diff --git a/resource-manager/aad/2021-05-01/domainservices/id_domainservice.go b/resource-manager/aad/2021-05-01/domainservices/id_domainservice.go index f84e9fbeb22..ee4bf900d3b 100644 --- a/resource-manager/aad/2021-05-01/domainservices/id_domainservice.go +++ b/resource-manager/aad/2021-05-01/domainservices/id_domainservice.go @@ -36,19 +36,9 @@ func ParseDomainServiceID(input string) (*DomainServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DomainServiceId{} - - 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.DomainServiceName, ok = parsed.Parsed["domainServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDomainServiceIDInsensitively(input string) (*DomainServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DomainServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DomainServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DomainServiceName, ok = parsed.Parsed["domainServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainServiceName", *parsed) + if id.DomainServiceName, ok = input.Parsed["domainServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "domainServiceName", input) } - return &id, nil + return nil } // ValidateDomainServiceID checks that 'input' can be parsed as a Domain Service ID diff --git a/resource-manager/aad/2021-05-01/oucontainer/id_domainservice.go b/resource-manager/aad/2021-05-01/oucontainer/id_domainservice.go index 8f4bf1bd7f7..0d6cbb0bd15 100644 --- a/resource-manager/aad/2021-05-01/oucontainer/id_domainservice.go +++ b/resource-manager/aad/2021-05-01/oucontainer/id_domainservice.go @@ -36,19 +36,9 @@ func ParseDomainServiceID(input string) (*DomainServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DomainServiceId{} - - 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.DomainServiceName, ok = parsed.Parsed["domainServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDomainServiceIDInsensitively(input string) (*DomainServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DomainServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DomainServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DomainServiceName, ok = parsed.Parsed["domainServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainServiceName", *parsed) + if id.DomainServiceName, ok = input.Parsed["domainServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "domainServiceName", input) } - return &id, nil + return nil } // ValidateDomainServiceID checks that 'input' can be parsed as a Domain Service ID diff --git a/resource-manager/aad/2021-05-01/oucontainer/id_oucontainer.go b/resource-manager/aad/2021-05-01/oucontainer/id_oucontainer.go index 1c154f61b79..1c29d863399 100644 --- a/resource-manager/aad/2021-05-01/oucontainer/id_oucontainer.go +++ b/resource-manager/aad/2021-05-01/oucontainer/id_oucontainer.go @@ -38,23 +38,9 @@ func ParseOuContainerID(input string) (*OuContainerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OuContainerId{} - - 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.DomainServiceName, ok = parsed.Parsed["domainServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainServiceName", *parsed) - } - - if id.OuContainerName, ok = parsed.Parsed["ouContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ouContainerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseOuContainerIDInsensitively(input string) (*OuContainerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OuContainerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OuContainerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DomainServiceName, ok = parsed.Parsed["domainServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainServiceName", *parsed) + if id.DomainServiceName, ok = input.Parsed["domainServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "domainServiceName", input) } - if id.OuContainerName, ok = parsed.Parsed["ouContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ouContainerName", *parsed) + if id.OuContainerName, ok = input.Parsed["ouContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ouContainerName", input) } - return &id, nil + return nil } // ValidateOuContainerID checks that 'input' can be parsed as a Ou Container ID diff --git a/resource-manager/aadb2c/2021-04-01-preview/tenants/id_b2cdirectory.go b/resource-manager/aadb2c/2021-04-01-preview/tenants/id_b2cdirectory.go index 034bf68ba42..07b6b5c65c0 100644 --- a/resource-manager/aadb2c/2021-04-01-preview/tenants/id_b2cdirectory.go +++ b/resource-manager/aadb2c/2021-04-01-preview/tenants/id_b2cdirectory.go @@ -36,19 +36,9 @@ func ParseB2CDirectoryID(input string) (*B2CDirectoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := B2CDirectoryId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroup", *parsed) - } - - if id.DirectoryName, ok = parsed.Parsed["directoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "directoryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseB2CDirectoryIDInsensitively(input string) (*B2CDirectoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := B2CDirectoryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *B2CDirectoryId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroup", *parsed) + if id.ResourceGroup, ok = input.Parsed["resourceGroup"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroup", input) } - if id.DirectoryName, ok = parsed.Parsed["directoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "directoryName", *parsed) + if id.DirectoryName, ok = input.Parsed["directoryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "directoryName", input) } - return &id, nil + return nil } // ValidateB2CDirectoryID checks that 'input' can be parsed as a B 2 C Directory ID diff --git a/resource-manager/advisor/2020-01-01/generaterecommendations/id_generaterecommendation.go b/resource-manager/advisor/2020-01-01/generaterecommendations/id_generaterecommendation.go index d08dbf6d7f3..8f08480dbc0 100644 --- a/resource-manager/advisor/2020-01-01/generaterecommendations/id_generaterecommendation.go +++ b/resource-manager/advisor/2020-01-01/generaterecommendations/id_generaterecommendation.go @@ -34,15 +34,9 @@ func ParseGenerateRecommendationID(input string) (*GenerateRecommendationId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GenerateRecommendationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseGenerateRecommendationIDInsensitively(input string) (*GenerateRecommen return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GenerateRecommendationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *GenerateRecommendationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if id.OperationId, ok = input.Parsed["operationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "operationId", input) } - return &id, nil + return nil } // ValidateGenerateRecommendationID checks that 'input' can be parsed as a Generate Recommendation ID diff --git a/resource-manager/advisor/2020-01-01/getrecommendations/id_scopedrecommendation.go b/resource-manager/advisor/2020-01-01/getrecommendations/id_scopedrecommendation.go index fc0c5f37014..5c26532aa4a 100644 --- a/resource-manager/advisor/2020-01-01/getrecommendations/id_scopedrecommendation.go +++ b/resource-manager/advisor/2020-01-01/getrecommendations/id_scopedrecommendation.go @@ -34,15 +34,9 @@ func ParseScopedRecommendationID(input string) (*ScopedRecommendationId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedRecommendationId{} - - if id.ResourceUri, ok = parsed.Parsed["resourceUri"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceUri", *parsed) - } - - if id.RecommendationId, ok = parsed.Parsed["recommendationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recommendationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedRecommendationIDInsensitively(input string) (*ScopedRecommendati return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedRecommendationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ResourceUri, ok = parsed.Parsed["resourceUri"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceUri", *parsed) + return &id, nil +} + +func (id *ScopedRecommendationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ResourceUri, ok = input.Parsed["resourceUri"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceUri", input) } - if id.RecommendationId, ok = parsed.Parsed["recommendationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recommendationId", *parsed) + if id.RecommendationId, ok = input.Parsed["recommendationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "recommendationId", input) } - return &id, nil + return nil } // ValidateScopedRecommendationID checks that 'input' can be parsed as a Scoped Recommendation ID diff --git a/resource-manager/advisor/2020-01-01/metadata/id_metadata.go b/resource-manager/advisor/2020-01-01/metadata/id_metadata.go index 4399da1b7a1..3370f131a41 100644 --- a/resource-manager/advisor/2020-01-01/metadata/id_metadata.go +++ b/resource-manager/advisor/2020-01-01/metadata/id_metadata.go @@ -32,11 +32,9 @@ func ParseMetadataID(input string) (*MetadataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MetadataId{} - - if id.MetadataName, ok = parsed.Parsed["metadataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "metadataName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseMetadataIDInsensitively(input string) (*MetadataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MetadataId{} - - if id.MetadataName, ok = parsed.Parsed["metadataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "metadataName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *MetadataId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.MetadataName, ok = input.Parsed["metadataName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "metadataName", input) + } + + return nil +} + // ValidateMetadataID checks that 'input' can be parsed as a Metadata ID func ValidateMetadataID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/advisor/2020-01-01/suppressions/id_scopedsuppression.go b/resource-manager/advisor/2020-01-01/suppressions/id_scopedsuppression.go index f589c85ebce..a9971eabca0 100644 --- a/resource-manager/advisor/2020-01-01/suppressions/id_scopedsuppression.go +++ b/resource-manager/advisor/2020-01-01/suppressions/id_scopedsuppression.go @@ -36,19 +36,9 @@ func ParseScopedSuppressionID(input string) (*ScopedSuppressionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedSuppressionId{} - - if id.ResourceUri, ok = parsed.Parsed["resourceUri"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceUri", *parsed) - } - - if id.RecommendationId, ok = parsed.Parsed["recommendationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recommendationId", *parsed) - } - - if id.SuppressionName, ok = parsed.Parsed["suppressionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "suppressionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseScopedSuppressionIDInsensitively(input string) (*ScopedSuppressionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedSuppressionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.ResourceUri, ok = parsed.Parsed["resourceUri"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceUri", *parsed) +func (id *ScopedSuppressionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ResourceUri, ok = input.Parsed["resourceUri"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceUri", input) } - if id.RecommendationId, ok = parsed.Parsed["recommendationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recommendationId", *parsed) + if id.RecommendationId, ok = input.Parsed["recommendationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "recommendationId", input) } - if id.SuppressionName, ok = parsed.Parsed["suppressionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "suppressionName", *parsed) + if id.SuppressionName, ok = input.Parsed["suppressionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "suppressionName", input) } - return &id, nil + return nil } // ValidateScopedSuppressionID checks that 'input' can be parsed as a Scoped Suppression ID diff --git a/resource-manager/advisor/2022-10-01/advisorscore/id_advisorscore.go b/resource-manager/advisor/2022-10-01/advisorscore/id_advisorscore.go index c5c2f632b3b..1c8b8f9eb3c 100644 --- a/resource-manager/advisor/2022-10-01/advisorscore/id_advisorscore.go +++ b/resource-manager/advisor/2022-10-01/advisorscore/id_advisorscore.go @@ -34,15 +34,9 @@ func ParseAdvisorScoreID(input string) (*AdvisorScoreId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AdvisorScoreId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.AdvisorScoreName, ok = parsed.Parsed["advisorScoreName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "advisorScoreName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseAdvisorScoreIDInsensitively(input string) (*AdvisorScoreId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AdvisorScoreId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *AdvisorScoreId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.AdvisorScoreName, ok = parsed.Parsed["advisorScoreName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "advisorScoreName", *parsed) + if id.AdvisorScoreName, ok = input.Parsed["advisorScoreName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "advisorScoreName", input) } - return &id, nil + return nil } // ValidateAdvisorScoreID checks that 'input' can be parsed as a Advisor Score ID diff --git a/resource-manager/advisor/2022-10-01/generaterecommendations/id_generaterecommendation.go b/resource-manager/advisor/2022-10-01/generaterecommendations/id_generaterecommendation.go index d08dbf6d7f3..8f08480dbc0 100644 --- a/resource-manager/advisor/2022-10-01/generaterecommendations/id_generaterecommendation.go +++ b/resource-manager/advisor/2022-10-01/generaterecommendations/id_generaterecommendation.go @@ -34,15 +34,9 @@ func ParseGenerateRecommendationID(input string) (*GenerateRecommendationId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GenerateRecommendationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseGenerateRecommendationIDInsensitively(input string) (*GenerateRecommen return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GenerateRecommendationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *GenerateRecommendationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if id.OperationId, ok = input.Parsed["operationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "operationId", input) } - return &id, nil + return nil } // ValidateGenerateRecommendationID checks that 'input' can be parsed as a Generate Recommendation ID diff --git a/resource-manager/advisor/2022-10-01/getrecommendations/id_scopedrecommendation.go b/resource-manager/advisor/2022-10-01/getrecommendations/id_scopedrecommendation.go index fc0c5f37014..5c26532aa4a 100644 --- a/resource-manager/advisor/2022-10-01/getrecommendations/id_scopedrecommendation.go +++ b/resource-manager/advisor/2022-10-01/getrecommendations/id_scopedrecommendation.go @@ -34,15 +34,9 @@ func ParseScopedRecommendationID(input string) (*ScopedRecommendationId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedRecommendationId{} - - if id.ResourceUri, ok = parsed.Parsed["resourceUri"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceUri", *parsed) - } - - if id.RecommendationId, ok = parsed.Parsed["recommendationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recommendationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedRecommendationIDInsensitively(input string) (*ScopedRecommendati return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedRecommendationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ResourceUri, ok = parsed.Parsed["resourceUri"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceUri", *parsed) + return &id, nil +} + +func (id *ScopedRecommendationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ResourceUri, ok = input.Parsed["resourceUri"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceUri", input) } - if id.RecommendationId, ok = parsed.Parsed["recommendationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recommendationId", *parsed) + if id.RecommendationId, ok = input.Parsed["recommendationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "recommendationId", input) } - return &id, nil + return nil } // ValidateScopedRecommendationID checks that 'input' can be parsed as a Scoped Recommendation ID diff --git a/resource-manager/advisor/2022-10-01/metadata/id_metadata.go b/resource-manager/advisor/2022-10-01/metadata/id_metadata.go index 4399da1b7a1..3370f131a41 100644 --- a/resource-manager/advisor/2022-10-01/metadata/id_metadata.go +++ b/resource-manager/advisor/2022-10-01/metadata/id_metadata.go @@ -32,11 +32,9 @@ func ParseMetadataID(input string) (*MetadataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MetadataId{} - - if id.MetadataName, ok = parsed.Parsed["metadataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "metadataName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseMetadataIDInsensitively(input string) (*MetadataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MetadataId{} - - if id.MetadataName, ok = parsed.Parsed["metadataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "metadataName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *MetadataId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.MetadataName, ok = input.Parsed["metadataName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "metadataName", input) + } + + return nil +} + // ValidateMetadataID checks that 'input' can be parsed as a Metadata ID func ValidateMetadataID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/advisor/2022-10-01/suppressions/id_scopedsuppression.go b/resource-manager/advisor/2022-10-01/suppressions/id_scopedsuppression.go index f589c85ebce..a9971eabca0 100644 --- a/resource-manager/advisor/2022-10-01/suppressions/id_scopedsuppression.go +++ b/resource-manager/advisor/2022-10-01/suppressions/id_scopedsuppression.go @@ -36,19 +36,9 @@ func ParseScopedSuppressionID(input string) (*ScopedSuppressionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedSuppressionId{} - - if id.ResourceUri, ok = parsed.Parsed["resourceUri"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceUri", *parsed) - } - - if id.RecommendationId, ok = parsed.Parsed["recommendationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recommendationId", *parsed) - } - - if id.SuppressionName, ok = parsed.Parsed["suppressionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "suppressionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseScopedSuppressionIDInsensitively(input string) (*ScopedSuppressionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedSuppressionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.ResourceUri, ok = parsed.Parsed["resourceUri"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceUri", *parsed) +func (id *ScopedSuppressionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ResourceUri, ok = input.Parsed["resourceUri"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceUri", input) } - if id.RecommendationId, ok = parsed.Parsed["recommendationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recommendationId", *parsed) + if id.RecommendationId, ok = input.Parsed["recommendationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "recommendationId", input) } - if id.SuppressionName, ok = parsed.Parsed["suppressionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "suppressionName", *parsed) + if id.SuppressionName, ok = input.Parsed["suppressionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "suppressionName", input) } - return &id, nil + return nil } // ValidateScopedSuppressionID checks that 'input' can be parsed as a Scoped Suppression ID diff --git a/resource-manager/advisor/2023-01-01/advisorscore/id_advisorscore.go b/resource-manager/advisor/2023-01-01/advisorscore/id_advisorscore.go index c5c2f632b3b..1c8b8f9eb3c 100644 --- a/resource-manager/advisor/2023-01-01/advisorscore/id_advisorscore.go +++ b/resource-manager/advisor/2023-01-01/advisorscore/id_advisorscore.go @@ -34,15 +34,9 @@ func ParseAdvisorScoreID(input string) (*AdvisorScoreId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AdvisorScoreId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.AdvisorScoreName, ok = parsed.Parsed["advisorScoreName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "advisorScoreName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseAdvisorScoreIDInsensitively(input string) (*AdvisorScoreId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AdvisorScoreId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *AdvisorScoreId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.AdvisorScoreName, ok = parsed.Parsed["advisorScoreName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "advisorScoreName", *parsed) + if id.AdvisorScoreName, ok = input.Parsed["advisorScoreName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "advisorScoreName", input) } - return &id, nil + return nil } // ValidateAdvisorScoreID checks that 'input' can be parsed as a Advisor Score ID diff --git a/resource-manager/advisor/2023-01-01/generaterecommendations/id_generaterecommendation.go b/resource-manager/advisor/2023-01-01/generaterecommendations/id_generaterecommendation.go index d08dbf6d7f3..8f08480dbc0 100644 --- a/resource-manager/advisor/2023-01-01/generaterecommendations/id_generaterecommendation.go +++ b/resource-manager/advisor/2023-01-01/generaterecommendations/id_generaterecommendation.go @@ -34,15 +34,9 @@ func ParseGenerateRecommendationID(input string) (*GenerateRecommendationId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GenerateRecommendationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseGenerateRecommendationIDInsensitively(input string) (*GenerateRecommen return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GenerateRecommendationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *GenerateRecommendationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if id.OperationId, ok = input.Parsed["operationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "operationId", input) } - return &id, nil + return nil } // ValidateGenerateRecommendationID checks that 'input' can be parsed as a Generate Recommendation ID diff --git a/resource-manager/advisor/2023-01-01/getrecommendations/id_scopedrecommendation.go b/resource-manager/advisor/2023-01-01/getrecommendations/id_scopedrecommendation.go index fc0c5f37014..5c26532aa4a 100644 --- a/resource-manager/advisor/2023-01-01/getrecommendations/id_scopedrecommendation.go +++ b/resource-manager/advisor/2023-01-01/getrecommendations/id_scopedrecommendation.go @@ -34,15 +34,9 @@ func ParseScopedRecommendationID(input string) (*ScopedRecommendationId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedRecommendationId{} - - if id.ResourceUri, ok = parsed.Parsed["resourceUri"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceUri", *parsed) - } - - if id.RecommendationId, ok = parsed.Parsed["recommendationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recommendationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedRecommendationIDInsensitively(input string) (*ScopedRecommendati return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedRecommendationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ResourceUri, ok = parsed.Parsed["resourceUri"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceUri", *parsed) + return &id, nil +} + +func (id *ScopedRecommendationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ResourceUri, ok = input.Parsed["resourceUri"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceUri", input) } - if id.RecommendationId, ok = parsed.Parsed["recommendationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recommendationId", *parsed) + if id.RecommendationId, ok = input.Parsed["recommendationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "recommendationId", input) } - return &id, nil + return nil } // ValidateScopedRecommendationID checks that 'input' can be parsed as a Scoped Recommendation ID diff --git a/resource-manager/advisor/2023-01-01/metadata/id_metadata.go b/resource-manager/advisor/2023-01-01/metadata/id_metadata.go index 4399da1b7a1..3370f131a41 100644 --- a/resource-manager/advisor/2023-01-01/metadata/id_metadata.go +++ b/resource-manager/advisor/2023-01-01/metadata/id_metadata.go @@ -32,11 +32,9 @@ func ParseMetadataID(input string) (*MetadataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MetadataId{} - - if id.MetadataName, ok = parsed.Parsed["metadataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "metadataName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseMetadataIDInsensitively(input string) (*MetadataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MetadataId{} - - if id.MetadataName, ok = parsed.Parsed["metadataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "metadataName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *MetadataId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.MetadataName, ok = input.Parsed["metadataName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "metadataName", input) + } + + return nil +} + // ValidateMetadataID checks that 'input' can be parsed as a Metadata ID func ValidateMetadataID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/advisor/2023-01-01/suppressions/id_scopedsuppression.go b/resource-manager/advisor/2023-01-01/suppressions/id_scopedsuppression.go index f589c85ebce..a9971eabca0 100644 --- a/resource-manager/advisor/2023-01-01/suppressions/id_scopedsuppression.go +++ b/resource-manager/advisor/2023-01-01/suppressions/id_scopedsuppression.go @@ -36,19 +36,9 @@ func ParseScopedSuppressionID(input string) (*ScopedSuppressionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedSuppressionId{} - - if id.ResourceUri, ok = parsed.Parsed["resourceUri"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceUri", *parsed) - } - - if id.RecommendationId, ok = parsed.Parsed["recommendationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recommendationId", *parsed) - } - - if id.SuppressionName, ok = parsed.Parsed["suppressionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "suppressionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseScopedSuppressionIDInsensitively(input string) (*ScopedSuppressionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedSuppressionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.ResourceUri, ok = parsed.Parsed["resourceUri"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceUri", *parsed) +func (id *ScopedSuppressionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ResourceUri, ok = input.Parsed["resourceUri"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceUri", input) } - if id.RecommendationId, ok = parsed.Parsed["recommendationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recommendationId", *parsed) + if id.RecommendationId, ok = input.Parsed["recommendationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "recommendationId", input) } - if id.SuppressionName, ok = parsed.Parsed["suppressionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "suppressionName", *parsed) + if id.SuppressionName, ok = input.Parsed["suppressionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "suppressionName", input) } - return &id, nil + return nil } // ValidateScopedSuppressionID checks that 'input' can be parsed as a Scoped Suppression ID diff --git a/resource-manager/alertsmanagement/2019-05-05-preview/actionrules/id_actionrule.go b/resource-manager/alertsmanagement/2019-05-05-preview/actionrules/id_actionrule.go index 5c1350ae99b..71ceeb73785 100644 --- a/resource-manager/alertsmanagement/2019-05-05-preview/actionrules/id_actionrule.go +++ b/resource-manager/alertsmanagement/2019-05-05-preview/actionrules/id_actionrule.go @@ -36,19 +36,9 @@ func ParseActionRuleID(input string) (*ActionRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ActionRuleId{} - - 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.ActionRuleName, ok = parsed.Parsed["actionRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseActionRuleIDInsensitively(input string) (*ActionRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ActionRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ActionRuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ActionRuleName, ok = parsed.Parsed["actionRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionRuleName", *parsed) + if id.ActionRuleName, ok = input.Parsed["actionRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "actionRuleName", input) } - return &id, nil + return nil } // ValidateActionRuleID checks that 'input' can be parsed as a Action Rule ID diff --git a/resource-manager/alertsmanagement/2019-05-05-preview/alertsmanagements/id_alert.go b/resource-manager/alertsmanagement/2019-05-05-preview/alertsmanagements/id_alert.go index d824db0f21c..0d3ca5b581f 100644 --- a/resource-manager/alertsmanagement/2019-05-05-preview/alertsmanagements/id_alert.go +++ b/resource-manager/alertsmanagement/2019-05-05-preview/alertsmanagements/id_alert.go @@ -34,15 +34,9 @@ func ParseAlertID(input string) (*AlertId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.AlertId, ok = parsed.Parsed["alertId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "alertId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseAlertIDInsensitively(input string) (*AlertId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *AlertId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.AlertId, ok = parsed.Parsed["alertId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "alertId", *parsed) + if id.AlertId, ok = input.Parsed["alertId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "alertId", input) } - return &id, nil + return nil } // ValidateAlertID checks that 'input' can be parsed as a Alert ID diff --git a/resource-manager/alertsmanagement/2019-05-05-preview/smartgroups/id_smartgroup.go b/resource-manager/alertsmanagement/2019-05-05-preview/smartgroups/id_smartgroup.go index 69282a0551f..2bb9f15ccfe 100644 --- a/resource-manager/alertsmanagement/2019-05-05-preview/smartgroups/id_smartgroup.go +++ b/resource-manager/alertsmanagement/2019-05-05-preview/smartgroups/id_smartgroup.go @@ -34,15 +34,9 @@ func ParseSmartGroupID(input string) (*SmartGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SmartGroupId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.SmartGroupId, ok = parsed.Parsed["smartGroupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "smartGroupId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseSmartGroupIDInsensitively(input string) (*SmartGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SmartGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SmartGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.SmartGroupId, ok = parsed.Parsed["smartGroupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "smartGroupId", *parsed) + if id.SmartGroupId, ok = input.Parsed["smartGroupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "smartGroupId", input) } - return &id, nil + return nil } // ValidateSmartGroupID checks that 'input' can be parsed as a Smart Group ID diff --git a/resource-manager/alertsmanagement/2019-06-01/smartdetectoralertrules/id_smartdetectoralertrule.go b/resource-manager/alertsmanagement/2019-06-01/smartdetectoralertrules/id_smartdetectoralertrule.go index f5e9a2d2b8d..afe15c15d53 100644 --- a/resource-manager/alertsmanagement/2019-06-01/smartdetectoralertrules/id_smartdetectoralertrule.go +++ b/resource-manager/alertsmanagement/2019-06-01/smartdetectoralertrules/id_smartdetectoralertrule.go @@ -36,19 +36,9 @@ func ParseSmartDetectorAlertRuleID(input string) (*SmartDetectorAlertRuleId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SmartDetectorAlertRuleId{} - - 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.SmartDetectorAlertRuleName, ok = parsed.Parsed["smartDetectorAlertRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "smartDetectorAlertRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSmartDetectorAlertRuleIDInsensitively(input string) (*SmartDetectorAle return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SmartDetectorAlertRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SmartDetectorAlertRuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SmartDetectorAlertRuleName, ok = parsed.Parsed["smartDetectorAlertRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "smartDetectorAlertRuleName", *parsed) + if id.SmartDetectorAlertRuleName, ok = input.Parsed["smartDetectorAlertRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "smartDetectorAlertRuleName", input) } - return &id, nil + return nil } // ValidateSmartDetectorAlertRuleID checks that 'input' can be parsed as a Smart Detector Alert Rule ID diff --git a/resource-manager/alertsmanagement/2021-08-08/alertprocessingrules/id_actionrule.go b/resource-manager/alertsmanagement/2021-08-08/alertprocessingrules/id_actionrule.go index a8adc5404d3..298ec2bc6f4 100644 --- a/resource-manager/alertsmanagement/2021-08-08/alertprocessingrules/id_actionrule.go +++ b/resource-manager/alertsmanagement/2021-08-08/alertprocessingrules/id_actionrule.go @@ -36,19 +36,9 @@ func ParseActionRuleID(input string) (*ActionRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ActionRuleId{} - - 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.ActionRuleName, ok = parsed.Parsed["actionRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseActionRuleIDInsensitively(input string) (*ActionRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ActionRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ActionRuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ActionRuleName, ok = parsed.Parsed["actionRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionRuleName", *parsed) + if id.ActionRuleName, ok = input.Parsed["actionRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "actionRuleName", input) } - return &id, nil + return nil } // ValidateActionRuleID checks that 'input' can be parsed as a Action Rule ID diff --git a/resource-manager/alertsmanagement/2023-03-01/prometheusrulegroups/id_prometheusrulegroup.go b/resource-manager/alertsmanagement/2023-03-01/prometheusrulegroups/id_prometheusrulegroup.go index 182aa1a5c08..f208c8b2695 100644 --- a/resource-manager/alertsmanagement/2023-03-01/prometheusrulegroups/id_prometheusrulegroup.go +++ b/resource-manager/alertsmanagement/2023-03-01/prometheusrulegroups/id_prometheusrulegroup.go @@ -36,19 +36,9 @@ func ParsePrometheusRuleGroupID(input string) (*PrometheusRuleGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrometheusRuleGroupId{} - - 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.PrometheusRuleGroupName, ok = parsed.Parsed["prometheusRuleGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "prometheusRuleGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePrometheusRuleGroupIDInsensitively(input string) (*PrometheusRuleGroup return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrometheusRuleGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PrometheusRuleGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrometheusRuleGroupName, ok = parsed.Parsed["prometheusRuleGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "prometheusRuleGroupName", *parsed) + if id.PrometheusRuleGroupName, ok = input.Parsed["prometheusRuleGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "prometheusRuleGroupName", input) } - return &id, nil + return nil } // ValidatePrometheusRuleGroupID checks that 'input' can be parsed as a Prometheus Rule Group ID diff --git a/resource-manager/analysisservices/2017-08-01/servers/id_location.go b/resource-manager/analysisservices/2017-08-01/servers/id_location.go index fcb439a960f..78c6c740211 100644 --- a/resource-manager/analysisservices/2017-08-01/servers/id_location.go +++ b/resource-manager/analysisservices/2017-08-01/servers/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/analysisservices/2017-08-01/servers/id_server.go b/resource-manager/analysisservices/2017-08-01/servers/id_server.go index fa7bc4cec62..8305f4a5216 100644 --- a/resource-manager/analysisservices/2017-08-01/servers/id_server.go +++ b/resource-manager/analysisservices/2017-08-01/servers/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/apimanagement/2021-08-01/api/id_api.go b/resource-manager/apimanagement/2021-08-01/api/id_api.go index b76a03a3ca4..7a0a77e48ee 100644 --- a/resource-manager/apimanagement/2021-08-01/api/id_api.go +++ b/resource-manager/apimanagement/2021-08-01/api/id_api.go @@ -38,23 +38,9 @@ func ParseApiID(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiIDInsensitively(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateApiID checks that 'input' can be parsed as a Api ID diff --git a/resource-manager/apimanagement/2021-08-01/api/id_service.go b/resource-manager/apimanagement/2021-08-01/api/id_service.go index c8e90bbf804..6a1e3ffbf4c 100644 --- a/resource-manager/apimanagement/2021-08-01/api/id_service.go +++ b/resource-manager/apimanagement/2021-08-01/api/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2021-08-01/apidiagnostic/id_api.go b/resource-manager/apimanagement/2021-08-01/apidiagnostic/id_api.go index 458b69d35bb..96657952393 100644 --- a/resource-manager/apimanagement/2021-08-01/apidiagnostic/id_api.go +++ b/resource-manager/apimanagement/2021-08-01/apidiagnostic/id_api.go @@ -38,23 +38,9 @@ func ParseApiID(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiIDInsensitively(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateApiID checks that 'input' can be parsed as a Api ID diff --git a/resource-manager/apimanagement/2021-08-01/apidiagnostic/id_apidiagnostic.go b/resource-manager/apimanagement/2021-08-01/apidiagnostic/id_apidiagnostic.go index c2dc08baea8..0e3e95f4369 100644 --- a/resource-manager/apimanagement/2021-08-01/apidiagnostic/id_apidiagnostic.go +++ b/resource-manager/apimanagement/2021-08-01/apidiagnostic/id_apidiagnostic.go @@ -40,27 +40,9 @@ func ParseApiDiagnosticID(input string) (*ApiDiagnosticId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiDiagnosticId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.DiagnosticId, ok = parsed.Parsed["diagnosticId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseApiDiagnosticIDInsensitively(input string) (*ApiDiagnosticId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiDiagnosticId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ApiDiagnosticId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.DiagnosticId, ok = parsed.Parsed["diagnosticId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticId", *parsed) + if id.DiagnosticId, ok = input.Parsed["diagnosticId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "diagnosticId", input) } - return &id, nil + return nil } // ValidateApiDiagnosticID checks that 'input' can be parsed as a Api Diagnostic ID diff --git a/resource-manager/apimanagement/2021-08-01/apiissue/id_api.go b/resource-manager/apimanagement/2021-08-01/apiissue/id_api.go index a53042d4cec..133174ac6ae 100644 --- a/resource-manager/apimanagement/2021-08-01/apiissue/id_api.go +++ b/resource-manager/apimanagement/2021-08-01/apiissue/id_api.go @@ -38,23 +38,9 @@ func ParseApiID(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiIDInsensitively(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateApiID checks that 'input' can be parsed as a Api ID diff --git a/resource-manager/apimanagement/2021-08-01/apiissue/id_apiissue.go b/resource-manager/apimanagement/2021-08-01/apiissue/id_apiissue.go index f5437406ba3..640acfc37da 100644 --- a/resource-manager/apimanagement/2021-08-01/apiissue/id_apiissue.go +++ b/resource-manager/apimanagement/2021-08-01/apiissue/id_apiissue.go @@ -40,27 +40,9 @@ func ParseApiIssueID(input string) (*ApiIssueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiIssueId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.IssueId, ok = parsed.Parsed["issueId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "issueId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseApiIssueIDInsensitively(input string) (*ApiIssueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiIssueId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ApiIssueId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.IssueId, ok = parsed.Parsed["issueId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "issueId", *parsed) + if id.IssueId, ok = input.Parsed["issueId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "issueId", input) } - return &id, nil + return nil } // ValidateApiIssueID checks that 'input' can be parsed as a Api Issue ID diff --git a/resource-manager/apimanagement/2021-08-01/apiissueattachment/id_apiissue.go b/resource-manager/apimanagement/2021-08-01/apiissueattachment/id_apiissue.go index 7bb616b8c62..c4f8ca725af 100644 --- a/resource-manager/apimanagement/2021-08-01/apiissueattachment/id_apiissue.go +++ b/resource-manager/apimanagement/2021-08-01/apiissueattachment/id_apiissue.go @@ -40,27 +40,9 @@ func ParseApiIssueID(input string) (*ApiIssueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiIssueId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.IssueId, ok = parsed.Parsed["issueId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "issueId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseApiIssueIDInsensitively(input string) (*ApiIssueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiIssueId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ApiIssueId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.IssueId, ok = parsed.Parsed["issueId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "issueId", *parsed) + if id.IssueId, ok = input.Parsed["issueId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "issueId", input) } - return &id, nil + return nil } // ValidateApiIssueID checks that 'input' can be parsed as a Api Issue ID diff --git a/resource-manager/apimanagement/2021-08-01/apiissueattachment/id_attachment.go b/resource-manager/apimanagement/2021-08-01/apiissueattachment/id_attachment.go index 201f3b7f724..7d336e46218 100644 --- a/resource-manager/apimanagement/2021-08-01/apiissueattachment/id_attachment.go +++ b/resource-manager/apimanagement/2021-08-01/apiissueattachment/id_attachment.go @@ -42,31 +42,9 @@ func ParseAttachmentID(input string) (*AttachmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AttachmentId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.IssueId, ok = parsed.Parsed["issueId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "issueId", *parsed) - } - - if id.AttachmentId, ok = parsed.Parsed["attachmentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "attachmentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseAttachmentIDInsensitively(input string) (*AttachmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AttachmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AttachmentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.IssueId, ok = parsed.Parsed["issueId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "issueId", *parsed) + if id.IssueId, ok = input.Parsed["issueId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "issueId", input) } - if id.AttachmentId, ok = parsed.Parsed["attachmentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "attachmentId", *parsed) + if id.AttachmentId, ok = input.Parsed["attachmentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "attachmentId", input) } - return &id, nil + return nil } // ValidateAttachmentID checks that 'input' can be parsed as a Attachment ID diff --git a/resource-manager/apimanagement/2021-08-01/apiissuecomment/id_apiissue.go b/resource-manager/apimanagement/2021-08-01/apiissuecomment/id_apiissue.go index fa985059e13..6123b4217fc 100644 --- a/resource-manager/apimanagement/2021-08-01/apiissuecomment/id_apiissue.go +++ b/resource-manager/apimanagement/2021-08-01/apiissuecomment/id_apiissue.go @@ -40,27 +40,9 @@ func ParseApiIssueID(input string) (*ApiIssueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiIssueId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.IssueId, ok = parsed.Parsed["issueId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "issueId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseApiIssueIDInsensitively(input string) (*ApiIssueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiIssueId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ApiIssueId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.IssueId, ok = parsed.Parsed["issueId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "issueId", *parsed) + if id.IssueId, ok = input.Parsed["issueId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "issueId", input) } - return &id, nil + return nil } // ValidateApiIssueID checks that 'input' can be parsed as a Api Issue ID diff --git a/resource-manager/apimanagement/2021-08-01/apiissuecomment/id_comment.go b/resource-manager/apimanagement/2021-08-01/apiissuecomment/id_comment.go index 4d6e5795faf..eca61943506 100644 --- a/resource-manager/apimanagement/2021-08-01/apiissuecomment/id_comment.go +++ b/resource-manager/apimanagement/2021-08-01/apiissuecomment/id_comment.go @@ -42,31 +42,9 @@ func ParseCommentID(input string) (*CommentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommentId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.IssueId, ok = parsed.Parsed["issueId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "issueId", *parsed) - } - - if id.CommentId, ok = parsed.Parsed["commentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "commentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseCommentIDInsensitively(input string) (*CommentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CommentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.IssueId, ok = parsed.Parsed["issueId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "issueId", *parsed) + if id.IssueId, ok = input.Parsed["issueId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "issueId", input) } - if id.CommentId, ok = parsed.Parsed["commentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "commentId", *parsed) + if id.CommentId, ok = input.Parsed["commentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "commentId", input) } - return &id, nil + return nil } // ValidateCommentID checks that 'input' can be parsed as a Comment ID diff --git a/resource-manager/apimanagement/2021-08-01/apimanagementservice/id_service.go b/resource-manager/apimanagement/2021-08-01/apimanagementservice/id_service.go index 95a62caed84..eccb86b056b 100644 --- a/resource-manager/apimanagement/2021-08-01/apimanagementservice/id_service.go +++ b/resource-manager/apimanagement/2021-08-01/apimanagementservice/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2021-08-01/apimanagementserviceskus/id_service.go b/resource-manager/apimanagement/2021-08-01/apimanagementserviceskus/id_service.go index d600f219ae6..b5afcf417bc 100644 --- a/resource-manager/apimanagement/2021-08-01/apimanagementserviceskus/id_service.go +++ b/resource-manager/apimanagement/2021-08-01/apimanagementserviceskus/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2021-08-01/apioperation/id_api.go b/resource-manager/apimanagement/2021-08-01/apioperation/id_api.go index 79a7327f622..43445741f29 100644 --- a/resource-manager/apimanagement/2021-08-01/apioperation/id_api.go +++ b/resource-manager/apimanagement/2021-08-01/apioperation/id_api.go @@ -38,23 +38,9 @@ func ParseApiID(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiIDInsensitively(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateApiID checks that 'input' can be parsed as a Api ID diff --git a/resource-manager/apimanagement/2021-08-01/apioperation/id_operation.go b/resource-manager/apimanagement/2021-08-01/apioperation/id_operation.go index de3ff9a53f6..438a2d60c02 100644 --- a/resource-manager/apimanagement/2021-08-01/apioperation/id_operation.go +++ b/resource-manager/apimanagement/2021-08-01/apioperation/id_operation.go @@ -40,27 +40,9 @@ func ParseOperationID(input string) (*OperationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseOperationIDInsensitively(input string) (*OperationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *OperationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if id.OperationId, ok = input.Parsed["operationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "operationId", input) } - return &id, nil + return nil } // ValidateOperationID checks that 'input' can be parsed as a Operation ID diff --git a/resource-manager/apimanagement/2021-08-01/apioperationpolicy/id_operation.go b/resource-manager/apimanagement/2021-08-01/apioperationpolicy/id_operation.go index 7cb0b5a54c7..4225aa7d778 100644 --- a/resource-manager/apimanagement/2021-08-01/apioperationpolicy/id_operation.go +++ b/resource-manager/apimanagement/2021-08-01/apioperationpolicy/id_operation.go @@ -40,27 +40,9 @@ func ParseOperationID(input string) (*OperationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseOperationIDInsensitively(input string) (*OperationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *OperationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if id.OperationId, ok = input.Parsed["operationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "operationId", input) } - return &id, nil + return nil } // ValidateOperationID checks that 'input' can be parsed as a Operation ID diff --git a/resource-manager/apimanagement/2021-08-01/apioperationsbytag/id_api.go b/resource-manager/apimanagement/2021-08-01/apioperationsbytag/id_api.go index 61af7bc027a..3b65c86986d 100644 --- a/resource-manager/apimanagement/2021-08-01/apioperationsbytag/id_api.go +++ b/resource-manager/apimanagement/2021-08-01/apioperationsbytag/id_api.go @@ -38,23 +38,9 @@ func ParseApiID(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiIDInsensitively(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateApiID checks that 'input' can be parsed as a Api ID diff --git a/resource-manager/apimanagement/2021-08-01/apioperationtag/id_operation.go b/resource-manager/apimanagement/2021-08-01/apioperationtag/id_operation.go index 80dc723f21e..9ff2edc8bb0 100644 --- a/resource-manager/apimanagement/2021-08-01/apioperationtag/id_operation.go +++ b/resource-manager/apimanagement/2021-08-01/apioperationtag/id_operation.go @@ -40,27 +40,9 @@ func ParseOperationID(input string) (*OperationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseOperationIDInsensitively(input string) (*OperationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *OperationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if id.OperationId, ok = input.Parsed["operationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "operationId", input) } - return &id, nil + return nil } // ValidateOperationID checks that 'input' can be parsed as a Operation ID diff --git a/resource-manager/apimanagement/2021-08-01/apioperationtag/id_operationtag.go b/resource-manager/apimanagement/2021-08-01/apioperationtag/id_operationtag.go index 50b4b0f0385..86a6377d961 100644 --- a/resource-manager/apimanagement/2021-08-01/apioperationtag/id_operationtag.go +++ b/resource-manager/apimanagement/2021-08-01/apioperationtag/id_operationtag.go @@ -42,31 +42,9 @@ func ParseOperationTagID(input string) (*OperationTagId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationTagId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) - } - - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseOperationTagIDInsensitively(input string) (*OperationTagId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationTagId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *OperationTagId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if id.OperationId, ok = input.Parsed["operationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "operationId", input) } - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + if id.TagId, ok = input.Parsed["tagId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tagId", input) } - return &id, nil + return nil } // ValidateOperationTagID checks that 'input' can be parsed as a Operation Tag ID diff --git a/resource-manager/apimanagement/2021-08-01/apipolicy/id_api.go b/resource-manager/apimanagement/2021-08-01/apipolicy/id_api.go index fa2aa4893ac..e6bb0d4a498 100644 --- a/resource-manager/apimanagement/2021-08-01/apipolicy/id_api.go +++ b/resource-manager/apimanagement/2021-08-01/apipolicy/id_api.go @@ -38,23 +38,9 @@ func ParseApiID(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiIDInsensitively(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateApiID checks that 'input' can be parsed as a Api ID diff --git a/resource-manager/apimanagement/2021-08-01/apiproduct/id_api.go b/resource-manager/apimanagement/2021-08-01/apiproduct/id_api.go index 34d8a372398..fb8a7d9a979 100644 --- a/resource-manager/apimanagement/2021-08-01/apiproduct/id_api.go +++ b/resource-manager/apimanagement/2021-08-01/apiproduct/id_api.go @@ -38,23 +38,9 @@ func ParseApiID(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiIDInsensitively(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateApiID checks that 'input' can be parsed as a Api ID diff --git a/resource-manager/apimanagement/2021-08-01/apirelease/id_api.go b/resource-manager/apimanagement/2021-08-01/apirelease/id_api.go index 2859d3f4219..330da942f46 100644 --- a/resource-manager/apimanagement/2021-08-01/apirelease/id_api.go +++ b/resource-manager/apimanagement/2021-08-01/apirelease/id_api.go @@ -38,23 +38,9 @@ func ParseApiID(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiIDInsensitively(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateApiID checks that 'input' can be parsed as a Api ID diff --git a/resource-manager/apimanagement/2021-08-01/apirelease/id_release.go b/resource-manager/apimanagement/2021-08-01/apirelease/id_release.go index a05148dd45c..3cbe29fbd02 100644 --- a/resource-manager/apimanagement/2021-08-01/apirelease/id_release.go +++ b/resource-manager/apimanagement/2021-08-01/apirelease/id_release.go @@ -40,27 +40,9 @@ func ParseReleaseID(input string) (*ReleaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReleaseId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.ReleaseId, ok = parsed.Parsed["releaseId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "releaseId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReleaseIDInsensitively(input string) (*ReleaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReleaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReleaseId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.ReleaseId, ok = parsed.Parsed["releaseId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "releaseId", *parsed) + if id.ReleaseId, ok = input.Parsed["releaseId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "releaseId", input) } - return &id, nil + return nil } // ValidateReleaseID checks that 'input' can be parsed as a Release ID diff --git a/resource-manager/apimanagement/2021-08-01/apirevision/id_api.go b/resource-manager/apimanagement/2021-08-01/apirevision/id_api.go index ecca30efbc4..d21321054a4 100644 --- a/resource-manager/apimanagement/2021-08-01/apirevision/id_api.go +++ b/resource-manager/apimanagement/2021-08-01/apirevision/id_api.go @@ -38,23 +38,9 @@ func ParseApiID(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiIDInsensitively(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateApiID checks that 'input' can be parsed as a Api ID diff --git a/resource-manager/apimanagement/2021-08-01/apisbytag/id_service.go b/resource-manager/apimanagement/2021-08-01/apisbytag/id_service.go index cabeab414cb..c51e286da4f 100644 --- a/resource-manager/apimanagement/2021-08-01/apisbytag/id_service.go +++ b/resource-manager/apimanagement/2021-08-01/apisbytag/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2021-08-01/apischema/id_api.go b/resource-manager/apimanagement/2021-08-01/apischema/id_api.go index f58e6b3b0fd..3cec3f2a149 100644 --- a/resource-manager/apimanagement/2021-08-01/apischema/id_api.go +++ b/resource-manager/apimanagement/2021-08-01/apischema/id_api.go @@ -38,23 +38,9 @@ func ParseApiID(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiIDInsensitively(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateApiID checks that 'input' can be parsed as a Api ID diff --git a/resource-manager/apimanagement/2021-08-01/apischema/id_apischema.go b/resource-manager/apimanagement/2021-08-01/apischema/id_apischema.go index 13017418f0c..2953ca314ba 100644 --- a/resource-manager/apimanagement/2021-08-01/apischema/id_apischema.go +++ b/resource-manager/apimanagement/2021-08-01/apischema/id_apischema.go @@ -40,27 +40,9 @@ func ParseApiSchemaID(input string) (*ApiSchemaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiSchemaId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.SchemaId, ok = parsed.Parsed["schemaId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseApiSchemaIDInsensitively(input string) (*ApiSchemaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiSchemaId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ApiSchemaId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.SchemaId, ok = parsed.Parsed["schemaId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaId", *parsed) + if id.SchemaId, ok = input.Parsed["schemaId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "schemaId", input) } - return &id, nil + return nil } // ValidateApiSchemaID checks that 'input' can be parsed as a Api Schema ID diff --git a/resource-manager/apimanagement/2021-08-01/apitag/id_api.go b/resource-manager/apimanagement/2021-08-01/apitag/id_api.go index 89fbccee1e6..c8afece467f 100644 --- a/resource-manager/apimanagement/2021-08-01/apitag/id_api.go +++ b/resource-manager/apimanagement/2021-08-01/apitag/id_api.go @@ -38,23 +38,9 @@ func ParseApiID(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiIDInsensitively(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateApiID checks that 'input' can be parsed as a Api ID diff --git a/resource-manager/apimanagement/2021-08-01/apitag/id_apitag.go b/resource-manager/apimanagement/2021-08-01/apitag/id_apitag.go index 065dee9d7df..0f562a900ad 100644 --- a/resource-manager/apimanagement/2021-08-01/apitag/id_apitag.go +++ b/resource-manager/apimanagement/2021-08-01/apitag/id_apitag.go @@ -40,27 +40,9 @@ func ParseApiTagID(input string) (*ApiTagId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiTagId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseApiTagIDInsensitively(input string) (*ApiTagId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiTagId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ApiTagId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + if id.TagId, ok = input.Parsed["tagId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tagId", input) } - return &id, nil + return nil } // ValidateApiTagID checks that 'input' can be parsed as a Api Tag ID diff --git a/resource-manager/apimanagement/2021-08-01/apitagdescription/id_api.go b/resource-manager/apimanagement/2021-08-01/apitagdescription/id_api.go index 7b00f6d8314..da65fe282bd 100644 --- a/resource-manager/apimanagement/2021-08-01/apitagdescription/id_api.go +++ b/resource-manager/apimanagement/2021-08-01/apitagdescription/id_api.go @@ -38,23 +38,9 @@ func ParseApiID(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiIDInsensitively(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateApiID checks that 'input' can be parsed as a Api ID diff --git a/resource-manager/apimanagement/2021-08-01/apitagdescription/id_tagdescription.go b/resource-manager/apimanagement/2021-08-01/apitagdescription/id_tagdescription.go index 4ac4fb2acef..b223d3e858b 100644 --- a/resource-manager/apimanagement/2021-08-01/apitagdescription/id_tagdescription.go +++ b/resource-manager/apimanagement/2021-08-01/apitagdescription/id_tagdescription.go @@ -40,27 +40,9 @@ func ParseTagDescriptionID(input string) (*TagDescriptionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TagDescriptionId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.TagDescriptionId, ok = parsed.Parsed["tagDescriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagDescriptionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseTagDescriptionIDInsensitively(input string) (*TagDescriptionId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TagDescriptionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TagDescriptionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.TagDescriptionId, ok = parsed.Parsed["tagDescriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagDescriptionId", *parsed) + if id.TagDescriptionId, ok = input.Parsed["tagDescriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tagDescriptionId", input) } - return &id, nil + return nil } // ValidateTagDescriptionID checks that 'input' can be parsed as a Tag Description ID diff --git a/resource-manager/apimanagement/2021-08-01/apiversionset/id_apiversionset.go b/resource-manager/apimanagement/2021-08-01/apiversionset/id_apiversionset.go index f541aa66a7d..ee3a221fa7d 100644 --- a/resource-manager/apimanagement/2021-08-01/apiversionset/id_apiversionset.go +++ b/resource-manager/apimanagement/2021-08-01/apiversionset/id_apiversionset.go @@ -38,23 +38,9 @@ func ParseApiVersionSetID(input string) (*ApiVersionSetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiVersionSetId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.VersionSetId, ok = parsed.Parsed["versionSetId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionSetId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiVersionSetIDInsensitively(input string) (*ApiVersionSetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiVersionSetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiVersionSetId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.VersionSetId, ok = parsed.Parsed["versionSetId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionSetId", *parsed) + if id.VersionSetId, ok = input.Parsed["versionSetId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionSetId", input) } - return &id, nil + return nil } // ValidateApiVersionSetID checks that 'input' can be parsed as a Api Version Set ID diff --git a/resource-manager/apimanagement/2021-08-01/apiversionset/id_service.go b/resource-manager/apimanagement/2021-08-01/apiversionset/id_service.go index b4503adde39..39d5f6a2dd1 100644 --- a/resource-manager/apimanagement/2021-08-01/apiversionset/id_service.go +++ b/resource-manager/apimanagement/2021-08-01/apiversionset/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2021-08-01/apiversionsets/id_apiversionset.go b/resource-manager/apimanagement/2021-08-01/apiversionsets/id_apiversionset.go index aa4b1218098..631a8829d3f 100644 --- a/resource-manager/apimanagement/2021-08-01/apiversionsets/id_apiversionset.go +++ b/resource-manager/apimanagement/2021-08-01/apiversionsets/id_apiversionset.go @@ -38,23 +38,9 @@ func ParseApiVersionSetID(input string) (*ApiVersionSetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiVersionSetId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.VersionSetId, ok = parsed.Parsed["versionSetId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionSetId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiVersionSetIDInsensitively(input string) (*ApiVersionSetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiVersionSetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiVersionSetId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.VersionSetId, ok = parsed.Parsed["versionSetId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionSetId", *parsed) + if id.VersionSetId, ok = input.Parsed["versionSetId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionSetId", input) } - return &id, nil + return nil } // ValidateApiVersionSetID checks that 'input' can be parsed as a Api Version Set ID diff --git a/resource-manager/apimanagement/2021-08-01/authorizationserver/id_authorizationserver.go b/resource-manager/apimanagement/2021-08-01/authorizationserver/id_authorizationserver.go index e5f6624ab65..f3fc41ad8ce 100644 --- a/resource-manager/apimanagement/2021-08-01/authorizationserver/id_authorizationserver.go +++ b/resource-manager/apimanagement/2021-08-01/authorizationserver/id_authorizationserver.go @@ -38,23 +38,9 @@ func ParseAuthorizationServerID(input string) (*AuthorizationServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationServerId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.AuthorizationServerName, ok = parsed.Parsed["authorizationServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAuthorizationServerIDInsensitively(input string) (*AuthorizationServer return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AuthorizationServerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.AuthorizationServerName, ok = parsed.Parsed["authorizationServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationServerName", *parsed) + if id.AuthorizationServerName, ok = input.Parsed["authorizationServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationServerName", input) } - return &id, nil + return nil } // ValidateAuthorizationServerID checks that 'input' can be parsed as a Authorization Server ID diff --git a/resource-manager/apimanagement/2021-08-01/authorizationserver/id_service.go b/resource-manager/apimanagement/2021-08-01/authorizationserver/id_service.go index 48f4a9da5ef..3f964ef83c6 100644 --- a/resource-manager/apimanagement/2021-08-01/authorizationserver/id_service.go +++ b/resource-manager/apimanagement/2021-08-01/authorizationserver/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2021-08-01/backend/id_backend.go b/resource-manager/apimanagement/2021-08-01/backend/id_backend.go index c7b8374637c..7111cfb2ae2 100644 --- a/resource-manager/apimanagement/2021-08-01/backend/id_backend.go +++ b/resource-manager/apimanagement/2021-08-01/backend/id_backend.go @@ -38,23 +38,9 @@ func ParseBackendID(input string) (*BackendId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackendId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.BackendId, ok = parsed.Parsed["backendId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backendId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackendIDInsensitively(input string) (*BackendId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackendId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackendId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.BackendId, ok = parsed.Parsed["backendId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backendId", *parsed) + if id.BackendId, ok = input.Parsed["backendId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backendId", input) } - return &id, nil + return nil } // ValidateBackendID checks that 'input' can be parsed as a Backend ID diff --git a/resource-manager/apimanagement/2021-08-01/backend/id_service.go b/resource-manager/apimanagement/2021-08-01/backend/id_service.go index a11de0ac7ea..894e41b5ffc 100644 --- a/resource-manager/apimanagement/2021-08-01/backend/id_service.go +++ b/resource-manager/apimanagement/2021-08-01/backend/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2021-08-01/backendreconnect/id_backend.go b/resource-manager/apimanagement/2021-08-01/backendreconnect/id_backend.go index e7bd4bda27f..2323cd337f6 100644 --- a/resource-manager/apimanagement/2021-08-01/backendreconnect/id_backend.go +++ b/resource-manager/apimanagement/2021-08-01/backendreconnect/id_backend.go @@ -38,23 +38,9 @@ func ParseBackendID(input string) (*BackendId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackendId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.BackendId, ok = parsed.Parsed["backendId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backendId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackendIDInsensitively(input string) (*BackendId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackendId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackendId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.BackendId, ok = parsed.Parsed["backendId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backendId", *parsed) + if id.BackendId, ok = input.Parsed["backendId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backendId", input) } - return &id, nil + return nil } // ValidateBackendID checks that 'input' can be parsed as a Backend ID diff --git a/resource-manager/apimanagement/2021-08-01/cache/id_cache.go b/resource-manager/apimanagement/2021-08-01/cache/id_cache.go index f481a454c49..910f2dec436 100644 --- a/resource-manager/apimanagement/2021-08-01/cache/id_cache.go +++ b/resource-manager/apimanagement/2021-08-01/cache/id_cache.go @@ -38,23 +38,9 @@ func ParseCacheID(input string) (*CacheId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CacheId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.CacheId, ok = parsed.Parsed["cacheId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cacheId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCacheIDInsensitively(input string) (*CacheId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CacheId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CacheId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.CacheId, ok = parsed.Parsed["cacheId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cacheId", *parsed) + if id.CacheId, ok = input.Parsed["cacheId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cacheId", input) } - return &id, nil + return nil } // ValidateCacheID checks that 'input' can be parsed as a Cache ID diff --git a/resource-manager/apimanagement/2021-08-01/cache/id_service.go b/resource-manager/apimanagement/2021-08-01/cache/id_service.go index bbca8da8f3a..3b930b104ea 100644 --- a/resource-manager/apimanagement/2021-08-01/cache/id_service.go +++ b/resource-manager/apimanagement/2021-08-01/cache/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2021-08-01/certificate/id_certificate.go b/resource-manager/apimanagement/2021-08-01/certificate/id_certificate.go index 623d4954ece..d11ca5a81dc 100644 --- a/resource-manager/apimanagement/2021-08-01/certificate/id_certificate.go +++ b/resource-manager/apimanagement/2021-08-01/certificate/id_certificate.go @@ -38,23 +38,9 @@ func ParseCertificateID(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.CertificateId, ok = parsed.Parsed["certificateId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCertificateIDInsensitively(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.CertificateId, ok = parsed.Parsed["certificateId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateId", *parsed) + if id.CertificateId, ok = input.Parsed["certificateId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateId", input) } - return &id, nil + return nil } // ValidateCertificateID checks that 'input' can be parsed as a Certificate ID diff --git a/resource-manager/apimanagement/2021-08-01/certificate/id_service.go b/resource-manager/apimanagement/2021-08-01/certificate/id_service.go index 66a90053cb1..4f35a34a7d3 100644 --- a/resource-manager/apimanagement/2021-08-01/certificate/id_service.go +++ b/resource-manager/apimanagement/2021-08-01/certificate/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2021-08-01/contenttype/id_contenttype.go b/resource-manager/apimanagement/2021-08-01/contenttype/id_contenttype.go index 7328e1b225d..a38ab676dca 100644 --- a/resource-manager/apimanagement/2021-08-01/contenttype/id_contenttype.go +++ b/resource-manager/apimanagement/2021-08-01/contenttype/id_contenttype.go @@ -38,23 +38,9 @@ func ParseContentTypeID(input string) (*ContentTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContentTypeId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ContentTypeId, ok = parsed.Parsed["contentTypeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "contentTypeId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseContentTypeIDInsensitively(input string) (*ContentTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContentTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ContentTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ContentTypeId, ok = parsed.Parsed["contentTypeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "contentTypeId", *parsed) + if id.ContentTypeId, ok = input.Parsed["contentTypeId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "contentTypeId", input) } - return &id, nil + return nil } // ValidateContentTypeID checks that 'input' can be parsed as a Content Type ID diff --git a/resource-manager/apimanagement/2021-08-01/contenttype/id_service.go b/resource-manager/apimanagement/2021-08-01/contenttype/id_service.go index bd1834775c3..f425169a4cb 100644 --- a/resource-manager/apimanagement/2021-08-01/contenttype/id_service.go +++ b/resource-manager/apimanagement/2021-08-01/contenttype/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2021-08-01/contenttypecontentitem/id_contentitem.go b/resource-manager/apimanagement/2021-08-01/contenttypecontentitem/id_contentitem.go index 45d0a06c68d..4e6f414ce57 100644 --- a/resource-manager/apimanagement/2021-08-01/contenttypecontentitem/id_contentitem.go +++ b/resource-manager/apimanagement/2021-08-01/contenttypecontentitem/id_contentitem.go @@ -40,27 +40,9 @@ func ParseContentItemID(input string) (*ContentItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContentItemId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ContentTypeId, ok = parsed.Parsed["contentTypeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "contentTypeId", *parsed) - } - - if id.ContentItemId, ok = parsed.Parsed["contentItemId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "contentItemId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseContentItemIDInsensitively(input string) (*ContentItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContentItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ContentItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ContentTypeId, ok = parsed.Parsed["contentTypeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "contentTypeId", *parsed) + if id.ContentTypeId, ok = input.Parsed["contentTypeId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "contentTypeId", input) } - if id.ContentItemId, ok = parsed.Parsed["contentItemId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "contentItemId", *parsed) + if id.ContentItemId, ok = input.Parsed["contentItemId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "contentItemId", input) } - return &id, nil + return nil } // ValidateContentItemID checks that 'input' can be parsed as a Content Item ID diff --git a/resource-manager/apimanagement/2021-08-01/contenttypecontentitem/id_contenttype.go b/resource-manager/apimanagement/2021-08-01/contenttypecontentitem/id_contenttype.go index 3b5c1e346ee..9d8bfce288f 100644 --- a/resource-manager/apimanagement/2021-08-01/contenttypecontentitem/id_contenttype.go +++ b/resource-manager/apimanagement/2021-08-01/contenttypecontentitem/id_contenttype.go @@ -38,23 +38,9 @@ func ParseContentTypeID(input string) (*ContentTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContentTypeId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ContentTypeId, ok = parsed.Parsed["contentTypeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "contentTypeId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseContentTypeIDInsensitively(input string) (*ContentTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContentTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ContentTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ContentTypeId, ok = parsed.Parsed["contentTypeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "contentTypeId", *parsed) + if id.ContentTypeId, ok = input.Parsed["contentTypeId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "contentTypeId", input) } - return &id, nil + return nil } // ValidateContentTypeID checks that 'input' can be parsed as a Content Type ID diff --git a/resource-manager/apimanagement/2021-08-01/delegationsettings/id_service.go b/resource-manager/apimanagement/2021-08-01/delegationsettings/id_service.go index c58ec8e039b..5c8d2f37462 100644 --- a/resource-manager/apimanagement/2021-08-01/delegationsettings/id_service.go +++ b/resource-manager/apimanagement/2021-08-01/delegationsettings/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2021-08-01/deletedservice/id_deletedservice.go b/resource-manager/apimanagement/2021-08-01/deletedservice/id_deletedservice.go index 16ae59293af..316c4f88aae 100644 --- a/resource-manager/apimanagement/2021-08-01/deletedservice/id_deletedservice.go +++ b/resource-manager/apimanagement/2021-08-01/deletedservice/id_deletedservice.go @@ -36,19 +36,9 @@ func ParseDeletedServiceID(input string) (*DeletedServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeletedServiceId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.DeletedServiceName, ok = parsed.Parsed["deletedServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDeletedServiceIDInsensitively(input string) (*DeletedServiceId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeletedServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DeletedServiceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.DeletedServiceName, ok = parsed.Parsed["deletedServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedServiceName", *parsed) + if id.DeletedServiceName, ok = input.Parsed["deletedServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deletedServiceName", input) } - return &id, nil + return nil } // ValidateDeletedServiceID checks that 'input' can be parsed as a Deleted Service ID diff --git a/resource-manager/apimanagement/2021-08-01/diagnostic/id_diagnostic.go b/resource-manager/apimanagement/2021-08-01/diagnostic/id_diagnostic.go index e283d041523..dc614829351 100644 --- a/resource-manager/apimanagement/2021-08-01/diagnostic/id_diagnostic.go +++ b/resource-manager/apimanagement/2021-08-01/diagnostic/id_diagnostic.go @@ -38,23 +38,9 @@ func ParseDiagnosticID(input string) (*DiagnosticId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiagnosticId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.DiagnosticId, ok = parsed.Parsed["diagnosticId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDiagnosticIDInsensitively(input string) (*DiagnosticId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiagnosticId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DiagnosticId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.DiagnosticId, ok = parsed.Parsed["diagnosticId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticId", *parsed) + if id.DiagnosticId, ok = input.Parsed["diagnosticId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "diagnosticId", input) } - return &id, nil + return nil } // ValidateDiagnosticID checks that 'input' can be parsed as a Diagnostic ID diff --git a/resource-manager/apimanagement/2021-08-01/diagnostic/id_service.go b/resource-manager/apimanagement/2021-08-01/diagnostic/id_service.go index 521b0f80d0a..912c67cfa64 100644 --- a/resource-manager/apimanagement/2021-08-01/diagnostic/id_service.go +++ b/resource-manager/apimanagement/2021-08-01/diagnostic/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2021-08-01/emailtemplate/id_service.go b/resource-manager/apimanagement/2021-08-01/emailtemplate/id_service.go index 6b34dfa4d2e..a1f9eb65d86 100644 --- a/resource-manager/apimanagement/2021-08-01/emailtemplate/id_service.go +++ b/resource-manager/apimanagement/2021-08-01/emailtemplate/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2021-08-01/emailtemplates/id_template.go b/resource-manager/apimanagement/2021-08-01/emailtemplates/id_template.go index c088c6f73c5..7dc72ab7ffc 100644 --- a/resource-manager/apimanagement/2021-08-01/emailtemplates/id_template.go +++ b/resource-manager/apimanagement/2021-08-01/emailtemplates/id_template.go @@ -38,31 +38,9 @@ func ParseTemplateID(input string) (*TemplateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TemplateId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if v, ok := parsed.Parsed["templateName"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "templateName", *parsed) - } - - templateName, err := parseTemplateName(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.TemplateName = *templateName + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -77,34 +55,42 @@ func ParseTemplateIDInsensitively(input string) (*TemplateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TemplateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TemplateId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if v, ok := parsed.Parsed["templateName"]; true { + if v, ok := input.Parsed["templateName"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "templateName", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "templateName", input) } templateName, err := parseTemplateName(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.TemplateName = *templateName } - return &id, nil + return nil } // ValidateTemplateID checks that 'input' can be parsed as a Template ID diff --git a/resource-manager/apimanagement/2021-08-01/gateway/id_gateway.go b/resource-manager/apimanagement/2021-08-01/gateway/id_gateway.go index 34550bb3edc..ccbe85e114d 100644 --- a/resource-manager/apimanagement/2021-08-01/gateway/id_gateway.go +++ b/resource-manager/apimanagement/2021-08-01/gateway/id_gateway.go @@ -38,23 +38,9 @@ func ParseGatewayID(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGatewayIDInsensitively(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GatewayId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if id.GatewayId, ok = input.Parsed["gatewayId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", input) } - return &id, nil + return nil } // ValidateGatewayID checks that 'input' can be parsed as a Gateway ID diff --git a/resource-manager/apimanagement/2021-08-01/gateway/id_service.go b/resource-manager/apimanagement/2021-08-01/gateway/id_service.go index a45df593cf6..da4dbe6703a 100644 --- a/resource-manager/apimanagement/2021-08-01/gateway/id_service.go +++ b/resource-manager/apimanagement/2021-08-01/gateway/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2021-08-01/gatewayapi/id_gateway.go b/resource-manager/apimanagement/2021-08-01/gatewayapi/id_gateway.go index 4165de54710..0261bc252ac 100644 --- a/resource-manager/apimanagement/2021-08-01/gatewayapi/id_gateway.go +++ b/resource-manager/apimanagement/2021-08-01/gatewayapi/id_gateway.go @@ -38,23 +38,9 @@ func ParseGatewayID(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGatewayIDInsensitively(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GatewayId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if id.GatewayId, ok = input.Parsed["gatewayId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", input) } - return &id, nil + return nil } // ValidateGatewayID checks that 'input' can be parsed as a Gateway ID diff --git a/resource-manager/apimanagement/2021-08-01/gatewayapi/id_gatewayapi.go b/resource-manager/apimanagement/2021-08-01/gatewayapi/id_gatewayapi.go index 7dc333eb0d3..7c845917a0f 100644 --- a/resource-manager/apimanagement/2021-08-01/gatewayapi/id_gatewayapi.go +++ b/resource-manager/apimanagement/2021-08-01/gatewayapi/id_gatewayapi.go @@ -40,27 +40,9 @@ func ParseGatewayApiID(input string) (*GatewayApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseGatewayApiIDInsensitively(input string) (*GatewayApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *GatewayApiId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if id.GatewayId, ok = input.Parsed["gatewayId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateGatewayApiID checks that 'input' can be parsed as a Gateway Api ID diff --git a/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/id_certificateauthority.go b/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/id_certificateauthority.go index 237095225f1..fa08514181b 100644 --- a/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/id_certificateauthority.go +++ b/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/id_certificateauthority.go @@ -40,27 +40,9 @@ func ParseCertificateAuthorityID(input string) (*CertificateAuthorityId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateAuthorityId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) - } - - if id.CertificateId, ok = parsed.Parsed["certificateId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseCertificateAuthorityIDInsensitively(input string) (*CertificateAuthori return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateAuthorityId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *CertificateAuthorityId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if id.GatewayId, ok = input.Parsed["gatewayId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", input) } - if id.CertificateId, ok = parsed.Parsed["certificateId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateId", *parsed) + if id.CertificateId, ok = input.Parsed["certificateId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateId", input) } - return &id, nil + return nil } // ValidateCertificateAuthorityID checks that 'input' can be parsed as a Certificate Authority ID diff --git a/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/id_gateway.go b/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/id_gateway.go index 787e1bc3e37..9f62338c3e7 100644 --- a/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/id_gateway.go +++ b/resource-manager/apimanagement/2021-08-01/gatewaycertificateauthority/id_gateway.go @@ -38,23 +38,9 @@ func ParseGatewayID(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGatewayIDInsensitively(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GatewayId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if id.GatewayId, ok = input.Parsed["gatewayId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", input) } - return &id, nil + return nil } // ValidateGatewayID checks that 'input' can be parsed as a Gateway ID diff --git a/resource-manager/apimanagement/2021-08-01/gatewaygeneratetoken/id_gateway.go b/resource-manager/apimanagement/2021-08-01/gatewaygeneratetoken/id_gateway.go index 6d924627762..fc452bcf7d7 100644 --- a/resource-manager/apimanagement/2021-08-01/gatewaygeneratetoken/id_gateway.go +++ b/resource-manager/apimanagement/2021-08-01/gatewaygeneratetoken/id_gateway.go @@ -38,23 +38,9 @@ func ParseGatewayID(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGatewayIDInsensitively(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GatewayId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if id.GatewayId, ok = input.Parsed["gatewayId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", input) } - return &id, nil + return nil } // ValidateGatewayID checks that 'input' can be parsed as a Gateway ID diff --git a/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/id_gateway.go b/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/id_gateway.go index db58fe2a01d..ee66d381b60 100644 --- a/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/id_gateway.go +++ b/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/id_gateway.go @@ -38,23 +38,9 @@ func ParseGatewayID(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGatewayIDInsensitively(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GatewayId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if id.GatewayId, ok = input.Parsed["gatewayId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", input) } - return &id, nil + return nil } // ValidateGatewayID checks that 'input' can be parsed as a Gateway ID diff --git a/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/id_hostnameconfiguration.go b/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/id_hostnameconfiguration.go index 6161f448656..345c2161ae6 100644 --- a/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/id_hostnameconfiguration.go +++ b/resource-manager/apimanagement/2021-08-01/gatewayhostnameconfiguration/id_hostnameconfiguration.go @@ -40,27 +40,9 @@ func ParseHostnameConfigurationID(input string) (*HostnameConfigurationId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostnameConfigurationId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) - } - - if id.HcId, ok = parsed.Parsed["hcId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hcId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseHostnameConfigurationIDInsensitively(input string) (*HostnameConfigura return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostnameConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *HostnameConfigurationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if id.GatewayId, ok = input.Parsed["gatewayId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", input) } - if id.HcId, ok = parsed.Parsed["hcId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hcId", *parsed) + if id.HcId, ok = input.Parsed["hcId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hcId", input) } - return &id, nil + return nil } // ValidateHostnameConfigurationID checks that 'input' can be parsed as a Hostname Configuration ID diff --git a/resource-manager/apimanagement/2021-08-01/gatewaylistkeys/id_gateway.go b/resource-manager/apimanagement/2021-08-01/gatewaylistkeys/id_gateway.go index 31bcc239ed0..10b1e70ee49 100644 --- a/resource-manager/apimanagement/2021-08-01/gatewaylistkeys/id_gateway.go +++ b/resource-manager/apimanagement/2021-08-01/gatewaylistkeys/id_gateway.go @@ -38,23 +38,9 @@ func ParseGatewayID(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGatewayIDInsensitively(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GatewayId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if id.GatewayId, ok = input.Parsed["gatewayId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", input) } - return &id, nil + return nil } // ValidateGatewayID checks that 'input' can be parsed as a Gateway ID diff --git a/resource-manager/apimanagement/2021-08-01/gatewayregeneratekey/id_gateway.go b/resource-manager/apimanagement/2021-08-01/gatewayregeneratekey/id_gateway.go index 514b9366d19..91b264cbd9e 100644 --- a/resource-manager/apimanagement/2021-08-01/gatewayregeneratekey/id_gateway.go +++ b/resource-manager/apimanagement/2021-08-01/gatewayregeneratekey/id_gateway.go @@ -38,23 +38,9 @@ func ParseGatewayID(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGatewayIDInsensitively(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GatewayId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if id.GatewayId, ok = input.Parsed["gatewayId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", input) } - return &id, nil + return nil } // ValidateGatewayID checks that 'input' can be parsed as a Gateway ID diff --git a/resource-manager/apimanagement/2021-08-01/group/id_group.go b/resource-manager/apimanagement/2021-08-01/group/id_group.go index 1cb69ca64b1..b6224b4b2d5 100644 --- a/resource-manager/apimanagement/2021-08-01/group/id_group.go +++ b/resource-manager/apimanagement/2021-08-01/group/id_group.go @@ -38,23 +38,9 @@ func ParseGroupID(input string) (*GroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GroupId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGroupIDInsensitively(input string) (*GroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + if id.GroupId, ok = input.Parsed["groupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "groupId", input) } - return &id, nil + return nil } // ValidateGroupID checks that 'input' can be parsed as a Group ID diff --git a/resource-manager/apimanagement/2021-08-01/group/id_service.go b/resource-manager/apimanagement/2021-08-01/group/id_service.go index 916e4cfce48..f9caa2ad509 100644 --- a/resource-manager/apimanagement/2021-08-01/group/id_service.go +++ b/resource-manager/apimanagement/2021-08-01/group/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2021-08-01/groupuser/id_group.go b/resource-manager/apimanagement/2021-08-01/groupuser/id_group.go index 9d328f9f026..8700a88c74c 100644 --- a/resource-manager/apimanagement/2021-08-01/groupuser/id_group.go +++ b/resource-manager/apimanagement/2021-08-01/groupuser/id_group.go @@ -38,23 +38,9 @@ func ParseGroupID(input string) (*GroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GroupId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGroupIDInsensitively(input string) (*GroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + if id.GroupId, ok = input.Parsed["groupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "groupId", input) } - return &id, nil + return nil } // ValidateGroupID checks that 'input' can be parsed as a Group ID diff --git a/resource-manager/apimanagement/2021-08-01/groupuser/id_groupuser.go b/resource-manager/apimanagement/2021-08-01/groupuser/id_groupuser.go index 70947c02de3..107bb00c1fb 100644 --- a/resource-manager/apimanagement/2021-08-01/groupuser/id_groupuser.go +++ b/resource-manager/apimanagement/2021-08-01/groupuser/id_groupuser.go @@ -40,27 +40,9 @@ func ParseGroupUserID(input string) (*GroupUserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GroupUserId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) - } - - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseGroupUserIDInsensitively(input string) (*GroupUserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GroupUserId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *GroupUserId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + if id.GroupId, ok = input.Parsed["groupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "groupId", input) } - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if id.UserId, ok = input.Parsed["userId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userId", input) } - return &id, nil + return nil } // ValidateGroupUserID checks that 'input' can be parsed as a Group User ID diff --git a/resource-manager/apimanagement/2021-08-01/identityprovider/id_identityprovider.go b/resource-manager/apimanagement/2021-08-01/identityprovider/id_identityprovider.go index b31fc9697f3..cb485fbbca2 100644 --- a/resource-manager/apimanagement/2021-08-01/identityprovider/id_identityprovider.go +++ b/resource-manager/apimanagement/2021-08-01/identityprovider/id_identityprovider.go @@ -38,31 +38,9 @@ func ParseIdentityProviderID(input string) (*IdentityProviderId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IdentityProviderId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if v, ok := parsed.Parsed["identityProviderName"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "identityProviderName", *parsed) - } - - identityProviderName, err := parseIdentityProviderType(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.IdentityProviderName = *identityProviderName + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -77,34 +55,42 @@ func ParseIdentityProviderIDInsensitively(input string) (*IdentityProviderId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IdentityProviderId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *IdentityProviderId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if v, ok := parsed.Parsed["identityProviderName"]; true { + if v, ok := input.Parsed["identityProviderName"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "identityProviderName", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "identityProviderName", input) } identityProviderName, err := parseIdentityProviderType(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.IdentityProviderName = *identityProviderName } - return &id, nil + return nil } // ValidateIdentityProviderID checks that 'input' can be parsed as a Identity Provider ID diff --git a/resource-manager/apimanagement/2021-08-01/identityprovider/id_service.go b/resource-manager/apimanagement/2021-08-01/identityprovider/id_service.go index 89ca80d7df0..b2789ac6a8f 100644 --- a/resource-manager/apimanagement/2021-08-01/identityprovider/id_service.go +++ b/resource-manager/apimanagement/2021-08-01/identityprovider/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2021-08-01/issue/id_issue.go b/resource-manager/apimanagement/2021-08-01/issue/id_issue.go index 4e23d04fe18..77ce6f29b3b 100644 --- a/resource-manager/apimanagement/2021-08-01/issue/id_issue.go +++ b/resource-manager/apimanagement/2021-08-01/issue/id_issue.go @@ -38,23 +38,9 @@ func ParseIssueID(input string) (*IssueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IssueId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.IssueId, ok = parsed.Parsed["issueId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "issueId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIssueIDInsensitively(input string) (*IssueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IssueId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IssueId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.IssueId, ok = parsed.Parsed["issueId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "issueId", *parsed) + if id.IssueId, ok = input.Parsed["issueId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "issueId", input) } - return &id, nil + return nil } // ValidateIssueID checks that 'input' can be parsed as a Issue ID diff --git a/resource-manager/apimanagement/2021-08-01/issue/id_service.go b/resource-manager/apimanagement/2021-08-01/issue/id_service.go index 48789e072fb..86785e7cc0d 100644 --- a/resource-manager/apimanagement/2021-08-01/issue/id_service.go +++ b/resource-manager/apimanagement/2021-08-01/issue/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2021-08-01/logger/id_logger.go b/resource-manager/apimanagement/2021-08-01/logger/id_logger.go index ee7f985a191..48e0f627f2a 100644 --- a/resource-manager/apimanagement/2021-08-01/logger/id_logger.go +++ b/resource-manager/apimanagement/2021-08-01/logger/id_logger.go @@ -38,23 +38,9 @@ func ParseLoggerID(input string) (*LoggerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LoggerId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.LoggerId, ok = parsed.Parsed["loggerId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loggerId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLoggerIDInsensitively(input string) (*LoggerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LoggerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LoggerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.LoggerId, ok = parsed.Parsed["loggerId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loggerId", *parsed) + if id.LoggerId, ok = input.Parsed["loggerId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "loggerId", input) } - return &id, nil + return nil } // ValidateLoggerID checks that 'input' can be parsed as a Logger ID diff --git a/resource-manager/apimanagement/2021-08-01/logger/id_service.go b/resource-manager/apimanagement/2021-08-01/logger/id_service.go index 5807ecae3aa..af4ae84d1ca 100644 --- a/resource-manager/apimanagement/2021-08-01/logger/id_service.go +++ b/resource-manager/apimanagement/2021-08-01/logger/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2021-08-01/namedvalue/id_namedvalue.go b/resource-manager/apimanagement/2021-08-01/namedvalue/id_namedvalue.go index eb84d26bb30..7356af722df 100644 --- a/resource-manager/apimanagement/2021-08-01/namedvalue/id_namedvalue.go +++ b/resource-manager/apimanagement/2021-08-01/namedvalue/id_namedvalue.go @@ -38,23 +38,9 @@ func ParseNamedValueID(input string) (*NamedValueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamedValueId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.NamedValueId, ok = parsed.Parsed["namedValueId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namedValueId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseNamedValueIDInsensitively(input string) (*NamedValueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamedValueId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *NamedValueId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.NamedValueId, ok = parsed.Parsed["namedValueId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namedValueId", *parsed) + if id.NamedValueId, ok = input.Parsed["namedValueId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namedValueId", input) } - return &id, nil + return nil } // ValidateNamedValueID checks that 'input' can be parsed as a Named Value ID diff --git a/resource-manager/apimanagement/2021-08-01/namedvalue/id_service.go b/resource-manager/apimanagement/2021-08-01/namedvalue/id_service.go index a39da071fda..51c851d257f 100644 --- a/resource-manager/apimanagement/2021-08-01/namedvalue/id_service.go +++ b/resource-manager/apimanagement/2021-08-01/namedvalue/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2021-08-01/networkstatus/id_location.go b/resource-manager/apimanagement/2021-08-01/networkstatus/id_location.go index 9bae59232c7..96f6c21f46a 100644 --- a/resource-manager/apimanagement/2021-08-01/networkstatus/id_location.go +++ b/resource-manager/apimanagement/2021-08-01/networkstatus/id_location.go @@ -38,23 +38,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/apimanagement/2021-08-01/networkstatus/id_service.go b/resource-manager/apimanagement/2021-08-01/networkstatus/id_service.go index 7607c8f6e3e..42461e8b992 100644 --- a/resource-manager/apimanagement/2021-08-01/networkstatus/id_service.go +++ b/resource-manager/apimanagement/2021-08-01/networkstatus/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2021-08-01/notification/id_notification.go b/resource-manager/apimanagement/2021-08-01/notification/id_notification.go index d769f22070b..ebb5d7ad704 100644 --- a/resource-manager/apimanagement/2021-08-01/notification/id_notification.go +++ b/resource-manager/apimanagement/2021-08-01/notification/id_notification.go @@ -38,31 +38,9 @@ func ParseNotificationID(input string) (*NotificationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NotificationId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if v, ok := parsed.Parsed["notificationName"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationName", *parsed) - } - - notificationName, err := parseNotificationName(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.NotificationName = *notificationName + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -77,34 +55,42 @@ func ParseNotificationIDInsensitively(input string) (*NotificationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NotificationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *NotificationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if v, ok := parsed.Parsed["notificationName"]; true { + if v, ok := input.Parsed["notificationName"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationName", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "notificationName", input) } notificationName, err := parseNotificationName(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.NotificationName = *notificationName } - return &id, nil + return nil } // ValidateNotificationID checks that 'input' can be parsed as a Notification ID diff --git a/resource-manager/apimanagement/2021-08-01/notification/id_service.go b/resource-manager/apimanagement/2021-08-01/notification/id_service.go index a3e0af16c59..11b88b72604 100644 --- a/resource-manager/apimanagement/2021-08-01/notification/id_service.go +++ b/resource-manager/apimanagement/2021-08-01/notification/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/id_notification.go b/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/id_notification.go index 03494ec3aec..c6cab7f7856 100644 --- a/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/id_notification.go +++ b/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/id_notification.go @@ -38,31 +38,9 @@ func ParseNotificationID(input string) (*NotificationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NotificationId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if v, ok := parsed.Parsed["notificationName"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationName", *parsed) - } - - notificationName, err := parseNotificationName(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.NotificationName = *notificationName + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -77,34 +55,42 @@ func ParseNotificationIDInsensitively(input string) (*NotificationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NotificationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *NotificationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if v, ok := parsed.Parsed["notificationName"]; true { + if v, ok := input.Parsed["notificationName"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationName", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "notificationName", input) } notificationName, err := parseNotificationName(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.NotificationName = *notificationName } - return &id, nil + return nil } // ValidateNotificationID checks that 'input' can be parsed as a Notification ID diff --git a/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/id_recipientemail.go b/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/id_recipientemail.go index 622fa5001ba..9616fe55542 100644 --- a/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/id_recipientemail.go +++ b/resource-manager/apimanagement/2021-08-01/notificationrecipientemail/id_recipientemail.go @@ -40,35 +40,9 @@ func ParseRecipientEmailID(input string) (*RecipientEmailId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecipientEmailId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if v, ok := parsed.Parsed["notificationName"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationName", *parsed) - } - - notificationName, err := parseNotificationName(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.NotificationName = *notificationName - } - - if id.RecipientEmailName, ok = parsed.Parsed["recipientEmailName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recipientEmailName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -83,38 +57,46 @@ func ParseRecipientEmailIDInsensitively(input string) (*RecipientEmailId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecipientEmailId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RecipientEmailId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if v, ok := parsed.Parsed["notificationName"]; true { + if v, ok := input.Parsed["notificationName"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationName", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "notificationName", input) } notificationName, err := parseNotificationName(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.NotificationName = *notificationName } - if id.RecipientEmailName, ok = parsed.Parsed["recipientEmailName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recipientEmailName", *parsed) + if id.RecipientEmailName, ok = input.Parsed["recipientEmailName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "recipientEmailName", input) } - return &id, nil + return nil } // ValidateRecipientEmailID checks that 'input' can be parsed as a Recipient Email ID diff --git a/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/id_notification.go b/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/id_notification.go index 9e0e8aebd25..c1f566238f9 100644 --- a/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/id_notification.go +++ b/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/id_notification.go @@ -38,31 +38,9 @@ func ParseNotificationID(input string) (*NotificationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NotificationId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if v, ok := parsed.Parsed["notificationName"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationName", *parsed) - } - - notificationName, err := parseNotificationName(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.NotificationName = *notificationName + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -77,34 +55,42 @@ func ParseNotificationIDInsensitively(input string) (*NotificationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NotificationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *NotificationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if v, ok := parsed.Parsed["notificationName"]; true { + if v, ok := input.Parsed["notificationName"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationName", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "notificationName", input) } notificationName, err := parseNotificationName(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.NotificationName = *notificationName } - return &id, nil + return nil } // ValidateNotificationID checks that 'input' can be parsed as a Notification ID diff --git a/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/id_recipientuser.go b/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/id_recipientuser.go index ba60daeb64b..d5e2ce19d24 100644 --- a/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/id_recipientuser.go +++ b/resource-manager/apimanagement/2021-08-01/notificationrecipientuser/id_recipientuser.go @@ -40,35 +40,9 @@ func ParseRecipientUserID(input string) (*RecipientUserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecipientUserId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if v, ok := parsed.Parsed["notificationName"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationName", *parsed) - } - - notificationName, err := parseNotificationName(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.NotificationName = *notificationName - } - - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -83,38 +57,46 @@ func ParseRecipientUserIDInsensitively(input string) (*RecipientUserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecipientUserId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RecipientUserId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if v, ok := parsed.Parsed["notificationName"]; true { + if v, ok := input.Parsed["notificationName"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationName", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "notificationName", input) } notificationName, err := parseNotificationName(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.NotificationName = *notificationName } - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if id.UserId, ok = input.Parsed["userId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userId", input) } - return &id, nil + return nil } // ValidateRecipientUserID checks that 'input' can be parsed as a Recipient User ID diff --git a/resource-manager/apimanagement/2021-08-01/openidconnectprovider/id_openidconnectprovider.go b/resource-manager/apimanagement/2021-08-01/openidconnectprovider/id_openidconnectprovider.go index 4c21b8383e0..6281797c5ed 100644 --- a/resource-manager/apimanagement/2021-08-01/openidconnectprovider/id_openidconnectprovider.go +++ b/resource-manager/apimanagement/2021-08-01/openidconnectprovider/id_openidconnectprovider.go @@ -38,23 +38,9 @@ func ParseOpenidConnectProviderID(input string) (*OpenidConnectProviderId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OpenidConnectProviderId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.OpenidConnectProviderName, ok = parsed.Parsed["openidConnectProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openidConnectProviderName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseOpenidConnectProviderIDInsensitively(input string) (*OpenidConnectProv return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OpenidConnectProviderId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OpenidConnectProviderId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.OpenidConnectProviderName, ok = parsed.Parsed["openidConnectProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openidConnectProviderName", *parsed) + if id.OpenidConnectProviderName, ok = input.Parsed["openidConnectProviderName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "openidConnectProviderName", input) } - return &id, nil + return nil } // ValidateOpenidConnectProviderID checks that 'input' can be parsed as a Openid Connect Provider ID diff --git a/resource-manager/apimanagement/2021-08-01/openidconnectprovider/id_service.go b/resource-manager/apimanagement/2021-08-01/openidconnectprovider/id_service.go index 5c1589b4130..6011bac9dea 100644 --- a/resource-manager/apimanagement/2021-08-01/openidconnectprovider/id_service.go +++ b/resource-manager/apimanagement/2021-08-01/openidconnectprovider/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2021-08-01/outboundnetworkdependenciesendpoints/id_service.go b/resource-manager/apimanagement/2021-08-01/outboundnetworkdependenciesendpoints/id_service.go index 632f1977756..fe94cec9540 100644 --- a/resource-manager/apimanagement/2021-08-01/outboundnetworkdependenciesendpoints/id_service.go +++ b/resource-manager/apimanagement/2021-08-01/outboundnetworkdependenciesendpoints/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2021-08-01/performconnectivitycheck/id_service.go b/resource-manager/apimanagement/2021-08-01/performconnectivitycheck/id_service.go index 4825412ea3d..5ba3db30421 100644 --- a/resource-manager/apimanagement/2021-08-01/performconnectivitycheck/id_service.go +++ b/resource-manager/apimanagement/2021-08-01/performconnectivitycheck/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2021-08-01/policy/id_service.go b/resource-manager/apimanagement/2021-08-01/policy/id_service.go index abd4ff17b68..a56cd4fcbd9 100644 --- a/resource-manager/apimanagement/2021-08-01/policy/id_service.go +++ b/resource-manager/apimanagement/2021-08-01/policy/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2021-08-01/policydescription/id_service.go b/resource-manager/apimanagement/2021-08-01/policydescription/id_service.go index b98c923d87b..69e0fb3fc50 100644 --- a/resource-manager/apimanagement/2021-08-01/policydescription/id_service.go +++ b/resource-manager/apimanagement/2021-08-01/policydescription/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2021-08-01/portalrevision/id_portalrevision.go b/resource-manager/apimanagement/2021-08-01/portalrevision/id_portalrevision.go index 4d8f88e3d4d..036c4579efd 100644 --- a/resource-manager/apimanagement/2021-08-01/portalrevision/id_portalrevision.go +++ b/resource-manager/apimanagement/2021-08-01/portalrevision/id_portalrevision.go @@ -38,23 +38,9 @@ func ParsePortalRevisionID(input string) (*PortalRevisionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PortalRevisionId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.PortalRevisionId, ok = parsed.Parsed["portalRevisionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "portalRevisionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePortalRevisionIDInsensitively(input string) (*PortalRevisionId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PortalRevisionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PortalRevisionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.PortalRevisionId, ok = parsed.Parsed["portalRevisionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "portalRevisionId", *parsed) + if id.PortalRevisionId, ok = input.Parsed["portalRevisionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "portalRevisionId", input) } - return &id, nil + return nil } // ValidatePortalRevisionID checks that 'input' can be parsed as a Portal Revision ID diff --git a/resource-manager/apimanagement/2021-08-01/portalrevision/id_service.go b/resource-manager/apimanagement/2021-08-01/portalrevision/id_service.go index 1144f19c377..e9329b7bd26 100644 --- a/resource-manager/apimanagement/2021-08-01/portalrevision/id_service.go +++ b/resource-manager/apimanagement/2021-08-01/portalrevision/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2021-08-01/portalsettings/id_service.go b/resource-manager/apimanagement/2021-08-01/portalsettings/id_service.go index 1afbc255261..08c2e404b72 100644 --- a/resource-manager/apimanagement/2021-08-01/portalsettings/id_service.go +++ b/resource-manager/apimanagement/2021-08-01/portalsettings/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2021-08-01/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/apimanagement/2021-08-01/privateendpointconnections/id_privateendpointconnection.go index fde99d1b98f..1af5dc47cf0 100644 --- a/resource-manager/apimanagement/2021-08-01/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/apimanagement/2021-08-01/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/apimanagement/2021-08-01/privateendpointconnections/id_privatelinkresource.go b/resource-manager/apimanagement/2021-08-01/privateendpointconnections/id_privatelinkresource.go index 3308d3eb863..517deab7731 100644 --- a/resource-manager/apimanagement/2021-08-01/privateendpointconnections/id_privatelinkresource.go +++ b/resource-manager/apimanagement/2021-08-01/privateendpointconnections/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/apimanagement/2021-08-01/privateendpointconnections/id_service.go b/resource-manager/apimanagement/2021-08-01/privateendpointconnections/id_service.go index 38c6b0f9c6a..38852b1d31d 100644 --- a/resource-manager/apimanagement/2021-08-01/privateendpointconnections/id_service.go +++ b/resource-manager/apimanagement/2021-08-01/privateendpointconnections/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2021-08-01/product/id_product.go b/resource-manager/apimanagement/2021-08-01/product/id_product.go index 68fc58b3c0c..c7625d1d9ac 100644 --- a/resource-manager/apimanagement/2021-08-01/product/id_product.go +++ b/resource-manager/apimanagement/2021-08-01/product/id_product.go @@ -38,23 +38,9 @@ func ParseProductID(input string) (*ProductId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProductIDInsensitively(input string) (*ProductId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProductId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if id.ProductId, ok = input.Parsed["productId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "productId", input) } - return &id, nil + return nil } // ValidateProductID checks that 'input' can be parsed as a Product ID diff --git a/resource-manager/apimanagement/2021-08-01/product/id_service.go b/resource-manager/apimanagement/2021-08-01/product/id_service.go index 453a38674d7..90ce39c0b6e 100644 --- a/resource-manager/apimanagement/2021-08-01/product/id_service.go +++ b/resource-manager/apimanagement/2021-08-01/product/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2021-08-01/productapi/id_product.go b/resource-manager/apimanagement/2021-08-01/productapi/id_product.go index ab13414a812..12e7e9f3173 100644 --- a/resource-manager/apimanagement/2021-08-01/productapi/id_product.go +++ b/resource-manager/apimanagement/2021-08-01/productapi/id_product.go @@ -38,23 +38,9 @@ func ParseProductID(input string) (*ProductId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProductIDInsensitively(input string) (*ProductId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProductId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if id.ProductId, ok = input.Parsed["productId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "productId", input) } - return &id, nil + return nil } // ValidateProductID checks that 'input' can be parsed as a Product ID diff --git a/resource-manager/apimanagement/2021-08-01/productapi/id_productapi.go b/resource-manager/apimanagement/2021-08-01/productapi/id_productapi.go index 241d1d4221d..1b0829c762a 100644 --- a/resource-manager/apimanagement/2021-08-01/productapi/id_productapi.go +++ b/resource-manager/apimanagement/2021-08-01/productapi/id_productapi.go @@ -40,27 +40,9 @@ func ParseProductApiID(input string) (*ProductApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseProductApiIDInsensitively(input string) (*ProductApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ProductApiId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if id.ProductId, ok = input.Parsed["productId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "productId", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateProductApiID checks that 'input' can be parsed as a Product Api ID diff --git a/resource-manager/apimanagement/2021-08-01/productgroup/id_product.go b/resource-manager/apimanagement/2021-08-01/productgroup/id_product.go index 78d1bbc0028..9da605f113d 100644 --- a/resource-manager/apimanagement/2021-08-01/productgroup/id_product.go +++ b/resource-manager/apimanagement/2021-08-01/productgroup/id_product.go @@ -38,23 +38,9 @@ func ParseProductID(input string) (*ProductId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProductIDInsensitively(input string) (*ProductId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProductId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if id.ProductId, ok = input.Parsed["productId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "productId", input) } - return &id, nil + return nil } // ValidateProductID checks that 'input' can be parsed as a Product ID diff --git a/resource-manager/apimanagement/2021-08-01/productgroup/id_productgroup.go b/resource-manager/apimanagement/2021-08-01/productgroup/id_productgroup.go index 3da15ed373b..a38f7d26fa3 100644 --- a/resource-manager/apimanagement/2021-08-01/productgroup/id_productgroup.go +++ b/resource-manager/apimanagement/2021-08-01/productgroup/id_productgroup.go @@ -40,27 +40,9 @@ func ParseProductGroupID(input string) (*ProductGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductGroupId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) - } - - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseProductGroupIDInsensitively(input string) (*ProductGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ProductGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if id.ProductId, ok = input.Parsed["productId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "productId", input) } - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + if id.GroupId, ok = input.Parsed["groupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "groupId", input) } - return &id, nil + return nil } // ValidateProductGroupID checks that 'input' can be parsed as a Product Group ID diff --git a/resource-manager/apimanagement/2021-08-01/productpolicy/id_product.go b/resource-manager/apimanagement/2021-08-01/productpolicy/id_product.go index 9698867e813..4baef506e98 100644 --- a/resource-manager/apimanagement/2021-08-01/productpolicy/id_product.go +++ b/resource-manager/apimanagement/2021-08-01/productpolicy/id_product.go @@ -38,23 +38,9 @@ func ParseProductID(input string) (*ProductId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProductIDInsensitively(input string) (*ProductId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProductId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if id.ProductId, ok = input.Parsed["productId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "productId", input) } - return &id, nil + return nil } // ValidateProductID checks that 'input' can be parsed as a Product ID diff --git a/resource-manager/apimanagement/2021-08-01/productsbytag/id_service.go b/resource-manager/apimanagement/2021-08-01/productsbytag/id_service.go index 9cc5fba20d5..dab0313cbb3 100644 --- a/resource-manager/apimanagement/2021-08-01/productsbytag/id_service.go +++ b/resource-manager/apimanagement/2021-08-01/productsbytag/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2021-08-01/productsubscription/id_product.go b/resource-manager/apimanagement/2021-08-01/productsubscription/id_product.go index 34d6c9e3c5c..0770ff03e50 100644 --- a/resource-manager/apimanagement/2021-08-01/productsubscription/id_product.go +++ b/resource-manager/apimanagement/2021-08-01/productsubscription/id_product.go @@ -38,23 +38,9 @@ func ParseProductID(input string) (*ProductId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProductIDInsensitively(input string) (*ProductId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProductId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if id.ProductId, ok = input.Parsed["productId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "productId", input) } - return &id, nil + return nil } // ValidateProductID checks that 'input' can be parsed as a Product ID diff --git a/resource-manager/apimanagement/2021-08-01/producttag/id_product.go b/resource-manager/apimanagement/2021-08-01/producttag/id_product.go index 0e8b83b03ef..01560e368e2 100644 --- a/resource-manager/apimanagement/2021-08-01/producttag/id_product.go +++ b/resource-manager/apimanagement/2021-08-01/producttag/id_product.go @@ -38,23 +38,9 @@ func ParseProductID(input string) (*ProductId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProductIDInsensitively(input string) (*ProductId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProductId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if id.ProductId, ok = input.Parsed["productId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "productId", input) } - return &id, nil + return nil } // ValidateProductID checks that 'input' can be parsed as a Product ID diff --git a/resource-manager/apimanagement/2021-08-01/producttag/id_producttag.go b/resource-manager/apimanagement/2021-08-01/producttag/id_producttag.go index ee2cbe499a3..95ba1801059 100644 --- a/resource-manager/apimanagement/2021-08-01/producttag/id_producttag.go +++ b/resource-manager/apimanagement/2021-08-01/producttag/id_producttag.go @@ -40,27 +40,9 @@ func ParseProductTagID(input string) (*ProductTagId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductTagId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) - } - - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseProductTagIDInsensitively(input string) (*ProductTagId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductTagId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ProductTagId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if id.ProductId, ok = input.Parsed["productId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "productId", input) } - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + if id.TagId, ok = input.Parsed["tagId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tagId", input) } - return &id, nil + return nil } // ValidateProductTagID checks that 'input' can be parsed as a Product Tag ID diff --git a/resource-manager/apimanagement/2021-08-01/quotabycounterkeys/id_quota.go b/resource-manager/apimanagement/2021-08-01/quotabycounterkeys/id_quota.go index bd09f03849c..1bcee82145a 100644 --- a/resource-manager/apimanagement/2021-08-01/quotabycounterkeys/id_quota.go +++ b/resource-manager/apimanagement/2021-08-01/quotabycounterkeys/id_quota.go @@ -38,23 +38,9 @@ func ParseQuotaID(input string) (*QuotaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QuotaId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.QuotaCounterKey, ok = parsed.Parsed["quotaCounterKey"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "quotaCounterKey", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseQuotaIDInsensitively(input string) (*QuotaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QuotaId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *QuotaId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.QuotaCounterKey, ok = parsed.Parsed["quotaCounterKey"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "quotaCounterKey", *parsed) + if id.QuotaCounterKey, ok = input.Parsed["quotaCounterKey"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "quotaCounterKey", input) } - return &id, nil + return nil } // ValidateQuotaID checks that 'input' can be parsed as a Quota ID diff --git a/resource-manager/apimanagement/2021-08-01/quotabyperiodkeys/id_period.go b/resource-manager/apimanagement/2021-08-01/quotabyperiodkeys/id_period.go index 51021a40cb2..457997a1f73 100644 --- a/resource-manager/apimanagement/2021-08-01/quotabyperiodkeys/id_period.go +++ b/resource-manager/apimanagement/2021-08-01/quotabyperiodkeys/id_period.go @@ -40,27 +40,9 @@ func ParsePeriodID(input string) (*PeriodId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PeriodId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.QuotaCounterKey, ok = parsed.Parsed["quotaCounterKey"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "quotaCounterKey", *parsed) - } - - if id.QuotaPeriodKey, ok = parsed.Parsed["quotaPeriodKey"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "quotaPeriodKey", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParsePeriodIDInsensitively(input string) (*PeriodId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PeriodId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *PeriodId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.QuotaCounterKey, ok = parsed.Parsed["quotaCounterKey"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "quotaCounterKey", *parsed) + if id.QuotaCounterKey, ok = input.Parsed["quotaCounterKey"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "quotaCounterKey", input) } - if id.QuotaPeriodKey, ok = parsed.Parsed["quotaPeriodKey"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "quotaPeriodKey", *parsed) + if id.QuotaPeriodKey, ok = input.Parsed["quotaPeriodKey"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "quotaPeriodKey", input) } - return &id, nil + return nil } // ValidatePeriodID checks that 'input' can be parsed as a Period ID diff --git a/resource-manager/apimanagement/2021-08-01/region/id_service.go b/resource-manager/apimanagement/2021-08-01/region/id_service.go index 28d0c9708d4..102d605acb5 100644 --- a/resource-manager/apimanagement/2021-08-01/region/id_service.go +++ b/resource-manager/apimanagement/2021-08-01/region/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2021-08-01/reports/id_service.go b/resource-manager/apimanagement/2021-08-01/reports/id_service.go index c86c2b26f93..2520584b82d 100644 --- a/resource-manager/apimanagement/2021-08-01/reports/id_service.go +++ b/resource-manager/apimanagement/2021-08-01/reports/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2021-08-01/schema/id_schema.go b/resource-manager/apimanagement/2021-08-01/schema/id_schema.go index 7454f30fe60..57f9ebb23c5 100644 --- a/resource-manager/apimanagement/2021-08-01/schema/id_schema.go +++ b/resource-manager/apimanagement/2021-08-01/schema/id_schema.go @@ -38,23 +38,9 @@ func ParseSchemaID(input string) (*SchemaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SchemaId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.SchemaId, ok = parsed.Parsed["schemaId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSchemaIDInsensitively(input string) (*SchemaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SchemaId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SchemaId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.SchemaId, ok = parsed.Parsed["schemaId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaId", *parsed) + if id.SchemaId, ok = input.Parsed["schemaId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "schemaId", input) } - return &id, nil + return nil } // ValidateSchemaID checks that 'input' can be parsed as a Schema ID diff --git a/resource-manager/apimanagement/2021-08-01/schema/id_service.go b/resource-manager/apimanagement/2021-08-01/schema/id_service.go index 2425e5c9127..d35dcd2431c 100644 --- a/resource-manager/apimanagement/2021-08-01/schema/id_service.go +++ b/resource-manager/apimanagement/2021-08-01/schema/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2021-08-01/signinsettings/id_service.go b/resource-manager/apimanagement/2021-08-01/signinsettings/id_service.go index 91fdf5b67b1..d449f2a8d38 100644 --- a/resource-manager/apimanagement/2021-08-01/signinsettings/id_service.go +++ b/resource-manager/apimanagement/2021-08-01/signinsettings/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2021-08-01/signupsettings/id_service.go b/resource-manager/apimanagement/2021-08-01/signupsettings/id_service.go index 5d9bd0a0c2f..f3787b73b81 100644 --- a/resource-manager/apimanagement/2021-08-01/signupsettings/id_service.go +++ b/resource-manager/apimanagement/2021-08-01/signupsettings/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2021-08-01/subscription/id_service.go b/resource-manager/apimanagement/2021-08-01/subscription/id_service.go index ec7f310e3df..93b509f052e 100644 --- a/resource-manager/apimanagement/2021-08-01/subscription/id_service.go +++ b/resource-manager/apimanagement/2021-08-01/subscription/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2021-08-01/subscription/id_subscriptions2.go b/resource-manager/apimanagement/2021-08-01/subscription/id_subscriptions2.go index baa1f57e1f6..f8b33d545ce 100644 --- a/resource-manager/apimanagement/2021-08-01/subscription/id_subscriptions2.go +++ b/resource-manager/apimanagement/2021-08-01/subscription/id_subscriptions2.go @@ -38,23 +38,9 @@ func ParseSubscriptions2ID(input string) (*Subscriptions2Id, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Subscriptions2Id{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSubscriptions2IDInsensitively(input string) (*Subscriptions2Id, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Subscriptions2Id{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *Subscriptions2Id) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", *parsed) + if id.SubscriptionName, ok = input.Parsed["subscriptionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", input) } - return &id, nil + return nil } // ValidateSubscriptions2ID checks that 'input' can be parsed as a Subscriptions 2 ID diff --git a/resource-manager/apimanagement/2021-08-01/subscription/id_usersubscriptions2.go b/resource-manager/apimanagement/2021-08-01/subscription/id_usersubscriptions2.go index ccc3bc6c72a..9c5f6ce11d0 100644 --- a/resource-manager/apimanagement/2021-08-01/subscription/id_usersubscriptions2.go +++ b/resource-manager/apimanagement/2021-08-01/subscription/id_usersubscriptions2.go @@ -40,27 +40,9 @@ func ParseUserSubscriptions2ID(input string) (*UserSubscriptions2Id, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserSubscriptions2Id{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) - } - - if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseUserSubscriptions2IDInsensitively(input string) (*UserSubscriptions2Id return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserSubscriptions2Id{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *UserSubscriptions2Id) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if id.UserId, ok = input.Parsed["userId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userId", input) } - if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", *parsed) + if id.SubscriptionName, ok = input.Parsed["subscriptionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", input) } - return &id, nil + return nil } // ValidateUserSubscriptions2ID checks that 'input' can be parsed as a User Subscriptions 2 ID diff --git a/resource-manager/apimanagement/2021-08-01/tag/id_service.go b/resource-manager/apimanagement/2021-08-01/tag/id_service.go index 05b834b495e..4571408724d 100644 --- a/resource-manager/apimanagement/2021-08-01/tag/id_service.go +++ b/resource-manager/apimanagement/2021-08-01/tag/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2021-08-01/tag/id_tag.go b/resource-manager/apimanagement/2021-08-01/tag/id_tag.go index 2f3b0e3027e..e5da01efc69 100644 --- a/resource-manager/apimanagement/2021-08-01/tag/id_tag.go +++ b/resource-manager/apimanagement/2021-08-01/tag/id_tag.go @@ -38,23 +38,9 @@ func ParseTagID(input string) (*TagId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TagId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTagIDInsensitively(input string) (*TagId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TagId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TagId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + if id.TagId, ok = input.Parsed["tagId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tagId", input) } - return &id, nil + return nil } // ValidateTagID checks that 'input' can be parsed as a Tag ID diff --git a/resource-manager/apimanagement/2021-08-01/tagresource/id_service.go b/resource-manager/apimanagement/2021-08-01/tagresource/id_service.go index 0ed54c64158..8467201490c 100644 --- a/resource-manager/apimanagement/2021-08-01/tagresource/id_service.go +++ b/resource-manager/apimanagement/2021-08-01/tagresource/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2021-08-01/tenantaccess/id_access.go b/resource-manager/apimanagement/2021-08-01/tenantaccess/id_access.go index f65bd39036b..c1088880ff5 100644 --- a/resource-manager/apimanagement/2021-08-01/tenantaccess/id_access.go +++ b/resource-manager/apimanagement/2021-08-01/tenantaccess/id_access.go @@ -38,31 +38,9 @@ func ParseAccessID(input string) (*AccessId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccessId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if v, ok := parsed.Parsed["accessName"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accessName", *parsed) - } - - accessName, err := parseAccessIdName(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.AccessName = *accessName + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -77,34 +55,42 @@ func ParseAccessIDInsensitively(input string) (*AccessId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccessId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *AccessId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if v, ok := parsed.Parsed["accessName"]; true { + if v, ok := input.Parsed["accessName"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accessName", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "accessName", input) } accessName, err := parseAccessIdName(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.AccessName = *accessName } - return &id, nil + return nil } // ValidateAccessID checks that 'input' can be parsed as a Access ID diff --git a/resource-manager/apimanagement/2021-08-01/tenantaccess/id_service.go b/resource-manager/apimanagement/2021-08-01/tenantaccess/id_service.go index 3a5122d04c9..eb27c6a8e00 100644 --- a/resource-manager/apimanagement/2021-08-01/tenantaccess/id_service.go +++ b/resource-manager/apimanagement/2021-08-01/tenantaccess/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2021-08-01/tenantaccessgit/id_access.go b/resource-manager/apimanagement/2021-08-01/tenantaccessgit/id_access.go index 2ba9d0cf84e..1b8f7cf9a5b 100644 --- a/resource-manager/apimanagement/2021-08-01/tenantaccessgit/id_access.go +++ b/resource-manager/apimanagement/2021-08-01/tenantaccessgit/id_access.go @@ -38,31 +38,9 @@ func ParseAccessID(input string) (*AccessId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccessId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if v, ok := parsed.Parsed["accessName"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accessName", *parsed) - } - - accessName, err := parseAccessIdName(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.AccessName = *accessName + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -77,34 +55,42 @@ func ParseAccessIDInsensitively(input string) (*AccessId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccessId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *AccessId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if v, ok := parsed.Parsed["accessName"]; true { + if v, ok := input.Parsed["accessName"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accessName", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "accessName", input) } accessName, err := parseAccessIdName(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.AccessName = *accessName } - return &id, nil + return nil } // ValidateAccessID checks that 'input' can be parsed as a Access ID diff --git a/resource-manager/apimanagement/2021-08-01/tenantconfiguration/id_service.go b/resource-manager/apimanagement/2021-08-01/tenantconfiguration/id_service.go index e4f04e8c155..035a1bd0afd 100644 --- a/resource-manager/apimanagement/2021-08-01/tenantconfiguration/id_service.go +++ b/resource-manager/apimanagement/2021-08-01/tenantconfiguration/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2021-08-01/tenantconfigurationsyncstate/id_service.go b/resource-manager/apimanagement/2021-08-01/tenantconfigurationsyncstate/id_service.go index da1608f2136..81e30d893aa 100644 --- a/resource-manager/apimanagement/2021-08-01/tenantconfigurationsyncstate/id_service.go +++ b/resource-manager/apimanagement/2021-08-01/tenantconfigurationsyncstate/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2021-08-01/tenantsettings/id_service.go b/resource-manager/apimanagement/2021-08-01/tenantsettings/id_service.go index d197d9265cc..16e418759e4 100644 --- a/resource-manager/apimanagement/2021-08-01/tenantsettings/id_service.go +++ b/resource-manager/apimanagement/2021-08-01/tenantsettings/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2021-08-01/user/id_service.go b/resource-manager/apimanagement/2021-08-01/user/id_service.go index 1747126f519..3ea79e41822 100644 --- a/resource-manager/apimanagement/2021-08-01/user/id_service.go +++ b/resource-manager/apimanagement/2021-08-01/user/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2021-08-01/user/id_user.go b/resource-manager/apimanagement/2021-08-01/user/id_user.go index 0b7943b4fae..08a07fa9e6f 100644 --- a/resource-manager/apimanagement/2021-08-01/user/id_user.go +++ b/resource-manager/apimanagement/2021-08-01/user/id_user.go @@ -38,23 +38,9 @@ func ParseUserID(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseUserIDInsensitively(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UserId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if id.UserId, ok = input.Parsed["userId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userId", input) } - return &id, nil + return nil } // ValidateUserID checks that 'input' can be parsed as a User ID diff --git a/resource-manager/apimanagement/2021-08-01/userconfirmationpasswordsend/id_user.go b/resource-manager/apimanagement/2021-08-01/userconfirmationpasswordsend/id_user.go index c827f27c182..dcd727f0f14 100644 --- a/resource-manager/apimanagement/2021-08-01/userconfirmationpasswordsend/id_user.go +++ b/resource-manager/apimanagement/2021-08-01/userconfirmationpasswordsend/id_user.go @@ -38,23 +38,9 @@ func ParseUserID(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseUserIDInsensitively(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UserId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if id.UserId, ok = input.Parsed["userId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userId", input) } - return &id, nil + return nil } // ValidateUserID checks that 'input' can be parsed as a User ID diff --git a/resource-manager/apimanagement/2021-08-01/usergroup/id_user.go b/resource-manager/apimanagement/2021-08-01/usergroup/id_user.go index 6f481473ac3..4f9503feb9f 100644 --- a/resource-manager/apimanagement/2021-08-01/usergroup/id_user.go +++ b/resource-manager/apimanagement/2021-08-01/usergroup/id_user.go @@ -38,23 +38,9 @@ func ParseUserID(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseUserIDInsensitively(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UserId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if id.UserId, ok = input.Parsed["userId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userId", input) } - return &id, nil + return nil } // ValidateUserID checks that 'input' can be parsed as a User ID diff --git a/resource-manager/apimanagement/2021-08-01/useridentity/id_user.go b/resource-manager/apimanagement/2021-08-01/useridentity/id_user.go index 185612cefc7..ea5036e1153 100644 --- a/resource-manager/apimanagement/2021-08-01/useridentity/id_user.go +++ b/resource-manager/apimanagement/2021-08-01/useridentity/id_user.go @@ -38,23 +38,9 @@ func ParseUserID(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseUserIDInsensitively(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UserId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if id.UserId, ok = input.Parsed["userId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userId", input) } - return &id, nil + return nil } // ValidateUserID checks that 'input' can be parsed as a User ID diff --git a/resource-manager/apimanagement/2021-08-01/users/id_user.go b/resource-manager/apimanagement/2021-08-01/users/id_user.go index 0720c2e6308..3e281134141 100644 --- a/resource-manager/apimanagement/2021-08-01/users/id_user.go +++ b/resource-manager/apimanagement/2021-08-01/users/id_user.go @@ -38,23 +38,9 @@ func ParseUserID(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseUserIDInsensitively(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UserId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if id.UserId, ok = input.Parsed["userId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userId", input) } - return &id, nil + return nil } // ValidateUserID checks that 'input' can be parsed as a User ID diff --git a/resource-manager/apimanagement/2021-08-01/usersubscription/id_user.go b/resource-manager/apimanagement/2021-08-01/usersubscription/id_user.go index c64085994b2..d1c798858f7 100644 --- a/resource-manager/apimanagement/2021-08-01/usersubscription/id_user.go +++ b/resource-manager/apimanagement/2021-08-01/usersubscription/id_user.go @@ -38,23 +38,9 @@ func ParseUserID(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseUserIDInsensitively(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UserId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if id.UserId, ok = input.Parsed["userId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userId", input) } - return &id, nil + return nil } // ValidateUserID checks that 'input' can be parsed as a User ID diff --git a/resource-manager/apimanagement/2021-08-01/usertoken/id_user.go b/resource-manager/apimanagement/2021-08-01/usertoken/id_user.go index 6f2e7012c25..7e0b9d7cb88 100644 --- a/resource-manager/apimanagement/2021-08-01/usertoken/id_user.go +++ b/resource-manager/apimanagement/2021-08-01/usertoken/id_user.go @@ -38,23 +38,9 @@ func ParseUserID(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseUserIDInsensitively(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UserId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if id.UserId, ok = input.Parsed["userId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userId", input) } - return &id, nil + return nil } // ValidateUserID checks that 'input' can be parsed as a User ID diff --git a/resource-manager/apimanagement/2022-08-01/api/id_api.go b/resource-manager/apimanagement/2022-08-01/api/id_api.go index b76a03a3ca4..7a0a77e48ee 100644 --- a/resource-manager/apimanagement/2022-08-01/api/id_api.go +++ b/resource-manager/apimanagement/2022-08-01/api/id_api.go @@ -38,23 +38,9 @@ func ParseApiID(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiIDInsensitively(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateApiID checks that 'input' can be parsed as a Api ID diff --git a/resource-manager/apimanagement/2022-08-01/api/id_service.go b/resource-manager/apimanagement/2022-08-01/api/id_service.go index c8e90bbf804..6a1e3ffbf4c 100644 --- a/resource-manager/apimanagement/2022-08-01/api/id_service.go +++ b/resource-manager/apimanagement/2022-08-01/api/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2022-08-01/apidiagnostic/id_api.go b/resource-manager/apimanagement/2022-08-01/apidiagnostic/id_api.go index 458b69d35bb..96657952393 100644 --- a/resource-manager/apimanagement/2022-08-01/apidiagnostic/id_api.go +++ b/resource-manager/apimanagement/2022-08-01/apidiagnostic/id_api.go @@ -38,23 +38,9 @@ func ParseApiID(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiIDInsensitively(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateApiID checks that 'input' can be parsed as a Api ID diff --git a/resource-manager/apimanagement/2022-08-01/apidiagnostic/id_apidiagnostic.go b/resource-manager/apimanagement/2022-08-01/apidiagnostic/id_apidiagnostic.go index c2dc08baea8..0e3e95f4369 100644 --- a/resource-manager/apimanagement/2022-08-01/apidiagnostic/id_apidiagnostic.go +++ b/resource-manager/apimanagement/2022-08-01/apidiagnostic/id_apidiagnostic.go @@ -40,27 +40,9 @@ func ParseApiDiagnosticID(input string) (*ApiDiagnosticId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiDiagnosticId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.DiagnosticId, ok = parsed.Parsed["diagnosticId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseApiDiagnosticIDInsensitively(input string) (*ApiDiagnosticId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiDiagnosticId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ApiDiagnosticId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.DiagnosticId, ok = parsed.Parsed["diagnosticId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticId", *parsed) + if id.DiagnosticId, ok = input.Parsed["diagnosticId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "diagnosticId", input) } - return &id, nil + return nil } // ValidateApiDiagnosticID checks that 'input' can be parsed as a Api Diagnostic ID diff --git a/resource-manager/apimanagement/2022-08-01/apiissue/id_api.go b/resource-manager/apimanagement/2022-08-01/apiissue/id_api.go index a53042d4cec..133174ac6ae 100644 --- a/resource-manager/apimanagement/2022-08-01/apiissue/id_api.go +++ b/resource-manager/apimanagement/2022-08-01/apiissue/id_api.go @@ -38,23 +38,9 @@ func ParseApiID(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiIDInsensitively(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateApiID checks that 'input' can be parsed as a Api ID diff --git a/resource-manager/apimanagement/2022-08-01/apiissue/id_apiissue.go b/resource-manager/apimanagement/2022-08-01/apiissue/id_apiissue.go index f5437406ba3..640acfc37da 100644 --- a/resource-manager/apimanagement/2022-08-01/apiissue/id_apiissue.go +++ b/resource-manager/apimanagement/2022-08-01/apiissue/id_apiissue.go @@ -40,27 +40,9 @@ func ParseApiIssueID(input string) (*ApiIssueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiIssueId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.IssueId, ok = parsed.Parsed["issueId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "issueId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseApiIssueIDInsensitively(input string) (*ApiIssueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiIssueId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ApiIssueId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.IssueId, ok = parsed.Parsed["issueId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "issueId", *parsed) + if id.IssueId, ok = input.Parsed["issueId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "issueId", input) } - return &id, nil + return nil } // ValidateApiIssueID checks that 'input' can be parsed as a Api Issue ID diff --git a/resource-manager/apimanagement/2022-08-01/apiissueattachment/id_apiissue.go b/resource-manager/apimanagement/2022-08-01/apiissueattachment/id_apiissue.go index 7bb616b8c62..c4f8ca725af 100644 --- a/resource-manager/apimanagement/2022-08-01/apiissueattachment/id_apiissue.go +++ b/resource-manager/apimanagement/2022-08-01/apiissueattachment/id_apiissue.go @@ -40,27 +40,9 @@ func ParseApiIssueID(input string) (*ApiIssueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiIssueId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.IssueId, ok = parsed.Parsed["issueId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "issueId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseApiIssueIDInsensitively(input string) (*ApiIssueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiIssueId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ApiIssueId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.IssueId, ok = parsed.Parsed["issueId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "issueId", *parsed) + if id.IssueId, ok = input.Parsed["issueId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "issueId", input) } - return &id, nil + return nil } // ValidateApiIssueID checks that 'input' can be parsed as a Api Issue ID diff --git a/resource-manager/apimanagement/2022-08-01/apiissueattachment/id_attachment.go b/resource-manager/apimanagement/2022-08-01/apiissueattachment/id_attachment.go index 201f3b7f724..7d336e46218 100644 --- a/resource-manager/apimanagement/2022-08-01/apiissueattachment/id_attachment.go +++ b/resource-manager/apimanagement/2022-08-01/apiissueattachment/id_attachment.go @@ -42,31 +42,9 @@ func ParseAttachmentID(input string) (*AttachmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AttachmentId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.IssueId, ok = parsed.Parsed["issueId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "issueId", *parsed) - } - - if id.AttachmentId, ok = parsed.Parsed["attachmentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "attachmentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseAttachmentIDInsensitively(input string) (*AttachmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AttachmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AttachmentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.IssueId, ok = parsed.Parsed["issueId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "issueId", *parsed) + if id.IssueId, ok = input.Parsed["issueId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "issueId", input) } - if id.AttachmentId, ok = parsed.Parsed["attachmentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "attachmentId", *parsed) + if id.AttachmentId, ok = input.Parsed["attachmentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "attachmentId", input) } - return &id, nil + return nil } // ValidateAttachmentID checks that 'input' can be parsed as a Attachment ID diff --git a/resource-manager/apimanagement/2022-08-01/apiissuecomment/id_apiissue.go b/resource-manager/apimanagement/2022-08-01/apiissuecomment/id_apiissue.go index fa985059e13..6123b4217fc 100644 --- a/resource-manager/apimanagement/2022-08-01/apiissuecomment/id_apiissue.go +++ b/resource-manager/apimanagement/2022-08-01/apiissuecomment/id_apiissue.go @@ -40,27 +40,9 @@ func ParseApiIssueID(input string) (*ApiIssueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiIssueId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.IssueId, ok = parsed.Parsed["issueId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "issueId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseApiIssueIDInsensitively(input string) (*ApiIssueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiIssueId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ApiIssueId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.IssueId, ok = parsed.Parsed["issueId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "issueId", *parsed) + if id.IssueId, ok = input.Parsed["issueId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "issueId", input) } - return &id, nil + return nil } // ValidateApiIssueID checks that 'input' can be parsed as a Api Issue ID diff --git a/resource-manager/apimanagement/2022-08-01/apiissuecomment/id_comment.go b/resource-manager/apimanagement/2022-08-01/apiissuecomment/id_comment.go index 4d6e5795faf..eca61943506 100644 --- a/resource-manager/apimanagement/2022-08-01/apiissuecomment/id_comment.go +++ b/resource-manager/apimanagement/2022-08-01/apiissuecomment/id_comment.go @@ -42,31 +42,9 @@ func ParseCommentID(input string) (*CommentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommentId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.IssueId, ok = parsed.Parsed["issueId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "issueId", *parsed) - } - - if id.CommentId, ok = parsed.Parsed["commentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "commentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseCommentIDInsensitively(input string) (*CommentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CommentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.IssueId, ok = parsed.Parsed["issueId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "issueId", *parsed) + if id.IssueId, ok = input.Parsed["issueId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "issueId", input) } - if id.CommentId, ok = parsed.Parsed["commentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "commentId", *parsed) + if id.CommentId, ok = input.Parsed["commentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "commentId", input) } - return &id, nil + return nil } // ValidateCommentID checks that 'input' can be parsed as a Comment ID diff --git a/resource-manager/apimanagement/2022-08-01/apimanagementservice/id_service.go b/resource-manager/apimanagement/2022-08-01/apimanagementservice/id_service.go index 95a62caed84..eccb86b056b 100644 --- a/resource-manager/apimanagement/2022-08-01/apimanagementservice/id_service.go +++ b/resource-manager/apimanagement/2022-08-01/apimanagementservice/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2022-08-01/apimanagementserviceskus/id_service.go b/resource-manager/apimanagement/2022-08-01/apimanagementserviceskus/id_service.go index d600f219ae6..b5afcf417bc 100644 --- a/resource-manager/apimanagement/2022-08-01/apimanagementserviceskus/id_service.go +++ b/resource-manager/apimanagement/2022-08-01/apimanagementserviceskus/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2022-08-01/apioperation/id_api.go b/resource-manager/apimanagement/2022-08-01/apioperation/id_api.go index 79a7327f622..43445741f29 100644 --- a/resource-manager/apimanagement/2022-08-01/apioperation/id_api.go +++ b/resource-manager/apimanagement/2022-08-01/apioperation/id_api.go @@ -38,23 +38,9 @@ func ParseApiID(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiIDInsensitively(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateApiID checks that 'input' can be parsed as a Api ID diff --git a/resource-manager/apimanagement/2022-08-01/apioperation/id_operation.go b/resource-manager/apimanagement/2022-08-01/apioperation/id_operation.go index de3ff9a53f6..438a2d60c02 100644 --- a/resource-manager/apimanagement/2022-08-01/apioperation/id_operation.go +++ b/resource-manager/apimanagement/2022-08-01/apioperation/id_operation.go @@ -40,27 +40,9 @@ func ParseOperationID(input string) (*OperationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseOperationIDInsensitively(input string) (*OperationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *OperationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if id.OperationId, ok = input.Parsed["operationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "operationId", input) } - return &id, nil + return nil } // ValidateOperationID checks that 'input' can be parsed as a Operation ID diff --git a/resource-manager/apimanagement/2022-08-01/apioperationpolicy/id_operation.go b/resource-manager/apimanagement/2022-08-01/apioperationpolicy/id_operation.go index 7cb0b5a54c7..4225aa7d778 100644 --- a/resource-manager/apimanagement/2022-08-01/apioperationpolicy/id_operation.go +++ b/resource-manager/apimanagement/2022-08-01/apioperationpolicy/id_operation.go @@ -40,27 +40,9 @@ func ParseOperationID(input string) (*OperationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseOperationIDInsensitively(input string) (*OperationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *OperationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if id.OperationId, ok = input.Parsed["operationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "operationId", input) } - return &id, nil + return nil } // ValidateOperationID checks that 'input' can be parsed as a Operation ID diff --git a/resource-manager/apimanagement/2022-08-01/apioperationsbytag/id_api.go b/resource-manager/apimanagement/2022-08-01/apioperationsbytag/id_api.go index 61af7bc027a..3b65c86986d 100644 --- a/resource-manager/apimanagement/2022-08-01/apioperationsbytag/id_api.go +++ b/resource-manager/apimanagement/2022-08-01/apioperationsbytag/id_api.go @@ -38,23 +38,9 @@ func ParseApiID(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiIDInsensitively(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateApiID checks that 'input' can be parsed as a Api ID diff --git a/resource-manager/apimanagement/2022-08-01/apioperationtag/id_operation.go b/resource-manager/apimanagement/2022-08-01/apioperationtag/id_operation.go index 80dc723f21e..9ff2edc8bb0 100644 --- a/resource-manager/apimanagement/2022-08-01/apioperationtag/id_operation.go +++ b/resource-manager/apimanagement/2022-08-01/apioperationtag/id_operation.go @@ -40,27 +40,9 @@ func ParseOperationID(input string) (*OperationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseOperationIDInsensitively(input string) (*OperationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *OperationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if id.OperationId, ok = input.Parsed["operationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "operationId", input) } - return &id, nil + return nil } // ValidateOperationID checks that 'input' can be parsed as a Operation ID diff --git a/resource-manager/apimanagement/2022-08-01/apioperationtag/id_operationtag.go b/resource-manager/apimanagement/2022-08-01/apioperationtag/id_operationtag.go index 50b4b0f0385..86a6377d961 100644 --- a/resource-manager/apimanagement/2022-08-01/apioperationtag/id_operationtag.go +++ b/resource-manager/apimanagement/2022-08-01/apioperationtag/id_operationtag.go @@ -42,31 +42,9 @@ func ParseOperationTagID(input string) (*OperationTagId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationTagId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) - } - - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseOperationTagIDInsensitively(input string) (*OperationTagId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationTagId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *OperationTagId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if id.OperationId, ok = input.Parsed["operationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "operationId", input) } - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + if id.TagId, ok = input.Parsed["tagId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tagId", input) } - return &id, nil + return nil } // ValidateOperationTagID checks that 'input' can be parsed as a Operation Tag ID diff --git a/resource-manager/apimanagement/2022-08-01/apipolicy/id_api.go b/resource-manager/apimanagement/2022-08-01/apipolicy/id_api.go index fa2aa4893ac..e6bb0d4a498 100644 --- a/resource-manager/apimanagement/2022-08-01/apipolicy/id_api.go +++ b/resource-manager/apimanagement/2022-08-01/apipolicy/id_api.go @@ -38,23 +38,9 @@ func ParseApiID(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiIDInsensitively(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateApiID checks that 'input' can be parsed as a Api ID diff --git a/resource-manager/apimanagement/2022-08-01/apiproduct/id_api.go b/resource-manager/apimanagement/2022-08-01/apiproduct/id_api.go index 34d8a372398..fb8a7d9a979 100644 --- a/resource-manager/apimanagement/2022-08-01/apiproduct/id_api.go +++ b/resource-manager/apimanagement/2022-08-01/apiproduct/id_api.go @@ -38,23 +38,9 @@ func ParseApiID(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiIDInsensitively(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateApiID checks that 'input' can be parsed as a Api ID diff --git a/resource-manager/apimanagement/2022-08-01/apirelease/id_api.go b/resource-manager/apimanagement/2022-08-01/apirelease/id_api.go index 2859d3f4219..330da942f46 100644 --- a/resource-manager/apimanagement/2022-08-01/apirelease/id_api.go +++ b/resource-manager/apimanagement/2022-08-01/apirelease/id_api.go @@ -38,23 +38,9 @@ func ParseApiID(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiIDInsensitively(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateApiID checks that 'input' can be parsed as a Api ID diff --git a/resource-manager/apimanagement/2022-08-01/apirelease/id_release.go b/resource-manager/apimanagement/2022-08-01/apirelease/id_release.go index a05148dd45c..3cbe29fbd02 100644 --- a/resource-manager/apimanagement/2022-08-01/apirelease/id_release.go +++ b/resource-manager/apimanagement/2022-08-01/apirelease/id_release.go @@ -40,27 +40,9 @@ func ParseReleaseID(input string) (*ReleaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReleaseId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.ReleaseId, ok = parsed.Parsed["releaseId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "releaseId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReleaseIDInsensitively(input string) (*ReleaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReleaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReleaseId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.ReleaseId, ok = parsed.Parsed["releaseId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "releaseId", *parsed) + if id.ReleaseId, ok = input.Parsed["releaseId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "releaseId", input) } - return &id, nil + return nil } // ValidateReleaseID checks that 'input' can be parsed as a Release ID diff --git a/resource-manager/apimanagement/2022-08-01/apirevision/id_api.go b/resource-manager/apimanagement/2022-08-01/apirevision/id_api.go index ecca30efbc4..d21321054a4 100644 --- a/resource-manager/apimanagement/2022-08-01/apirevision/id_api.go +++ b/resource-manager/apimanagement/2022-08-01/apirevision/id_api.go @@ -38,23 +38,9 @@ func ParseApiID(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiIDInsensitively(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateApiID checks that 'input' can be parsed as a Api ID diff --git a/resource-manager/apimanagement/2022-08-01/apisbytag/id_service.go b/resource-manager/apimanagement/2022-08-01/apisbytag/id_service.go index cabeab414cb..c51e286da4f 100644 --- a/resource-manager/apimanagement/2022-08-01/apisbytag/id_service.go +++ b/resource-manager/apimanagement/2022-08-01/apisbytag/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2022-08-01/apischema/id_api.go b/resource-manager/apimanagement/2022-08-01/apischema/id_api.go index f58e6b3b0fd..3cec3f2a149 100644 --- a/resource-manager/apimanagement/2022-08-01/apischema/id_api.go +++ b/resource-manager/apimanagement/2022-08-01/apischema/id_api.go @@ -38,23 +38,9 @@ func ParseApiID(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiIDInsensitively(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateApiID checks that 'input' can be parsed as a Api ID diff --git a/resource-manager/apimanagement/2022-08-01/apischema/id_apischema.go b/resource-manager/apimanagement/2022-08-01/apischema/id_apischema.go index 13017418f0c..2953ca314ba 100644 --- a/resource-manager/apimanagement/2022-08-01/apischema/id_apischema.go +++ b/resource-manager/apimanagement/2022-08-01/apischema/id_apischema.go @@ -40,27 +40,9 @@ func ParseApiSchemaID(input string) (*ApiSchemaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiSchemaId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.SchemaId, ok = parsed.Parsed["schemaId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseApiSchemaIDInsensitively(input string) (*ApiSchemaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiSchemaId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ApiSchemaId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.SchemaId, ok = parsed.Parsed["schemaId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaId", *parsed) + if id.SchemaId, ok = input.Parsed["schemaId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "schemaId", input) } - return &id, nil + return nil } // ValidateApiSchemaID checks that 'input' can be parsed as a Api Schema ID diff --git a/resource-manager/apimanagement/2022-08-01/apitag/id_api.go b/resource-manager/apimanagement/2022-08-01/apitag/id_api.go index 89fbccee1e6..c8afece467f 100644 --- a/resource-manager/apimanagement/2022-08-01/apitag/id_api.go +++ b/resource-manager/apimanagement/2022-08-01/apitag/id_api.go @@ -38,23 +38,9 @@ func ParseApiID(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiIDInsensitively(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateApiID checks that 'input' can be parsed as a Api ID diff --git a/resource-manager/apimanagement/2022-08-01/apitag/id_apitag.go b/resource-manager/apimanagement/2022-08-01/apitag/id_apitag.go index 065dee9d7df..0f562a900ad 100644 --- a/resource-manager/apimanagement/2022-08-01/apitag/id_apitag.go +++ b/resource-manager/apimanagement/2022-08-01/apitag/id_apitag.go @@ -40,27 +40,9 @@ func ParseApiTagID(input string) (*ApiTagId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiTagId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseApiTagIDInsensitively(input string) (*ApiTagId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiTagId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ApiTagId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + if id.TagId, ok = input.Parsed["tagId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tagId", input) } - return &id, nil + return nil } // ValidateApiTagID checks that 'input' can be parsed as a Api Tag ID diff --git a/resource-manager/apimanagement/2022-08-01/apitagdescription/id_api.go b/resource-manager/apimanagement/2022-08-01/apitagdescription/id_api.go index 7b00f6d8314..da65fe282bd 100644 --- a/resource-manager/apimanagement/2022-08-01/apitagdescription/id_api.go +++ b/resource-manager/apimanagement/2022-08-01/apitagdescription/id_api.go @@ -38,23 +38,9 @@ func ParseApiID(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiIDInsensitively(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateApiID checks that 'input' can be parsed as a Api ID diff --git a/resource-manager/apimanagement/2022-08-01/apitagdescription/id_tagdescription.go b/resource-manager/apimanagement/2022-08-01/apitagdescription/id_tagdescription.go index 4ac4fb2acef..b223d3e858b 100644 --- a/resource-manager/apimanagement/2022-08-01/apitagdescription/id_tagdescription.go +++ b/resource-manager/apimanagement/2022-08-01/apitagdescription/id_tagdescription.go @@ -40,27 +40,9 @@ func ParseTagDescriptionID(input string) (*TagDescriptionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TagDescriptionId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.TagDescriptionId, ok = parsed.Parsed["tagDescriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagDescriptionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseTagDescriptionIDInsensitively(input string) (*TagDescriptionId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TagDescriptionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TagDescriptionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.TagDescriptionId, ok = parsed.Parsed["tagDescriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagDescriptionId", *parsed) + if id.TagDescriptionId, ok = input.Parsed["tagDescriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tagDescriptionId", input) } - return &id, nil + return nil } // ValidateTagDescriptionID checks that 'input' can be parsed as a Tag Description ID diff --git a/resource-manager/apimanagement/2022-08-01/apiversionset/id_apiversionset.go b/resource-manager/apimanagement/2022-08-01/apiversionset/id_apiversionset.go index f541aa66a7d..ee3a221fa7d 100644 --- a/resource-manager/apimanagement/2022-08-01/apiversionset/id_apiversionset.go +++ b/resource-manager/apimanagement/2022-08-01/apiversionset/id_apiversionset.go @@ -38,23 +38,9 @@ func ParseApiVersionSetID(input string) (*ApiVersionSetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiVersionSetId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.VersionSetId, ok = parsed.Parsed["versionSetId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionSetId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiVersionSetIDInsensitively(input string) (*ApiVersionSetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiVersionSetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiVersionSetId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.VersionSetId, ok = parsed.Parsed["versionSetId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionSetId", *parsed) + if id.VersionSetId, ok = input.Parsed["versionSetId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionSetId", input) } - return &id, nil + return nil } // ValidateApiVersionSetID checks that 'input' can be parsed as a Api Version Set ID diff --git a/resource-manager/apimanagement/2022-08-01/apiversionset/id_service.go b/resource-manager/apimanagement/2022-08-01/apiversionset/id_service.go index b4503adde39..39d5f6a2dd1 100644 --- a/resource-manager/apimanagement/2022-08-01/apiversionset/id_service.go +++ b/resource-manager/apimanagement/2022-08-01/apiversionset/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2022-08-01/apiversionsets/id_apiversionset.go b/resource-manager/apimanagement/2022-08-01/apiversionsets/id_apiversionset.go index aa4b1218098..631a8829d3f 100644 --- a/resource-manager/apimanagement/2022-08-01/apiversionsets/id_apiversionset.go +++ b/resource-manager/apimanagement/2022-08-01/apiversionsets/id_apiversionset.go @@ -38,23 +38,9 @@ func ParseApiVersionSetID(input string) (*ApiVersionSetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiVersionSetId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.VersionSetId, ok = parsed.Parsed["versionSetId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionSetId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiVersionSetIDInsensitively(input string) (*ApiVersionSetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiVersionSetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiVersionSetId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.VersionSetId, ok = parsed.Parsed["versionSetId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionSetId", *parsed) + if id.VersionSetId, ok = input.Parsed["versionSetId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionSetId", input) } - return &id, nil + return nil } // ValidateApiVersionSetID checks that 'input' can be parsed as a Api Version Set ID diff --git a/resource-manager/apimanagement/2022-08-01/apiwiki/id_api.go b/resource-manager/apimanagement/2022-08-01/apiwiki/id_api.go index 4a4038b5b88..59d2f57a098 100644 --- a/resource-manager/apimanagement/2022-08-01/apiwiki/id_api.go +++ b/resource-manager/apimanagement/2022-08-01/apiwiki/id_api.go @@ -38,23 +38,9 @@ func ParseApiID(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiIDInsensitively(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateApiID checks that 'input' can be parsed as a Api ID diff --git a/resource-manager/apimanagement/2022-08-01/authorization/id_authorization.go b/resource-manager/apimanagement/2022-08-01/authorization/id_authorization.go index 43cf3c30fae..2f50d657905 100644 --- a/resource-manager/apimanagement/2022-08-01/authorization/id_authorization.go +++ b/resource-manager/apimanagement/2022-08-01/authorization/id_authorization.go @@ -40,27 +40,9 @@ func ParseAuthorizationID(input string) (*AuthorizationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.AuthorizationProviderId, ok = parsed.Parsed["authorizationProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationProviderId", *parsed) - } - - if id.AuthorizationId, ok = parsed.Parsed["authorizationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseAuthorizationIDInsensitively(input string) (*AuthorizationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *AuthorizationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.AuthorizationProviderId, ok = parsed.Parsed["authorizationProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationProviderId", *parsed) + if id.AuthorizationProviderId, ok = input.Parsed["authorizationProviderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationProviderId", input) } - if id.AuthorizationId, ok = parsed.Parsed["authorizationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationId", *parsed) + if id.AuthorizationId, ok = input.Parsed["authorizationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationId", input) } - return &id, nil + return nil } // ValidateAuthorizationID checks that 'input' can be parsed as a Authorization ID diff --git a/resource-manager/apimanagement/2022-08-01/authorizationaccesspolicy/id_accesspolicy.go b/resource-manager/apimanagement/2022-08-01/authorizationaccesspolicy/id_accesspolicy.go index f4908beab18..392ecde78d3 100644 --- a/resource-manager/apimanagement/2022-08-01/authorizationaccesspolicy/id_accesspolicy.go +++ b/resource-manager/apimanagement/2022-08-01/authorizationaccesspolicy/id_accesspolicy.go @@ -42,31 +42,9 @@ func ParseAccessPolicyID(input string) (*AccessPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccessPolicyId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.AuthorizationProviderId, ok = parsed.Parsed["authorizationProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationProviderId", *parsed) - } - - if id.AuthorizationId, ok = parsed.Parsed["authorizationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationId", *parsed) - } - - if id.AuthorizationAccessPolicyId, ok = parsed.Parsed["authorizationAccessPolicyId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationAccessPolicyId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseAccessPolicyIDInsensitively(input string) (*AccessPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccessPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AccessPolicyId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.AuthorizationProviderId, ok = parsed.Parsed["authorizationProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationProviderId", *parsed) + if id.AuthorizationProviderId, ok = input.Parsed["authorizationProviderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationProviderId", input) } - if id.AuthorizationId, ok = parsed.Parsed["authorizationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationId", *parsed) + if id.AuthorizationId, ok = input.Parsed["authorizationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationId", input) } - if id.AuthorizationAccessPolicyId, ok = parsed.Parsed["authorizationAccessPolicyId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationAccessPolicyId", *parsed) + if id.AuthorizationAccessPolicyId, ok = input.Parsed["authorizationAccessPolicyId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationAccessPolicyId", input) } - return &id, nil + return nil } // ValidateAccessPolicyID checks that 'input' can be parsed as a Access Policy ID diff --git a/resource-manager/apimanagement/2022-08-01/authorizationaccesspolicy/id_authorization.go b/resource-manager/apimanagement/2022-08-01/authorizationaccesspolicy/id_authorization.go index 4c439275e3d..d80d068b2d1 100644 --- a/resource-manager/apimanagement/2022-08-01/authorizationaccesspolicy/id_authorization.go +++ b/resource-manager/apimanagement/2022-08-01/authorizationaccesspolicy/id_authorization.go @@ -40,27 +40,9 @@ func ParseAuthorizationID(input string) (*AuthorizationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.AuthorizationProviderId, ok = parsed.Parsed["authorizationProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationProviderId", *parsed) - } - - if id.AuthorizationId, ok = parsed.Parsed["authorizationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseAuthorizationIDInsensitively(input string) (*AuthorizationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *AuthorizationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.AuthorizationProviderId, ok = parsed.Parsed["authorizationProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationProviderId", *parsed) + if id.AuthorizationProviderId, ok = input.Parsed["authorizationProviderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationProviderId", input) } - if id.AuthorizationId, ok = parsed.Parsed["authorizationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationId", *parsed) + if id.AuthorizationId, ok = input.Parsed["authorizationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationId", input) } - return &id, nil + return nil } // ValidateAuthorizationID checks that 'input' can be parsed as a Authorization ID diff --git a/resource-manager/apimanagement/2022-08-01/authorizationconfirmconsentcode/id_authorization.go b/resource-manager/apimanagement/2022-08-01/authorizationconfirmconsentcode/id_authorization.go index ba3cdc93ae9..58de0836315 100644 --- a/resource-manager/apimanagement/2022-08-01/authorizationconfirmconsentcode/id_authorization.go +++ b/resource-manager/apimanagement/2022-08-01/authorizationconfirmconsentcode/id_authorization.go @@ -40,27 +40,9 @@ func ParseAuthorizationID(input string) (*AuthorizationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.AuthorizationProviderId, ok = parsed.Parsed["authorizationProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationProviderId", *parsed) - } - - if id.AuthorizationId, ok = parsed.Parsed["authorizationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseAuthorizationIDInsensitively(input string) (*AuthorizationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *AuthorizationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.AuthorizationProviderId, ok = parsed.Parsed["authorizationProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationProviderId", *parsed) + if id.AuthorizationProviderId, ok = input.Parsed["authorizationProviderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationProviderId", input) } - if id.AuthorizationId, ok = parsed.Parsed["authorizationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationId", *parsed) + if id.AuthorizationId, ok = input.Parsed["authorizationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationId", input) } - return &id, nil + return nil } // ValidateAuthorizationID checks that 'input' can be parsed as a Authorization ID diff --git a/resource-manager/apimanagement/2022-08-01/authorizationloginlinks/id_authorization.go b/resource-manager/apimanagement/2022-08-01/authorizationloginlinks/id_authorization.go index 1e1e6b66add..6253d8c7f67 100644 --- a/resource-manager/apimanagement/2022-08-01/authorizationloginlinks/id_authorization.go +++ b/resource-manager/apimanagement/2022-08-01/authorizationloginlinks/id_authorization.go @@ -40,27 +40,9 @@ func ParseAuthorizationID(input string) (*AuthorizationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.AuthorizationProviderId, ok = parsed.Parsed["authorizationProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationProviderId", *parsed) - } - - if id.AuthorizationId, ok = parsed.Parsed["authorizationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseAuthorizationIDInsensitively(input string) (*AuthorizationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *AuthorizationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.AuthorizationProviderId, ok = parsed.Parsed["authorizationProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationProviderId", *parsed) + if id.AuthorizationProviderId, ok = input.Parsed["authorizationProviderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationProviderId", input) } - if id.AuthorizationId, ok = parsed.Parsed["authorizationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationId", *parsed) + if id.AuthorizationId, ok = input.Parsed["authorizationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationId", input) } - return &id, nil + return nil } // ValidateAuthorizationID checks that 'input' can be parsed as a Authorization ID diff --git a/resource-manager/apimanagement/2022-08-01/authorizationprovider/id_authorizationprovider.go b/resource-manager/apimanagement/2022-08-01/authorizationprovider/id_authorizationprovider.go index 77bec395bd8..0d392ebb1b5 100644 --- a/resource-manager/apimanagement/2022-08-01/authorizationprovider/id_authorizationprovider.go +++ b/resource-manager/apimanagement/2022-08-01/authorizationprovider/id_authorizationprovider.go @@ -38,23 +38,9 @@ func ParseAuthorizationProviderID(input string) (*AuthorizationProviderId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationProviderId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.AuthorizationProviderId, ok = parsed.Parsed["authorizationProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationProviderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAuthorizationProviderIDInsensitively(input string) (*AuthorizationProv return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationProviderId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AuthorizationProviderId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.AuthorizationProviderId, ok = parsed.Parsed["authorizationProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationProviderId", *parsed) + if id.AuthorizationProviderId, ok = input.Parsed["authorizationProviderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationProviderId", input) } - return &id, nil + return nil } // ValidateAuthorizationProviderID checks that 'input' can be parsed as a Authorization Provider ID diff --git a/resource-manager/apimanagement/2022-08-01/authorizationprovider/id_service.go b/resource-manager/apimanagement/2022-08-01/authorizationprovider/id_service.go index acc7b0ea016..56cac638a9e 100644 --- a/resource-manager/apimanagement/2022-08-01/authorizationprovider/id_service.go +++ b/resource-manager/apimanagement/2022-08-01/authorizationprovider/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2022-08-01/authorizations/id_authorizationprovider.go b/resource-manager/apimanagement/2022-08-01/authorizations/id_authorizationprovider.go index e8c53b27f15..467673047fc 100644 --- a/resource-manager/apimanagement/2022-08-01/authorizations/id_authorizationprovider.go +++ b/resource-manager/apimanagement/2022-08-01/authorizations/id_authorizationprovider.go @@ -38,23 +38,9 @@ func ParseAuthorizationProviderID(input string) (*AuthorizationProviderId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationProviderId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.AuthorizationProviderId, ok = parsed.Parsed["authorizationProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationProviderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAuthorizationProviderIDInsensitively(input string) (*AuthorizationProv return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationProviderId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AuthorizationProviderId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.AuthorizationProviderId, ok = parsed.Parsed["authorizationProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationProviderId", *parsed) + if id.AuthorizationProviderId, ok = input.Parsed["authorizationProviderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationProviderId", input) } - return &id, nil + return nil } // ValidateAuthorizationProviderID checks that 'input' can be parsed as a Authorization Provider ID diff --git a/resource-manager/apimanagement/2022-08-01/authorizationserver/id_authorizationserver.go b/resource-manager/apimanagement/2022-08-01/authorizationserver/id_authorizationserver.go index e5f6624ab65..f3fc41ad8ce 100644 --- a/resource-manager/apimanagement/2022-08-01/authorizationserver/id_authorizationserver.go +++ b/resource-manager/apimanagement/2022-08-01/authorizationserver/id_authorizationserver.go @@ -38,23 +38,9 @@ func ParseAuthorizationServerID(input string) (*AuthorizationServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationServerId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.AuthorizationServerName, ok = parsed.Parsed["authorizationServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAuthorizationServerIDInsensitively(input string) (*AuthorizationServer return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AuthorizationServerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.AuthorizationServerName, ok = parsed.Parsed["authorizationServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationServerName", *parsed) + if id.AuthorizationServerName, ok = input.Parsed["authorizationServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationServerName", input) } - return &id, nil + return nil } // ValidateAuthorizationServerID checks that 'input' can be parsed as a Authorization Server ID diff --git a/resource-manager/apimanagement/2022-08-01/authorizationserver/id_service.go b/resource-manager/apimanagement/2022-08-01/authorizationserver/id_service.go index 48f4a9da5ef..3f964ef83c6 100644 --- a/resource-manager/apimanagement/2022-08-01/authorizationserver/id_service.go +++ b/resource-manager/apimanagement/2022-08-01/authorizationserver/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2022-08-01/backend/id_backend.go b/resource-manager/apimanagement/2022-08-01/backend/id_backend.go index c7b8374637c..7111cfb2ae2 100644 --- a/resource-manager/apimanagement/2022-08-01/backend/id_backend.go +++ b/resource-manager/apimanagement/2022-08-01/backend/id_backend.go @@ -38,23 +38,9 @@ func ParseBackendID(input string) (*BackendId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackendId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.BackendId, ok = parsed.Parsed["backendId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backendId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackendIDInsensitively(input string) (*BackendId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackendId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackendId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.BackendId, ok = parsed.Parsed["backendId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backendId", *parsed) + if id.BackendId, ok = input.Parsed["backendId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backendId", input) } - return &id, nil + return nil } // ValidateBackendID checks that 'input' can be parsed as a Backend ID diff --git a/resource-manager/apimanagement/2022-08-01/backend/id_service.go b/resource-manager/apimanagement/2022-08-01/backend/id_service.go index a11de0ac7ea..894e41b5ffc 100644 --- a/resource-manager/apimanagement/2022-08-01/backend/id_service.go +++ b/resource-manager/apimanagement/2022-08-01/backend/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2022-08-01/backendreconnect/id_backend.go b/resource-manager/apimanagement/2022-08-01/backendreconnect/id_backend.go index e7bd4bda27f..2323cd337f6 100644 --- a/resource-manager/apimanagement/2022-08-01/backendreconnect/id_backend.go +++ b/resource-manager/apimanagement/2022-08-01/backendreconnect/id_backend.go @@ -38,23 +38,9 @@ func ParseBackendID(input string) (*BackendId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackendId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.BackendId, ok = parsed.Parsed["backendId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backendId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackendIDInsensitively(input string) (*BackendId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackendId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackendId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.BackendId, ok = parsed.Parsed["backendId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backendId", *parsed) + if id.BackendId, ok = input.Parsed["backendId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backendId", input) } - return &id, nil + return nil } // ValidateBackendID checks that 'input' can be parsed as a Backend ID diff --git a/resource-manager/apimanagement/2022-08-01/cache/id_cache.go b/resource-manager/apimanagement/2022-08-01/cache/id_cache.go index f481a454c49..910f2dec436 100644 --- a/resource-manager/apimanagement/2022-08-01/cache/id_cache.go +++ b/resource-manager/apimanagement/2022-08-01/cache/id_cache.go @@ -38,23 +38,9 @@ func ParseCacheID(input string) (*CacheId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CacheId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.CacheId, ok = parsed.Parsed["cacheId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cacheId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCacheIDInsensitively(input string) (*CacheId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CacheId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CacheId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.CacheId, ok = parsed.Parsed["cacheId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cacheId", *parsed) + if id.CacheId, ok = input.Parsed["cacheId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cacheId", input) } - return &id, nil + return nil } // ValidateCacheID checks that 'input' can be parsed as a Cache ID diff --git a/resource-manager/apimanagement/2022-08-01/cache/id_service.go b/resource-manager/apimanagement/2022-08-01/cache/id_service.go index bbca8da8f3a..3b930b104ea 100644 --- a/resource-manager/apimanagement/2022-08-01/cache/id_service.go +++ b/resource-manager/apimanagement/2022-08-01/cache/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2022-08-01/certificate/id_certificate.go b/resource-manager/apimanagement/2022-08-01/certificate/id_certificate.go index 623d4954ece..d11ca5a81dc 100644 --- a/resource-manager/apimanagement/2022-08-01/certificate/id_certificate.go +++ b/resource-manager/apimanagement/2022-08-01/certificate/id_certificate.go @@ -38,23 +38,9 @@ func ParseCertificateID(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.CertificateId, ok = parsed.Parsed["certificateId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCertificateIDInsensitively(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.CertificateId, ok = parsed.Parsed["certificateId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateId", *parsed) + if id.CertificateId, ok = input.Parsed["certificateId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateId", input) } - return &id, nil + return nil } // ValidateCertificateID checks that 'input' can be parsed as a Certificate ID diff --git a/resource-manager/apimanagement/2022-08-01/certificate/id_service.go b/resource-manager/apimanagement/2022-08-01/certificate/id_service.go index 66a90053cb1..4f35a34a7d3 100644 --- a/resource-manager/apimanagement/2022-08-01/certificate/id_service.go +++ b/resource-manager/apimanagement/2022-08-01/certificate/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2022-08-01/contenttype/id_contenttype.go b/resource-manager/apimanagement/2022-08-01/contenttype/id_contenttype.go index 7328e1b225d..a38ab676dca 100644 --- a/resource-manager/apimanagement/2022-08-01/contenttype/id_contenttype.go +++ b/resource-manager/apimanagement/2022-08-01/contenttype/id_contenttype.go @@ -38,23 +38,9 @@ func ParseContentTypeID(input string) (*ContentTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContentTypeId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ContentTypeId, ok = parsed.Parsed["contentTypeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "contentTypeId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseContentTypeIDInsensitively(input string) (*ContentTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContentTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ContentTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ContentTypeId, ok = parsed.Parsed["contentTypeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "contentTypeId", *parsed) + if id.ContentTypeId, ok = input.Parsed["contentTypeId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "contentTypeId", input) } - return &id, nil + return nil } // ValidateContentTypeID checks that 'input' can be parsed as a Content Type ID diff --git a/resource-manager/apimanagement/2022-08-01/contenttype/id_service.go b/resource-manager/apimanagement/2022-08-01/contenttype/id_service.go index bd1834775c3..f425169a4cb 100644 --- a/resource-manager/apimanagement/2022-08-01/contenttype/id_service.go +++ b/resource-manager/apimanagement/2022-08-01/contenttype/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2022-08-01/contenttypecontentitem/id_contentitem.go b/resource-manager/apimanagement/2022-08-01/contenttypecontentitem/id_contentitem.go index 45d0a06c68d..4e6f414ce57 100644 --- a/resource-manager/apimanagement/2022-08-01/contenttypecontentitem/id_contentitem.go +++ b/resource-manager/apimanagement/2022-08-01/contenttypecontentitem/id_contentitem.go @@ -40,27 +40,9 @@ func ParseContentItemID(input string) (*ContentItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContentItemId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ContentTypeId, ok = parsed.Parsed["contentTypeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "contentTypeId", *parsed) - } - - if id.ContentItemId, ok = parsed.Parsed["contentItemId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "contentItemId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseContentItemIDInsensitively(input string) (*ContentItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContentItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ContentItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ContentTypeId, ok = parsed.Parsed["contentTypeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "contentTypeId", *parsed) + if id.ContentTypeId, ok = input.Parsed["contentTypeId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "contentTypeId", input) } - if id.ContentItemId, ok = parsed.Parsed["contentItemId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "contentItemId", *parsed) + if id.ContentItemId, ok = input.Parsed["contentItemId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "contentItemId", input) } - return &id, nil + return nil } // ValidateContentItemID checks that 'input' can be parsed as a Content Item ID diff --git a/resource-manager/apimanagement/2022-08-01/contenttypecontentitem/id_contenttype.go b/resource-manager/apimanagement/2022-08-01/contenttypecontentitem/id_contenttype.go index 3b5c1e346ee..9d8bfce288f 100644 --- a/resource-manager/apimanagement/2022-08-01/contenttypecontentitem/id_contenttype.go +++ b/resource-manager/apimanagement/2022-08-01/contenttypecontentitem/id_contenttype.go @@ -38,23 +38,9 @@ func ParseContentTypeID(input string) (*ContentTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContentTypeId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ContentTypeId, ok = parsed.Parsed["contentTypeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "contentTypeId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseContentTypeIDInsensitively(input string) (*ContentTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContentTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ContentTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ContentTypeId, ok = parsed.Parsed["contentTypeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "contentTypeId", *parsed) + if id.ContentTypeId, ok = input.Parsed["contentTypeId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "contentTypeId", input) } - return &id, nil + return nil } // ValidateContentTypeID checks that 'input' can be parsed as a Content Type ID diff --git a/resource-manager/apimanagement/2022-08-01/delegationsettings/id_service.go b/resource-manager/apimanagement/2022-08-01/delegationsettings/id_service.go index c58ec8e039b..5c8d2f37462 100644 --- a/resource-manager/apimanagement/2022-08-01/delegationsettings/id_service.go +++ b/resource-manager/apimanagement/2022-08-01/delegationsettings/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2022-08-01/deletedservice/id_deletedservice.go b/resource-manager/apimanagement/2022-08-01/deletedservice/id_deletedservice.go index 16ae59293af..316c4f88aae 100644 --- a/resource-manager/apimanagement/2022-08-01/deletedservice/id_deletedservice.go +++ b/resource-manager/apimanagement/2022-08-01/deletedservice/id_deletedservice.go @@ -36,19 +36,9 @@ func ParseDeletedServiceID(input string) (*DeletedServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeletedServiceId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.DeletedServiceName, ok = parsed.Parsed["deletedServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDeletedServiceIDInsensitively(input string) (*DeletedServiceId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeletedServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DeletedServiceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.DeletedServiceName, ok = parsed.Parsed["deletedServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedServiceName", *parsed) + if id.DeletedServiceName, ok = input.Parsed["deletedServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deletedServiceName", input) } - return &id, nil + return nil } // ValidateDeletedServiceID checks that 'input' can be parsed as a Deleted Service ID diff --git a/resource-manager/apimanagement/2022-08-01/diagnostic/id_diagnostic.go b/resource-manager/apimanagement/2022-08-01/diagnostic/id_diagnostic.go index e283d041523..dc614829351 100644 --- a/resource-manager/apimanagement/2022-08-01/diagnostic/id_diagnostic.go +++ b/resource-manager/apimanagement/2022-08-01/diagnostic/id_diagnostic.go @@ -38,23 +38,9 @@ func ParseDiagnosticID(input string) (*DiagnosticId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiagnosticId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.DiagnosticId, ok = parsed.Parsed["diagnosticId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDiagnosticIDInsensitively(input string) (*DiagnosticId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiagnosticId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DiagnosticId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.DiagnosticId, ok = parsed.Parsed["diagnosticId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticId", *parsed) + if id.DiagnosticId, ok = input.Parsed["diagnosticId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "diagnosticId", input) } - return &id, nil + return nil } // ValidateDiagnosticID checks that 'input' can be parsed as a Diagnostic ID diff --git a/resource-manager/apimanagement/2022-08-01/diagnostic/id_service.go b/resource-manager/apimanagement/2022-08-01/diagnostic/id_service.go index 521b0f80d0a..912c67cfa64 100644 --- a/resource-manager/apimanagement/2022-08-01/diagnostic/id_service.go +++ b/resource-manager/apimanagement/2022-08-01/diagnostic/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2022-08-01/documentationresource/id_documentation.go b/resource-manager/apimanagement/2022-08-01/documentationresource/id_documentation.go index 3ad31fd0dac..6705b4ef5e6 100644 --- a/resource-manager/apimanagement/2022-08-01/documentationresource/id_documentation.go +++ b/resource-manager/apimanagement/2022-08-01/documentationresource/id_documentation.go @@ -38,23 +38,9 @@ func ParseDocumentationID(input string) (*DocumentationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DocumentationId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.DocumentationId, ok = parsed.Parsed["documentationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "documentationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDocumentationIDInsensitively(input string) (*DocumentationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DocumentationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DocumentationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.DocumentationId, ok = parsed.Parsed["documentationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "documentationId", *parsed) + if id.DocumentationId, ok = input.Parsed["documentationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "documentationId", input) } - return &id, nil + return nil } // ValidateDocumentationID checks that 'input' can be parsed as a Documentation ID diff --git a/resource-manager/apimanagement/2022-08-01/documentationresource/id_service.go b/resource-manager/apimanagement/2022-08-01/documentationresource/id_service.go index 019e05f0f8d..c31d9d6516e 100644 --- a/resource-manager/apimanagement/2022-08-01/documentationresource/id_service.go +++ b/resource-manager/apimanagement/2022-08-01/documentationresource/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2022-08-01/emailtemplate/id_service.go b/resource-manager/apimanagement/2022-08-01/emailtemplate/id_service.go index 6b34dfa4d2e..a1f9eb65d86 100644 --- a/resource-manager/apimanagement/2022-08-01/emailtemplate/id_service.go +++ b/resource-manager/apimanagement/2022-08-01/emailtemplate/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2022-08-01/emailtemplates/id_template.go b/resource-manager/apimanagement/2022-08-01/emailtemplates/id_template.go index c088c6f73c5..7dc72ab7ffc 100644 --- a/resource-manager/apimanagement/2022-08-01/emailtemplates/id_template.go +++ b/resource-manager/apimanagement/2022-08-01/emailtemplates/id_template.go @@ -38,31 +38,9 @@ func ParseTemplateID(input string) (*TemplateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TemplateId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if v, ok := parsed.Parsed["templateName"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "templateName", *parsed) - } - - templateName, err := parseTemplateName(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.TemplateName = *templateName + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -77,34 +55,42 @@ func ParseTemplateIDInsensitively(input string) (*TemplateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TemplateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TemplateId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if v, ok := parsed.Parsed["templateName"]; true { + if v, ok := input.Parsed["templateName"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "templateName", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "templateName", input) } templateName, err := parseTemplateName(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.TemplateName = *templateName } - return &id, nil + return nil } // ValidateTemplateID checks that 'input' can be parsed as a Template ID diff --git a/resource-manager/apimanagement/2022-08-01/gateway/id_gateway.go b/resource-manager/apimanagement/2022-08-01/gateway/id_gateway.go index 34550bb3edc..ccbe85e114d 100644 --- a/resource-manager/apimanagement/2022-08-01/gateway/id_gateway.go +++ b/resource-manager/apimanagement/2022-08-01/gateway/id_gateway.go @@ -38,23 +38,9 @@ func ParseGatewayID(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGatewayIDInsensitively(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GatewayId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if id.GatewayId, ok = input.Parsed["gatewayId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", input) } - return &id, nil + return nil } // ValidateGatewayID checks that 'input' can be parsed as a Gateway ID diff --git a/resource-manager/apimanagement/2022-08-01/gateway/id_service.go b/resource-manager/apimanagement/2022-08-01/gateway/id_service.go index a45df593cf6..da4dbe6703a 100644 --- a/resource-manager/apimanagement/2022-08-01/gateway/id_service.go +++ b/resource-manager/apimanagement/2022-08-01/gateway/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2022-08-01/gatewayapi/id_gateway.go b/resource-manager/apimanagement/2022-08-01/gatewayapi/id_gateway.go index 4165de54710..0261bc252ac 100644 --- a/resource-manager/apimanagement/2022-08-01/gatewayapi/id_gateway.go +++ b/resource-manager/apimanagement/2022-08-01/gatewayapi/id_gateway.go @@ -38,23 +38,9 @@ func ParseGatewayID(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGatewayIDInsensitively(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GatewayId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if id.GatewayId, ok = input.Parsed["gatewayId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", input) } - return &id, nil + return nil } // ValidateGatewayID checks that 'input' can be parsed as a Gateway ID diff --git a/resource-manager/apimanagement/2022-08-01/gatewayapi/id_gatewayapi.go b/resource-manager/apimanagement/2022-08-01/gatewayapi/id_gatewayapi.go index 7dc333eb0d3..7c845917a0f 100644 --- a/resource-manager/apimanagement/2022-08-01/gatewayapi/id_gatewayapi.go +++ b/resource-manager/apimanagement/2022-08-01/gatewayapi/id_gatewayapi.go @@ -40,27 +40,9 @@ func ParseGatewayApiID(input string) (*GatewayApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseGatewayApiIDInsensitively(input string) (*GatewayApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *GatewayApiId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if id.GatewayId, ok = input.Parsed["gatewayId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateGatewayApiID checks that 'input' can be parsed as a Gateway Api ID diff --git a/resource-manager/apimanagement/2022-08-01/gatewaycertificateauthority/id_certificateauthority.go b/resource-manager/apimanagement/2022-08-01/gatewaycertificateauthority/id_certificateauthority.go index 237095225f1..fa08514181b 100644 --- a/resource-manager/apimanagement/2022-08-01/gatewaycertificateauthority/id_certificateauthority.go +++ b/resource-manager/apimanagement/2022-08-01/gatewaycertificateauthority/id_certificateauthority.go @@ -40,27 +40,9 @@ func ParseCertificateAuthorityID(input string) (*CertificateAuthorityId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateAuthorityId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) - } - - if id.CertificateId, ok = parsed.Parsed["certificateId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseCertificateAuthorityIDInsensitively(input string) (*CertificateAuthori return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateAuthorityId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *CertificateAuthorityId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if id.GatewayId, ok = input.Parsed["gatewayId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", input) } - if id.CertificateId, ok = parsed.Parsed["certificateId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateId", *parsed) + if id.CertificateId, ok = input.Parsed["certificateId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateId", input) } - return &id, nil + return nil } // ValidateCertificateAuthorityID checks that 'input' can be parsed as a Certificate Authority ID diff --git a/resource-manager/apimanagement/2022-08-01/gatewaycertificateauthority/id_gateway.go b/resource-manager/apimanagement/2022-08-01/gatewaycertificateauthority/id_gateway.go index 787e1bc3e37..9f62338c3e7 100644 --- a/resource-manager/apimanagement/2022-08-01/gatewaycertificateauthority/id_gateway.go +++ b/resource-manager/apimanagement/2022-08-01/gatewaycertificateauthority/id_gateway.go @@ -38,23 +38,9 @@ func ParseGatewayID(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGatewayIDInsensitively(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GatewayId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if id.GatewayId, ok = input.Parsed["gatewayId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", input) } - return &id, nil + return nil } // ValidateGatewayID checks that 'input' can be parsed as a Gateway ID diff --git a/resource-manager/apimanagement/2022-08-01/gatewaygeneratetoken/id_gateway.go b/resource-manager/apimanagement/2022-08-01/gatewaygeneratetoken/id_gateway.go index 6d924627762..fc452bcf7d7 100644 --- a/resource-manager/apimanagement/2022-08-01/gatewaygeneratetoken/id_gateway.go +++ b/resource-manager/apimanagement/2022-08-01/gatewaygeneratetoken/id_gateway.go @@ -38,23 +38,9 @@ func ParseGatewayID(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGatewayIDInsensitively(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GatewayId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if id.GatewayId, ok = input.Parsed["gatewayId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", input) } - return &id, nil + return nil } // ValidateGatewayID checks that 'input' can be parsed as a Gateway ID diff --git a/resource-manager/apimanagement/2022-08-01/gatewayhostnameconfiguration/id_gateway.go b/resource-manager/apimanagement/2022-08-01/gatewayhostnameconfiguration/id_gateway.go index db58fe2a01d..ee66d381b60 100644 --- a/resource-manager/apimanagement/2022-08-01/gatewayhostnameconfiguration/id_gateway.go +++ b/resource-manager/apimanagement/2022-08-01/gatewayhostnameconfiguration/id_gateway.go @@ -38,23 +38,9 @@ func ParseGatewayID(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGatewayIDInsensitively(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GatewayId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if id.GatewayId, ok = input.Parsed["gatewayId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", input) } - return &id, nil + return nil } // ValidateGatewayID checks that 'input' can be parsed as a Gateway ID diff --git a/resource-manager/apimanagement/2022-08-01/gatewayhostnameconfiguration/id_hostnameconfiguration.go b/resource-manager/apimanagement/2022-08-01/gatewayhostnameconfiguration/id_hostnameconfiguration.go index 6161f448656..345c2161ae6 100644 --- a/resource-manager/apimanagement/2022-08-01/gatewayhostnameconfiguration/id_hostnameconfiguration.go +++ b/resource-manager/apimanagement/2022-08-01/gatewayhostnameconfiguration/id_hostnameconfiguration.go @@ -40,27 +40,9 @@ func ParseHostnameConfigurationID(input string) (*HostnameConfigurationId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostnameConfigurationId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) - } - - if id.HcId, ok = parsed.Parsed["hcId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hcId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseHostnameConfigurationIDInsensitively(input string) (*HostnameConfigura return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostnameConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *HostnameConfigurationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if id.GatewayId, ok = input.Parsed["gatewayId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", input) } - if id.HcId, ok = parsed.Parsed["hcId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hcId", *parsed) + if id.HcId, ok = input.Parsed["hcId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hcId", input) } - return &id, nil + return nil } // ValidateHostnameConfigurationID checks that 'input' can be parsed as a Hostname Configuration ID diff --git a/resource-manager/apimanagement/2022-08-01/gatewaylistkeys/id_gateway.go b/resource-manager/apimanagement/2022-08-01/gatewaylistkeys/id_gateway.go index 31bcc239ed0..10b1e70ee49 100644 --- a/resource-manager/apimanagement/2022-08-01/gatewaylistkeys/id_gateway.go +++ b/resource-manager/apimanagement/2022-08-01/gatewaylistkeys/id_gateway.go @@ -38,23 +38,9 @@ func ParseGatewayID(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGatewayIDInsensitively(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GatewayId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if id.GatewayId, ok = input.Parsed["gatewayId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", input) } - return &id, nil + return nil } // ValidateGatewayID checks that 'input' can be parsed as a Gateway ID diff --git a/resource-manager/apimanagement/2022-08-01/gatewayregeneratekey/id_gateway.go b/resource-manager/apimanagement/2022-08-01/gatewayregeneratekey/id_gateway.go index 514b9366d19..91b264cbd9e 100644 --- a/resource-manager/apimanagement/2022-08-01/gatewayregeneratekey/id_gateway.go +++ b/resource-manager/apimanagement/2022-08-01/gatewayregeneratekey/id_gateway.go @@ -38,23 +38,9 @@ func ParseGatewayID(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGatewayIDInsensitively(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GatewayId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if id.GatewayId, ok = input.Parsed["gatewayId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", input) } - return &id, nil + return nil } // ValidateGatewayID checks that 'input' can be parsed as a Gateway ID diff --git a/resource-manager/apimanagement/2022-08-01/graphqlapiresolver/id_api.go b/resource-manager/apimanagement/2022-08-01/graphqlapiresolver/id_api.go index 06ebb68e150..93e3218bcdd 100644 --- a/resource-manager/apimanagement/2022-08-01/graphqlapiresolver/id_api.go +++ b/resource-manager/apimanagement/2022-08-01/graphqlapiresolver/id_api.go @@ -38,23 +38,9 @@ func ParseApiID(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiIDInsensitively(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateApiID checks that 'input' can be parsed as a Api ID diff --git a/resource-manager/apimanagement/2022-08-01/graphqlapiresolver/id_resolver.go b/resource-manager/apimanagement/2022-08-01/graphqlapiresolver/id_resolver.go index d657ec444db..d767751c128 100644 --- a/resource-manager/apimanagement/2022-08-01/graphqlapiresolver/id_resolver.go +++ b/resource-manager/apimanagement/2022-08-01/graphqlapiresolver/id_resolver.go @@ -40,27 +40,9 @@ func ParseResolverID(input string) (*ResolverId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResolverId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.ResolverId, ok = parsed.Parsed["resolverId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resolverId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseResolverIDInsensitively(input string) (*ResolverId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResolverId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ResolverId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.ResolverId, ok = parsed.Parsed["resolverId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resolverId", *parsed) + if id.ResolverId, ok = input.Parsed["resolverId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resolverId", input) } - return &id, nil + return nil } // ValidateResolverID checks that 'input' can be parsed as a Resolver ID diff --git a/resource-manager/apimanagement/2022-08-01/graphqlapiresolverpolicy/id_resolver.go b/resource-manager/apimanagement/2022-08-01/graphqlapiresolverpolicy/id_resolver.go index dd348a9e3ab..d78abb8a805 100644 --- a/resource-manager/apimanagement/2022-08-01/graphqlapiresolverpolicy/id_resolver.go +++ b/resource-manager/apimanagement/2022-08-01/graphqlapiresolverpolicy/id_resolver.go @@ -40,27 +40,9 @@ func ParseResolverID(input string) (*ResolverId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResolverId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.ResolverId, ok = parsed.Parsed["resolverId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resolverId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseResolverIDInsensitively(input string) (*ResolverId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResolverId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ResolverId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.ResolverId, ok = parsed.Parsed["resolverId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resolverId", *parsed) + if id.ResolverId, ok = input.Parsed["resolverId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resolverId", input) } - return &id, nil + return nil } // ValidateResolverID checks that 'input' can be parsed as a Resolver ID diff --git a/resource-manager/apimanagement/2022-08-01/group/id_group.go b/resource-manager/apimanagement/2022-08-01/group/id_group.go index 1cb69ca64b1..b6224b4b2d5 100644 --- a/resource-manager/apimanagement/2022-08-01/group/id_group.go +++ b/resource-manager/apimanagement/2022-08-01/group/id_group.go @@ -38,23 +38,9 @@ func ParseGroupID(input string) (*GroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GroupId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGroupIDInsensitively(input string) (*GroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + if id.GroupId, ok = input.Parsed["groupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "groupId", input) } - return &id, nil + return nil } // ValidateGroupID checks that 'input' can be parsed as a Group ID diff --git a/resource-manager/apimanagement/2022-08-01/group/id_service.go b/resource-manager/apimanagement/2022-08-01/group/id_service.go index 916e4cfce48..f9caa2ad509 100644 --- a/resource-manager/apimanagement/2022-08-01/group/id_service.go +++ b/resource-manager/apimanagement/2022-08-01/group/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2022-08-01/groupuser/id_group.go b/resource-manager/apimanagement/2022-08-01/groupuser/id_group.go index 9d328f9f026..8700a88c74c 100644 --- a/resource-manager/apimanagement/2022-08-01/groupuser/id_group.go +++ b/resource-manager/apimanagement/2022-08-01/groupuser/id_group.go @@ -38,23 +38,9 @@ func ParseGroupID(input string) (*GroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GroupId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGroupIDInsensitively(input string) (*GroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + if id.GroupId, ok = input.Parsed["groupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "groupId", input) } - return &id, nil + return nil } // ValidateGroupID checks that 'input' can be parsed as a Group ID diff --git a/resource-manager/apimanagement/2022-08-01/groupuser/id_groupuser.go b/resource-manager/apimanagement/2022-08-01/groupuser/id_groupuser.go index 70947c02de3..107bb00c1fb 100644 --- a/resource-manager/apimanagement/2022-08-01/groupuser/id_groupuser.go +++ b/resource-manager/apimanagement/2022-08-01/groupuser/id_groupuser.go @@ -40,27 +40,9 @@ func ParseGroupUserID(input string) (*GroupUserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GroupUserId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) - } - - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseGroupUserIDInsensitively(input string) (*GroupUserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GroupUserId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *GroupUserId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + if id.GroupId, ok = input.Parsed["groupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "groupId", input) } - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if id.UserId, ok = input.Parsed["userId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userId", input) } - return &id, nil + return nil } // ValidateGroupUserID checks that 'input' can be parsed as a Group User ID diff --git a/resource-manager/apimanagement/2022-08-01/identityprovider/id_identityprovider.go b/resource-manager/apimanagement/2022-08-01/identityprovider/id_identityprovider.go index b31fc9697f3..cb485fbbca2 100644 --- a/resource-manager/apimanagement/2022-08-01/identityprovider/id_identityprovider.go +++ b/resource-manager/apimanagement/2022-08-01/identityprovider/id_identityprovider.go @@ -38,31 +38,9 @@ func ParseIdentityProviderID(input string) (*IdentityProviderId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IdentityProviderId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if v, ok := parsed.Parsed["identityProviderName"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "identityProviderName", *parsed) - } - - identityProviderName, err := parseIdentityProviderType(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.IdentityProviderName = *identityProviderName + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -77,34 +55,42 @@ func ParseIdentityProviderIDInsensitively(input string) (*IdentityProviderId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IdentityProviderId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *IdentityProviderId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if v, ok := parsed.Parsed["identityProviderName"]; true { + if v, ok := input.Parsed["identityProviderName"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "identityProviderName", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "identityProviderName", input) } identityProviderName, err := parseIdentityProviderType(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.IdentityProviderName = *identityProviderName } - return &id, nil + return nil } // ValidateIdentityProviderID checks that 'input' can be parsed as a Identity Provider ID diff --git a/resource-manager/apimanagement/2022-08-01/identityprovider/id_service.go b/resource-manager/apimanagement/2022-08-01/identityprovider/id_service.go index 89ca80d7df0..b2789ac6a8f 100644 --- a/resource-manager/apimanagement/2022-08-01/identityprovider/id_service.go +++ b/resource-manager/apimanagement/2022-08-01/identityprovider/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2022-08-01/issue/id_issue.go b/resource-manager/apimanagement/2022-08-01/issue/id_issue.go index 4e23d04fe18..77ce6f29b3b 100644 --- a/resource-manager/apimanagement/2022-08-01/issue/id_issue.go +++ b/resource-manager/apimanagement/2022-08-01/issue/id_issue.go @@ -38,23 +38,9 @@ func ParseIssueID(input string) (*IssueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IssueId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.IssueId, ok = parsed.Parsed["issueId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "issueId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIssueIDInsensitively(input string) (*IssueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IssueId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IssueId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.IssueId, ok = parsed.Parsed["issueId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "issueId", *parsed) + if id.IssueId, ok = input.Parsed["issueId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "issueId", input) } - return &id, nil + return nil } // ValidateIssueID checks that 'input' can be parsed as a Issue ID diff --git a/resource-manager/apimanagement/2022-08-01/issue/id_service.go b/resource-manager/apimanagement/2022-08-01/issue/id_service.go index 48789e072fb..86785e7cc0d 100644 --- a/resource-manager/apimanagement/2022-08-01/issue/id_service.go +++ b/resource-manager/apimanagement/2022-08-01/issue/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2022-08-01/logger/id_logger.go b/resource-manager/apimanagement/2022-08-01/logger/id_logger.go index ee7f985a191..48e0f627f2a 100644 --- a/resource-manager/apimanagement/2022-08-01/logger/id_logger.go +++ b/resource-manager/apimanagement/2022-08-01/logger/id_logger.go @@ -38,23 +38,9 @@ func ParseLoggerID(input string) (*LoggerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LoggerId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.LoggerId, ok = parsed.Parsed["loggerId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loggerId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLoggerIDInsensitively(input string) (*LoggerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LoggerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LoggerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.LoggerId, ok = parsed.Parsed["loggerId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loggerId", *parsed) + if id.LoggerId, ok = input.Parsed["loggerId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "loggerId", input) } - return &id, nil + return nil } // ValidateLoggerID checks that 'input' can be parsed as a Logger ID diff --git a/resource-manager/apimanagement/2022-08-01/logger/id_service.go b/resource-manager/apimanagement/2022-08-01/logger/id_service.go index 5807ecae3aa..af4ae84d1ca 100644 --- a/resource-manager/apimanagement/2022-08-01/logger/id_service.go +++ b/resource-manager/apimanagement/2022-08-01/logger/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2022-08-01/namedvalue/id_namedvalue.go b/resource-manager/apimanagement/2022-08-01/namedvalue/id_namedvalue.go index eb84d26bb30..7356af722df 100644 --- a/resource-manager/apimanagement/2022-08-01/namedvalue/id_namedvalue.go +++ b/resource-manager/apimanagement/2022-08-01/namedvalue/id_namedvalue.go @@ -38,23 +38,9 @@ func ParseNamedValueID(input string) (*NamedValueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamedValueId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.NamedValueId, ok = parsed.Parsed["namedValueId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namedValueId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseNamedValueIDInsensitively(input string) (*NamedValueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamedValueId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *NamedValueId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.NamedValueId, ok = parsed.Parsed["namedValueId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namedValueId", *parsed) + if id.NamedValueId, ok = input.Parsed["namedValueId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namedValueId", input) } - return &id, nil + return nil } // ValidateNamedValueID checks that 'input' can be parsed as a Named Value ID diff --git a/resource-manager/apimanagement/2022-08-01/namedvalue/id_service.go b/resource-manager/apimanagement/2022-08-01/namedvalue/id_service.go index a39da071fda..51c851d257f 100644 --- a/resource-manager/apimanagement/2022-08-01/namedvalue/id_service.go +++ b/resource-manager/apimanagement/2022-08-01/namedvalue/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2022-08-01/networkstatus/id_location.go b/resource-manager/apimanagement/2022-08-01/networkstatus/id_location.go index 9bae59232c7..96f6c21f46a 100644 --- a/resource-manager/apimanagement/2022-08-01/networkstatus/id_location.go +++ b/resource-manager/apimanagement/2022-08-01/networkstatus/id_location.go @@ -38,23 +38,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/apimanagement/2022-08-01/networkstatus/id_service.go b/resource-manager/apimanagement/2022-08-01/networkstatus/id_service.go index 7607c8f6e3e..42461e8b992 100644 --- a/resource-manager/apimanagement/2022-08-01/networkstatus/id_service.go +++ b/resource-manager/apimanagement/2022-08-01/networkstatus/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2022-08-01/notification/id_notification.go b/resource-manager/apimanagement/2022-08-01/notification/id_notification.go index d769f22070b..ebb5d7ad704 100644 --- a/resource-manager/apimanagement/2022-08-01/notification/id_notification.go +++ b/resource-manager/apimanagement/2022-08-01/notification/id_notification.go @@ -38,31 +38,9 @@ func ParseNotificationID(input string) (*NotificationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NotificationId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if v, ok := parsed.Parsed["notificationName"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationName", *parsed) - } - - notificationName, err := parseNotificationName(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.NotificationName = *notificationName + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -77,34 +55,42 @@ func ParseNotificationIDInsensitively(input string) (*NotificationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NotificationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *NotificationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if v, ok := parsed.Parsed["notificationName"]; true { + if v, ok := input.Parsed["notificationName"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationName", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "notificationName", input) } notificationName, err := parseNotificationName(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.NotificationName = *notificationName } - return &id, nil + return nil } // ValidateNotificationID checks that 'input' can be parsed as a Notification ID diff --git a/resource-manager/apimanagement/2022-08-01/notification/id_service.go b/resource-manager/apimanagement/2022-08-01/notification/id_service.go index a3e0af16c59..11b88b72604 100644 --- a/resource-manager/apimanagement/2022-08-01/notification/id_service.go +++ b/resource-manager/apimanagement/2022-08-01/notification/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2022-08-01/notificationrecipientemail/id_notification.go b/resource-manager/apimanagement/2022-08-01/notificationrecipientemail/id_notification.go index 03494ec3aec..c6cab7f7856 100644 --- a/resource-manager/apimanagement/2022-08-01/notificationrecipientemail/id_notification.go +++ b/resource-manager/apimanagement/2022-08-01/notificationrecipientemail/id_notification.go @@ -38,31 +38,9 @@ func ParseNotificationID(input string) (*NotificationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NotificationId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if v, ok := parsed.Parsed["notificationName"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationName", *parsed) - } - - notificationName, err := parseNotificationName(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.NotificationName = *notificationName + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -77,34 +55,42 @@ func ParseNotificationIDInsensitively(input string) (*NotificationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NotificationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *NotificationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if v, ok := parsed.Parsed["notificationName"]; true { + if v, ok := input.Parsed["notificationName"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationName", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "notificationName", input) } notificationName, err := parseNotificationName(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.NotificationName = *notificationName } - return &id, nil + return nil } // ValidateNotificationID checks that 'input' can be parsed as a Notification ID diff --git a/resource-manager/apimanagement/2022-08-01/notificationrecipientemail/id_recipientemail.go b/resource-manager/apimanagement/2022-08-01/notificationrecipientemail/id_recipientemail.go index 622fa5001ba..9616fe55542 100644 --- a/resource-manager/apimanagement/2022-08-01/notificationrecipientemail/id_recipientemail.go +++ b/resource-manager/apimanagement/2022-08-01/notificationrecipientemail/id_recipientemail.go @@ -40,35 +40,9 @@ func ParseRecipientEmailID(input string) (*RecipientEmailId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecipientEmailId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if v, ok := parsed.Parsed["notificationName"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationName", *parsed) - } - - notificationName, err := parseNotificationName(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.NotificationName = *notificationName - } - - if id.RecipientEmailName, ok = parsed.Parsed["recipientEmailName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recipientEmailName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -83,38 +57,46 @@ func ParseRecipientEmailIDInsensitively(input string) (*RecipientEmailId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecipientEmailId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RecipientEmailId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if v, ok := parsed.Parsed["notificationName"]; true { + if v, ok := input.Parsed["notificationName"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationName", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "notificationName", input) } notificationName, err := parseNotificationName(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.NotificationName = *notificationName } - if id.RecipientEmailName, ok = parsed.Parsed["recipientEmailName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recipientEmailName", *parsed) + if id.RecipientEmailName, ok = input.Parsed["recipientEmailName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "recipientEmailName", input) } - return &id, nil + return nil } // ValidateRecipientEmailID checks that 'input' can be parsed as a Recipient Email ID diff --git a/resource-manager/apimanagement/2022-08-01/notificationrecipientuser/id_notification.go b/resource-manager/apimanagement/2022-08-01/notificationrecipientuser/id_notification.go index 9e0e8aebd25..c1f566238f9 100644 --- a/resource-manager/apimanagement/2022-08-01/notificationrecipientuser/id_notification.go +++ b/resource-manager/apimanagement/2022-08-01/notificationrecipientuser/id_notification.go @@ -38,31 +38,9 @@ func ParseNotificationID(input string) (*NotificationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NotificationId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if v, ok := parsed.Parsed["notificationName"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationName", *parsed) - } - - notificationName, err := parseNotificationName(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.NotificationName = *notificationName + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -77,34 +55,42 @@ func ParseNotificationIDInsensitively(input string) (*NotificationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NotificationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *NotificationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if v, ok := parsed.Parsed["notificationName"]; true { + if v, ok := input.Parsed["notificationName"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationName", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "notificationName", input) } notificationName, err := parseNotificationName(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.NotificationName = *notificationName } - return &id, nil + return nil } // ValidateNotificationID checks that 'input' can be parsed as a Notification ID diff --git a/resource-manager/apimanagement/2022-08-01/notificationrecipientuser/id_recipientuser.go b/resource-manager/apimanagement/2022-08-01/notificationrecipientuser/id_recipientuser.go index ba60daeb64b..d5e2ce19d24 100644 --- a/resource-manager/apimanagement/2022-08-01/notificationrecipientuser/id_recipientuser.go +++ b/resource-manager/apimanagement/2022-08-01/notificationrecipientuser/id_recipientuser.go @@ -40,35 +40,9 @@ func ParseRecipientUserID(input string) (*RecipientUserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecipientUserId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if v, ok := parsed.Parsed["notificationName"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationName", *parsed) - } - - notificationName, err := parseNotificationName(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.NotificationName = *notificationName - } - - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -83,38 +57,46 @@ func ParseRecipientUserIDInsensitively(input string) (*RecipientUserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecipientUserId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RecipientUserId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if v, ok := parsed.Parsed["notificationName"]; true { + if v, ok := input.Parsed["notificationName"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationName", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "notificationName", input) } notificationName, err := parseNotificationName(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.NotificationName = *notificationName } - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if id.UserId, ok = input.Parsed["userId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userId", input) } - return &id, nil + return nil } // ValidateRecipientUserID checks that 'input' can be parsed as a Recipient User ID diff --git a/resource-manager/apimanagement/2022-08-01/openidconnectprovider/id_openidconnectprovider.go b/resource-manager/apimanagement/2022-08-01/openidconnectprovider/id_openidconnectprovider.go index 4c21b8383e0..6281797c5ed 100644 --- a/resource-manager/apimanagement/2022-08-01/openidconnectprovider/id_openidconnectprovider.go +++ b/resource-manager/apimanagement/2022-08-01/openidconnectprovider/id_openidconnectprovider.go @@ -38,23 +38,9 @@ func ParseOpenidConnectProviderID(input string) (*OpenidConnectProviderId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OpenidConnectProviderId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.OpenidConnectProviderName, ok = parsed.Parsed["openidConnectProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openidConnectProviderName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseOpenidConnectProviderIDInsensitively(input string) (*OpenidConnectProv return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OpenidConnectProviderId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OpenidConnectProviderId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.OpenidConnectProviderName, ok = parsed.Parsed["openidConnectProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openidConnectProviderName", *parsed) + if id.OpenidConnectProviderName, ok = input.Parsed["openidConnectProviderName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "openidConnectProviderName", input) } - return &id, nil + return nil } // ValidateOpenidConnectProviderID checks that 'input' can be parsed as a Openid Connect Provider ID diff --git a/resource-manager/apimanagement/2022-08-01/openidconnectprovider/id_service.go b/resource-manager/apimanagement/2022-08-01/openidconnectprovider/id_service.go index 5c1589b4130..6011bac9dea 100644 --- a/resource-manager/apimanagement/2022-08-01/openidconnectprovider/id_service.go +++ b/resource-manager/apimanagement/2022-08-01/openidconnectprovider/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2022-08-01/outboundnetworkdependenciesendpoints/id_service.go b/resource-manager/apimanagement/2022-08-01/outboundnetworkdependenciesendpoints/id_service.go index 632f1977756..fe94cec9540 100644 --- a/resource-manager/apimanagement/2022-08-01/outboundnetworkdependenciesendpoints/id_service.go +++ b/resource-manager/apimanagement/2022-08-01/outboundnetworkdependenciesendpoints/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2022-08-01/performconnectivitycheck/id_service.go b/resource-manager/apimanagement/2022-08-01/performconnectivitycheck/id_service.go index 4825412ea3d..5ba3db30421 100644 --- a/resource-manager/apimanagement/2022-08-01/performconnectivitycheck/id_service.go +++ b/resource-manager/apimanagement/2022-08-01/performconnectivitycheck/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2022-08-01/policy/id_service.go b/resource-manager/apimanagement/2022-08-01/policy/id_service.go index abd4ff17b68..a56cd4fcbd9 100644 --- a/resource-manager/apimanagement/2022-08-01/policy/id_service.go +++ b/resource-manager/apimanagement/2022-08-01/policy/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2022-08-01/policydescription/id_service.go b/resource-manager/apimanagement/2022-08-01/policydescription/id_service.go index b98c923d87b..69e0fb3fc50 100644 --- a/resource-manager/apimanagement/2022-08-01/policydescription/id_service.go +++ b/resource-manager/apimanagement/2022-08-01/policydescription/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2022-08-01/policyfragment/id_policyfragment.go b/resource-manager/apimanagement/2022-08-01/policyfragment/id_policyfragment.go index 353ec0820e9..84038f6a5b5 100644 --- a/resource-manager/apimanagement/2022-08-01/policyfragment/id_policyfragment.go +++ b/resource-manager/apimanagement/2022-08-01/policyfragment/id_policyfragment.go @@ -38,23 +38,9 @@ func ParsePolicyFragmentID(input string) (*PolicyFragmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PolicyFragmentId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.PolicyFragmentName, ok = parsed.Parsed["policyFragmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policyFragmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePolicyFragmentIDInsensitively(input string) (*PolicyFragmentId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PolicyFragmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PolicyFragmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.PolicyFragmentName, ok = parsed.Parsed["policyFragmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policyFragmentName", *parsed) + if id.PolicyFragmentName, ok = input.Parsed["policyFragmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "policyFragmentName", input) } - return &id, nil + return nil } // ValidatePolicyFragmentID checks that 'input' can be parsed as a Policy Fragment ID diff --git a/resource-manager/apimanagement/2022-08-01/policyfragment/id_service.go b/resource-manager/apimanagement/2022-08-01/policyfragment/id_service.go index e7865065dfb..3dd82cf7e72 100644 --- a/resource-manager/apimanagement/2022-08-01/policyfragment/id_service.go +++ b/resource-manager/apimanagement/2022-08-01/policyfragment/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2022-08-01/portalconfig/id_portalconfig.go b/resource-manager/apimanagement/2022-08-01/portalconfig/id_portalconfig.go index 0ccfcf508c3..5bf077e2a3d 100644 --- a/resource-manager/apimanagement/2022-08-01/portalconfig/id_portalconfig.go +++ b/resource-manager/apimanagement/2022-08-01/portalconfig/id_portalconfig.go @@ -38,23 +38,9 @@ func ParsePortalConfigID(input string) (*PortalConfigId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PortalConfigId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.PortalConfigId, ok = parsed.Parsed["portalConfigId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "portalConfigId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePortalConfigIDInsensitively(input string) (*PortalConfigId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PortalConfigId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PortalConfigId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.PortalConfigId, ok = parsed.Parsed["portalConfigId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "portalConfigId", *parsed) + if id.PortalConfigId, ok = input.Parsed["portalConfigId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "portalConfigId", input) } - return &id, nil + return nil } // ValidatePortalConfigID checks that 'input' can be parsed as a Portal Config ID diff --git a/resource-manager/apimanagement/2022-08-01/portalconfig/id_service.go b/resource-manager/apimanagement/2022-08-01/portalconfig/id_service.go index 3564b20fa9d..ff95f491c74 100644 --- a/resource-manager/apimanagement/2022-08-01/portalconfig/id_service.go +++ b/resource-manager/apimanagement/2022-08-01/portalconfig/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2022-08-01/portalrevision/id_portalrevision.go b/resource-manager/apimanagement/2022-08-01/portalrevision/id_portalrevision.go index 4d8f88e3d4d..036c4579efd 100644 --- a/resource-manager/apimanagement/2022-08-01/portalrevision/id_portalrevision.go +++ b/resource-manager/apimanagement/2022-08-01/portalrevision/id_portalrevision.go @@ -38,23 +38,9 @@ func ParsePortalRevisionID(input string) (*PortalRevisionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PortalRevisionId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.PortalRevisionId, ok = parsed.Parsed["portalRevisionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "portalRevisionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePortalRevisionIDInsensitively(input string) (*PortalRevisionId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PortalRevisionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PortalRevisionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.PortalRevisionId, ok = parsed.Parsed["portalRevisionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "portalRevisionId", *parsed) + if id.PortalRevisionId, ok = input.Parsed["portalRevisionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "portalRevisionId", input) } - return &id, nil + return nil } // ValidatePortalRevisionID checks that 'input' can be parsed as a Portal Revision ID diff --git a/resource-manager/apimanagement/2022-08-01/portalrevision/id_service.go b/resource-manager/apimanagement/2022-08-01/portalrevision/id_service.go index 1144f19c377..e9329b7bd26 100644 --- a/resource-manager/apimanagement/2022-08-01/portalrevision/id_service.go +++ b/resource-manager/apimanagement/2022-08-01/portalrevision/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2022-08-01/portalsettings/id_service.go b/resource-manager/apimanagement/2022-08-01/portalsettings/id_service.go index 1afbc255261..08c2e404b72 100644 --- a/resource-manager/apimanagement/2022-08-01/portalsettings/id_service.go +++ b/resource-manager/apimanagement/2022-08-01/portalsettings/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2022-08-01/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/apimanagement/2022-08-01/privateendpointconnections/id_privateendpointconnection.go index fde99d1b98f..1af5dc47cf0 100644 --- a/resource-manager/apimanagement/2022-08-01/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/apimanagement/2022-08-01/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/apimanagement/2022-08-01/privateendpointconnections/id_privatelinkresource.go b/resource-manager/apimanagement/2022-08-01/privateendpointconnections/id_privatelinkresource.go index 3308d3eb863..517deab7731 100644 --- a/resource-manager/apimanagement/2022-08-01/privateendpointconnections/id_privatelinkresource.go +++ b/resource-manager/apimanagement/2022-08-01/privateendpointconnections/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/apimanagement/2022-08-01/privateendpointconnections/id_service.go b/resource-manager/apimanagement/2022-08-01/privateendpointconnections/id_service.go index 38c6b0f9c6a..38852b1d31d 100644 --- a/resource-manager/apimanagement/2022-08-01/privateendpointconnections/id_service.go +++ b/resource-manager/apimanagement/2022-08-01/privateendpointconnections/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2022-08-01/product/id_product.go b/resource-manager/apimanagement/2022-08-01/product/id_product.go index 68fc58b3c0c..c7625d1d9ac 100644 --- a/resource-manager/apimanagement/2022-08-01/product/id_product.go +++ b/resource-manager/apimanagement/2022-08-01/product/id_product.go @@ -38,23 +38,9 @@ func ParseProductID(input string) (*ProductId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProductIDInsensitively(input string) (*ProductId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProductId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if id.ProductId, ok = input.Parsed["productId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "productId", input) } - return &id, nil + return nil } // ValidateProductID checks that 'input' can be parsed as a Product ID diff --git a/resource-manager/apimanagement/2022-08-01/product/id_service.go b/resource-manager/apimanagement/2022-08-01/product/id_service.go index 453a38674d7..90ce39c0b6e 100644 --- a/resource-manager/apimanagement/2022-08-01/product/id_service.go +++ b/resource-manager/apimanagement/2022-08-01/product/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2022-08-01/productapi/id_product.go b/resource-manager/apimanagement/2022-08-01/productapi/id_product.go index ab13414a812..12e7e9f3173 100644 --- a/resource-manager/apimanagement/2022-08-01/productapi/id_product.go +++ b/resource-manager/apimanagement/2022-08-01/productapi/id_product.go @@ -38,23 +38,9 @@ func ParseProductID(input string) (*ProductId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProductIDInsensitively(input string) (*ProductId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProductId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if id.ProductId, ok = input.Parsed["productId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "productId", input) } - return &id, nil + return nil } // ValidateProductID checks that 'input' can be parsed as a Product ID diff --git a/resource-manager/apimanagement/2022-08-01/productapi/id_productapi.go b/resource-manager/apimanagement/2022-08-01/productapi/id_productapi.go index 241d1d4221d..1b0829c762a 100644 --- a/resource-manager/apimanagement/2022-08-01/productapi/id_productapi.go +++ b/resource-manager/apimanagement/2022-08-01/productapi/id_productapi.go @@ -40,27 +40,9 @@ func ParseProductApiID(input string) (*ProductApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseProductApiIDInsensitively(input string) (*ProductApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ProductApiId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if id.ProductId, ok = input.Parsed["productId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "productId", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateProductApiID checks that 'input' can be parsed as a Product Api ID diff --git a/resource-manager/apimanagement/2022-08-01/productgroup/id_product.go b/resource-manager/apimanagement/2022-08-01/productgroup/id_product.go index 78d1bbc0028..9da605f113d 100644 --- a/resource-manager/apimanagement/2022-08-01/productgroup/id_product.go +++ b/resource-manager/apimanagement/2022-08-01/productgroup/id_product.go @@ -38,23 +38,9 @@ func ParseProductID(input string) (*ProductId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProductIDInsensitively(input string) (*ProductId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProductId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if id.ProductId, ok = input.Parsed["productId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "productId", input) } - return &id, nil + return nil } // ValidateProductID checks that 'input' can be parsed as a Product ID diff --git a/resource-manager/apimanagement/2022-08-01/productgroup/id_productgroup.go b/resource-manager/apimanagement/2022-08-01/productgroup/id_productgroup.go index 3da15ed373b..a38f7d26fa3 100644 --- a/resource-manager/apimanagement/2022-08-01/productgroup/id_productgroup.go +++ b/resource-manager/apimanagement/2022-08-01/productgroup/id_productgroup.go @@ -40,27 +40,9 @@ func ParseProductGroupID(input string) (*ProductGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductGroupId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) - } - - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseProductGroupIDInsensitively(input string) (*ProductGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ProductGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if id.ProductId, ok = input.Parsed["productId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "productId", input) } - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + if id.GroupId, ok = input.Parsed["groupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "groupId", input) } - return &id, nil + return nil } // ValidateProductGroupID checks that 'input' can be parsed as a Product Group ID diff --git a/resource-manager/apimanagement/2022-08-01/productpolicy/id_product.go b/resource-manager/apimanagement/2022-08-01/productpolicy/id_product.go index 9698867e813..4baef506e98 100644 --- a/resource-manager/apimanagement/2022-08-01/productpolicy/id_product.go +++ b/resource-manager/apimanagement/2022-08-01/productpolicy/id_product.go @@ -38,23 +38,9 @@ func ParseProductID(input string) (*ProductId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProductIDInsensitively(input string) (*ProductId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProductId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if id.ProductId, ok = input.Parsed["productId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "productId", input) } - return &id, nil + return nil } // ValidateProductID checks that 'input' can be parsed as a Product ID diff --git a/resource-manager/apimanagement/2022-08-01/productsbytag/id_service.go b/resource-manager/apimanagement/2022-08-01/productsbytag/id_service.go index 9cc5fba20d5..dab0313cbb3 100644 --- a/resource-manager/apimanagement/2022-08-01/productsbytag/id_service.go +++ b/resource-manager/apimanagement/2022-08-01/productsbytag/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2022-08-01/productsubscription/id_product.go b/resource-manager/apimanagement/2022-08-01/productsubscription/id_product.go index 34d6c9e3c5c..0770ff03e50 100644 --- a/resource-manager/apimanagement/2022-08-01/productsubscription/id_product.go +++ b/resource-manager/apimanagement/2022-08-01/productsubscription/id_product.go @@ -38,23 +38,9 @@ func ParseProductID(input string) (*ProductId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProductIDInsensitively(input string) (*ProductId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProductId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if id.ProductId, ok = input.Parsed["productId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "productId", input) } - return &id, nil + return nil } // ValidateProductID checks that 'input' can be parsed as a Product ID diff --git a/resource-manager/apimanagement/2022-08-01/producttag/id_product.go b/resource-manager/apimanagement/2022-08-01/producttag/id_product.go index 0e8b83b03ef..01560e368e2 100644 --- a/resource-manager/apimanagement/2022-08-01/producttag/id_product.go +++ b/resource-manager/apimanagement/2022-08-01/producttag/id_product.go @@ -38,23 +38,9 @@ func ParseProductID(input string) (*ProductId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProductIDInsensitively(input string) (*ProductId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProductId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if id.ProductId, ok = input.Parsed["productId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "productId", input) } - return &id, nil + return nil } // ValidateProductID checks that 'input' can be parsed as a Product ID diff --git a/resource-manager/apimanagement/2022-08-01/producttag/id_producttag.go b/resource-manager/apimanagement/2022-08-01/producttag/id_producttag.go index ee2cbe499a3..95ba1801059 100644 --- a/resource-manager/apimanagement/2022-08-01/producttag/id_producttag.go +++ b/resource-manager/apimanagement/2022-08-01/producttag/id_producttag.go @@ -40,27 +40,9 @@ func ParseProductTagID(input string) (*ProductTagId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductTagId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) - } - - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseProductTagIDInsensitively(input string) (*ProductTagId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductTagId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ProductTagId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if id.ProductId, ok = input.Parsed["productId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "productId", input) } - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + if id.TagId, ok = input.Parsed["tagId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tagId", input) } - return &id, nil + return nil } // ValidateProductTagID checks that 'input' can be parsed as a Product Tag ID diff --git a/resource-manager/apimanagement/2022-08-01/productwiki/id_product.go b/resource-manager/apimanagement/2022-08-01/productwiki/id_product.go index d0e1fabaa5f..a88f5200335 100644 --- a/resource-manager/apimanagement/2022-08-01/productwiki/id_product.go +++ b/resource-manager/apimanagement/2022-08-01/productwiki/id_product.go @@ -38,23 +38,9 @@ func ParseProductID(input string) (*ProductId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProductIDInsensitively(input string) (*ProductId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProductId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if id.ProductId, ok = input.Parsed["productId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "productId", input) } - return &id, nil + return nil } // ValidateProductID checks that 'input' can be parsed as a Product ID diff --git a/resource-manager/apimanagement/2022-08-01/quotabycounterkeys/id_quota.go b/resource-manager/apimanagement/2022-08-01/quotabycounterkeys/id_quota.go index bd09f03849c..1bcee82145a 100644 --- a/resource-manager/apimanagement/2022-08-01/quotabycounterkeys/id_quota.go +++ b/resource-manager/apimanagement/2022-08-01/quotabycounterkeys/id_quota.go @@ -38,23 +38,9 @@ func ParseQuotaID(input string) (*QuotaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QuotaId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.QuotaCounterKey, ok = parsed.Parsed["quotaCounterKey"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "quotaCounterKey", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseQuotaIDInsensitively(input string) (*QuotaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QuotaId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *QuotaId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.QuotaCounterKey, ok = parsed.Parsed["quotaCounterKey"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "quotaCounterKey", *parsed) + if id.QuotaCounterKey, ok = input.Parsed["quotaCounterKey"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "quotaCounterKey", input) } - return &id, nil + return nil } // ValidateQuotaID checks that 'input' can be parsed as a Quota ID diff --git a/resource-manager/apimanagement/2022-08-01/quotabyperiodkeys/id_period.go b/resource-manager/apimanagement/2022-08-01/quotabyperiodkeys/id_period.go index 51021a40cb2..457997a1f73 100644 --- a/resource-manager/apimanagement/2022-08-01/quotabyperiodkeys/id_period.go +++ b/resource-manager/apimanagement/2022-08-01/quotabyperiodkeys/id_period.go @@ -40,27 +40,9 @@ func ParsePeriodID(input string) (*PeriodId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PeriodId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.QuotaCounterKey, ok = parsed.Parsed["quotaCounterKey"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "quotaCounterKey", *parsed) - } - - if id.QuotaPeriodKey, ok = parsed.Parsed["quotaPeriodKey"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "quotaPeriodKey", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParsePeriodIDInsensitively(input string) (*PeriodId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PeriodId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *PeriodId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.QuotaCounterKey, ok = parsed.Parsed["quotaCounterKey"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "quotaCounterKey", *parsed) + if id.QuotaCounterKey, ok = input.Parsed["quotaCounterKey"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "quotaCounterKey", input) } - if id.QuotaPeriodKey, ok = parsed.Parsed["quotaPeriodKey"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "quotaPeriodKey", *parsed) + if id.QuotaPeriodKey, ok = input.Parsed["quotaPeriodKey"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "quotaPeriodKey", input) } - return &id, nil + return nil } // ValidatePeriodID checks that 'input' can be parsed as a Period ID diff --git a/resource-manager/apimanagement/2022-08-01/region/id_service.go b/resource-manager/apimanagement/2022-08-01/region/id_service.go index 28d0c9708d4..102d605acb5 100644 --- a/resource-manager/apimanagement/2022-08-01/region/id_service.go +++ b/resource-manager/apimanagement/2022-08-01/region/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2022-08-01/reports/id_service.go b/resource-manager/apimanagement/2022-08-01/reports/id_service.go index c86c2b26f93..2520584b82d 100644 --- a/resource-manager/apimanagement/2022-08-01/reports/id_service.go +++ b/resource-manager/apimanagement/2022-08-01/reports/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2022-08-01/schema/id_schema.go b/resource-manager/apimanagement/2022-08-01/schema/id_schema.go index 7454f30fe60..57f9ebb23c5 100644 --- a/resource-manager/apimanagement/2022-08-01/schema/id_schema.go +++ b/resource-manager/apimanagement/2022-08-01/schema/id_schema.go @@ -38,23 +38,9 @@ func ParseSchemaID(input string) (*SchemaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SchemaId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.SchemaId, ok = parsed.Parsed["schemaId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSchemaIDInsensitively(input string) (*SchemaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SchemaId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SchemaId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.SchemaId, ok = parsed.Parsed["schemaId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaId", *parsed) + if id.SchemaId, ok = input.Parsed["schemaId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "schemaId", input) } - return &id, nil + return nil } // ValidateSchemaID checks that 'input' can be parsed as a Schema ID diff --git a/resource-manager/apimanagement/2022-08-01/schema/id_service.go b/resource-manager/apimanagement/2022-08-01/schema/id_service.go index 2425e5c9127..d35dcd2431c 100644 --- a/resource-manager/apimanagement/2022-08-01/schema/id_service.go +++ b/resource-manager/apimanagement/2022-08-01/schema/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2022-08-01/signinsettings/id_service.go b/resource-manager/apimanagement/2022-08-01/signinsettings/id_service.go index 91fdf5b67b1..d449f2a8d38 100644 --- a/resource-manager/apimanagement/2022-08-01/signinsettings/id_service.go +++ b/resource-manager/apimanagement/2022-08-01/signinsettings/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2022-08-01/signupsettings/id_service.go b/resource-manager/apimanagement/2022-08-01/signupsettings/id_service.go index 5d9bd0a0c2f..f3787b73b81 100644 --- a/resource-manager/apimanagement/2022-08-01/signupsettings/id_service.go +++ b/resource-manager/apimanagement/2022-08-01/signupsettings/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2022-08-01/subscription/id_service.go b/resource-manager/apimanagement/2022-08-01/subscription/id_service.go index ec7f310e3df..93b509f052e 100644 --- a/resource-manager/apimanagement/2022-08-01/subscription/id_service.go +++ b/resource-manager/apimanagement/2022-08-01/subscription/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2022-08-01/subscription/id_subscriptions2.go b/resource-manager/apimanagement/2022-08-01/subscription/id_subscriptions2.go index baa1f57e1f6..f8b33d545ce 100644 --- a/resource-manager/apimanagement/2022-08-01/subscription/id_subscriptions2.go +++ b/resource-manager/apimanagement/2022-08-01/subscription/id_subscriptions2.go @@ -38,23 +38,9 @@ func ParseSubscriptions2ID(input string) (*Subscriptions2Id, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Subscriptions2Id{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSubscriptions2IDInsensitively(input string) (*Subscriptions2Id, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Subscriptions2Id{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *Subscriptions2Id) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", *parsed) + if id.SubscriptionName, ok = input.Parsed["subscriptionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", input) } - return &id, nil + return nil } // ValidateSubscriptions2ID checks that 'input' can be parsed as a Subscriptions 2 ID diff --git a/resource-manager/apimanagement/2022-08-01/subscription/id_usersubscriptions2.go b/resource-manager/apimanagement/2022-08-01/subscription/id_usersubscriptions2.go index ccc3bc6c72a..9c5f6ce11d0 100644 --- a/resource-manager/apimanagement/2022-08-01/subscription/id_usersubscriptions2.go +++ b/resource-manager/apimanagement/2022-08-01/subscription/id_usersubscriptions2.go @@ -40,27 +40,9 @@ func ParseUserSubscriptions2ID(input string) (*UserSubscriptions2Id, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserSubscriptions2Id{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) - } - - if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseUserSubscriptions2IDInsensitively(input string) (*UserSubscriptions2Id return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserSubscriptions2Id{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *UserSubscriptions2Id) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if id.UserId, ok = input.Parsed["userId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userId", input) } - if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", *parsed) + if id.SubscriptionName, ok = input.Parsed["subscriptionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", input) } - return &id, nil + return nil } // ValidateUserSubscriptions2ID checks that 'input' can be parsed as a User Subscriptions 2 ID diff --git a/resource-manager/apimanagement/2022-08-01/tag/id_service.go b/resource-manager/apimanagement/2022-08-01/tag/id_service.go index 05b834b495e..4571408724d 100644 --- a/resource-manager/apimanagement/2022-08-01/tag/id_service.go +++ b/resource-manager/apimanagement/2022-08-01/tag/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2022-08-01/tag/id_tag.go b/resource-manager/apimanagement/2022-08-01/tag/id_tag.go index 2f3b0e3027e..e5da01efc69 100644 --- a/resource-manager/apimanagement/2022-08-01/tag/id_tag.go +++ b/resource-manager/apimanagement/2022-08-01/tag/id_tag.go @@ -38,23 +38,9 @@ func ParseTagID(input string) (*TagId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TagId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTagIDInsensitively(input string) (*TagId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TagId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TagId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + if id.TagId, ok = input.Parsed["tagId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tagId", input) } - return &id, nil + return nil } // ValidateTagID checks that 'input' can be parsed as a Tag ID diff --git a/resource-manager/apimanagement/2022-08-01/tagresource/id_service.go b/resource-manager/apimanagement/2022-08-01/tagresource/id_service.go index 0ed54c64158..8467201490c 100644 --- a/resource-manager/apimanagement/2022-08-01/tagresource/id_service.go +++ b/resource-manager/apimanagement/2022-08-01/tagresource/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2022-08-01/tenantaccess/id_access.go b/resource-manager/apimanagement/2022-08-01/tenantaccess/id_access.go index f65bd39036b..c1088880ff5 100644 --- a/resource-manager/apimanagement/2022-08-01/tenantaccess/id_access.go +++ b/resource-manager/apimanagement/2022-08-01/tenantaccess/id_access.go @@ -38,31 +38,9 @@ func ParseAccessID(input string) (*AccessId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccessId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if v, ok := parsed.Parsed["accessName"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accessName", *parsed) - } - - accessName, err := parseAccessIdName(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.AccessName = *accessName + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -77,34 +55,42 @@ func ParseAccessIDInsensitively(input string) (*AccessId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccessId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *AccessId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if v, ok := parsed.Parsed["accessName"]; true { + if v, ok := input.Parsed["accessName"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accessName", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "accessName", input) } accessName, err := parseAccessIdName(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.AccessName = *accessName } - return &id, nil + return nil } // ValidateAccessID checks that 'input' can be parsed as a Access ID diff --git a/resource-manager/apimanagement/2022-08-01/tenantaccess/id_service.go b/resource-manager/apimanagement/2022-08-01/tenantaccess/id_service.go index 3a5122d04c9..eb27c6a8e00 100644 --- a/resource-manager/apimanagement/2022-08-01/tenantaccess/id_service.go +++ b/resource-manager/apimanagement/2022-08-01/tenantaccess/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2022-08-01/tenantaccessgit/id_access.go b/resource-manager/apimanagement/2022-08-01/tenantaccessgit/id_access.go index 2ba9d0cf84e..1b8f7cf9a5b 100644 --- a/resource-manager/apimanagement/2022-08-01/tenantaccessgit/id_access.go +++ b/resource-manager/apimanagement/2022-08-01/tenantaccessgit/id_access.go @@ -38,31 +38,9 @@ func ParseAccessID(input string) (*AccessId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccessId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if v, ok := parsed.Parsed["accessName"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accessName", *parsed) - } - - accessName, err := parseAccessIdName(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.AccessName = *accessName + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -77,34 +55,42 @@ func ParseAccessIDInsensitively(input string) (*AccessId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccessId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *AccessId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if v, ok := parsed.Parsed["accessName"]; true { + if v, ok := input.Parsed["accessName"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accessName", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "accessName", input) } accessName, err := parseAccessIdName(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.AccessName = *accessName } - return &id, nil + return nil } // ValidateAccessID checks that 'input' can be parsed as a Access ID diff --git a/resource-manager/apimanagement/2022-08-01/tenantconfiguration/id_service.go b/resource-manager/apimanagement/2022-08-01/tenantconfiguration/id_service.go index e4f04e8c155..035a1bd0afd 100644 --- a/resource-manager/apimanagement/2022-08-01/tenantconfiguration/id_service.go +++ b/resource-manager/apimanagement/2022-08-01/tenantconfiguration/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2022-08-01/tenantconfigurationsyncstate/id_service.go b/resource-manager/apimanagement/2022-08-01/tenantconfigurationsyncstate/id_service.go index da1608f2136..81e30d893aa 100644 --- a/resource-manager/apimanagement/2022-08-01/tenantconfigurationsyncstate/id_service.go +++ b/resource-manager/apimanagement/2022-08-01/tenantconfigurationsyncstate/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2022-08-01/tenantsettings/id_service.go b/resource-manager/apimanagement/2022-08-01/tenantsettings/id_service.go index d197d9265cc..16e418759e4 100644 --- a/resource-manager/apimanagement/2022-08-01/tenantsettings/id_service.go +++ b/resource-manager/apimanagement/2022-08-01/tenantsettings/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2022-08-01/user/id_service.go b/resource-manager/apimanagement/2022-08-01/user/id_service.go index 1747126f519..3ea79e41822 100644 --- a/resource-manager/apimanagement/2022-08-01/user/id_service.go +++ b/resource-manager/apimanagement/2022-08-01/user/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2022-08-01/user/id_user.go b/resource-manager/apimanagement/2022-08-01/user/id_user.go index 0b7943b4fae..08a07fa9e6f 100644 --- a/resource-manager/apimanagement/2022-08-01/user/id_user.go +++ b/resource-manager/apimanagement/2022-08-01/user/id_user.go @@ -38,23 +38,9 @@ func ParseUserID(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseUserIDInsensitively(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UserId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if id.UserId, ok = input.Parsed["userId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userId", input) } - return &id, nil + return nil } // ValidateUserID checks that 'input' can be parsed as a User ID diff --git a/resource-manager/apimanagement/2022-08-01/userconfirmationpasswordsend/id_user.go b/resource-manager/apimanagement/2022-08-01/userconfirmationpasswordsend/id_user.go index c827f27c182..dcd727f0f14 100644 --- a/resource-manager/apimanagement/2022-08-01/userconfirmationpasswordsend/id_user.go +++ b/resource-manager/apimanagement/2022-08-01/userconfirmationpasswordsend/id_user.go @@ -38,23 +38,9 @@ func ParseUserID(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseUserIDInsensitively(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UserId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if id.UserId, ok = input.Parsed["userId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userId", input) } - return &id, nil + return nil } // ValidateUserID checks that 'input' can be parsed as a User ID diff --git a/resource-manager/apimanagement/2022-08-01/usergroup/id_user.go b/resource-manager/apimanagement/2022-08-01/usergroup/id_user.go index 6f481473ac3..4f9503feb9f 100644 --- a/resource-manager/apimanagement/2022-08-01/usergroup/id_user.go +++ b/resource-manager/apimanagement/2022-08-01/usergroup/id_user.go @@ -38,23 +38,9 @@ func ParseUserID(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseUserIDInsensitively(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UserId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if id.UserId, ok = input.Parsed["userId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userId", input) } - return &id, nil + return nil } // ValidateUserID checks that 'input' can be parsed as a User ID diff --git a/resource-manager/apimanagement/2022-08-01/useridentity/id_user.go b/resource-manager/apimanagement/2022-08-01/useridentity/id_user.go index 185612cefc7..ea5036e1153 100644 --- a/resource-manager/apimanagement/2022-08-01/useridentity/id_user.go +++ b/resource-manager/apimanagement/2022-08-01/useridentity/id_user.go @@ -38,23 +38,9 @@ func ParseUserID(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseUserIDInsensitively(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UserId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if id.UserId, ok = input.Parsed["userId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userId", input) } - return &id, nil + return nil } // ValidateUserID checks that 'input' can be parsed as a User ID diff --git a/resource-manager/apimanagement/2022-08-01/users/id_user.go b/resource-manager/apimanagement/2022-08-01/users/id_user.go index 0720c2e6308..3e281134141 100644 --- a/resource-manager/apimanagement/2022-08-01/users/id_user.go +++ b/resource-manager/apimanagement/2022-08-01/users/id_user.go @@ -38,23 +38,9 @@ func ParseUserID(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseUserIDInsensitively(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UserId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if id.UserId, ok = input.Parsed["userId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userId", input) } - return &id, nil + return nil } // ValidateUserID checks that 'input' can be parsed as a User ID diff --git a/resource-manager/apimanagement/2022-08-01/usersubscription/id_user.go b/resource-manager/apimanagement/2022-08-01/usersubscription/id_user.go index c64085994b2..d1c798858f7 100644 --- a/resource-manager/apimanagement/2022-08-01/usersubscription/id_user.go +++ b/resource-manager/apimanagement/2022-08-01/usersubscription/id_user.go @@ -38,23 +38,9 @@ func ParseUserID(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseUserIDInsensitively(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UserId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if id.UserId, ok = input.Parsed["userId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userId", input) } - return &id, nil + return nil } // ValidateUserID checks that 'input' can be parsed as a User ID diff --git a/resource-manager/apimanagement/2022-08-01/usertoken/id_user.go b/resource-manager/apimanagement/2022-08-01/usertoken/id_user.go index 6f2e7012c25..7e0b9d7cb88 100644 --- a/resource-manager/apimanagement/2022-08-01/usertoken/id_user.go +++ b/resource-manager/apimanagement/2022-08-01/usertoken/id_user.go @@ -38,23 +38,9 @@ func ParseUserID(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseUserIDInsensitively(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UserId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if id.UserId, ok = input.Parsed["userId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userId", input) } - return &id, nil + return nil } // ValidateUserID checks that 'input' can be parsed as a User ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/api/id_api.go b/resource-manager/apimanagement/2023-03-01-preview/api/id_api.go index b76a03a3ca4..7a0a77e48ee 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/api/id_api.go +++ b/resource-manager/apimanagement/2023-03-01-preview/api/id_api.go @@ -38,23 +38,9 @@ func ParseApiID(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiIDInsensitively(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateApiID checks that 'input' can be parsed as a Api ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/api/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/api/id_service.go index c8e90bbf804..6a1e3ffbf4c 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/api/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/api/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/api/id_workspace.go b/resource-manager/apimanagement/2023-03-01-preview/api/id_workspace.go index 859924f472d..2c513118517 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/api/id_workspace.go +++ b/resource-manager/apimanagement/2023-03-01-preview/api/id_workspace.go @@ -38,23 +38,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WorkspaceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/api/id_workspaceapi.go b/resource-manager/apimanagement/2023-03-01-preview/api/id_workspaceapi.go index 31815f4d11b..136e4ec82a2 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/api/id_workspaceapi.go +++ b/resource-manager/apimanagement/2023-03-01-preview/api/id_workspaceapi.go @@ -40,27 +40,9 @@ func ParseWorkspaceApiID(input string) (*WorkspaceApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseWorkspaceApiIDInsensitively(input string) (*WorkspaceApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *WorkspaceApiId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateWorkspaceApiID checks that 'input' can be parsed as a Workspace Api ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/apidiagnostic/id_api.go b/resource-manager/apimanagement/2023-03-01-preview/apidiagnostic/id_api.go index 458b69d35bb..96657952393 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/apidiagnostic/id_api.go +++ b/resource-manager/apimanagement/2023-03-01-preview/apidiagnostic/id_api.go @@ -38,23 +38,9 @@ func ParseApiID(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiIDInsensitively(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateApiID checks that 'input' can be parsed as a Api ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/apidiagnostic/id_apidiagnostic.go b/resource-manager/apimanagement/2023-03-01-preview/apidiagnostic/id_apidiagnostic.go index c2dc08baea8..0e3e95f4369 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/apidiagnostic/id_apidiagnostic.go +++ b/resource-manager/apimanagement/2023-03-01-preview/apidiagnostic/id_apidiagnostic.go @@ -40,27 +40,9 @@ func ParseApiDiagnosticID(input string) (*ApiDiagnosticId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiDiagnosticId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.DiagnosticId, ok = parsed.Parsed["diagnosticId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseApiDiagnosticIDInsensitively(input string) (*ApiDiagnosticId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiDiagnosticId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ApiDiagnosticId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.DiagnosticId, ok = parsed.Parsed["diagnosticId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticId", *parsed) + if id.DiagnosticId, ok = input.Parsed["diagnosticId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "diagnosticId", input) } - return &id, nil + return nil } // ValidateApiDiagnosticID checks that 'input' can be parsed as a Api Diagnostic ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/apiissue/id_api.go b/resource-manager/apimanagement/2023-03-01-preview/apiissue/id_api.go index a53042d4cec..133174ac6ae 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/apiissue/id_api.go +++ b/resource-manager/apimanagement/2023-03-01-preview/apiissue/id_api.go @@ -38,23 +38,9 @@ func ParseApiID(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiIDInsensitively(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateApiID checks that 'input' can be parsed as a Api ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/apiissue/id_apiissue.go b/resource-manager/apimanagement/2023-03-01-preview/apiissue/id_apiissue.go index f5437406ba3..640acfc37da 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/apiissue/id_apiissue.go +++ b/resource-manager/apimanagement/2023-03-01-preview/apiissue/id_apiissue.go @@ -40,27 +40,9 @@ func ParseApiIssueID(input string) (*ApiIssueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiIssueId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.IssueId, ok = parsed.Parsed["issueId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "issueId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseApiIssueIDInsensitively(input string) (*ApiIssueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiIssueId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ApiIssueId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.IssueId, ok = parsed.Parsed["issueId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "issueId", *parsed) + if id.IssueId, ok = input.Parsed["issueId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "issueId", input) } - return &id, nil + return nil } // ValidateApiIssueID checks that 'input' can be parsed as a Api Issue ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/apiissueattachment/id_apiissue.go b/resource-manager/apimanagement/2023-03-01-preview/apiissueattachment/id_apiissue.go index 7bb616b8c62..c4f8ca725af 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/apiissueattachment/id_apiissue.go +++ b/resource-manager/apimanagement/2023-03-01-preview/apiissueattachment/id_apiissue.go @@ -40,27 +40,9 @@ func ParseApiIssueID(input string) (*ApiIssueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiIssueId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.IssueId, ok = parsed.Parsed["issueId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "issueId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseApiIssueIDInsensitively(input string) (*ApiIssueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiIssueId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ApiIssueId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.IssueId, ok = parsed.Parsed["issueId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "issueId", *parsed) + if id.IssueId, ok = input.Parsed["issueId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "issueId", input) } - return &id, nil + return nil } // ValidateApiIssueID checks that 'input' can be parsed as a Api Issue ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/apiissueattachment/id_attachment.go b/resource-manager/apimanagement/2023-03-01-preview/apiissueattachment/id_attachment.go index 201f3b7f724..7d336e46218 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/apiissueattachment/id_attachment.go +++ b/resource-manager/apimanagement/2023-03-01-preview/apiissueattachment/id_attachment.go @@ -42,31 +42,9 @@ func ParseAttachmentID(input string) (*AttachmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AttachmentId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.IssueId, ok = parsed.Parsed["issueId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "issueId", *parsed) - } - - if id.AttachmentId, ok = parsed.Parsed["attachmentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "attachmentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseAttachmentIDInsensitively(input string) (*AttachmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AttachmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AttachmentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.IssueId, ok = parsed.Parsed["issueId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "issueId", *parsed) + if id.IssueId, ok = input.Parsed["issueId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "issueId", input) } - if id.AttachmentId, ok = parsed.Parsed["attachmentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "attachmentId", *parsed) + if id.AttachmentId, ok = input.Parsed["attachmentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "attachmentId", input) } - return &id, nil + return nil } // ValidateAttachmentID checks that 'input' can be parsed as a Attachment ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/apiissuecomment/id_apiissue.go b/resource-manager/apimanagement/2023-03-01-preview/apiissuecomment/id_apiissue.go index fa985059e13..6123b4217fc 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/apiissuecomment/id_apiissue.go +++ b/resource-manager/apimanagement/2023-03-01-preview/apiissuecomment/id_apiissue.go @@ -40,27 +40,9 @@ func ParseApiIssueID(input string) (*ApiIssueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiIssueId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.IssueId, ok = parsed.Parsed["issueId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "issueId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseApiIssueIDInsensitively(input string) (*ApiIssueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiIssueId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ApiIssueId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.IssueId, ok = parsed.Parsed["issueId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "issueId", *parsed) + if id.IssueId, ok = input.Parsed["issueId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "issueId", input) } - return &id, nil + return nil } // ValidateApiIssueID checks that 'input' can be parsed as a Api Issue ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/apiissuecomment/id_comment.go b/resource-manager/apimanagement/2023-03-01-preview/apiissuecomment/id_comment.go index 4d6e5795faf..eca61943506 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/apiissuecomment/id_comment.go +++ b/resource-manager/apimanagement/2023-03-01-preview/apiissuecomment/id_comment.go @@ -42,31 +42,9 @@ func ParseCommentID(input string) (*CommentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommentId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.IssueId, ok = parsed.Parsed["issueId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "issueId", *parsed) - } - - if id.CommentId, ok = parsed.Parsed["commentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "commentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseCommentIDInsensitively(input string) (*CommentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CommentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.IssueId, ok = parsed.Parsed["issueId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "issueId", *parsed) + if id.IssueId, ok = input.Parsed["issueId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "issueId", input) } - if id.CommentId, ok = parsed.Parsed["commentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "commentId", *parsed) + if id.CommentId, ok = input.Parsed["commentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "commentId", input) } - return &id, nil + return nil } // ValidateCommentID checks that 'input' can be parsed as a Comment ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/apimanagementservice/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/apimanagementservice/id_service.go index 95a62caed84..eccb86b056b 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/apimanagementservice/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/apimanagementservice/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/apimanagementserviceskus/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/apimanagementserviceskus/id_service.go index d600f219ae6..b5afcf417bc 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/apimanagementserviceskus/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/apimanagementserviceskus/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/apioperation/id_api.go b/resource-manager/apimanagement/2023-03-01-preview/apioperation/id_api.go index 79a7327f622..43445741f29 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/apioperation/id_api.go +++ b/resource-manager/apimanagement/2023-03-01-preview/apioperation/id_api.go @@ -38,23 +38,9 @@ func ParseApiID(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiIDInsensitively(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateApiID checks that 'input' can be parsed as a Api ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/apioperation/id_apioperation.go b/resource-manager/apimanagement/2023-03-01-preview/apioperation/id_apioperation.go index d4d0d715ad7..d8b45a20493 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/apioperation/id_apioperation.go +++ b/resource-manager/apimanagement/2023-03-01-preview/apioperation/id_apioperation.go @@ -42,31 +42,9 @@ func ParseApiOperationID(input string) (*ApiOperationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiOperationId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseApiOperationIDInsensitively(input string) (*ApiOperationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiOperationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ApiOperationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if id.OperationId, ok = input.Parsed["operationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "operationId", input) } - return &id, nil + return nil } // ValidateApiOperationID checks that 'input' can be parsed as a Api Operation ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/apioperation/id_operation.go b/resource-manager/apimanagement/2023-03-01-preview/apioperation/id_operation.go index de3ff9a53f6..438a2d60c02 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/apioperation/id_operation.go +++ b/resource-manager/apimanagement/2023-03-01-preview/apioperation/id_operation.go @@ -40,27 +40,9 @@ func ParseOperationID(input string) (*OperationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseOperationIDInsensitively(input string) (*OperationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *OperationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if id.OperationId, ok = input.Parsed["operationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "operationId", input) } - return &id, nil + return nil } // ValidateOperationID checks that 'input' can be parsed as a Operation ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/apioperation/id_workspaceapi.go b/resource-manager/apimanagement/2023-03-01-preview/apioperation/id_workspaceapi.go index e07cc23697a..348dfe8e3da 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/apioperation/id_workspaceapi.go +++ b/resource-manager/apimanagement/2023-03-01-preview/apioperation/id_workspaceapi.go @@ -40,27 +40,9 @@ func ParseWorkspaceApiID(input string) (*WorkspaceApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseWorkspaceApiIDInsensitively(input string) (*WorkspaceApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *WorkspaceApiId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateWorkspaceApiID checks that 'input' can be parsed as a Workspace Api ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/apioperationpolicy/id_apioperation.go b/resource-manager/apimanagement/2023-03-01-preview/apioperationpolicy/id_apioperation.go index 022fe84640a..2a1492c1887 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/apioperationpolicy/id_apioperation.go +++ b/resource-manager/apimanagement/2023-03-01-preview/apioperationpolicy/id_apioperation.go @@ -42,31 +42,9 @@ func ParseApiOperationID(input string) (*ApiOperationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiOperationId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseApiOperationIDInsensitively(input string) (*ApiOperationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiOperationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ApiOperationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if id.OperationId, ok = input.Parsed["operationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "operationId", input) } - return &id, nil + return nil } // ValidateApiOperationID checks that 'input' can be parsed as a Api Operation ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/apioperationpolicy/id_operation.go b/resource-manager/apimanagement/2023-03-01-preview/apioperationpolicy/id_operation.go index 7cb0b5a54c7..4225aa7d778 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/apioperationpolicy/id_operation.go +++ b/resource-manager/apimanagement/2023-03-01-preview/apioperationpolicy/id_operation.go @@ -40,27 +40,9 @@ func ParseOperationID(input string) (*OperationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseOperationIDInsensitively(input string) (*OperationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *OperationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if id.OperationId, ok = input.Parsed["operationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "operationId", input) } - return &id, nil + return nil } // ValidateOperationID checks that 'input' can be parsed as a Operation ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/apioperationsbytag/id_api.go b/resource-manager/apimanagement/2023-03-01-preview/apioperationsbytag/id_api.go index 61af7bc027a..3b65c86986d 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/apioperationsbytag/id_api.go +++ b/resource-manager/apimanagement/2023-03-01-preview/apioperationsbytag/id_api.go @@ -38,23 +38,9 @@ func ParseApiID(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiIDInsensitively(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateApiID checks that 'input' can be parsed as a Api ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/apioperationtag/id_operation.go b/resource-manager/apimanagement/2023-03-01-preview/apioperationtag/id_operation.go index 80dc723f21e..9ff2edc8bb0 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/apioperationtag/id_operation.go +++ b/resource-manager/apimanagement/2023-03-01-preview/apioperationtag/id_operation.go @@ -40,27 +40,9 @@ func ParseOperationID(input string) (*OperationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseOperationIDInsensitively(input string) (*OperationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *OperationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if id.OperationId, ok = input.Parsed["operationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "operationId", input) } - return &id, nil + return nil } // ValidateOperationID checks that 'input' can be parsed as a Operation ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/apioperationtag/id_operationtag.go b/resource-manager/apimanagement/2023-03-01-preview/apioperationtag/id_operationtag.go index 50b4b0f0385..86a6377d961 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/apioperationtag/id_operationtag.go +++ b/resource-manager/apimanagement/2023-03-01-preview/apioperationtag/id_operationtag.go @@ -42,31 +42,9 @@ func ParseOperationTagID(input string) (*OperationTagId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationTagId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) - } - - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseOperationTagIDInsensitively(input string) (*OperationTagId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationTagId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *OperationTagId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if id.OperationId, ok = input.Parsed["operationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "operationId", input) } - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + if id.TagId, ok = input.Parsed["tagId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tagId", input) } - return &id, nil + return nil } // ValidateOperationTagID checks that 'input' can be parsed as a Operation Tag ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/apipolicy/id_api.go b/resource-manager/apimanagement/2023-03-01-preview/apipolicy/id_api.go index fa2aa4893ac..e6bb0d4a498 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/apipolicy/id_api.go +++ b/resource-manager/apimanagement/2023-03-01-preview/apipolicy/id_api.go @@ -38,23 +38,9 @@ func ParseApiID(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiIDInsensitively(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateApiID checks that 'input' can be parsed as a Api ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/apipolicy/id_workspaceapi.go b/resource-manager/apimanagement/2023-03-01-preview/apipolicy/id_workspaceapi.go index ae78089879a..f5c0b1dda51 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/apipolicy/id_workspaceapi.go +++ b/resource-manager/apimanagement/2023-03-01-preview/apipolicy/id_workspaceapi.go @@ -40,27 +40,9 @@ func ParseWorkspaceApiID(input string) (*WorkspaceApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseWorkspaceApiIDInsensitively(input string) (*WorkspaceApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *WorkspaceApiId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateWorkspaceApiID checks that 'input' can be parsed as a Workspace Api ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/apiproduct/id_api.go b/resource-manager/apimanagement/2023-03-01-preview/apiproduct/id_api.go index 34d8a372398..fb8a7d9a979 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/apiproduct/id_api.go +++ b/resource-manager/apimanagement/2023-03-01-preview/apiproduct/id_api.go @@ -38,23 +38,9 @@ func ParseApiID(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiIDInsensitively(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateApiID checks that 'input' can be parsed as a Api ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/apirelease/id_api.go b/resource-manager/apimanagement/2023-03-01-preview/apirelease/id_api.go index 2859d3f4219..330da942f46 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/apirelease/id_api.go +++ b/resource-manager/apimanagement/2023-03-01-preview/apirelease/id_api.go @@ -38,23 +38,9 @@ func ParseApiID(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiIDInsensitively(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateApiID checks that 'input' can be parsed as a Api ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/apirelease/id_apirelease.go b/resource-manager/apimanagement/2023-03-01-preview/apirelease/id_apirelease.go index 0ca2f5ed28d..8a0e8f25415 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/apirelease/id_apirelease.go +++ b/resource-manager/apimanagement/2023-03-01-preview/apirelease/id_apirelease.go @@ -42,31 +42,9 @@ func ParseApiReleaseID(input string) (*ApiReleaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiReleaseId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.ReleaseId, ok = parsed.Parsed["releaseId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "releaseId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseApiReleaseIDInsensitively(input string) (*ApiReleaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiReleaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ApiReleaseId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.ReleaseId, ok = parsed.Parsed["releaseId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "releaseId", *parsed) + if id.ReleaseId, ok = input.Parsed["releaseId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "releaseId", input) } - return &id, nil + return nil } // ValidateApiReleaseID checks that 'input' can be parsed as a Api Release ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/apirelease/id_release.go b/resource-manager/apimanagement/2023-03-01-preview/apirelease/id_release.go index a05148dd45c..3cbe29fbd02 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/apirelease/id_release.go +++ b/resource-manager/apimanagement/2023-03-01-preview/apirelease/id_release.go @@ -40,27 +40,9 @@ func ParseReleaseID(input string) (*ReleaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReleaseId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.ReleaseId, ok = parsed.Parsed["releaseId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "releaseId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReleaseIDInsensitively(input string) (*ReleaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReleaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReleaseId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.ReleaseId, ok = parsed.Parsed["releaseId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "releaseId", *parsed) + if id.ReleaseId, ok = input.Parsed["releaseId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "releaseId", input) } - return &id, nil + return nil } // ValidateReleaseID checks that 'input' can be parsed as a Release ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/apirelease/id_workspaceapi.go b/resource-manager/apimanagement/2023-03-01-preview/apirelease/id_workspaceapi.go index c58f589c63c..9729a6669e3 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/apirelease/id_workspaceapi.go +++ b/resource-manager/apimanagement/2023-03-01-preview/apirelease/id_workspaceapi.go @@ -40,27 +40,9 @@ func ParseWorkspaceApiID(input string) (*WorkspaceApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseWorkspaceApiIDInsensitively(input string) (*WorkspaceApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *WorkspaceApiId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateWorkspaceApiID checks that 'input' can be parsed as a Workspace Api ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/apirevision/id_api.go b/resource-manager/apimanagement/2023-03-01-preview/apirevision/id_api.go index ecca30efbc4..d21321054a4 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/apirevision/id_api.go +++ b/resource-manager/apimanagement/2023-03-01-preview/apirevision/id_api.go @@ -38,23 +38,9 @@ func ParseApiID(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiIDInsensitively(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateApiID checks that 'input' can be parsed as a Api ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/apirevision/id_workspaceapi.go b/resource-manager/apimanagement/2023-03-01-preview/apirevision/id_workspaceapi.go index e1ea3a4537b..5901c125f95 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/apirevision/id_workspaceapi.go +++ b/resource-manager/apimanagement/2023-03-01-preview/apirevision/id_workspaceapi.go @@ -40,27 +40,9 @@ func ParseWorkspaceApiID(input string) (*WorkspaceApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseWorkspaceApiIDInsensitively(input string) (*WorkspaceApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *WorkspaceApiId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateWorkspaceApiID checks that 'input' can be parsed as a Workspace Api ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/apisbytag/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/apisbytag/id_service.go index cabeab414cb..c51e286da4f 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/apisbytag/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/apisbytag/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/apischema/id_api.go b/resource-manager/apimanagement/2023-03-01-preview/apischema/id_api.go index f58e6b3b0fd..3cec3f2a149 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/apischema/id_api.go +++ b/resource-manager/apimanagement/2023-03-01-preview/apischema/id_api.go @@ -38,23 +38,9 @@ func ParseApiID(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiIDInsensitively(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateApiID checks that 'input' can be parsed as a Api ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/apischema/id_apischema.go b/resource-manager/apimanagement/2023-03-01-preview/apischema/id_apischema.go index 13017418f0c..2953ca314ba 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/apischema/id_apischema.go +++ b/resource-manager/apimanagement/2023-03-01-preview/apischema/id_apischema.go @@ -40,27 +40,9 @@ func ParseApiSchemaID(input string) (*ApiSchemaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiSchemaId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.SchemaId, ok = parsed.Parsed["schemaId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseApiSchemaIDInsensitively(input string) (*ApiSchemaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiSchemaId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ApiSchemaId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.SchemaId, ok = parsed.Parsed["schemaId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaId", *parsed) + if id.SchemaId, ok = input.Parsed["schemaId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "schemaId", input) } - return &id, nil + return nil } // ValidateApiSchemaID checks that 'input' can be parsed as a Api Schema ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/apischema/id_workspaceapi.go b/resource-manager/apimanagement/2023-03-01-preview/apischema/id_workspaceapi.go index e6570eb1cc4..8c65c874c48 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/apischema/id_workspaceapi.go +++ b/resource-manager/apimanagement/2023-03-01-preview/apischema/id_workspaceapi.go @@ -40,27 +40,9 @@ func ParseWorkspaceApiID(input string) (*WorkspaceApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseWorkspaceApiIDInsensitively(input string) (*WorkspaceApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *WorkspaceApiId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateWorkspaceApiID checks that 'input' can be parsed as a Workspace Api ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/apischema/id_workspaceapischema.go b/resource-manager/apimanagement/2023-03-01-preview/apischema/id_workspaceapischema.go index 8cb35c49a63..a9a6aaefde1 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/apischema/id_workspaceapischema.go +++ b/resource-manager/apimanagement/2023-03-01-preview/apischema/id_workspaceapischema.go @@ -42,31 +42,9 @@ func ParseWorkspaceApiSchemaID(input string) (*WorkspaceApiSchemaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceApiSchemaId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.SchemaId, ok = parsed.Parsed["schemaId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseWorkspaceApiSchemaIDInsensitively(input string) (*WorkspaceApiSchemaId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceApiSchemaId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceApiSchemaId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.SchemaId, ok = parsed.Parsed["schemaId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaId", *parsed) + if id.SchemaId, ok = input.Parsed["schemaId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "schemaId", input) } - return &id, nil + return nil } // ValidateWorkspaceApiSchemaID checks that 'input' can be parsed as a Workspace Api Schema ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/apitag/id_api.go b/resource-manager/apimanagement/2023-03-01-preview/apitag/id_api.go index 89fbccee1e6..c8afece467f 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/apitag/id_api.go +++ b/resource-manager/apimanagement/2023-03-01-preview/apitag/id_api.go @@ -38,23 +38,9 @@ func ParseApiID(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiIDInsensitively(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateApiID checks that 'input' can be parsed as a Api ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/apitag/id_apitag.go b/resource-manager/apimanagement/2023-03-01-preview/apitag/id_apitag.go index 065dee9d7df..0f562a900ad 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/apitag/id_apitag.go +++ b/resource-manager/apimanagement/2023-03-01-preview/apitag/id_apitag.go @@ -40,27 +40,9 @@ func ParseApiTagID(input string) (*ApiTagId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiTagId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseApiTagIDInsensitively(input string) (*ApiTagId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiTagId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ApiTagId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + if id.TagId, ok = input.Parsed["tagId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tagId", input) } - return &id, nil + return nil } // ValidateApiTagID checks that 'input' can be parsed as a Api Tag ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/apitagdescription/id_api.go b/resource-manager/apimanagement/2023-03-01-preview/apitagdescription/id_api.go index 7b00f6d8314..da65fe282bd 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/apitagdescription/id_api.go +++ b/resource-manager/apimanagement/2023-03-01-preview/apitagdescription/id_api.go @@ -38,23 +38,9 @@ func ParseApiID(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiIDInsensitively(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateApiID checks that 'input' can be parsed as a Api ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/apitagdescription/id_tagdescription.go b/resource-manager/apimanagement/2023-03-01-preview/apitagdescription/id_tagdescription.go index 4ac4fb2acef..b223d3e858b 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/apitagdescription/id_tagdescription.go +++ b/resource-manager/apimanagement/2023-03-01-preview/apitagdescription/id_tagdescription.go @@ -40,27 +40,9 @@ func ParseTagDescriptionID(input string) (*TagDescriptionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TagDescriptionId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.TagDescriptionId, ok = parsed.Parsed["tagDescriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagDescriptionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseTagDescriptionIDInsensitively(input string) (*TagDescriptionId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TagDescriptionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TagDescriptionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.TagDescriptionId, ok = parsed.Parsed["tagDescriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagDescriptionId", *parsed) + if id.TagDescriptionId, ok = input.Parsed["tagDescriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tagDescriptionId", input) } - return &id, nil + return nil } // ValidateTagDescriptionID checks that 'input' can be parsed as a Tag Description ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/apiversionset/id_apiversionset.go b/resource-manager/apimanagement/2023-03-01-preview/apiversionset/id_apiversionset.go index f541aa66a7d..ee3a221fa7d 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/apiversionset/id_apiversionset.go +++ b/resource-manager/apimanagement/2023-03-01-preview/apiversionset/id_apiversionset.go @@ -38,23 +38,9 @@ func ParseApiVersionSetID(input string) (*ApiVersionSetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiVersionSetId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.VersionSetId, ok = parsed.Parsed["versionSetId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionSetId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiVersionSetIDInsensitively(input string) (*ApiVersionSetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiVersionSetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiVersionSetId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.VersionSetId, ok = parsed.Parsed["versionSetId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionSetId", *parsed) + if id.VersionSetId, ok = input.Parsed["versionSetId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionSetId", input) } - return &id, nil + return nil } // ValidateApiVersionSetID checks that 'input' can be parsed as a Api Version Set ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/apiversionset/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/apiversionset/id_service.go index b4503adde39..39d5f6a2dd1 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/apiversionset/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/apiversionset/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/apiversionset/id_workspace.go b/resource-manager/apimanagement/2023-03-01-preview/apiversionset/id_workspace.go index 2ccc069bef1..4a65980662a 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/apiversionset/id_workspace.go +++ b/resource-manager/apimanagement/2023-03-01-preview/apiversionset/id_workspace.go @@ -38,23 +38,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WorkspaceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/apiversionset/id_workspaceapiversionset.go b/resource-manager/apimanagement/2023-03-01-preview/apiversionset/id_workspaceapiversionset.go index 296e07fe3ab..38d340e3cba 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/apiversionset/id_workspaceapiversionset.go +++ b/resource-manager/apimanagement/2023-03-01-preview/apiversionset/id_workspaceapiversionset.go @@ -40,27 +40,9 @@ func ParseWorkspaceApiVersionSetID(input string) (*WorkspaceApiVersionSetId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceApiVersionSetId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) - } - - if id.VersionSetId, ok = parsed.Parsed["versionSetId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionSetId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseWorkspaceApiVersionSetIDInsensitively(input string) (*WorkspaceApiVers return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceApiVersionSetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *WorkspaceApiVersionSetId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - if id.VersionSetId, ok = parsed.Parsed["versionSetId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionSetId", *parsed) + if id.VersionSetId, ok = input.Parsed["versionSetId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionSetId", input) } - return &id, nil + return nil } // ValidateWorkspaceApiVersionSetID checks that 'input' can be parsed as a Workspace Api Version Set ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/apiversionsets/id_apiversionset.go b/resource-manager/apimanagement/2023-03-01-preview/apiversionsets/id_apiversionset.go index aa4b1218098..631a8829d3f 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/apiversionsets/id_apiversionset.go +++ b/resource-manager/apimanagement/2023-03-01-preview/apiversionsets/id_apiversionset.go @@ -38,23 +38,9 @@ func ParseApiVersionSetID(input string) (*ApiVersionSetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiVersionSetId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.VersionSetId, ok = parsed.Parsed["versionSetId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionSetId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiVersionSetIDInsensitively(input string) (*ApiVersionSetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiVersionSetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiVersionSetId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.VersionSetId, ok = parsed.Parsed["versionSetId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionSetId", *parsed) + if id.VersionSetId, ok = input.Parsed["versionSetId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionSetId", input) } - return &id, nil + return nil } // ValidateApiVersionSetID checks that 'input' can be parsed as a Api Version Set ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/apiversionsets/id_workspaceapiversionset.go b/resource-manager/apimanagement/2023-03-01-preview/apiversionsets/id_workspaceapiversionset.go index f0bce8c5bcb..9deb96e9fd6 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/apiversionsets/id_workspaceapiversionset.go +++ b/resource-manager/apimanagement/2023-03-01-preview/apiversionsets/id_workspaceapiversionset.go @@ -40,27 +40,9 @@ func ParseWorkspaceApiVersionSetID(input string) (*WorkspaceApiVersionSetId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceApiVersionSetId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) - } - - if id.VersionSetId, ok = parsed.Parsed["versionSetId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionSetId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseWorkspaceApiVersionSetIDInsensitively(input string) (*WorkspaceApiVers return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceApiVersionSetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *WorkspaceApiVersionSetId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - if id.VersionSetId, ok = parsed.Parsed["versionSetId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionSetId", *parsed) + if id.VersionSetId, ok = input.Parsed["versionSetId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionSetId", input) } - return &id, nil + return nil } // ValidateWorkspaceApiVersionSetID checks that 'input' can be parsed as a Workspace Api Version Set ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/apiwiki/id_api.go b/resource-manager/apimanagement/2023-03-01-preview/apiwiki/id_api.go index 4a4038b5b88..59d2f57a098 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/apiwiki/id_api.go +++ b/resource-manager/apimanagement/2023-03-01-preview/apiwiki/id_api.go @@ -38,23 +38,9 @@ func ParseApiID(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiIDInsensitively(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateApiID checks that 'input' can be parsed as a Api ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/authorization/id_authorization.go b/resource-manager/apimanagement/2023-03-01-preview/authorization/id_authorization.go index 43cf3c30fae..2f50d657905 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/authorization/id_authorization.go +++ b/resource-manager/apimanagement/2023-03-01-preview/authorization/id_authorization.go @@ -40,27 +40,9 @@ func ParseAuthorizationID(input string) (*AuthorizationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.AuthorizationProviderId, ok = parsed.Parsed["authorizationProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationProviderId", *parsed) - } - - if id.AuthorizationId, ok = parsed.Parsed["authorizationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseAuthorizationIDInsensitively(input string) (*AuthorizationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *AuthorizationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.AuthorizationProviderId, ok = parsed.Parsed["authorizationProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationProviderId", *parsed) + if id.AuthorizationProviderId, ok = input.Parsed["authorizationProviderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationProviderId", input) } - if id.AuthorizationId, ok = parsed.Parsed["authorizationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationId", *parsed) + if id.AuthorizationId, ok = input.Parsed["authorizationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationId", input) } - return &id, nil + return nil } // ValidateAuthorizationID checks that 'input' can be parsed as a Authorization ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/authorizationaccesspolicy/id_accesspolicy.go b/resource-manager/apimanagement/2023-03-01-preview/authorizationaccesspolicy/id_accesspolicy.go index f4908beab18..392ecde78d3 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/authorizationaccesspolicy/id_accesspolicy.go +++ b/resource-manager/apimanagement/2023-03-01-preview/authorizationaccesspolicy/id_accesspolicy.go @@ -42,31 +42,9 @@ func ParseAccessPolicyID(input string) (*AccessPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccessPolicyId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.AuthorizationProviderId, ok = parsed.Parsed["authorizationProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationProviderId", *parsed) - } - - if id.AuthorizationId, ok = parsed.Parsed["authorizationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationId", *parsed) - } - - if id.AuthorizationAccessPolicyId, ok = parsed.Parsed["authorizationAccessPolicyId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationAccessPolicyId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseAccessPolicyIDInsensitively(input string) (*AccessPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccessPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AccessPolicyId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.AuthorizationProviderId, ok = parsed.Parsed["authorizationProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationProviderId", *parsed) + if id.AuthorizationProviderId, ok = input.Parsed["authorizationProviderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationProviderId", input) } - if id.AuthorizationId, ok = parsed.Parsed["authorizationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationId", *parsed) + if id.AuthorizationId, ok = input.Parsed["authorizationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationId", input) } - if id.AuthorizationAccessPolicyId, ok = parsed.Parsed["authorizationAccessPolicyId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationAccessPolicyId", *parsed) + if id.AuthorizationAccessPolicyId, ok = input.Parsed["authorizationAccessPolicyId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationAccessPolicyId", input) } - return &id, nil + return nil } // ValidateAccessPolicyID checks that 'input' can be parsed as a Access Policy ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/authorizationaccesspolicy/id_authorization.go b/resource-manager/apimanagement/2023-03-01-preview/authorizationaccesspolicy/id_authorization.go index 4c439275e3d..d80d068b2d1 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/authorizationaccesspolicy/id_authorization.go +++ b/resource-manager/apimanagement/2023-03-01-preview/authorizationaccesspolicy/id_authorization.go @@ -40,27 +40,9 @@ func ParseAuthorizationID(input string) (*AuthorizationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.AuthorizationProviderId, ok = parsed.Parsed["authorizationProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationProviderId", *parsed) - } - - if id.AuthorizationId, ok = parsed.Parsed["authorizationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseAuthorizationIDInsensitively(input string) (*AuthorizationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *AuthorizationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.AuthorizationProviderId, ok = parsed.Parsed["authorizationProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationProviderId", *parsed) + if id.AuthorizationProviderId, ok = input.Parsed["authorizationProviderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationProviderId", input) } - if id.AuthorizationId, ok = parsed.Parsed["authorizationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationId", *parsed) + if id.AuthorizationId, ok = input.Parsed["authorizationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationId", input) } - return &id, nil + return nil } // ValidateAuthorizationID checks that 'input' can be parsed as a Authorization ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/authorizationconfirmconsentcode/id_authorization.go b/resource-manager/apimanagement/2023-03-01-preview/authorizationconfirmconsentcode/id_authorization.go index ba3cdc93ae9..58de0836315 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/authorizationconfirmconsentcode/id_authorization.go +++ b/resource-manager/apimanagement/2023-03-01-preview/authorizationconfirmconsentcode/id_authorization.go @@ -40,27 +40,9 @@ func ParseAuthorizationID(input string) (*AuthorizationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.AuthorizationProviderId, ok = parsed.Parsed["authorizationProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationProviderId", *parsed) - } - - if id.AuthorizationId, ok = parsed.Parsed["authorizationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseAuthorizationIDInsensitively(input string) (*AuthorizationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *AuthorizationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.AuthorizationProviderId, ok = parsed.Parsed["authorizationProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationProviderId", *parsed) + if id.AuthorizationProviderId, ok = input.Parsed["authorizationProviderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationProviderId", input) } - if id.AuthorizationId, ok = parsed.Parsed["authorizationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationId", *parsed) + if id.AuthorizationId, ok = input.Parsed["authorizationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationId", input) } - return &id, nil + return nil } // ValidateAuthorizationID checks that 'input' can be parsed as a Authorization ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/authorizationloginlinks/id_authorization.go b/resource-manager/apimanagement/2023-03-01-preview/authorizationloginlinks/id_authorization.go index 1e1e6b66add..6253d8c7f67 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/authorizationloginlinks/id_authorization.go +++ b/resource-manager/apimanagement/2023-03-01-preview/authorizationloginlinks/id_authorization.go @@ -40,27 +40,9 @@ func ParseAuthorizationID(input string) (*AuthorizationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.AuthorizationProviderId, ok = parsed.Parsed["authorizationProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationProviderId", *parsed) - } - - if id.AuthorizationId, ok = parsed.Parsed["authorizationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseAuthorizationIDInsensitively(input string) (*AuthorizationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *AuthorizationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.AuthorizationProviderId, ok = parsed.Parsed["authorizationProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationProviderId", *parsed) + if id.AuthorizationProviderId, ok = input.Parsed["authorizationProviderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationProviderId", input) } - if id.AuthorizationId, ok = parsed.Parsed["authorizationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationId", *parsed) + if id.AuthorizationId, ok = input.Parsed["authorizationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationId", input) } - return &id, nil + return nil } // ValidateAuthorizationID checks that 'input' can be parsed as a Authorization ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/authorizationprovider/id_authorizationprovider.go b/resource-manager/apimanagement/2023-03-01-preview/authorizationprovider/id_authorizationprovider.go index 77bec395bd8..0d392ebb1b5 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/authorizationprovider/id_authorizationprovider.go +++ b/resource-manager/apimanagement/2023-03-01-preview/authorizationprovider/id_authorizationprovider.go @@ -38,23 +38,9 @@ func ParseAuthorizationProviderID(input string) (*AuthorizationProviderId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationProviderId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.AuthorizationProviderId, ok = parsed.Parsed["authorizationProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationProviderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAuthorizationProviderIDInsensitively(input string) (*AuthorizationProv return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationProviderId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AuthorizationProviderId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.AuthorizationProviderId, ok = parsed.Parsed["authorizationProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationProviderId", *parsed) + if id.AuthorizationProviderId, ok = input.Parsed["authorizationProviderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationProviderId", input) } - return &id, nil + return nil } // ValidateAuthorizationProviderID checks that 'input' can be parsed as a Authorization Provider ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/authorizationprovider/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/authorizationprovider/id_service.go index acc7b0ea016..56cac638a9e 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/authorizationprovider/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/authorizationprovider/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/authorizations/id_authorizationprovider.go b/resource-manager/apimanagement/2023-03-01-preview/authorizations/id_authorizationprovider.go index e8c53b27f15..467673047fc 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/authorizations/id_authorizationprovider.go +++ b/resource-manager/apimanagement/2023-03-01-preview/authorizations/id_authorizationprovider.go @@ -38,23 +38,9 @@ func ParseAuthorizationProviderID(input string) (*AuthorizationProviderId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationProviderId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.AuthorizationProviderId, ok = parsed.Parsed["authorizationProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationProviderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAuthorizationProviderIDInsensitively(input string) (*AuthorizationProv return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationProviderId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AuthorizationProviderId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.AuthorizationProviderId, ok = parsed.Parsed["authorizationProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationProviderId", *parsed) + if id.AuthorizationProviderId, ok = input.Parsed["authorizationProviderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationProviderId", input) } - return &id, nil + return nil } // ValidateAuthorizationProviderID checks that 'input' can be parsed as a Authorization Provider ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/authorizationserver/id_authorizationserver.go b/resource-manager/apimanagement/2023-03-01-preview/authorizationserver/id_authorizationserver.go index e5f6624ab65..f3fc41ad8ce 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/authorizationserver/id_authorizationserver.go +++ b/resource-manager/apimanagement/2023-03-01-preview/authorizationserver/id_authorizationserver.go @@ -38,23 +38,9 @@ func ParseAuthorizationServerID(input string) (*AuthorizationServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationServerId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.AuthorizationServerName, ok = parsed.Parsed["authorizationServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAuthorizationServerIDInsensitively(input string) (*AuthorizationServer return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AuthorizationServerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.AuthorizationServerName, ok = parsed.Parsed["authorizationServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationServerName", *parsed) + if id.AuthorizationServerName, ok = input.Parsed["authorizationServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationServerName", input) } - return &id, nil + return nil } // ValidateAuthorizationServerID checks that 'input' can be parsed as a Authorization Server ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/authorizationserver/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/authorizationserver/id_service.go index 48f4a9da5ef..3f964ef83c6 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/authorizationserver/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/authorizationserver/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/backend/id_backend.go b/resource-manager/apimanagement/2023-03-01-preview/backend/id_backend.go index c7b8374637c..7111cfb2ae2 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/backend/id_backend.go +++ b/resource-manager/apimanagement/2023-03-01-preview/backend/id_backend.go @@ -38,23 +38,9 @@ func ParseBackendID(input string) (*BackendId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackendId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.BackendId, ok = parsed.Parsed["backendId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backendId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackendIDInsensitively(input string) (*BackendId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackendId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackendId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.BackendId, ok = parsed.Parsed["backendId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backendId", *parsed) + if id.BackendId, ok = input.Parsed["backendId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backendId", input) } - return &id, nil + return nil } // ValidateBackendID checks that 'input' can be parsed as a Backend ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/backend/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/backend/id_service.go index a11de0ac7ea..894e41b5ffc 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/backend/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/backend/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/backendreconnect/id_backend.go b/resource-manager/apimanagement/2023-03-01-preview/backendreconnect/id_backend.go index e7bd4bda27f..2323cd337f6 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/backendreconnect/id_backend.go +++ b/resource-manager/apimanagement/2023-03-01-preview/backendreconnect/id_backend.go @@ -38,23 +38,9 @@ func ParseBackendID(input string) (*BackendId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackendId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.BackendId, ok = parsed.Parsed["backendId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backendId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackendIDInsensitively(input string) (*BackendId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackendId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackendId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.BackendId, ok = parsed.Parsed["backendId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backendId", *parsed) + if id.BackendId, ok = input.Parsed["backendId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backendId", input) } - return &id, nil + return nil } // ValidateBackendID checks that 'input' can be parsed as a Backend ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/cache/id_cache.go b/resource-manager/apimanagement/2023-03-01-preview/cache/id_cache.go index f481a454c49..910f2dec436 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/cache/id_cache.go +++ b/resource-manager/apimanagement/2023-03-01-preview/cache/id_cache.go @@ -38,23 +38,9 @@ func ParseCacheID(input string) (*CacheId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CacheId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.CacheId, ok = parsed.Parsed["cacheId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cacheId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCacheIDInsensitively(input string) (*CacheId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CacheId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CacheId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.CacheId, ok = parsed.Parsed["cacheId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cacheId", *parsed) + if id.CacheId, ok = input.Parsed["cacheId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cacheId", input) } - return &id, nil + return nil } // ValidateCacheID checks that 'input' can be parsed as a Cache ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/cache/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/cache/id_service.go index bbca8da8f3a..3b930b104ea 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/cache/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/cache/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/certificate/id_certificate.go b/resource-manager/apimanagement/2023-03-01-preview/certificate/id_certificate.go index 623d4954ece..d11ca5a81dc 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/certificate/id_certificate.go +++ b/resource-manager/apimanagement/2023-03-01-preview/certificate/id_certificate.go @@ -38,23 +38,9 @@ func ParseCertificateID(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.CertificateId, ok = parsed.Parsed["certificateId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCertificateIDInsensitively(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.CertificateId, ok = parsed.Parsed["certificateId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateId", *parsed) + if id.CertificateId, ok = input.Parsed["certificateId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateId", input) } - return &id, nil + return nil } // ValidateCertificateID checks that 'input' can be parsed as a Certificate ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/certificate/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/certificate/id_service.go index 66a90053cb1..4f35a34a7d3 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/certificate/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/certificate/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/contenttype/id_contenttype.go b/resource-manager/apimanagement/2023-03-01-preview/contenttype/id_contenttype.go index 7328e1b225d..a38ab676dca 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/contenttype/id_contenttype.go +++ b/resource-manager/apimanagement/2023-03-01-preview/contenttype/id_contenttype.go @@ -38,23 +38,9 @@ func ParseContentTypeID(input string) (*ContentTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContentTypeId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ContentTypeId, ok = parsed.Parsed["contentTypeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "contentTypeId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseContentTypeIDInsensitively(input string) (*ContentTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContentTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ContentTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ContentTypeId, ok = parsed.Parsed["contentTypeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "contentTypeId", *parsed) + if id.ContentTypeId, ok = input.Parsed["contentTypeId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "contentTypeId", input) } - return &id, nil + return nil } // ValidateContentTypeID checks that 'input' can be parsed as a Content Type ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/contenttype/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/contenttype/id_service.go index bd1834775c3..f425169a4cb 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/contenttype/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/contenttype/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/contenttypecontentitem/id_contentitem.go b/resource-manager/apimanagement/2023-03-01-preview/contenttypecontentitem/id_contentitem.go index 45d0a06c68d..4e6f414ce57 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/contenttypecontentitem/id_contentitem.go +++ b/resource-manager/apimanagement/2023-03-01-preview/contenttypecontentitem/id_contentitem.go @@ -40,27 +40,9 @@ func ParseContentItemID(input string) (*ContentItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContentItemId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ContentTypeId, ok = parsed.Parsed["contentTypeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "contentTypeId", *parsed) - } - - if id.ContentItemId, ok = parsed.Parsed["contentItemId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "contentItemId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseContentItemIDInsensitively(input string) (*ContentItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContentItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ContentItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ContentTypeId, ok = parsed.Parsed["contentTypeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "contentTypeId", *parsed) + if id.ContentTypeId, ok = input.Parsed["contentTypeId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "contentTypeId", input) } - if id.ContentItemId, ok = parsed.Parsed["contentItemId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "contentItemId", *parsed) + if id.ContentItemId, ok = input.Parsed["contentItemId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "contentItemId", input) } - return &id, nil + return nil } // ValidateContentItemID checks that 'input' can be parsed as a Content Item ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/contenttypecontentitem/id_contenttype.go b/resource-manager/apimanagement/2023-03-01-preview/contenttypecontentitem/id_contenttype.go index 3b5c1e346ee..9d8bfce288f 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/contenttypecontentitem/id_contenttype.go +++ b/resource-manager/apimanagement/2023-03-01-preview/contenttypecontentitem/id_contenttype.go @@ -38,23 +38,9 @@ func ParseContentTypeID(input string) (*ContentTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContentTypeId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ContentTypeId, ok = parsed.Parsed["contentTypeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "contentTypeId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseContentTypeIDInsensitively(input string) (*ContentTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContentTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ContentTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ContentTypeId, ok = parsed.Parsed["contentTypeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "contentTypeId", *parsed) + if id.ContentTypeId, ok = input.Parsed["contentTypeId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "contentTypeId", input) } - return &id, nil + return nil } // ValidateContentTypeID checks that 'input' can be parsed as a Content Type ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/delegationsettings/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/delegationsettings/id_service.go index c58ec8e039b..5c8d2f37462 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/delegationsettings/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/delegationsettings/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/deletedservice/id_deletedservice.go b/resource-manager/apimanagement/2023-03-01-preview/deletedservice/id_deletedservice.go index 16ae59293af..316c4f88aae 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/deletedservice/id_deletedservice.go +++ b/resource-manager/apimanagement/2023-03-01-preview/deletedservice/id_deletedservice.go @@ -36,19 +36,9 @@ func ParseDeletedServiceID(input string) (*DeletedServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeletedServiceId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.DeletedServiceName, ok = parsed.Parsed["deletedServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDeletedServiceIDInsensitively(input string) (*DeletedServiceId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeletedServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DeletedServiceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.DeletedServiceName, ok = parsed.Parsed["deletedServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedServiceName", *parsed) + if id.DeletedServiceName, ok = input.Parsed["deletedServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deletedServiceName", input) } - return &id, nil + return nil } // ValidateDeletedServiceID checks that 'input' can be parsed as a Deleted Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/diagnostic/id_diagnostic.go b/resource-manager/apimanagement/2023-03-01-preview/diagnostic/id_diagnostic.go index e283d041523..dc614829351 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/diagnostic/id_diagnostic.go +++ b/resource-manager/apimanagement/2023-03-01-preview/diagnostic/id_diagnostic.go @@ -38,23 +38,9 @@ func ParseDiagnosticID(input string) (*DiagnosticId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiagnosticId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.DiagnosticId, ok = parsed.Parsed["diagnosticId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDiagnosticIDInsensitively(input string) (*DiagnosticId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiagnosticId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DiagnosticId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.DiagnosticId, ok = parsed.Parsed["diagnosticId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticId", *parsed) + if id.DiagnosticId, ok = input.Parsed["diagnosticId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "diagnosticId", input) } - return &id, nil + return nil } // ValidateDiagnosticID checks that 'input' can be parsed as a Diagnostic ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/diagnostic/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/diagnostic/id_service.go index 521b0f80d0a..912c67cfa64 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/diagnostic/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/diagnostic/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/documentationresource/id_documentation.go b/resource-manager/apimanagement/2023-03-01-preview/documentationresource/id_documentation.go index 3ad31fd0dac..6705b4ef5e6 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/documentationresource/id_documentation.go +++ b/resource-manager/apimanagement/2023-03-01-preview/documentationresource/id_documentation.go @@ -38,23 +38,9 @@ func ParseDocumentationID(input string) (*DocumentationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DocumentationId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.DocumentationId, ok = parsed.Parsed["documentationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "documentationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDocumentationIDInsensitively(input string) (*DocumentationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DocumentationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DocumentationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.DocumentationId, ok = parsed.Parsed["documentationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "documentationId", *parsed) + if id.DocumentationId, ok = input.Parsed["documentationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "documentationId", input) } - return &id, nil + return nil } // ValidateDocumentationID checks that 'input' can be parsed as a Documentation ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/documentationresource/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/documentationresource/id_service.go index 019e05f0f8d..c31d9d6516e 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/documentationresource/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/documentationresource/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/emailtemplate/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/emailtemplate/id_service.go index 6b34dfa4d2e..a1f9eb65d86 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/emailtemplate/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/emailtemplate/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/emailtemplates/id_template.go b/resource-manager/apimanagement/2023-03-01-preview/emailtemplates/id_template.go index c088c6f73c5..7dc72ab7ffc 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/emailtemplates/id_template.go +++ b/resource-manager/apimanagement/2023-03-01-preview/emailtemplates/id_template.go @@ -38,31 +38,9 @@ func ParseTemplateID(input string) (*TemplateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TemplateId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if v, ok := parsed.Parsed["templateName"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "templateName", *parsed) - } - - templateName, err := parseTemplateName(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.TemplateName = *templateName + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -77,34 +55,42 @@ func ParseTemplateIDInsensitively(input string) (*TemplateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TemplateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TemplateId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if v, ok := parsed.Parsed["templateName"]; true { + if v, ok := input.Parsed["templateName"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "templateName", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "templateName", input) } templateName, err := parseTemplateName(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.TemplateName = *templateName } - return &id, nil + return nil } // ValidateTemplateID checks that 'input' can be parsed as a Template ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/gateway/id_gateway.go b/resource-manager/apimanagement/2023-03-01-preview/gateway/id_gateway.go index 34550bb3edc..ccbe85e114d 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/gateway/id_gateway.go +++ b/resource-manager/apimanagement/2023-03-01-preview/gateway/id_gateway.go @@ -38,23 +38,9 @@ func ParseGatewayID(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGatewayIDInsensitively(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GatewayId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if id.GatewayId, ok = input.Parsed["gatewayId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", input) } - return &id, nil + return nil } // ValidateGatewayID checks that 'input' can be parsed as a Gateway ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/gateway/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/gateway/id_service.go index a45df593cf6..da4dbe6703a 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/gateway/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/gateway/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/gatewayapi/id_gateway.go b/resource-manager/apimanagement/2023-03-01-preview/gatewayapi/id_gateway.go index 4165de54710..0261bc252ac 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/gatewayapi/id_gateway.go +++ b/resource-manager/apimanagement/2023-03-01-preview/gatewayapi/id_gateway.go @@ -38,23 +38,9 @@ func ParseGatewayID(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGatewayIDInsensitively(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GatewayId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if id.GatewayId, ok = input.Parsed["gatewayId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", input) } - return &id, nil + return nil } // ValidateGatewayID checks that 'input' can be parsed as a Gateway ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/gatewayapi/id_gatewayapi.go b/resource-manager/apimanagement/2023-03-01-preview/gatewayapi/id_gatewayapi.go index 7dc333eb0d3..7c845917a0f 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/gatewayapi/id_gatewayapi.go +++ b/resource-manager/apimanagement/2023-03-01-preview/gatewayapi/id_gatewayapi.go @@ -40,27 +40,9 @@ func ParseGatewayApiID(input string) (*GatewayApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseGatewayApiIDInsensitively(input string) (*GatewayApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *GatewayApiId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if id.GatewayId, ok = input.Parsed["gatewayId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateGatewayApiID checks that 'input' can be parsed as a Gateway Api ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/gatewaycertificateauthority/id_certificateauthority.go b/resource-manager/apimanagement/2023-03-01-preview/gatewaycertificateauthority/id_certificateauthority.go index 237095225f1..fa08514181b 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/gatewaycertificateauthority/id_certificateauthority.go +++ b/resource-manager/apimanagement/2023-03-01-preview/gatewaycertificateauthority/id_certificateauthority.go @@ -40,27 +40,9 @@ func ParseCertificateAuthorityID(input string) (*CertificateAuthorityId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateAuthorityId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) - } - - if id.CertificateId, ok = parsed.Parsed["certificateId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseCertificateAuthorityIDInsensitively(input string) (*CertificateAuthori return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateAuthorityId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *CertificateAuthorityId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if id.GatewayId, ok = input.Parsed["gatewayId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", input) } - if id.CertificateId, ok = parsed.Parsed["certificateId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateId", *parsed) + if id.CertificateId, ok = input.Parsed["certificateId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateId", input) } - return &id, nil + return nil } // ValidateCertificateAuthorityID checks that 'input' can be parsed as a Certificate Authority ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/gatewaycertificateauthority/id_gateway.go b/resource-manager/apimanagement/2023-03-01-preview/gatewaycertificateauthority/id_gateway.go index 787e1bc3e37..9f62338c3e7 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/gatewaycertificateauthority/id_gateway.go +++ b/resource-manager/apimanagement/2023-03-01-preview/gatewaycertificateauthority/id_gateway.go @@ -38,23 +38,9 @@ func ParseGatewayID(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGatewayIDInsensitively(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GatewayId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if id.GatewayId, ok = input.Parsed["gatewayId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", input) } - return &id, nil + return nil } // ValidateGatewayID checks that 'input' can be parsed as a Gateway ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/gatewaygeneratetoken/id_gateway.go b/resource-manager/apimanagement/2023-03-01-preview/gatewaygeneratetoken/id_gateway.go index 6d924627762..fc452bcf7d7 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/gatewaygeneratetoken/id_gateway.go +++ b/resource-manager/apimanagement/2023-03-01-preview/gatewaygeneratetoken/id_gateway.go @@ -38,23 +38,9 @@ func ParseGatewayID(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGatewayIDInsensitively(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GatewayId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if id.GatewayId, ok = input.Parsed["gatewayId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", input) } - return &id, nil + return nil } // ValidateGatewayID checks that 'input' can be parsed as a Gateway ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/gatewayhostnameconfiguration/id_gateway.go b/resource-manager/apimanagement/2023-03-01-preview/gatewayhostnameconfiguration/id_gateway.go index db58fe2a01d..ee66d381b60 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/gatewayhostnameconfiguration/id_gateway.go +++ b/resource-manager/apimanagement/2023-03-01-preview/gatewayhostnameconfiguration/id_gateway.go @@ -38,23 +38,9 @@ func ParseGatewayID(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGatewayIDInsensitively(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GatewayId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if id.GatewayId, ok = input.Parsed["gatewayId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", input) } - return &id, nil + return nil } // ValidateGatewayID checks that 'input' can be parsed as a Gateway ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/gatewayhostnameconfiguration/id_hostnameconfiguration.go b/resource-manager/apimanagement/2023-03-01-preview/gatewayhostnameconfiguration/id_hostnameconfiguration.go index 6161f448656..345c2161ae6 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/gatewayhostnameconfiguration/id_hostnameconfiguration.go +++ b/resource-manager/apimanagement/2023-03-01-preview/gatewayhostnameconfiguration/id_hostnameconfiguration.go @@ -40,27 +40,9 @@ func ParseHostnameConfigurationID(input string) (*HostnameConfigurationId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostnameConfigurationId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) - } - - if id.HcId, ok = parsed.Parsed["hcId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hcId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseHostnameConfigurationIDInsensitively(input string) (*HostnameConfigura return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostnameConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *HostnameConfigurationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if id.GatewayId, ok = input.Parsed["gatewayId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", input) } - if id.HcId, ok = parsed.Parsed["hcId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hcId", *parsed) + if id.HcId, ok = input.Parsed["hcId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hcId", input) } - return &id, nil + return nil } // ValidateHostnameConfigurationID checks that 'input' can be parsed as a Hostname Configuration ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/gatewayinvalidatedebugcredentials/id_gateway.go b/resource-manager/apimanagement/2023-03-01-preview/gatewayinvalidatedebugcredentials/id_gateway.go index c35d9dcf1e9..387056c940e 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/gatewayinvalidatedebugcredentials/id_gateway.go +++ b/resource-manager/apimanagement/2023-03-01-preview/gatewayinvalidatedebugcredentials/id_gateway.go @@ -38,23 +38,9 @@ func ParseGatewayID(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGatewayIDInsensitively(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GatewayId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if id.GatewayId, ok = input.Parsed["gatewayId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", input) } - return &id, nil + return nil } // ValidateGatewayID checks that 'input' can be parsed as a Gateway ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/gatewaylistdebugcredentials/id_gateway.go b/resource-manager/apimanagement/2023-03-01-preview/gatewaylistdebugcredentials/id_gateway.go index 6aef36b4a87..70e12204a55 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/gatewaylistdebugcredentials/id_gateway.go +++ b/resource-manager/apimanagement/2023-03-01-preview/gatewaylistdebugcredentials/id_gateway.go @@ -38,23 +38,9 @@ func ParseGatewayID(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGatewayIDInsensitively(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GatewayId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if id.GatewayId, ok = input.Parsed["gatewayId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", input) } - return &id, nil + return nil } // ValidateGatewayID checks that 'input' can be parsed as a Gateway ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/gatewaylistkeys/id_gateway.go b/resource-manager/apimanagement/2023-03-01-preview/gatewaylistkeys/id_gateway.go index 31bcc239ed0..10b1e70ee49 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/gatewaylistkeys/id_gateway.go +++ b/resource-manager/apimanagement/2023-03-01-preview/gatewaylistkeys/id_gateway.go @@ -38,23 +38,9 @@ func ParseGatewayID(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGatewayIDInsensitively(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GatewayId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if id.GatewayId, ok = input.Parsed["gatewayId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", input) } - return &id, nil + return nil } // ValidateGatewayID checks that 'input' can be parsed as a Gateway ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/gatewaylisttrace/id_gateway.go b/resource-manager/apimanagement/2023-03-01-preview/gatewaylisttrace/id_gateway.go index a3ca5b8c6d1..edb3e2308f8 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/gatewaylisttrace/id_gateway.go +++ b/resource-manager/apimanagement/2023-03-01-preview/gatewaylisttrace/id_gateway.go @@ -38,23 +38,9 @@ func ParseGatewayID(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGatewayIDInsensitively(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GatewayId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if id.GatewayId, ok = input.Parsed["gatewayId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", input) } - return &id, nil + return nil } // ValidateGatewayID checks that 'input' can be parsed as a Gateway ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/gatewayregeneratekey/id_gateway.go b/resource-manager/apimanagement/2023-03-01-preview/gatewayregeneratekey/id_gateway.go index 514b9366d19..91b264cbd9e 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/gatewayregeneratekey/id_gateway.go +++ b/resource-manager/apimanagement/2023-03-01-preview/gatewayregeneratekey/id_gateway.go @@ -38,23 +38,9 @@ func ParseGatewayID(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGatewayIDInsensitively(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GatewayId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if id.GatewayId, ok = input.Parsed["gatewayId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", input) } - return &id, nil + return nil } // ValidateGatewayID checks that 'input' can be parsed as a Gateway ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/graphqlapiresolver/id_api.go b/resource-manager/apimanagement/2023-03-01-preview/graphqlapiresolver/id_api.go index 06ebb68e150..93e3218bcdd 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/graphqlapiresolver/id_api.go +++ b/resource-manager/apimanagement/2023-03-01-preview/graphqlapiresolver/id_api.go @@ -38,23 +38,9 @@ func ParseApiID(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiIDInsensitively(input string) (*ApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateApiID checks that 'input' can be parsed as a Api ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/graphqlapiresolver/id_resolver.go b/resource-manager/apimanagement/2023-03-01-preview/graphqlapiresolver/id_resolver.go index d657ec444db..d767751c128 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/graphqlapiresolver/id_resolver.go +++ b/resource-manager/apimanagement/2023-03-01-preview/graphqlapiresolver/id_resolver.go @@ -40,27 +40,9 @@ func ParseResolverID(input string) (*ResolverId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResolverId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.ResolverId, ok = parsed.Parsed["resolverId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resolverId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseResolverIDInsensitively(input string) (*ResolverId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResolverId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ResolverId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.ResolverId, ok = parsed.Parsed["resolverId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resolverId", *parsed) + if id.ResolverId, ok = input.Parsed["resolverId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resolverId", input) } - return &id, nil + return nil } // ValidateResolverID checks that 'input' can be parsed as a Resolver ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/graphqlapiresolverpolicy/id_resolver.go b/resource-manager/apimanagement/2023-03-01-preview/graphqlapiresolverpolicy/id_resolver.go index dd348a9e3ab..d78abb8a805 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/graphqlapiresolverpolicy/id_resolver.go +++ b/resource-manager/apimanagement/2023-03-01-preview/graphqlapiresolverpolicy/id_resolver.go @@ -40,27 +40,9 @@ func ParseResolverID(input string) (*ResolverId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResolverId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) - } - - if id.ResolverId, ok = parsed.Parsed["resolverId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resolverId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseResolverIDInsensitively(input string) (*ResolverId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResolverId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ResolverId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - if id.ResolverId, ok = parsed.Parsed["resolverId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resolverId", *parsed) + if id.ResolverId, ok = input.Parsed["resolverId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resolverId", input) } - return &id, nil + return nil } // ValidateResolverID checks that 'input' can be parsed as a Resolver ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/group/id_group.go b/resource-manager/apimanagement/2023-03-01-preview/group/id_group.go index 1cb69ca64b1..b6224b4b2d5 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/group/id_group.go +++ b/resource-manager/apimanagement/2023-03-01-preview/group/id_group.go @@ -38,23 +38,9 @@ func ParseGroupID(input string) (*GroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GroupId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGroupIDInsensitively(input string) (*GroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + if id.GroupId, ok = input.Parsed["groupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "groupId", input) } - return &id, nil + return nil } // ValidateGroupID checks that 'input' can be parsed as a Group ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/group/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/group/id_service.go index 916e4cfce48..f9caa2ad509 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/group/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/group/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/group/id_workspace.go b/resource-manager/apimanagement/2023-03-01-preview/group/id_workspace.go index 9bde327647b..1396a39c83d 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/group/id_workspace.go +++ b/resource-manager/apimanagement/2023-03-01-preview/group/id_workspace.go @@ -38,23 +38,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WorkspaceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/group/id_workspacegroup.go b/resource-manager/apimanagement/2023-03-01-preview/group/id_workspacegroup.go index b2b59f85bab..37a20ec6af4 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/group/id_workspacegroup.go +++ b/resource-manager/apimanagement/2023-03-01-preview/group/id_workspacegroup.go @@ -40,27 +40,9 @@ func ParseWorkspaceGroupID(input string) (*WorkspaceGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceGroupId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) - } - - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseWorkspaceGroupIDInsensitively(input string) (*WorkspaceGroupId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *WorkspaceGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + if id.GroupId, ok = input.Parsed["groupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "groupId", input) } - return &id, nil + return nil } // ValidateWorkspaceGroupID checks that 'input' can be parsed as a Workspace Group ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/groupuser/id_group.go b/resource-manager/apimanagement/2023-03-01-preview/groupuser/id_group.go index 9d328f9f026..8700a88c74c 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/groupuser/id_group.go +++ b/resource-manager/apimanagement/2023-03-01-preview/groupuser/id_group.go @@ -38,23 +38,9 @@ func ParseGroupID(input string) (*GroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GroupId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGroupIDInsensitively(input string) (*GroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + if id.GroupId, ok = input.Parsed["groupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "groupId", input) } - return &id, nil + return nil } // ValidateGroupID checks that 'input' can be parsed as a Group ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/groupuser/id_groupuser.go b/resource-manager/apimanagement/2023-03-01-preview/groupuser/id_groupuser.go index 70947c02de3..107bb00c1fb 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/groupuser/id_groupuser.go +++ b/resource-manager/apimanagement/2023-03-01-preview/groupuser/id_groupuser.go @@ -40,27 +40,9 @@ func ParseGroupUserID(input string) (*GroupUserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GroupUserId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) - } - - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseGroupUserIDInsensitively(input string) (*GroupUserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GroupUserId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *GroupUserId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + if id.GroupId, ok = input.Parsed["groupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "groupId", input) } - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if id.UserId, ok = input.Parsed["userId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userId", input) } - return &id, nil + return nil } // ValidateGroupUserID checks that 'input' can be parsed as a Group User ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/groupuser/id_workspacegroup.go b/resource-manager/apimanagement/2023-03-01-preview/groupuser/id_workspacegroup.go index 741d5f38d68..8fdcc08b0a5 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/groupuser/id_workspacegroup.go +++ b/resource-manager/apimanagement/2023-03-01-preview/groupuser/id_workspacegroup.go @@ -40,27 +40,9 @@ func ParseWorkspaceGroupID(input string) (*WorkspaceGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceGroupId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) - } - - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseWorkspaceGroupIDInsensitively(input string) (*WorkspaceGroupId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *WorkspaceGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + if id.GroupId, ok = input.Parsed["groupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "groupId", input) } - return &id, nil + return nil } // ValidateWorkspaceGroupID checks that 'input' can be parsed as a Workspace Group ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/groupuser/id_workspacegroupuser.go b/resource-manager/apimanagement/2023-03-01-preview/groupuser/id_workspacegroupuser.go index 2a5b27a09c7..9ad4bab1d1c 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/groupuser/id_workspacegroupuser.go +++ b/resource-manager/apimanagement/2023-03-01-preview/groupuser/id_workspacegroupuser.go @@ -42,31 +42,9 @@ func ParseWorkspaceGroupUserID(input string) (*WorkspaceGroupUserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceGroupUserId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) - } - - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) - } - - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseWorkspaceGroupUserIDInsensitively(input string) (*WorkspaceGroupUserId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceGroupUserId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceGroupUserId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + if id.GroupId, ok = input.Parsed["groupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "groupId", input) } - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if id.UserId, ok = input.Parsed["userId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userId", input) } - return &id, nil + return nil } // ValidateWorkspaceGroupUserID checks that 'input' can be parsed as a Workspace Group User ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/identityprovider/id_identityprovider.go b/resource-manager/apimanagement/2023-03-01-preview/identityprovider/id_identityprovider.go index b31fc9697f3..cb485fbbca2 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/identityprovider/id_identityprovider.go +++ b/resource-manager/apimanagement/2023-03-01-preview/identityprovider/id_identityprovider.go @@ -38,31 +38,9 @@ func ParseIdentityProviderID(input string) (*IdentityProviderId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IdentityProviderId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if v, ok := parsed.Parsed["identityProviderName"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "identityProviderName", *parsed) - } - - identityProviderName, err := parseIdentityProviderType(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.IdentityProviderName = *identityProviderName + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -77,34 +55,42 @@ func ParseIdentityProviderIDInsensitively(input string) (*IdentityProviderId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IdentityProviderId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *IdentityProviderId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if v, ok := parsed.Parsed["identityProviderName"]; true { + if v, ok := input.Parsed["identityProviderName"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "identityProviderName", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "identityProviderName", input) } identityProviderName, err := parseIdentityProviderType(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.IdentityProviderName = *identityProviderName } - return &id, nil + return nil } // ValidateIdentityProviderID checks that 'input' can be parsed as a Identity Provider ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/identityprovider/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/identityprovider/id_service.go index 89ca80d7df0..b2789ac6a8f 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/identityprovider/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/identityprovider/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/issue/id_issue.go b/resource-manager/apimanagement/2023-03-01-preview/issue/id_issue.go index 4e23d04fe18..77ce6f29b3b 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/issue/id_issue.go +++ b/resource-manager/apimanagement/2023-03-01-preview/issue/id_issue.go @@ -38,23 +38,9 @@ func ParseIssueID(input string) (*IssueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IssueId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.IssueId, ok = parsed.Parsed["issueId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "issueId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIssueIDInsensitively(input string) (*IssueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IssueId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IssueId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.IssueId, ok = parsed.Parsed["issueId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "issueId", *parsed) + if id.IssueId, ok = input.Parsed["issueId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "issueId", input) } - return &id, nil + return nil } // ValidateIssueID checks that 'input' can be parsed as a Issue ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/issue/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/issue/id_service.go index 48789e072fb..86785e7cc0d 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/issue/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/issue/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/logger/id_logger.go b/resource-manager/apimanagement/2023-03-01-preview/logger/id_logger.go index ee7f985a191..48e0f627f2a 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/logger/id_logger.go +++ b/resource-manager/apimanagement/2023-03-01-preview/logger/id_logger.go @@ -38,23 +38,9 @@ func ParseLoggerID(input string) (*LoggerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LoggerId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.LoggerId, ok = parsed.Parsed["loggerId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loggerId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLoggerIDInsensitively(input string) (*LoggerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LoggerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LoggerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.LoggerId, ok = parsed.Parsed["loggerId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loggerId", *parsed) + if id.LoggerId, ok = input.Parsed["loggerId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "loggerId", input) } - return &id, nil + return nil } // ValidateLoggerID checks that 'input' can be parsed as a Logger ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/logger/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/logger/id_service.go index 5807ecae3aa..af4ae84d1ca 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/logger/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/logger/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/namedvalue/id_namedvalue.go b/resource-manager/apimanagement/2023-03-01-preview/namedvalue/id_namedvalue.go index eb84d26bb30..7356af722df 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/namedvalue/id_namedvalue.go +++ b/resource-manager/apimanagement/2023-03-01-preview/namedvalue/id_namedvalue.go @@ -38,23 +38,9 @@ func ParseNamedValueID(input string) (*NamedValueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamedValueId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.NamedValueId, ok = parsed.Parsed["namedValueId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namedValueId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseNamedValueIDInsensitively(input string) (*NamedValueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamedValueId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *NamedValueId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.NamedValueId, ok = parsed.Parsed["namedValueId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namedValueId", *parsed) + if id.NamedValueId, ok = input.Parsed["namedValueId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namedValueId", input) } - return &id, nil + return nil } // ValidateNamedValueID checks that 'input' can be parsed as a Named Value ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/namedvalue/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/namedvalue/id_service.go index a39da071fda..51c851d257f 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/namedvalue/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/namedvalue/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/namedvalue/id_workspace.go b/resource-manager/apimanagement/2023-03-01-preview/namedvalue/id_workspace.go index 61a94d7257b..67d288eb775 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/namedvalue/id_workspace.go +++ b/resource-manager/apimanagement/2023-03-01-preview/namedvalue/id_workspace.go @@ -38,23 +38,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WorkspaceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/namedvalue/id_workspacenamedvalue.go b/resource-manager/apimanagement/2023-03-01-preview/namedvalue/id_workspacenamedvalue.go index aa64e0e9dec..b6c513effac 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/namedvalue/id_workspacenamedvalue.go +++ b/resource-manager/apimanagement/2023-03-01-preview/namedvalue/id_workspacenamedvalue.go @@ -40,27 +40,9 @@ func ParseWorkspaceNamedValueID(input string) (*WorkspaceNamedValueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceNamedValueId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) - } - - if id.NamedValueId, ok = parsed.Parsed["namedValueId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namedValueId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseWorkspaceNamedValueIDInsensitively(input string) (*WorkspaceNamedValue return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceNamedValueId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *WorkspaceNamedValueId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - if id.NamedValueId, ok = parsed.Parsed["namedValueId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namedValueId", *parsed) + if id.NamedValueId, ok = input.Parsed["namedValueId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namedValueId", input) } - return &id, nil + return nil } // ValidateWorkspaceNamedValueID checks that 'input' can be parsed as a Workspace Named Value ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/networkstatus/id_location.go b/resource-manager/apimanagement/2023-03-01-preview/networkstatus/id_location.go index 9bae59232c7..96f6c21f46a 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/networkstatus/id_location.go +++ b/resource-manager/apimanagement/2023-03-01-preview/networkstatus/id_location.go @@ -38,23 +38,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/networkstatus/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/networkstatus/id_service.go index 7607c8f6e3e..42461e8b992 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/networkstatus/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/networkstatus/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/notification/id_notification.go b/resource-manager/apimanagement/2023-03-01-preview/notification/id_notification.go index d769f22070b..ebb5d7ad704 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/notification/id_notification.go +++ b/resource-manager/apimanagement/2023-03-01-preview/notification/id_notification.go @@ -38,31 +38,9 @@ func ParseNotificationID(input string) (*NotificationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NotificationId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if v, ok := parsed.Parsed["notificationName"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationName", *parsed) - } - - notificationName, err := parseNotificationName(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.NotificationName = *notificationName + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -77,34 +55,42 @@ func ParseNotificationIDInsensitively(input string) (*NotificationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NotificationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *NotificationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if v, ok := parsed.Parsed["notificationName"]; true { + if v, ok := input.Parsed["notificationName"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationName", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "notificationName", input) } notificationName, err := parseNotificationName(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.NotificationName = *notificationName } - return &id, nil + return nil } // ValidateNotificationID checks that 'input' can be parsed as a Notification ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/notification/id_notificationnotification.go b/resource-manager/apimanagement/2023-03-01-preview/notification/id_notificationnotification.go index c47cc083d29..d94d4918b7c 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/notification/id_notificationnotification.go +++ b/resource-manager/apimanagement/2023-03-01-preview/notification/id_notificationnotification.go @@ -40,35 +40,9 @@ func ParseNotificationNotificationID(input string) (*NotificationNotificationId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NotificationNotificationId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) - } - - if v, ok := parsed.Parsed["notificationName"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationName", *parsed) - } - - notificationName, err := parseNotificationName(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.NotificationName = *notificationName + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -83,38 +57,46 @@ func ParseNotificationNotificationIDInsensitively(input string) (*NotificationNo return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NotificationNotificationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *NotificationNotificationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - if v, ok := parsed.Parsed["notificationName"]; true { + if v, ok := input.Parsed["notificationName"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationName", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "notificationName", input) } notificationName, err := parseNotificationName(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.NotificationName = *notificationName } - return &id, nil + return nil } // ValidateNotificationNotificationID checks that 'input' can be parsed as a Notification Notification ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/notification/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/notification/id_service.go index a3e0af16c59..11b88b72604 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/notification/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/notification/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/notification/id_workspace.go b/resource-manager/apimanagement/2023-03-01-preview/notification/id_workspace.go index 626e41374ef..517317d1e24 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/notification/id_workspace.go +++ b/resource-manager/apimanagement/2023-03-01-preview/notification/id_workspace.go @@ -38,23 +38,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WorkspaceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/notificationrecipientemail/id_notification.go b/resource-manager/apimanagement/2023-03-01-preview/notificationrecipientemail/id_notification.go index 03494ec3aec..c6cab7f7856 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/notificationrecipientemail/id_notification.go +++ b/resource-manager/apimanagement/2023-03-01-preview/notificationrecipientemail/id_notification.go @@ -38,31 +38,9 @@ func ParseNotificationID(input string) (*NotificationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NotificationId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if v, ok := parsed.Parsed["notificationName"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationName", *parsed) - } - - notificationName, err := parseNotificationName(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.NotificationName = *notificationName + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -77,34 +55,42 @@ func ParseNotificationIDInsensitively(input string) (*NotificationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NotificationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *NotificationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if v, ok := parsed.Parsed["notificationName"]; true { + if v, ok := input.Parsed["notificationName"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationName", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "notificationName", input) } notificationName, err := parseNotificationName(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.NotificationName = *notificationName } - return &id, nil + return nil } // ValidateNotificationID checks that 'input' can be parsed as a Notification ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/notificationrecipientemail/id_notificationnotification.go b/resource-manager/apimanagement/2023-03-01-preview/notificationrecipientemail/id_notificationnotification.go index a1dd74503f0..3f0f2c0086b 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/notificationrecipientemail/id_notificationnotification.go +++ b/resource-manager/apimanagement/2023-03-01-preview/notificationrecipientemail/id_notificationnotification.go @@ -40,35 +40,9 @@ func ParseNotificationNotificationID(input string) (*NotificationNotificationId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NotificationNotificationId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) - } - - if v, ok := parsed.Parsed["notificationName"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationName", *parsed) - } - - notificationName, err := parseNotificationName(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.NotificationName = *notificationName + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -83,38 +57,46 @@ func ParseNotificationNotificationIDInsensitively(input string) (*NotificationNo return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NotificationNotificationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *NotificationNotificationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - if v, ok := parsed.Parsed["notificationName"]; true { + if v, ok := input.Parsed["notificationName"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationName", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "notificationName", input) } notificationName, err := parseNotificationName(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.NotificationName = *notificationName } - return &id, nil + return nil } // ValidateNotificationNotificationID checks that 'input' can be parsed as a Notification Notification ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/notificationrecipientemail/id_notificationrecipientemail.go b/resource-manager/apimanagement/2023-03-01-preview/notificationrecipientemail/id_notificationrecipientemail.go index 543bc9dbf87..2fa5430b7b8 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/notificationrecipientemail/id_notificationrecipientemail.go +++ b/resource-manager/apimanagement/2023-03-01-preview/notificationrecipientemail/id_notificationrecipientemail.go @@ -42,39 +42,9 @@ func ParseNotificationRecipientEmailID(input string) (*NotificationRecipientEmai return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NotificationRecipientEmailId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) - } - - if v, ok := parsed.Parsed["notificationName"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationName", *parsed) - } - - notificationName, err := parseNotificationName(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.NotificationName = *notificationName - } - - if id.RecipientEmailName, ok = parsed.Parsed["recipientEmailName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recipientEmailName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -89,42 +59,50 @@ func ParseNotificationRecipientEmailIDInsensitively(input string) (*Notification return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NotificationRecipientEmailId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *NotificationRecipientEmailId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - if v, ok := parsed.Parsed["notificationName"]; true { + if v, ok := input.Parsed["notificationName"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationName", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "notificationName", input) } notificationName, err := parseNotificationName(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.NotificationName = *notificationName } - if id.RecipientEmailName, ok = parsed.Parsed["recipientEmailName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recipientEmailName", *parsed) + if id.RecipientEmailName, ok = input.Parsed["recipientEmailName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "recipientEmailName", input) } - return &id, nil + return nil } // ValidateNotificationRecipientEmailID checks that 'input' can be parsed as a Notification Recipient Email ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/notificationrecipientemail/id_recipientemail.go b/resource-manager/apimanagement/2023-03-01-preview/notificationrecipientemail/id_recipientemail.go index 622fa5001ba..9616fe55542 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/notificationrecipientemail/id_recipientemail.go +++ b/resource-manager/apimanagement/2023-03-01-preview/notificationrecipientemail/id_recipientemail.go @@ -40,35 +40,9 @@ func ParseRecipientEmailID(input string) (*RecipientEmailId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecipientEmailId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if v, ok := parsed.Parsed["notificationName"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationName", *parsed) - } - - notificationName, err := parseNotificationName(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.NotificationName = *notificationName - } - - if id.RecipientEmailName, ok = parsed.Parsed["recipientEmailName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recipientEmailName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -83,38 +57,46 @@ func ParseRecipientEmailIDInsensitively(input string) (*RecipientEmailId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecipientEmailId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RecipientEmailId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if v, ok := parsed.Parsed["notificationName"]; true { + if v, ok := input.Parsed["notificationName"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationName", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "notificationName", input) } notificationName, err := parseNotificationName(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.NotificationName = *notificationName } - if id.RecipientEmailName, ok = parsed.Parsed["recipientEmailName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recipientEmailName", *parsed) + if id.RecipientEmailName, ok = input.Parsed["recipientEmailName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "recipientEmailName", input) } - return &id, nil + return nil } // ValidateRecipientEmailID checks that 'input' can be parsed as a Recipient Email ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/notificationrecipientuser/id_notification.go b/resource-manager/apimanagement/2023-03-01-preview/notificationrecipientuser/id_notification.go index 9e0e8aebd25..c1f566238f9 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/notificationrecipientuser/id_notification.go +++ b/resource-manager/apimanagement/2023-03-01-preview/notificationrecipientuser/id_notification.go @@ -38,31 +38,9 @@ func ParseNotificationID(input string) (*NotificationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NotificationId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if v, ok := parsed.Parsed["notificationName"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationName", *parsed) - } - - notificationName, err := parseNotificationName(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.NotificationName = *notificationName + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -77,34 +55,42 @@ func ParseNotificationIDInsensitively(input string) (*NotificationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NotificationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *NotificationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if v, ok := parsed.Parsed["notificationName"]; true { + if v, ok := input.Parsed["notificationName"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationName", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "notificationName", input) } notificationName, err := parseNotificationName(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.NotificationName = *notificationName } - return &id, nil + return nil } // ValidateNotificationID checks that 'input' can be parsed as a Notification ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/notificationrecipientuser/id_notificationnotification.go b/resource-manager/apimanagement/2023-03-01-preview/notificationrecipientuser/id_notificationnotification.go index db2a34e2394..37a765aeea2 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/notificationrecipientuser/id_notificationnotification.go +++ b/resource-manager/apimanagement/2023-03-01-preview/notificationrecipientuser/id_notificationnotification.go @@ -40,35 +40,9 @@ func ParseNotificationNotificationID(input string) (*NotificationNotificationId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NotificationNotificationId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) - } - - if v, ok := parsed.Parsed["notificationName"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationName", *parsed) - } - - notificationName, err := parseNotificationName(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.NotificationName = *notificationName + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -83,38 +57,46 @@ func ParseNotificationNotificationIDInsensitively(input string) (*NotificationNo return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NotificationNotificationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *NotificationNotificationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - if v, ok := parsed.Parsed["notificationName"]; true { + if v, ok := input.Parsed["notificationName"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationName", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "notificationName", input) } notificationName, err := parseNotificationName(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.NotificationName = *notificationName } - return &id, nil + return nil } // ValidateNotificationNotificationID checks that 'input' can be parsed as a Notification Notification ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/notificationrecipientuser/id_notificationrecipientuser.go b/resource-manager/apimanagement/2023-03-01-preview/notificationrecipientuser/id_notificationrecipientuser.go index f4d087fa321..554584f6c15 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/notificationrecipientuser/id_notificationrecipientuser.go +++ b/resource-manager/apimanagement/2023-03-01-preview/notificationrecipientuser/id_notificationrecipientuser.go @@ -42,39 +42,9 @@ func ParseNotificationRecipientUserID(input string) (*NotificationRecipientUserI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NotificationRecipientUserId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) - } - - if v, ok := parsed.Parsed["notificationName"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationName", *parsed) - } - - notificationName, err := parseNotificationName(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.NotificationName = *notificationName - } - - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -89,42 +59,50 @@ func ParseNotificationRecipientUserIDInsensitively(input string) (*NotificationR return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NotificationRecipientUserId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *NotificationRecipientUserId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - if v, ok := parsed.Parsed["notificationName"]; true { + if v, ok := input.Parsed["notificationName"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationName", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "notificationName", input) } notificationName, err := parseNotificationName(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.NotificationName = *notificationName } - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if id.UserId, ok = input.Parsed["userId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userId", input) } - return &id, nil + return nil } // ValidateNotificationRecipientUserID checks that 'input' can be parsed as a Notification Recipient User ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/notificationrecipientuser/id_recipientuser.go b/resource-manager/apimanagement/2023-03-01-preview/notificationrecipientuser/id_recipientuser.go index ba60daeb64b..d5e2ce19d24 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/notificationrecipientuser/id_recipientuser.go +++ b/resource-manager/apimanagement/2023-03-01-preview/notificationrecipientuser/id_recipientuser.go @@ -40,35 +40,9 @@ func ParseRecipientUserID(input string) (*RecipientUserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecipientUserId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if v, ok := parsed.Parsed["notificationName"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationName", *parsed) - } - - notificationName, err := parseNotificationName(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.NotificationName = *notificationName - } - - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -83,38 +57,46 @@ func ParseRecipientUserIDInsensitively(input string) (*RecipientUserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecipientUserId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RecipientUserId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if v, ok := parsed.Parsed["notificationName"]; true { + if v, ok := input.Parsed["notificationName"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationName", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "notificationName", input) } notificationName, err := parseNotificationName(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.NotificationName = *notificationName } - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if id.UserId, ok = input.Parsed["userId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userId", input) } - return &id, nil + return nil } // ValidateRecipientUserID checks that 'input' can be parsed as a Recipient User ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/openidconnectprovider/id_openidconnectprovider.go b/resource-manager/apimanagement/2023-03-01-preview/openidconnectprovider/id_openidconnectprovider.go index 4c21b8383e0..6281797c5ed 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/openidconnectprovider/id_openidconnectprovider.go +++ b/resource-manager/apimanagement/2023-03-01-preview/openidconnectprovider/id_openidconnectprovider.go @@ -38,23 +38,9 @@ func ParseOpenidConnectProviderID(input string) (*OpenidConnectProviderId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OpenidConnectProviderId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.OpenidConnectProviderName, ok = parsed.Parsed["openidConnectProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openidConnectProviderName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseOpenidConnectProviderIDInsensitively(input string) (*OpenidConnectProv return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OpenidConnectProviderId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OpenidConnectProviderId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.OpenidConnectProviderName, ok = parsed.Parsed["openidConnectProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openidConnectProviderName", *parsed) + if id.OpenidConnectProviderName, ok = input.Parsed["openidConnectProviderName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "openidConnectProviderName", input) } - return &id, nil + return nil } // ValidateOpenidConnectProviderID checks that 'input' can be parsed as a Openid Connect Provider ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/openidconnectprovider/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/openidconnectprovider/id_service.go index 5c1589b4130..6011bac9dea 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/openidconnectprovider/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/openidconnectprovider/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/outboundnetworkdependenciesendpoints/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/outboundnetworkdependenciesendpoints/id_service.go index 632f1977756..fe94cec9540 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/outboundnetworkdependenciesendpoints/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/outboundnetworkdependenciesendpoints/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/performconnectivitycheck/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/performconnectivitycheck/id_service.go index 4825412ea3d..5ba3db30421 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/performconnectivitycheck/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/performconnectivitycheck/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/policy/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/policy/id_service.go index abd4ff17b68..a56cd4fcbd9 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/policy/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/policy/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/policydescription/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/policydescription/id_service.go index b98c923d87b..69e0fb3fc50 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/policydescription/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/policydescription/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/policyfragment/id_policyfragment.go b/resource-manager/apimanagement/2023-03-01-preview/policyfragment/id_policyfragment.go index 353ec0820e9..84038f6a5b5 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/policyfragment/id_policyfragment.go +++ b/resource-manager/apimanagement/2023-03-01-preview/policyfragment/id_policyfragment.go @@ -38,23 +38,9 @@ func ParsePolicyFragmentID(input string) (*PolicyFragmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PolicyFragmentId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.PolicyFragmentName, ok = parsed.Parsed["policyFragmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policyFragmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePolicyFragmentIDInsensitively(input string) (*PolicyFragmentId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PolicyFragmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PolicyFragmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.PolicyFragmentName, ok = parsed.Parsed["policyFragmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policyFragmentName", *parsed) + if id.PolicyFragmentName, ok = input.Parsed["policyFragmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "policyFragmentName", input) } - return &id, nil + return nil } // ValidatePolicyFragmentID checks that 'input' can be parsed as a Policy Fragment ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/policyfragment/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/policyfragment/id_service.go index e7865065dfb..3dd82cf7e72 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/policyfragment/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/policyfragment/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/policyfragment/id_workspace.go b/resource-manager/apimanagement/2023-03-01-preview/policyfragment/id_workspace.go index b8f9b98dcef..6d709a6ab2d 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/policyfragment/id_workspace.go +++ b/resource-manager/apimanagement/2023-03-01-preview/policyfragment/id_workspace.go @@ -38,23 +38,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WorkspaceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/policyfragment/id_workspacepolicyfragment.go b/resource-manager/apimanagement/2023-03-01-preview/policyfragment/id_workspacepolicyfragment.go index b6b9b466a22..0fbcf70ce63 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/policyfragment/id_workspacepolicyfragment.go +++ b/resource-manager/apimanagement/2023-03-01-preview/policyfragment/id_workspacepolicyfragment.go @@ -40,27 +40,9 @@ func ParseWorkspacePolicyFragmentID(input string) (*WorkspacePolicyFragmentId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspacePolicyFragmentId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) - } - - if id.PolicyFragmentName, ok = parsed.Parsed["policyFragmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policyFragmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseWorkspacePolicyFragmentIDInsensitively(input string) (*WorkspacePolicy return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspacePolicyFragmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *WorkspacePolicyFragmentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - if id.PolicyFragmentName, ok = parsed.Parsed["policyFragmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policyFragmentName", *parsed) + if id.PolicyFragmentName, ok = input.Parsed["policyFragmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "policyFragmentName", input) } - return &id, nil + return nil } // ValidateWorkspacePolicyFragmentID checks that 'input' can be parsed as a Workspace Policy Fragment ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/portalconfig/id_portalconfig.go b/resource-manager/apimanagement/2023-03-01-preview/portalconfig/id_portalconfig.go index 0ccfcf508c3..5bf077e2a3d 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/portalconfig/id_portalconfig.go +++ b/resource-manager/apimanagement/2023-03-01-preview/portalconfig/id_portalconfig.go @@ -38,23 +38,9 @@ func ParsePortalConfigID(input string) (*PortalConfigId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PortalConfigId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.PortalConfigId, ok = parsed.Parsed["portalConfigId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "portalConfigId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePortalConfigIDInsensitively(input string) (*PortalConfigId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PortalConfigId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PortalConfigId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.PortalConfigId, ok = parsed.Parsed["portalConfigId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "portalConfigId", *parsed) + if id.PortalConfigId, ok = input.Parsed["portalConfigId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "portalConfigId", input) } - return &id, nil + return nil } // ValidatePortalConfigID checks that 'input' can be parsed as a Portal Config ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/portalconfig/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/portalconfig/id_service.go index 3564b20fa9d..ff95f491c74 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/portalconfig/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/portalconfig/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/portalrevision/id_portalrevision.go b/resource-manager/apimanagement/2023-03-01-preview/portalrevision/id_portalrevision.go index 4d8f88e3d4d..036c4579efd 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/portalrevision/id_portalrevision.go +++ b/resource-manager/apimanagement/2023-03-01-preview/portalrevision/id_portalrevision.go @@ -38,23 +38,9 @@ func ParsePortalRevisionID(input string) (*PortalRevisionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PortalRevisionId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.PortalRevisionId, ok = parsed.Parsed["portalRevisionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "portalRevisionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePortalRevisionIDInsensitively(input string) (*PortalRevisionId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PortalRevisionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PortalRevisionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.PortalRevisionId, ok = parsed.Parsed["portalRevisionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "portalRevisionId", *parsed) + if id.PortalRevisionId, ok = input.Parsed["portalRevisionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "portalRevisionId", input) } - return &id, nil + return nil } // ValidatePortalRevisionID checks that 'input' can be parsed as a Portal Revision ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/portalrevision/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/portalrevision/id_service.go index 1144f19c377..e9329b7bd26 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/portalrevision/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/portalrevision/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/portalsettings/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/portalsettings/id_service.go index 1afbc255261..08c2e404b72 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/portalsettings/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/portalsettings/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/apimanagement/2023-03-01-preview/privateendpointconnections/id_privateendpointconnection.go index fde99d1b98f..1af5dc47cf0 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/apimanagement/2023-03-01-preview/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/privateendpointconnections/id_privatelinkresource.go b/resource-manager/apimanagement/2023-03-01-preview/privateendpointconnections/id_privatelinkresource.go index 3308d3eb863..517deab7731 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/privateendpointconnections/id_privatelinkresource.go +++ b/resource-manager/apimanagement/2023-03-01-preview/privateendpointconnections/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/privateendpointconnections/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/privateendpointconnections/id_service.go index 38c6b0f9c6a..38852b1d31d 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/privateendpointconnections/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/privateendpointconnections/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/product/id_product.go b/resource-manager/apimanagement/2023-03-01-preview/product/id_product.go index 68fc58b3c0c..c7625d1d9ac 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/product/id_product.go +++ b/resource-manager/apimanagement/2023-03-01-preview/product/id_product.go @@ -38,23 +38,9 @@ func ParseProductID(input string) (*ProductId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProductIDInsensitively(input string) (*ProductId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProductId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if id.ProductId, ok = input.Parsed["productId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "productId", input) } - return &id, nil + return nil } // ValidateProductID checks that 'input' can be parsed as a Product ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/product/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/product/id_service.go index 453a38674d7..90ce39c0b6e 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/product/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/product/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/product/id_workspace.go b/resource-manager/apimanagement/2023-03-01-preview/product/id_workspace.go index 9e20b46f360..4440d5d78aa 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/product/id_workspace.go +++ b/resource-manager/apimanagement/2023-03-01-preview/product/id_workspace.go @@ -38,23 +38,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WorkspaceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/product/id_workspaceproduct.go b/resource-manager/apimanagement/2023-03-01-preview/product/id_workspaceproduct.go index 18306ead97b..b9d0c10c3f3 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/product/id_workspaceproduct.go +++ b/resource-manager/apimanagement/2023-03-01-preview/product/id_workspaceproduct.go @@ -40,27 +40,9 @@ func ParseWorkspaceProductID(input string) (*WorkspaceProductId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceProductId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) - } - - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseWorkspaceProductIDInsensitively(input string) (*WorkspaceProductId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceProductId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *WorkspaceProductId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if id.ProductId, ok = input.Parsed["productId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "productId", input) } - return &id, nil + return nil } // ValidateWorkspaceProductID checks that 'input' can be parsed as a Workspace Product ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/productapi/id_product.go b/resource-manager/apimanagement/2023-03-01-preview/productapi/id_product.go index ab13414a812..12e7e9f3173 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/productapi/id_product.go +++ b/resource-manager/apimanagement/2023-03-01-preview/productapi/id_product.go @@ -38,23 +38,9 @@ func ParseProductID(input string) (*ProductId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProductIDInsensitively(input string) (*ProductId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProductId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if id.ProductId, ok = input.Parsed["productId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "productId", input) } - return &id, nil + return nil } // ValidateProductID checks that 'input' can be parsed as a Product ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/productapi/id_productapi.go b/resource-manager/apimanagement/2023-03-01-preview/productapi/id_productapi.go index 241d1d4221d..1b0829c762a 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/productapi/id_productapi.go +++ b/resource-manager/apimanagement/2023-03-01-preview/productapi/id_productapi.go @@ -40,27 +40,9 @@ func ParseProductApiID(input string) (*ProductApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductApiId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseProductApiIDInsensitively(input string) (*ProductApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ProductApiId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if id.ProductId, ok = input.Parsed["productId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "productId", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateProductApiID checks that 'input' can be parsed as a Product Api ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/productapilink/id_product.go b/resource-manager/apimanagement/2023-03-01-preview/productapilink/id_product.go index 6859b94186a..1f7bdd8de2e 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/productapilink/id_product.go +++ b/resource-manager/apimanagement/2023-03-01-preview/productapilink/id_product.go @@ -38,23 +38,9 @@ func ParseProductID(input string) (*ProductId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProductIDInsensitively(input string) (*ProductId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProductId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if id.ProductId, ok = input.Parsed["productId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "productId", input) } - return &id, nil + return nil } // ValidateProductID checks that 'input' can be parsed as a Product ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/productapilink/id_productapilink.go b/resource-manager/apimanagement/2023-03-01-preview/productapilink/id_productapilink.go index d66114d0873..6116c07e1bd 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/productapilink/id_productapilink.go +++ b/resource-manager/apimanagement/2023-03-01-preview/productapilink/id_productapilink.go @@ -40,27 +40,9 @@ func ParseProductApiLinkID(input string) (*ProductApiLinkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductApiLinkId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) - } - - if id.ApiLinkId, ok = parsed.Parsed["apiLinkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiLinkId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseProductApiLinkIDInsensitively(input string) (*ProductApiLinkId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductApiLinkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ProductApiLinkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if id.ProductId, ok = input.Parsed["productId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "productId", input) } - if id.ApiLinkId, ok = parsed.Parsed["apiLinkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiLinkId", *parsed) + if id.ApiLinkId, ok = input.Parsed["apiLinkId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiLinkId", input) } - return &id, nil + return nil } // ValidateProductApiLinkID checks that 'input' can be parsed as a Product Api Link ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/productapilink/id_workspaceproduct.go b/resource-manager/apimanagement/2023-03-01-preview/productapilink/id_workspaceproduct.go index 34a1bac591a..4c8d57addf5 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/productapilink/id_workspaceproduct.go +++ b/resource-manager/apimanagement/2023-03-01-preview/productapilink/id_workspaceproduct.go @@ -40,27 +40,9 @@ func ParseWorkspaceProductID(input string) (*WorkspaceProductId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceProductId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) - } - - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseWorkspaceProductIDInsensitively(input string) (*WorkspaceProductId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceProductId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *WorkspaceProductId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if id.ProductId, ok = input.Parsed["productId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "productId", input) } - return &id, nil + return nil } // ValidateWorkspaceProductID checks that 'input' can be parsed as a Workspace Product ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/productapilink/id_workspaceproductapilink.go b/resource-manager/apimanagement/2023-03-01-preview/productapilink/id_workspaceproductapilink.go index ff07c6241fe..37a30c00f56 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/productapilink/id_workspaceproductapilink.go +++ b/resource-manager/apimanagement/2023-03-01-preview/productapilink/id_workspaceproductapilink.go @@ -42,31 +42,9 @@ func ParseWorkspaceProductApiLinkID(input string) (*WorkspaceProductApiLinkId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceProductApiLinkId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) - } - - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) - } - - if id.ApiLinkId, ok = parsed.Parsed["apiLinkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiLinkId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseWorkspaceProductApiLinkIDInsensitively(input string) (*WorkspaceProduc return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceProductApiLinkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceProductApiLinkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if id.ProductId, ok = input.Parsed["productId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "productId", input) } - if id.ApiLinkId, ok = parsed.Parsed["apiLinkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiLinkId", *parsed) + if id.ApiLinkId, ok = input.Parsed["apiLinkId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiLinkId", input) } - return &id, nil + return nil } // ValidateWorkspaceProductApiLinkID checks that 'input' can be parsed as a Workspace Product Api Link ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/productgroup/id_product.go b/resource-manager/apimanagement/2023-03-01-preview/productgroup/id_product.go index 78d1bbc0028..9da605f113d 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/productgroup/id_product.go +++ b/resource-manager/apimanagement/2023-03-01-preview/productgroup/id_product.go @@ -38,23 +38,9 @@ func ParseProductID(input string) (*ProductId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProductIDInsensitively(input string) (*ProductId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProductId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if id.ProductId, ok = input.Parsed["productId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "productId", input) } - return &id, nil + return nil } // ValidateProductID checks that 'input' can be parsed as a Product ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/productgroup/id_productgroup.go b/resource-manager/apimanagement/2023-03-01-preview/productgroup/id_productgroup.go index 3da15ed373b..a38f7d26fa3 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/productgroup/id_productgroup.go +++ b/resource-manager/apimanagement/2023-03-01-preview/productgroup/id_productgroup.go @@ -40,27 +40,9 @@ func ParseProductGroupID(input string) (*ProductGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductGroupId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) - } - - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseProductGroupIDInsensitively(input string) (*ProductGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ProductGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if id.ProductId, ok = input.Parsed["productId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "productId", input) } - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + if id.GroupId, ok = input.Parsed["groupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "groupId", input) } - return &id, nil + return nil } // ValidateProductGroupID checks that 'input' can be parsed as a Product Group ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/productgrouplink/id_grouplink.go b/resource-manager/apimanagement/2023-03-01-preview/productgrouplink/id_grouplink.go index 742758e378f..5c2b5966aa7 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/productgrouplink/id_grouplink.go +++ b/resource-manager/apimanagement/2023-03-01-preview/productgrouplink/id_grouplink.go @@ -40,27 +40,9 @@ func ParseGroupLinkID(input string) (*GroupLinkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GroupLinkId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) - } - - if id.GroupLinkId, ok = parsed.Parsed["groupLinkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupLinkId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseGroupLinkIDInsensitively(input string) (*GroupLinkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GroupLinkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *GroupLinkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if id.ProductId, ok = input.Parsed["productId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "productId", input) } - if id.GroupLinkId, ok = parsed.Parsed["groupLinkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupLinkId", *parsed) + if id.GroupLinkId, ok = input.Parsed["groupLinkId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "groupLinkId", input) } - return &id, nil + return nil } // ValidateGroupLinkID checks that 'input' can be parsed as a Group Link ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/productgrouplink/id_product.go b/resource-manager/apimanagement/2023-03-01-preview/productgrouplink/id_product.go index a5a435b9b71..78003fea319 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/productgrouplink/id_product.go +++ b/resource-manager/apimanagement/2023-03-01-preview/productgrouplink/id_product.go @@ -38,23 +38,9 @@ func ParseProductID(input string) (*ProductId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProductIDInsensitively(input string) (*ProductId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProductId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if id.ProductId, ok = input.Parsed["productId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "productId", input) } - return &id, nil + return nil } // ValidateProductID checks that 'input' can be parsed as a Product ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/productgrouplink/id_productgrouplink.go b/resource-manager/apimanagement/2023-03-01-preview/productgrouplink/id_productgrouplink.go index 38b1b8dcd23..f73ba1185f9 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/productgrouplink/id_productgrouplink.go +++ b/resource-manager/apimanagement/2023-03-01-preview/productgrouplink/id_productgrouplink.go @@ -42,31 +42,9 @@ func ParseProductGroupLinkID(input string) (*ProductGroupLinkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductGroupLinkId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) - } - - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) - } - - if id.GroupLinkId, ok = parsed.Parsed["groupLinkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupLinkId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseProductGroupLinkIDInsensitively(input string) (*ProductGroupLinkId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductGroupLinkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProductGroupLinkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if id.ProductId, ok = input.Parsed["productId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "productId", input) } - if id.GroupLinkId, ok = parsed.Parsed["groupLinkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupLinkId", *parsed) + if id.GroupLinkId, ok = input.Parsed["groupLinkId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "groupLinkId", input) } - return &id, nil + return nil } // ValidateProductGroupLinkID checks that 'input' can be parsed as a Product Group Link ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/productgrouplink/id_workspaceproduct.go b/resource-manager/apimanagement/2023-03-01-preview/productgrouplink/id_workspaceproduct.go index 0c41e851bed..5f0172a7551 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/productgrouplink/id_workspaceproduct.go +++ b/resource-manager/apimanagement/2023-03-01-preview/productgrouplink/id_workspaceproduct.go @@ -40,27 +40,9 @@ func ParseWorkspaceProductID(input string) (*WorkspaceProductId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceProductId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) - } - - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseWorkspaceProductIDInsensitively(input string) (*WorkspaceProductId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceProductId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *WorkspaceProductId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if id.ProductId, ok = input.Parsed["productId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "productId", input) } - return &id, nil + return nil } // ValidateWorkspaceProductID checks that 'input' can be parsed as a Workspace Product ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/productpolicy/id_product.go b/resource-manager/apimanagement/2023-03-01-preview/productpolicy/id_product.go index 9698867e813..4baef506e98 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/productpolicy/id_product.go +++ b/resource-manager/apimanagement/2023-03-01-preview/productpolicy/id_product.go @@ -38,23 +38,9 @@ func ParseProductID(input string) (*ProductId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProductIDInsensitively(input string) (*ProductId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProductId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if id.ProductId, ok = input.Parsed["productId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "productId", input) } - return &id, nil + return nil } // ValidateProductID checks that 'input' can be parsed as a Product ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/productpolicy/id_workspaceproduct.go b/resource-manager/apimanagement/2023-03-01-preview/productpolicy/id_workspaceproduct.go index 62b62efc0ea..6588f2c0ff6 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/productpolicy/id_workspaceproduct.go +++ b/resource-manager/apimanagement/2023-03-01-preview/productpolicy/id_workspaceproduct.go @@ -40,27 +40,9 @@ func ParseWorkspaceProductID(input string) (*WorkspaceProductId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceProductId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) - } - - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseWorkspaceProductIDInsensitively(input string) (*WorkspaceProductId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceProductId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *WorkspaceProductId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if id.ProductId, ok = input.Parsed["productId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "productId", input) } - return &id, nil + return nil } // ValidateWorkspaceProductID checks that 'input' can be parsed as a Workspace Product ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/productsbytag/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/productsbytag/id_service.go index 9cc5fba20d5..dab0313cbb3 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/productsbytag/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/productsbytag/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/productsubscription/id_product.go b/resource-manager/apimanagement/2023-03-01-preview/productsubscription/id_product.go index 34d6c9e3c5c..0770ff03e50 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/productsubscription/id_product.go +++ b/resource-manager/apimanagement/2023-03-01-preview/productsubscription/id_product.go @@ -38,23 +38,9 @@ func ParseProductID(input string) (*ProductId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProductIDInsensitively(input string) (*ProductId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProductId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if id.ProductId, ok = input.Parsed["productId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "productId", input) } - return &id, nil + return nil } // ValidateProductID checks that 'input' can be parsed as a Product ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/producttag/id_product.go b/resource-manager/apimanagement/2023-03-01-preview/producttag/id_product.go index 0e8b83b03ef..01560e368e2 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/producttag/id_product.go +++ b/resource-manager/apimanagement/2023-03-01-preview/producttag/id_product.go @@ -38,23 +38,9 @@ func ParseProductID(input string) (*ProductId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProductIDInsensitively(input string) (*ProductId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProductId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if id.ProductId, ok = input.Parsed["productId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "productId", input) } - return &id, nil + return nil } // ValidateProductID checks that 'input' can be parsed as a Product ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/producttag/id_producttag.go b/resource-manager/apimanagement/2023-03-01-preview/producttag/id_producttag.go index ee2cbe499a3..95ba1801059 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/producttag/id_producttag.go +++ b/resource-manager/apimanagement/2023-03-01-preview/producttag/id_producttag.go @@ -40,27 +40,9 @@ func ParseProductTagID(input string) (*ProductTagId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductTagId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) - } - - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseProductTagIDInsensitively(input string) (*ProductTagId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductTagId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ProductTagId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if id.ProductId, ok = input.Parsed["productId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "productId", input) } - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + if id.TagId, ok = input.Parsed["tagId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tagId", input) } - return &id, nil + return nil } // ValidateProductTagID checks that 'input' can be parsed as a Product Tag ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/productwiki/id_product.go b/resource-manager/apimanagement/2023-03-01-preview/productwiki/id_product.go index d0e1fabaa5f..a88f5200335 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/productwiki/id_product.go +++ b/resource-manager/apimanagement/2023-03-01-preview/productwiki/id_product.go @@ -38,23 +38,9 @@ func ParseProductID(input string) (*ProductId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProductIDInsensitively(input string) (*ProductId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProductId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProductId, ok = parsed.Parsed["productId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productId", *parsed) + if id.ProductId, ok = input.Parsed["productId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "productId", input) } - return &id, nil + return nil } // ValidateProductID checks that 'input' can be parsed as a Product ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/quotabycounterkeys/id_quota.go b/resource-manager/apimanagement/2023-03-01-preview/quotabycounterkeys/id_quota.go index bd09f03849c..1bcee82145a 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/quotabycounterkeys/id_quota.go +++ b/resource-manager/apimanagement/2023-03-01-preview/quotabycounterkeys/id_quota.go @@ -38,23 +38,9 @@ func ParseQuotaID(input string) (*QuotaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QuotaId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.QuotaCounterKey, ok = parsed.Parsed["quotaCounterKey"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "quotaCounterKey", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseQuotaIDInsensitively(input string) (*QuotaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QuotaId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *QuotaId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.QuotaCounterKey, ok = parsed.Parsed["quotaCounterKey"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "quotaCounterKey", *parsed) + if id.QuotaCounterKey, ok = input.Parsed["quotaCounterKey"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "quotaCounterKey", input) } - return &id, nil + return nil } // ValidateQuotaID checks that 'input' can be parsed as a Quota ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/quotabyperiodkeys/id_period.go b/resource-manager/apimanagement/2023-03-01-preview/quotabyperiodkeys/id_period.go index 51021a40cb2..457997a1f73 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/quotabyperiodkeys/id_period.go +++ b/resource-manager/apimanagement/2023-03-01-preview/quotabyperiodkeys/id_period.go @@ -40,27 +40,9 @@ func ParsePeriodID(input string) (*PeriodId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PeriodId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.QuotaCounterKey, ok = parsed.Parsed["quotaCounterKey"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "quotaCounterKey", *parsed) - } - - if id.QuotaPeriodKey, ok = parsed.Parsed["quotaPeriodKey"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "quotaPeriodKey", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParsePeriodIDInsensitively(input string) (*PeriodId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PeriodId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *PeriodId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.QuotaCounterKey, ok = parsed.Parsed["quotaCounterKey"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "quotaCounterKey", *parsed) + if id.QuotaCounterKey, ok = input.Parsed["quotaCounterKey"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "quotaCounterKey", input) } - if id.QuotaPeriodKey, ok = parsed.Parsed["quotaPeriodKey"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "quotaPeriodKey", *parsed) + if id.QuotaPeriodKey, ok = input.Parsed["quotaPeriodKey"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "quotaPeriodKey", input) } - return &id, nil + return nil } // ValidatePeriodID checks that 'input' can be parsed as a Period ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/region/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/region/id_service.go index 28d0c9708d4..102d605acb5 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/region/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/region/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/reports/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/reports/id_service.go index c86c2b26f93..2520584b82d 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/reports/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/reports/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/schema/id_schema.go b/resource-manager/apimanagement/2023-03-01-preview/schema/id_schema.go index 7454f30fe60..57f9ebb23c5 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/schema/id_schema.go +++ b/resource-manager/apimanagement/2023-03-01-preview/schema/id_schema.go @@ -38,23 +38,9 @@ func ParseSchemaID(input string) (*SchemaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SchemaId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.SchemaId, ok = parsed.Parsed["schemaId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSchemaIDInsensitively(input string) (*SchemaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SchemaId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SchemaId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.SchemaId, ok = parsed.Parsed["schemaId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaId", *parsed) + if id.SchemaId, ok = input.Parsed["schemaId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "schemaId", input) } - return &id, nil + return nil } // ValidateSchemaID checks that 'input' can be parsed as a Schema ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/schema/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/schema/id_service.go index 2425e5c9127..d35dcd2431c 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/schema/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/schema/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/schema/id_workspace.go b/resource-manager/apimanagement/2023-03-01-preview/schema/id_workspace.go index 31444975c99..9f95b8b0244 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/schema/id_workspace.go +++ b/resource-manager/apimanagement/2023-03-01-preview/schema/id_workspace.go @@ -38,23 +38,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WorkspaceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/schema/id_workspaceschema.go b/resource-manager/apimanagement/2023-03-01-preview/schema/id_workspaceschema.go index d980bbf84e0..4ed34d6c13f 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/schema/id_workspaceschema.go +++ b/resource-manager/apimanagement/2023-03-01-preview/schema/id_workspaceschema.go @@ -40,27 +40,9 @@ func ParseWorkspaceSchemaID(input string) (*WorkspaceSchemaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceSchemaId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) - } - - if id.SchemaId, ok = parsed.Parsed["schemaId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseWorkspaceSchemaIDInsensitively(input string) (*WorkspaceSchemaId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceSchemaId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *WorkspaceSchemaId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - if id.SchemaId, ok = parsed.Parsed["schemaId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaId", *parsed) + if id.SchemaId, ok = input.Parsed["schemaId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "schemaId", input) } - return &id, nil + return nil } // ValidateWorkspaceSchemaID checks that 'input' can be parsed as a Workspace Schema ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/signinsettings/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/signinsettings/id_service.go index 91fdf5b67b1..d449f2a8d38 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/signinsettings/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/signinsettings/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/signupsettings/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/signupsettings/id_service.go index 5d9bd0a0c2f..f3787b73b81 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/signupsettings/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/signupsettings/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/subscription/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/subscription/id_service.go index ec7f310e3df..93b509f052e 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/subscription/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/subscription/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/subscription/id_subscriptions2.go b/resource-manager/apimanagement/2023-03-01-preview/subscription/id_subscriptions2.go index baa1f57e1f6..f8b33d545ce 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/subscription/id_subscriptions2.go +++ b/resource-manager/apimanagement/2023-03-01-preview/subscription/id_subscriptions2.go @@ -38,23 +38,9 @@ func ParseSubscriptions2ID(input string) (*Subscriptions2Id, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Subscriptions2Id{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSubscriptions2IDInsensitively(input string) (*Subscriptions2Id, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Subscriptions2Id{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *Subscriptions2Id) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", *parsed) + if id.SubscriptionName, ok = input.Parsed["subscriptionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", input) } - return &id, nil + return nil } // ValidateSubscriptions2ID checks that 'input' can be parsed as a Subscriptions 2 ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/subscription/id_usersubscriptions2.go b/resource-manager/apimanagement/2023-03-01-preview/subscription/id_usersubscriptions2.go index ccc3bc6c72a..9c5f6ce11d0 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/subscription/id_usersubscriptions2.go +++ b/resource-manager/apimanagement/2023-03-01-preview/subscription/id_usersubscriptions2.go @@ -40,27 +40,9 @@ func ParseUserSubscriptions2ID(input string) (*UserSubscriptions2Id, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserSubscriptions2Id{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) - } - - if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseUserSubscriptions2IDInsensitively(input string) (*UserSubscriptions2Id return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserSubscriptions2Id{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *UserSubscriptions2Id) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if id.UserId, ok = input.Parsed["userId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userId", input) } - if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", *parsed) + if id.SubscriptionName, ok = input.Parsed["subscriptionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", input) } - return &id, nil + return nil } // ValidateUserSubscriptions2ID checks that 'input' can be parsed as a User Subscriptions 2 ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/subscription/id_workspace.go b/resource-manager/apimanagement/2023-03-01-preview/subscription/id_workspace.go index 346bcf34fb8..33a75c92a43 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/subscription/id_workspace.go +++ b/resource-manager/apimanagement/2023-03-01-preview/subscription/id_workspace.go @@ -38,23 +38,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WorkspaceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/subscription/id_workspacesubscriptions2.go b/resource-manager/apimanagement/2023-03-01-preview/subscription/id_workspacesubscriptions2.go index c29870d1649..b5bdbb879d4 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/subscription/id_workspacesubscriptions2.go +++ b/resource-manager/apimanagement/2023-03-01-preview/subscription/id_workspacesubscriptions2.go @@ -40,27 +40,9 @@ func ParseWorkspaceSubscriptions2ID(input string) (*WorkspaceSubscriptions2Id, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceSubscriptions2Id{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) - } - - if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseWorkspaceSubscriptions2IDInsensitively(input string) (*WorkspaceSubscr return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceSubscriptions2Id{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *WorkspaceSubscriptions2Id) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", *parsed) + if id.SubscriptionName, ok = input.Parsed["subscriptionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", input) } - return &id, nil + return nil } // ValidateWorkspaceSubscriptions2ID checks that 'input' can be parsed as a Workspace Subscriptions 2 ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/tag/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/tag/id_service.go index 05b834b495e..4571408724d 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/tag/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/tag/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/tag/id_tag.go b/resource-manager/apimanagement/2023-03-01-preview/tag/id_tag.go index 2f3b0e3027e..e5da01efc69 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/tag/id_tag.go +++ b/resource-manager/apimanagement/2023-03-01-preview/tag/id_tag.go @@ -38,23 +38,9 @@ func ParseTagID(input string) (*TagId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TagId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTagIDInsensitively(input string) (*TagId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TagId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TagId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + if id.TagId, ok = input.Parsed["tagId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tagId", input) } - return &id, nil + return nil } // ValidateTagID checks that 'input' can be parsed as a Tag ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/tag/id_workspace.go b/resource-manager/apimanagement/2023-03-01-preview/tag/id_workspace.go index 15041bd7f1d..bc540576340 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/tag/id_workspace.go +++ b/resource-manager/apimanagement/2023-03-01-preview/tag/id_workspace.go @@ -38,23 +38,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WorkspaceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/tag/id_workspacetag.go b/resource-manager/apimanagement/2023-03-01-preview/tag/id_workspacetag.go index 2fe11b0bc15..58914e837b5 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/tag/id_workspacetag.go +++ b/resource-manager/apimanagement/2023-03-01-preview/tag/id_workspacetag.go @@ -40,27 +40,9 @@ func ParseWorkspaceTagID(input string) (*WorkspaceTagId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceTagId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) - } - - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseWorkspaceTagIDInsensitively(input string) (*WorkspaceTagId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceTagId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *WorkspaceTagId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + if id.TagId, ok = input.Parsed["tagId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tagId", input) } - return &id, nil + return nil } // ValidateWorkspaceTagID checks that 'input' can be parsed as a Workspace Tag ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/tagapilink/id_apilink.go b/resource-manager/apimanagement/2023-03-01-preview/tagapilink/id_apilink.go index 48c3fea2c21..f2c80c1dce2 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/tagapilink/id_apilink.go +++ b/resource-manager/apimanagement/2023-03-01-preview/tagapilink/id_apilink.go @@ -40,27 +40,9 @@ func ParseApiLinkID(input string) (*ApiLinkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiLinkId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) - } - - if id.ApiLinkId, ok = parsed.Parsed["apiLinkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiLinkId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseApiLinkIDInsensitively(input string) (*ApiLinkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiLinkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ApiLinkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + if id.TagId, ok = input.Parsed["tagId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tagId", input) } - if id.ApiLinkId, ok = parsed.Parsed["apiLinkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiLinkId", *parsed) + if id.ApiLinkId, ok = input.Parsed["apiLinkId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiLinkId", input) } - return &id, nil + return nil } // ValidateApiLinkID checks that 'input' can be parsed as a Api Link ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/tagapilink/id_tag.go b/resource-manager/apimanagement/2023-03-01-preview/tagapilink/id_tag.go index ff41f67d2ee..1fe926acec7 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/tagapilink/id_tag.go +++ b/resource-manager/apimanagement/2023-03-01-preview/tagapilink/id_tag.go @@ -38,23 +38,9 @@ func ParseTagID(input string) (*TagId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TagId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTagIDInsensitively(input string) (*TagId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TagId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TagId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + if id.TagId, ok = input.Parsed["tagId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tagId", input) } - return &id, nil + return nil } // ValidateTagID checks that 'input' can be parsed as a Tag ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/tagapilink/id_tagapilink.go b/resource-manager/apimanagement/2023-03-01-preview/tagapilink/id_tagapilink.go index f80e325abbc..c2f269aeefe 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/tagapilink/id_tagapilink.go +++ b/resource-manager/apimanagement/2023-03-01-preview/tagapilink/id_tagapilink.go @@ -42,31 +42,9 @@ func ParseTagApiLinkID(input string) (*TagApiLinkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TagApiLinkId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) - } - - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) - } - - if id.ApiLinkId, ok = parsed.Parsed["apiLinkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiLinkId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseTagApiLinkIDInsensitively(input string) (*TagApiLinkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TagApiLinkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *TagApiLinkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + if id.TagId, ok = input.Parsed["tagId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tagId", input) } - if id.ApiLinkId, ok = parsed.Parsed["apiLinkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiLinkId", *parsed) + if id.ApiLinkId, ok = input.Parsed["apiLinkId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiLinkId", input) } - return &id, nil + return nil } // ValidateTagApiLinkID checks that 'input' can be parsed as a Tag Api Link ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/tagapilink/id_workspacetag.go b/resource-manager/apimanagement/2023-03-01-preview/tagapilink/id_workspacetag.go index 00ffaa6c005..b69fb658365 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/tagapilink/id_workspacetag.go +++ b/resource-manager/apimanagement/2023-03-01-preview/tagapilink/id_workspacetag.go @@ -40,27 +40,9 @@ func ParseWorkspaceTagID(input string) (*WorkspaceTagId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceTagId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) - } - - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseWorkspaceTagIDInsensitively(input string) (*WorkspaceTagId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceTagId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *WorkspaceTagId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + if id.TagId, ok = input.Parsed["tagId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tagId", input) } - return &id, nil + return nil } // ValidateWorkspaceTagID checks that 'input' can be parsed as a Workspace Tag ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/tagoperationlink/id_operationlink.go b/resource-manager/apimanagement/2023-03-01-preview/tagoperationlink/id_operationlink.go index 155acf008f1..6ff1a861a3d 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/tagoperationlink/id_operationlink.go +++ b/resource-manager/apimanagement/2023-03-01-preview/tagoperationlink/id_operationlink.go @@ -40,27 +40,9 @@ func ParseOperationLinkID(input string) (*OperationLinkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationLinkId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) - } - - if id.OperationLinkId, ok = parsed.Parsed["operationLinkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationLinkId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseOperationLinkIDInsensitively(input string) (*OperationLinkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationLinkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *OperationLinkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + if id.TagId, ok = input.Parsed["tagId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tagId", input) } - if id.OperationLinkId, ok = parsed.Parsed["operationLinkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationLinkId", *parsed) + if id.OperationLinkId, ok = input.Parsed["operationLinkId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "operationLinkId", input) } - return &id, nil + return nil } // ValidateOperationLinkID checks that 'input' can be parsed as a Operation Link ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/tagoperationlink/id_tag.go b/resource-manager/apimanagement/2023-03-01-preview/tagoperationlink/id_tag.go index 0da97592b31..7effa795bd6 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/tagoperationlink/id_tag.go +++ b/resource-manager/apimanagement/2023-03-01-preview/tagoperationlink/id_tag.go @@ -38,23 +38,9 @@ func ParseTagID(input string) (*TagId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TagId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTagIDInsensitively(input string) (*TagId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TagId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TagId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + if id.TagId, ok = input.Parsed["tagId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tagId", input) } - return &id, nil + return nil } // ValidateTagID checks that 'input' can be parsed as a Tag ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/tagoperationlink/id_tagoperationlink.go b/resource-manager/apimanagement/2023-03-01-preview/tagoperationlink/id_tagoperationlink.go index 3e06fc4b07c..e97f1eeedae 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/tagoperationlink/id_tagoperationlink.go +++ b/resource-manager/apimanagement/2023-03-01-preview/tagoperationlink/id_tagoperationlink.go @@ -42,31 +42,9 @@ func ParseTagOperationLinkID(input string) (*TagOperationLinkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TagOperationLinkId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) - } - - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) - } - - if id.OperationLinkId, ok = parsed.Parsed["operationLinkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationLinkId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseTagOperationLinkIDInsensitively(input string) (*TagOperationLinkId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TagOperationLinkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *TagOperationLinkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + if id.TagId, ok = input.Parsed["tagId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tagId", input) } - if id.OperationLinkId, ok = parsed.Parsed["operationLinkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationLinkId", *parsed) + if id.OperationLinkId, ok = input.Parsed["operationLinkId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "operationLinkId", input) } - return &id, nil + return nil } // ValidateTagOperationLinkID checks that 'input' can be parsed as a Tag Operation Link ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/tagoperationlink/id_workspacetag.go b/resource-manager/apimanagement/2023-03-01-preview/tagoperationlink/id_workspacetag.go index ac10815f1e6..41b7c3dbcc0 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/tagoperationlink/id_workspacetag.go +++ b/resource-manager/apimanagement/2023-03-01-preview/tagoperationlink/id_workspacetag.go @@ -40,27 +40,9 @@ func ParseWorkspaceTagID(input string) (*WorkspaceTagId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceTagId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) - } - - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseWorkspaceTagIDInsensitively(input string) (*WorkspaceTagId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceTagId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *WorkspaceTagId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + if id.TagId, ok = input.Parsed["tagId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tagId", input) } - return &id, nil + return nil } // ValidateWorkspaceTagID checks that 'input' can be parsed as a Workspace Tag ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/tagproductlink/id_productlink.go b/resource-manager/apimanagement/2023-03-01-preview/tagproductlink/id_productlink.go index e047386268d..94ad97f05ff 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/tagproductlink/id_productlink.go +++ b/resource-manager/apimanagement/2023-03-01-preview/tagproductlink/id_productlink.go @@ -40,27 +40,9 @@ func ParseProductLinkID(input string) (*ProductLinkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductLinkId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) - } - - if id.ProductLinkId, ok = parsed.Parsed["productLinkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productLinkId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseProductLinkIDInsensitively(input string) (*ProductLinkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProductLinkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ProductLinkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + if id.TagId, ok = input.Parsed["tagId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tagId", input) } - if id.ProductLinkId, ok = parsed.Parsed["productLinkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productLinkId", *parsed) + if id.ProductLinkId, ok = input.Parsed["productLinkId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "productLinkId", input) } - return &id, nil + return nil } // ValidateProductLinkID checks that 'input' can be parsed as a Product Link ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/tagproductlink/id_tag.go b/resource-manager/apimanagement/2023-03-01-preview/tagproductlink/id_tag.go index fa76485841b..981b1dd3b72 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/tagproductlink/id_tag.go +++ b/resource-manager/apimanagement/2023-03-01-preview/tagproductlink/id_tag.go @@ -38,23 +38,9 @@ func ParseTagID(input string) (*TagId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TagId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTagIDInsensitively(input string) (*TagId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TagId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TagId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + if id.TagId, ok = input.Parsed["tagId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tagId", input) } - return &id, nil + return nil } // ValidateTagID checks that 'input' can be parsed as a Tag ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/tagproductlink/id_tagproductlink.go b/resource-manager/apimanagement/2023-03-01-preview/tagproductlink/id_tagproductlink.go index af79d439fcb..813753f06ea 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/tagproductlink/id_tagproductlink.go +++ b/resource-manager/apimanagement/2023-03-01-preview/tagproductlink/id_tagproductlink.go @@ -42,31 +42,9 @@ func ParseTagProductLinkID(input string) (*TagProductLinkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TagProductLinkId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) - } - - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) - } - - if id.ProductLinkId, ok = parsed.Parsed["productLinkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productLinkId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseTagProductLinkIDInsensitively(input string) (*TagProductLinkId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TagProductLinkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *TagProductLinkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + if id.TagId, ok = input.Parsed["tagId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tagId", input) } - if id.ProductLinkId, ok = parsed.Parsed["productLinkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "productLinkId", *parsed) + if id.ProductLinkId, ok = input.Parsed["productLinkId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "productLinkId", input) } - return &id, nil + return nil } // ValidateTagProductLinkID checks that 'input' can be parsed as a Tag Product Link ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/tagproductlink/id_workspacetag.go b/resource-manager/apimanagement/2023-03-01-preview/tagproductlink/id_workspacetag.go index d0676c0993c..e00425256af 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/tagproductlink/id_workspacetag.go +++ b/resource-manager/apimanagement/2023-03-01-preview/tagproductlink/id_workspacetag.go @@ -40,27 +40,9 @@ func ParseWorkspaceTagID(input string) (*WorkspaceTagId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceTagId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) - } - - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseWorkspaceTagIDInsensitively(input string) (*WorkspaceTagId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceTagId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *WorkspaceTagId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - if id.TagId, ok = parsed.Parsed["tagId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagId", *parsed) + if id.TagId, ok = input.Parsed["tagId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tagId", input) } - return &id, nil + return nil } // ValidateWorkspaceTagID checks that 'input' can be parsed as a Workspace Tag ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/tagresource/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/tagresource/id_service.go index 0ed54c64158..8467201490c 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/tagresource/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/tagresource/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/tenantaccess/id_access.go b/resource-manager/apimanagement/2023-03-01-preview/tenantaccess/id_access.go index f65bd39036b..c1088880ff5 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/tenantaccess/id_access.go +++ b/resource-manager/apimanagement/2023-03-01-preview/tenantaccess/id_access.go @@ -38,31 +38,9 @@ func ParseAccessID(input string) (*AccessId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccessId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if v, ok := parsed.Parsed["accessName"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accessName", *parsed) - } - - accessName, err := parseAccessIdName(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.AccessName = *accessName + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -77,34 +55,42 @@ func ParseAccessIDInsensitively(input string) (*AccessId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccessId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *AccessId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if v, ok := parsed.Parsed["accessName"]; true { + if v, ok := input.Parsed["accessName"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accessName", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "accessName", input) } accessName, err := parseAccessIdName(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.AccessName = *accessName } - return &id, nil + return nil } // ValidateAccessID checks that 'input' can be parsed as a Access ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/tenantaccess/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/tenantaccess/id_service.go index 3a5122d04c9..eb27c6a8e00 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/tenantaccess/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/tenantaccess/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/tenantaccessgit/id_access.go b/resource-manager/apimanagement/2023-03-01-preview/tenantaccessgit/id_access.go index 2ba9d0cf84e..1b8f7cf9a5b 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/tenantaccessgit/id_access.go +++ b/resource-manager/apimanagement/2023-03-01-preview/tenantaccessgit/id_access.go @@ -38,31 +38,9 @@ func ParseAccessID(input string) (*AccessId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccessId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if v, ok := parsed.Parsed["accessName"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accessName", *parsed) - } - - accessName, err := parseAccessIdName(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.AccessName = *accessName + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -77,34 +55,42 @@ func ParseAccessIDInsensitively(input string) (*AccessId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccessId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *AccessId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if v, ok := parsed.Parsed["accessName"]; true { + if v, ok := input.Parsed["accessName"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accessName", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "accessName", input) } accessName, err := parseAccessIdName(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.AccessName = *accessName } - return &id, nil + return nil } // ValidateAccessID checks that 'input' can be parsed as a Access ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/tenantconfiguration/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/tenantconfiguration/id_service.go index e4f04e8c155..035a1bd0afd 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/tenantconfiguration/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/tenantconfiguration/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/tenantconfigurationsyncstate/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/tenantconfigurationsyncstate/id_service.go index da1608f2136..81e30d893aa 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/tenantconfigurationsyncstate/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/tenantconfigurationsyncstate/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/tenantsettings/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/tenantsettings/id_service.go index d197d9265cc..16e418759e4 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/tenantsettings/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/tenantsettings/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/user/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/user/id_service.go index 1747126f519..3ea79e41822 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/user/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/user/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/user/id_user.go b/resource-manager/apimanagement/2023-03-01-preview/user/id_user.go index 0b7943b4fae..08a07fa9e6f 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/user/id_user.go +++ b/resource-manager/apimanagement/2023-03-01-preview/user/id_user.go @@ -38,23 +38,9 @@ func ParseUserID(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseUserIDInsensitively(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UserId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if id.UserId, ok = input.Parsed["userId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userId", input) } - return &id, nil + return nil } // ValidateUserID checks that 'input' can be parsed as a User ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/userconfirmationpasswordsend/id_user.go b/resource-manager/apimanagement/2023-03-01-preview/userconfirmationpasswordsend/id_user.go index c827f27c182..dcd727f0f14 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/userconfirmationpasswordsend/id_user.go +++ b/resource-manager/apimanagement/2023-03-01-preview/userconfirmationpasswordsend/id_user.go @@ -38,23 +38,9 @@ func ParseUserID(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseUserIDInsensitively(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UserId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if id.UserId, ok = input.Parsed["userId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userId", input) } - return &id, nil + return nil } // ValidateUserID checks that 'input' can be parsed as a User ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/usergroup/id_user.go b/resource-manager/apimanagement/2023-03-01-preview/usergroup/id_user.go index 6f481473ac3..4f9503feb9f 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/usergroup/id_user.go +++ b/resource-manager/apimanagement/2023-03-01-preview/usergroup/id_user.go @@ -38,23 +38,9 @@ func ParseUserID(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseUserIDInsensitively(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UserId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if id.UserId, ok = input.Parsed["userId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userId", input) } - return &id, nil + return nil } // ValidateUserID checks that 'input' can be parsed as a User ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/useridentity/id_user.go b/resource-manager/apimanagement/2023-03-01-preview/useridentity/id_user.go index 185612cefc7..ea5036e1153 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/useridentity/id_user.go +++ b/resource-manager/apimanagement/2023-03-01-preview/useridentity/id_user.go @@ -38,23 +38,9 @@ func ParseUserID(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseUserIDInsensitively(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UserId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if id.UserId, ok = input.Parsed["userId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userId", input) } - return &id, nil + return nil } // ValidateUserID checks that 'input' can be parsed as a User ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/users/id_user.go b/resource-manager/apimanagement/2023-03-01-preview/users/id_user.go index 0720c2e6308..3e281134141 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/users/id_user.go +++ b/resource-manager/apimanagement/2023-03-01-preview/users/id_user.go @@ -38,23 +38,9 @@ func ParseUserID(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseUserIDInsensitively(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UserId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if id.UserId, ok = input.Parsed["userId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userId", input) } - return &id, nil + return nil } // ValidateUserID checks that 'input' can be parsed as a User ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/usersubscription/id_user.go b/resource-manager/apimanagement/2023-03-01-preview/usersubscription/id_user.go index c64085994b2..d1c798858f7 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/usersubscription/id_user.go +++ b/resource-manager/apimanagement/2023-03-01-preview/usersubscription/id_user.go @@ -38,23 +38,9 @@ func ParseUserID(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseUserIDInsensitively(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UserId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if id.UserId, ok = input.Parsed["userId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userId", input) } - return &id, nil + return nil } // ValidateUserID checks that 'input' can be parsed as a User ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/usertoken/id_user.go b/resource-manager/apimanagement/2023-03-01-preview/usertoken/id_user.go index 6f2e7012c25..7e0b9d7cb88 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/usertoken/id_user.go +++ b/resource-manager/apimanagement/2023-03-01-preview/usertoken/id_user.go @@ -38,23 +38,9 @@ func ParseUserID(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseUserIDInsensitively(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UserId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.UserId, ok = parsed.Parsed["userId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userId", *parsed) + if id.UserId, ok = input.Parsed["userId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userId", input) } - return &id, nil + return nil } // ValidateUserID checks that 'input' can be parsed as a User ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/workspace/id_service.go b/resource-manager/apimanagement/2023-03-01-preview/workspace/id_service.go index 280f61d6b33..d4300bb7f0a 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/workspace/id_service.go +++ b/resource-manager/apimanagement/2023-03-01-preview/workspace/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/workspace/id_workspace.go b/resource-manager/apimanagement/2023-03-01-preview/workspace/id_workspace.go index 12d5189e36b..7a178c3172d 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/workspace/id_workspace.go +++ b/resource-manager/apimanagement/2023-03-01-preview/workspace/id_workspace.go @@ -38,23 +38,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WorkspaceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/apimanagement/2023-03-01-preview/workspacepolicy/id_workspace.go b/resource-manager/apimanagement/2023-03-01-preview/workspacepolicy/id_workspace.go index da9f11b78ae..92b1543a0de 100644 --- a/resource-manager/apimanagement/2023-03-01-preview/workspacepolicy/id_workspace.go +++ b/resource-manager/apimanagement/2023-03-01-preview/workspacepolicy/id_workspace.go @@ -38,23 +38,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WorkspaceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.WorkspaceId, ok = parsed.Parsed["workspaceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", *parsed) + if id.WorkspaceId, ok = input.Parsed["workspaceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceId", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/appconfiguration/2023-03-01/configurationstores/id_configurationstore.go b/resource-manager/appconfiguration/2023-03-01/configurationstores/id_configurationstore.go index cae39b3cfc0..a7e4d9b09c2 100644 --- a/resource-manager/appconfiguration/2023-03-01/configurationstores/id_configurationstore.go +++ b/resource-manager/appconfiguration/2023-03-01/configurationstores/id_configurationstore.go @@ -36,19 +36,9 @@ func ParseConfigurationStoreID(input string) (*ConfigurationStoreId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationStoreId{} - - 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.ConfigurationStoreName, ok = parsed.Parsed["configurationStoreName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationStoreName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseConfigurationStoreIDInsensitively(input string) (*ConfigurationStoreId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationStoreId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ConfigurationStoreId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ConfigurationStoreName, ok = parsed.Parsed["configurationStoreName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationStoreName", *parsed) + if id.ConfigurationStoreName, ok = input.Parsed["configurationStoreName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationStoreName", input) } - return &id, nil + return nil } // ValidateConfigurationStoreID checks that 'input' can be parsed as a Configuration Store ID diff --git a/resource-manager/appconfiguration/2023-03-01/deletedconfigurationstores/id_deletedconfigurationstore.go b/resource-manager/appconfiguration/2023-03-01/deletedconfigurationstores/id_deletedconfigurationstore.go index 7c03358920a..aabf0933405 100644 --- a/resource-manager/appconfiguration/2023-03-01/deletedconfigurationstores/id_deletedconfigurationstore.go +++ b/resource-manager/appconfiguration/2023-03-01/deletedconfigurationstores/id_deletedconfigurationstore.go @@ -36,19 +36,9 @@ func ParseDeletedConfigurationStoreID(input string) (*DeletedConfigurationStoreI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeletedConfigurationStoreId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.DeletedConfigurationStoreName, ok = parsed.Parsed["deletedConfigurationStoreName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedConfigurationStoreName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDeletedConfigurationStoreIDInsensitively(input string) (*DeletedConfig return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeletedConfigurationStoreId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DeletedConfigurationStoreId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.DeletedConfigurationStoreName, ok = parsed.Parsed["deletedConfigurationStoreName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedConfigurationStoreName", *parsed) + if id.DeletedConfigurationStoreName, ok = input.Parsed["deletedConfigurationStoreName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deletedConfigurationStoreName", input) } - return &id, nil + return nil } // ValidateDeletedConfigurationStoreID checks that 'input' can be parsed as a Deleted Configuration Store ID diff --git a/resource-manager/appconfiguration/2023-03-01/keyvalues/id_keyvalue.go b/resource-manager/appconfiguration/2023-03-01/keyvalues/id_keyvalue.go index 08b221ebf01..2b8014abbdb 100644 --- a/resource-manager/appconfiguration/2023-03-01/keyvalues/id_keyvalue.go +++ b/resource-manager/appconfiguration/2023-03-01/keyvalues/id_keyvalue.go @@ -38,23 +38,9 @@ func ParseKeyValueID(input string) (*KeyValueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := KeyValueId{} - - 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.ConfigurationStoreName, ok = parsed.Parsed["configurationStoreName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationStoreName", *parsed) - } - - if id.KeyValueName, ok = parsed.Parsed["keyValueName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyValueName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseKeyValueIDInsensitively(input string) (*KeyValueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := KeyValueId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *KeyValueId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ConfigurationStoreName, ok = parsed.Parsed["configurationStoreName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationStoreName", *parsed) + if id.ConfigurationStoreName, ok = input.Parsed["configurationStoreName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationStoreName", input) } - if id.KeyValueName, ok = parsed.Parsed["keyValueName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyValueName", *parsed) + if id.KeyValueName, ok = input.Parsed["keyValueName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "keyValueName", input) } - return &id, nil + return nil } // ValidateKeyValueID checks that 'input' can be parsed as a Key Value ID diff --git a/resource-manager/appconfiguration/2023-03-01/operations/id_location.go b/resource-manager/appconfiguration/2023-03-01/operations/id_location.go index a8367fe1dc7..7e4626f1c14 100644 --- a/resource-manager/appconfiguration/2023-03-01/operations/id_location.go +++ b/resource-manager/appconfiguration/2023-03-01/operations/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/appconfiguration/2023-03-01/privateendpointconnections/id_configurationstore.go b/resource-manager/appconfiguration/2023-03-01/privateendpointconnections/id_configurationstore.go index 4119d1b4f69..76a85218612 100644 --- a/resource-manager/appconfiguration/2023-03-01/privateendpointconnections/id_configurationstore.go +++ b/resource-manager/appconfiguration/2023-03-01/privateendpointconnections/id_configurationstore.go @@ -36,19 +36,9 @@ func ParseConfigurationStoreID(input string) (*ConfigurationStoreId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationStoreId{} - - 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.ConfigurationStoreName, ok = parsed.Parsed["configurationStoreName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationStoreName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseConfigurationStoreIDInsensitively(input string) (*ConfigurationStoreId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationStoreId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ConfigurationStoreId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ConfigurationStoreName, ok = parsed.Parsed["configurationStoreName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationStoreName", *parsed) + if id.ConfigurationStoreName, ok = input.Parsed["configurationStoreName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationStoreName", input) } - return &id, nil + return nil } // ValidateConfigurationStoreID checks that 'input' can be parsed as a Configuration Store ID diff --git a/resource-manager/appconfiguration/2023-03-01/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/appconfiguration/2023-03-01/privateendpointconnections/id_privateendpointconnection.go index f53a252dba3..b6b9cb34710 100644 --- a/resource-manager/appconfiguration/2023-03-01/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/appconfiguration/2023-03-01/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.ConfigurationStoreName, ok = parsed.Parsed["configurationStoreName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationStoreName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ConfigurationStoreName, ok = parsed.Parsed["configurationStoreName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationStoreName", *parsed) + if id.ConfigurationStoreName, ok = input.Parsed["configurationStoreName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationStoreName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/appconfiguration/2023-03-01/privatelinkresources/id_configurationstore.go b/resource-manager/appconfiguration/2023-03-01/privatelinkresources/id_configurationstore.go index dc3a91c84f2..5e6bf23dd72 100644 --- a/resource-manager/appconfiguration/2023-03-01/privatelinkresources/id_configurationstore.go +++ b/resource-manager/appconfiguration/2023-03-01/privatelinkresources/id_configurationstore.go @@ -36,19 +36,9 @@ func ParseConfigurationStoreID(input string) (*ConfigurationStoreId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationStoreId{} - - 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.ConfigurationStoreName, ok = parsed.Parsed["configurationStoreName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationStoreName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseConfigurationStoreIDInsensitively(input string) (*ConfigurationStoreId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationStoreId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ConfigurationStoreId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ConfigurationStoreName, ok = parsed.Parsed["configurationStoreName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationStoreName", *parsed) + if id.ConfigurationStoreName, ok = input.Parsed["configurationStoreName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationStoreName", input) } - return &id, nil + return nil } // ValidateConfigurationStoreID checks that 'input' can be parsed as a Configuration Store ID diff --git a/resource-manager/appconfiguration/2023-03-01/privatelinkresources/id_privatelinkresource.go b/resource-manager/appconfiguration/2023-03-01/privatelinkresources/id_privatelinkresource.go index 8d0b5dee617..dc27a08f796 100644 --- a/resource-manager/appconfiguration/2023-03-01/privatelinkresources/id_privatelinkresource.go +++ b/resource-manager/appconfiguration/2023-03-01/privatelinkresources/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.ConfigurationStoreName, ok = parsed.Parsed["configurationStoreName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationStoreName", *parsed) - } - - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ConfigurationStoreName, ok = parsed.Parsed["configurationStoreName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationStoreName", *parsed) + if id.ConfigurationStoreName, ok = input.Parsed["configurationStoreName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationStoreName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/appconfiguration/2023-03-01/replicas/id_configurationstore.go b/resource-manager/appconfiguration/2023-03-01/replicas/id_configurationstore.go index 64c7ad6a244..567c11c03bb 100644 --- a/resource-manager/appconfiguration/2023-03-01/replicas/id_configurationstore.go +++ b/resource-manager/appconfiguration/2023-03-01/replicas/id_configurationstore.go @@ -36,19 +36,9 @@ func ParseConfigurationStoreID(input string) (*ConfigurationStoreId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationStoreId{} - - 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.ConfigurationStoreName, ok = parsed.Parsed["configurationStoreName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationStoreName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseConfigurationStoreIDInsensitively(input string) (*ConfigurationStoreId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationStoreId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ConfigurationStoreId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ConfigurationStoreName, ok = parsed.Parsed["configurationStoreName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationStoreName", *parsed) + if id.ConfigurationStoreName, ok = input.Parsed["configurationStoreName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationStoreName", input) } - return &id, nil + return nil } // ValidateConfigurationStoreID checks that 'input' can be parsed as a Configuration Store ID diff --git a/resource-manager/appconfiguration/2023-03-01/replicas/id_replica.go b/resource-manager/appconfiguration/2023-03-01/replicas/id_replica.go index 464e8bae7e9..0bce2615b43 100644 --- a/resource-manager/appconfiguration/2023-03-01/replicas/id_replica.go +++ b/resource-manager/appconfiguration/2023-03-01/replicas/id_replica.go @@ -38,23 +38,9 @@ func ParseReplicaID(input string) (*ReplicaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicaId{} - - 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.ConfigurationStoreName, ok = parsed.Parsed["configurationStoreName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationStoreName", *parsed) - } - - if id.ReplicaName, ok = parsed.Parsed["replicaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicaName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicaIDInsensitively(input string) (*ReplicaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicaId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicaId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ConfigurationStoreName, ok = parsed.Parsed["configurationStoreName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationStoreName", *parsed) + if id.ConfigurationStoreName, ok = input.Parsed["configurationStoreName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationStoreName", input) } - if id.ReplicaName, ok = parsed.Parsed["replicaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicaName", *parsed) + if id.ReplicaName, ok = input.Parsed["replicaName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicaName", input) } - return &id, nil + return nil } // ValidateReplicaID checks that 'input' can be parsed as a Replica ID diff --git a/resource-manager/applicationinsights/2015-05-01/analyticsitemsapis/id_providercomponent.go b/resource-manager/applicationinsights/2015-05-01/analyticsitemsapis/id_providercomponent.go index 47a82cac66a..845b430ee80 100644 --- a/resource-manager/applicationinsights/2015-05-01/analyticsitemsapis/id_providercomponent.go +++ b/resource-manager/applicationinsights/2015-05-01/analyticsitemsapis/id_providercomponent.go @@ -38,23 +38,9 @@ func ParseProviderComponentID(input string) (*ProviderComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderComponentId{} - - 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.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) - } - - if id.ScopePath, ok = parsed.Parsed["scopePath"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scopePath", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProviderComponentIDInsensitively(input string) (*ProviderComponentId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderComponentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProviderComponentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) } - if id.ScopePath, ok = parsed.Parsed["scopePath"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scopePath", *parsed) + if id.ScopePath, ok = input.Parsed["scopePath"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scopePath", input) } - return &id, nil + return nil } // ValidateProviderComponentID checks that 'input' can be parsed as a Provider Component ID diff --git a/resource-manager/applicationinsights/2015-05-01/componentannotationsapis/id_annotation.go b/resource-manager/applicationinsights/2015-05-01/componentannotationsapis/id_annotation.go index b7c0860fbdb..dfeb39707eb 100644 --- a/resource-manager/applicationinsights/2015-05-01/componentannotationsapis/id_annotation.go +++ b/resource-manager/applicationinsights/2015-05-01/componentannotationsapis/id_annotation.go @@ -38,23 +38,9 @@ func ParseAnnotationID(input string) (*AnnotationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AnnotationId{} - - 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.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) - } - - if id.AnnotationId, ok = parsed.Parsed["annotationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "annotationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAnnotationIDInsensitively(input string) (*AnnotationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AnnotationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AnnotationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) } - if id.AnnotationId, ok = parsed.Parsed["annotationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "annotationId", *parsed) + if id.AnnotationId, ok = input.Parsed["annotationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "annotationId", input) } - return &id, nil + return nil } // ValidateAnnotationID checks that 'input' can be parsed as a Annotation ID diff --git a/resource-manager/applicationinsights/2015-05-01/componentannotationsapis/id_component.go b/resource-manager/applicationinsights/2015-05-01/componentannotationsapis/id_component.go index 211b168799b..045e1f698b9 100644 --- a/resource-manager/applicationinsights/2015-05-01/componentannotationsapis/id_component.go +++ b/resource-manager/applicationinsights/2015-05-01/componentannotationsapis/id_component.go @@ -36,19 +36,9 @@ func ParseComponentID(input string) (*ComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentId{} - - 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.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseComponentIDInsensitively(input string) (*ComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ComponentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) } - return &id, nil + return nil } // ValidateComponentID checks that 'input' can be parsed as a Component ID diff --git a/resource-manager/applicationinsights/2015-05-01/componentapikeysapis/id_apikey.go b/resource-manager/applicationinsights/2015-05-01/componentapikeysapis/id_apikey.go index 32a2ea0ff0a..5aa3ee95a29 100644 --- a/resource-manager/applicationinsights/2015-05-01/componentapikeysapis/id_apikey.go +++ b/resource-manager/applicationinsights/2015-05-01/componentapikeysapis/id_apikey.go @@ -38,23 +38,9 @@ func ParseApiKeyID(input string) (*ApiKeyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiKeyId{} - - 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.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) - } - - if id.KeyId, ok = parsed.Parsed["keyId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiKeyIDInsensitively(input string) (*ApiKeyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiKeyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiKeyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) } - if id.KeyId, ok = parsed.Parsed["keyId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyId", *parsed) + if id.KeyId, ok = input.Parsed["keyId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "keyId", input) } - return &id, nil + return nil } // ValidateApiKeyID checks that 'input' can be parsed as a Api Key ID diff --git a/resource-manager/applicationinsights/2015-05-01/componentapikeysapis/id_component.go b/resource-manager/applicationinsights/2015-05-01/componentapikeysapis/id_component.go index ed607aa42cc..73c5185f5a7 100644 --- a/resource-manager/applicationinsights/2015-05-01/componentapikeysapis/id_component.go +++ b/resource-manager/applicationinsights/2015-05-01/componentapikeysapis/id_component.go @@ -36,19 +36,9 @@ func ParseComponentID(input string) (*ComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentId{} - - 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.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseComponentIDInsensitively(input string) (*ComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ComponentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) } - return &id, nil + return nil } // ValidateComponentID checks that 'input' can be parsed as a Component ID diff --git a/resource-manager/applicationinsights/2015-05-01/componentcontinuousexportapis/id_component.go b/resource-manager/applicationinsights/2015-05-01/componentcontinuousexportapis/id_component.go index cb8b098b16d..020255f2d2a 100644 --- a/resource-manager/applicationinsights/2015-05-01/componentcontinuousexportapis/id_component.go +++ b/resource-manager/applicationinsights/2015-05-01/componentcontinuousexportapis/id_component.go @@ -36,19 +36,9 @@ func ParseComponentID(input string) (*ComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentId{} - - 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.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseComponentIDInsensitively(input string) (*ComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ComponentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) } - return &id, nil + return nil } // ValidateComponentID checks that 'input' can be parsed as a Component ID diff --git a/resource-manager/applicationinsights/2015-05-01/componentcontinuousexportapis/id_exportconfiguration.go b/resource-manager/applicationinsights/2015-05-01/componentcontinuousexportapis/id_exportconfiguration.go index f46292c8ea4..89cee3977f3 100644 --- a/resource-manager/applicationinsights/2015-05-01/componentcontinuousexportapis/id_exportconfiguration.go +++ b/resource-manager/applicationinsights/2015-05-01/componentcontinuousexportapis/id_exportconfiguration.go @@ -38,23 +38,9 @@ func ParseExportConfigurationID(input string) (*ExportConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExportConfigurationId{} - - 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.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) - } - - if id.ExportId, ok = parsed.Parsed["exportId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "exportId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseExportConfigurationIDInsensitively(input string) (*ExportConfiguration return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExportConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ExportConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) } - if id.ExportId, ok = parsed.Parsed["exportId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "exportId", *parsed) + if id.ExportId, ok = input.Parsed["exportId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "exportId", input) } - return &id, nil + return nil } // ValidateExportConfigurationID checks that 'input' can be parsed as a Export Configuration ID diff --git a/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/id_component.go b/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/id_component.go index 1c357b6695c..6ece0a43f79 100644 --- a/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/id_component.go +++ b/resource-manager/applicationinsights/2015-05-01/componentfeaturesandpricingapis/id_component.go @@ -36,19 +36,9 @@ func ParseComponentID(input string) (*ComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentId{} - - 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.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseComponentIDInsensitively(input string) (*ComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ComponentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) } - return &id, nil + return nil } // ValidateComponentID checks that 'input' can be parsed as a Component ID diff --git a/resource-manager/applicationinsights/2015-05-01/componentproactivedetectionapis/id_component.go b/resource-manager/applicationinsights/2015-05-01/componentproactivedetectionapis/id_component.go index 8a713f1b7d8..89745711f34 100644 --- a/resource-manager/applicationinsights/2015-05-01/componentproactivedetectionapis/id_component.go +++ b/resource-manager/applicationinsights/2015-05-01/componentproactivedetectionapis/id_component.go @@ -36,19 +36,9 @@ func ParseComponentID(input string) (*ComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentId{} - - 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.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseComponentIDInsensitively(input string) (*ComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ComponentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) } - return &id, nil + return nil } // ValidateComponentID checks that 'input' can be parsed as a Component ID diff --git a/resource-manager/applicationinsights/2015-05-01/componentproactivedetectionapis/id_proactivedetectionconfig.go b/resource-manager/applicationinsights/2015-05-01/componentproactivedetectionapis/id_proactivedetectionconfig.go index d00ea6d8df4..c3ac7c4013f 100644 --- a/resource-manager/applicationinsights/2015-05-01/componentproactivedetectionapis/id_proactivedetectionconfig.go +++ b/resource-manager/applicationinsights/2015-05-01/componentproactivedetectionapis/id_proactivedetectionconfig.go @@ -38,23 +38,9 @@ func ParseProactiveDetectionConfigID(input string) (*ProactiveDetectionConfigId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProactiveDetectionConfigId{} - - 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.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) - } - - if id.ConfigurationId, ok = parsed.Parsed["configurationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProactiveDetectionConfigIDInsensitively(input string) (*ProactiveDetec return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProactiveDetectionConfigId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProactiveDetectionConfigId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) } - if id.ConfigurationId, ok = parsed.Parsed["configurationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationId", *parsed) + if id.ConfigurationId, ok = input.Parsed["configurationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationId", input) } - return &id, nil + return nil } // ValidateProactiveDetectionConfigID checks that 'input' can be parsed as a Proactive Detection Config ID diff --git a/resource-manager/applicationinsights/2015-05-01/componentsapis/id_component.go b/resource-manager/applicationinsights/2015-05-01/componentsapis/id_component.go index 68eb35687e4..21dc66b72fd 100644 --- a/resource-manager/applicationinsights/2015-05-01/componentsapis/id_component.go +++ b/resource-manager/applicationinsights/2015-05-01/componentsapis/id_component.go @@ -36,19 +36,9 @@ func ParseComponentID(input string) (*ComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentId{} - - 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.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseComponentIDInsensitively(input string) (*ComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ComponentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) } - return &id, nil + return nil } // ValidateComponentID checks that 'input' can be parsed as a Component ID diff --git a/resource-manager/applicationinsights/2015-05-01/componentsapis/id_operation.go b/resource-manager/applicationinsights/2015-05-01/componentsapis/id_operation.go index 0c603e62e19..9ee2208b86b 100644 --- a/resource-manager/applicationinsights/2015-05-01/componentsapis/id_operation.go +++ b/resource-manager/applicationinsights/2015-05-01/componentsapis/id_operation.go @@ -38,23 +38,9 @@ func ParseOperationID(input string) (*OperationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationId{} - - 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.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) - } - - if id.PurgeId, ok = parsed.Parsed["purgeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "purgeId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseOperationIDInsensitively(input string) (*OperationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OperationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) } - if id.PurgeId, ok = parsed.Parsed["purgeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "purgeId", *parsed) + if id.PurgeId, ok = input.Parsed["purgeId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "purgeId", input) } - return &id, nil + return nil } // ValidateOperationID checks that 'input' can be parsed as a Operation ID diff --git a/resource-manager/applicationinsights/2015-05-01/componentworkitemconfigsapis/id_component.go b/resource-manager/applicationinsights/2015-05-01/componentworkitemconfigsapis/id_component.go index bfc79f079cf..cc584d89a80 100644 --- a/resource-manager/applicationinsights/2015-05-01/componentworkitemconfigsapis/id_component.go +++ b/resource-manager/applicationinsights/2015-05-01/componentworkitemconfigsapis/id_component.go @@ -36,19 +36,9 @@ func ParseComponentID(input string) (*ComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentId{} - - 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.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseComponentIDInsensitively(input string) (*ComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ComponentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) } - return &id, nil + return nil } // ValidateComponentID checks that 'input' can be parsed as a Component ID diff --git a/resource-manager/applicationinsights/2015-05-01/componentworkitemconfigsapis/id_workitemconfig.go b/resource-manager/applicationinsights/2015-05-01/componentworkitemconfigsapis/id_workitemconfig.go index 2caea0f63d6..116eddd37f8 100644 --- a/resource-manager/applicationinsights/2015-05-01/componentworkitemconfigsapis/id_workitemconfig.go +++ b/resource-manager/applicationinsights/2015-05-01/componentworkitemconfigsapis/id_workitemconfig.go @@ -38,23 +38,9 @@ func ParseWorkItemConfigID(input string) (*WorkItemConfigId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkItemConfigId{} - - 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.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) - } - - if id.WorkItemConfigId, ok = parsed.Parsed["workItemConfigId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workItemConfigId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWorkItemConfigIDInsensitively(input string) (*WorkItemConfigId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkItemConfigId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WorkItemConfigId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) } - if id.WorkItemConfigId, ok = parsed.Parsed["workItemConfigId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workItemConfigId", *parsed) + if id.WorkItemConfigId, ok = input.Parsed["workItemConfigId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workItemConfigId", input) } - return &id, nil + return nil } // ValidateWorkItemConfigID checks that 'input' can be parsed as a Work Item Config ID diff --git a/resource-manager/applicationinsights/2015-05-01/favoritesapis/id_component.go b/resource-manager/applicationinsights/2015-05-01/favoritesapis/id_component.go index f2ab1e850c2..8f349bae8b3 100644 --- a/resource-manager/applicationinsights/2015-05-01/favoritesapis/id_component.go +++ b/resource-manager/applicationinsights/2015-05-01/favoritesapis/id_component.go @@ -36,19 +36,9 @@ func ParseComponentID(input string) (*ComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentId{} - - 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.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseComponentIDInsensitively(input string) (*ComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ComponentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) } - return &id, nil + return nil } // ValidateComponentID checks that 'input' can be parsed as a Component ID diff --git a/resource-manager/applicationinsights/2015-05-01/favoritesapis/id_favorite.go b/resource-manager/applicationinsights/2015-05-01/favoritesapis/id_favorite.go index a3f9fee66b2..aa666f00235 100644 --- a/resource-manager/applicationinsights/2015-05-01/favoritesapis/id_favorite.go +++ b/resource-manager/applicationinsights/2015-05-01/favoritesapis/id_favorite.go @@ -38,23 +38,9 @@ func ParseFavoriteID(input string) (*FavoriteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FavoriteId{} - - 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.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) - } - - if id.FavoriteId, ok = parsed.Parsed["favoriteId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "favoriteId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFavoriteIDInsensitively(input string) (*FavoriteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FavoriteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FavoriteId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) } - if id.FavoriteId, ok = parsed.Parsed["favoriteId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "favoriteId", *parsed) + if id.FavoriteId, ok = input.Parsed["favoriteId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "favoriteId", input) } - return &id, nil + return nil } // ValidateFavoriteID checks that 'input' can be parsed as a Favorite ID diff --git a/resource-manager/applicationinsights/2015-05-01/myworkbooksapis/id_myworkbook.go b/resource-manager/applicationinsights/2015-05-01/myworkbooksapis/id_myworkbook.go index 2e58ad488ff..8292d483575 100644 --- a/resource-manager/applicationinsights/2015-05-01/myworkbooksapis/id_myworkbook.go +++ b/resource-manager/applicationinsights/2015-05-01/myworkbooksapis/id_myworkbook.go @@ -36,19 +36,9 @@ func ParseMyWorkbookID(input string) (*MyWorkbookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MyWorkbookId{} - - 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.MyWorkbookName, ok = parsed.Parsed["myWorkbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "myWorkbookName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMyWorkbookIDInsensitively(input string) (*MyWorkbookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MyWorkbookId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MyWorkbookId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MyWorkbookName, ok = parsed.Parsed["myWorkbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "myWorkbookName", *parsed) + if id.MyWorkbookName, ok = input.Parsed["myWorkbookName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "myWorkbookName", input) } - return &id, nil + return nil } // ValidateMyWorkbookID checks that 'input' can be parsed as a My Workbook ID diff --git a/resource-manager/applicationinsights/2015-05-01/webtestlocationsapis/id_component.go b/resource-manager/applicationinsights/2015-05-01/webtestlocationsapis/id_component.go index 569f3732239..f87ffc81024 100644 --- a/resource-manager/applicationinsights/2015-05-01/webtestlocationsapis/id_component.go +++ b/resource-manager/applicationinsights/2015-05-01/webtestlocationsapis/id_component.go @@ -36,19 +36,9 @@ func ParseComponentID(input string) (*ComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentId{} - - 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.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseComponentIDInsensitively(input string) (*ComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ComponentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) } - return &id, nil + return nil } // ValidateComponentID checks that 'input' can be parsed as a Component ID diff --git a/resource-manager/applicationinsights/2015-05-01/webtestsapis/id_component.go b/resource-manager/applicationinsights/2015-05-01/webtestsapis/id_component.go index ab841f823b2..18302cbed9d 100644 --- a/resource-manager/applicationinsights/2015-05-01/webtestsapis/id_component.go +++ b/resource-manager/applicationinsights/2015-05-01/webtestsapis/id_component.go @@ -36,19 +36,9 @@ func ParseComponentID(input string) (*ComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentId{} - - 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.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseComponentIDInsensitively(input string) (*ComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ComponentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) } - return &id, nil + return nil } // ValidateComponentID checks that 'input' can be parsed as a Component ID diff --git a/resource-manager/applicationinsights/2015-05-01/webtestsapis/id_webtest.go b/resource-manager/applicationinsights/2015-05-01/webtestsapis/id_webtest.go index 0c36b5abe0f..c60693195ba 100644 --- a/resource-manager/applicationinsights/2015-05-01/webtestsapis/id_webtest.go +++ b/resource-manager/applicationinsights/2015-05-01/webtestsapis/id_webtest.go @@ -36,19 +36,9 @@ func ParseWebTestID(input string) (*WebTestId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WebTestId{} - - 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.WebTestName, ok = parsed.Parsed["webTestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "webTestName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWebTestIDInsensitively(input string) (*WebTestId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WebTestId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WebTestId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WebTestName, ok = parsed.Parsed["webTestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "webTestName", *parsed) + if id.WebTestName, ok = input.Parsed["webTestName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "webTestName", input) } - return &id, nil + return nil } // ValidateWebTestID checks that 'input' can be parsed as a Web Test ID diff --git a/resource-manager/applicationinsights/2015-05-01/workbooksapis/id_workbook.go b/resource-manager/applicationinsights/2015-05-01/workbooksapis/id_workbook.go index d683fcea08f..0e7582c9170 100644 --- a/resource-manager/applicationinsights/2015-05-01/workbooksapis/id_workbook.go +++ b/resource-manager/applicationinsights/2015-05-01/workbooksapis/id_workbook.go @@ -36,19 +36,9 @@ func ParseWorkbookID(input string) (*WorkbookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkbookId{} - - 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.WorkbookName, ok = parsed.Parsed["workbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workbookName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkbookIDInsensitively(input string) (*WorkbookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkbookId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkbookId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkbookName, ok = parsed.Parsed["workbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workbookName", *parsed) + if id.WorkbookName, ok = input.Parsed["workbookName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workbookName", input) } - return &id, nil + return nil } // ValidateWorkbookID checks that 'input' can be parsed as a Workbook ID diff --git a/resource-manager/applicationinsights/2020-02-02/componentsapis/id_component.go b/resource-manager/applicationinsights/2020-02-02/componentsapis/id_component.go index 68eb35687e4..21dc66b72fd 100644 --- a/resource-manager/applicationinsights/2020-02-02/componentsapis/id_component.go +++ b/resource-manager/applicationinsights/2020-02-02/componentsapis/id_component.go @@ -36,19 +36,9 @@ func ParseComponentID(input string) (*ComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentId{} - - 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.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseComponentIDInsensitively(input string) (*ComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ComponentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) } - return &id, nil + return nil } // ValidateComponentID checks that 'input' can be parsed as a Component ID diff --git a/resource-manager/applicationinsights/2020-02-02/componentsapis/id_operation.go b/resource-manager/applicationinsights/2020-02-02/componentsapis/id_operation.go index 0c603e62e19..9ee2208b86b 100644 --- a/resource-manager/applicationinsights/2020-02-02/componentsapis/id_operation.go +++ b/resource-manager/applicationinsights/2020-02-02/componentsapis/id_operation.go @@ -38,23 +38,9 @@ func ParseOperationID(input string) (*OperationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationId{} - - 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.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) - } - - if id.PurgeId, ok = parsed.Parsed["purgeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "purgeId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseOperationIDInsensitively(input string) (*OperationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OperationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) } - if id.PurgeId, ok = parsed.Parsed["purgeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "purgeId", *parsed) + if id.PurgeId, ok = input.Parsed["purgeId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "purgeId", input) } - return &id, nil + return nil } // ValidateOperationID checks that 'input' can be parsed as a Operation ID diff --git a/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/id_workbooktemplate.go b/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/id_workbooktemplate.go index 487a2ed99ce..6184c3353f5 100644 --- a/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/id_workbooktemplate.go +++ b/resource-manager/applicationinsights/2020-11-20/workbooktemplatesapis/id_workbooktemplate.go @@ -36,19 +36,9 @@ func ParseWorkbookTemplateID(input string) (*WorkbookTemplateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkbookTemplateId{} - - 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.WorkbookTemplateName, ok = parsed.Parsed["workbookTemplateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workbookTemplateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkbookTemplateIDInsensitively(input string) (*WorkbookTemplateId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkbookTemplateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkbookTemplateId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkbookTemplateName, ok = parsed.Parsed["workbookTemplateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workbookTemplateName", *parsed) + if id.WorkbookTemplateName, ok = input.Parsed["workbookTemplateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workbookTemplateName", input) } - return &id, nil + return nil } // ValidateWorkbookTemplateID checks that 'input' can be parsed as a Workbook Template ID diff --git a/resource-manager/applicationinsights/2022-04-01/workbooksapis/id_revision.go b/resource-manager/applicationinsights/2022-04-01/workbooksapis/id_revision.go index 9cf01d504ce..ca59bd54a90 100644 --- a/resource-manager/applicationinsights/2022-04-01/workbooksapis/id_revision.go +++ b/resource-manager/applicationinsights/2022-04-01/workbooksapis/id_revision.go @@ -38,23 +38,9 @@ func ParseRevisionID(input string) (*RevisionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RevisionId{} - - 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.WorkbookName, ok = parsed.Parsed["workbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workbookName", *parsed) - } - - if id.RevisionId, ok = parsed.Parsed["revisionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "revisionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRevisionIDInsensitively(input string) (*RevisionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RevisionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RevisionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkbookName, ok = parsed.Parsed["workbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workbookName", *parsed) + if id.WorkbookName, ok = input.Parsed["workbookName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workbookName", input) } - if id.RevisionId, ok = parsed.Parsed["revisionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "revisionId", *parsed) + if id.RevisionId, ok = input.Parsed["revisionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "revisionId", input) } - return &id, nil + return nil } // ValidateRevisionID checks that 'input' can be parsed as a Revision ID diff --git a/resource-manager/applicationinsights/2022-04-01/workbooksapis/id_workbook.go b/resource-manager/applicationinsights/2022-04-01/workbooksapis/id_workbook.go index d683fcea08f..0e7582c9170 100644 --- a/resource-manager/applicationinsights/2022-04-01/workbooksapis/id_workbook.go +++ b/resource-manager/applicationinsights/2022-04-01/workbooksapis/id_workbook.go @@ -36,19 +36,9 @@ func ParseWorkbookID(input string) (*WorkbookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkbookId{} - - 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.WorkbookName, ok = parsed.Parsed["workbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workbookName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkbookIDInsensitively(input string) (*WorkbookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkbookId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkbookId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkbookName, ok = parsed.Parsed["workbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workbookName", *parsed) + if id.WorkbookName, ok = input.Parsed["workbookName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workbookName", input) } - return &id, nil + return nil } // ValidateWorkbookID checks that 'input' can be parsed as a Workbook ID diff --git a/resource-manager/applicationinsights/2022-06-15/webtestsapis/id_component.go b/resource-manager/applicationinsights/2022-06-15/webtestsapis/id_component.go index ab841f823b2..18302cbed9d 100644 --- a/resource-manager/applicationinsights/2022-06-15/webtestsapis/id_component.go +++ b/resource-manager/applicationinsights/2022-06-15/webtestsapis/id_component.go @@ -36,19 +36,9 @@ func ParseComponentID(input string) (*ComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentId{} - - 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.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseComponentIDInsensitively(input string) (*ComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ComponentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) } - return &id, nil + return nil } // ValidateComponentID checks that 'input' can be parsed as a Component ID diff --git a/resource-manager/applicationinsights/2022-06-15/webtestsapis/id_webtest.go b/resource-manager/applicationinsights/2022-06-15/webtestsapis/id_webtest.go index 0c36b5abe0f..c60693195ba 100644 --- a/resource-manager/applicationinsights/2022-06-15/webtestsapis/id_webtest.go +++ b/resource-manager/applicationinsights/2022-06-15/webtestsapis/id_webtest.go @@ -36,19 +36,9 @@ func ParseWebTestID(input string) (*WebTestId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WebTestId{} - - 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.WebTestName, ok = parsed.Parsed["webTestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "webTestName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWebTestIDInsensitively(input string) (*WebTestId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WebTestId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WebTestId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WebTestName, ok = parsed.Parsed["webTestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "webTestName", *parsed) + if id.WebTestName, ok = input.Parsed["webTestName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "webTestName", input) } - return &id, nil + return nil } // ValidateWebTestID checks that 'input' can be parsed as a Web Test ID diff --git a/resource-manager/applicationinsights/2023-06-01/workbooksapis/id_revision.go b/resource-manager/applicationinsights/2023-06-01/workbooksapis/id_revision.go index 9cf01d504ce..ca59bd54a90 100644 --- a/resource-manager/applicationinsights/2023-06-01/workbooksapis/id_revision.go +++ b/resource-manager/applicationinsights/2023-06-01/workbooksapis/id_revision.go @@ -38,23 +38,9 @@ func ParseRevisionID(input string) (*RevisionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RevisionId{} - - 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.WorkbookName, ok = parsed.Parsed["workbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workbookName", *parsed) - } - - if id.RevisionId, ok = parsed.Parsed["revisionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "revisionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRevisionIDInsensitively(input string) (*RevisionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RevisionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RevisionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkbookName, ok = parsed.Parsed["workbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workbookName", *parsed) + if id.WorkbookName, ok = input.Parsed["workbookName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workbookName", input) } - if id.RevisionId, ok = parsed.Parsed["revisionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "revisionId", *parsed) + if id.RevisionId, ok = input.Parsed["revisionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "revisionId", input) } - return &id, nil + return nil } // ValidateRevisionID checks that 'input' can be parsed as a Revision ID diff --git a/resource-manager/applicationinsights/2023-06-01/workbooksapis/id_workbook.go b/resource-manager/applicationinsights/2023-06-01/workbooksapis/id_workbook.go index d683fcea08f..0e7582c9170 100644 --- a/resource-manager/applicationinsights/2023-06-01/workbooksapis/id_workbook.go +++ b/resource-manager/applicationinsights/2023-06-01/workbooksapis/id_workbook.go @@ -36,19 +36,9 @@ func ParseWorkbookID(input string) (*WorkbookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkbookId{} - - 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.WorkbookName, ok = parsed.Parsed["workbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workbookName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkbookIDInsensitively(input string) (*WorkbookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkbookId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkbookId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkbookName, ok = parsed.Parsed["workbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workbookName", *parsed) + if id.WorkbookName, ok = input.Parsed["workbookName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workbookName", input) } - return &id, nil + return nil } // ValidateWorkbookID checks that 'input' can be parsed as a Workbook ID diff --git a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_agentpool.go b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_agentpool.go index 2c3d6545f54..4e88e61ff4b 100644 --- a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_agentpool.go +++ b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_agentpool.go @@ -40,27 +40,9 @@ func ParseAgentPoolID(input string) (*AgentPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AgentPoolId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.BuildServiceName, ok = parsed.Parsed["buildServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", *parsed) - } - - if id.AgentPoolName, ok = parsed.Parsed["agentPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "agentPoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseAgentPoolIDInsensitively(input string) (*AgentPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AgentPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *AgentPoolId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.BuildServiceName, ok = parsed.Parsed["buildServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", *parsed) + if id.BuildServiceName, ok = input.Parsed["buildServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", input) } - if id.AgentPoolName, ok = parsed.Parsed["agentPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "agentPoolName", *parsed) + if id.AgentPoolName, ok = input.Parsed["agentPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "agentPoolName", input) } - return &id, nil + return nil } // ValidateAgentPoolID checks that 'input' can be parsed as a Agent Pool ID diff --git a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_apiportal.go b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_apiportal.go index a503b92a287..faad4673814 100644 --- a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_apiportal.go +++ b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_apiportal.go @@ -38,23 +38,9 @@ func ParseApiPortalID(input string) (*ApiPortalId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiPortalId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.ApiPortalName, ok = parsed.Parsed["apiPortalName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiPortalName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiPortalIDInsensitively(input string) (*ApiPortalId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiPortalId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiPortalId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.ApiPortalName, ok = parsed.Parsed["apiPortalName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiPortalName", *parsed) + if id.ApiPortalName, ok = input.Parsed["apiPortalName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiPortalName", input) } - return &id, nil + return nil } // ValidateApiPortalID checks that 'input' can be parsed as a Api Portal ID diff --git a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_apiportaldomain.go b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_apiportaldomain.go index 7772d26d4f6..a3434b26654 100644 --- a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_apiportaldomain.go +++ b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_apiportaldomain.go @@ -40,27 +40,9 @@ func ParseApiPortalDomainID(input string) (*ApiPortalDomainId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiPortalDomainId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.ApiPortalName, ok = parsed.Parsed["apiPortalName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiPortalName", *parsed) - } - - if id.DomainName, ok = parsed.Parsed["domainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseApiPortalDomainIDInsensitively(input string) (*ApiPortalDomainId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiPortalDomainId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ApiPortalDomainId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.ApiPortalName, ok = parsed.Parsed["apiPortalName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiPortalName", *parsed) + if id.ApiPortalName, ok = input.Parsed["apiPortalName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiPortalName", input) } - if id.DomainName, ok = parsed.Parsed["domainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainName", *parsed) + if id.DomainName, ok = input.Parsed["domainName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "domainName", input) } - return &id, nil + return nil } // ValidateApiPortalDomainID checks that 'input' can be parsed as a Api Portal Domain ID diff --git a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_apm.go b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_apm.go index df03f3b0ad8..1f0db0dbe95 100644 --- a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_apm.go +++ b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_apm.go @@ -38,23 +38,9 @@ func ParseApmID(input string) (*ApmId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApmId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.ApmName, ok = parsed.Parsed["apmName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apmName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApmIDInsensitively(input string) (*ApmId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApmId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApmId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.ApmName, ok = parsed.Parsed["apmName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apmName", *parsed) + if id.ApmName, ok = input.Parsed["apmName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apmName", input) } - return &id, nil + return nil } // ValidateApmID checks that 'input' can be parsed as a Apm ID diff --git a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_app.go b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_app.go index 0c9cf467702..5df0ab5cba3 100644 --- a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_app.go +++ b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_app.go @@ -38,23 +38,9 @@ func ParseAppID(input string) (*AppId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AppId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.AppName, ok = parsed.Parsed["appName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "appName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAppIDInsensitively(input string) (*AppId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AppId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AppId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.AppName, ok = parsed.Parsed["appName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "appName", *parsed) + if id.AppName, ok = input.Parsed["appName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "appName", input) } - return &id, nil + return nil } // ValidateAppID checks that 'input' can be parsed as a App ID diff --git a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_applicationaccelerator.go b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_applicationaccelerator.go index a154cd0e316..65c43b92c43 100644 --- a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_applicationaccelerator.go +++ b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_applicationaccelerator.go @@ -38,23 +38,9 @@ func ParseApplicationAcceleratorID(input string) (*ApplicationAcceleratorId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationAcceleratorId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.ApplicationAcceleratorName, ok = parsed.Parsed["applicationAcceleratorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationAcceleratorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApplicationAcceleratorIDInsensitively(input string) (*ApplicationAccel return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationAcceleratorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApplicationAcceleratorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.ApplicationAcceleratorName, ok = parsed.Parsed["applicationAcceleratorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationAcceleratorName", *parsed) + if id.ApplicationAcceleratorName, ok = input.Parsed["applicationAcceleratorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationAcceleratorName", input) } - return &id, nil + return nil } // ValidateApplicationAcceleratorID checks that 'input' can be parsed as a Application Accelerator ID diff --git a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_applicationliveview.go b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_applicationliveview.go index fe403dece92..db3c4d7af5a 100644 --- a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_applicationliveview.go +++ b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_applicationliveview.go @@ -38,23 +38,9 @@ func ParseApplicationLiveViewID(input string) (*ApplicationLiveViewId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationLiveViewId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.ApplicationLiveViewName, ok = parsed.Parsed["applicationLiveViewName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationLiveViewName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApplicationLiveViewIDInsensitively(input string) (*ApplicationLiveView return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationLiveViewId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApplicationLiveViewId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.ApplicationLiveViewName, ok = parsed.Parsed["applicationLiveViewName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationLiveViewName", *parsed) + if id.ApplicationLiveViewName, ok = input.Parsed["applicationLiveViewName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationLiveViewName", input) } - return &id, nil + return nil } // ValidateApplicationLiveViewID checks that 'input' can be parsed as a Application Live View ID diff --git a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_binding.go b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_binding.go index 7978075b54b..96f785290fd 100644 --- a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_binding.go +++ b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_binding.go @@ -40,27 +40,9 @@ func ParseBindingID(input string) (*BindingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BindingId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.AppName, ok = parsed.Parsed["appName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "appName", *parsed) - } - - if id.BindingName, ok = parsed.Parsed["bindingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bindingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseBindingIDInsensitively(input string) (*BindingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BindingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *BindingId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.AppName, ok = parsed.Parsed["appName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "appName", *parsed) + if id.AppName, ok = input.Parsed["appName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "appName", input) } - if id.BindingName, ok = parsed.Parsed["bindingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bindingName", *parsed) + if id.BindingName, ok = input.Parsed["bindingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "bindingName", input) } - return &id, nil + return nil } // ValidateBindingID checks that 'input' can be parsed as a Binding ID diff --git a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_build.go b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_build.go index 2fed396fb88..64699292291 100644 --- a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_build.go +++ b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_build.go @@ -40,27 +40,9 @@ func ParseBuildID(input string) (*BuildId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BuildId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.BuildServiceName, ok = parsed.Parsed["buildServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", *parsed) - } - - if id.BuildName, ok = parsed.Parsed["buildName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseBuildIDInsensitively(input string) (*BuildId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BuildId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *BuildId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.BuildServiceName, ok = parsed.Parsed["buildServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", *parsed) + if id.BuildServiceName, ok = input.Parsed["buildServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", input) } - if id.BuildName, ok = parsed.Parsed["buildName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildName", *parsed) + if id.BuildName, ok = input.Parsed["buildName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "buildName", input) } - return &id, nil + return nil } // ValidateBuildID checks that 'input' can be parsed as a Build ID diff --git a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_builder.go b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_builder.go index 1a3a013ed4b..3db6d55a43e 100644 --- a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_builder.go +++ b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_builder.go @@ -40,27 +40,9 @@ func ParseBuilderID(input string) (*BuilderId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BuilderId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.BuildServiceName, ok = parsed.Parsed["buildServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", *parsed) - } - - if id.BuilderName, ok = parsed.Parsed["builderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "builderName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseBuilderIDInsensitively(input string) (*BuilderId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BuilderId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *BuilderId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.BuildServiceName, ok = parsed.Parsed["buildServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", *parsed) + if id.BuildServiceName, ok = input.Parsed["buildServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", input) } - if id.BuilderName, ok = parsed.Parsed["builderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "builderName", *parsed) + if id.BuilderName, ok = input.Parsed["builderName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "builderName", input) } - return &id, nil + return nil } // ValidateBuilderID checks that 'input' can be parsed as a Builder ID diff --git a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_buildpackbinding.go b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_buildpackbinding.go index 0c0969bf728..634738440e3 100644 --- a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_buildpackbinding.go +++ b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_buildpackbinding.go @@ -42,31 +42,9 @@ func ParseBuildPackBindingID(input string) (*BuildPackBindingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BuildPackBindingId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.BuildServiceName, ok = parsed.Parsed["buildServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", *parsed) - } - - if id.BuilderName, ok = parsed.Parsed["builderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "builderName", *parsed) - } - - if id.BuildPackBindingName, ok = parsed.Parsed["buildPackBindingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildPackBindingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseBuildPackBindingIDInsensitively(input string) (*BuildPackBindingId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BuildPackBindingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *BuildPackBindingId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.BuildServiceName, ok = parsed.Parsed["buildServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", *parsed) + if id.BuildServiceName, ok = input.Parsed["buildServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", input) } - if id.BuilderName, ok = parsed.Parsed["builderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "builderName", *parsed) + if id.BuilderName, ok = input.Parsed["builderName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "builderName", input) } - if id.BuildPackBindingName, ok = parsed.Parsed["buildPackBindingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildPackBindingName", *parsed) + if id.BuildPackBindingName, ok = input.Parsed["buildPackBindingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "buildPackBindingName", input) } - return &id, nil + return nil } // ValidateBuildPackBindingID checks that 'input' can be parsed as a Build Pack Binding ID diff --git a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_buildservice.go b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_buildservice.go index b6331a77da4..aa1fdece06e 100644 --- a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_buildservice.go +++ b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_buildservice.go @@ -38,23 +38,9 @@ func ParseBuildServiceID(input string) (*BuildServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BuildServiceId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.BuildServiceName, ok = parsed.Parsed["buildServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBuildServiceIDInsensitively(input string) (*BuildServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BuildServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BuildServiceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.BuildServiceName, ok = parsed.Parsed["buildServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", *parsed) + if id.BuildServiceName, ok = input.Parsed["buildServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", input) } - return &id, nil + return nil } // ValidateBuildServiceID checks that 'input' can be parsed as a Build Service ID diff --git a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_certificate.go b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_certificate.go index 7b21881fbcf..c0451f184e0 100644 --- a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_certificate.go +++ b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_certificate.go @@ -38,23 +38,9 @@ func ParseCertificateID(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCertificateIDInsensitively(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if id.CertificateName, ok = input.Parsed["certificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateName", input) } - return &id, nil + return nil } // ValidateCertificateID checks that 'input' can be parsed as a Certificate ID diff --git a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_configurationservice.go b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_configurationservice.go index 33ee1ed5932..cf886a64e73 100644 --- a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_configurationservice.go +++ b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_configurationservice.go @@ -38,23 +38,9 @@ func ParseConfigurationServiceID(input string) (*ConfigurationServiceId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationServiceId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.ConfigurationServiceName, ok = parsed.Parsed["configurationServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConfigurationServiceIDInsensitively(input string) (*ConfigurationServi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConfigurationServiceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.ConfigurationServiceName, ok = parsed.Parsed["configurationServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationServiceName", *parsed) + if id.ConfigurationServiceName, ok = input.Parsed["configurationServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationServiceName", input) } - return &id, nil + return nil } // ValidateConfigurationServiceID checks that 'input' can be parsed as a Configuration Service ID diff --git a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_containerregistry.go b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_containerregistry.go index 1066b596176..b69a8f3b412 100644 --- a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_containerregistry.go +++ b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_containerregistry.go @@ -38,23 +38,9 @@ func ParseContainerRegistryID(input string) (*ContainerRegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerRegistryId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.ContainerRegistryName, ok = parsed.Parsed["containerRegistryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerRegistryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseContainerRegistryIDInsensitively(input string) (*ContainerRegistryId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerRegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ContainerRegistryId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.ContainerRegistryName, ok = parsed.Parsed["containerRegistryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerRegistryName", *parsed) + if id.ContainerRegistryName, ok = input.Parsed["containerRegistryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerRegistryName", input) } - return &id, nil + return nil } // ValidateContainerRegistryID checks that 'input' can be parsed as a Container Registry ID diff --git a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_customizedaccelerator.go b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_customizedaccelerator.go index 82fa4c4fbfe..db5a1b4f697 100644 --- a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_customizedaccelerator.go +++ b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_customizedaccelerator.go @@ -40,27 +40,9 @@ func ParseCustomizedAcceleratorID(input string) (*CustomizedAcceleratorId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CustomizedAcceleratorId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.ApplicationAcceleratorName, ok = parsed.Parsed["applicationAcceleratorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationAcceleratorName", *parsed) - } - - if id.CustomizedAcceleratorName, ok = parsed.Parsed["customizedAcceleratorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "customizedAcceleratorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseCustomizedAcceleratorIDInsensitively(input string) (*CustomizedAcceler return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CustomizedAcceleratorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *CustomizedAcceleratorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.ApplicationAcceleratorName, ok = parsed.Parsed["applicationAcceleratorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationAcceleratorName", *parsed) + if id.ApplicationAcceleratorName, ok = input.Parsed["applicationAcceleratorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationAcceleratorName", input) } - if id.CustomizedAcceleratorName, ok = parsed.Parsed["customizedAcceleratorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "customizedAcceleratorName", *parsed) + if id.CustomizedAcceleratorName, ok = input.Parsed["customizedAcceleratorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "customizedAcceleratorName", input) } - return &id, nil + return nil } // ValidateCustomizedAcceleratorID checks that 'input' can be parsed as a Customized Accelerator ID diff --git a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_deployment.go b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_deployment.go index 761bbbcb7e9..948d2bc2791 100644 --- a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_deployment.go +++ b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_deployment.go @@ -40,27 +40,9 @@ func ParseDeploymentID(input string) (*DeploymentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeploymentId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.AppName, ok = parsed.Parsed["appName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "appName", *parsed) - } - - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseDeploymentIDInsensitively(input string) (*DeploymentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeploymentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DeploymentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.AppName, ok = parsed.Parsed["appName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "appName", *parsed) + if id.AppName, ok = input.Parsed["appName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "appName", input) } - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if id.DeploymentName, ok = input.Parsed["deploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", input) } - return &id, nil + return nil } // ValidateDeploymentID checks that 'input' can be parsed as a Deployment ID diff --git a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_devtoolportal.go b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_devtoolportal.go index 9bbc984db7c..3c1f4e236a8 100644 --- a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_devtoolportal.go +++ b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_devtoolportal.go @@ -38,23 +38,9 @@ func ParseDevToolPortalID(input string) (*DevToolPortalId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DevToolPortalId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.DevToolPortalName, ok = parsed.Parsed["devToolPortalName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "devToolPortalName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDevToolPortalIDInsensitively(input string) (*DevToolPortalId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DevToolPortalId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DevToolPortalId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.DevToolPortalName, ok = parsed.Parsed["devToolPortalName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "devToolPortalName", *parsed) + if id.DevToolPortalName, ok = input.Parsed["devToolPortalName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "devToolPortalName", input) } - return &id, nil + return nil } // ValidateDevToolPortalID checks that 'input' can be parsed as a Dev Tool Portal ID diff --git a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_domain.go b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_domain.go index cc296a7d0a8..d937c652e6f 100644 --- a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_domain.go +++ b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_domain.go @@ -40,27 +40,9 @@ func ParseDomainID(input string) (*DomainId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DomainId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.AppName, ok = parsed.Parsed["appName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "appName", *parsed) - } - - if id.DomainName, ok = parsed.Parsed["domainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseDomainIDInsensitively(input string) (*DomainId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DomainId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DomainId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.AppName, ok = parsed.Parsed["appName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "appName", *parsed) + if id.AppName, ok = input.Parsed["appName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "appName", input) } - if id.DomainName, ok = parsed.Parsed["domainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainName", *parsed) + if id.DomainName, ok = input.Parsed["domainName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "domainName", input) } - return &id, nil + return nil } // ValidateDomainID checks that 'input' can be parsed as a Domain ID diff --git a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_gateway.go b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_gateway.go index dadc41b3cd7..230c23dfb2b 100644 --- a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_gateway.go +++ b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_gateway.go @@ -38,23 +38,9 @@ func ParseGatewayID(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.GatewayName, ok = parsed.Parsed["gatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGatewayIDInsensitively(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GatewayId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.GatewayName, ok = parsed.Parsed["gatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayName", *parsed) + if id.GatewayName, ok = input.Parsed["gatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayName", input) } - return &id, nil + return nil } // ValidateGatewayID checks that 'input' can be parsed as a Gateway ID diff --git a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_gatewaydomain.go b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_gatewaydomain.go index 9092fa94792..7b6c60bea89 100644 --- a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_gatewaydomain.go +++ b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_gatewaydomain.go @@ -40,27 +40,9 @@ func ParseGatewayDomainID(input string) (*GatewayDomainId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayDomainId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.GatewayName, ok = parsed.Parsed["gatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayName", *parsed) - } - - if id.DomainName, ok = parsed.Parsed["domainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseGatewayDomainIDInsensitively(input string) (*GatewayDomainId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayDomainId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *GatewayDomainId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.GatewayName, ok = parsed.Parsed["gatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayName", *parsed) + if id.GatewayName, ok = input.Parsed["gatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayName", input) } - if id.DomainName, ok = parsed.Parsed["domainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainName", *parsed) + if id.DomainName, ok = input.Parsed["domainName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "domainName", input) } - return &id, nil + return nil } // ValidateGatewayDomainID checks that 'input' can be parsed as a Gateway Domain ID diff --git a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_location.go b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_location.go index 921d61c37e1..73de68cd2fc 100644 --- a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_location.go +++ b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_predefinedaccelerator.go b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_predefinedaccelerator.go index 48e7aa984b6..ae628f1db06 100644 --- a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_predefinedaccelerator.go +++ b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_predefinedaccelerator.go @@ -40,27 +40,9 @@ func ParsePredefinedAcceleratorID(input string) (*PredefinedAcceleratorId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PredefinedAcceleratorId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.ApplicationAcceleratorName, ok = parsed.Parsed["applicationAcceleratorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationAcceleratorName", *parsed) - } - - if id.PredefinedAcceleratorName, ok = parsed.Parsed["predefinedAcceleratorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "predefinedAcceleratorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParsePredefinedAcceleratorIDInsensitively(input string) (*PredefinedAcceler return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PredefinedAcceleratorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *PredefinedAcceleratorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.ApplicationAcceleratorName, ok = parsed.Parsed["applicationAcceleratorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationAcceleratorName", *parsed) + if id.ApplicationAcceleratorName, ok = input.Parsed["applicationAcceleratorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationAcceleratorName", input) } - if id.PredefinedAcceleratorName, ok = parsed.Parsed["predefinedAcceleratorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "predefinedAcceleratorName", *parsed) + if id.PredefinedAcceleratorName, ok = input.Parsed["predefinedAcceleratorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "predefinedAcceleratorName", input) } - return &id, nil + return nil } // ValidatePredefinedAcceleratorID checks that 'input' can be parsed as a Predefined Accelerator ID diff --git a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_result.go b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_result.go index 1e910fa5681..24b94f7a22f 100644 --- a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_result.go +++ b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_result.go @@ -42,31 +42,9 @@ func ParseResultID(input string) (*ResultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResultId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.BuildServiceName, ok = parsed.Parsed["buildServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", *parsed) - } - - if id.BuildName, ok = parsed.Parsed["buildName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildName", *parsed) - } - - if id.ResultName, ok = parsed.Parsed["resultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseResultIDInsensitively(input string) (*ResultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ResultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.BuildServiceName, ok = parsed.Parsed["buildServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", *parsed) + if id.BuildServiceName, ok = input.Parsed["buildServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", input) } - if id.BuildName, ok = parsed.Parsed["buildName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildName", *parsed) + if id.BuildName, ok = input.Parsed["buildName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "buildName", input) } - if id.ResultName, ok = parsed.Parsed["resultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resultName", *parsed) + if id.ResultName, ok = input.Parsed["resultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resultName", input) } - return &id, nil + return nil } // ValidateResultID checks that 'input' can be parsed as a Result ID diff --git a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_routeconfig.go b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_routeconfig.go index c4321531ea6..01fcb56f521 100644 --- a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_routeconfig.go +++ b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_routeconfig.go @@ -40,27 +40,9 @@ func ParseRouteConfigID(input string) (*RouteConfigId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteConfigId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.GatewayName, ok = parsed.Parsed["gatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayName", *parsed) - } - - if id.RouteConfigName, ok = parsed.Parsed["routeConfigName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeConfigName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseRouteConfigIDInsensitively(input string) (*RouteConfigId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteConfigId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RouteConfigId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.GatewayName, ok = parsed.Parsed["gatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayName", *parsed) + if id.GatewayName, ok = input.Parsed["gatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayName", input) } - if id.RouteConfigName, ok = parsed.Parsed["routeConfigName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeConfigName", *parsed) + if id.RouteConfigName, ok = input.Parsed["routeConfigName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routeConfigName", input) } - return &id, nil + return nil } // ValidateRouteConfigID checks that 'input' can be parsed as a Route Config ID diff --git a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_serviceregistry.go b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_serviceregistry.go index 32eab236c94..f0f0a758214 100644 --- a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_serviceregistry.go +++ b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_serviceregistry.go @@ -38,23 +38,9 @@ func ParseServiceRegistryID(input string) (*ServiceRegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceRegistryId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.ServiceRegistryName, ok = parsed.Parsed["serviceRegistryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceRegistryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseServiceRegistryIDInsensitively(input string) (*ServiceRegistryId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceRegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ServiceRegistryId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.ServiceRegistryName, ok = parsed.Parsed["serviceRegistryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceRegistryName", *parsed) + if id.ServiceRegistryName, ok = input.Parsed["serviceRegistryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceRegistryName", input) } - return &id, nil + return nil } // ValidateServiceRegistryID checks that 'input' can be parsed as a Service Registry ID diff --git a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_spring.go b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_spring.go index 9241aa92627..bc4a27d472e 100644 --- a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_spring.go +++ b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_spring.go @@ -36,19 +36,9 @@ func ParseSpringID(input string) (*SpringId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SpringId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSpringIDInsensitively(input string) (*SpringId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SpringId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SpringId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - return &id, nil + return nil } // ValidateSpringID checks that 'input' can be parsed as a Spring ID diff --git a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_storage.go b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_storage.go index 423ed346497..900787ffafd 100644 --- a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_storage.go +++ b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_storage.go @@ -38,23 +38,9 @@ func ParseStorageID(input string) (*StorageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.StorageName, ok = parsed.Parsed["storageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseStorageIDInsensitively(input string) (*StorageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *StorageId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.StorageName, ok = parsed.Parsed["storageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageName", *parsed) + if id.StorageName, ok = input.Parsed["storageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageName", input) } - return &id, nil + return nil } // ValidateStorageID checks that 'input' can be parsed as a Storage ID diff --git a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_supportedbuildpack.go b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_supportedbuildpack.go index 5ba143a8389..df3b85230f8 100644 --- a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_supportedbuildpack.go +++ b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_supportedbuildpack.go @@ -40,27 +40,9 @@ func ParseSupportedBuildPackID(input string) (*SupportedBuildPackId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SupportedBuildPackId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.BuildServiceName, ok = parsed.Parsed["buildServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", *parsed) - } - - if id.SupportedBuildPackName, ok = parsed.Parsed["supportedBuildPackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "supportedBuildPackName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSupportedBuildPackIDInsensitively(input string) (*SupportedBuildPackId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SupportedBuildPackId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SupportedBuildPackId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.BuildServiceName, ok = parsed.Parsed["buildServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", *parsed) + if id.BuildServiceName, ok = input.Parsed["buildServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", input) } - if id.SupportedBuildPackName, ok = parsed.Parsed["supportedBuildPackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "supportedBuildPackName", *parsed) + if id.SupportedBuildPackName, ok = input.Parsed["supportedBuildPackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "supportedBuildPackName", input) } - return &id, nil + return nil } // ValidateSupportedBuildPackID checks that 'input' can be parsed as a Supported Build Pack ID diff --git a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_supportedstack.go b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_supportedstack.go index b840619a7c5..f01b495a377 100644 --- a/resource-manager/appplatform/2023-07-01-preview/appplatform/id_supportedstack.go +++ b/resource-manager/appplatform/2023-07-01-preview/appplatform/id_supportedstack.go @@ -40,27 +40,9 @@ func ParseSupportedStackID(input string) (*SupportedStackId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SupportedStackId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.BuildServiceName, ok = parsed.Parsed["buildServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", *parsed) - } - - if id.SupportedStackName, ok = parsed.Parsed["supportedStackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "supportedStackName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSupportedStackIDInsensitively(input string) (*SupportedStackId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SupportedStackId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SupportedStackId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.BuildServiceName, ok = parsed.Parsed["buildServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", *parsed) + if id.BuildServiceName, ok = input.Parsed["buildServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", input) } - if id.SupportedStackName, ok = parsed.Parsed["supportedStackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "supportedStackName", *parsed) + if id.SupportedStackName, ok = input.Parsed["supportedStackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "supportedStackName", input) } - return &id, nil + return nil } // ValidateSupportedStackID checks that 'input' can be parsed as a Supported Stack ID diff --git a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_agentpool.go b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_agentpool.go index 2c3d6545f54..4e88e61ff4b 100644 --- a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_agentpool.go +++ b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_agentpool.go @@ -40,27 +40,9 @@ func ParseAgentPoolID(input string) (*AgentPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AgentPoolId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.BuildServiceName, ok = parsed.Parsed["buildServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", *parsed) - } - - if id.AgentPoolName, ok = parsed.Parsed["agentPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "agentPoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseAgentPoolIDInsensitively(input string) (*AgentPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AgentPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *AgentPoolId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.BuildServiceName, ok = parsed.Parsed["buildServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", *parsed) + if id.BuildServiceName, ok = input.Parsed["buildServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", input) } - if id.AgentPoolName, ok = parsed.Parsed["agentPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "agentPoolName", *parsed) + if id.AgentPoolName, ok = input.Parsed["agentPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "agentPoolName", input) } - return &id, nil + return nil } // ValidateAgentPoolID checks that 'input' can be parsed as a Agent Pool ID diff --git a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_apiportal.go b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_apiportal.go index a503b92a287..faad4673814 100644 --- a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_apiportal.go +++ b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_apiportal.go @@ -38,23 +38,9 @@ func ParseApiPortalID(input string) (*ApiPortalId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiPortalId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.ApiPortalName, ok = parsed.Parsed["apiPortalName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiPortalName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiPortalIDInsensitively(input string) (*ApiPortalId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiPortalId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiPortalId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.ApiPortalName, ok = parsed.Parsed["apiPortalName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiPortalName", *parsed) + if id.ApiPortalName, ok = input.Parsed["apiPortalName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiPortalName", input) } - return &id, nil + return nil } // ValidateApiPortalID checks that 'input' can be parsed as a Api Portal ID diff --git a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_apiportaldomain.go b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_apiportaldomain.go index 7772d26d4f6..a3434b26654 100644 --- a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_apiportaldomain.go +++ b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_apiportaldomain.go @@ -40,27 +40,9 @@ func ParseApiPortalDomainID(input string) (*ApiPortalDomainId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiPortalDomainId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.ApiPortalName, ok = parsed.Parsed["apiPortalName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiPortalName", *parsed) - } - - if id.DomainName, ok = parsed.Parsed["domainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseApiPortalDomainIDInsensitively(input string) (*ApiPortalDomainId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiPortalDomainId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ApiPortalDomainId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.ApiPortalName, ok = parsed.Parsed["apiPortalName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiPortalName", *parsed) + if id.ApiPortalName, ok = input.Parsed["apiPortalName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiPortalName", input) } - if id.DomainName, ok = parsed.Parsed["domainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainName", *parsed) + if id.DomainName, ok = input.Parsed["domainName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "domainName", input) } - return &id, nil + return nil } // ValidateApiPortalDomainID checks that 'input' can be parsed as a Api Portal Domain ID diff --git a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_apm.go b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_apm.go index df03f3b0ad8..1f0db0dbe95 100644 --- a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_apm.go +++ b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_apm.go @@ -38,23 +38,9 @@ func ParseApmID(input string) (*ApmId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApmId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.ApmName, ok = parsed.Parsed["apmName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apmName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApmIDInsensitively(input string) (*ApmId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApmId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApmId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.ApmName, ok = parsed.Parsed["apmName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apmName", *parsed) + if id.ApmName, ok = input.Parsed["apmName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apmName", input) } - return &id, nil + return nil } // ValidateApmID checks that 'input' can be parsed as a Apm ID diff --git a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_app.go b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_app.go index 0c9cf467702..5df0ab5cba3 100644 --- a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_app.go +++ b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_app.go @@ -38,23 +38,9 @@ func ParseAppID(input string) (*AppId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AppId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.AppName, ok = parsed.Parsed["appName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "appName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAppIDInsensitively(input string) (*AppId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AppId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AppId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.AppName, ok = parsed.Parsed["appName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "appName", *parsed) + if id.AppName, ok = input.Parsed["appName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "appName", input) } - return &id, nil + return nil } // ValidateAppID checks that 'input' can be parsed as a App ID diff --git a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_applicationaccelerator.go b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_applicationaccelerator.go index a154cd0e316..65c43b92c43 100644 --- a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_applicationaccelerator.go +++ b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_applicationaccelerator.go @@ -38,23 +38,9 @@ func ParseApplicationAcceleratorID(input string) (*ApplicationAcceleratorId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationAcceleratorId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.ApplicationAcceleratorName, ok = parsed.Parsed["applicationAcceleratorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationAcceleratorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApplicationAcceleratorIDInsensitively(input string) (*ApplicationAccel return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationAcceleratorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApplicationAcceleratorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.ApplicationAcceleratorName, ok = parsed.Parsed["applicationAcceleratorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationAcceleratorName", *parsed) + if id.ApplicationAcceleratorName, ok = input.Parsed["applicationAcceleratorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationAcceleratorName", input) } - return &id, nil + return nil } // ValidateApplicationAcceleratorID checks that 'input' can be parsed as a Application Accelerator ID diff --git a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_applicationliveview.go b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_applicationliveview.go index fe403dece92..db3c4d7af5a 100644 --- a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_applicationliveview.go +++ b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_applicationliveview.go @@ -38,23 +38,9 @@ func ParseApplicationLiveViewID(input string) (*ApplicationLiveViewId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationLiveViewId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.ApplicationLiveViewName, ok = parsed.Parsed["applicationLiveViewName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationLiveViewName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApplicationLiveViewIDInsensitively(input string) (*ApplicationLiveView return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationLiveViewId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApplicationLiveViewId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.ApplicationLiveViewName, ok = parsed.Parsed["applicationLiveViewName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationLiveViewName", *parsed) + if id.ApplicationLiveViewName, ok = input.Parsed["applicationLiveViewName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationLiveViewName", input) } - return &id, nil + return nil } // ValidateApplicationLiveViewID checks that 'input' can be parsed as a Application Live View ID diff --git a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_binding.go b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_binding.go index 7978075b54b..96f785290fd 100644 --- a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_binding.go +++ b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_binding.go @@ -40,27 +40,9 @@ func ParseBindingID(input string) (*BindingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BindingId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.AppName, ok = parsed.Parsed["appName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "appName", *parsed) - } - - if id.BindingName, ok = parsed.Parsed["bindingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bindingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseBindingIDInsensitively(input string) (*BindingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BindingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *BindingId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.AppName, ok = parsed.Parsed["appName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "appName", *parsed) + if id.AppName, ok = input.Parsed["appName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "appName", input) } - if id.BindingName, ok = parsed.Parsed["bindingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bindingName", *parsed) + if id.BindingName, ok = input.Parsed["bindingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "bindingName", input) } - return &id, nil + return nil } // ValidateBindingID checks that 'input' can be parsed as a Binding ID diff --git a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_build.go b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_build.go index 2fed396fb88..64699292291 100644 --- a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_build.go +++ b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_build.go @@ -40,27 +40,9 @@ func ParseBuildID(input string) (*BuildId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BuildId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.BuildServiceName, ok = parsed.Parsed["buildServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", *parsed) - } - - if id.BuildName, ok = parsed.Parsed["buildName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseBuildIDInsensitively(input string) (*BuildId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BuildId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *BuildId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.BuildServiceName, ok = parsed.Parsed["buildServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", *parsed) + if id.BuildServiceName, ok = input.Parsed["buildServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", input) } - if id.BuildName, ok = parsed.Parsed["buildName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildName", *parsed) + if id.BuildName, ok = input.Parsed["buildName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "buildName", input) } - return &id, nil + return nil } // ValidateBuildID checks that 'input' can be parsed as a Build ID diff --git a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_builder.go b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_builder.go index 1a3a013ed4b..3db6d55a43e 100644 --- a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_builder.go +++ b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_builder.go @@ -40,27 +40,9 @@ func ParseBuilderID(input string) (*BuilderId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BuilderId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.BuildServiceName, ok = parsed.Parsed["buildServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", *parsed) - } - - if id.BuilderName, ok = parsed.Parsed["builderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "builderName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseBuilderIDInsensitively(input string) (*BuilderId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BuilderId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *BuilderId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.BuildServiceName, ok = parsed.Parsed["buildServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", *parsed) + if id.BuildServiceName, ok = input.Parsed["buildServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", input) } - if id.BuilderName, ok = parsed.Parsed["builderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "builderName", *parsed) + if id.BuilderName, ok = input.Parsed["builderName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "builderName", input) } - return &id, nil + return nil } // ValidateBuilderID checks that 'input' can be parsed as a Builder ID diff --git a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_buildpackbinding.go b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_buildpackbinding.go index 0c0969bf728..634738440e3 100644 --- a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_buildpackbinding.go +++ b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_buildpackbinding.go @@ -42,31 +42,9 @@ func ParseBuildPackBindingID(input string) (*BuildPackBindingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BuildPackBindingId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.BuildServiceName, ok = parsed.Parsed["buildServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", *parsed) - } - - if id.BuilderName, ok = parsed.Parsed["builderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "builderName", *parsed) - } - - if id.BuildPackBindingName, ok = parsed.Parsed["buildPackBindingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildPackBindingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseBuildPackBindingIDInsensitively(input string) (*BuildPackBindingId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BuildPackBindingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *BuildPackBindingId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.BuildServiceName, ok = parsed.Parsed["buildServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", *parsed) + if id.BuildServiceName, ok = input.Parsed["buildServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", input) } - if id.BuilderName, ok = parsed.Parsed["builderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "builderName", *parsed) + if id.BuilderName, ok = input.Parsed["builderName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "builderName", input) } - if id.BuildPackBindingName, ok = parsed.Parsed["buildPackBindingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildPackBindingName", *parsed) + if id.BuildPackBindingName, ok = input.Parsed["buildPackBindingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "buildPackBindingName", input) } - return &id, nil + return nil } // ValidateBuildPackBindingID checks that 'input' can be parsed as a Build Pack Binding ID diff --git a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_buildservice.go b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_buildservice.go index b6331a77da4..aa1fdece06e 100644 --- a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_buildservice.go +++ b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_buildservice.go @@ -38,23 +38,9 @@ func ParseBuildServiceID(input string) (*BuildServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BuildServiceId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.BuildServiceName, ok = parsed.Parsed["buildServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBuildServiceIDInsensitively(input string) (*BuildServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BuildServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BuildServiceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.BuildServiceName, ok = parsed.Parsed["buildServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", *parsed) + if id.BuildServiceName, ok = input.Parsed["buildServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", input) } - return &id, nil + return nil } // ValidateBuildServiceID checks that 'input' can be parsed as a Build Service ID diff --git a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_certificate.go b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_certificate.go index 7b21881fbcf..c0451f184e0 100644 --- a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_certificate.go +++ b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_certificate.go @@ -38,23 +38,9 @@ func ParseCertificateID(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCertificateIDInsensitively(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if id.CertificateName, ok = input.Parsed["certificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateName", input) } - return &id, nil + return nil } // ValidateCertificateID checks that 'input' can be parsed as a Certificate ID diff --git a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_configurationservice.go b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_configurationservice.go index 33ee1ed5932..cf886a64e73 100644 --- a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_configurationservice.go +++ b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_configurationservice.go @@ -38,23 +38,9 @@ func ParseConfigurationServiceID(input string) (*ConfigurationServiceId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationServiceId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.ConfigurationServiceName, ok = parsed.Parsed["configurationServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConfigurationServiceIDInsensitively(input string) (*ConfigurationServi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConfigurationServiceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.ConfigurationServiceName, ok = parsed.Parsed["configurationServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationServiceName", *parsed) + if id.ConfigurationServiceName, ok = input.Parsed["configurationServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationServiceName", input) } - return &id, nil + return nil } // ValidateConfigurationServiceID checks that 'input' can be parsed as a Configuration Service ID diff --git a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_containerregistry.go b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_containerregistry.go index 1066b596176..b69a8f3b412 100644 --- a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_containerregistry.go +++ b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_containerregistry.go @@ -38,23 +38,9 @@ func ParseContainerRegistryID(input string) (*ContainerRegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerRegistryId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.ContainerRegistryName, ok = parsed.Parsed["containerRegistryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerRegistryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseContainerRegistryIDInsensitively(input string) (*ContainerRegistryId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerRegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ContainerRegistryId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.ContainerRegistryName, ok = parsed.Parsed["containerRegistryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerRegistryName", *parsed) + if id.ContainerRegistryName, ok = input.Parsed["containerRegistryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerRegistryName", input) } - return &id, nil + return nil } // ValidateContainerRegistryID checks that 'input' can be parsed as a Container Registry ID diff --git a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_customizedaccelerator.go b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_customizedaccelerator.go index 82fa4c4fbfe..db5a1b4f697 100644 --- a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_customizedaccelerator.go +++ b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_customizedaccelerator.go @@ -40,27 +40,9 @@ func ParseCustomizedAcceleratorID(input string) (*CustomizedAcceleratorId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CustomizedAcceleratorId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.ApplicationAcceleratorName, ok = parsed.Parsed["applicationAcceleratorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationAcceleratorName", *parsed) - } - - if id.CustomizedAcceleratorName, ok = parsed.Parsed["customizedAcceleratorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "customizedAcceleratorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseCustomizedAcceleratorIDInsensitively(input string) (*CustomizedAcceler return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CustomizedAcceleratorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *CustomizedAcceleratorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.ApplicationAcceleratorName, ok = parsed.Parsed["applicationAcceleratorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationAcceleratorName", *parsed) + if id.ApplicationAcceleratorName, ok = input.Parsed["applicationAcceleratorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationAcceleratorName", input) } - if id.CustomizedAcceleratorName, ok = parsed.Parsed["customizedAcceleratorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "customizedAcceleratorName", *parsed) + if id.CustomizedAcceleratorName, ok = input.Parsed["customizedAcceleratorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "customizedAcceleratorName", input) } - return &id, nil + return nil } // ValidateCustomizedAcceleratorID checks that 'input' can be parsed as a Customized Accelerator ID diff --git a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_deployment.go b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_deployment.go index 761bbbcb7e9..948d2bc2791 100644 --- a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_deployment.go +++ b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_deployment.go @@ -40,27 +40,9 @@ func ParseDeploymentID(input string) (*DeploymentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeploymentId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.AppName, ok = parsed.Parsed["appName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "appName", *parsed) - } - - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseDeploymentIDInsensitively(input string) (*DeploymentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeploymentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DeploymentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.AppName, ok = parsed.Parsed["appName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "appName", *parsed) + if id.AppName, ok = input.Parsed["appName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "appName", input) } - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if id.DeploymentName, ok = input.Parsed["deploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", input) } - return &id, nil + return nil } // ValidateDeploymentID checks that 'input' can be parsed as a Deployment ID diff --git a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_devtoolportal.go b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_devtoolportal.go index 9bbc984db7c..3c1f4e236a8 100644 --- a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_devtoolportal.go +++ b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_devtoolportal.go @@ -38,23 +38,9 @@ func ParseDevToolPortalID(input string) (*DevToolPortalId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DevToolPortalId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.DevToolPortalName, ok = parsed.Parsed["devToolPortalName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "devToolPortalName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDevToolPortalIDInsensitively(input string) (*DevToolPortalId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DevToolPortalId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DevToolPortalId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.DevToolPortalName, ok = parsed.Parsed["devToolPortalName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "devToolPortalName", *parsed) + if id.DevToolPortalName, ok = input.Parsed["devToolPortalName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "devToolPortalName", input) } - return &id, nil + return nil } // ValidateDevToolPortalID checks that 'input' can be parsed as a Dev Tool Portal ID diff --git a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_domain.go b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_domain.go index cc296a7d0a8..d937c652e6f 100644 --- a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_domain.go +++ b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_domain.go @@ -40,27 +40,9 @@ func ParseDomainID(input string) (*DomainId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DomainId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.AppName, ok = parsed.Parsed["appName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "appName", *parsed) - } - - if id.DomainName, ok = parsed.Parsed["domainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseDomainIDInsensitively(input string) (*DomainId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DomainId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DomainId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.AppName, ok = parsed.Parsed["appName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "appName", *parsed) + if id.AppName, ok = input.Parsed["appName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "appName", input) } - if id.DomainName, ok = parsed.Parsed["domainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainName", *parsed) + if id.DomainName, ok = input.Parsed["domainName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "domainName", input) } - return &id, nil + return nil } // ValidateDomainID checks that 'input' can be parsed as a Domain ID diff --git a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_gateway.go b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_gateway.go index dadc41b3cd7..230c23dfb2b 100644 --- a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_gateway.go +++ b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_gateway.go @@ -38,23 +38,9 @@ func ParseGatewayID(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.GatewayName, ok = parsed.Parsed["gatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGatewayIDInsensitively(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GatewayId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.GatewayName, ok = parsed.Parsed["gatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayName", *parsed) + if id.GatewayName, ok = input.Parsed["gatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayName", input) } - return &id, nil + return nil } // ValidateGatewayID checks that 'input' can be parsed as a Gateway ID diff --git a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_gatewaydomain.go b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_gatewaydomain.go index 9092fa94792..7b6c60bea89 100644 --- a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_gatewaydomain.go +++ b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_gatewaydomain.go @@ -40,27 +40,9 @@ func ParseGatewayDomainID(input string) (*GatewayDomainId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayDomainId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.GatewayName, ok = parsed.Parsed["gatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayName", *parsed) - } - - if id.DomainName, ok = parsed.Parsed["domainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseGatewayDomainIDInsensitively(input string) (*GatewayDomainId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayDomainId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *GatewayDomainId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.GatewayName, ok = parsed.Parsed["gatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayName", *parsed) + if id.GatewayName, ok = input.Parsed["gatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayName", input) } - if id.DomainName, ok = parsed.Parsed["domainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainName", *parsed) + if id.DomainName, ok = input.Parsed["domainName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "domainName", input) } - return &id, nil + return nil } // ValidateGatewayDomainID checks that 'input' can be parsed as a Gateway Domain ID diff --git a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_location.go b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_location.go index 921d61c37e1..73de68cd2fc 100644 --- a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_location.go +++ b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_predefinedaccelerator.go b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_predefinedaccelerator.go index 48e7aa984b6..ae628f1db06 100644 --- a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_predefinedaccelerator.go +++ b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_predefinedaccelerator.go @@ -40,27 +40,9 @@ func ParsePredefinedAcceleratorID(input string) (*PredefinedAcceleratorId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PredefinedAcceleratorId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.ApplicationAcceleratorName, ok = parsed.Parsed["applicationAcceleratorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationAcceleratorName", *parsed) - } - - if id.PredefinedAcceleratorName, ok = parsed.Parsed["predefinedAcceleratorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "predefinedAcceleratorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParsePredefinedAcceleratorIDInsensitively(input string) (*PredefinedAcceler return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PredefinedAcceleratorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *PredefinedAcceleratorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.ApplicationAcceleratorName, ok = parsed.Parsed["applicationAcceleratorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationAcceleratorName", *parsed) + if id.ApplicationAcceleratorName, ok = input.Parsed["applicationAcceleratorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationAcceleratorName", input) } - if id.PredefinedAcceleratorName, ok = parsed.Parsed["predefinedAcceleratorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "predefinedAcceleratorName", *parsed) + if id.PredefinedAcceleratorName, ok = input.Parsed["predefinedAcceleratorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "predefinedAcceleratorName", input) } - return &id, nil + return nil } // ValidatePredefinedAcceleratorID checks that 'input' can be parsed as a Predefined Accelerator ID diff --git a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_result.go b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_result.go index 1e910fa5681..24b94f7a22f 100644 --- a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_result.go +++ b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_result.go @@ -42,31 +42,9 @@ func ParseResultID(input string) (*ResultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResultId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.BuildServiceName, ok = parsed.Parsed["buildServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", *parsed) - } - - if id.BuildName, ok = parsed.Parsed["buildName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildName", *parsed) - } - - if id.ResultName, ok = parsed.Parsed["resultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseResultIDInsensitively(input string) (*ResultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ResultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.BuildServiceName, ok = parsed.Parsed["buildServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", *parsed) + if id.BuildServiceName, ok = input.Parsed["buildServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", input) } - if id.BuildName, ok = parsed.Parsed["buildName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildName", *parsed) + if id.BuildName, ok = input.Parsed["buildName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "buildName", input) } - if id.ResultName, ok = parsed.Parsed["resultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resultName", *parsed) + if id.ResultName, ok = input.Parsed["resultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resultName", input) } - return &id, nil + return nil } // ValidateResultID checks that 'input' can be parsed as a Result ID diff --git a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_routeconfig.go b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_routeconfig.go index c4321531ea6..01fcb56f521 100644 --- a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_routeconfig.go +++ b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_routeconfig.go @@ -40,27 +40,9 @@ func ParseRouteConfigID(input string) (*RouteConfigId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteConfigId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.GatewayName, ok = parsed.Parsed["gatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayName", *parsed) - } - - if id.RouteConfigName, ok = parsed.Parsed["routeConfigName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeConfigName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseRouteConfigIDInsensitively(input string) (*RouteConfigId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteConfigId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RouteConfigId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.GatewayName, ok = parsed.Parsed["gatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayName", *parsed) + if id.GatewayName, ok = input.Parsed["gatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayName", input) } - if id.RouteConfigName, ok = parsed.Parsed["routeConfigName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeConfigName", *parsed) + if id.RouteConfigName, ok = input.Parsed["routeConfigName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routeConfigName", input) } - return &id, nil + return nil } // ValidateRouteConfigID checks that 'input' can be parsed as a Route Config ID diff --git a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_serviceregistry.go b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_serviceregistry.go index 32eab236c94..f0f0a758214 100644 --- a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_serviceregistry.go +++ b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_serviceregistry.go @@ -38,23 +38,9 @@ func ParseServiceRegistryID(input string) (*ServiceRegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceRegistryId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.ServiceRegistryName, ok = parsed.Parsed["serviceRegistryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceRegistryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseServiceRegistryIDInsensitively(input string) (*ServiceRegistryId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceRegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ServiceRegistryId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.ServiceRegistryName, ok = parsed.Parsed["serviceRegistryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceRegistryName", *parsed) + if id.ServiceRegistryName, ok = input.Parsed["serviceRegistryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceRegistryName", input) } - return &id, nil + return nil } // ValidateServiceRegistryID checks that 'input' can be parsed as a Service Registry ID diff --git a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_spring.go b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_spring.go index 9241aa92627..bc4a27d472e 100644 --- a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_spring.go +++ b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_spring.go @@ -36,19 +36,9 @@ func ParseSpringID(input string) (*SpringId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SpringId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSpringIDInsensitively(input string) (*SpringId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SpringId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SpringId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - return &id, nil + return nil } // ValidateSpringID checks that 'input' can be parsed as a Spring ID diff --git a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_storage.go b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_storage.go index 423ed346497..900787ffafd 100644 --- a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_storage.go +++ b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_storage.go @@ -38,23 +38,9 @@ func ParseStorageID(input string) (*StorageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.StorageName, ok = parsed.Parsed["storageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseStorageIDInsensitively(input string) (*StorageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *StorageId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.StorageName, ok = parsed.Parsed["storageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageName", *parsed) + if id.StorageName, ok = input.Parsed["storageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageName", input) } - return &id, nil + return nil } // ValidateStorageID checks that 'input' can be parsed as a Storage ID diff --git a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_supportedbuildpack.go b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_supportedbuildpack.go index 5ba143a8389..df3b85230f8 100644 --- a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_supportedbuildpack.go +++ b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_supportedbuildpack.go @@ -40,27 +40,9 @@ func ParseSupportedBuildPackID(input string) (*SupportedBuildPackId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SupportedBuildPackId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.BuildServiceName, ok = parsed.Parsed["buildServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", *parsed) - } - - if id.SupportedBuildPackName, ok = parsed.Parsed["supportedBuildPackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "supportedBuildPackName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSupportedBuildPackIDInsensitively(input string) (*SupportedBuildPackId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SupportedBuildPackId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SupportedBuildPackId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.BuildServiceName, ok = parsed.Parsed["buildServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", *parsed) + if id.BuildServiceName, ok = input.Parsed["buildServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", input) } - if id.SupportedBuildPackName, ok = parsed.Parsed["supportedBuildPackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "supportedBuildPackName", *parsed) + if id.SupportedBuildPackName, ok = input.Parsed["supportedBuildPackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "supportedBuildPackName", input) } - return &id, nil + return nil } // ValidateSupportedBuildPackID checks that 'input' can be parsed as a Supported Build Pack ID diff --git a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_supportedstack.go b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_supportedstack.go index b840619a7c5..f01b495a377 100644 --- a/resource-manager/appplatform/2023-09-01-preview/appplatform/id_supportedstack.go +++ b/resource-manager/appplatform/2023-09-01-preview/appplatform/id_supportedstack.go @@ -40,27 +40,9 @@ func ParseSupportedStackID(input string) (*SupportedStackId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SupportedStackId{} - - 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.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) - } - - if id.BuildServiceName, ok = parsed.Parsed["buildServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", *parsed) - } - - if id.SupportedStackName, ok = parsed.Parsed["supportedStackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "supportedStackName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSupportedStackIDInsensitively(input string) (*SupportedStackId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SupportedStackId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SupportedStackId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpringName, ok = parsed.Parsed["springName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "springName", *parsed) + if id.SpringName, ok = input.Parsed["springName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "springName", input) } - if id.BuildServiceName, ok = parsed.Parsed["buildServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", *parsed) + if id.BuildServiceName, ok = input.Parsed["buildServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "buildServiceName", input) } - if id.SupportedStackName, ok = parsed.Parsed["supportedStackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "supportedStackName", *parsed) + if id.SupportedStackName, ok = input.Parsed["supportedStackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "supportedStackName", input) } - return &id, nil + return nil } // ValidateSupportedStackID checks that 'input' can be parsed as a Supported Stack ID diff --git a/resource-manager/attestation/2020-10-01/attestationproviders/id_attestationproviders.go b/resource-manager/attestation/2020-10-01/attestationproviders/id_attestationproviders.go index 6caef6da48a..2b9db62e5c2 100644 --- a/resource-manager/attestation/2020-10-01/attestationproviders/id_attestationproviders.go +++ b/resource-manager/attestation/2020-10-01/attestationproviders/id_attestationproviders.go @@ -36,19 +36,9 @@ func ParseAttestationProvidersID(input string) (*AttestationProvidersId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AttestationProvidersId{} - - 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.AttestationProviderName, ok = parsed.Parsed["attestationProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "attestationProviderName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAttestationProvidersIDInsensitively(input string) (*AttestationProvide return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AttestationProvidersId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AttestationProvidersId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AttestationProviderName, ok = parsed.Parsed["attestationProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "attestationProviderName", *parsed) + if id.AttestationProviderName, ok = input.Parsed["attestationProviderName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "attestationProviderName", input) } - return &id, nil + return nil } // ValidateAttestationProvidersID checks that 'input' can be parsed as a Attestation Providers ID diff --git a/resource-manager/attestation/2020-10-01/attestationproviders/id_location.go b/resource-manager/attestation/2020-10-01/attestationproviders/id_location.go index 9bd8033e347..0a371ed4c90 100644 --- a/resource-manager/attestation/2020-10-01/attestationproviders/id_location.go +++ b/resource-manager/attestation/2020-10-01/attestationproviders/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/attestation/2020-10-01/privateendpointconnections/id_attestationproviders.go b/resource-manager/attestation/2020-10-01/privateendpointconnections/id_attestationproviders.go index 1a647daf0f1..7a3290846c8 100644 --- a/resource-manager/attestation/2020-10-01/privateendpointconnections/id_attestationproviders.go +++ b/resource-manager/attestation/2020-10-01/privateendpointconnections/id_attestationproviders.go @@ -36,19 +36,9 @@ func ParseAttestationProvidersID(input string) (*AttestationProvidersId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AttestationProvidersId{} - - 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.AttestationProviderName, ok = parsed.Parsed["attestationProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "attestationProviderName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAttestationProvidersIDInsensitively(input string) (*AttestationProvide return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AttestationProvidersId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AttestationProvidersId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AttestationProviderName, ok = parsed.Parsed["attestationProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "attestationProviderName", *parsed) + if id.AttestationProviderName, ok = input.Parsed["attestationProviderName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "attestationProviderName", input) } - return &id, nil + return nil } // ValidateAttestationProvidersID checks that 'input' can be parsed as a Attestation Providers ID diff --git a/resource-manager/attestation/2020-10-01/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/attestation/2020-10-01/privateendpointconnections/id_privateendpointconnection.go index 4da5eb01a46..5bf1484536f 100644 --- a/resource-manager/attestation/2020-10-01/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/attestation/2020-10-01/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.AttestationProviderName, ok = parsed.Parsed["attestationProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "attestationProviderName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AttestationProviderName, ok = parsed.Parsed["attestationProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "attestationProviderName", *parsed) + if id.AttestationProviderName, ok = input.Parsed["attestationProviderName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "attestationProviderName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/attestation/2021-06-01/attestationproviders/id_attestationproviders.go b/resource-manager/attestation/2021-06-01/attestationproviders/id_attestationproviders.go index 6caef6da48a..2b9db62e5c2 100644 --- a/resource-manager/attestation/2021-06-01/attestationproviders/id_attestationproviders.go +++ b/resource-manager/attestation/2021-06-01/attestationproviders/id_attestationproviders.go @@ -36,19 +36,9 @@ func ParseAttestationProvidersID(input string) (*AttestationProvidersId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AttestationProvidersId{} - - 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.AttestationProviderName, ok = parsed.Parsed["attestationProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "attestationProviderName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAttestationProvidersIDInsensitively(input string) (*AttestationProvide return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AttestationProvidersId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AttestationProvidersId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AttestationProviderName, ok = parsed.Parsed["attestationProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "attestationProviderName", *parsed) + if id.AttestationProviderName, ok = input.Parsed["attestationProviderName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "attestationProviderName", input) } - return &id, nil + return nil } // ValidateAttestationProvidersID checks that 'input' can be parsed as a Attestation Providers ID diff --git a/resource-manager/attestation/2021-06-01/attestationproviders/id_location.go b/resource-manager/attestation/2021-06-01/attestationproviders/id_location.go index 9bd8033e347..0a371ed4c90 100644 --- a/resource-manager/attestation/2021-06-01/attestationproviders/id_location.go +++ b/resource-manager/attestation/2021-06-01/attestationproviders/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/attestation/2021-06-01/privateendpointconnections/id_attestationproviders.go b/resource-manager/attestation/2021-06-01/privateendpointconnections/id_attestationproviders.go index 1a647daf0f1..7a3290846c8 100644 --- a/resource-manager/attestation/2021-06-01/privateendpointconnections/id_attestationproviders.go +++ b/resource-manager/attestation/2021-06-01/privateendpointconnections/id_attestationproviders.go @@ -36,19 +36,9 @@ func ParseAttestationProvidersID(input string) (*AttestationProvidersId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AttestationProvidersId{} - - 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.AttestationProviderName, ok = parsed.Parsed["attestationProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "attestationProviderName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAttestationProvidersIDInsensitively(input string) (*AttestationProvide return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AttestationProvidersId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AttestationProvidersId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AttestationProviderName, ok = parsed.Parsed["attestationProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "attestationProviderName", *parsed) + if id.AttestationProviderName, ok = input.Parsed["attestationProviderName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "attestationProviderName", input) } - return &id, nil + return nil } // ValidateAttestationProvidersID checks that 'input' can be parsed as a Attestation Providers ID diff --git a/resource-manager/attestation/2021-06-01/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/attestation/2021-06-01/privateendpointconnections/id_privateendpointconnection.go index 4da5eb01a46..5bf1484536f 100644 --- a/resource-manager/attestation/2021-06-01/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/attestation/2021-06-01/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.AttestationProviderName, ok = parsed.Parsed["attestationProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "attestationProviderName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AttestationProviderName, ok = parsed.Parsed["attestationProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "attestationProviderName", *parsed) + if id.AttestationProviderName, ok = input.Parsed["attestationProviderName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "attestationProviderName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/attestation/2021-06-01/privatelinkresources/id_attestationproviders.go b/resource-manager/attestation/2021-06-01/privatelinkresources/id_attestationproviders.go index 37c78ffaca5..a85a898ee47 100644 --- a/resource-manager/attestation/2021-06-01/privatelinkresources/id_attestationproviders.go +++ b/resource-manager/attestation/2021-06-01/privatelinkresources/id_attestationproviders.go @@ -36,19 +36,9 @@ func ParseAttestationProvidersID(input string) (*AttestationProvidersId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AttestationProvidersId{} - - 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.AttestationProviderName, ok = parsed.Parsed["attestationProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "attestationProviderName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAttestationProvidersIDInsensitively(input string) (*AttestationProvide return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AttestationProvidersId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AttestationProvidersId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AttestationProviderName, ok = parsed.Parsed["attestationProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "attestationProviderName", *parsed) + if id.AttestationProviderName, ok = input.Parsed["attestationProviderName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "attestationProviderName", input) } - return &id, nil + return nil } // ValidateAttestationProvidersID checks that 'input' can be parsed as a Attestation Providers ID diff --git a/resource-manager/authorization/2020-10-01/roleassignmentscheduleinstances/id_scopedroleassignmentscheduleinstance.go b/resource-manager/authorization/2020-10-01/roleassignmentscheduleinstances/id_scopedroleassignmentscheduleinstance.go index b5ee5c6d8c1..651c1c23295 100644 --- a/resource-manager/authorization/2020-10-01/roleassignmentscheduleinstances/id_scopedroleassignmentscheduleinstance.go +++ b/resource-manager/authorization/2020-10-01/roleassignmentscheduleinstances/id_scopedroleassignmentscheduleinstance.go @@ -34,15 +34,9 @@ func ParseScopedRoleAssignmentScheduleInstanceID(input string) (*ScopedRoleAssig return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedRoleAssignmentScheduleInstanceId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.RoleAssignmentScheduleInstanceName, ok = parsed.Parsed["roleAssignmentScheduleInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleAssignmentScheduleInstanceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedRoleAssignmentScheduleInstanceIDInsensitively(input string) (*Sc return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedRoleAssignmentScheduleInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedRoleAssignmentScheduleInstanceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.RoleAssignmentScheduleInstanceName, ok = parsed.Parsed["roleAssignmentScheduleInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleAssignmentScheduleInstanceName", *parsed) + if id.RoleAssignmentScheduleInstanceName, ok = input.Parsed["roleAssignmentScheduleInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "roleAssignmentScheduleInstanceName", input) } - return &id, nil + return nil } // ValidateScopedRoleAssignmentScheduleInstanceID checks that 'input' can be parsed as a Scoped Role Assignment Schedule Instance ID diff --git a/resource-manager/authorization/2020-10-01/roleassignmentschedulerequests/id_scopedroleassignmentschedulerequest.go b/resource-manager/authorization/2020-10-01/roleassignmentschedulerequests/id_scopedroleassignmentschedulerequest.go index 58dc248ef51..6c1e6ea9463 100644 --- a/resource-manager/authorization/2020-10-01/roleassignmentschedulerequests/id_scopedroleassignmentschedulerequest.go +++ b/resource-manager/authorization/2020-10-01/roleassignmentschedulerequests/id_scopedroleassignmentschedulerequest.go @@ -34,15 +34,9 @@ func ParseScopedRoleAssignmentScheduleRequestID(input string) (*ScopedRoleAssign return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedRoleAssignmentScheduleRequestId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.RoleAssignmentScheduleRequestName, ok = parsed.Parsed["roleAssignmentScheduleRequestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleAssignmentScheduleRequestName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedRoleAssignmentScheduleRequestIDInsensitively(input string) (*Sco return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedRoleAssignmentScheduleRequestId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedRoleAssignmentScheduleRequestId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.RoleAssignmentScheduleRequestName, ok = parsed.Parsed["roleAssignmentScheduleRequestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleAssignmentScheduleRequestName", *parsed) + if id.RoleAssignmentScheduleRequestName, ok = input.Parsed["roleAssignmentScheduleRequestName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "roleAssignmentScheduleRequestName", input) } - return &id, nil + return nil } // ValidateScopedRoleAssignmentScheduleRequestID checks that 'input' can be parsed as a Scoped Role Assignment Schedule Request ID diff --git a/resource-manager/authorization/2020-10-01/roleassignmentschedules/id_scopedroleassignmentschedule.go b/resource-manager/authorization/2020-10-01/roleassignmentschedules/id_scopedroleassignmentschedule.go index 851fbe04102..9ba453e1f6b 100644 --- a/resource-manager/authorization/2020-10-01/roleassignmentschedules/id_scopedroleassignmentschedule.go +++ b/resource-manager/authorization/2020-10-01/roleassignmentschedules/id_scopedroleassignmentschedule.go @@ -34,15 +34,9 @@ func ParseScopedRoleAssignmentScheduleID(input string) (*ScopedRoleAssignmentSch return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedRoleAssignmentScheduleId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.RoleAssignmentScheduleName, ok = parsed.Parsed["roleAssignmentScheduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleAssignmentScheduleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedRoleAssignmentScheduleIDInsensitively(input string) (*ScopedRole return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedRoleAssignmentScheduleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedRoleAssignmentScheduleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.RoleAssignmentScheduleName, ok = parsed.Parsed["roleAssignmentScheduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleAssignmentScheduleName", *parsed) + if id.RoleAssignmentScheduleName, ok = input.Parsed["roleAssignmentScheduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "roleAssignmentScheduleName", input) } - return &id, nil + return nil } // ValidateScopedRoleAssignmentScheduleID checks that 'input' can be parsed as a Scoped Role Assignment Schedule ID diff --git a/resource-manager/authorization/2020-10-01/roleeligibilityscheduleinstances/id_scopedroleeligibilityscheduleinstance.go b/resource-manager/authorization/2020-10-01/roleeligibilityscheduleinstances/id_scopedroleeligibilityscheduleinstance.go index 70a22675819..9ce74e160c1 100644 --- a/resource-manager/authorization/2020-10-01/roleeligibilityscheduleinstances/id_scopedroleeligibilityscheduleinstance.go +++ b/resource-manager/authorization/2020-10-01/roleeligibilityscheduleinstances/id_scopedroleeligibilityscheduleinstance.go @@ -34,15 +34,9 @@ func ParseScopedRoleEligibilityScheduleInstanceID(input string) (*ScopedRoleElig return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedRoleEligibilityScheduleInstanceId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.RoleEligibilityScheduleInstanceName, ok = parsed.Parsed["roleEligibilityScheduleInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleEligibilityScheduleInstanceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedRoleEligibilityScheduleInstanceIDInsensitively(input string) (*S return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedRoleEligibilityScheduleInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedRoleEligibilityScheduleInstanceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.RoleEligibilityScheduleInstanceName, ok = parsed.Parsed["roleEligibilityScheduleInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleEligibilityScheduleInstanceName", *parsed) + if id.RoleEligibilityScheduleInstanceName, ok = input.Parsed["roleEligibilityScheduleInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "roleEligibilityScheduleInstanceName", input) } - return &id, nil + return nil } // ValidateScopedRoleEligibilityScheduleInstanceID checks that 'input' can be parsed as a Scoped Role Eligibility Schedule Instance ID diff --git a/resource-manager/authorization/2020-10-01/roleeligibilityschedulerequests/id_scopedroleeligibilityschedulerequest.go b/resource-manager/authorization/2020-10-01/roleeligibilityschedulerequests/id_scopedroleeligibilityschedulerequest.go index cbdce69f271..370aa097652 100644 --- a/resource-manager/authorization/2020-10-01/roleeligibilityschedulerequests/id_scopedroleeligibilityschedulerequest.go +++ b/resource-manager/authorization/2020-10-01/roleeligibilityschedulerequests/id_scopedroleeligibilityschedulerequest.go @@ -34,15 +34,9 @@ func ParseScopedRoleEligibilityScheduleRequestID(input string) (*ScopedRoleEligi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedRoleEligibilityScheduleRequestId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.RoleEligibilityScheduleRequestName, ok = parsed.Parsed["roleEligibilityScheduleRequestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleEligibilityScheduleRequestName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedRoleEligibilityScheduleRequestIDInsensitively(input string) (*Sc return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedRoleEligibilityScheduleRequestId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedRoleEligibilityScheduleRequestId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.RoleEligibilityScheduleRequestName, ok = parsed.Parsed["roleEligibilityScheduleRequestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleEligibilityScheduleRequestName", *parsed) + if id.RoleEligibilityScheduleRequestName, ok = input.Parsed["roleEligibilityScheduleRequestName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "roleEligibilityScheduleRequestName", input) } - return &id, nil + return nil } // ValidateScopedRoleEligibilityScheduleRequestID checks that 'input' can be parsed as a Scoped Role Eligibility Schedule Request ID diff --git a/resource-manager/authorization/2020-10-01/roleeligibilityschedules/id_scopedroleeligibilityschedule.go b/resource-manager/authorization/2020-10-01/roleeligibilityschedules/id_scopedroleeligibilityschedule.go index cd39ebc247d..4b1f03a9fa0 100644 --- a/resource-manager/authorization/2020-10-01/roleeligibilityschedules/id_scopedroleeligibilityschedule.go +++ b/resource-manager/authorization/2020-10-01/roleeligibilityschedules/id_scopedroleeligibilityschedule.go @@ -34,15 +34,9 @@ func ParseScopedRoleEligibilityScheduleID(input string) (*ScopedRoleEligibilityS return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedRoleEligibilityScheduleId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.RoleEligibilityScheduleName, ok = parsed.Parsed["roleEligibilityScheduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleEligibilityScheduleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedRoleEligibilityScheduleIDInsensitively(input string) (*ScopedRol return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedRoleEligibilityScheduleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedRoleEligibilityScheduleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.RoleEligibilityScheduleName, ok = parsed.Parsed["roleEligibilityScheduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleEligibilityScheduleName", *parsed) + if id.RoleEligibilityScheduleName, ok = input.Parsed["roleEligibilityScheduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "roleEligibilityScheduleName", input) } - return &id, nil + return nil } // ValidateScopedRoleEligibilityScheduleID checks that 'input' can be parsed as a Scoped Role Eligibility Schedule ID diff --git a/resource-manager/authorization/2020-10-01/rolemanagementpolicies/id_scopedrolemanagementpolicy.go b/resource-manager/authorization/2020-10-01/rolemanagementpolicies/id_scopedrolemanagementpolicy.go index 545ad0e8818..2635534c0d6 100644 --- a/resource-manager/authorization/2020-10-01/rolemanagementpolicies/id_scopedrolemanagementpolicy.go +++ b/resource-manager/authorization/2020-10-01/rolemanagementpolicies/id_scopedrolemanagementpolicy.go @@ -34,15 +34,9 @@ func ParseScopedRoleManagementPolicyID(input string) (*ScopedRoleManagementPolic return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedRoleManagementPolicyId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.RoleManagementPolicyName, ok = parsed.Parsed["roleManagementPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleManagementPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedRoleManagementPolicyIDInsensitively(input string) (*ScopedRoleMa return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedRoleManagementPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedRoleManagementPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.RoleManagementPolicyName, ok = parsed.Parsed["roleManagementPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleManagementPolicyName", *parsed) + if id.RoleManagementPolicyName, ok = input.Parsed["roleManagementPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "roleManagementPolicyName", input) } - return &id, nil + return nil } // ValidateScopedRoleManagementPolicyID checks that 'input' can be parsed as a Scoped Role Management Policy ID diff --git a/resource-manager/authorization/2020-10-01/rolemanagementpolicyassignments/id_scopedrolemanagementpolicyassignment.go b/resource-manager/authorization/2020-10-01/rolemanagementpolicyassignments/id_scopedrolemanagementpolicyassignment.go index 087ac02ffee..a0351391a17 100644 --- a/resource-manager/authorization/2020-10-01/rolemanagementpolicyassignments/id_scopedrolemanagementpolicyassignment.go +++ b/resource-manager/authorization/2020-10-01/rolemanagementpolicyassignments/id_scopedrolemanagementpolicyassignment.go @@ -34,15 +34,9 @@ func ParseScopedRoleManagementPolicyAssignmentID(input string) (*ScopedRoleManag return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedRoleManagementPolicyAssignmentId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.RoleManagementPolicyAssignmentName, ok = parsed.Parsed["roleManagementPolicyAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleManagementPolicyAssignmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedRoleManagementPolicyAssignmentIDInsensitively(input string) (*Sc return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedRoleManagementPolicyAssignmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedRoleManagementPolicyAssignmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.RoleManagementPolicyAssignmentName, ok = parsed.Parsed["roleManagementPolicyAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleManagementPolicyAssignmentName", *parsed) + if id.RoleManagementPolicyAssignmentName, ok = input.Parsed["roleManagementPolicyAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "roleManagementPolicyAssignmentName", input) } - return &id, nil + return nil } // ValidateScopedRoleManagementPolicyAssignmentID checks that 'input' can be parsed as a Scoped Role Management Policy Assignment ID diff --git a/resource-manager/authorization/2022-04-01/denyassignments/id_scopeddenyassignmentid.go b/resource-manager/authorization/2022-04-01/denyassignments/id_scopeddenyassignmentid.go index 6531766a405..1612041f05b 100644 --- a/resource-manager/authorization/2022-04-01/denyassignments/id_scopeddenyassignmentid.go +++ b/resource-manager/authorization/2022-04-01/denyassignments/id_scopeddenyassignmentid.go @@ -34,15 +34,9 @@ func ParseScopedDenyAssignmentIdID(input string) (*ScopedDenyAssignmentIdId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedDenyAssignmentIdId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.DenyAssignmentId, ok = parsed.Parsed["denyAssignmentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "denyAssignmentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedDenyAssignmentIdIDInsensitively(input string) (*ScopedDenyAssign return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedDenyAssignmentIdId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedDenyAssignmentIdId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.DenyAssignmentId, ok = parsed.Parsed["denyAssignmentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "denyAssignmentId", *parsed) + if id.DenyAssignmentId, ok = input.Parsed["denyAssignmentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "denyAssignmentId", input) } - return &id, nil + return nil } // ValidateScopedDenyAssignmentIdID checks that 'input' can be parsed as a Scoped Deny Assignment Id ID diff --git a/resource-manager/authorization/2022-04-01/provideroperationsmetadata/id_provideroperation.go b/resource-manager/authorization/2022-04-01/provideroperationsmetadata/id_provideroperation.go index ac0a4614757..ff45fc5876e 100644 --- a/resource-manager/authorization/2022-04-01/provideroperationsmetadata/id_provideroperation.go +++ b/resource-manager/authorization/2022-04-01/provideroperationsmetadata/id_provideroperation.go @@ -32,11 +32,9 @@ func ParseProviderOperationID(input string) (*ProviderOperationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderOperationId{} - - if id.ProviderOperationName, ok = parsed.Parsed["providerOperationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "providerOperationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseProviderOperationIDInsensitively(input string) (*ProviderOperationId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderOperationId{} - - if id.ProviderOperationName, ok = parsed.Parsed["providerOperationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "providerOperationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *ProviderOperationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ProviderOperationName, ok = input.Parsed["providerOperationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "providerOperationName", input) + } + + return nil +} + // ValidateProviderOperationID checks that 'input' can be parsed as a Provider Operation ID func ValidateProviderOperationID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/authorization/2022-04-01/roleassignments/id_scopedroleassignment.go b/resource-manager/authorization/2022-04-01/roleassignments/id_scopedroleassignment.go index 4605be879f7..4c1266cf21d 100644 --- a/resource-manager/authorization/2022-04-01/roleassignments/id_scopedroleassignment.go +++ b/resource-manager/authorization/2022-04-01/roleassignments/id_scopedroleassignment.go @@ -34,15 +34,9 @@ func ParseScopedRoleAssignmentID(input string) (*ScopedRoleAssignmentId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedRoleAssignmentId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.RoleAssignmentName, ok = parsed.Parsed["roleAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleAssignmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedRoleAssignmentIDInsensitively(input string) (*ScopedRoleAssignme return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedRoleAssignmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedRoleAssignmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.RoleAssignmentName, ok = parsed.Parsed["roleAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleAssignmentName", *parsed) + if id.RoleAssignmentName, ok = input.Parsed["roleAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "roleAssignmentName", input) } - return &id, nil + return nil } // ValidateScopedRoleAssignmentID checks that 'input' can be parsed as a Scoped Role Assignment ID diff --git a/resource-manager/authorization/2022-04-01/roledefinitions/id_scopedroledefinition.go b/resource-manager/authorization/2022-04-01/roledefinitions/id_scopedroledefinition.go index 50a72b320ed..c55dc9fbab2 100644 --- a/resource-manager/authorization/2022-04-01/roledefinitions/id_scopedroledefinition.go +++ b/resource-manager/authorization/2022-04-01/roledefinitions/id_scopedroledefinition.go @@ -34,15 +34,9 @@ func ParseScopedRoleDefinitionID(input string) (*ScopedRoleDefinitionId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedRoleDefinitionId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.RoleDefinitionId, ok = parsed.Parsed["roleDefinitionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleDefinitionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedRoleDefinitionIDInsensitively(input string) (*ScopedRoleDefiniti return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedRoleDefinitionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedRoleDefinitionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.RoleDefinitionId, ok = parsed.Parsed["roleDefinitionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleDefinitionId", *parsed) + if id.RoleDefinitionId, ok = input.Parsed["roleDefinitionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "roleDefinitionId", input) } - return &id, nil + return nil } // ValidateScopedRoleDefinitionID checks that 'input' can be parsed as a Scoped Role Definition ID diff --git a/resource-manager/authorization/2022-05-01-preview/roledefinitions/id_scopedroledefinition.go b/resource-manager/authorization/2022-05-01-preview/roledefinitions/id_scopedroledefinition.go index 50a72b320ed..c55dc9fbab2 100644 --- a/resource-manager/authorization/2022-05-01-preview/roledefinitions/id_scopedroledefinition.go +++ b/resource-manager/authorization/2022-05-01-preview/roledefinitions/id_scopedroledefinition.go @@ -34,15 +34,9 @@ func ParseScopedRoleDefinitionID(input string) (*ScopedRoleDefinitionId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedRoleDefinitionId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.RoleDefinitionId, ok = parsed.Parsed["roleDefinitionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleDefinitionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedRoleDefinitionIDInsensitively(input string) (*ScopedRoleDefiniti return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedRoleDefinitionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedRoleDefinitionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.RoleDefinitionId, ok = parsed.Parsed["roleDefinitionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleDefinitionId", *parsed) + if id.RoleDefinitionId, ok = input.Parsed["roleDefinitionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "roleDefinitionId", input) } - return &id, nil + return nil } // ValidateScopedRoleDefinitionID checks that 'input' can be parsed as a Scoped Role Definition ID diff --git a/resource-manager/automanage/2022-05-04/bestpractices/id_bestpractice.go b/resource-manager/automanage/2022-05-04/bestpractices/id_bestpractice.go index f989570cbc8..325f5ab1349 100644 --- a/resource-manager/automanage/2022-05-04/bestpractices/id_bestpractice.go +++ b/resource-manager/automanage/2022-05-04/bestpractices/id_bestpractice.go @@ -32,11 +32,9 @@ func ParseBestPracticeID(input string) (*BestPracticeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BestPracticeId{} - - if id.BestPracticeName, ok = parsed.Parsed["bestPracticeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bestPracticeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseBestPracticeIDInsensitively(input string) (*BestPracticeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BestPracticeId{} - - if id.BestPracticeName, ok = parsed.Parsed["bestPracticeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bestPracticeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *BestPracticeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BestPracticeName, ok = input.Parsed["bestPracticeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "bestPracticeName", input) + } + + return nil +} + // ValidateBestPracticeID checks that 'input' can be parsed as a Best Practice ID func ValidateBestPracticeID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/automanage/2022-05-04/bestpracticesversions/id_bestpractice.go b/resource-manager/automanage/2022-05-04/bestpracticesversions/id_bestpractice.go index 9aa6d070c5f..9d29f6580d0 100644 --- a/resource-manager/automanage/2022-05-04/bestpracticesversions/id_bestpractice.go +++ b/resource-manager/automanage/2022-05-04/bestpracticesversions/id_bestpractice.go @@ -32,11 +32,9 @@ func ParseBestPracticeID(input string) (*BestPracticeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BestPracticeId{} - - if id.BestPracticeName, ok = parsed.Parsed["bestPracticeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bestPracticeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseBestPracticeIDInsensitively(input string) (*BestPracticeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BestPracticeId{} - - if id.BestPracticeName, ok = parsed.Parsed["bestPracticeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bestPracticeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *BestPracticeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BestPracticeName, ok = input.Parsed["bestPracticeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "bestPracticeName", input) + } + + return nil +} + // ValidateBestPracticeID checks that 'input' can be parsed as a Best Practice ID func ValidateBestPracticeID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/automanage/2022-05-04/bestpracticesversions/id_version.go b/resource-manager/automanage/2022-05-04/bestpracticesversions/id_version.go index ff497746887..05b0407d974 100644 --- a/resource-manager/automanage/2022-05-04/bestpracticesversions/id_version.go +++ b/resource-manager/automanage/2022-05-04/bestpracticesversions/id_version.go @@ -34,15 +34,9 @@ func ParseVersionID(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} - - if id.BestPracticeName, ok = parsed.Parsed["bestPracticeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bestPracticeName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseVersionIDInsensitively(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.BestPracticeName, ok = parsed.Parsed["bestPracticeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bestPracticeName", *parsed) + return &id, nil +} + +func (id *VersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BestPracticeName, ok = input.Parsed["bestPracticeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "bestPracticeName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateVersionID checks that 'input' can be parsed as a Version ID diff --git a/resource-manager/automanage/2022-05-04/configurationprofileassignments/id_cluster.go b/resource-manager/automanage/2022-05-04/configurationprofileassignments/id_cluster.go index e2a4af4b26a..e4dd9e42244 100644 --- a/resource-manager/automanage/2022-05-04/configurationprofileassignments/id_cluster.go +++ b/resource-manager/automanage/2022-05-04/configurationprofileassignments/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/automanage/2022-05-04/configurationprofileassignments/id_machine.go b/resource-manager/automanage/2022-05-04/configurationprofileassignments/id_machine.go index 08de9def5d6..271f8b43821 100644 --- a/resource-manager/automanage/2022-05-04/configurationprofileassignments/id_machine.go +++ b/resource-manager/automanage/2022-05-04/configurationprofileassignments/id_machine.go @@ -36,19 +36,9 @@ func ParseMachineID(input string) (*MachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MachineId{} - - 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.MachineName, ok = parsed.Parsed["machineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMachineIDInsensitively(input string) (*MachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MachineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MachineName, ok = parsed.Parsed["machineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machineName", *parsed) + if id.MachineName, ok = input.Parsed["machineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "machineName", input) } - return &id, nil + return nil } // ValidateMachineID checks that 'input' can be parsed as a Machine ID diff --git a/resource-manager/automanage/2022-05-04/configurationprofileassignments/id_virtualmachine.go b/resource-manager/automanage/2022-05-04/configurationprofileassignments/id_virtualmachine.go index 2a5f6d2443b..c091996dabd 100644 --- a/resource-manager/automanage/2022-05-04/configurationprofileassignments/id_virtualmachine.go +++ b/resource-manager/automanage/2022-05-04/configurationprofileassignments/id_virtualmachine.go @@ -36,19 +36,9 @@ func ParseVirtualMachineID(input string) (*VirtualMachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineIDInsensitively(input string) (*VirtualMachineId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - return &id, nil + return nil } // ValidateVirtualMachineID checks that 'input' can be parsed as a Virtual Machine ID diff --git a/resource-manager/automanage/2022-05-04/configurationprofileassignments/id_virtualmachineproviders2configurationprofileassignment.go b/resource-manager/automanage/2022-05-04/configurationprofileassignments/id_virtualmachineproviders2configurationprofileassignment.go index f0c242d405b..7cede32e011 100644 --- a/resource-manager/automanage/2022-05-04/configurationprofileassignments/id_virtualmachineproviders2configurationprofileassignment.go +++ b/resource-manager/automanage/2022-05-04/configurationprofileassignments/id_virtualmachineproviders2configurationprofileassignment.go @@ -38,23 +38,9 @@ func ParseVirtualMachineProviders2ConfigurationProfileAssignmentID(input string) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineProviders2ConfigurationProfileAssignmentId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) - } - - if id.ConfigurationProfileAssignmentName, ok = parsed.Parsed["configurationProfileAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationProfileAssignmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualMachineProviders2ConfigurationProfileAssignmentIDInsensitively( return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineProviders2ConfigurationProfileAssignmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineProviders2ConfigurationProfileAssignmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - if id.ConfigurationProfileAssignmentName, ok = parsed.Parsed["configurationProfileAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationProfileAssignmentName", *parsed) + if id.ConfigurationProfileAssignmentName, ok = input.Parsed["configurationProfileAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationProfileAssignmentName", input) } - return &id, nil + return nil } // ValidateVirtualMachineProviders2ConfigurationProfileAssignmentID checks that 'input' can be parsed as a Virtual Machine Providers 2 Configuration Profile Assignment ID diff --git a/resource-manager/automanage/2022-05-04/configurationprofilehciassignments/id_configurationprofileassignment.go b/resource-manager/automanage/2022-05-04/configurationprofilehciassignments/id_configurationprofileassignment.go index b256815d8bd..e189135ba87 100644 --- a/resource-manager/automanage/2022-05-04/configurationprofilehciassignments/id_configurationprofileassignment.go +++ b/resource-manager/automanage/2022-05-04/configurationprofilehciassignments/id_configurationprofileassignment.go @@ -38,23 +38,9 @@ func ParseConfigurationProfileAssignmentID(input string) (*ConfigurationProfileA return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationProfileAssignmentId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.ConfigurationProfileAssignmentName, ok = parsed.Parsed["configurationProfileAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationProfileAssignmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConfigurationProfileAssignmentIDInsensitively(input string) (*Configur return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationProfileAssignmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConfigurationProfileAssignmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.ConfigurationProfileAssignmentName, ok = parsed.Parsed["configurationProfileAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationProfileAssignmentName", *parsed) + if id.ConfigurationProfileAssignmentName, ok = input.Parsed["configurationProfileAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationProfileAssignmentName", input) } - return &id, nil + return nil } // ValidateConfigurationProfileAssignmentID checks that 'input' can be parsed as a Configuration Profile Assignment ID diff --git a/resource-manager/automanage/2022-05-04/configurationprofilehcrpassignments/id_providers2configurationprofileassignment.go b/resource-manager/automanage/2022-05-04/configurationprofilehcrpassignments/id_providers2configurationprofileassignment.go index 238d40a705d..903ee88509d 100644 --- a/resource-manager/automanage/2022-05-04/configurationprofilehcrpassignments/id_providers2configurationprofileassignment.go +++ b/resource-manager/automanage/2022-05-04/configurationprofilehcrpassignments/id_providers2configurationprofileassignment.go @@ -38,23 +38,9 @@ func ParseProviders2ConfigurationProfileAssignmentID(input string) (*Providers2C return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2ConfigurationProfileAssignmentId{} - - 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.MachineName, ok = parsed.Parsed["machineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machineName", *parsed) - } - - if id.ConfigurationProfileAssignmentName, ok = parsed.Parsed["configurationProfileAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationProfileAssignmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProviders2ConfigurationProfileAssignmentIDInsensitively(input string) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2ConfigurationProfileAssignmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *Providers2ConfigurationProfileAssignmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MachineName, ok = parsed.Parsed["machineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machineName", *parsed) + if id.MachineName, ok = input.Parsed["machineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "machineName", input) } - if id.ConfigurationProfileAssignmentName, ok = parsed.Parsed["configurationProfileAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationProfileAssignmentName", *parsed) + if id.ConfigurationProfileAssignmentName, ok = input.Parsed["configurationProfileAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationProfileAssignmentName", input) } - return &id, nil + return nil } // ValidateProviders2ConfigurationProfileAssignmentID checks that 'input' can be parsed as a Providers 2 Configuration Profile Assignment ID diff --git a/resource-manager/automanage/2022-05-04/configurationprofiles/id_configurationprofile.go b/resource-manager/automanage/2022-05-04/configurationprofiles/id_configurationprofile.go index 443b3aebb2f..dfc16c561b0 100644 --- a/resource-manager/automanage/2022-05-04/configurationprofiles/id_configurationprofile.go +++ b/resource-manager/automanage/2022-05-04/configurationprofiles/id_configurationprofile.go @@ -36,19 +36,9 @@ func ParseConfigurationProfileID(input string) (*ConfigurationProfileId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationProfileId{} - - 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.ConfigurationProfileName, ok = parsed.Parsed["configurationProfileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationProfileName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseConfigurationProfileIDInsensitively(input string) (*ConfigurationProfi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationProfileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ConfigurationProfileId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ConfigurationProfileName, ok = parsed.Parsed["configurationProfileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationProfileName", *parsed) + if id.ConfigurationProfileName, ok = input.Parsed["configurationProfileName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationProfileName", input) } - return &id, nil + return nil } // ValidateConfigurationProfileID checks that 'input' can be parsed as a Configuration Profile ID diff --git a/resource-manager/automanage/2022-05-04/configurationprofilesversions/id_configurationprofile.go b/resource-manager/automanage/2022-05-04/configurationprofilesversions/id_configurationprofile.go index 5d50d7c3989..b461af8afa9 100644 --- a/resource-manager/automanage/2022-05-04/configurationprofilesversions/id_configurationprofile.go +++ b/resource-manager/automanage/2022-05-04/configurationprofilesversions/id_configurationprofile.go @@ -36,19 +36,9 @@ func ParseConfigurationProfileID(input string) (*ConfigurationProfileId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationProfileId{} - - 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.ConfigurationProfileName, ok = parsed.Parsed["configurationProfileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationProfileName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseConfigurationProfileIDInsensitively(input string) (*ConfigurationProfi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationProfileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ConfigurationProfileId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ConfigurationProfileName, ok = parsed.Parsed["configurationProfileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationProfileName", *parsed) + if id.ConfigurationProfileName, ok = input.Parsed["configurationProfileName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationProfileName", input) } - return &id, nil + return nil } // ValidateConfigurationProfileID checks that 'input' can be parsed as a Configuration Profile ID diff --git a/resource-manager/automanage/2022-05-04/configurationprofilesversions/id_configurationprofileversion.go b/resource-manager/automanage/2022-05-04/configurationprofilesversions/id_configurationprofileversion.go index a37da291b62..d8b56dd03cf 100644 --- a/resource-manager/automanage/2022-05-04/configurationprofilesversions/id_configurationprofileversion.go +++ b/resource-manager/automanage/2022-05-04/configurationprofilesversions/id_configurationprofileversion.go @@ -38,23 +38,9 @@ func ParseConfigurationProfileVersionID(input string) (*ConfigurationProfileVers return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationProfileVersionId{} - - 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.ConfigurationProfileName, ok = parsed.Parsed["configurationProfileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationProfileName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConfigurationProfileVersionIDInsensitively(input string) (*Configurati return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationProfileVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConfigurationProfileVersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ConfigurationProfileName, ok = parsed.Parsed["configurationProfileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationProfileName", *parsed) + if id.ConfigurationProfileName, ok = input.Parsed["configurationProfileName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationProfileName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateConfigurationProfileVersionID checks that 'input' can be parsed as a Configuration Profile Version ID diff --git a/resource-manager/automanage/2022-05-04/hcireports/id_configurationprofileassignment.go b/resource-manager/automanage/2022-05-04/hcireports/id_configurationprofileassignment.go index 2277bd44b33..493a331a47d 100644 --- a/resource-manager/automanage/2022-05-04/hcireports/id_configurationprofileassignment.go +++ b/resource-manager/automanage/2022-05-04/hcireports/id_configurationprofileassignment.go @@ -38,23 +38,9 @@ func ParseConfigurationProfileAssignmentID(input string) (*ConfigurationProfileA return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationProfileAssignmentId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.ConfigurationProfileAssignmentName, ok = parsed.Parsed["configurationProfileAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationProfileAssignmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConfigurationProfileAssignmentIDInsensitively(input string) (*Configur return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationProfileAssignmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConfigurationProfileAssignmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.ConfigurationProfileAssignmentName, ok = parsed.Parsed["configurationProfileAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationProfileAssignmentName", *parsed) + if id.ConfigurationProfileAssignmentName, ok = input.Parsed["configurationProfileAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationProfileAssignmentName", input) } - return &id, nil + return nil } // ValidateConfigurationProfileAssignmentID checks that 'input' can be parsed as a Configuration Profile Assignment ID diff --git a/resource-manager/automanage/2022-05-04/hcireports/id_report.go b/resource-manager/automanage/2022-05-04/hcireports/id_report.go index 4388141336d..7f55c1f3827 100644 --- a/resource-manager/automanage/2022-05-04/hcireports/id_report.go +++ b/resource-manager/automanage/2022-05-04/hcireports/id_report.go @@ -40,27 +40,9 @@ func ParseReportID(input string) (*ReportId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReportId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.ConfigurationProfileAssignmentName, ok = parsed.Parsed["configurationProfileAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationProfileAssignmentName", *parsed) - } - - if id.ReportName, ok = parsed.Parsed["reportName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reportName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReportIDInsensitively(input string) (*ReportId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReportId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReportId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.ConfigurationProfileAssignmentName, ok = parsed.Parsed["configurationProfileAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationProfileAssignmentName", *parsed) + if id.ConfigurationProfileAssignmentName, ok = input.Parsed["configurationProfileAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationProfileAssignmentName", input) } - if id.ReportName, ok = parsed.Parsed["reportName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reportName", *parsed) + if id.ReportName, ok = input.Parsed["reportName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reportName", input) } - return &id, nil + return nil } // ValidateReportID checks that 'input' can be parsed as a Report ID diff --git a/resource-manager/automanage/2022-05-04/hcrpreports/id_configurationprofileassignmentreport.go b/resource-manager/automanage/2022-05-04/hcrpreports/id_configurationprofileassignmentreport.go index 409ed3eef3b..94f479b3299 100644 --- a/resource-manager/automanage/2022-05-04/hcrpreports/id_configurationprofileassignmentreport.go +++ b/resource-manager/automanage/2022-05-04/hcrpreports/id_configurationprofileassignmentreport.go @@ -40,27 +40,9 @@ func ParseConfigurationProfileAssignmentReportID(input string) (*ConfigurationPr return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationProfileAssignmentReportId{} - - 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.MachineName, ok = parsed.Parsed["machineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machineName", *parsed) - } - - if id.ConfigurationProfileAssignmentName, ok = parsed.Parsed["configurationProfileAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationProfileAssignmentName", *parsed) - } - - if id.ReportName, ok = parsed.Parsed["reportName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reportName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseConfigurationProfileAssignmentReportIDInsensitively(input string) (*Co return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationProfileAssignmentReportId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ConfigurationProfileAssignmentReportId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MachineName, ok = parsed.Parsed["machineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machineName", *parsed) + if id.MachineName, ok = input.Parsed["machineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "machineName", input) } - if id.ConfigurationProfileAssignmentName, ok = parsed.Parsed["configurationProfileAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationProfileAssignmentName", *parsed) + if id.ConfigurationProfileAssignmentName, ok = input.Parsed["configurationProfileAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationProfileAssignmentName", input) } - if id.ReportName, ok = parsed.Parsed["reportName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reportName", *parsed) + if id.ReportName, ok = input.Parsed["reportName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reportName", input) } - return &id, nil + return nil } // ValidateConfigurationProfileAssignmentReportID checks that 'input' can be parsed as a Configuration Profile Assignment Report ID diff --git a/resource-manager/automanage/2022-05-04/hcrpreports/id_providers2configurationprofileassignment.go b/resource-manager/automanage/2022-05-04/hcrpreports/id_providers2configurationprofileassignment.go index 8e9493cdbb9..2b3b40b5b19 100644 --- a/resource-manager/automanage/2022-05-04/hcrpreports/id_providers2configurationprofileassignment.go +++ b/resource-manager/automanage/2022-05-04/hcrpreports/id_providers2configurationprofileassignment.go @@ -38,23 +38,9 @@ func ParseProviders2ConfigurationProfileAssignmentID(input string) (*Providers2C return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2ConfigurationProfileAssignmentId{} - - 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.MachineName, ok = parsed.Parsed["machineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machineName", *parsed) - } - - if id.ConfigurationProfileAssignmentName, ok = parsed.Parsed["configurationProfileAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationProfileAssignmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProviders2ConfigurationProfileAssignmentIDInsensitively(input string) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2ConfigurationProfileAssignmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *Providers2ConfigurationProfileAssignmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MachineName, ok = parsed.Parsed["machineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machineName", *parsed) + if id.MachineName, ok = input.Parsed["machineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "machineName", input) } - if id.ConfigurationProfileAssignmentName, ok = parsed.Parsed["configurationProfileAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationProfileAssignmentName", *parsed) + if id.ConfigurationProfileAssignmentName, ok = input.Parsed["configurationProfileAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationProfileAssignmentName", input) } - return &id, nil + return nil } // ValidateProviders2ConfigurationProfileAssignmentID checks that 'input' can be parsed as a Providers 2 Configuration Profile Assignment ID diff --git a/resource-manager/automanage/2022-05-04/reports/id_providers2configurationprofileassignmentreport.go b/resource-manager/automanage/2022-05-04/reports/id_providers2configurationprofileassignmentreport.go index 2af4b0a83c6..041b09da27d 100644 --- a/resource-manager/automanage/2022-05-04/reports/id_providers2configurationprofileassignmentreport.go +++ b/resource-manager/automanage/2022-05-04/reports/id_providers2configurationprofileassignmentreport.go @@ -40,27 +40,9 @@ func ParseProviders2ConfigurationProfileAssignmentReportID(input string) (*Provi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2ConfigurationProfileAssignmentReportId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) - } - - if id.ConfigurationProfileAssignmentName, ok = parsed.Parsed["configurationProfileAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationProfileAssignmentName", *parsed) - } - - if id.ReportName, ok = parsed.Parsed["reportName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reportName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseProviders2ConfigurationProfileAssignmentReportIDInsensitively(input st return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2ConfigurationProfileAssignmentReportId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *Providers2ConfigurationProfileAssignmentReportId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - if id.ConfigurationProfileAssignmentName, ok = parsed.Parsed["configurationProfileAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationProfileAssignmentName", *parsed) + if id.ConfigurationProfileAssignmentName, ok = input.Parsed["configurationProfileAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationProfileAssignmentName", input) } - if id.ReportName, ok = parsed.Parsed["reportName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reportName", *parsed) + if id.ReportName, ok = input.Parsed["reportName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reportName", input) } - return &id, nil + return nil } // ValidateProviders2ConfigurationProfileAssignmentReportID checks that 'input' can be parsed as a Providers 2 Configuration Profile Assignment Report ID diff --git a/resource-manager/automanage/2022-05-04/reports/id_virtualmachineproviders2configurationprofileassignment.go b/resource-manager/automanage/2022-05-04/reports/id_virtualmachineproviders2configurationprofileassignment.go index 1155d4fb917..7f9f58c9bbd 100644 --- a/resource-manager/automanage/2022-05-04/reports/id_virtualmachineproviders2configurationprofileassignment.go +++ b/resource-manager/automanage/2022-05-04/reports/id_virtualmachineproviders2configurationprofileassignment.go @@ -38,23 +38,9 @@ func ParseVirtualMachineProviders2ConfigurationProfileAssignmentID(input string) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineProviders2ConfigurationProfileAssignmentId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) - } - - if id.ConfigurationProfileAssignmentName, ok = parsed.Parsed["configurationProfileAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationProfileAssignmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualMachineProviders2ConfigurationProfileAssignmentIDInsensitively( return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineProviders2ConfigurationProfileAssignmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineProviders2ConfigurationProfileAssignmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - if id.ConfigurationProfileAssignmentName, ok = parsed.Parsed["configurationProfileAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationProfileAssignmentName", *parsed) + if id.ConfigurationProfileAssignmentName, ok = input.Parsed["configurationProfileAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationProfileAssignmentName", input) } - return &id, nil + return nil } // ValidateVirtualMachineProviders2ConfigurationProfileAssignmentID checks that 'input' can be parsed as a Virtual Machine Providers 2 Configuration Profile Assignment ID diff --git a/resource-manager/automation/2015-10-31/activity/id_activity.go b/resource-manager/automation/2015-10-31/activity/id_activity.go index 3930c905492..9a1bddcd0a9 100644 --- a/resource-manager/automation/2015-10-31/activity/id_activity.go +++ b/resource-manager/automation/2015-10-31/activity/id_activity.go @@ -40,27 +40,9 @@ func ParseActivityID(input string) (*ActivityId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ActivityId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) - } - - if id.ActivityName, ok = parsed.Parsed["activityName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "activityName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseActivityIDInsensitively(input string) (*ActivityId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ActivityId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ActivityId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if id.ModuleName, ok = input.Parsed["moduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "moduleName", input) } - if id.ActivityName, ok = parsed.Parsed["activityName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "activityName", *parsed) + if id.ActivityName, ok = input.Parsed["activityName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "activityName", input) } - return &id, nil + return nil } // ValidateActivityID checks that 'input' can be parsed as a Activity ID diff --git a/resource-manager/automation/2015-10-31/activity/id_module.go b/resource-manager/automation/2015-10-31/activity/id_module.go index 0c927d16d45..15aac63648e 100644 --- a/resource-manager/automation/2015-10-31/activity/id_module.go +++ b/resource-manager/automation/2015-10-31/activity/id_module.go @@ -38,23 +38,9 @@ func ParseModuleID(input string) (*ModuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModuleId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseModuleIDInsensitively(input string) (*ModuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ModuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if id.ModuleName, ok = input.Parsed["moduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "moduleName", input) } - return &id, nil + return nil } // ValidateModuleID checks that 'input' can be parsed as a Module ID diff --git a/resource-manager/automation/2015-10-31/agentregistrationinformation/id_automationaccount.go b/resource-manager/automation/2015-10-31/agentregistrationinformation/id_automationaccount.go index 08b840fe82d..ed488fda092 100644 --- a/resource-manager/automation/2015-10-31/agentregistrationinformation/id_automationaccount.go +++ b/resource-manager/automation/2015-10-31/agentregistrationinformation/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2015-10-31/automationaccount/id_automationaccount.go b/resource-manager/automation/2015-10-31/automationaccount/id_automationaccount.go index 507f59b0248..30125ce2604 100644 --- a/resource-manager/automation/2015-10-31/automationaccount/id_automationaccount.go +++ b/resource-manager/automation/2015-10-31/automationaccount/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2015-10-31/certificate/id_automationaccount.go b/resource-manager/automation/2015-10-31/certificate/id_automationaccount.go index b72970d4392..5f31a6b8efd 100644 --- a/resource-manager/automation/2015-10-31/certificate/id_automationaccount.go +++ b/resource-manager/automation/2015-10-31/certificate/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2015-10-31/certificate/id_certificate.go b/resource-manager/automation/2015-10-31/certificate/id_certificate.go index a4dd6601140..492524d5d54 100644 --- a/resource-manager/automation/2015-10-31/certificate/id_certificate.go +++ b/resource-manager/automation/2015-10-31/certificate/id_certificate.go @@ -38,23 +38,9 @@ func ParseCertificateID(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCertificateIDInsensitively(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if id.CertificateName, ok = input.Parsed["certificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateName", input) } - return &id, nil + return nil } // ValidateCertificateID checks that 'input' can be parsed as a Certificate ID diff --git a/resource-manager/automation/2015-10-31/connection/id_automationaccount.go b/resource-manager/automation/2015-10-31/connection/id_automationaccount.go index 6b4cf0ead8b..0036ab33fe6 100644 --- a/resource-manager/automation/2015-10-31/connection/id_automationaccount.go +++ b/resource-manager/automation/2015-10-31/connection/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2015-10-31/connection/id_connection.go b/resource-manager/automation/2015-10-31/connection/id_connection.go index e38741628fe..8199efc92b3 100644 --- a/resource-manager/automation/2015-10-31/connection/id_connection.go +++ b/resource-manager/automation/2015-10-31/connection/id_connection.go @@ -38,23 +38,9 @@ func ParseConnectionID(input string) (*ConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ConnectionName, ok = parsed.Parsed["connectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConnectionIDInsensitively(input string) (*ConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ConnectionName, ok = parsed.Parsed["connectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionName", *parsed) + if id.ConnectionName, ok = input.Parsed["connectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectionName", input) } - return &id, nil + return nil } // ValidateConnectionID checks that 'input' can be parsed as a Connection ID diff --git a/resource-manager/automation/2015-10-31/connectiontype/id_automationaccount.go b/resource-manager/automation/2015-10-31/connectiontype/id_automationaccount.go index 9ac59c1b5c4..2df28b9d4b3 100644 --- a/resource-manager/automation/2015-10-31/connectiontype/id_automationaccount.go +++ b/resource-manager/automation/2015-10-31/connectiontype/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2015-10-31/connectiontype/id_connectiontype.go b/resource-manager/automation/2015-10-31/connectiontype/id_connectiontype.go index c27cff4d1ee..c933b61f97a 100644 --- a/resource-manager/automation/2015-10-31/connectiontype/id_connectiontype.go +++ b/resource-manager/automation/2015-10-31/connectiontype/id_connectiontype.go @@ -38,23 +38,9 @@ func ParseConnectionTypeID(input string) (*ConnectionTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionTypeId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ConnectionTypeName, ok = parsed.Parsed["connectionTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionTypeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConnectionTypeIDInsensitively(input string) (*ConnectionTypeId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConnectionTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ConnectionTypeName, ok = parsed.Parsed["connectionTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionTypeName", *parsed) + if id.ConnectionTypeName, ok = input.Parsed["connectionTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectionTypeName", input) } - return &id, nil + return nil } // ValidateConnectionTypeID checks that 'input' can be parsed as a Connection Type ID diff --git a/resource-manager/automation/2015-10-31/credential/id_automationaccount.go b/resource-manager/automation/2015-10-31/credential/id_automationaccount.go index 1d277938871..a8ea4d95e75 100644 --- a/resource-manager/automation/2015-10-31/credential/id_automationaccount.go +++ b/resource-manager/automation/2015-10-31/credential/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2015-10-31/credential/id_credential.go b/resource-manager/automation/2015-10-31/credential/id_credential.go index 3bc69d79906..6f666f05d43 100644 --- a/resource-manager/automation/2015-10-31/credential/id_credential.go +++ b/resource-manager/automation/2015-10-31/credential/id_credential.go @@ -38,23 +38,9 @@ func ParseCredentialID(input string) (*CredentialId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CredentialId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.CredentialName, ok = parsed.Parsed["credentialName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "credentialName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCredentialIDInsensitively(input string) (*CredentialId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CredentialId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CredentialId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.CredentialName, ok = parsed.Parsed["credentialName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "credentialName", *parsed) + if id.CredentialName, ok = input.Parsed["credentialName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "credentialName", input) } - return &id, nil + return nil } // ValidateCredentialID checks that 'input' can be parsed as a Credential ID diff --git a/resource-manager/automation/2015-10-31/dsccompilationjob/id_automationaccount.go b/resource-manager/automation/2015-10-31/dsccompilationjob/id_automationaccount.go index f67a1327f44..b9f8082811a 100644 --- a/resource-manager/automation/2015-10-31/dsccompilationjob/id_automationaccount.go +++ b/resource-manager/automation/2015-10-31/dsccompilationjob/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2015-10-31/dsccompilationjob/id_compilationjobstream.go b/resource-manager/automation/2015-10-31/dsccompilationjob/id_compilationjobstream.go index 5fc6154a16c..01e3bc0100e 100644 --- a/resource-manager/automation/2015-10-31/dsccompilationjob/id_compilationjobstream.go +++ b/resource-manager/automation/2015-10-31/dsccompilationjob/id_compilationjobstream.go @@ -40,27 +40,9 @@ func ParseCompilationJobStreamID(input string) (*CompilationJobStreamId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CompilationJobStreamId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.JobId, ok = parsed.Parsed["jobId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobId", *parsed) - } - - if id.JobStreamId, ok = parsed.Parsed["jobStreamId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobStreamId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseCompilationJobStreamIDInsensitively(input string) (*CompilationJobStre return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CompilationJobStreamId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *CompilationJobStreamId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.JobId, ok = parsed.Parsed["jobId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobId", *parsed) + if id.JobId, ok = input.Parsed["jobId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobId", input) } - if id.JobStreamId, ok = parsed.Parsed["jobStreamId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobStreamId", *parsed) + if id.JobStreamId, ok = input.Parsed["jobStreamId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobStreamId", input) } - return &id, nil + return nil } // ValidateCompilationJobStreamID checks that 'input' can be parsed as a Compilation Job Stream ID diff --git a/resource-manager/automation/2015-10-31/dscconfiguration/id_automationaccount.go b/resource-manager/automation/2015-10-31/dscconfiguration/id_automationaccount.go index e55bc5823ef..7d065e1e87f 100644 --- a/resource-manager/automation/2015-10-31/dscconfiguration/id_automationaccount.go +++ b/resource-manager/automation/2015-10-31/dscconfiguration/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2015-10-31/dscconfiguration/id_configuration.go b/resource-manager/automation/2015-10-31/dscconfiguration/id_configuration.go index 9ab132d3e0a..ad9cf42c091 100644 --- a/resource-manager/automation/2015-10-31/dscconfiguration/id_configuration.go +++ b/resource-manager/automation/2015-10-31/dscconfiguration/id_configuration.go @@ -38,23 +38,9 @@ func ParseConfigurationID(input string) (*ConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConfigurationIDInsensitively(input string) (*ConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationName", *parsed) + if id.ConfigurationName, ok = input.Parsed["configurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationName", input) } - return &id, nil + return nil } // ValidateConfigurationID checks that 'input' can be parsed as a Configuration ID diff --git a/resource-manager/automation/2015-10-31/dscnode/id_automationaccount.go b/resource-manager/automation/2015-10-31/dscnode/id_automationaccount.go index 93f32245d95..dc7ca325d76 100644 --- a/resource-manager/automation/2015-10-31/dscnode/id_automationaccount.go +++ b/resource-manager/automation/2015-10-31/dscnode/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2015-10-31/dscnode/id_node.go b/resource-manager/automation/2015-10-31/dscnode/id_node.go index ba81c8d1099..f838b58dfb7 100644 --- a/resource-manager/automation/2015-10-31/dscnode/id_node.go +++ b/resource-manager/automation/2015-10-31/dscnode/id_node.go @@ -38,23 +38,9 @@ func ParseNodeID(input string) (*NodeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NodeId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.NodeId, ok = parsed.Parsed["nodeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nodeId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseNodeIDInsensitively(input string) (*NodeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NodeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *NodeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.NodeId, ok = parsed.Parsed["nodeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nodeId", *parsed) + if id.NodeId, ok = input.Parsed["nodeId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "nodeId", input) } - return &id, nil + return nil } // ValidateNodeID checks that 'input' can be parsed as a Node ID diff --git a/resource-manager/automation/2015-10-31/dscnodeconfiguration/id_automationaccount.go b/resource-manager/automation/2015-10-31/dscnodeconfiguration/id_automationaccount.go index 86960689e71..254e43fe5d9 100644 --- a/resource-manager/automation/2015-10-31/dscnodeconfiguration/id_automationaccount.go +++ b/resource-manager/automation/2015-10-31/dscnodeconfiguration/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2015-10-31/dscnodeconfiguration/id_nodeconfiguration.go b/resource-manager/automation/2015-10-31/dscnodeconfiguration/id_nodeconfiguration.go index df13fdfef49..7d94c8c45ea 100644 --- a/resource-manager/automation/2015-10-31/dscnodeconfiguration/id_nodeconfiguration.go +++ b/resource-manager/automation/2015-10-31/dscnodeconfiguration/id_nodeconfiguration.go @@ -38,23 +38,9 @@ func ParseNodeConfigurationID(input string) (*NodeConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NodeConfigurationId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.NodeConfigurationName, ok = parsed.Parsed["nodeConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nodeConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseNodeConfigurationIDInsensitively(input string) (*NodeConfigurationId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NodeConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *NodeConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.NodeConfigurationName, ok = parsed.Parsed["nodeConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nodeConfigurationName", *parsed) + if id.NodeConfigurationName, ok = input.Parsed["nodeConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "nodeConfigurationName", input) } - return &id, nil + return nil } // ValidateNodeConfigurationID checks that 'input' can be parsed as a Node Configuration ID diff --git a/resource-manager/automation/2015-10-31/hybridrunbookworkergroup/id_automationaccount.go b/resource-manager/automation/2015-10-31/hybridrunbookworkergroup/id_automationaccount.go index 33a62270abe..3a2202493f9 100644 --- a/resource-manager/automation/2015-10-31/hybridrunbookworkergroup/id_automationaccount.go +++ b/resource-manager/automation/2015-10-31/hybridrunbookworkergroup/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2015-10-31/hybridrunbookworkergroup/id_hybridrunbookworkergroup.go b/resource-manager/automation/2015-10-31/hybridrunbookworkergroup/id_hybridrunbookworkergroup.go index 5a9d8c7a7e4..774227e7d67 100644 --- a/resource-manager/automation/2015-10-31/hybridrunbookworkergroup/id_hybridrunbookworkergroup.go +++ b/resource-manager/automation/2015-10-31/hybridrunbookworkergroup/id_hybridrunbookworkergroup.go @@ -38,23 +38,9 @@ func ParseHybridRunbookWorkerGroupID(input string) (*HybridRunbookWorkerGroupId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HybridRunbookWorkerGroupId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.HybridRunbookWorkerGroupName, ok = parsed.Parsed["hybridRunbookWorkerGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridRunbookWorkerGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseHybridRunbookWorkerGroupIDInsensitively(input string) (*HybridRunbookW return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HybridRunbookWorkerGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *HybridRunbookWorkerGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.HybridRunbookWorkerGroupName, ok = parsed.Parsed["hybridRunbookWorkerGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridRunbookWorkerGroupName", *parsed) + if id.HybridRunbookWorkerGroupName, ok = input.Parsed["hybridRunbookWorkerGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hybridRunbookWorkerGroupName", input) } - return &id, nil + return nil } // ValidateHybridRunbookWorkerGroupID checks that 'input' can be parsed as a Hybrid Runbook Worker Group ID diff --git a/resource-manager/automation/2015-10-31/job/id_automationaccount.go b/resource-manager/automation/2015-10-31/job/id_automationaccount.go index 92931d6f634..cbc63031f3b 100644 --- a/resource-manager/automation/2015-10-31/job/id_automationaccount.go +++ b/resource-manager/automation/2015-10-31/job/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2015-10-31/job/id_job.go b/resource-manager/automation/2015-10-31/job/id_job.go index 02bd7d38642..843678adae5 100644 --- a/resource-manager/automation/2015-10-31/job/id_job.go +++ b/resource-manager/automation/2015-10-31/job/id_job.go @@ -38,23 +38,9 @@ func ParseJobID(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.JobId, ok = parsed.Parsed["jobId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseJobIDInsensitively(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *JobId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.JobId, ok = parsed.Parsed["jobId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobId", *parsed) + if id.JobId, ok = input.Parsed["jobId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobId", input) } - return &id, nil + return nil } // ValidateJobID checks that 'input' can be parsed as a Job ID diff --git a/resource-manager/automation/2015-10-31/jobschedule/id_automationaccount.go b/resource-manager/automation/2015-10-31/jobschedule/id_automationaccount.go index 400c8f88c64..2b9d8abbf03 100644 --- a/resource-manager/automation/2015-10-31/jobschedule/id_automationaccount.go +++ b/resource-manager/automation/2015-10-31/jobschedule/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2015-10-31/jobschedule/id_jobschedule.go b/resource-manager/automation/2015-10-31/jobschedule/id_jobschedule.go index 96c657b3d4b..c2f160f1cf4 100644 --- a/resource-manager/automation/2015-10-31/jobschedule/id_jobschedule.go +++ b/resource-manager/automation/2015-10-31/jobschedule/id_jobschedule.go @@ -38,23 +38,9 @@ func ParseJobScheduleID(input string) (*JobScheduleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobScheduleId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.JobScheduleId, ok = parsed.Parsed["jobScheduleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobScheduleId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseJobScheduleIDInsensitively(input string) (*JobScheduleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobScheduleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *JobScheduleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.JobScheduleId, ok = parsed.Parsed["jobScheduleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobScheduleId", *parsed) + if id.JobScheduleId, ok = input.Parsed["jobScheduleId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobScheduleId", input) } - return &id, nil + return nil } // ValidateJobScheduleID checks that 'input' can be parsed as a Job Schedule ID diff --git a/resource-manager/automation/2015-10-31/jobstream/id_job.go b/resource-manager/automation/2015-10-31/jobstream/id_job.go index 0c0e86d7a40..9e306739402 100644 --- a/resource-manager/automation/2015-10-31/jobstream/id_job.go +++ b/resource-manager/automation/2015-10-31/jobstream/id_job.go @@ -38,23 +38,9 @@ func ParseJobID(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.JobId, ok = parsed.Parsed["jobId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseJobIDInsensitively(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *JobId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.JobId, ok = parsed.Parsed["jobId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobId", *parsed) + if id.JobId, ok = input.Parsed["jobId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobId", input) } - return &id, nil + return nil } // ValidateJobID checks that 'input' can be parsed as a Job ID diff --git a/resource-manager/automation/2015-10-31/jobstream/id_stream.go b/resource-manager/automation/2015-10-31/jobstream/id_stream.go index be3f2e3b58e..51e2c9fdf91 100644 --- a/resource-manager/automation/2015-10-31/jobstream/id_stream.go +++ b/resource-manager/automation/2015-10-31/jobstream/id_stream.go @@ -40,27 +40,9 @@ func ParseStreamID(input string) (*StreamId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StreamId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.JobId, ok = parsed.Parsed["jobId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobId", *parsed) - } - - if id.JobStreamId, ok = parsed.Parsed["jobStreamId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobStreamId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseStreamIDInsensitively(input string) (*StreamId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StreamId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *StreamId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.JobId, ok = parsed.Parsed["jobId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobId", *parsed) + if id.JobId, ok = input.Parsed["jobId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobId", input) } - if id.JobStreamId, ok = parsed.Parsed["jobStreamId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobStreamId", *parsed) + if id.JobStreamId, ok = input.Parsed["jobStreamId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobStreamId", input) } - return &id, nil + return nil } // ValidateStreamID checks that 'input' can be parsed as a Stream ID diff --git a/resource-manager/automation/2015-10-31/linkedworkspace/id_automationaccount.go b/resource-manager/automation/2015-10-31/linkedworkspace/id_automationaccount.go index deddffb8d5a..ea7bde1591e 100644 --- a/resource-manager/automation/2015-10-31/linkedworkspace/id_automationaccount.go +++ b/resource-manager/automation/2015-10-31/linkedworkspace/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2015-10-31/listkeys/id_automationaccount.go b/resource-manager/automation/2015-10-31/listkeys/id_automationaccount.go index 5f70ed146f5..ac3bcb95a66 100644 --- a/resource-manager/automation/2015-10-31/listkeys/id_automationaccount.go +++ b/resource-manager/automation/2015-10-31/listkeys/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2015-10-31/module/id_automationaccount.go b/resource-manager/automation/2015-10-31/module/id_automationaccount.go index eb9b0e144b5..90f3b8db661 100644 --- a/resource-manager/automation/2015-10-31/module/id_automationaccount.go +++ b/resource-manager/automation/2015-10-31/module/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2015-10-31/module/id_module.go b/resource-manager/automation/2015-10-31/module/id_module.go index d94c81de067..f556cfcb0e9 100644 --- a/resource-manager/automation/2015-10-31/module/id_module.go +++ b/resource-manager/automation/2015-10-31/module/id_module.go @@ -38,23 +38,9 @@ func ParseModuleID(input string) (*ModuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModuleId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseModuleIDInsensitively(input string) (*ModuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ModuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if id.ModuleName, ok = input.Parsed["moduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "moduleName", input) } - return &id, nil + return nil } // ValidateModuleID checks that 'input' can be parsed as a Module ID diff --git a/resource-manager/automation/2015-10-31/nodereports/id_node.go b/resource-manager/automation/2015-10-31/nodereports/id_node.go index c6647cae159..dc8ccf90f7f 100644 --- a/resource-manager/automation/2015-10-31/nodereports/id_node.go +++ b/resource-manager/automation/2015-10-31/nodereports/id_node.go @@ -38,23 +38,9 @@ func ParseNodeID(input string) (*NodeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NodeId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.NodeId, ok = parsed.Parsed["nodeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nodeId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseNodeIDInsensitively(input string) (*NodeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NodeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *NodeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.NodeId, ok = parsed.Parsed["nodeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nodeId", *parsed) + if id.NodeId, ok = input.Parsed["nodeId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "nodeId", input) } - return &id, nil + return nil } // ValidateNodeID checks that 'input' can be parsed as a Node ID diff --git a/resource-manager/automation/2015-10-31/nodereports/id_report.go b/resource-manager/automation/2015-10-31/nodereports/id_report.go index 445cf9c68ad..ee1bf3af901 100644 --- a/resource-manager/automation/2015-10-31/nodereports/id_report.go +++ b/resource-manager/automation/2015-10-31/nodereports/id_report.go @@ -40,27 +40,9 @@ func ParseReportID(input string) (*ReportId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReportId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.NodeId, ok = parsed.Parsed["nodeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nodeId", *parsed) - } - - if id.ReportId, ok = parsed.Parsed["reportId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reportId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReportIDInsensitively(input string) (*ReportId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReportId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReportId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.NodeId, ok = parsed.Parsed["nodeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nodeId", *parsed) + if id.NodeId, ok = input.Parsed["nodeId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "nodeId", input) } - if id.ReportId, ok = parsed.Parsed["reportId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reportId", *parsed) + if id.ReportId, ok = input.Parsed["reportId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reportId", input) } - return &id, nil + return nil } // ValidateReportID checks that 'input' can be parsed as a Report ID diff --git a/resource-manager/automation/2015-10-31/objectdatatypes/id_moduleobjectdatatype.go b/resource-manager/automation/2015-10-31/objectdatatypes/id_moduleobjectdatatype.go index f4b6295f338..c6781dacbff 100644 --- a/resource-manager/automation/2015-10-31/objectdatatypes/id_moduleobjectdatatype.go +++ b/resource-manager/automation/2015-10-31/objectdatatypes/id_moduleobjectdatatype.go @@ -40,27 +40,9 @@ func ParseModuleObjectDataTypeID(input string) (*ModuleObjectDataTypeId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModuleObjectDataTypeId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) - } - - if id.ObjectDataTypeName, ok = parsed.Parsed["objectDataTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "objectDataTypeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseModuleObjectDataTypeIDInsensitively(input string) (*ModuleObjectDataTy return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModuleObjectDataTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ModuleObjectDataTypeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if id.ModuleName, ok = input.Parsed["moduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "moduleName", input) } - if id.ObjectDataTypeName, ok = parsed.Parsed["objectDataTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "objectDataTypeName", *parsed) + if id.ObjectDataTypeName, ok = input.Parsed["objectDataTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "objectDataTypeName", input) } - return &id, nil + return nil } // ValidateModuleObjectDataTypeID checks that 'input' can be parsed as a Module Object Data Type ID diff --git a/resource-manager/automation/2015-10-31/objectdatatypes/id_objectdatatype.go b/resource-manager/automation/2015-10-31/objectdatatypes/id_objectdatatype.go index 1272d15447b..1035288be12 100644 --- a/resource-manager/automation/2015-10-31/objectdatatypes/id_objectdatatype.go +++ b/resource-manager/automation/2015-10-31/objectdatatypes/id_objectdatatype.go @@ -38,23 +38,9 @@ func ParseObjectDataTypeID(input string) (*ObjectDataTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ObjectDataTypeId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ObjectDataTypeName, ok = parsed.Parsed["objectDataTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "objectDataTypeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseObjectDataTypeIDInsensitively(input string) (*ObjectDataTypeId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ObjectDataTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ObjectDataTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ObjectDataTypeName, ok = parsed.Parsed["objectDataTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "objectDataTypeName", *parsed) + if id.ObjectDataTypeName, ok = input.Parsed["objectDataTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "objectDataTypeName", input) } - return &id, nil + return nil } // ValidateObjectDataTypeID checks that 'input' can be parsed as a Object Data Type ID diff --git a/resource-manager/automation/2015-10-31/runbook/id_automationaccount.go b/resource-manager/automation/2015-10-31/runbook/id_automationaccount.go index 8a8b18b7895..43161edfa7e 100644 --- a/resource-manager/automation/2015-10-31/runbook/id_automationaccount.go +++ b/resource-manager/automation/2015-10-31/runbook/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2015-10-31/runbook/id_runbook.go b/resource-manager/automation/2015-10-31/runbook/id_runbook.go index 2adace8bd11..9c8d15c9ac0 100644 --- a/resource-manager/automation/2015-10-31/runbook/id_runbook.go +++ b/resource-manager/automation/2015-10-31/runbook/id_runbook.go @@ -38,23 +38,9 @@ func ParseRunbookID(input string) (*RunbookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunbookId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.RunbookName, ok = parsed.Parsed["runbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runbookName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRunbookIDInsensitively(input string) (*RunbookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunbookId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RunbookId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.RunbookName, ok = parsed.Parsed["runbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runbookName", *parsed) + if id.RunbookName, ok = input.Parsed["runbookName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runbookName", input) } - return &id, nil + return nil } // ValidateRunbookID checks that 'input' can be parsed as a Runbook ID diff --git a/resource-manager/automation/2015-10-31/runbookdraft/id_runbook.go b/resource-manager/automation/2015-10-31/runbookdraft/id_runbook.go index 65a6774ab35..b01c075eb73 100644 --- a/resource-manager/automation/2015-10-31/runbookdraft/id_runbook.go +++ b/resource-manager/automation/2015-10-31/runbookdraft/id_runbook.go @@ -38,23 +38,9 @@ func ParseRunbookID(input string) (*RunbookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunbookId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.RunbookName, ok = parsed.Parsed["runbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runbookName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRunbookIDInsensitively(input string) (*RunbookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunbookId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RunbookId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.RunbookName, ok = parsed.Parsed["runbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runbookName", *parsed) + if id.RunbookName, ok = input.Parsed["runbookName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runbookName", input) } - return &id, nil + return nil } // ValidateRunbookID checks that 'input' can be parsed as a Runbook ID diff --git a/resource-manager/automation/2015-10-31/schedule/id_automationaccount.go b/resource-manager/automation/2015-10-31/schedule/id_automationaccount.go index 1bd8c3bfabe..14c4aea9691 100644 --- a/resource-manager/automation/2015-10-31/schedule/id_automationaccount.go +++ b/resource-manager/automation/2015-10-31/schedule/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2015-10-31/schedule/id_schedule.go b/resource-manager/automation/2015-10-31/schedule/id_schedule.go index 6cb8d3029c2..7dd7bb5fbc5 100644 --- a/resource-manager/automation/2015-10-31/schedule/id_schedule.go +++ b/resource-manager/automation/2015-10-31/schedule/id_schedule.go @@ -38,23 +38,9 @@ func ParseScheduleID(input string) (*ScheduleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScheduleId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ScheduleName, ok = parsed.Parsed["scheduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseScheduleIDInsensitively(input string) (*ScheduleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScheduleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ScheduleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ScheduleName, ok = parsed.Parsed["scheduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", *parsed) + if id.ScheduleName, ok = input.Parsed["scheduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", input) } - return &id, nil + return nil } // ValidateScheduleID checks that 'input' can be parsed as a Schedule ID diff --git a/resource-manager/automation/2015-10-31/statistics/id_automationaccount.go b/resource-manager/automation/2015-10-31/statistics/id_automationaccount.go index acb480c909f..f1006810ba4 100644 --- a/resource-manager/automation/2015-10-31/statistics/id_automationaccount.go +++ b/resource-manager/automation/2015-10-31/statistics/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2015-10-31/testjob/id_runbook.go b/resource-manager/automation/2015-10-31/testjob/id_runbook.go index 5ea2c22ce96..7a4b2bb504f 100644 --- a/resource-manager/automation/2015-10-31/testjob/id_runbook.go +++ b/resource-manager/automation/2015-10-31/testjob/id_runbook.go @@ -38,23 +38,9 @@ func ParseRunbookID(input string) (*RunbookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunbookId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.RunbookName, ok = parsed.Parsed["runbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runbookName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRunbookIDInsensitively(input string) (*RunbookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunbookId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RunbookId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.RunbookName, ok = parsed.Parsed["runbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runbookName", *parsed) + if id.RunbookName, ok = input.Parsed["runbookName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runbookName", input) } - return &id, nil + return nil } // ValidateRunbookID checks that 'input' can be parsed as a Runbook ID diff --git a/resource-manager/automation/2015-10-31/testjobstream/id_runbook.go b/resource-manager/automation/2015-10-31/testjobstream/id_runbook.go index b9602d1e074..2db9b3a2d82 100644 --- a/resource-manager/automation/2015-10-31/testjobstream/id_runbook.go +++ b/resource-manager/automation/2015-10-31/testjobstream/id_runbook.go @@ -38,23 +38,9 @@ func ParseRunbookID(input string) (*RunbookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunbookId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.RunbookName, ok = parsed.Parsed["runbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runbookName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRunbookIDInsensitively(input string) (*RunbookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunbookId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RunbookId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.RunbookName, ok = parsed.Parsed["runbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runbookName", *parsed) + if id.RunbookName, ok = input.Parsed["runbookName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runbookName", input) } - return &id, nil + return nil } // ValidateRunbookID checks that 'input' can be parsed as a Runbook ID diff --git a/resource-manager/automation/2015-10-31/testjobstream/id_testjobstream.go b/resource-manager/automation/2015-10-31/testjobstream/id_testjobstream.go index 7cfa557b55b..adb397aab0c 100644 --- a/resource-manager/automation/2015-10-31/testjobstream/id_testjobstream.go +++ b/resource-manager/automation/2015-10-31/testjobstream/id_testjobstream.go @@ -40,27 +40,9 @@ func ParseTestJobStreamID(input string) (*TestJobStreamId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TestJobStreamId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.RunbookName, ok = parsed.Parsed["runbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runbookName", *parsed) - } - - if id.JobStreamId, ok = parsed.Parsed["jobStreamId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobStreamId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseTestJobStreamIDInsensitively(input string) (*TestJobStreamId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TestJobStreamId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TestJobStreamId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.RunbookName, ok = parsed.Parsed["runbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runbookName", *parsed) + if id.RunbookName, ok = input.Parsed["runbookName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runbookName", input) } - if id.JobStreamId, ok = parsed.Parsed["jobStreamId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobStreamId", *parsed) + if id.JobStreamId, ok = input.Parsed["jobStreamId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobStreamId", input) } - return &id, nil + return nil } // ValidateTestJobStreamID checks that 'input' can be parsed as a Test Job Stream ID diff --git a/resource-manager/automation/2015-10-31/typefields/id_type.go b/resource-manager/automation/2015-10-31/typefields/id_type.go index 494728e37cc..a8529df8d82 100644 --- a/resource-manager/automation/2015-10-31/typefields/id_type.go +++ b/resource-manager/automation/2015-10-31/typefields/id_type.go @@ -40,27 +40,9 @@ func ParseTypeID(input string) (*TypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TypeId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) - } - - if id.TypeName, ok = parsed.Parsed["typeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "typeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseTypeIDInsensitively(input string) (*TypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TypeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if id.ModuleName, ok = input.Parsed["moduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "moduleName", input) } - if id.TypeName, ok = parsed.Parsed["typeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "typeName", *parsed) + if id.TypeName, ok = input.Parsed["typeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "typeName", input) } - return &id, nil + return nil } // ValidateTypeID checks that 'input' can be parsed as a Type ID diff --git a/resource-manager/automation/2015-10-31/usages/id_automationaccount.go b/resource-manager/automation/2015-10-31/usages/id_automationaccount.go index 92d03475dfc..5325f60346c 100644 --- a/resource-manager/automation/2015-10-31/usages/id_automationaccount.go +++ b/resource-manager/automation/2015-10-31/usages/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2015-10-31/variable/id_automationaccount.go b/resource-manager/automation/2015-10-31/variable/id_automationaccount.go index 5e89d091247..55cc4873ac0 100644 --- a/resource-manager/automation/2015-10-31/variable/id_automationaccount.go +++ b/resource-manager/automation/2015-10-31/variable/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2015-10-31/variable/id_variable.go b/resource-manager/automation/2015-10-31/variable/id_variable.go index 6f4c6f2db0e..15c186227f2 100644 --- a/resource-manager/automation/2015-10-31/variable/id_variable.go +++ b/resource-manager/automation/2015-10-31/variable/id_variable.go @@ -38,23 +38,9 @@ func ParseVariableID(input string) (*VariableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VariableId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.VariableName, ok = parsed.Parsed["variableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "variableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVariableIDInsensitively(input string) (*VariableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VariableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VariableId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.VariableName, ok = parsed.Parsed["variableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "variableName", *parsed) + if id.VariableName, ok = input.Parsed["variableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "variableName", input) } - return &id, nil + return nil } // ValidateVariableID checks that 'input' can be parsed as a Variable ID diff --git a/resource-manager/automation/2015-10-31/watcher/id_automationaccount.go b/resource-manager/automation/2015-10-31/watcher/id_automationaccount.go index c63a4470c5a..45aadf4b69c 100644 --- a/resource-manager/automation/2015-10-31/watcher/id_automationaccount.go +++ b/resource-manager/automation/2015-10-31/watcher/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2015-10-31/watcher/id_watcher.go b/resource-manager/automation/2015-10-31/watcher/id_watcher.go index a5e15b03801..40f4c7a735a 100644 --- a/resource-manager/automation/2015-10-31/watcher/id_watcher.go +++ b/resource-manager/automation/2015-10-31/watcher/id_watcher.go @@ -38,23 +38,9 @@ func ParseWatcherID(input string) (*WatcherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WatcherId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.WatcherName, ok = parsed.Parsed["watcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watcherName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWatcherIDInsensitively(input string) (*WatcherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WatcherId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WatcherId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.WatcherName, ok = parsed.Parsed["watcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watcherName", *parsed) + if id.WatcherName, ok = input.Parsed["watcherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "watcherName", input) } - return &id, nil + return nil } // ValidateWatcherID checks that 'input' can be parsed as a Watcher ID diff --git a/resource-manager/automation/2015-10-31/webhook/id_automationaccount.go b/resource-manager/automation/2015-10-31/webhook/id_automationaccount.go index 725ca6e4447..309bf48fcf7 100644 --- a/resource-manager/automation/2015-10-31/webhook/id_automationaccount.go +++ b/resource-manager/automation/2015-10-31/webhook/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2015-10-31/webhook/id_webhook.go b/resource-manager/automation/2015-10-31/webhook/id_webhook.go index acb8b7029ce..5894053ca46 100644 --- a/resource-manager/automation/2015-10-31/webhook/id_webhook.go +++ b/resource-manager/automation/2015-10-31/webhook/id_webhook.go @@ -38,23 +38,9 @@ func ParseWebHookID(input string) (*WebHookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WebHookId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.WebHookName, ok = parsed.Parsed["webHookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "webHookName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWebHookIDInsensitively(input string) (*WebHookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WebHookId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WebHookId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.WebHookName, ok = parsed.Parsed["webHookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "webHookName", *parsed) + if id.WebHookName, ok = input.Parsed["webHookName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "webHookName", input) } - return &id, nil + return nil } // ValidateWebHookID checks that 'input' can be parsed as a Web Hook ID diff --git a/resource-manager/automation/2019-06-01/activity/id_activity.go b/resource-manager/automation/2019-06-01/activity/id_activity.go index 3930c905492..9a1bddcd0a9 100644 --- a/resource-manager/automation/2019-06-01/activity/id_activity.go +++ b/resource-manager/automation/2019-06-01/activity/id_activity.go @@ -40,27 +40,9 @@ func ParseActivityID(input string) (*ActivityId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ActivityId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) - } - - if id.ActivityName, ok = parsed.Parsed["activityName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "activityName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseActivityIDInsensitively(input string) (*ActivityId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ActivityId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ActivityId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if id.ModuleName, ok = input.Parsed["moduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "moduleName", input) } - if id.ActivityName, ok = parsed.Parsed["activityName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "activityName", *parsed) + if id.ActivityName, ok = input.Parsed["activityName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "activityName", input) } - return &id, nil + return nil } // ValidateActivityID checks that 'input' can be parsed as a Activity ID diff --git a/resource-manager/automation/2019-06-01/activity/id_module.go b/resource-manager/automation/2019-06-01/activity/id_module.go index 0c927d16d45..15aac63648e 100644 --- a/resource-manager/automation/2019-06-01/activity/id_module.go +++ b/resource-manager/automation/2019-06-01/activity/id_module.go @@ -38,23 +38,9 @@ func ParseModuleID(input string) (*ModuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModuleId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseModuleIDInsensitively(input string) (*ModuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ModuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if id.ModuleName, ok = input.Parsed["moduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "moduleName", input) } - return &id, nil + return nil } // ValidateModuleID checks that 'input' can be parsed as a Module ID diff --git a/resource-manager/automation/2019-06-01/agentregistrationinformation/id_automationaccount.go b/resource-manager/automation/2019-06-01/agentregistrationinformation/id_automationaccount.go index 08b840fe82d..ed488fda092 100644 --- a/resource-manager/automation/2019-06-01/agentregistrationinformation/id_automationaccount.go +++ b/resource-manager/automation/2019-06-01/agentregistrationinformation/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2019-06-01/automationaccount/id_automationaccount.go b/resource-manager/automation/2019-06-01/automationaccount/id_automationaccount.go index 507f59b0248..30125ce2604 100644 --- a/resource-manager/automation/2019-06-01/automationaccount/id_automationaccount.go +++ b/resource-manager/automation/2019-06-01/automationaccount/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2019-06-01/certificate/id_automationaccount.go b/resource-manager/automation/2019-06-01/certificate/id_automationaccount.go index b72970d4392..5f31a6b8efd 100644 --- a/resource-manager/automation/2019-06-01/certificate/id_automationaccount.go +++ b/resource-manager/automation/2019-06-01/certificate/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2019-06-01/certificate/id_certificate.go b/resource-manager/automation/2019-06-01/certificate/id_certificate.go index a4dd6601140..492524d5d54 100644 --- a/resource-manager/automation/2019-06-01/certificate/id_certificate.go +++ b/resource-manager/automation/2019-06-01/certificate/id_certificate.go @@ -38,23 +38,9 @@ func ParseCertificateID(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCertificateIDInsensitively(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if id.CertificateName, ok = input.Parsed["certificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateName", input) } - return &id, nil + return nil } // ValidateCertificateID checks that 'input' can be parsed as a Certificate ID diff --git a/resource-manager/automation/2019-06-01/connection/id_automationaccount.go b/resource-manager/automation/2019-06-01/connection/id_automationaccount.go index 6b4cf0ead8b..0036ab33fe6 100644 --- a/resource-manager/automation/2019-06-01/connection/id_automationaccount.go +++ b/resource-manager/automation/2019-06-01/connection/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2019-06-01/connection/id_connection.go b/resource-manager/automation/2019-06-01/connection/id_connection.go index e38741628fe..8199efc92b3 100644 --- a/resource-manager/automation/2019-06-01/connection/id_connection.go +++ b/resource-manager/automation/2019-06-01/connection/id_connection.go @@ -38,23 +38,9 @@ func ParseConnectionID(input string) (*ConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ConnectionName, ok = parsed.Parsed["connectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConnectionIDInsensitively(input string) (*ConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ConnectionName, ok = parsed.Parsed["connectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionName", *parsed) + if id.ConnectionName, ok = input.Parsed["connectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectionName", input) } - return &id, nil + return nil } // ValidateConnectionID checks that 'input' can be parsed as a Connection ID diff --git a/resource-manager/automation/2019-06-01/connectiontype/id_automationaccount.go b/resource-manager/automation/2019-06-01/connectiontype/id_automationaccount.go index 9ac59c1b5c4..2df28b9d4b3 100644 --- a/resource-manager/automation/2019-06-01/connectiontype/id_automationaccount.go +++ b/resource-manager/automation/2019-06-01/connectiontype/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2019-06-01/connectiontype/id_connectiontype.go b/resource-manager/automation/2019-06-01/connectiontype/id_connectiontype.go index c27cff4d1ee..c933b61f97a 100644 --- a/resource-manager/automation/2019-06-01/connectiontype/id_connectiontype.go +++ b/resource-manager/automation/2019-06-01/connectiontype/id_connectiontype.go @@ -38,23 +38,9 @@ func ParseConnectionTypeID(input string) (*ConnectionTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionTypeId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ConnectionTypeName, ok = parsed.Parsed["connectionTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionTypeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConnectionTypeIDInsensitively(input string) (*ConnectionTypeId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConnectionTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ConnectionTypeName, ok = parsed.Parsed["connectionTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionTypeName", *parsed) + if id.ConnectionTypeName, ok = input.Parsed["connectionTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectionTypeName", input) } - return &id, nil + return nil } // ValidateConnectionTypeID checks that 'input' can be parsed as a Connection Type ID diff --git a/resource-manager/automation/2019-06-01/credential/id_automationaccount.go b/resource-manager/automation/2019-06-01/credential/id_automationaccount.go index 1d277938871..a8ea4d95e75 100644 --- a/resource-manager/automation/2019-06-01/credential/id_automationaccount.go +++ b/resource-manager/automation/2019-06-01/credential/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2019-06-01/credential/id_credential.go b/resource-manager/automation/2019-06-01/credential/id_credential.go index 3bc69d79906..6f666f05d43 100644 --- a/resource-manager/automation/2019-06-01/credential/id_credential.go +++ b/resource-manager/automation/2019-06-01/credential/id_credential.go @@ -38,23 +38,9 @@ func ParseCredentialID(input string) (*CredentialId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CredentialId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.CredentialName, ok = parsed.Parsed["credentialName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "credentialName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCredentialIDInsensitively(input string) (*CredentialId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CredentialId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CredentialId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.CredentialName, ok = parsed.Parsed["credentialName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "credentialName", *parsed) + if id.CredentialName, ok = input.Parsed["credentialName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "credentialName", input) } - return &id, nil + return nil } // ValidateCredentialID checks that 'input' can be parsed as a Credential ID diff --git a/resource-manager/automation/2019-06-01/dsccompilationjob/id_automationaccount.go b/resource-manager/automation/2019-06-01/dsccompilationjob/id_automationaccount.go index f67a1327f44..b9f8082811a 100644 --- a/resource-manager/automation/2019-06-01/dsccompilationjob/id_automationaccount.go +++ b/resource-manager/automation/2019-06-01/dsccompilationjob/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2019-06-01/dsccompilationjob/id_compilationjobstream.go b/resource-manager/automation/2019-06-01/dsccompilationjob/id_compilationjobstream.go index 414a06e2b1a..2acbbc1d81a 100644 --- a/resource-manager/automation/2019-06-01/dsccompilationjob/id_compilationjobstream.go +++ b/resource-manager/automation/2019-06-01/dsccompilationjob/id_compilationjobstream.go @@ -40,27 +40,9 @@ func ParseCompilationJobStreamID(input string) (*CompilationJobStreamId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CompilationJobStreamId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.CompilationJobName, ok = parsed.Parsed["compilationJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "compilationJobName", *parsed) - } - - if id.JobStreamId, ok = parsed.Parsed["jobStreamId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobStreamId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseCompilationJobStreamIDInsensitively(input string) (*CompilationJobStre return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CompilationJobStreamId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *CompilationJobStreamId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.CompilationJobName, ok = parsed.Parsed["compilationJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "compilationJobName", *parsed) + if id.CompilationJobName, ok = input.Parsed["compilationJobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "compilationJobName", input) } - if id.JobStreamId, ok = parsed.Parsed["jobStreamId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobStreamId", *parsed) + if id.JobStreamId, ok = input.Parsed["jobStreamId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobStreamId", input) } - return &id, nil + return nil } // ValidateCompilationJobStreamID checks that 'input' can be parsed as a Compilation Job Stream ID diff --git a/resource-manager/automation/2019-06-01/dscconfiguration/id_automationaccount.go b/resource-manager/automation/2019-06-01/dscconfiguration/id_automationaccount.go index e55bc5823ef..7d065e1e87f 100644 --- a/resource-manager/automation/2019-06-01/dscconfiguration/id_automationaccount.go +++ b/resource-manager/automation/2019-06-01/dscconfiguration/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2019-06-01/dscconfiguration/id_configuration.go b/resource-manager/automation/2019-06-01/dscconfiguration/id_configuration.go index 9ab132d3e0a..ad9cf42c091 100644 --- a/resource-manager/automation/2019-06-01/dscconfiguration/id_configuration.go +++ b/resource-manager/automation/2019-06-01/dscconfiguration/id_configuration.go @@ -38,23 +38,9 @@ func ParseConfigurationID(input string) (*ConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConfigurationIDInsensitively(input string) (*ConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationName", *parsed) + if id.ConfigurationName, ok = input.Parsed["configurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationName", input) } - return &id, nil + return nil } // ValidateConfigurationID checks that 'input' can be parsed as a Configuration ID diff --git a/resource-manager/automation/2019-06-01/dscnode/id_automationaccount.go b/resource-manager/automation/2019-06-01/dscnode/id_automationaccount.go index 93f32245d95..dc7ca325d76 100644 --- a/resource-manager/automation/2019-06-01/dscnode/id_automationaccount.go +++ b/resource-manager/automation/2019-06-01/dscnode/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2019-06-01/dscnode/id_node.go b/resource-manager/automation/2019-06-01/dscnode/id_node.go index ba81c8d1099..f838b58dfb7 100644 --- a/resource-manager/automation/2019-06-01/dscnode/id_node.go +++ b/resource-manager/automation/2019-06-01/dscnode/id_node.go @@ -38,23 +38,9 @@ func ParseNodeID(input string) (*NodeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NodeId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.NodeId, ok = parsed.Parsed["nodeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nodeId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseNodeIDInsensitively(input string) (*NodeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NodeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *NodeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.NodeId, ok = parsed.Parsed["nodeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nodeId", *parsed) + if id.NodeId, ok = input.Parsed["nodeId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "nodeId", input) } - return &id, nil + return nil } // ValidateNodeID checks that 'input' can be parsed as a Node ID diff --git a/resource-manager/automation/2019-06-01/dscnodeconfiguration/id_automationaccount.go b/resource-manager/automation/2019-06-01/dscnodeconfiguration/id_automationaccount.go index 86960689e71..254e43fe5d9 100644 --- a/resource-manager/automation/2019-06-01/dscnodeconfiguration/id_automationaccount.go +++ b/resource-manager/automation/2019-06-01/dscnodeconfiguration/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2019-06-01/dscnodeconfiguration/id_nodeconfiguration.go b/resource-manager/automation/2019-06-01/dscnodeconfiguration/id_nodeconfiguration.go index df13fdfef49..7d94c8c45ea 100644 --- a/resource-manager/automation/2019-06-01/dscnodeconfiguration/id_nodeconfiguration.go +++ b/resource-manager/automation/2019-06-01/dscnodeconfiguration/id_nodeconfiguration.go @@ -38,23 +38,9 @@ func ParseNodeConfigurationID(input string) (*NodeConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NodeConfigurationId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.NodeConfigurationName, ok = parsed.Parsed["nodeConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nodeConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseNodeConfigurationIDInsensitively(input string) (*NodeConfigurationId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NodeConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *NodeConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.NodeConfigurationName, ok = parsed.Parsed["nodeConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nodeConfigurationName", *parsed) + if id.NodeConfigurationName, ok = input.Parsed["nodeConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "nodeConfigurationName", input) } - return &id, nil + return nil } // ValidateNodeConfigurationID checks that 'input' can be parsed as a Node Configuration ID diff --git a/resource-manager/automation/2019-06-01/hybridrunbookworkergroup/id_automationaccount.go b/resource-manager/automation/2019-06-01/hybridrunbookworkergroup/id_automationaccount.go index 33a62270abe..3a2202493f9 100644 --- a/resource-manager/automation/2019-06-01/hybridrunbookworkergroup/id_automationaccount.go +++ b/resource-manager/automation/2019-06-01/hybridrunbookworkergroup/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2019-06-01/hybridrunbookworkergroup/id_hybridrunbookworkergroup.go b/resource-manager/automation/2019-06-01/hybridrunbookworkergroup/id_hybridrunbookworkergroup.go index 5a9d8c7a7e4..774227e7d67 100644 --- a/resource-manager/automation/2019-06-01/hybridrunbookworkergroup/id_hybridrunbookworkergroup.go +++ b/resource-manager/automation/2019-06-01/hybridrunbookworkergroup/id_hybridrunbookworkergroup.go @@ -38,23 +38,9 @@ func ParseHybridRunbookWorkerGroupID(input string) (*HybridRunbookWorkerGroupId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HybridRunbookWorkerGroupId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.HybridRunbookWorkerGroupName, ok = parsed.Parsed["hybridRunbookWorkerGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridRunbookWorkerGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseHybridRunbookWorkerGroupIDInsensitively(input string) (*HybridRunbookW return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HybridRunbookWorkerGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *HybridRunbookWorkerGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.HybridRunbookWorkerGroupName, ok = parsed.Parsed["hybridRunbookWorkerGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridRunbookWorkerGroupName", *parsed) + if id.HybridRunbookWorkerGroupName, ok = input.Parsed["hybridRunbookWorkerGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hybridRunbookWorkerGroupName", input) } - return &id, nil + return nil } // ValidateHybridRunbookWorkerGroupID checks that 'input' can be parsed as a Hybrid Runbook Worker Group ID diff --git a/resource-manager/automation/2019-06-01/job/id_automationaccount.go b/resource-manager/automation/2019-06-01/job/id_automationaccount.go index 92931d6f634..cbc63031f3b 100644 --- a/resource-manager/automation/2019-06-01/job/id_automationaccount.go +++ b/resource-manager/automation/2019-06-01/job/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2019-06-01/job/id_job.go b/resource-manager/automation/2019-06-01/job/id_job.go index fbadf9f6a12..301f0ade03f 100644 --- a/resource-manager/automation/2019-06-01/job/id_job.go +++ b/resource-manager/automation/2019-06-01/job/id_job.go @@ -38,23 +38,9 @@ func ParseJobID(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseJobIDInsensitively(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *JobId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - return &id, nil + return nil } // ValidateJobID checks that 'input' can be parsed as a Job ID diff --git a/resource-manager/automation/2019-06-01/jobschedule/id_automationaccount.go b/resource-manager/automation/2019-06-01/jobschedule/id_automationaccount.go index 400c8f88c64..2b9d8abbf03 100644 --- a/resource-manager/automation/2019-06-01/jobschedule/id_automationaccount.go +++ b/resource-manager/automation/2019-06-01/jobschedule/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2019-06-01/jobschedule/id_jobschedule.go b/resource-manager/automation/2019-06-01/jobschedule/id_jobschedule.go index 96c657b3d4b..c2f160f1cf4 100644 --- a/resource-manager/automation/2019-06-01/jobschedule/id_jobschedule.go +++ b/resource-manager/automation/2019-06-01/jobschedule/id_jobschedule.go @@ -38,23 +38,9 @@ func ParseJobScheduleID(input string) (*JobScheduleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobScheduleId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.JobScheduleId, ok = parsed.Parsed["jobScheduleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobScheduleId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseJobScheduleIDInsensitively(input string) (*JobScheduleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobScheduleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *JobScheduleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.JobScheduleId, ok = parsed.Parsed["jobScheduleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobScheduleId", *parsed) + if id.JobScheduleId, ok = input.Parsed["jobScheduleId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobScheduleId", input) } - return &id, nil + return nil } // ValidateJobScheduleID checks that 'input' can be parsed as a Job Schedule ID diff --git a/resource-manager/automation/2019-06-01/jobstream/id_job.go b/resource-manager/automation/2019-06-01/jobstream/id_job.go index 0d8282be25c..46e6c67a788 100644 --- a/resource-manager/automation/2019-06-01/jobstream/id_job.go +++ b/resource-manager/automation/2019-06-01/jobstream/id_job.go @@ -38,23 +38,9 @@ func ParseJobID(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseJobIDInsensitively(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *JobId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - return &id, nil + return nil } // ValidateJobID checks that 'input' can be parsed as a Job ID diff --git a/resource-manager/automation/2019-06-01/jobstream/id_stream.go b/resource-manager/automation/2019-06-01/jobstream/id_stream.go index 2cbff7b6794..edb99c9e84e 100644 --- a/resource-manager/automation/2019-06-01/jobstream/id_stream.go +++ b/resource-manager/automation/2019-06-01/jobstream/id_stream.go @@ -40,27 +40,9 @@ func ParseStreamID(input string) (*StreamId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StreamId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) - } - - if id.JobStreamId, ok = parsed.Parsed["jobStreamId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobStreamId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseStreamIDInsensitively(input string) (*StreamId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StreamId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *StreamId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - if id.JobStreamId, ok = parsed.Parsed["jobStreamId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobStreamId", *parsed) + if id.JobStreamId, ok = input.Parsed["jobStreamId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobStreamId", input) } - return &id, nil + return nil } // ValidateStreamID checks that 'input' can be parsed as a Stream ID diff --git a/resource-manager/automation/2019-06-01/linkedworkspace/id_automationaccount.go b/resource-manager/automation/2019-06-01/linkedworkspace/id_automationaccount.go index deddffb8d5a..ea7bde1591e 100644 --- a/resource-manager/automation/2019-06-01/linkedworkspace/id_automationaccount.go +++ b/resource-manager/automation/2019-06-01/linkedworkspace/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2019-06-01/listkeys/id_automationaccount.go b/resource-manager/automation/2019-06-01/listkeys/id_automationaccount.go index 5f70ed146f5..ac3bcb95a66 100644 --- a/resource-manager/automation/2019-06-01/listkeys/id_automationaccount.go +++ b/resource-manager/automation/2019-06-01/listkeys/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2019-06-01/module/id_automationaccount.go b/resource-manager/automation/2019-06-01/module/id_automationaccount.go index eb9b0e144b5..90f3b8db661 100644 --- a/resource-manager/automation/2019-06-01/module/id_automationaccount.go +++ b/resource-manager/automation/2019-06-01/module/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2019-06-01/module/id_module.go b/resource-manager/automation/2019-06-01/module/id_module.go index d94c81de067..f556cfcb0e9 100644 --- a/resource-manager/automation/2019-06-01/module/id_module.go +++ b/resource-manager/automation/2019-06-01/module/id_module.go @@ -38,23 +38,9 @@ func ParseModuleID(input string) (*ModuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModuleId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseModuleIDInsensitively(input string) (*ModuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ModuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if id.ModuleName, ok = input.Parsed["moduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "moduleName", input) } - return &id, nil + return nil } // ValidateModuleID checks that 'input' can be parsed as a Module ID diff --git a/resource-manager/automation/2019-06-01/nodecountinformation/id_counttype.go b/resource-manager/automation/2019-06-01/nodecountinformation/id_counttype.go index c73497c8c40..0688a1d71bb 100644 --- a/resource-manager/automation/2019-06-01/nodecountinformation/id_counttype.go +++ b/resource-manager/automation/2019-06-01/nodecountinformation/id_counttype.go @@ -38,31 +38,9 @@ func ParseCountTypeID(input string) (*CountTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CountTypeId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if v, ok := parsed.Parsed["countType"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "countType", *parsed) - } - - countType, err := parseCountType(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.CountType = *countType + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -77,34 +55,42 @@ func ParseCountTypeIDInsensitively(input string) (*CountTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CountTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *CountTypeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if v, ok := parsed.Parsed["countType"]; true { + if v, ok := input.Parsed["countType"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "countType", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "countType", input) } countType, err := parseCountType(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.CountType = *countType } - return &id, nil + return nil } // ValidateCountTypeID checks that 'input' can be parsed as a Count Type ID diff --git a/resource-manager/automation/2019-06-01/nodereports/id_node.go b/resource-manager/automation/2019-06-01/nodereports/id_node.go index c6647cae159..dc8ccf90f7f 100644 --- a/resource-manager/automation/2019-06-01/nodereports/id_node.go +++ b/resource-manager/automation/2019-06-01/nodereports/id_node.go @@ -38,23 +38,9 @@ func ParseNodeID(input string) (*NodeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NodeId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.NodeId, ok = parsed.Parsed["nodeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nodeId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseNodeIDInsensitively(input string) (*NodeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NodeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *NodeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.NodeId, ok = parsed.Parsed["nodeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nodeId", *parsed) + if id.NodeId, ok = input.Parsed["nodeId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "nodeId", input) } - return &id, nil + return nil } // ValidateNodeID checks that 'input' can be parsed as a Node ID diff --git a/resource-manager/automation/2019-06-01/nodereports/id_report.go b/resource-manager/automation/2019-06-01/nodereports/id_report.go index 445cf9c68ad..ee1bf3af901 100644 --- a/resource-manager/automation/2019-06-01/nodereports/id_report.go +++ b/resource-manager/automation/2019-06-01/nodereports/id_report.go @@ -40,27 +40,9 @@ func ParseReportID(input string) (*ReportId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReportId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.NodeId, ok = parsed.Parsed["nodeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nodeId", *parsed) - } - - if id.ReportId, ok = parsed.Parsed["reportId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reportId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReportIDInsensitively(input string) (*ReportId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReportId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReportId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.NodeId, ok = parsed.Parsed["nodeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nodeId", *parsed) + if id.NodeId, ok = input.Parsed["nodeId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "nodeId", input) } - if id.ReportId, ok = parsed.Parsed["reportId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reportId", *parsed) + if id.ReportId, ok = input.Parsed["reportId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reportId", input) } - return &id, nil + return nil } // ValidateReportID checks that 'input' can be parsed as a Report ID diff --git a/resource-manager/automation/2019-06-01/objectdatatypes/id_moduleobjectdatatype.go b/resource-manager/automation/2019-06-01/objectdatatypes/id_moduleobjectdatatype.go index f4b6295f338..c6781dacbff 100644 --- a/resource-manager/automation/2019-06-01/objectdatatypes/id_moduleobjectdatatype.go +++ b/resource-manager/automation/2019-06-01/objectdatatypes/id_moduleobjectdatatype.go @@ -40,27 +40,9 @@ func ParseModuleObjectDataTypeID(input string) (*ModuleObjectDataTypeId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModuleObjectDataTypeId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) - } - - if id.ObjectDataTypeName, ok = parsed.Parsed["objectDataTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "objectDataTypeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseModuleObjectDataTypeIDInsensitively(input string) (*ModuleObjectDataTy return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModuleObjectDataTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ModuleObjectDataTypeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if id.ModuleName, ok = input.Parsed["moduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "moduleName", input) } - if id.ObjectDataTypeName, ok = parsed.Parsed["objectDataTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "objectDataTypeName", *parsed) + if id.ObjectDataTypeName, ok = input.Parsed["objectDataTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "objectDataTypeName", input) } - return &id, nil + return nil } // ValidateModuleObjectDataTypeID checks that 'input' can be parsed as a Module Object Data Type ID diff --git a/resource-manager/automation/2019-06-01/objectdatatypes/id_objectdatatype.go b/resource-manager/automation/2019-06-01/objectdatatypes/id_objectdatatype.go index 1272d15447b..1035288be12 100644 --- a/resource-manager/automation/2019-06-01/objectdatatypes/id_objectdatatype.go +++ b/resource-manager/automation/2019-06-01/objectdatatypes/id_objectdatatype.go @@ -38,23 +38,9 @@ func ParseObjectDataTypeID(input string) (*ObjectDataTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ObjectDataTypeId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ObjectDataTypeName, ok = parsed.Parsed["objectDataTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "objectDataTypeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseObjectDataTypeIDInsensitively(input string) (*ObjectDataTypeId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ObjectDataTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ObjectDataTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ObjectDataTypeName, ok = parsed.Parsed["objectDataTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "objectDataTypeName", *parsed) + if id.ObjectDataTypeName, ok = input.Parsed["objectDataTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "objectDataTypeName", input) } - return &id, nil + return nil } // ValidateObjectDataTypeID checks that 'input' can be parsed as a Object Data Type ID diff --git a/resource-manager/automation/2019-06-01/python2package/id_automationaccount.go b/resource-manager/automation/2019-06-01/python2package/id_automationaccount.go index d768add2e38..1de475464a5 100644 --- a/resource-manager/automation/2019-06-01/python2package/id_automationaccount.go +++ b/resource-manager/automation/2019-06-01/python2package/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2019-06-01/python2package/id_python2package.go b/resource-manager/automation/2019-06-01/python2package/id_python2package.go index 8ed4fe6bda2..b72866ad718 100644 --- a/resource-manager/automation/2019-06-01/python2package/id_python2package.go +++ b/resource-manager/automation/2019-06-01/python2package/id_python2package.go @@ -38,23 +38,9 @@ func ParsePython2PackageID(input string) (*Python2PackageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Python2PackageId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.Python2PackageName, ok = parsed.Parsed["python2PackageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "python2PackageName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePython2PackageIDInsensitively(input string) (*Python2PackageId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Python2PackageId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *Python2PackageId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.Python2PackageName, ok = parsed.Parsed["python2PackageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "python2PackageName", *parsed) + if id.Python2PackageName, ok = input.Parsed["python2PackageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "python2PackageName", input) } - return &id, nil + return nil } // ValidatePython2PackageID checks that 'input' can be parsed as a Python 2 Package ID diff --git a/resource-manager/automation/2019-06-01/runbook/id_automationaccount.go b/resource-manager/automation/2019-06-01/runbook/id_automationaccount.go index 8a8b18b7895..43161edfa7e 100644 --- a/resource-manager/automation/2019-06-01/runbook/id_automationaccount.go +++ b/resource-manager/automation/2019-06-01/runbook/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2019-06-01/runbook/id_runbook.go b/resource-manager/automation/2019-06-01/runbook/id_runbook.go index 2adace8bd11..9c8d15c9ac0 100644 --- a/resource-manager/automation/2019-06-01/runbook/id_runbook.go +++ b/resource-manager/automation/2019-06-01/runbook/id_runbook.go @@ -38,23 +38,9 @@ func ParseRunbookID(input string) (*RunbookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunbookId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.RunbookName, ok = parsed.Parsed["runbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runbookName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRunbookIDInsensitively(input string) (*RunbookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunbookId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RunbookId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.RunbookName, ok = parsed.Parsed["runbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runbookName", *parsed) + if id.RunbookName, ok = input.Parsed["runbookName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runbookName", input) } - return &id, nil + return nil } // ValidateRunbookID checks that 'input' can be parsed as a Runbook ID diff --git a/resource-manager/automation/2019-06-01/runbookdraft/id_runbook.go b/resource-manager/automation/2019-06-01/runbookdraft/id_runbook.go index 65a6774ab35..b01c075eb73 100644 --- a/resource-manager/automation/2019-06-01/runbookdraft/id_runbook.go +++ b/resource-manager/automation/2019-06-01/runbookdraft/id_runbook.go @@ -38,23 +38,9 @@ func ParseRunbookID(input string) (*RunbookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunbookId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.RunbookName, ok = parsed.Parsed["runbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runbookName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRunbookIDInsensitively(input string) (*RunbookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunbookId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RunbookId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.RunbookName, ok = parsed.Parsed["runbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runbookName", *parsed) + if id.RunbookName, ok = input.Parsed["runbookName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runbookName", input) } - return &id, nil + return nil } // ValidateRunbookID checks that 'input' can be parsed as a Runbook ID diff --git a/resource-manager/automation/2019-06-01/schedule/id_automationaccount.go b/resource-manager/automation/2019-06-01/schedule/id_automationaccount.go index 1bd8c3bfabe..14c4aea9691 100644 --- a/resource-manager/automation/2019-06-01/schedule/id_automationaccount.go +++ b/resource-manager/automation/2019-06-01/schedule/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2019-06-01/schedule/id_schedule.go b/resource-manager/automation/2019-06-01/schedule/id_schedule.go index 6cb8d3029c2..7dd7bb5fbc5 100644 --- a/resource-manager/automation/2019-06-01/schedule/id_schedule.go +++ b/resource-manager/automation/2019-06-01/schedule/id_schedule.go @@ -38,23 +38,9 @@ func ParseScheduleID(input string) (*ScheduleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScheduleId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ScheduleName, ok = parsed.Parsed["scheduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseScheduleIDInsensitively(input string) (*ScheduleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScheduleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ScheduleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ScheduleName, ok = parsed.Parsed["scheduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", *parsed) + if id.ScheduleName, ok = input.Parsed["scheduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", input) } - return &id, nil + return nil } // ValidateScheduleID checks that 'input' can be parsed as a Schedule ID diff --git a/resource-manager/automation/2019-06-01/softwareupdateconfiguration/id_automationaccount.go b/resource-manager/automation/2019-06-01/softwareupdateconfiguration/id_automationaccount.go index 9ffed52c235..88cca4592a6 100644 --- a/resource-manager/automation/2019-06-01/softwareupdateconfiguration/id_automationaccount.go +++ b/resource-manager/automation/2019-06-01/softwareupdateconfiguration/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2019-06-01/softwareupdateconfiguration/id_softwareupdateconfiguration.go b/resource-manager/automation/2019-06-01/softwareupdateconfiguration/id_softwareupdateconfiguration.go index 4a255353d30..defb89b228a 100644 --- a/resource-manager/automation/2019-06-01/softwareupdateconfiguration/id_softwareupdateconfiguration.go +++ b/resource-manager/automation/2019-06-01/softwareupdateconfiguration/id_softwareupdateconfiguration.go @@ -38,23 +38,9 @@ func ParseSoftwareUpdateConfigurationID(input string) (*SoftwareUpdateConfigurat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SoftwareUpdateConfigurationId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.SoftwareUpdateConfigurationName, ok = parsed.Parsed["softwareUpdateConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "softwareUpdateConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSoftwareUpdateConfigurationIDInsensitively(input string) (*SoftwareUpd return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SoftwareUpdateConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SoftwareUpdateConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.SoftwareUpdateConfigurationName, ok = parsed.Parsed["softwareUpdateConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "softwareUpdateConfigurationName", *parsed) + if id.SoftwareUpdateConfigurationName, ok = input.Parsed["softwareUpdateConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "softwareUpdateConfigurationName", input) } - return &id, nil + return nil } // ValidateSoftwareUpdateConfigurationID checks that 'input' can be parsed as a Software Update Configuration ID diff --git a/resource-manager/automation/2019-06-01/softwareupdateconfigurationmachinerun/id_automationaccount.go b/resource-manager/automation/2019-06-01/softwareupdateconfigurationmachinerun/id_automationaccount.go index d1a5f3929b5..f57cc59341f 100644 --- a/resource-manager/automation/2019-06-01/softwareupdateconfigurationmachinerun/id_automationaccount.go +++ b/resource-manager/automation/2019-06-01/softwareupdateconfigurationmachinerun/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2019-06-01/softwareupdateconfigurationmachinerun/id_softwareupdateconfigurationmachinerun.go b/resource-manager/automation/2019-06-01/softwareupdateconfigurationmachinerun/id_softwareupdateconfigurationmachinerun.go index 514e494e501..9d195124bf9 100644 --- a/resource-manager/automation/2019-06-01/softwareupdateconfigurationmachinerun/id_softwareupdateconfigurationmachinerun.go +++ b/resource-manager/automation/2019-06-01/softwareupdateconfigurationmachinerun/id_softwareupdateconfigurationmachinerun.go @@ -38,23 +38,9 @@ func ParseSoftwareUpdateConfigurationMachineRunID(input string) (*SoftwareUpdate return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SoftwareUpdateConfigurationMachineRunId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.SoftwareUpdateConfigurationMachineRunId, ok = parsed.Parsed["softwareUpdateConfigurationMachineRunId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "softwareUpdateConfigurationMachineRunId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSoftwareUpdateConfigurationMachineRunIDInsensitively(input string) (*S return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SoftwareUpdateConfigurationMachineRunId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SoftwareUpdateConfigurationMachineRunId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.SoftwareUpdateConfigurationMachineRunId, ok = parsed.Parsed["softwareUpdateConfigurationMachineRunId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "softwareUpdateConfigurationMachineRunId", *parsed) + if id.SoftwareUpdateConfigurationMachineRunId, ok = input.Parsed["softwareUpdateConfigurationMachineRunId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "softwareUpdateConfigurationMachineRunId", input) } - return &id, nil + return nil } // ValidateSoftwareUpdateConfigurationMachineRunID checks that 'input' can be parsed as a Software Update Configuration Machine Run ID diff --git a/resource-manager/automation/2019-06-01/softwareupdateconfigurationrun/id_automationaccount.go b/resource-manager/automation/2019-06-01/softwareupdateconfigurationrun/id_automationaccount.go index b3d0b483c65..3cbeb376567 100644 --- a/resource-manager/automation/2019-06-01/softwareupdateconfigurationrun/id_automationaccount.go +++ b/resource-manager/automation/2019-06-01/softwareupdateconfigurationrun/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2019-06-01/softwareupdateconfigurationrun/id_softwareupdateconfigurationrun.go b/resource-manager/automation/2019-06-01/softwareupdateconfigurationrun/id_softwareupdateconfigurationrun.go index 2fb7b6fd07c..f7a4bb2be19 100644 --- a/resource-manager/automation/2019-06-01/softwareupdateconfigurationrun/id_softwareupdateconfigurationrun.go +++ b/resource-manager/automation/2019-06-01/softwareupdateconfigurationrun/id_softwareupdateconfigurationrun.go @@ -38,23 +38,9 @@ func ParseSoftwareUpdateConfigurationRunID(input string) (*SoftwareUpdateConfigu return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SoftwareUpdateConfigurationRunId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.SoftwareUpdateConfigurationRunId, ok = parsed.Parsed["softwareUpdateConfigurationRunId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "softwareUpdateConfigurationRunId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSoftwareUpdateConfigurationRunIDInsensitively(input string) (*Software return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SoftwareUpdateConfigurationRunId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SoftwareUpdateConfigurationRunId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.SoftwareUpdateConfigurationRunId, ok = parsed.Parsed["softwareUpdateConfigurationRunId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "softwareUpdateConfigurationRunId", *parsed) + if id.SoftwareUpdateConfigurationRunId, ok = input.Parsed["softwareUpdateConfigurationRunId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "softwareUpdateConfigurationRunId", input) } - return &id, nil + return nil } // ValidateSoftwareUpdateConfigurationRunID checks that 'input' can be parsed as a Software Update Configuration Run ID diff --git a/resource-manager/automation/2019-06-01/sourcecontrol/id_automationaccount.go b/resource-manager/automation/2019-06-01/sourcecontrol/id_automationaccount.go index 8c4e02996a7..69afbfe3e72 100644 --- a/resource-manager/automation/2019-06-01/sourcecontrol/id_automationaccount.go +++ b/resource-manager/automation/2019-06-01/sourcecontrol/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2019-06-01/sourcecontrol/id_sourcecontrol.go b/resource-manager/automation/2019-06-01/sourcecontrol/id_sourcecontrol.go index 72e5c4d821d..39f98c52c3d 100644 --- a/resource-manager/automation/2019-06-01/sourcecontrol/id_sourcecontrol.go +++ b/resource-manager/automation/2019-06-01/sourcecontrol/id_sourcecontrol.go @@ -38,23 +38,9 @@ func ParseSourceControlID(input string) (*SourceControlId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSourceControlIDInsensitively(input string) (*SourceControlId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SourceControlId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) + if id.SourceControlName, ok = input.Parsed["sourceControlName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", input) } - return &id, nil + return nil } // ValidateSourceControlID checks that 'input' can be parsed as a Source Control ID diff --git a/resource-manager/automation/2019-06-01/sourcecontrolsyncjob/id_sourcecontrol.go b/resource-manager/automation/2019-06-01/sourcecontrolsyncjob/id_sourcecontrol.go index 62ab03b2ac1..6ee0738d824 100644 --- a/resource-manager/automation/2019-06-01/sourcecontrolsyncjob/id_sourcecontrol.go +++ b/resource-manager/automation/2019-06-01/sourcecontrolsyncjob/id_sourcecontrol.go @@ -38,23 +38,9 @@ func ParseSourceControlID(input string) (*SourceControlId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSourceControlIDInsensitively(input string) (*SourceControlId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SourceControlId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) + if id.SourceControlName, ok = input.Parsed["sourceControlName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", input) } - return &id, nil + return nil } // ValidateSourceControlID checks that 'input' can be parsed as a Source Control ID diff --git a/resource-manager/automation/2019-06-01/sourcecontrolsyncjob/id_sourcecontrolsyncjob.go b/resource-manager/automation/2019-06-01/sourcecontrolsyncjob/id_sourcecontrolsyncjob.go index 3450a4ccc34..6c32abe23cd 100644 --- a/resource-manager/automation/2019-06-01/sourcecontrolsyncjob/id_sourcecontrolsyncjob.go +++ b/resource-manager/automation/2019-06-01/sourcecontrolsyncjob/id_sourcecontrolsyncjob.go @@ -40,27 +40,9 @@ func ParseSourceControlSyncJobID(input string) (*SourceControlSyncJobId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlSyncJobId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) - } - - if id.SourceControlSyncJobId, ok = parsed.Parsed["sourceControlSyncJobId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlSyncJobId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSourceControlSyncJobIDInsensitively(input string) (*SourceControlSyncJ return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlSyncJobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SourceControlSyncJobId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) + if id.SourceControlName, ok = input.Parsed["sourceControlName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", input) } - if id.SourceControlSyncJobId, ok = parsed.Parsed["sourceControlSyncJobId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlSyncJobId", *parsed) + if id.SourceControlSyncJobId, ok = input.Parsed["sourceControlSyncJobId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sourceControlSyncJobId", input) } - return &id, nil + return nil } // ValidateSourceControlSyncJobID checks that 'input' can be parsed as a Source Control Sync Job ID diff --git a/resource-manager/automation/2019-06-01/sourcecontrolsyncjobstreams/id_sourcecontrolsyncjob.go b/resource-manager/automation/2019-06-01/sourcecontrolsyncjobstreams/id_sourcecontrolsyncjob.go index d31cfb97687..6da55d6b46c 100644 --- a/resource-manager/automation/2019-06-01/sourcecontrolsyncjobstreams/id_sourcecontrolsyncjob.go +++ b/resource-manager/automation/2019-06-01/sourcecontrolsyncjobstreams/id_sourcecontrolsyncjob.go @@ -40,27 +40,9 @@ func ParseSourceControlSyncJobID(input string) (*SourceControlSyncJobId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlSyncJobId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) - } - - if id.SourceControlSyncJobId, ok = parsed.Parsed["sourceControlSyncJobId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlSyncJobId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSourceControlSyncJobIDInsensitively(input string) (*SourceControlSyncJ return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlSyncJobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SourceControlSyncJobId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) + if id.SourceControlName, ok = input.Parsed["sourceControlName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", input) } - if id.SourceControlSyncJobId, ok = parsed.Parsed["sourceControlSyncJobId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlSyncJobId", *parsed) + if id.SourceControlSyncJobId, ok = input.Parsed["sourceControlSyncJobId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sourceControlSyncJobId", input) } - return &id, nil + return nil } // ValidateSourceControlSyncJobID checks that 'input' can be parsed as a Source Control Sync Job ID diff --git a/resource-manager/automation/2019-06-01/sourcecontrolsyncjobstreams/id_sourcecontrolsyncjobstream.go b/resource-manager/automation/2019-06-01/sourcecontrolsyncjobstreams/id_sourcecontrolsyncjobstream.go index 1658914fcd0..1734b33ba66 100644 --- a/resource-manager/automation/2019-06-01/sourcecontrolsyncjobstreams/id_sourcecontrolsyncjobstream.go +++ b/resource-manager/automation/2019-06-01/sourcecontrolsyncjobstreams/id_sourcecontrolsyncjobstream.go @@ -42,31 +42,9 @@ func ParseSourceControlSyncJobStreamID(input string) (*SourceControlSyncJobStrea return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlSyncJobStreamId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) - } - - if id.SourceControlSyncJobId, ok = parsed.Parsed["sourceControlSyncJobId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlSyncJobId", *parsed) - } - - if id.StreamId, ok = parsed.Parsed["streamId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseSourceControlSyncJobStreamIDInsensitively(input string) (*SourceContro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlSyncJobStreamId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SourceControlSyncJobStreamId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) + if id.SourceControlName, ok = input.Parsed["sourceControlName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", input) } - if id.SourceControlSyncJobId, ok = parsed.Parsed["sourceControlSyncJobId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlSyncJobId", *parsed) + if id.SourceControlSyncJobId, ok = input.Parsed["sourceControlSyncJobId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sourceControlSyncJobId", input) } - if id.StreamId, ok = parsed.Parsed["streamId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamId", *parsed) + if id.StreamId, ok = input.Parsed["streamId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "streamId", input) } - return &id, nil + return nil } // ValidateSourceControlSyncJobStreamID checks that 'input' can be parsed as a Source Control Sync Job Stream ID diff --git a/resource-manager/automation/2019-06-01/statistics/id_automationaccount.go b/resource-manager/automation/2019-06-01/statistics/id_automationaccount.go index acb480c909f..f1006810ba4 100644 --- a/resource-manager/automation/2019-06-01/statistics/id_automationaccount.go +++ b/resource-manager/automation/2019-06-01/statistics/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2019-06-01/testjob/id_runbook.go b/resource-manager/automation/2019-06-01/testjob/id_runbook.go index 5ea2c22ce96..7a4b2bb504f 100644 --- a/resource-manager/automation/2019-06-01/testjob/id_runbook.go +++ b/resource-manager/automation/2019-06-01/testjob/id_runbook.go @@ -38,23 +38,9 @@ func ParseRunbookID(input string) (*RunbookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunbookId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.RunbookName, ok = parsed.Parsed["runbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runbookName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRunbookIDInsensitively(input string) (*RunbookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunbookId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RunbookId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.RunbookName, ok = parsed.Parsed["runbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runbookName", *parsed) + if id.RunbookName, ok = input.Parsed["runbookName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runbookName", input) } - return &id, nil + return nil } // ValidateRunbookID checks that 'input' can be parsed as a Runbook ID diff --git a/resource-manager/automation/2019-06-01/testjobstream/id_runbook.go b/resource-manager/automation/2019-06-01/testjobstream/id_runbook.go index b9602d1e074..2db9b3a2d82 100644 --- a/resource-manager/automation/2019-06-01/testjobstream/id_runbook.go +++ b/resource-manager/automation/2019-06-01/testjobstream/id_runbook.go @@ -38,23 +38,9 @@ func ParseRunbookID(input string) (*RunbookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunbookId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.RunbookName, ok = parsed.Parsed["runbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runbookName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRunbookIDInsensitively(input string) (*RunbookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunbookId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RunbookId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.RunbookName, ok = parsed.Parsed["runbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runbookName", *parsed) + if id.RunbookName, ok = input.Parsed["runbookName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runbookName", input) } - return &id, nil + return nil } // ValidateRunbookID checks that 'input' can be parsed as a Runbook ID diff --git a/resource-manager/automation/2019-06-01/testjobstream/id_testjobstream.go b/resource-manager/automation/2019-06-01/testjobstream/id_testjobstream.go index 7cfa557b55b..adb397aab0c 100644 --- a/resource-manager/automation/2019-06-01/testjobstream/id_testjobstream.go +++ b/resource-manager/automation/2019-06-01/testjobstream/id_testjobstream.go @@ -40,27 +40,9 @@ func ParseTestJobStreamID(input string) (*TestJobStreamId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TestJobStreamId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.RunbookName, ok = parsed.Parsed["runbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runbookName", *parsed) - } - - if id.JobStreamId, ok = parsed.Parsed["jobStreamId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobStreamId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseTestJobStreamIDInsensitively(input string) (*TestJobStreamId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TestJobStreamId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TestJobStreamId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.RunbookName, ok = parsed.Parsed["runbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runbookName", *parsed) + if id.RunbookName, ok = input.Parsed["runbookName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runbookName", input) } - if id.JobStreamId, ok = parsed.Parsed["jobStreamId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobStreamId", *parsed) + if id.JobStreamId, ok = input.Parsed["jobStreamId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobStreamId", input) } - return &id, nil + return nil } // ValidateTestJobStreamID checks that 'input' can be parsed as a Test Job Stream ID diff --git a/resource-manager/automation/2019-06-01/typefields/id_type.go b/resource-manager/automation/2019-06-01/typefields/id_type.go index 494728e37cc..a8529df8d82 100644 --- a/resource-manager/automation/2019-06-01/typefields/id_type.go +++ b/resource-manager/automation/2019-06-01/typefields/id_type.go @@ -40,27 +40,9 @@ func ParseTypeID(input string) (*TypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TypeId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) - } - - if id.TypeName, ok = parsed.Parsed["typeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "typeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseTypeIDInsensitively(input string) (*TypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TypeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if id.ModuleName, ok = input.Parsed["moduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "moduleName", input) } - if id.TypeName, ok = parsed.Parsed["typeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "typeName", *parsed) + if id.TypeName, ok = input.Parsed["typeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "typeName", input) } - return &id, nil + return nil } // ValidateTypeID checks that 'input' can be parsed as a Type ID diff --git a/resource-manager/automation/2019-06-01/usages/id_automationaccount.go b/resource-manager/automation/2019-06-01/usages/id_automationaccount.go index 92d03475dfc..5325f60346c 100644 --- a/resource-manager/automation/2019-06-01/usages/id_automationaccount.go +++ b/resource-manager/automation/2019-06-01/usages/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2019-06-01/variable/id_automationaccount.go b/resource-manager/automation/2019-06-01/variable/id_automationaccount.go index 5e89d091247..55cc4873ac0 100644 --- a/resource-manager/automation/2019-06-01/variable/id_automationaccount.go +++ b/resource-manager/automation/2019-06-01/variable/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2019-06-01/variable/id_variable.go b/resource-manager/automation/2019-06-01/variable/id_variable.go index 6f4c6f2db0e..15c186227f2 100644 --- a/resource-manager/automation/2019-06-01/variable/id_variable.go +++ b/resource-manager/automation/2019-06-01/variable/id_variable.go @@ -38,23 +38,9 @@ func ParseVariableID(input string) (*VariableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VariableId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.VariableName, ok = parsed.Parsed["variableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "variableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVariableIDInsensitively(input string) (*VariableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VariableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VariableId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.VariableName, ok = parsed.Parsed["variableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "variableName", *parsed) + if id.VariableName, ok = input.Parsed["variableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "variableName", input) } - return &id, nil + return nil } // ValidateVariableID checks that 'input' can be parsed as a Variable ID diff --git a/resource-manager/automation/2019-06-01/watcher/id_automationaccount.go b/resource-manager/automation/2019-06-01/watcher/id_automationaccount.go index c63a4470c5a..45aadf4b69c 100644 --- a/resource-manager/automation/2019-06-01/watcher/id_automationaccount.go +++ b/resource-manager/automation/2019-06-01/watcher/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2019-06-01/watcher/id_watcher.go b/resource-manager/automation/2019-06-01/watcher/id_watcher.go index a5e15b03801..40f4c7a735a 100644 --- a/resource-manager/automation/2019-06-01/watcher/id_watcher.go +++ b/resource-manager/automation/2019-06-01/watcher/id_watcher.go @@ -38,23 +38,9 @@ func ParseWatcherID(input string) (*WatcherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WatcherId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.WatcherName, ok = parsed.Parsed["watcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watcherName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWatcherIDInsensitively(input string) (*WatcherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WatcherId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WatcherId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.WatcherName, ok = parsed.Parsed["watcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watcherName", *parsed) + if id.WatcherName, ok = input.Parsed["watcherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "watcherName", input) } - return &id, nil + return nil } // ValidateWatcherID checks that 'input' can be parsed as a Watcher ID diff --git a/resource-manager/automation/2020-01-13-preview/activity/id_activity.go b/resource-manager/automation/2020-01-13-preview/activity/id_activity.go index 3930c905492..9a1bddcd0a9 100644 --- a/resource-manager/automation/2020-01-13-preview/activity/id_activity.go +++ b/resource-manager/automation/2020-01-13-preview/activity/id_activity.go @@ -40,27 +40,9 @@ func ParseActivityID(input string) (*ActivityId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ActivityId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) - } - - if id.ActivityName, ok = parsed.Parsed["activityName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "activityName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseActivityIDInsensitively(input string) (*ActivityId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ActivityId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ActivityId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if id.ModuleName, ok = input.Parsed["moduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "moduleName", input) } - if id.ActivityName, ok = parsed.Parsed["activityName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "activityName", *parsed) + if id.ActivityName, ok = input.Parsed["activityName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "activityName", input) } - return &id, nil + return nil } // ValidateActivityID checks that 'input' can be parsed as a Activity ID diff --git a/resource-manager/automation/2020-01-13-preview/activity/id_module.go b/resource-manager/automation/2020-01-13-preview/activity/id_module.go index 0c927d16d45..15aac63648e 100644 --- a/resource-manager/automation/2020-01-13-preview/activity/id_module.go +++ b/resource-manager/automation/2020-01-13-preview/activity/id_module.go @@ -38,23 +38,9 @@ func ParseModuleID(input string) (*ModuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModuleId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseModuleIDInsensitively(input string) (*ModuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ModuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if id.ModuleName, ok = input.Parsed["moduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "moduleName", input) } - return &id, nil + return nil } // ValidateModuleID checks that 'input' can be parsed as a Module ID diff --git a/resource-manager/automation/2020-01-13-preview/agentregistrationinformation/id_automationaccount.go b/resource-manager/automation/2020-01-13-preview/agentregistrationinformation/id_automationaccount.go index 08b840fe82d..ed488fda092 100644 --- a/resource-manager/automation/2020-01-13-preview/agentregistrationinformation/id_automationaccount.go +++ b/resource-manager/automation/2020-01-13-preview/agentregistrationinformation/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2020-01-13-preview/automationaccount/id_automationaccount.go b/resource-manager/automation/2020-01-13-preview/automationaccount/id_automationaccount.go index 507f59b0248..30125ce2604 100644 --- a/resource-manager/automation/2020-01-13-preview/automationaccount/id_automationaccount.go +++ b/resource-manager/automation/2020-01-13-preview/automationaccount/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2020-01-13-preview/certificate/id_automationaccount.go b/resource-manager/automation/2020-01-13-preview/certificate/id_automationaccount.go index b72970d4392..5f31a6b8efd 100644 --- a/resource-manager/automation/2020-01-13-preview/certificate/id_automationaccount.go +++ b/resource-manager/automation/2020-01-13-preview/certificate/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2020-01-13-preview/certificate/id_certificate.go b/resource-manager/automation/2020-01-13-preview/certificate/id_certificate.go index a4dd6601140..492524d5d54 100644 --- a/resource-manager/automation/2020-01-13-preview/certificate/id_certificate.go +++ b/resource-manager/automation/2020-01-13-preview/certificate/id_certificate.go @@ -38,23 +38,9 @@ func ParseCertificateID(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCertificateIDInsensitively(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if id.CertificateName, ok = input.Parsed["certificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateName", input) } - return &id, nil + return nil } // ValidateCertificateID checks that 'input' can be parsed as a Certificate ID diff --git a/resource-manager/automation/2020-01-13-preview/connection/id_automationaccount.go b/resource-manager/automation/2020-01-13-preview/connection/id_automationaccount.go index 6b4cf0ead8b..0036ab33fe6 100644 --- a/resource-manager/automation/2020-01-13-preview/connection/id_automationaccount.go +++ b/resource-manager/automation/2020-01-13-preview/connection/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2020-01-13-preview/connection/id_connection.go b/resource-manager/automation/2020-01-13-preview/connection/id_connection.go index e38741628fe..8199efc92b3 100644 --- a/resource-manager/automation/2020-01-13-preview/connection/id_connection.go +++ b/resource-manager/automation/2020-01-13-preview/connection/id_connection.go @@ -38,23 +38,9 @@ func ParseConnectionID(input string) (*ConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ConnectionName, ok = parsed.Parsed["connectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConnectionIDInsensitively(input string) (*ConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ConnectionName, ok = parsed.Parsed["connectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionName", *parsed) + if id.ConnectionName, ok = input.Parsed["connectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectionName", input) } - return &id, nil + return nil } // ValidateConnectionID checks that 'input' can be parsed as a Connection ID diff --git a/resource-manager/automation/2020-01-13-preview/connectiontype/id_automationaccount.go b/resource-manager/automation/2020-01-13-preview/connectiontype/id_automationaccount.go index 9ac59c1b5c4..2df28b9d4b3 100644 --- a/resource-manager/automation/2020-01-13-preview/connectiontype/id_automationaccount.go +++ b/resource-manager/automation/2020-01-13-preview/connectiontype/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2020-01-13-preview/connectiontype/id_connectiontype.go b/resource-manager/automation/2020-01-13-preview/connectiontype/id_connectiontype.go index c27cff4d1ee..c933b61f97a 100644 --- a/resource-manager/automation/2020-01-13-preview/connectiontype/id_connectiontype.go +++ b/resource-manager/automation/2020-01-13-preview/connectiontype/id_connectiontype.go @@ -38,23 +38,9 @@ func ParseConnectionTypeID(input string) (*ConnectionTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionTypeId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ConnectionTypeName, ok = parsed.Parsed["connectionTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionTypeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConnectionTypeIDInsensitively(input string) (*ConnectionTypeId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConnectionTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ConnectionTypeName, ok = parsed.Parsed["connectionTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionTypeName", *parsed) + if id.ConnectionTypeName, ok = input.Parsed["connectionTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectionTypeName", input) } - return &id, nil + return nil } // ValidateConnectionTypeID checks that 'input' can be parsed as a Connection Type ID diff --git a/resource-manager/automation/2020-01-13-preview/credential/id_automationaccount.go b/resource-manager/automation/2020-01-13-preview/credential/id_automationaccount.go index 1d277938871..a8ea4d95e75 100644 --- a/resource-manager/automation/2020-01-13-preview/credential/id_automationaccount.go +++ b/resource-manager/automation/2020-01-13-preview/credential/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2020-01-13-preview/credential/id_credential.go b/resource-manager/automation/2020-01-13-preview/credential/id_credential.go index 3bc69d79906..6f666f05d43 100644 --- a/resource-manager/automation/2020-01-13-preview/credential/id_credential.go +++ b/resource-manager/automation/2020-01-13-preview/credential/id_credential.go @@ -38,23 +38,9 @@ func ParseCredentialID(input string) (*CredentialId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CredentialId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.CredentialName, ok = parsed.Parsed["credentialName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "credentialName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCredentialIDInsensitively(input string) (*CredentialId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CredentialId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CredentialId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.CredentialName, ok = parsed.Parsed["credentialName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "credentialName", *parsed) + if id.CredentialName, ok = input.Parsed["credentialName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "credentialName", input) } - return &id, nil + return nil } // ValidateCredentialID checks that 'input' can be parsed as a Credential ID diff --git a/resource-manager/automation/2020-01-13-preview/dsccompilationjob/id_automationaccount.go b/resource-manager/automation/2020-01-13-preview/dsccompilationjob/id_automationaccount.go index f67a1327f44..b9f8082811a 100644 --- a/resource-manager/automation/2020-01-13-preview/dsccompilationjob/id_automationaccount.go +++ b/resource-manager/automation/2020-01-13-preview/dsccompilationjob/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2020-01-13-preview/dsccompilationjob/id_stream.go b/resource-manager/automation/2020-01-13-preview/dsccompilationjob/id_stream.go index c0b4d59e158..40be68662b4 100644 --- a/resource-manager/automation/2020-01-13-preview/dsccompilationjob/id_stream.go +++ b/resource-manager/automation/2020-01-13-preview/dsccompilationjob/id_stream.go @@ -40,27 +40,9 @@ func ParseStreamID(input string) (*StreamId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StreamId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.JobId, ok = parsed.Parsed["jobId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobId", *parsed) - } - - if id.JobStreamId, ok = parsed.Parsed["jobStreamId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobStreamId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseStreamIDInsensitively(input string) (*StreamId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StreamId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *StreamId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.JobId, ok = parsed.Parsed["jobId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobId", *parsed) + if id.JobId, ok = input.Parsed["jobId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobId", input) } - if id.JobStreamId, ok = parsed.Parsed["jobStreamId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobStreamId", *parsed) + if id.JobStreamId, ok = input.Parsed["jobStreamId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobStreamId", input) } - return &id, nil + return nil } // ValidateStreamID checks that 'input' can be parsed as a Stream ID diff --git a/resource-manager/automation/2020-01-13-preview/dscnode/id_automationaccount.go b/resource-manager/automation/2020-01-13-preview/dscnode/id_automationaccount.go index 93f32245d95..dc7ca325d76 100644 --- a/resource-manager/automation/2020-01-13-preview/dscnode/id_automationaccount.go +++ b/resource-manager/automation/2020-01-13-preview/dscnode/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2020-01-13-preview/dscnode/id_node.go b/resource-manager/automation/2020-01-13-preview/dscnode/id_node.go index ba81c8d1099..f838b58dfb7 100644 --- a/resource-manager/automation/2020-01-13-preview/dscnode/id_node.go +++ b/resource-manager/automation/2020-01-13-preview/dscnode/id_node.go @@ -38,23 +38,9 @@ func ParseNodeID(input string) (*NodeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NodeId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.NodeId, ok = parsed.Parsed["nodeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nodeId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseNodeIDInsensitively(input string) (*NodeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NodeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *NodeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.NodeId, ok = parsed.Parsed["nodeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nodeId", *parsed) + if id.NodeId, ok = input.Parsed["nodeId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "nodeId", input) } - return &id, nil + return nil } // ValidateNodeID checks that 'input' can be parsed as a Node ID diff --git a/resource-manager/automation/2020-01-13-preview/dscnodeconfiguration/id_automationaccount.go b/resource-manager/automation/2020-01-13-preview/dscnodeconfiguration/id_automationaccount.go index 86960689e71..254e43fe5d9 100644 --- a/resource-manager/automation/2020-01-13-preview/dscnodeconfiguration/id_automationaccount.go +++ b/resource-manager/automation/2020-01-13-preview/dscnodeconfiguration/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2020-01-13-preview/dscnodeconfiguration/id_nodeconfiguration.go b/resource-manager/automation/2020-01-13-preview/dscnodeconfiguration/id_nodeconfiguration.go index df13fdfef49..7d94c8c45ea 100644 --- a/resource-manager/automation/2020-01-13-preview/dscnodeconfiguration/id_nodeconfiguration.go +++ b/resource-manager/automation/2020-01-13-preview/dscnodeconfiguration/id_nodeconfiguration.go @@ -38,23 +38,9 @@ func ParseNodeConfigurationID(input string) (*NodeConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NodeConfigurationId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.NodeConfigurationName, ok = parsed.Parsed["nodeConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nodeConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseNodeConfigurationIDInsensitively(input string) (*NodeConfigurationId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NodeConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *NodeConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.NodeConfigurationName, ok = parsed.Parsed["nodeConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nodeConfigurationName", *parsed) + if id.NodeConfigurationName, ok = input.Parsed["nodeConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "nodeConfigurationName", input) } - return &id, nil + return nil } // ValidateNodeConfigurationID checks that 'input' can be parsed as a Node Configuration ID diff --git a/resource-manager/automation/2020-01-13-preview/hybridrunbookworkergroup/id_automationaccount.go b/resource-manager/automation/2020-01-13-preview/hybridrunbookworkergroup/id_automationaccount.go index 33a62270abe..3a2202493f9 100644 --- a/resource-manager/automation/2020-01-13-preview/hybridrunbookworkergroup/id_automationaccount.go +++ b/resource-manager/automation/2020-01-13-preview/hybridrunbookworkergroup/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2020-01-13-preview/hybridrunbookworkergroup/id_hybridrunbookworkergroup.go b/resource-manager/automation/2020-01-13-preview/hybridrunbookworkergroup/id_hybridrunbookworkergroup.go index 5a9d8c7a7e4..774227e7d67 100644 --- a/resource-manager/automation/2020-01-13-preview/hybridrunbookworkergroup/id_hybridrunbookworkergroup.go +++ b/resource-manager/automation/2020-01-13-preview/hybridrunbookworkergroup/id_hybridrunbookworkergroup.go @@ -38,23 +38,9 @@ func ParseHybridRunbookWorkerGroupID(input string) (*HybridRunbookWorkerGroupId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HybridRunbookWorkerGroupId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.HybridRunbookWorkerGroupName, ok = parsed.Parsed["hybridRunbookWorkerGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridRunbookWorkerGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseHybridRunbookWorkerGroupIDInsensitively(input string) (*HybridRunbookW return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HybridRunbookWorkerGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *HybridRunbookWorkerGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.HybridRunbookWorkerGroupName, ok = parsed.Parsed["hybridRunbookWorkerGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridRunbookWorkerGroupName", *parsed) + if id.HybridRunbookWorkerGroupName, ok = input.Parsed["hybridRunbookWorkerGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hybridRunbookWorkerGroupName", input) } - return &id, nil + return nil } // ValidateHybridRunbookWorkerGroupID checks that 'input' can be parsed as a Hybrid Runbook Worker Group ID diff --git a/resource-manager/automation/2020-01-13-preview/jobschedule/id_automationaccount.go b/resource-manager/automation/2020-01-13-preview/jobschedule/id_automationaccount.go index 400c8f88c64..2b9d8abbf03 100644 --- a/resource-manager/automation/2020-01-13-preview/jobschedule/id_automationaccount.go +++ b/resource-manager/automation/2020-01-13-preview/jobschedule/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2020-01-13-preview/jobschedule/id_jobschedule.go b/resource-manager/automation/2020-01-13-preview/jobschedule/id_jobschedule.go index 96c657b3d4b..c2f160f1cf4 100644 --- a/resource-manager/automation/2020-01-13-preview/jobschedule/id_jobschedule.go +++ b/resource-manager/automation/2020-01-13-preview/jobschedule/id_jobschedule.go @@ -38,23 +38,9 @@ func ParseJobScheduleID(input string) (*JobScheduleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobScheduleId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.JobScheduleId, ok = parsed.Parsed["jobScheduleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobScheduleId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseJobScheduleIDInsensitively(input string) (*JobScheduleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobScheduleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *JobScheduleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.JobScheduleId, ok = parsed.Parsed["jobScheduleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobScheduleId", *parsed) + if id.JobScheduleId, ok = input.Parsed["jobScheduleId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobScheduleId", input) } - return &id, nil + return nil } // ValidateJobScheduleID checks that 'input' can be parsed as a Job Schedule ID diff --git a/resource-manager/automation/2020-01-13-preview/linkedworkspace/id_automationaccount.go b/resource-manager/automation/2020-01-13-preview/linkedworkspace/id_automationaccount.go index deddffb8d5a..ea7bde1591e 100644 --- a/resource-manager/automation/2020-01-13-preview/linkedworkspace/id_automationaccount.go +++ b/resource-manager/automation/2020-01-13-preview/linkedworkspace/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2020-01-13-preview/listkeys/id_automationaccount.go b/resource-manager/automation/2020-01-13-preview/listkeys/id_automationaccount.go index 5f70ed146f5..ac3bcb95a66 100644 --- a/resource-manager/automation/2020-01-13-preview/listkeys/id_automationaccount.go +++ b/resource-manager/automation/2020-01-13-preview/listkeys/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2020-01-13-preview/module/id_automationaccount.go b/resource-manager/automation/2020-01-13-preview/module/id_automationaccount.go index eb9b0e144b5..90f3b8db661 100644 --- a/resource-manager/automation/2020-01-13-preview/module/id_automationaccount.go +++ b/resource-manager/automation/2020-01-13-preview/module/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2020-01-13-preview/module/id_module.go b/resource-manager/automation/2020-01-13-preview/module/id_module.go index d94c81de067..f556cfcb0e9 100644 --- a/resource-manager/automation/2020-01-13-preview/module/id_module.go +++ b/resource-manager/automation/2020-01-13-preview/module/id_module.go @@ -38,23 +38,9 @@ func ParseModuleID(input string) (*ModuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModuleId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseModuleIDInsensitively(input string) (*ModuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ModuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if id.ModuleName, ok = input.Parsed["moduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "moduleName", input) } - return &id, nil + return nil } // ValidateModuleID checks that 'input' can be parsed as a Module ID diff --git a/resource-manager/automation/2020-01-13-preview/nodecountinformation/id_counttype.go b/resource-manager/automation/2020-01-13-preview/nodecountinformation/id_counttype.go index c73497c8c40..0688a1d71bb 100644 --- a/resource-manager/automation/2020-01-13-preview/nodecountinformation/id_counttype.go +++ b/resource-manager/automation/2020-01-13-preview/nodecountinformation/id_counttype.go @@ -38,31 +38,9 @@ func ParseCountTypeID(input string) (*CountTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CountTypeId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if v, ok := parsed.Parsed["countType"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "countType", *parsed) - } - - countType, err := parseCountType(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.CountType = *countType + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -77,34 +55,42 @@ func ParseCountTypeIDInsensitively(input string) (*CountTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CountTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *CountTypeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if v, ok := parsed.Parsed["countType"]; true { + if v, ok := input.Parsed["countType"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "countType", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "countType", input) } countType, err := parseCountType(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.CountType = *countType } - return &id, nil + return nil } // ValidateCountTypeID checks that 'input' can be parsed as a Count Type ID diff --git a/resource-manager/automation/2020-01-13-preview/nodereports/id_node.go b/resource-manager/automation/2020-01-13-preview/nodereports/id_node.go index c6647cae159..dc8ccf90f7f 100644 --- a/resource-manager/automation/2020-01-13-preview/nodereports/id_node.go +++ b/resource-manager/automation/2020-01-13-preview/nodereports/id_node.go @@ -38,23 +38,9 @@ func ParseNodeID(input string) (*NodeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NodeId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.NodeId, ok = parsed.Parsed["nodeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nodeId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseNodeIDInsensitively(input string) (*NodeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NodeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *NodeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.NodeId, ok = parsed.Parsed["nodeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nodeId", *parsed) + if id.NodeId, ok = input.Parsed["nodeId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "nodeId", input) } - return &id, nil + return nil } // ValidateNodeID checks that 'input' can be parsed as a Node ID diff --git a/resource-manager/automation/2020-01-13-preview/nodereports/id_report.go b/resource-manager/automation/2020-01-13-preview/nodereports/id_report.go index 445cf9c68ad..ee1bf3af901 100644 --- a/resource-manager/automation/2020-01-13-preview/nodereports/id_report.go +++ b/resource-manager/automation/2020-01-13-preview/nodereports/id_report.go @@ -40,27 +40,9 @@ func ParseReportID(input string) (*ReportId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReportId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.NodeId, ok = parsed.Parsed["nodeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nodeId", *parsed) - } - - if id.ReportId, ok = parsed.Parsed["reportId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reportId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReportIDInsensitively(input string) (*ReportId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReportId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReportId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.NodeId, ok = parsed.Parsed["nodeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nodeId", *parsed) + if id.NodeId, ok = input.Parsed["nodeId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "nodeId", input) } - if id.ReportId, ok = parsed.Parsed["reportId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reportId", *parsed) + if id.ReportId, ok = input.Parsed["reportId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reportId", input) } - return &id, nil + return nil } // ValidateReportID checks that 'input' can be parsed as a Report ID diff --git a/resource-manager/automation/2020-01-13-preview/objectdatatypes/id_moduleobjectdatatype.go b/resource-manager/automation/2020-01-13-preview/objectdatatypes/id_moduleobjectdatatype.go index f4b6295f338..c6781dacbff 100644 --- a/resource-manager/automation/2020-01-13-preview/objectdatatypes/id_moduleobjectdatatype.go +++ b/resource-manager/automation/2020-01-13-preview/objectdatatypes/id_moduleobjectdatatype.go @@ -40,27 +40,9 @@ func ParseModuleObjectDataTypeID(input string) (*ModuleObjectDataTypeId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModuleObjectDataTypeId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) - } - - if id.ObjectDataTypeName, ok = parsed.Parsed["objectDataTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "objectDataTypeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseModuleObjectDataTypeIDInsensitively(input string) (*ModuleObjectDataTy return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModuleObjectDataTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ModuleObjectDataTypeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if id.ModuleName, ok = input.Parsed["moduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "moduleName", input) } - if id.ObjectDataTypeName, ok = parsed.Parsed["objectDataTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "objectDataTypeName", *parsed) + if id.ObjectDataTypeName, ok = input.Parsed["objectDataTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "objectDataTypeName", input) } - return &id, nil + return nil } // ValidateModuleObjectDataTypeID checks that 'input' can be parsed as a Module Object Data Type ID diff --git a/resource-manager/automation/2020-01-13-preview/objectdatatypes/id_objectdatatype.go b/resource-manager/automation/2020-01-13-preview/objectdatatypes/id_objectdatatype.go index 1272d15447b..1035288be12 100644 --- a/resource-manager/automation/2020-01-13-preview/objectdatatypes/id_objectdatatype.go +++ b/resource-manager/automation/2020-01-13-preview/objectdatatypes/id_objectdatatype.go @@ -38,23 +38,9 @@ func ParseObjectDataTypeID(input string) (*ObjectDataTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ObjectDataTypeId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ObjectDataTypeName, ok = parsed.Parsed["objectDataTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "objectDataTypeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseObjectDataTypeIDInsensitively(input string) (*ObjectDataTypeId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ObjectDataTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ObjectDataTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ObjectDataTypeName, ok = parsed.Parsed["objectDataTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "objectDataTypeName", *parsed) + if id.ObjectDataTypeName, ok = input.Parsed["objectDataTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "objectDataTypeName", input) } - return &id, nil + return nil } // ValidateObjectDataTypeID checks that 'input' can be parsed as a Object Data Type ID diff --git a/resource-manager/automation/2020-01-13-preview/privateendpointconnections/id_automationaccount.go b/resource-manager/automation/2020-01-13-preview/privateendpointconnections/id_automationaccount.go index c01bf8b1fe8..a3efc956146 100644 --- a/resource-manager/automation/2020-01-13-preview/privateendpointconnections/id_automationaccount.go +++ b/resource-manager/automation/2020-01-13-preview/privateendpointconnections/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2020-01-13-preview/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/automation/2020-01-13-preview/privateendpointconnections/id_privateendpointconnection.go index 0eddf244567..6324d755ed6 100644 --- a/resource-manager/automation/2020-01-13-preview/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/automation/2020-01-13-preview/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/automation/2020-01-13-preview/privatelinkresources/id_automationaccount.go b/resource-manager/automation/2020-01-13-preview/privatelinkresources/id_automationaccount.go index 45eed97f792..896b352b25e 100644 --- a/resource-manager/automation/2020-01-13-preview/privatelinkresources/id_automationaccount.go +++ b/resource-manager/automation/2020-01-13-preview/privatelinkresources/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2020-01-13-preview/python2package/id_automationaccount.go b/resource-manager/automation/2020-01-13-preview/python2package/id_automationaccount.go index d768add2e38..1de475464a5 100644 --- a/resource-manager/automation/2020-01-13-preview/python2package/id_automationaccount.go +++ b/resource-manager/automation/2020-01-13-preview/python2package/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2020-01-13-preview/python2package/id_python2package.go b/resource-manager/automation/2020-01-13-preview/python2package/id_python2package.go index 8ed4fe6bda2..b72866ad718 100644 --- a/resource-manager/automation/2020-01-13-preview/python2package/id_python2package.go +++ b/resource-manager/automation/2020-01-13-preview/python2package/id_python2package.go @@ -38,23 +38,9 @@ func ParsePython2PackageID(input string) (*Python2PackageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Python2PackageId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.Python2PackageName, ok = parsed.Parsed["python2PackageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "python2PackageName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePython2PackageIDInsensitively(input string) (*Python2PackageId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Python2PackageId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *Python2PackageId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.Python2PackageName, ok = parsed.Parsed["python2PackageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "python2PackageName", *parsed) + if id.Python2PackageName, ok = input.Parsed["python2PackageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "python2PackageName", input) } - return &id, nil + return nil } // ValidatePython2PackageID checks that 'input' can be parsed as a Python 2 Package ID diff --git a/resource-manager/automation/2020-01-13-preview/schedule/id_automationaccount.go b/resource-manager/automation/2020-01-13-preview/schedule/id_automationaccount.go index 1bd8c3bfabe..14c4aea9691 100644 --- a/resource-manager/automation/2020-01-13-preview/schedule/id_automationaccount.go +++ b/resource-manager/automation/2020-01-13-preview/schedule/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2020-01-13-preview/schedule/id_schedule.go b/resource-manager/automation/2020-01-13-preview/schedule/id_schedule.go index 6cb8d3029c2..7dd7bb5fbc5 100644 --- a/resource-manager/automation/2020-01-13-preview/schedule/id_schedule.go +++ b/resource-manager/automation/2020-01-13-preview/schedule/id_schedule.go @@ -38,23 +38,9 @@ func ParseScheduleID(input string) (*ScheduleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScheduleId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ScheduleName, ok = parsed.Parsed["scheduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseScheduleIDInsensitively(input string) (*ScheduleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScheduleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ScheduleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ScheduleName, ok = parsed.Parsed["scheduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", *parsed) + if id.ScheduleName, ok = input.Parsed["scheduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", input) } - return &id, nil + return nil } // ValidateScheduleID checks that 'input' can be parsed as a Schedule ID diff --git a/resource-manager/automation/2020-01-13-preview/sourcecontrol/id_automationaccount.go b/resource-manager/automation/2020-01-13-preview/sourcecontrol/id_automationaccount.go index 8c4e02996a7..69afbfe3e72 100644 --- a/resource-manager/automation/2020-01-13-preview/sourcecontrol/id_automationaccount.go +++ b/resource-manager/automation/2020-01-13-preview/sourcecontrol/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2020-01-13-preview/sourcecontrol/id_sourcecontrol.go b/resource-manager/automation/2020-01-13-preview/sourcecontrol/id_sourcecontrol.go index 72e5c4d821d..39f98c52c3d 100644 --- a/resource-manager/automation/2020-01-13-preview/sourcecontrol/id_sourcecontrol.go +++ b/resource-manager/automation/2020-01-13-preview/sourcecontrol/id_sourcecontrol.go @@ -38,23 +38,9 @@ func ParseSourceControlID(input string) (*SourceControlId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSourceControlIDInsensitively(input string) (*SourceControlId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SourceControlId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) + if id.SourceControlName, ok = input.Parsed["sourceControlName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", input) } - return &id, nil + return nil } // ValidateSourceControlID checks that 'input' can be parsed as a Source Control ID diff --git a/resource-manager/automation/2020-01-13-preview/sourcecontrolsyncjob/id_sourcecontrol.go b/resource-manager/automation/2020-01-13-preview/sourcecontrolsyncjob/id_sourcecontrol.go index 62ab03b2ac1..6ee0738d824 100644 --- a/resource-manager/automation/2020-01-13-preview/sourcecontrolsyncjob/id_sourcecontrol.go +++ b/resource-manager/automation/2020-01-13-preview/sourcecontrolsyncjob/id_sourcecontrol.go @@ -38,23 +38,9 @@ func ParseSourceControlID(input string) (*SourceControlId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSourceControlIDInsensitively(input string) (*SourceControlId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SourceControlId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) + if id.SourceControlName, ok = input.Parsed["sourceControlName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", input) } - return &id, nil + return nil } // ValidateSourceControlID checks that 'input' can be parsed as a Source Control ID diff --git a/resource-manager/automation/2020-01-13-preview/sourcecontrolsyncjob/id_sourcecontrolsyncjob.go b/resource-manager/automation/2020-01-13-preview/sourcecontrolsyncjob/id_sourcecontrolsyncjob.go index 3450a4ccc34..6c32abe23cd 100644 --- a/resource-manager/automation/2020-01-13-preview/sourcecontrolsyncjob/id_sourcecontrolsyncjob.go +++ b/resource-manager/automation/2020-01-13-preview/sourcecontrolsyncjob/id_sourcecontrolsyncjob.go @@ -40,27 +40,9 @@ func ParseSourceControlSyncJobID(input string) (*SourceControlSyncJobId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlSyncJobId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) - } - - if id.SourceControlSyncJobId, ok = parsed.Parsed["sourceControlSyncJobId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlSyncJobId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSourceControlSyncJobIDInsensitively(input string) (*SourceControlSyncJ return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlSyncJobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SourceControlSyncJobId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) + if id.SourceControlName, ok = input.Parsed["sourceControlName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", input) } - if id.SourceControlSyncJobId, ok = parsed.Parsed["sourceControlSyncJobId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlSyncJobId", *parsed) + if id.SourceControlSyncJobId, ok = input.Parsed["sourceControlSyncJobId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sourceControlSyncJobId", input) } - return &id, nil + return nil } // ValidateSourceControlSyncJobID checks that 'input' can be parsed as a Source Control Sync Job ID diff --git a/resource-manager/automation/2020-01-13-preview/sourcecontrolsyncjobstreams/id_sourcecontrolsyncjob.go b/resource-manager/automation/2020-01-13-preview/sourcecontrolsyncjobstreams/id_sourcecontrolsyncjob.go index d31cfb97687..6da55d6b46c 100644 --- a/resource-manager/automation/2020-01-13-preview/sourcecontrolsyncjobstreams/id_sourcecontrolsyncjob.go +++ b/resource-manager/automation/2020-01-13-preview/sourcecontrolsyncjobstreams/id_sourcecontrolsyncjob.go @@ -40,27 +40,9 @@ func ParseSourceControlSyncJobID(input string) (*SourceControlSyncJobId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlSyncJobId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) - } - - if id.SourceControlSyncJobId, ok = parsed.Parsed["sourceControlSyncJobId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlSyncJobId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSourceControlSyncJobIDInsensitively(input string) (*SourceControlSyncJ return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlSyncJobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SourceControlSyncJobId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) + if id.SourceControlName, ok = input.Parsed["sourceControlName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", input) } - if id.SourceControlSyncJobId, ok = parsed.Parsed["sourceControlSyncJobId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlSyncJobId", *parsed) + if id.SourceControlSyncJobId, ok = input.Parsed["sourceControlSyncJobId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sourceControlSyncJobId", input) } - return &id, nil + return nil } // ValidateSourceControlSyncJobID checks that 'input' can be parsed as a Source Control Sync Job ID diff --git a/resource-manager/automation/2020-01-13-preview/sourcecontrolsyncjobstreams/id_sourcecontrolsyncjobstream.go b/resource-manager/automation/2020-01-13-preview/sourcecontrolsyncjobstreams/id_sourcecontrolsyncjobstream.go index 1658914fcd0..1734b33ba66 100644 --- a/resource-manager/automation/2020-01-13-preview/sourcecontrolsyncjobstreams/id_sourcecontrolsyncjobstream.go +++ b/resource-manager/automation/2020-01-13-preview/sourcecontrolsyncjobstreams/id_sourcecontrolsyncjobstream.go @@ -42,31 +42,9 @@ func ParseSourceControlSyncJobStreamID(input string) (*SourceControlSyncJobStrea return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlSyncJobStreamId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) - } - - if id.SourceControlSyncJobId, ok = parsed.Parsed["sourceControlSyncJobId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlSyncJobId", *parsed) - } - - if id.StreamId, ok = parsed.Parsed["streamId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseSourceControlSyncJobStreamIDInsensitively(input string) (*SourceContro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlSyncJobStreamId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SourceControlSyncJobStreamId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) + if id.SourceControlName, ok = input.Parsed["sourceControlName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", input) } - if id.SourceControlSyncJobId, ok = parsed.Parsed["sourceControlSyncJobId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlSyncJobId", *parsed) + if id.SourceControlSyncJobId, ok = input.Parsed["sourceControlSyncJobId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sourceControlSyncJobId", input) } - if id.StreamId, ok = parsed.Parsed["streamId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamId", *parsed) + if id.StreamId, ok = input.Parsed["streamId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "streamId", input) } - return &id, nil + return nil } // ValidateSourceControlSyncJobStreamID checks that 'input' can be parsed as a Source Control Sync Job Stream ID diff --git a/resource-manager/automation/2020-01-13-preview/statistics/id_automationaccount.go b/resource-manager/automation/2020-01-13-preview/statistics/id_automationaccount.go index acb480c909f..f1006810ba4 100644 --- a/resource-manager/automation/2020-01-13-preview/statistics/id_automationaccount.go +++ b/resource-manager/automation/2020-01-13-preview/statistics/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2020-01-13-preview/typefields/id_type.go b/resource-manager/automation/2020-01-13-preview/typefields/id_type.go index 494728e37cc..a8529df8d82 100644 --- a/resource-manager/automation/2020-01-13-preview/typefields/id_type.go +++ b/resource-manager/automation/2020-01-13-preview/typefields/id_type.go @@ -40,27 +40,9 @@ func ParseTypeID(input string) (*TypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TypeId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) - } - - if id.TypeName, ok = parsed.Parsed["typeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "typeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseTypeIDInsensitively(input string) (*TypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TypeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if id.ModuleName, ok = input.Parsed["moduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "moduleName", input) } - if id.TypeName, ok = parsed.Parsed["typeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "typeName", *parsed) + if id.TypeName, ok = input.Parsed["typeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "typeName", input) } - return &id, nil + return nil } // ValidateTypeID checks that 'input' can be parsed as a Type ID diff --git a/resource-manager/automation/2020-01-13-preview/usages/id_automationaccount.go b/resource-manager/automation/2020-01-13-preview/usages/id_automationaccount.go index 92d03475dfc..5325f60346c 100644 --- a/resource-manager/automation/2020-01-13-preview/usages/id_automationaccount.go +++ b/resource-manager/automation/2020-01-13-preview/usages/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2020-01-13-preview/variable/id_automationaccount.go b/resource-manager/automation/2020-01-13-preview/variable/id_automationaccount.go index 5e89d091247..55cc4873ac0 100644 --- a/resource-manager/automation/2020-01-13-preview/variable/id_automationaccount.go +++ b/resource-manager/automation/2020-01-13-preview/variable/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2020-01-13-preview/variable/id_variable.go b/resource-manager/automation/2020-01-13-preview/variable/id_variable.go index 6f4c6f2db0e..15c186227f2 100644 --- a/resource-manager/automation/2020-01-13-preview/variable/id_variable.go +++ b/resource-manager/automation/2020-01-13-preview/variable/id_variable.go @@ -38,23 +38,9 @@ func ParseVariableID(input string) (*VariableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VariableId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.VariableName, ok = parsed.Parsed["variableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "variableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVariableIDInsensitively(input string) (*VariableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VariableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VariableId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.VariableName, ok = parsed.Parsed["variableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "variableName", *parsed) + if id.VariableName, ok = input.Parsed["variableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "variableName", input) } - return &id, nil + return nil } // ValidateVariableID checks that 'input' can be parsed as a Variable ID diff --git a/resource-manager/automation/2020-01-13-preview/watcher/id_automationaccount.go b/resource-manager/automation/2020-01-13-preview/watcher/id_automationaccount.go index c63a4470c5a..45aadf4b69c 100644 --- a/resource-manager/automation/2020-01-13-preview/watcher/id_automationaccount.go +++ b/resource-manager/automation/2020-01-13-preview/watcher/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2020-01-13-preview/watcher/id_watcher.go b/resource-manager/automation/2020-01-13-preview/watcher/id_watcher.go index a5e15b03801..40f4c7a735a 100644 --- a/resource-manager/automation/2020-01-13-preview/watcher/id_watcher.go +++ b/resource-manager/automation/2020-01-13-preview/watcher/id_watcher.go @@ -38,23 +38,9 @@ func ParseWatcherID(input string) (*WatcherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WatcherId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.WatcherName, ok = parsed.Parsed["watcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watcherName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWatcherIDInsensitively(input string) (*WatcherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WatcherId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WatcherId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.WatcherName, ok = parsed.Parsed["watcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watcherName", *parsed) + if id.WatcherName, ok = input.Parsed["watcherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "watcherName", input) } - return &id, nil + return nil } // ValidateWatcherID checks that 'input' can be parsed as a Watcher ID diff --git a/resource-manager/automation/2021-06-22/automationaccount/id_automationaccount.go b/resource-manager/automation/2021-06-22/automationaccount/id_automationaccount.go index 507f59b0248..30125ce2604 100644 --- a/resource-manager/automation/2021-06-22/automationaccount/id_automationaccount.go +++ b/resource-manager/automation/2021-06-22/automationaccount/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2021-06-22/hybridrunbookworker/id_hybridrunbookworker.go b/resource-manager/automation/2021-06-22/hybridrunbookworker/id_hybridrunbookworker.go index d65585a8ec5..41964d77d33 100644 --- a/resource-manager/automation/2021-06-22/hybridrunbookworker/id_hybridrunbookworker.go +++ b/resource-manager/automation/2021-06-22/hybridrunbookworker/id_hybridrunbookworker.go @@ -40,27 +40,9 @@ func ParseHybridRunbookWorkerID(input string) (*HybridRunbookWorkerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HybridRunbookWorkerId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.HybridRunbookWorkerGroupName, ok = parsed.Parsed["hybridRunbookWorkerGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridRunbookWorkerGroupName", *parsed) - } - - if id.HybridRunbookWorkerId, ok = parsed.Parsed["hybridRunbookWorkerId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridRunbookWorkerId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseHybridRunbookWorkerIDInsensitively(input string) (*HybridRunbookWorker return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HybridRunbookWorkerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *HybridRunbookWorkerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.HybridRunbookWorkerGroupName, ok = parsed.Parsed["hybridRunbookWorkerGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridRunbookWorkerGroupName", *parsed) + if id.HybridRunbookWorkerGroupName, ok = input.Parsed["hybridRunbookWorkerGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hybridRunbookWorkerGroupName", input) } - if id.HybridRunbookWorkerId, ok = parsed.Parsed["hybridRunbookWorkerId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridRunbookWorkerId", *parsed) + if id.HybridRunbookWorkerId, ok = input.Parsed["hybridRunbookWorkerId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hybridRunbookWorkerId", input) } - return &id, nil + return nil } // ValidateHybridRunbookWorkerID checks that 'input' can be parsed as a Hybrid Runbook Worker ID diff --git a/resource-manager/automation/2021-06-22/hybridrunbookworker/id_hybridrunbookworkergroup.go b/resource-manager/automation/2021-06-22/hybridrunbookworker/id_hybridrunbookworkergroup.go index 54670f1d376..64c7328992a 100644 --- a/resource-manager/automation/2021-06-22/hybridrunbookworker/id_hybridrunbookworkergroup.go +++ b/resource-manager/automation/2021-06-22/hybridrunbookworker/id_hybridrunbookworkergroup.go @@ -38,23 +38,9 @@ func ParseHybridRunbookWorkerGroupID(input string) (*HybridRunbookWorkerGroupId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HybridRunbookWorkerGroupId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.HybridRunbookWorkerGroupName, ok = parsed.Parsed["hybridRunbookWorkerGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridRunbookWorkerGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseHybridRunbookWorkerGroupIDInsensitively(input string) (*HybridRunbookW return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HybridRunbookWorkerGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *HybridRunbookWorkerGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.HybridRunbookWorkerGroupName, ok = parsed.Parsed["hybridRunbookWorkerGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridRunbookWorkerGroupName", *parsed) + if id.HybridRunbookWorkerGroupName, ok = input.Parsed["hybridRunbookWorkerGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hybridRunbookWorkerGroupName", input) } - return &id, nil + return nil } // ValidateHybridRunbookWorkerGroupID checks that 'input' can be parsed as a Hybrid Runbook Worker Group ID diff --git a/resource-manager/automation/2021-06-22/hybridrunbookworkergroup/id_automationaccount.go b/resource-manager/automation/2021-06-22/hybridrunbookworkergroup/id_automationaccount.go index 33a62270abe..3a2202493f9 100644 --- a/resource-manager/automation/2021-06-22/hybridrunbookworkergroup/id_automationaccount.go +++ b/resource-manager/automation/2021-06-22/hybridrunbookworkergroup/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2021-06-22/hybridrunbookworkergroup/id_hybridrunbookworkergroup.go b/resource-manager/automation/2021-06-22/hybridrunbookworkergroup/id_hybridrunbookworkergroup.go index 5a9d8c7a7e4..774227e7d67 100644 --- a/resource-manager/automation/2021-06-22/hybridrunbookworkergroup/id_hybridrunbookworkergroup.go +++ b/resource-manager/automation/2021-06-22/hybridrunbookworkergroup/id_hybridrunbookworkergroup.go @@ -38,23 +38,9 @@ func ParseHybridRunbookWorkerGroupID(input string) (*HybridRunbookWorkerGroupId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HybridRunbookWorkerGroupId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.HybridRunbookWorkerGroupName, ok = parsed.Parsed["hybridRunbookWorkerGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridRunbookWorkerGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseHybridRunbookWorkerGroupIDInsensitively(input string) (*HybridRunbookW return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HybridRunbookWorkerGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *HybridRunbookWorkerGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.HybridRunbookWorkerGroupName, ok = parsed.Parsed["hybridRunbookWorkerGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridRunbookWorkerGroupName", *parsed) + if id.HybridRunbookWorkerGroupName, ok = input.Parsed["hybridRunbookWorkerGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hybridRunbookWorkerGroupName", input) } - return &id, nil + return nil } // ValidateHybridRunbookWorkerGroupID checks that 'input' can be parsed as a Hybrid Runbook Worker Group ID diff --git a/resource-manager/automation/2021-06-22/listkeys/id_automationaccount.go b/resource-manager/automation/2021-06-22/listkeys/id_automationaccount.go index 5f70ed146f5..ac3bcb95a66 100644 --- a/resource-manager/automation/2021-06-22/listkeys/id_automationaccount.go +++ b/resource-manager/automation/2021-06-22/listkeys/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2021-06-22/operations/id_automationaccount.go b/resource-manager/automation/2021-06-22/operations/id_automationaccount.go index 8c56596bd3f..72ff420049e 100644 --- a/resource-manager/automation/2021-06-22/operations/id_automationaccount.go +++ b/resource-manager/automation/2021-06-22/operations/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2021-06-22/statistics/id_automationaccount.go b/resource-manager/automation/2021-06-22/statistics/id_automationaccount.go index acb480c909f..f1006810ba4 100644 --- a/resource-manager/automation/2021-06-22/statistics/id_automationaccount.go +++ b/resource-manager/automation/2021-06-22/statistics/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2021-06-22/usages/id_automationaccount.go b/resource-manager/automation/2021-06-22/usages/id_automationaccount.go index 92d03475dfc..5325f60346c 100644 --- a/resource-manager/automation/2021-06-22/usages/id_automationaccount.go +++ b/resource-manager/automation/2021-06-22/usages/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2022-08-08/activity/id_activity.go b/resource-manager/automation/2022-08-08/activity/id_activity.go index 3930c905492..9a1bddcd0a9 100644 --- a/resource-manager/automation/2022-08-08/activity/id_activity.go +++ b/resource-manager/automation/2022-08-08/activity/id_activity.go @@ -40,27 +40,9 @@ func ParseActivityID(input string) (*ActivityId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ActivityId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) - } - - if id.ActivityName, ok = parsed.Parsed["activityName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "activityName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseActivityIDInsensitively(input string) (*ActivityId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ActivityId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ActivityId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if id.ModuleName, ok = input.Parsed["moduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "moduleName", input) } - if id.ActivityName, ok = parsed.Parsed["activityName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "activityName", *parsed) + if id.ActivityName, ok = input.Parsed["activityName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "activityName", input) } - return &id, nil + return nil } // ValidateActivityID checks that 'input' can be parsed as a Activity ID diff --git a/resource-manager/automation/2022-08-08/activity/id_module.go b/resource-manager/automation/2022-08-08/activity/id_module.go index 0c927d16d45..15aac63648e 100644 --- a/resource-manager/automation/2022-08-08/activity/id_module.go +++ b/resource-manager/automation/2022-08-08/activity/id_module.go @@ -38,23 +38,9 @@ func ParseModuleID(input string) (*ModuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModuleId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseModuleIDInsensitively(input string) (*ModuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ModuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if id.ModuleName, ok = input.Parsed["moduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "moduleName", input) } - return &id, nil + return nil } // ValidateModuleID checks that 'input' can be parsed as a Module ID diff --git a/resource-manager/automation/2022-08-08/automationaccount/id_automationaccount.go b/resource-manager/automation/2022-08-08/automationaccount/id_automationaccount.go index 507f59b0248..30125ce2604 100644 --- a/resource-manager/automation/2022-08-08/automationaccount/id_automationaccount.go +++ b/resource-manager/automation/2022-08-08/automationaccount/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2022-08-08/certificate/id_automationaccount.go b/resource-manager/automation/2022-08-08/certificate/id_automationaccount.go index b72970d4392..5f31a6b8efd 100644 --- a/resource-manager/automation/2022-08-08/certificate/id_automationaccount.go +++ b/resource-manager/automation/2022-08-08/certificate/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2022-08-08/certificate/id_certificate.go b/resource-manager/automation/2022-08-08/certificate/id_certificate.go index a4dd6601140..492524d5d54 100644 --- a/resource-manager/automation/2022-08-08/certificate/id_certificate.go +++ b/resource-manager/automation/2022-08-08/certificate/id_certificate.go @@ -38,23 +38,9 @@ func ParseCertificateID(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCertificateIDInsensitively(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if id.CertificateName, ok = input.Parsed["certificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateName", input) } - return &id, nil + return nil } // ValidateCertificateID checks that 'input' can be parsed as a Certificate ID diff --git a/resource-manager/automation/2022-08-08/connection/id_automationaccount.go b/resource-manager/automation/2022-08-08/connection/id_automationaccount.go index 6b4cf0ead8b..0036ab33fe6 100644 --- a/resource-manager/automation/2022-08-08/connection/id_automationaccount.go +++ b/resource-manager/automation/2022-08-08/connection/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2022-08-08/connection/id_connection.go b/resource-manager/automation/2022-08-08/connection/id_connection.go index e38741628fe..8199efc92b3 100644 --- a/resource-manager/automation/2022-08-08/connection/id_connection.go +++ b/resource-manager/automation/2022-08-08/connection/id_connection.go @@ -38,23 +38,9 @@ func ParseConnectionID(input string) (*ConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ConnectionName, ok = parsed.Parsed["connectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConnectionIDInsensitively(input string) (*ConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ConnectionName, ok = parsed.Parsed["connectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionName", *parsed) + if id.ConnectionName, ok = input.Parsed["connectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectionName", input) } - return &id, nil + return nil } // ValidateConnectionID checks that 'input' can be parsed as a Connection ID diff --git a/resource-manager/automation/2022-08-08/connectiontype/id_automationaccount.go b/resource-manager/automation/2022-08-08/connectiontype/id_automationaccount.go index 9ac59c1b5c4..2df28b9d4b3 100644 --- a/resource-manager/automation/2022-08-08/connectiontype/id_automationaccount.go +++ b/resource-manager/automation/2022-08-08/connectiontype/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2022-08-08/connectiontype/id_connectiontype.go b/resource-manager/automation/2022-08-08/connectiontype/id_connectiontype.go index c27cff4d1ee..c933b61f97a 100644 --- a/resource-manager/automation/2022-08-08/connectiontype/id_connectiontype.go +++ b/resource-manager/automation/2022-08-08/connectiontype/id_connectiontype.go @@ -38,23 +38,9 @@ func ParseConnectionTypeID(input string) (*ConnectionTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionTypeId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ConnectionTypeName, ok = parsed.Parsed["connectionTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionTypeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConnectionTypeIDInsensitively(input string) (*ConnectionTypeId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConnectionTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ConnectionTypeName, ok = parsed.Parsed["connectionTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionTypeName", *parsed) + if id.ConnectionTypeName, ok = input.Parsed["connectionTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectionTypeName", input) } - return &id, nil + return nil } // ValidateConnectionTypeID checks that 'input' can be parsed as a Connection Type ID diff --git a/resource-manager/automation/2022-08-08/credential/id_automationaccount.go b/resource-manager/automation/2022-08-08/credential/id_automationaccount.go index 1d277938871..a8ea4d95e75 100644 --- a/resource-manager/automation/2022-08-08/credential/id_automationaccount.go +++ b/resource-manager/automation/2022-08-08/credential/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2022-08-08/credential/id_credential.go b/resource-manager/automation/2022-08-08/credential/id_credential.go index 3bc69d79906..6f666f05d43 100644 --- a/resource-manager/automation/2022-08-08/credential/id_credential.go +++ b/resource-manager/automation/2022-08-08/credential/id_credential.go @@ -38,23 +38,9 @@ func ParseCredentialID(input string) (*CredentialId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CredentialId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.CredentialName, ok = parsed.Parsed["credentialName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "credentialName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCredentialIDInsensitively(input string) (*CredentialId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CredentialId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CredentialId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.CredentialName, ok = parsed.Parsed["credentialName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "credentialName", *parsed) + if id.CredentialName, ok = input.Parsed["credentialName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "credentialName", input) } - return &id, nil + return nil } // ValidateCredentialID checks that 'input' can be parsed as a Credential ID diff --git a/resource-manager/automation/2022-08-08/dscconfiguration/id_automationaccount.go b/resource-manager/automation/2022-08-08/dscconfiguration/id_automationaccount.go index e55bc5823ef..7d065e1e87f 100644 --- a/resource-manager/automation/2022-08-08/dscconfiguration/id_automationaccount.go +++ b/resource-manager/automation/2022-08-08/dscconfiguration/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2022-08-08/dscconfiguration/id_configuration.go b/resource-manager/automation/2022-08-08/dscconfiguration/id_configuration.go index 9ab132d3e0a..ad9cf42c091 100644 --- a/resource-manager/automation/2022-08-08/dscconfiguration/id_configuration.go +++ b/resource-manager/automation/2022-08-08/dscconfiguration/id_configuration.go @@ -38,23 +38,9 @@ func ParseConfigurationID(input string) (*ConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConfigurationIDInsensitively(input string) (*ConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationName", *parsed) + if id.ConfigurationName, ok = input.Parsed["configurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationName", input) } - return &id, nil + return nil } // ValidateConfigurationID checks that 'input' can be parsed as a Configuration ID diff --git a/resource-manager/automation/2022-08-08/dscnodeconfiguration/id_automationaccount.go b/resource-manager/automation/2022-08-08/dscnodeconfiguration/id_automationaccount.go index 86960689e71..254e43fe5d9 100644 --- a/resource-manager/automation/2022-08-08/dscnodeconfiguration/id_automationaccount.go +++ b/resource-manager/automation/2022-08-08/dscnodeconfiguration/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2022-08-08/dscnodeconfiguration/id_nodeconfiguration.go b/resource-manager/automation/2022-08-08/dscnodeconfiguration/id_nodeconfiguration.go index df13fdfef49..7d94c8c45ea 100644 --- a/resource-manager/automation/2022-08-08/dscnodeconfiguration/id_nodeconfiguration.go +++ b/resource-manager/automation/2022-08-08/dscnodeconfiguration/id_nodeconfiguration.go @@ -38,23 +38,9 @@ func ParseNodeConfigurationID(input string) (*NodeConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NodeConfigurationId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.NodeConfigurationName, ok = parsed.Parsed["nodeConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nodeConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseNodeConfigurationIDInsensitively(input string) (*NodeConfigurationId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NodeConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *NodeConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.NodeConfigurationName, ok = parsed.Parsed["nodeConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nodeConfigurationName", *parsed) + if id.NodeConfigurationName, ok = input.Parsed["nodeConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "nodeConfigurationName", input) } - return &id, nil + return nil } // ValidateNodeConfigurationID checks that 'input' can be parsed as a Node Configuration ID diff --git a/resource-manager/automation/2022-08-08/hybridrunbookworker/id_hybridrunbookworker.go b/resource-manager/automation/2022-08-08/hybridrunbookworker/id_hybridrunbookworker.go index d65585a8ec5..41964d77d33 100644 --- a/resource-manager/automation/2022-08-08/hybridrunbookworker/id_hybridrunbookworker.go +++ b/resource-manager/automation/2022-08-08/hybridrunbookworker/id_hybridrunbookworker.go @@ -40,27 +40,9 @@ func ParseHybridRunbookWorkerID(input string) (*HybridRunbookWorkerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HybridRunbookWorkerId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.HybridRunbookWorkerGroupName, ok = parsed.Parsed["hybridRunbookWorkerGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridRunbookWorkerGroupName", *parsed) - } - - if id.HybridRunbookWorkerId, ok = parsed.Parsed["hybridRunbookWorkerId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridRunbookWorkerId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseHybridRunbookWorkerIDInsensitively(input string) (*HybridRunbookWorker return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HybridRunbookWorkerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *HybridRunbookWorkerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.HybridRunbookWorkerGroupName, ok = parsed.Parsed["hybridRunbookWorkerGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridRunbookWorkerGroupName", *parsed) + if id.HybridRunbookWorkerGroupName, ok = input.Parsed["hybridRunbookWorkerGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hybridRunbookWorkerGroupName", input) } - if id.HybridRunbookWorkerId, ok = parsed.Parsed["hybridRunbookWorkerId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridRunbookWorkerId", *parsed) + if id.HybridRunbookWorkerId, ok = input.Parsed["hybridRunbookWorkerId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hybridRunbookWorkerId", input) } - return &id, nil + return nil } // ValidateHybridRunbookWorkerID checks that 'input' can be parsed as a Hybrid Runbook Worker ID diff --git a/resource-manager/automation/2022-08-08/hybridrunbookworker/id_hybridrunbookworkergroup.go b/resource-manager/automation/2022-08-08/hybridrunbookworker/id_hybridrunbookworkergroup.go index 54670f1d376..64c7328992a 100644 --- a/resource-manager/automation/2022-08-08/hybridrunbookworker/id_hybridrunbookworkergroup.go +++ b/resource-manager/automation/2022-08-08/hybridrunbookworker/id_hybridrunbookworkergroup.go @@ -38,23 +38,9 @@ func ParseHybridRunbookWorkerGroupID(input string) (*HybridRunbookWorkerGroupId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HybridRunbookWorkerGroupId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.HybridRunbookWorkerGroupName, ok = parsed.Parsed["hybridRunbookWorkerGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridRunbookWorkerGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseHybridRunbookWorkerGroupIDInsensitively(input string) (*HybridRunbookW return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HybridRunbookWorkerGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *HybridRunbookWorkerGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.HybridRunbookWorkerGroupName, ok = parsed.Parsed["hybridRunbookWorkerGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridRunbookWorkerGroupName", *parsed) + if id.HybridRunbookWorkerGroupName, ok = input.Parsed["hybridRunbookWorkerGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hybridRunbookWorkerGroupName", input) } - return &id, nil + return nil } // ValidateHybridRunbookWorkerGroupID checks that 'input' can be parsed as a Hybrid Runbook Worker Group ID diff --git a/resource-manager/automation/2022-08-08/hybridrunbookworkergroup/id_automationaccount.go b/resource-manager/automation/2022-08-08/hybridrunbookworkergroup/id_automationaccount.go index 33a62270abe..3a2202493f9 100644 --- a/resource-manager/automation/2022-08-08/hybridrunbookworkergroup/id_automationaccount.go +++ b/resource-manager/automation/2022-08-08/hybridrunbookworkergroup/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2022-08-08/hybridrunbookworkergroup/id_hybridrunbookworkergroup.go b/resource-manager/automation/2022-08-08/hybridrunbookworkergroup/id_hybridrunbookworkergroup.go index 5a9d8c7a7e4..774227e7d67 100644 --- a/resource-manager/automation/2022-08-08/hybridrunbookworkergroup/id_hybridrunbookworkergroup.go +++ b/resource-manager/automation/2022-08-08/hybridrunbookworkergroup/id_hybridrunbookworkergroup.go @@ -38,23 +38,9 @@ func ParseHybridRunbookWorkerGroupID(input string) (*HybridRunbookWorkerGroupId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HybridRunbookWorkerGroupId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.HybridRunbookWorkerGroupName, ok = parsed.Parsed["hybridRunbookWorkerGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridRunbookWorkerGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseHybridRunbookWorkerGroupIDInsensitively(input string) (*HybridRunbookW return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HybridRunbookWorkerGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *HybridRunbookWorkerGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.HybridRunbookWorkerGroupName, ok = parsed.Parsed["hybridRunbookWorkerGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridRunbookWorkerGroupName", *parsed) + if id.HybridRunbookWorkerGroupName, ok = input.Parsed["hybridRunbookWorkerGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hybridRunbookWorkerGroupName", input) } - return &id, nil + return nil } // ValidateHybridRunbookWorkerGroupID checks that 'input' can be parsed as a Hybrid Runbook Worker Group ID diff --git a/resource-manager/automation/2022-08-08/job/id_automationaccount.go b/resource-manager/automation/2022-08-08/job/id_automationaccount.go index 92931d6f634..cbc63031f3b 100644 --- a/resource-manager/automation/2022-08-08/job/id_automationaccount.go +++ b/resource-manager/automation/2022-08-08/job/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2022-08-08/job/id_job.go b/resource-manager/automation/2022-08-08/job/id_job.go index fbadf9f6a12..301f0ade03f 100644 --- a/resource-manager/automation/2022-08-08/job/id_job.go +++ b/resource-manager/automation/2022-08-08/job/id_job.go @@ -38,23 +38,9 @@ func ParseJobID(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseJobIDInsensitively(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *JobId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - return &id, nil + return nil } // ValidateJobID checks that 'input' can be parsed as a Job ID diff --git a/resource-manager/automation/2022-08-08/jobschedule/id_automationaccount.go b/resource-manager/automation/2022-08-08/jobschedule/id_automationaccount.go index 400c8f88c64..2b9d8abbf03 100644 --- a/resource-manager/automation/2022-08-08/jobschedule/id_automationaccount.go +++ b/resource-manager/automation/2022-08-08/jobschedule/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2022-08-08/jobschedule/id_jobschedule.go b/resource-manager/automation/2022-08-08/jobschedule/id_jobschedule.go index 96c657b3d4b..c2f160f1cf4 100644 --- a/resource-manager/automation/2022-08-08/jobschedule/id_jobschedule.go +++ b/resource-manager/automation/2022-08-08/jobschedule/id_jobschedule.go @@ -38,23 +38,9 @@ func ParseJobScheduleID(input string) (*JobScheduleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobScheduleId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.JobScheduleId, ok = parsed.Parsed["jobScheduleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobScheduleId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseJobScheduleIDInsensitively(input string) (*JobScheduleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobScheduleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *JobScheduleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.JobScheduleId, ok = parsed.Parsed["jobScheduleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobScheduleId", *parsed) + if id.JobScheduleId, ok = input.Parsed["jobScheduleId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobScheduleId", input) } - return &id, nil + return nil } // ValidateJobScheduleID checks that 'input' can be parsed as a Job Schedule ID diff --git a/resource-manager/automation/2022-08-08/jobstream/id_job.go b/resource-manager/automation/2022-08-08/jobstream/id_job.go index 0d8282be25c..46e6c67a788 100644 --- a/resource-manager/automation/2022-08-08/jobstream/id_job.go +++ b/resource-manager/automation/2022-08-08/jobstream/id_job.go @@ -38,23 +38,9 @@ func ParseJobID(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseJobIDInsensitively(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *JobId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - return &id, nil + return nil } // ValidateJobID checks that 'input' can be parsed as a Job ID diff --git a/resource-manager/automation/2022-08-08/jobstream/id_stream.go b/resource-manager/automation/2022-08-08/jobstream/id_stream.go index 2cbff7b6794..edb99c9e84e 100644 --- a/resource-manager/automation/2022-08-08/jobstream/id_stream.go +++ b/resource-manager/automation/2022-08-08/jobstream/id_stream.go @@ -40,27 +40,9 @@ func ParseStreamID(input string) (*StreamId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StreamId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) - } - - if id.JobStreamId, ok = parsed.Parsed["jobStreamId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobStreamId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseStreamIDInsensitively(input string) (*StreamId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StreamId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *StreamId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - if id.JobStreamId, ok = parsed.Parsed["jobStreamId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobStreamId", *parsed) + if id.JobStreamId, ok = input.Parsed["jobStreamId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobStreamId", input) } - return &id, nil + return nil } // ValidateStreamID checks that 'input' can be parsed as a Stream ID diff --git a/resource-manager/automation/2022-08-08/linkedworkspace/id_automationaccount.go b/resource-manager/automation/2022-08-08/linkedworkspace/id_automationaccount.go index deddffb8d5a..ea7bde1591e 100644 --- a/resource-manager/automation/2022-08-08/linkedworkspace/id_automationaccount.go +++ b/resource-manager/automation/2022-08-08/linkedworkspace/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2022-08-08/listkeys/id_automationaccount.go b/resource-manager/automation/2022-08-08/listkeys/id_automationaccount.go index 5f70ed146f5..ac3bcb95a66 100644 --- a/resource-manager/automation/2022-08-08/listkeys/id_automationaccount.go +++ b/resource-manager/automation/2022-08-08/listkeys/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2022-08-08/module/id_automationaccount.go b/resource-manager/automation/2022-08-08/module/id_automationaccount.go index eb9b0e144b5..90f3b8db661 100644 --- a/resource-manager/automation/2022-08-08/module/id_automationaccount.go +++ b/resource-manager/automation/2022-08-08/module/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2022-08-08/module/id_module.go b/resource-manager/automation/2022-08-08/module/id_module.go index d94c81de067..f556cfcb0e9 100644 --- a/resource-manager/automation/2022-08-08/module/id_module.go +++ b/resource-manager/automation/2022-08-08/module/id_module.go @@ -38,23 +38,9 @@ func ParseModuleID(input string) (*ModuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModuleId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseModuleIDInsensitively(input string) (*ModuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ModuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if id.ModuleName, ok = input.Parsed["moduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "moduleName", input) } - return &id, nil + return nil } // ValidateModuleID checks that 'input' can be parsed as a Module ID diff --git a/resource-manager/automation/2022-08-08/objectdatatypes/id_moduleobjectdatatype.go b/resource-manager/automation/2022-08-08/objectdatatypes/id_moduleobjectdatatype.go index f4b6295f338..c6781dacbff 100644 --- a/resource-manager/automation/2022-08-08/objectdatatypes/id_moduleobjectdatatype.go +++ b/resource-manager/automation/2022-08-08/objectdatatypes/id_moduleobjectdatatype.go @@ -40,27 +40,9 @@ func ParseModuleObjectDataTypeID(input string) (*ModuleObjectDataTypeId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModuleObjectDataTypeId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) - } - - if id.ObjectDataTypeName, ok = parsed.Parsed["objectDataTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "objectDataTypeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseModuleObjectDataTypeIDInsensitively(input string) (*ModuleObjectDataTy return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModuleObjectDataTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ModuleObjectDataTypeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if id.ModuleName, ok = input.Parsed["moduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "moduleName", input) } - if id.ObjectDataTypeName, ok = parsed.Parsed["objectDataTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "objectDataTypeName", *parsed) + if id.ObjectDataTypeName, ok = input.Parsed["objectDataTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "objectDataTypeName", input) } - return &id, nil + return nil } // ValidateModuleObjectDataTypeID checks that 'input' can be parsed as a Module Object Data Type ID diff --git a/resource-manager/automation/2022-08-08/objectdatatypes/id_objectdatatype.go b/resource-manager/automation/2022-08-08/objectdatatypes/id_objectdatatype.go index 1272d15447b..1035288be12 100644 --- a/resource-manager/automation/2022-08-08/objectdatatypes/id_objectdatatype.go +++ b/resource-manager/automation/2022-08-08/objectdatatypes/id_objectdatatype.go @@ -38,23 +38,9 @@ func ParseObjectDataTypeID(input string) (*ObjectDataTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ObjectDataTypeId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ObjectDataTypeName, ok = parsed.Parsed["objectDataTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "objectDataTypeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseObjectDataTypeIDInsensitively(input string) (*ObjectDataTypeId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ObjectDataTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ObjectDataTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ObjectDataTypeName, ok = parsed.Parsed["objectDataTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "objectDataTypeName", *parsed) + if id.ObjectDataTypeName, ok = input.Parsed["objectDataTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "objectDataTypeName", input) } - return &id, nil + return nil } // ValidateObjectDataTypeID checks that 'input' can be parsed as a Object Data Type ID diff --git a/resource-manager/automation/2022-08-08/operations/id_automationaccount.go b/resource-manager/automation/2022-08-08/operations/id_automationaccount.go index 8c56596bd3f..72ff420049e 100644 --- a/resource-manager/automation/2022-08-08/operations/id_automationaccount.go +++ b/resource-manager/automation/2022-08-08/operations/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2022-08-08/python2package/id_automationaccount.go b/resource-manager/automation/2022-08-08/python2package/id_automationaccount.go index d768add2e38..1de475464a5 100644 --- a/resource-manager/automation/2022-08-08/python2package/id_automationaccount.go +++ b/resource-manager/automation/2022-08-08/python2package/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2022-08-08/python2package/id_python2package.go b/resource-manager/automation/2022-08-08/python2package/id_python2package.go index 8ed4fe6bda2..b72866ad718 100644 --- a/resource-manager/automation/2022-08-08/python2package/id_python2package.go +++ b/resource-manager/automation/2022-08-08/python2package/id_python2package.go @@ -38,23 +38,9 @@ func ParsePython2PackageID(input string) (*Python2PackageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Python2PackageId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.Python2PackageName, ok = parsed.Parsed["python2PackageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "python2PackageName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePython2PackageIDInsensitively(input string) (*Python2PackageId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Python2PackageId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *Python2PackageId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.Python2PackageName, ok = parsed.Parsed["python2PackageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "python2PackageName", *parsed) + if id.Python2PackageName, ok = input.Parsed["python2PackageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "python2PackageName", input) } - return &id, nil + return nil } // ValidatePython2PackageID checks that 'input' can be parsed as a Python 2 Package ID diff --git a/resource-manager/automation/2022-08-08/python3package/id_automationaccount.go b/resource-manager/automation/2022-08-08/python3package/id_automationaccount.go index f6805805bf7..6609025b8ed 100644 --- a/resource-manager/automation/2022-08-08/python3package/id_automationaccount.go +++ b/resource-manager/automation/2022-08-08/python3package/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2022-08-08/python3package/id_python3package.go b/resource-manager/automation/2022-08-08/python3package/id_python3package.go index b94e1868e97..2d076d66f83 100644 --- a/resource-manager/automation/2022-08-08/python3package/id_python3package.go +++ b/resource-manager/automation/2022-08-08/python3package/id_python3package.go @@ -38,23 +38,9 @@ func ParsePython3PackageID(input string) (*Python3PackageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Python3PackageId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.Python3PackageName, ok = parsed.Parsed["python3PackageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "python3PackageName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePython3PackageIDInsensitively(input string) (*Python3PackageId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Python3PackageId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *Python3PackageId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.Python3PackageName, ok = parsed.Parsed["python3PackageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "python3PackageName", *parsed) + if id.Python3PackageName, ok = input.Parsed["python3PackageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "python3PackageName", input) } - return &id, nil + return nil } // ValidatePython3PackageID checks that 'input' can be parsed as a Python 3 Package ID diff --git a/resource-manager/automation/2022-08-08/runbook/id_automationaccount.go b/resource-manager/automation/2022-08-08/runbook/id_automationaccount.go index 8a8b18b7895..43161edfa7e 100644 --- a/resource-manager/automation/2022-08-08/runbook/id_automationaccount.go +++ b/resource-manager/automation/2022-08-08/runbook/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2022-08-08/runbook/id_runbook.go b/resource-manager/automation/2022-08-08/runbook/id_runbook.go index 2adace8bd11..9c8d15c9ac0 100644 --- a/resource-manager/automation/2022-08-08/runbook/id_runbook.go +++ b/resource-manager/automation/2022-08-08/runbook/id_runbook.go @@ -38,23 +38,9 @@ func ParseRunbookID(input string) (*RunbookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunbookId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.RunbookName, ok = parsed.Parsed["runbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runbookName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRunbookIDInsensitively(input string) (*RunbookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunbookId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RunbookId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.RunbookName, ok = parsed.Parsed["runbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runbookName", *parsed) + if id.RunbookName, ok = input.Parsed["runbookName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runbookName", input) } - return &id, nil + return nil } // ValidateRunbookID checks that 'input' can be parsed as a Runbook ID diff --git a/resource-manager/automation/2022-08-08/runbookdraft/id_runbook.go b/resource-manager/automation/2022-08-08/runbookdraft/id_runbook.go index 65a6774ab35..b01c075eb73 100644 --- a/resource-manager/automation/2022-08-08/runbookdraft/id_runbook.go +++ b/resource-manager/automation/2022-08-08/runbookdraft/id_runbook.go @@ -38,23 +38,9 @@ func ParseRunbookID(input string) (*RunbookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunbookId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.RunbookName, ok = parsed.Parsed["runbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runbookName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRunbookIDInsensitively(input string) (*RunbookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunbookId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RunbookId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.RunbookName, ok = parsed.Parsed["runbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runbookName", *parsed) + if id.RunbookName, ok = input.Parsed["runbookName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runbookName", input) } - return &id, nil + return nil } // ValidateRunbookID checks that 'input' can be parsed as a Runbook ID diff --git a/resource-manager/automation/2022-08-08/schedule/id_automationaccount.go b/resource-manager/automation/2022-08-08/schedule/id_automationaccount.go index 1bd8c3bfabe..14c4aea9691 100644 --- a/resource-manager/automation/2022-08-08/schedule/id_automationaccount.go +++ b/resource-manager/automation/2022-08-08/schedule/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2022-08-08/schedule/id_schedule.go b/resource-manager/automation/2022-08-08/schedule/id_schedule.go index 6cb8d3029c2..7dd7bb5fbc5 100644 --- a/resource-manager/automation/2022-08-08/schedule/id_schedule.go +++ b/resource-manager/automation/2022-08-08/schedule/id_schedule.go @@ -38,23 +38,9 @@ func ParseScheduleID(input string) (*ScheduleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScheduleId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ScheduleName, ok = parsed.Parsed["scheduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseScheduleIDInsensitively(input string) (*ScheduleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScheduleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ScheduleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ScheduleName, ok = parsed.Parsed["scheduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", *parsed) + if id.ScheduleName, ok = input.Parsed["scheduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", input) } - return &id, nil + return nil } // ValidateScheduleID checks that 'input' can be parsed as a Schedule ID diff --git a/resource-manager/automation/2022-08-08/softwareupdateconfigurationmachinerun/id_automationaccount.go b/resource-manager/automation/2022-08-08/softwareupdateconfigurationmachinerun/id_automationaccount.go index d1a5f3929b5..f57cc59341f 100644 --- a/resource-manager/automation/2022-08-08/softwareupdateconfigurationmachinerun/id_automationaccount.go +++ b/resource-manager/automation/2022-08-08/softwareupdateconfigurationmachinerun/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2022-08-08/softwareupdateconfigurationmachinerun/id_softwareupdateconfigurationmachinerun.go b/resource-manager/automation/2022-08-08/softwareupdateconfigurationmachinerun/id_softwareupdateconfigurationmachinerun.go index 514e494e501..9d195124bf9 100644 --- a/resource-manager/automation/2022-08-08/softwareupdateconfigurationmachinerun/id_softwareupdateconfigurationmachinerun.go +++ b/resource-manager/automation/2022-08-08/softwareupdateconfigurationmachinerun/id_softwareupdateconfigurationmachinerun.go @@ -38,23 +38,9 @@ func ParseSoftwareUpdateConfigurationMachineRunID(input string) (*SoftwareUpdate return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SoftwareUpdateConfigurationMachineRunId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.SoftwareUpdateConfigurationMachineRunId, ok = parsed.Parsed["softwareUpdateConfigurationMachineRunId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "softwareUpdateConfigurationMachineRunId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSoftwareUpdateConfigurationMachineRunIDInsensitively(input string) (*S return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SoftwareUpdateConfigurationMachineRunId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SoftwareUpdateConfigurationMachineRunId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.SoftwareUpdateConfigurationMachineRunId, ok = parsed.Parsed["softwareUpdateConfigurationMachineRunId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "softwareUpdateConfigurationMachineRunId", *parsed) + if id.SoftwareUpdateConfigurationMachineRunId, ok = input.Parsed["softwareUpdateConfigurationMachineRunId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "softwareUpdateConfigurationMachineRunId", input) } - return &id, nil + return nil } // ValidateSoftwareUpdateConfigurationMachineRunID checks that 'input' can be parsed as a Software Update Configuration Machine Run ID diff --git a/resource-manager/automation/2022-08-08/softwareupdateconfigurationrun/id_automationaccount.go b/resource-manager/automation/2022-08-08/softwareupdateconfigurationrun/id_automationaccount.go index b3d0b483c65..3cbeb376567 100644 --- a/resource-manager/automation/2022-08-08/softwareupdateconfigurationrun/id_automationaccount.go +++ b/resource-manager/automation/2022-08-08/softwareupdateconfigurationrun/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2022-08-08/softwareupdateconfigurationrun/id_softwareupdateconfigurationrun.go b/resource-manager/automation/2022-08-08/softwareupdateconfigurationrun/id_softwareupdateconfigurationrun.go index 2fb7b6fd07c..f7a4bb2be19 100644 --- a/resource-manager/automation/2022-08-08/softwareupdateconfigurationrun/id_softwareupdateconfigurationrun.go +++ b/resource-manager/automation/2022-08-08/softwareupdateconfigurationrun/id_softwareupdateconfigurationrun.go @@ -38,23 +38,9 @@ func ParseSoftwareUpdateConfigurationRunID(input string) (*SoftwareUpdateConfigu return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SoftwareUpdateConfigurationRunId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.SoftwareUpdateConfigurationRunId, ok = parsed.Parsed["softwareUpdateConfigurationRunId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "softwareUpdateConfigurationRunId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSoftwareUpdateConfigurationRunIDInsensitively(input string) (*Software return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SoftwareUpdateConfigurationRunId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SoftwareUpdateConfigurationRunId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.SoftwareUpdateConfigurationRunId, ok = parsed.Parsed["softwareUpdateConfigurationRunId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "softwareUpdateConfigurationRunId", *parsed) + if id.SoftwareUpdateConfigurationRunId, ok = input.Parsed["softwareUpdateConfigurationRunId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "softwareUpdateConfigurationRunId", input) } - return &id, nil + return nil } // ValidateSoftwareUpdateConfigurationRunID checks that 'input' can be parsed as a Software Update Configuration Run ID diff --git a/resource-manager/automation/2022-08-08/sourcecontrol/id_automationaccount.go b/resource-manager/automation/2022-08-08/sourcecontrol/id_automationaccount.go index 8c4e02996a7..69afbfe3e72 100644 --- a/resource-manager/automation/2022-08-08/sourcecontrol/id_automationaccount.go +++ b/resource-manager/automation/2022-08-08/sourcecontrol/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2022-08-08/sourcecontrol/id_sourcecontrol.go b/resource-manager/automation/2022-08-08/sourcecontrol/id_sourcecontrol.go index 72e5c4d821d..39f98c52c3d 100644 --- a/resource-manager/automation/2022-08-08/sourcecontrol/id_sourcecontrol.go +++ b/resource-manager/automation/2022-08-08/sourcecontrol/id_sourcecontrol.go @@ -38,23 +38,9 @@ func ParseSourceControlID(input string) (*SourceControlId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSourceControlIDInsensitively(input string) (*SourceControlId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SourceControlId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) + if id.SourceControlName, ok = input.Parsed["sourceControlName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", input) } - return &id, nil + return nil } // ValidateSourceControlID checks that 'input' can be parsed as a Source Control ID diff --git a/resource-manager/automation/2022-08-08/sourcecontrolsyncjob/id_sourcecontrol.go b/resource-manager/automation/2022-08-08/sourcecontrolsyncjob/id_sourcecontrol.go index 62ab03b2ac1..6ee0738d824 100644 --- a/resource-manager/automation/2022-08-08/sourcecontrolsyncjob/id_sourcecontrol.go +++ b/resource-manager/automation/2022-08-08/sourcecontrolsyncjob/id_sourcecontrol.go @@ -38,23 +38,9 @@ func ParseSourceControlID(input string) (*SourceControlId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSourceControlIDInsensitively(input string) (*SourceControlId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SourceControlId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) + if id.SourceControlName, ok = input.Parsed["sourceControlName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", input) } - return &id, nil + return nil } // ValidateSourceControlID checks that 'input' can be parsed as a Source Control ID diff --git a/resource-manager/automation/2022-08-08/sourcecontrolsyncjob/id_sourcecontrolsyncjob.go b/resource-manager/automation/2022-08-08/sourcecontrolsyncjob/id_sourcecontrolsyncjob.go index 3450a4ccc34..6c32abe23cd 100644 --- a/resource-manager/automation/2022-08-08/sourcecontrolsyncjob/id_sourcecontrolsyncjob.go +++ b/resource-manager/automation/2022-08-08/sourcecontrolsyncjob/id_sourcecontrolsyncjob.go @@ -40,27 +40,9 @@ func ParseSourceControlSyncJobID(input string) (*SourceControlSyncJobId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlSyncJobId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) - } - - if id.SourceControlSyncJobId, ok = parsed.Parsed["sourceControlSyncJobId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlSyncJobId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSourceControlSyncJobIDInsensitively(input string) (*SourceControlSyncJ return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlSyncJobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SourceControlSyncJobId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) + if id.SourceControlName, ok = input.Parsed["sourceControlName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", input) } - if id.SourceControlSyncJobId, ok = parsed.Parsed["sourceControlSyncJobId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlSyncJobId", *parsed) + if id.SourceControlSyncJobId, ok = input.Parsed["sourceControlSyncJobId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sourceControlSyncJobId", input) } - return &id, nil + return nil } // ValidateSourceControlSyncJobID checks that 'input' can be parsed as a Source Control Sync Job ID diff --git a/resource-manager/automation/2022-08-08/sourcecontrolsyncjobstreams/id_sourcecontrolsyncjob.go b/resource-manager/automation/2022-08-08/sourcecontrolsyncjobstreams/id_sourcecontrolsyncjob.go index d31cfb97687..6da55d6b46c 100644 --- a/resource-manager/automation/2022-08-08/sourcecontrolsyncjobstreams/id_sourcecontrolsyncjob.go +++ b/resource-manager/automation/2022-08-08/sourcecontrolsyncjobstreams/id_sourcecontrolsyncjob.go @@ -40,27 +40,9 @@ func ParseSourceControlSyncJobID(input string) (*SourceControlSyncJobId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlSyncJobId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) - } - - if id.SourceControlSyncJobId, ok = parsed.Parsed["sourceControlSyncJobId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlSyncJobId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSourceControlSyncJobIDInsensitively(input string) (*SourceControlSyncJ return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlSyncJobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SourceControlSyncJobId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) + if id.SourceControlName, ok = input.Parsed["sourceControlName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", input) } - if id.SourceControlSyncJobId, ok = parsed.Parsed["sourceControlSyncJobId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlSyncJobId", *parsed) + if id.SourceControlSyncJobId, ok = input.Parsed["sourceControlSyncJobId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sourceControlSyncJobId", input) } - return &id, nil + return nil } // ValidateSourceControlSyncJobID checks that 'input' can be parsed as a Source Control Sync Job ID diff --git a/resource-manager/automation/2022-08-08/sourcecontrolsyncjobstreams/id_sourcecontrolsyncjobstream.go b/resource-manager/automation/2022-08-08/sourcecontrolsyncjobstreams/id_sourcecontrolsyncjobstream.go index 1658914fcd0..1734b33ba66 100644 --- a/resource-manager/automation/2022-08-08/sourcecontrolsyncjobstreams/id_sourcecontrolsyncjobstream.go +++ b/resource-manager/automation/2022-08-08/sourcecontrolsyncjobstreams/id_sourcecontrolsyncjobstream.go @@ -42,31 +42,9 @@ func ParseSourceControlSyncJobStreamID(input string) (*SourceControlSyncJobStrea return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlSyncJobStreamId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) - } - - if id.SourceControlSyncJobId, ok = parsed.Parsed["sourceControlSyncJobId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlSyncJobId", *parsed) - } - - if id.StreamId, ok = parsed.Parsed["streamId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseSourceControlSyncJobStreamIDInsensitively(input string) (*SourceContro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlSyncJobStreamId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SourceControlSyncJobStreamId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) + if id.SourceControlName, ok = input.Parsed["sourceControlName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", input) } - if id.SourceControlSyncJobId, ok = parsed.Parsed["sourceControlSyncJobId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlSyncJobId", *parsed) + if id.SourceControlSyncJobId, ok = input.Parsed["sourceControlSyncJobId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sourceControlSyncJobId", input) } - if id.StreamId, ok = parsed.Parsed["streamId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamId", *parsed) + if id.StreamId, ok = input.Parsed["streamId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "streamId", input) } - return &id, nil + return nil } // ValidateSourceControlSyncJobStreamID checks that 'input' can be parsed as a Source Control Sync Job Stream ID diff --git a/resource-manager/automation/2022-08-08/statistics/id_automationaccount.go b/resource-manager/automation/2022-08-08/statistics/id_automationaccount.go index acb480c909f..f1006810ba4 100644 --- a/resource-manager/automation/2022-08-08/statistics/id_automationaccount.go +++ b/resource-manager/automation/2022-08-08/statistics/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2022-08-08/testjob/id_runbook.go b/resource-manager/automation/2022-08-08/testjob/id_runbook.go index 5ea2c22ce96..7a4b2bb504f 100644 --- a/resource-manager/automation/2022-08-08/testjob/id_runbook.go +++ b/resource-manager/automation/2022-08-08/testjob/id_runbook.go @@ -38,23 +38,9 @@ func ParseRunbookID(input string) (*RunbookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunbookId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.RunbookName, ok = parsed.Parsed["runbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runbookName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRunbookIDInsensitively(input string) (*RunbookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunbookId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RunbookId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.RunbookName, ok = parsed.Parsed["runbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runbookName", *parsed) + if id.RunbookName, ok = input.Parsed["runbookName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runbookName", input) } - return &id, nil + return nil } // ValidateRunbookID checks that 'input' can be parsed as a Runbook ID diff --git a/resource-manager/automation/2022-08-08/testjobstream/id_runbook.go b/resource-manager/automation/2022-08-08/testjobstream/id_runbook.go index b9602d1e074..2db9b3a2d82 100644 --- a/resource-manager/automation/2022-08-08/testjobstream/id_runbook.go +++ b/resource-manager/automation/2022-08-08/testjobstream/id_runbook.go @@ -38,23 +38,9 @@ func ParseRunbookID(input string) (*RunbookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunbookId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.RunbookName, ok = parsed.Parsed["runbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runbookName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRunbookIDInsensitively(input string) (*RunbookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunbookId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RunbookId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.RunbookName, ok = parsed.Parsed["runbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runbookName", *parsed) + if id.RunbookName, ok = input.Parsed["runbookName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runbookName", input) } - return &id, nil + return nil } // ValidateRunbookID checks that 'input' can be parsed as a Runbook ID diff --git a/resource-manager/automation/2022-08-08/testjobstream/id_testjobstream.go b/resource-manager/automation/2022-08-08/testjobstream/id_testjobstream.go index 7cfa557b55b..adb397aab0c 100644 --- a/resource-manager/automation/2022-08-08/testjobstream/id_testjobstream.go +++ b/resource-manager/automation/2022-08-08/testjobstream/id_testjobstream.go @@ -40,27 +40,9 @@ func ParseTestJobStreamID(input string) (*TestJobStreamId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TestJobStreamId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.RunbookName, ok = parsed.Parsed["runbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runbookName", *parsed) - } - - if id.JobStreamId, ok = parsed.Parsed["jobStreamId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobStreamId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseTestJobStreamIDInsensitively(input string) (*TestJobStreamId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TestJobStreamId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TestJobStreamId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.RunbookName, ok = parsed.Parsed["runbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runbookName", *parsed) + if id.RunbookName, ok = input.Parsed["runbookName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runbookName", input) } - if id.JobStreamId, ok = parsed.Parsed["jobStreamId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobStreamId", *parsed) + if id.JobStreamId, ok = input.Parsed["jobStreamId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobStreamId", input) } - return &id, nil + return nil } // ValidateTestJobStreamID checks that 'input' can be parsed as a Test Job Stream ID diff --git a/resource-manager/automation/2022-08-08/typefields/id_type.go b/resource-manager/automation/2022-08-08/typefields/id_type.go index 494728e37cc..a8529df8d82 100644 --- a/resource-manager/automation/2022-08-08/typefields/id_type.go +++ b/resource-manager/automation/2022-08-08/typefields/id_type.go @@ -40,27 +40,9 @@ func ParseTypeID(input string) (*TypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TypeId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) - } - - if id.TypeName, ok = parsed.Parsed["typeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "typeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseTypeIDInsensitively(input string) (*TypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TypeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if id.ModuleName, ok = input.Parsed["moduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "moduleName", input) } - if id.TypeName, ok = parsed.Parsed["typeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "typeName", *parsed) + if id.TypeName, ok = input.Parsed["typeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "typeName", input) } - return &id, nil + return nil } // ValidateTypeID checks that 'input' can be parsed as a Type ID diff --git a/resource-manager/automation/2022-08-08/usages/id_automationaccount.go b/resource-manager/automation/2022-08-08/usages/id_automationaccount.go index 92d03475dfc..5325f60346c 100644 --- a/resource-manager/automation/2022-08-08/usages/id_automationaccount.go +++ b/resource-manager/automation/2022-08-08/usages/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2022-08-08/variable/id_automationaccount.go b/resource-manager/automation/2022-08-08/variable/id_automationaccount.go index 5e89d091247..55cc4873ac0 100644 --- a/resource-manager/automation/2022-08-08/variable/id_automationaccount.go +++ b/resource-manager/automation/2022-08-08/variable/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2022-08-08/variable/id_variable.go b/resource-manager/automation/2022-08-08/variable/id_variable.go index 6f4c6f2db0e..15c186227f2 100644 --- a/resource-manager/automation/2022-08-08/variable/id_variable.go +++ b/resource-manager/automation/2022-08-08/variable/id_variable.go @@ -38,23 +38,9 @@ func ParseVariableID(input string) (*VariableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VariableId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.VariableName, ok = parsed.Parsed["variableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "variableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVariableIDInsensitively(input string) (*VariableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VariableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VariableId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.VariableName, ok = parsed.Parsed["variableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "variableName", *parsed) + if id.VariableName, ok = input.Parsed["variableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "variableName", input) } - return &id, nil + return nil } // ValidateVariableID checks that 'input' can be parsed as a Variable ID diff --git a/resource-manager/automation/2023-11-01/activity/id_activity.go b/resource-manager/automation/2023-11-01/activity/id_activity.go index 3930c905492..9a1bddcd0a9 100644 --- a/resource-manager/automation/2023-11-01/activity/id_activity.go +++ b/resource-manager/automation/2023-11-01/activity/id_activity.go @@ -40,27 +40,9 @@ func ParseActivityID(input string) (*ActivityId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ActivityId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) - } - - if id.ActivityName, ok = parsed.Parsed["activityName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "activityName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseActivityIDInsensitively(input string) (*ActivityId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ActivityId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ActivityId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if id.ModuleName, ok = input.Parsed["moduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "moduleName", input) } - if id.ActivityName, ok = parsed.Parsed["activityName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "activityName", *parsed) + if id.ActivityName, ok = input.Parsed["activityName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "activityName", input) } - return &id, nil + return nil } // ValidateActivityID checks that 'input' can be parsed as a Activity ID diff --git a/resource-manager/automation/2023-11-01/activity/id_module.go b/resource-manager/automation/2023-11-01/activity/id_module.go index 0c927d16d45..15aac63648e 100644 --- a/resource-manager/automation/2023-11-01/activity/id_module.go +++ b/resource-manager/automation/2023-11-01/activity/id_module.go @@ -38,23 +38,9 @@ func ParseModuleID(input string) (*ModuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModuleId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseModuleIDInsensitively(input string) (*ModuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ModuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if id.ModuleName, ok = input.Parsed["moduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "moduleName", input) } - return &id, nil + return nil } // ValidateModuleID checks that 'input' can be parsed as a Module ID diff --git a/resource-manager/automation/2023-11-01/automationaccount/id_automationaccount.go b/resource-manager/automation/2023-11-01/automationaccount/id_automationaccount.go index 507f59b0248..30125ce2604 100644 --- a/resource-manager/automation/2023-11-01/automationaccount/id_automationaccount.go +++ b/resource-manager/automation/2023-11-01/automationaccount/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2023-11-01/certificate/id_automationaccount.go b/resource-manager/automation/2023-11-01/certificate/id_automationaccount.go index b72970d4392..5f31a6b8efd 100644 --- a/resource-manager/automation/2023-11-01/certificate/id_automationaccount.go +++ b/resource-manager/automation/2023-11-01/certificate/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2023-11-01/certificate/id_certificate.go b/resource-manager/automation/2023-11-01/certificate/id_certificate.go index a4dd6601140..492524d5d54 100644 --- a/resource-manager/automation/2023-11-01/certificate/id_certificate.go +++ b/resource-manager/automation/2023-11-01/certificate/id_certificate.go @@ -38,23 +38,9 @@ func ParseCertificateID(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCertificateIDInsensitively(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if id.CertificateName, ok = input.Parsed["certificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateName", input) } - return &id, nil + return nil } // ValidateCertificateID checks that 'input' can be parsed as a Certificate ID diff --git a/resource-manager/automation/2023-11-01/connection/id_automationaccount.go b/resource-manager/automation/2023-11-01/connection/id_automationaccount.go index 6b4cf0ead8b..0036ab33fe6 100644 --- a/resource-manager/automation/2023-11-01/connection/id_automationaccount.go +++ b/resource-manager/automation/2023-11-01/connection/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2023-11-01/connection/id_connection.go b/resource-manager/automation/2023-11-01/connection/id_connection.go index e38741628fe..8199efc92b3 100644 --- a/resource-manager/automation/2023-11-01/connection/id_connection.go +++ b/resource-manager/automation/2023-11-01/connection/id_connection.go @@ -38,23 +38,9 @@ func ParseConnectionID(input string) (*ConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ConnectionName, ok = parsed.Parsed["connectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConnectionIDInsensitively(input string) (*ConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ConnectionName, ok = parsed.Parsed["connectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionName", *parsed) + if id.ConnectionName, ok = input.Parsed["connectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectionName", input) } - return &id, nil + return nil } // ValidateConnectionID checks that 'input' can be parsed as a Connection ID diff --git a/resource-manager/automation/2023-11-01/connectiontype/id_automationaccount.go b/resource-manager/automation/2023-11-01/connectiontype/id_automationaccount.go index 9ac59c1b5c4..2df28b9d4b3 100644 --- a/resource-manager/automation/2023-11-01/connectiontype/id_automationaccount.go +++ b/resource-manager/automation/2023-11-01/connectiontype/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2023-11-01/connectiontype/id_connectiontype.go b/resource-manager/automation/2023-11-01/connectiontype/id_connectiontype.go index c27cff4d1ee..c933b61f97a 100644 --- a/resource-manager/automation/2023-11-01/connectiontype/id_connectiontype.go +++ b/resource-manager/automation/2023-11-01/connectiontype/id_connectiontype.go @@ -38,23 +38,9 @@ func ParseConnectionTypeID(input string) (*ConnectionTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionTypeId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ConnectionTypeName, ok = parsed.Parsed["connectionTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionTypeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConnectionTypeIDInsensitively(input string) (*ConnectionTypeId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConnectionTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ConnectionTypeName, ok = parsed.Parsed["connectionTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionTypeName", *parsed) + if id.ConnectionTypeName, ok = input.Parsed["connectionTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectionTypeName", input) } - return &id, nil + return nil } // ValidateConnectionTypeID checks that 'input' can be parsed as a Connection Type ID diff --git a/resource-manager/automation/2023-11-01/credential/id_automationaccount.go b/resource-manager/automation/2023-11-01/credential/id_automationaccount.go index 1d277938871..a8ea4d95e75 100644 --- a/resource-manager/automation/2023-11-01/credential/id_automationaccount.go +++ b/resource-manager/automation/2023-11-01/credential/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2023-11-01/credential/id_credential.go b/resource-manager/automation/2023-11-01/credential/id_credential.go index 3bc69d79906..6f666f05d43 100644 --- a/resource-manager/automation/2023-11-01/credential/id_credential.go +++ b/resource-manager/automation/2023-11-01/credential/id_credential.go @@ -38,23 +38,9 @@ func ParseCredentialID(input string) (*CredentialId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CredentialId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.CredentialName, ok = parsed.Parsed["credentialName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "credentialName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCredentialIDInsensitively(input string) (*CredentialId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CredentialId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CredentialId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.CredentialName, ok = parsed.Parsed["credentialName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "credentialName", *parsed) + if id.CredentialName, ok = input.Parsed["credentialName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "credentialName", input) } - return &id, nil + return nil } // ValidateCredentialID checks that 'input' can be parsed as a Credential ID diff --git a/resource-manager/automation/2023-11-01/dscconfiguration/id_automationaccount.go b/resource-manager/automation/2023-11-01/dscconfiguration/id_automationaccount.go index e55bc5823ef..7d065e1e87f 100644 --- a/resource-manager/automation/2023-11-01/dscconfiguration/id_automationaccount.go +++ b/resource-manager/automation/2023-11-01/dscconfiguration/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2023-11-01/dscconfiguration/id_configuration.go b/resource-manager/automation/2023-11-01/dscconfiguration/id_configuration.go index 9ab132d3e0a..ad9cf42c091 100644 --- a/resource-manager/automation/2023-11-01/dscconfiguration/id_configuration.go +++ b/resource-manager/automation/2023-11-01/dscconfiguration/id_configuration.go @@ -38,23 +38,9 @@ func ParseConfigurationID(input string) (*ConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConfigurationIDInsensitively(input string) (*ConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationName", *parsed) + if id.ConfigurationName, ok = input.Parsed["configurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationName", input) } - return &id, nil + return nil } // ValidateConfigurationID checks that 'input' can be parsed as a Configuration ID diff --git a/resource-manager/automation/2023-11-01/dscnodeconfiguration/id_automationaccount.go b/resource-manager/automation/2023-11-01/dscnodeconfiguration/id_automationaccount.go index 86960689e71..254e43fe5d9 100644 --- a/resource-manager/automation/2023-11-01/dscnodeconfiguration/id_automationaccount.go +++ b/resource-manager/automation/2023-11-01/dscnodeconfiguration/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2023-11-01/dscnodeconfiguration/id_nodeconfiguration.go b/resource-manager/automation/2023-11-01/dscnodeconfiguration/id_nodeconfiguration.go index df13fdfef49..7d94c8c45ea 100644 --- a/resource-manager/automation/2023-11-01/dscnodeconfiguration/id_nodeconfiguration.go +++ b/resource-manager/automation/2023-11-01/dscnodeconfiguration/id_nodeconfiguration.go @@ -38,23 +38,9 @@ func ParseNodeConfigurationID(input string) (*NodeConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NodeConfigurationId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.NodeConfigurationName, ok = parsed.Parsed["nodeConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nodeConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseNodeConfigurationIDInsensitively(input string) (*NodeConfigurationId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NodeConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *NodeConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.NodeConfigurationName, ok = parsed.Parsed["nodeConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nodeConfigurationName", *parsed) + if id.NodeConfigurationName, ok = input.Parsed["nodeConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "nodeConfigurationName", input) } - return &id, nil + return nil } // ValidateNodeConfigurationID checks that 'input' can be parsed as a Node Configuration ID diff --git a/resource-manager/automation/2023-11-01/hybridrunbookworker/id_hybridrunbookworker.go b/resource-manager/automation/2023-11-01/hybridrunbookworker/id_hybridrunbookworker.go index d65585a8ec5..41964d77d33 100644 --- a/resource-manager/automation/2023-11-01/hybridrunbookworker/id_hybridrunbookworker.go +++ b/resource-manager/automation/2023-11-01/hybridrunbookworker/id_hybridrunbookworker.go @@ -40,27 +40,9 @@ func ParseHybridRunbookWorkerID(input string) (*HybridRunbookWorkerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HybridRunbookWorkerId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.HybridRunbookWorkerGroupName, ok = parsed.Parsed["hybridRunbookWorkerGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridRunbookWorkerGroupName", *parsed) - } - - if id.HybridRunbookWorkerId, ok = parsed.Parsed["hybridRunbookWorkerId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridRunbookWorkerId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseHybridRunbookWorkerIDInsensitively(input string) (*HybridRunbookWorker return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HybridRunbookWorkerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *HybridRunbookWorkerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.HybridRunbookWorkerGroupName, ok = parsed.Parsed["hybridRunbookWorkerGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridRunbookWorkerGroupName", *parsed) + if id.HybridRunbookWorkerGroupName, ok = input.Parsed["hybridRunbookWorkerGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hybridRunbookWorkerGroupName", input) } - if id.HybridRunbookWorkerId, ok = parsed.Parsed["hybridRunbookWorkerId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridRunbookWorkerId", *parsed) + if id.HybridRunbookWorkerId, ok = input.Parsed["hybridRunbookWorkerId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hybridRunbookWorkerId", input) } - return &id, nil + return nil } // ValidateHybridRunbookWorkerID checks that 'input' can be parsed as a Hybrid Runbook Worker ID diff --git a/resource-manager/automation/2023-11-01/hybridrunbookworker/id_hybridrunbookworkergroup.go b/resource-manager/automation/2023-11-01/hybridrunbookworker/id_hybridrunbookworkergroup.go index 54670f1d376..64c7328992a 100644 --- a/resource-manager/automation/2023-11-01/hybridrunbookworker/id_hybridrunbookworkergroup.go +++ b/resource-manager/automation/2023-11-01/hybridrunbookworker/id_hybridrunbookworkergroup.go @@ -38,23 +38,9 @@ func ParseHybridRunbookWorkerGroupID(input string) (*HybridRunbookWorkerGroupId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HybridRunbookWorkerGroupId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.HybridRunbookWorkerGroupName, ok = parsed.Parsed["hybridRunbookWorkerGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridRunbookWorkerGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseHybridRunbookWorkerGroupIDInsensitively(input string) (*HybridRunbookW return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HybridRunbookWorkerGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *HybridRunbookWorkerGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.HybridRunbookWorkerGroupName, ok = parsed.Parsed["hybridRunbookWorkerGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridRunbookWorkerGroupName", *parsed) + if id.HybridRunbookWorkerGroupName, ok = input.Parsed["hybridRunbookWorkerGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hybridRunbookWorkerGroupName", input) } - return &id, nil + return nil } // ValidateHybridRunbookWorkerGroupID checks that 'input' can be parsed as a Hybrid Runbook Worker Group ID diff --git a/resource-manager/automation/2023-11-01/hybridrunbookworkergroup/id_automationaccount.go b/resource-manager/automation/2023-11-01/hybridrunbookworkergroup/id_automationaccount.go index 33a62270abe..3a2202493f9 100644 --- a/resource-manager/automation/2023-11-01/hybridrunbookworkergroup/id_automationaccount.go +++ b/resource-manager/automation/2023-11-01/hybridrunbookworkergroup/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2023-11-01/hybridrunbookworkergroup/id_hybridrunbookworkergroup.go b/resource-manager/automation/2023-11-01/hybridrunbookworkergroup/id_hybridrunbookworkergroup.go index 5a9d8c7a7e4..774227e7d67 100644 --- a/resource-manager/automation/2023-11-01/hybridrunbookworkergroup/id_hybridrunbookworkergroup.go +++ b/resource-manager/automation/2023-11-01/hybridrunbookworkergroup/id_hybridrunbookworkergroup.go @@ -38,23 +38,9 @@ func ParseHybridRunbookWorkerGroupID(input string) (*HybridRunbookWorkerGroupId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HybridRunbookWorkerGroupId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.HybridRunbookWorkerGroupName, ok = parsed.Parsed["hybridRunbookWorkerGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridRunbookWorkerGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseHybridRunbookWorkerGroupIDInsensitively(input string) (*HybridRunbookW return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HybridRunbookWorkerGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *HybridRunbookWorkerGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.HybridRunbookWorkerGroupName, ok = parsed.Parsed["hybridRunbookWorkerGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridRunbookWorkerGroupName", *parsed) + if id.HybridRunbookWorkerGroupName, ok = input.Parsed["hybridRunbookWorkerGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hybridRunbookWorkerGroupName", input) } - return &id, nil + return nil } // ValidateHybridRunbookWorkerGroupID checks that 'input' can be parsed as a Hybrid Runbook Worker Group ID diff --git a/resource-manager/automation/2023-11-01/job/id_automationaccount.go b/resource-manager/automation/2023-11-01/job/id_automationaccount.go index 92931d6f634..cbc63031f3b 100644 --- a/resource-manager/automation/2023-11-01/job/id_automationaccount.go +++ b/resource-manager/automation/2023-11-01/job/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2023-11-01/job/id_job.go b/resource-manager/automation/2023-11-01/job/id_job.go index fbadf9f6a12..301f0ade03f 100644 --- a/resource-manager/automation/2023-11-01/job/id_job.go +++ b/resource-manager/automation/2023-11-01/job/id_job.go @@ -38,23 +38,9 @@ func ParseJobID(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseJobIDInsensitively(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *JobId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - return &id, nil + return nil } // ValidateJobID checks that 'input' can be parsed as a Job ID diff --git a/resource-manager/automation/2023-11-01/jobschedule/id_automationaccount.go b/resource-manager/automation/2023-11-01/jobschedule/id_automationaccount.go index 400c8f88c64..2b9d8abbf03 100644 --- a/resource-manager/automation/2023-11-01/jobschedule/id_automationaccount.go +++ b/resource-manager/automation/2023-11-01/jobschedule/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2023-11-01/jobschedule/id_jobschedule.go b/resource-manager/automation/2023-11-01/jobschedule/id_jobschedule.go index 96c657b3d4b..c2f160f1cf4 100644 --- a/resource-manager/automation/2023-11-01/jobschedule/id_jobschedule.go +++ b/resource-manager/automation/2023-11-01/jobschedule/id_jobschedule.go @@ -38,23 +38,9 @@ func ParseJobScheduleID(input string) (*JobScheduleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobScheduleId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.JobScheduleId, ok = parsed.Parsed["jobScheduleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobScheduleId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseJobScheduleIDInsensitively(input string) (*JobScheduleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobScheduleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *JobScheduleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.JobScheduleId, ok = parsed.Parsed["jobScheduleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobScheduleId", *parsed) + if id.JobScheduleId, ok = input.Parsed["jobScheduleId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobScheduleId", input) } - return &id, nil + return nil } // ValidateJobScheduleID checks that 'input' can be parsed as a Job Schedule ID diff --git a/resource-manager/automation/2023-11-01/jobstream/id_job.go b/resource-manager/automation/2023-11-01/jobstream/id_job.go index 0d8282be25c..46e6c67a788 100644 --- a/resource-manager/automation/2023-11-01/jobstream/id_job.go +++ b/resource-manager/automation/2023-11-01/jobstream/id_job.go @@ -38,23 +38,9 @@ func ParseJobID(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseJobIDInsensitively(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *JobId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - return &id, nil + return nil } // ValidateJobID checks that 'input' can be parsed as a Job ID diff --git a/resource-manager/automation/2023-11-01/jobstream/id_stream.go b/resource-manager/automation/2023-11-01/jobstream/id_stream.go index 2cbff7b6794..edb99c9e84e 100644 --- a/resource-manager/automation/2023-11-01/jobstream/id_stream.go +++ b/resource-manager/automation/2023-11-01/jobstream/id_stream.go @@ -40,27 +40,9 @@ func ParseStreamID(input string) (*StreamId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StreamId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) - } - - if id.JobStreamId, ok = parsed.Parsed["jobStreamId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobStreamId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseStreamIDInsensitively(input string) (*StreamId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StreamId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *StreamId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - if id.JobStreamId, ok = parsed.Parsed["jobStreamId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobStreamId", *parsed) + if id.JobStreamId, ok = input.Parsed["jobStreamId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobStreamId", input) } - return &id, nil + return nil } // ValidateStreamID checks that 'input' can be parsed as a Stream ID diff --git a/resource-manager/automation/2023-11-01/linkedworkspace/id_automationaccount.go b/resource-manager/automation/2023-11-01/linkedworkspace/id_automationaccount.go index deddffb8d5a..ea7bde1591e 100644 --- a/resource-manager/automation/2023-11-01/linkedworkspace/id_automationaccount.go +++ b/resource-manager/automation/2023-11-01/linkedworkspace/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2023-11-01/listkeys/id_automationaccount.go b/resource-manager/automation/2023-11-01/listkeys/id_automationaccount.go index 5f70ed146f5..ac3bcb95a66 100644 --- a/resource-manager/automation/2023-11-01/listkeys/id_automationaccount.go +++ b/resource-manager/automation/2023-11-01/listkeys/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2023-11-01/module/id_automationaccount.go b/resource-manager/automation/2023-11-01/module/id_automationaccount.go index eb9b0e144b5..90f3b8db661 100644 --- a/resource-manager/automation/2023-11-01/module/id_automationaccount.go +++ b/resource-manager/automation/2023-11-01/module/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2023-11-01/module/id_module.go b/resource-manager/automation/2023-11-01/module/id_module.go index d94c81de067..f556cfcb0e9 100644 --- a/resource-manager/automation/2023-11-01/module/id_module.go +++ b/resource-manager/automation/2023-11-01/module/id_module.go @@ -38,23 +38,9 @@ func ParseModuleID(input string) (*ModuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModuleId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseModuleIDInsensitively(input string) (*ModuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ModuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if id.ModuleName, ok = input.Parsed["moduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "moduleName", input) } - return &id, nil + return nil } // ValidateModuleID checks that 'input' can be parsed as a Module ID diff --git a/resource-manager/automation/2023-11-01/module/id_powershell72module.go b/resource-manager/automation/2023-11-01/module/id_powershell72module.go index 3aca56335b5..80036be5d11 100644 --- a/resource-manager/automation/2023-11-01/module/id_powershell72module.go +++ b/resource-manager/automation/2023-11-01/module/id_powershell72module.go @@ -38,23 +38,9 @@ func ParsePowerShell72ModuleID(input string) (*PowerShell72ModuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PowerShell72ModuleId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.PowerShell72ModuleName, ok = parsed.Parsed["powerShell72ModuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "powerShell72ModuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePowerShell72ModuleIDInsensitively(input string) (*PowerShell72ModuleId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PowerShell72ModuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PowerShell72ModuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.PowerShell72ModuleName, ok = parsed.Parsed["powerShell72ModuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "powerShell72ModuleName", *parsed) + if id.PowerShell72ModuleName, ok = input.Parsed["powerShell72ModuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "powerShell72ModuleName", input) } - return &id, nil + return nil } // ValidatePowerShell72ModuleID checks that 'input' can be parsed as a Power Shell 7 2 Module ID diff --git a/resource-manager/automation/2023-11-01/objectdatatypes/id_moduleobjectdatatype.go b/resource-manager/automation/2023-11-01/objectdatatypes/id_moduleobjectdatatype.go index f4b6295f338..c6781dacbff 100644 --- a/resource-manager/automation/2023-11-01/objectdatatypes/id_moduleobjectdatatype.go +++ b/resource-manager/automation/2023-11-01/objectdatatypes/id_moduleobjectdatatype.go @@ -40,27 +40,9 @@ func ParseModuleObjectDataTypeID(input string) (*ModuleObjectDataTypeId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModuleObjectDataTypeId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) - } - - if id.ObjectDataTypeName, ok = parsed.Parsed["objectDataTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "objectDataTypeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseModuleObjectDataTypeIDInsensitively(input string) (*ModuleObjectDataTy return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModuleObjectDataTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ModuleObjectDataTypeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if id.ModuleName, ok = input.Parsed["moduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "moduleName", input) } - if id.ObjectDataTypeName, ok = parsed.Parsed["objectDataTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "objectDataTypeName", *parsed) + if id.ObjectDataTypeName, ok = input.Parsed["objectDataTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "objectDataTypeName", input) } - return &id, nil + return nil } // ValidateModuleObjectDataTypeID checks that 'input' can be parsed as a Module Object Data Type ID diff --git a/resource-manager/automation/2023-11-01/objectdatatypes/id_objectdatatype.go b/resource-manager/automation/2023-11-01/objectdatatypes/id_objectdatatype.go index 1272d15447b..1035288be12 100644 --- a/resource-manager/automation/2023-11-01/objectdatatypes/id_objectdatatype.go +++ b/resource-manager/automation/2023-11-01/objectdatatypes/id_objectdatatype.go @@ -38,23 +38,9 @@ func ParseObjectDataTypeID(input string) (*ObjectDataTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ObjectDataTypeId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ObjectDataTypeName, ok = parsed.Parsed["objectDataTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "objectDataTypeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseObjectDataTypeIDInsensitively(input string) (*ObjectDataTypeId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ObjectDataTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ObjectDataTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ObjectDataTypeName, ok = parsed.Parsed["objectDataTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "objectDataTypeName", *parsed) + if id.ObjectDataTypeName, ok = input.Parsed["objectDataTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "objectDataTypeName", input) } - return &id, nil + return nil } // ValidateObjectDataTypeID checks that 'input' can be parsed as a Object Data Type ID diff --git a/resource-manager/automation/2023-11-01/operations/id_automationaccount.go b/resource-manager/automation/2023-11-01/operations/id_automationaccount.go index 8c56596bd3f..72ff420049e 100644 --- a/resource-manager/automation/2023-11-01/operations/id_automationaccount.go +++ b/resource-manager/automation/2023-11-01/operations/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2023-11-01/python2package/id_automationaccount.go b/resource-manager/automation/2023-11-01/python2package/id_automationaccount.go index d768add2e38..1de475464a5 100644 --- a/resource-manager/automation/2023-11-01/python2package/id_automationaccount.go +++ b/resource-manager/automation/2023-11-01/python2package/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2023-11-01/python2package/id_python2package.go b/resource-manager/automation/2023-11-01/python2package/id_python2package.go index 8ed4fe6bda2..b72866ad718 100644 --- a/resource-manager/automation/2023-11-01/python2package/id_python2package.go +++ b/resource-manager/automation/2023-11-01/python2package/id_python2package.go @@ -38,23 +38,9 @@ func ParsePython2PackageID(input string) (*Python2PackageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Python2PackageId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.Python2PackageName, ok = parsed.Parsed["python2PackageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "python2PackageName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePython2PackageIDInsensitively(input string) (*Python2PackageId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Python2PackageId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *Python2PackageId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.Python2PackageName, ok = parsed.Parsed["python2PackageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "python2PackageName", *parsed) + if id.Python2PackageName, ok = input.Parsed["python2PackageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "python2PackageName", input) } - return &id, nil + return nil } // ValidatePython2PackageID checks that 'input' can be parsed as a Python 2 Package ID diff --git a/resource-manager/automation/2023-11-01/python3package/id_automationaccount.go b/resource-manager/automation/2023-11-01/python3package/id_automationaccount.go index f6805805bf7..6609025b8ed 100644 --- a/resource-manager/automation/2023-11-01/python3package/id_automationaccount.go +++ b/resource-manager/automation/2023-11-01/python3package/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2023-11-01/python3package/id_python3package.go b/resource-manager/automation/2023-11-01/python3package/id_python3package.go index b94e1868e97..2d076d66f83 100644 --- a/resource-manager/automation/2023-11-01/python3package/id_python3package.go +++ b/resource-manager/automation/2023-11-01/python3package/id_python3package.go @@ -38,23 +38,9 @@ func ParsePython3PackageID(input string) (*Python3PackageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Python3PackageId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.Python3PackageName, ok = parsed.Parsed["python3PackageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "python3PackageName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePython3PackageIDInsensitively(input string) (*Python3PackageId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Python3PackageId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *Python3PackageId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.Python3PackageName, ok = parsed.Parsed["python3PackageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "python3PackageName", *parsed) + if id.Python3PackageName, ok = input.Parsed["python3PackageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "python3PackageName", input) } - return &id, nil + return nil } // ValidatePython3PackageID checks that 'input' can be parsed as a Python 3 Package ID diff --git a/resource-manager/automation/2023-11-01/runbook/id_automationaccount.go b/resource-manager/automation/2023-11-01/runbook/id_automationaccount.go index 8a8b18b7895..43161edfa7e 100644 --- a/resource-manager/automation/2023-11-01/runbook/id_automationaccount.go +++ b/resource-manager/automation/2023-11-01/runbook/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2023-11-01/runbook/id_runbook.go b/resource-manager/automation/2023-11-01/runbook/id_runbook.go index 2adace8bd11..9c8d15c9ac0 100644 --- a/resource-manager/automation/2023-11-01/runbook/id_runbook.go +++ b/resource-manager/automation/2023-11-01/runbook/id_runbook.go @@ -38,23 +38,9 @@ func ParseRunbookID(input string) (*RunbookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunbookId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.RunbookName, ok = parsed.Parsed["runbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runbookName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRunbookIDInsensitively(input string) (*RunbookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunbookId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RunbookId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.RunbookName, ok = parsed.Parsed["runbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runbookName", *parsed) + if id.RunbookName, ok = input.Parsed["runbookName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runbookName", input) } - return &id, nil + return nil } // ValidateRunbookID checks that 'input' can be parsed as a Runbook ID diff --git a/resource-manager/automation/2023-11-01/runbookdraft/id_runbook.go b/resource-manager/automation/2023-11-01/runbookdraft/id_runbook.go index 65a6774ab35..b01c075eb73 100644 --- a/resource-manager/automation/2023-11-01/runbookdraft/id_runbook.go +++ b/resource-manager/automation/2023-11-01/runbookdraft/id_runbook.go @@ -38,23 +38,9 @@ func ParseRunbookID(input string) (*RunbookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunbookId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.RunbookName, ok = parsed.Parsed["runbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runbookName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRunbookIDInsensitively(input string) (*RunbookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunbookId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RunbookId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.RunbookName, ok = parsed.Parsed["runbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runbookName", *parsed) + if id.RunbookName, ok = input.Parsed["runbookName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runbookName", input) } - return &id, nil + return nil } // ValidateRunbookID checks that 'input' can be parsed as a Runbook ID diff --git a/resource-manager/automation/2023-11-01/schedule/id_automationaccount.go b/resource-manager/automation/2023-11-01/schedule/id_automationaccount.go index 1bd8c3bfabe..14c4aea9691 100644 --- a/resource-manager/automation/2023-11-01/schedule/id_automationaccount.go +++ b/resource-manager/automation/2023-11-01/schedule/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2023-11-01/schedule/id_schedule.go b/resource-manager/automation/2023-11-01/schedule/id_schedule.go index 6cb8d3029c2..7dd7bb5fbc5 100644 --- a/resource-manager/automation/2023-11-01/schedule/id_schedule.go +++ b/resource-manager/automation/2023-11-01/schedule/id_schedule.go @@ -38,23 +38,9 @@ func ParseScheduleID(input string) (*ScheduleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScheduleId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ScheduleName, ok = parsed.Parsed["scheduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseScheduleIDInsensitively(input string) (*ScheduleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScheduleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ScheduleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ScheduleName, ok = parsed.Parsed["scheduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", *parsed) + if id.ScheduleName, ok = input.Parsed["scheduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", input) } - return &id, nil + return nil } // ValidateScheduleID checks that 'input' can be parsed as a Schedule ID diff --git a/resource-manager/automation/2023-11-01/softwareupdateconfigurationmachinerun/id_automationaccount.go b/resource-manager/automation/2023-11-01/softwareupdateconfigurationmachinerun/id_automationaccount.go index d1a5f3929b5..f57cc59341f 100644 --- a/resource-manager/automation/2023-11-01/softwareupdateconfigurationmachinerun/id_automationaccount.go +++ b/resource-manager/automation/2023-11-01/softwareupdateconfigurationmachinerun/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2023-11-01/softwareupdateconfigurationmachinerun/id_softwareupdateconfigurationmachinerun.go b/resource-manager/automation/2023-11-01/softwareupdateconfigurationmachinerun/id_softwareupdateconfigurationmachinerun.go index 514e494e501..9d195124bf9 100644 --- a/resource-manager/automation/2023-11-01/softwareupdateconfigurationmachinerun/id_softwareupdateconfigurationmachinerun.go +++ b/resource-manager/automation/2023-11-01/softwareupdateconfigurationmachinerun/id_softwareupdateconfigurationmachinerun.go @@ -38,23 +38,9 @@ func ParseSoftwareUpdateConfigurationMachineRunID(input string) (*SoftwareUpdate return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SoftwareUpdateConfigurationMachineRunId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.SoftwareUpdateConfigurationMachineRunId, ok = parsed.Parsed["softwareUpdateConfigurationMachineRunId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "softwareUpdateConfigurationMachineRunId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSoftwareUpdateConfigurationMachineRunIDInsensitively(input string) (*S return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SoftwareUpdateConfigurationMachineRunId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SoftwareUpdateConfigurationMachineRunId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.SoftwareUpdateConfigurationMachineRunId, ok = parsed.Parsed["softwareUpdateConfigurationMachineRunId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "softwareUpdateConfigurationMachineRunId", *parsed) + if id.SoftwareUpdateConfigurationMachineRunId, ok = input.Parsed["softwareUpdateConfigurationMachineRunId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "softwareUpdateConfigurationMachineRunId", input) } - return &id, nil + return nil } // ValidateSoftwareUpdateConfigurationMachineRunID checks that 'input' can be parsed as a Software Update Configuration Machine Run ID diff --git a/resource-manager/automation/2023-11-01/softwareupdateconfigurationrun/id_automationaccount.go b/resource-manager/automation/2023-11-01/softwareupdateconfigurationrun/id_automationaccount.go index b3d0b483c65..3cbeb376567 100644 --- a/resource-manager/automation/2023-11-01/softwareupdateconfigurationrun/id_automationaccount.go +++ b/resource-manager/automation/2023-11-01/softwareupdateconfigurationrun/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2023-11-01/softwareupdateconfigurationrun/id_softwareupdateconfigurationrun.go b/resource-manager/automation/2023-11-01/softwareupdateconfigurationrun/id_softwareupdateconfigurationrun.go index 2fb7b6fd07c..f7a4bb2be19 100644 --- a/resource-manager/automation/2023-11-01/softwareupdateconfigurationrun/id_softwareupdateconfigurationrun.go +++ b/resource-manager/automation/2023-11-01/softwareupdateconfigurationrun/id_softwareupdateconfigurationrun.go @@ -38,23 +38,9 @@ func ParseSoftwareUpdateConfigurationRunID(input string) (*SoftwareUpdateConfigu return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SoftwareUpdateConfigurationRunId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.SoftwareUpdateConfigurationRunId, ok = parsed.Parsed["softwareUpdateConfigurationRunId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "softwareUpdateConfigurationRunId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSoftwareUpdateConfigurationRunIDInsensitively(input string) (*Software return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SoftwareUpdateConfigurationRunId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SoftwareUpdateConfigurationRunId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.SoftwareUpdateConfigurationRunId, ok = parsed.Parsed["softwareUpdateConfigurationRunId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "softwareUpdateConfigurationRunId", *parsed) + if id.SoftwareUpdateConfigurationRunId, ok = input.Parsed["softwareUpdateConfigurationRunId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "softwareUpdateConfigurationRunId", input) } - return &id, nil + return nil } // ValidateSoftwareUpdateConfigurationRunID checks that 'input' can be parsed as a Software Update Configuration Run ID diff --git a/resource-manager/automation/2023-11-01/sourcecontrol/id_automationaccount.go b/resource-manager/automation/2023-11-01/sourcecontrol/id_automationaccount.go index 8c4e02996a7..69afbfe3e72 100644 --- a/resource-manager/automation/2023-11-01/sourcecontrol/id_automationaccount.go +++ b/resource-manager/automation/2023-11-01/sourcecontrol/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2023-11-01/sourcecontrol/id_sourcecontrol.go b/resource-manager/automation/2023-11-01/sourcecontrol/id_sourcecontrol.go index 72e5c4d821d..39f98c52c3d 100644 --- a/resource-manager/automation/2023-11-01/sourcecontrol/id_sourcecontrol.go +++ b/resource-manager/automation/2023-11-01/sourcecontrol/id_sourcecontrol.go @@ -38,23 +38,9 @@ func ParseSourceControlID(input string) (*SourceControlId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSourceControlIDInsensitively(input string) (*SourceControlId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SourceControlId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) + if id.SourceControlName, ok = input.Parsed["sourceControlName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", input) } - return &id, nil + return nil } // ValidateSourceControlID checks that 'input' can be parsed as a Source Control ID diff --git a/resource-manager/automation/2023-11-01/sourcecontrolsyncjob/id_sourcecontrol.go b/resource-manager/automation/2023-11-01/sourcecontrolsyncjob/id_sourcecontrol.go index 62ab03b2ac1..6ee0738d824 100644 --- a/resource-manager/automation/2023-11-01/sourcecontrolsyncjob/id_sourcecontrol.go +++ b/resource-manager/automation/2023-11-01/sourcecontrolsyncjob/id_sourcecontrol.go @@ -38,23 +38,9 @@ func ParseSourceControlID(input string) (*SourceControlId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSourceControlIDInsensitively(input string) (*SourceControlId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SourceControlId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) + if id.SourceControlName, ok = input.Parsed["sourceControlName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", input) } - return &id, nil + return nil } // ValidateSourceControlID checks that 'input' can be parsed as a Source Control ID diff --git a/resource-manager/automation/2023-11-01/sourcecontrolsyncjob/id_sourcecontrolsyncjob.go b/resource-manager/automation/2023-11-01/sourcecontrolsyncjob/id_sourcecontrolsyncjob.go index 3450a4ccc34..6c32abe23cd 100644 --- a/resource-manager/automation/2023-11-01/sourcecontrolsyncjob/id_sourcecontrolsyncjob.go +++ b/resource-manager/automation/2023-11-01/sourcecontrolsyncjob/id_sourcecontrolsyncjob.go @@ -40,27 +40,9 @@ func ParseSourceControlSyncJobID(input string) (*SourceControlSyncJobId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlSyncJobId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) - } - - if id.SourceControlSyncJobId, ok = parsed.Parsed["sourceControlSyncJobId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlSyncJobId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSourceControlSyncJobIDInsensitively(input string) (*SourceControlSyncJ return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlSyncJobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SourceControlSyncJobId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) + if id.SourceControlName, ok = input.Parsed["sourceControlName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", input) } - if id.SourceControlSyncJobId, ok = parsed.Parsed["sourceControlSyncJobId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlSyncJobId", *parsed) + if id.SourceControlSyncJobId, ok = input.Parsed["sourceControlSyncJobId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sourceControlSyncJobId", input) } - return &id, nil + return nil } // ValidateSourceControlSyncJobID checks that 'input' can be parsed as a Source Control Sync Job ID diff --git a/resource-manager/automation/2023-11-01/sourcecontrolsyncjobstreams/id_sourcecontrolsyncjob.go b/resource-manager/automation/2023-11-01/sourcecontrolsyncjobstreams/id_sourcecontrolsyncjob.go index d31cfb97687..6da55d6b46c 100644 --- a/resource-manager/automation/2023-11-01/sourcecontrolsyncjobstreams/id_sourcecontrolsyncjob.go +++ b/resource-manager/automation/2023-11-01/sourcecontrolsyncjobstreams/id_sourcecontrolsyncjob.go @@ -40,27 +40,9 @@ func ParseSourceControlSyncJobID(input string) (*SourceControlSyncJobId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlSyncJobId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) - } - - if id.SourceControlSyncJobId, ok = parsed.Parsed["sourceControlSyncJobId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlSyncJobId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSourceControlSyncJobIDInsensitively(input string) (*SourceControlSyncJ return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlSyncJobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SourceControlSyncJobId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) + if id.SourceControlName, ok = input.Parsed["sourceControlName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", input) } - if id.SourceControlSyncJobId, ok = parsed.Parsed["sourceControlSyncJobId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlSyncJobId", *parsed) + if id.SourceControlSyncJobId, ok = input.Parsed["sourceControlSyncJobId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sourceControlSyncJobId", input) } - return &id, nil + return nil } // ValidateSourceControlSyncJobID checks that 'input' can be parsed as a Source Control Sync Job ID diff --git a/resource-manager/automation/2023-11-01/sourcecontrolsyncjobstreams/id_sourcecontrolsyncjobstream.go b/resource-manager/automation/2023-11-01/sourcecontrolsyncjobstreams/id_sourcecontrolsyncjobstream.go index 1658914fcd0..1734b33ba66 100644 --- a/resource-manager/automation/2023-11-01/sourcecontrolsyncjobstreams/id_sourcecontrolsyncjobstream.go +++ b/resource-manager/automation/2023-11-01/sourcecontrolsyncjobstreams/id_sourcecontrolsyncjobstream.go @@ -42,31 +42,9 @@ func ParseSourceControlSyncJobStreamID(input string) (*SourceControlSyncJobStrea return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlSyncJobStreamId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) - } - - if id.SourceControlSyncJobId, ok = parsed.Parsed["sourceControlSyncJobId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlSyncJobId", *parsed) - } - - if id.StreamId, ok = parsed.Parsed["streamId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseSourceControlSyncJobStreamIDInsensitively(input string) (*SourceContro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlSyncJobStreamId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SourceControlSyncJobStreamId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) + if id.SourceControlName, ok = input.Parsed["sourceControlName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", input) } - if id.SourceControlSyncJobId, ok = parsed.Parsed["sourceControlSyncJobId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlSyncJobId", *parsed) + if id.SourceControlSyncJobId, ok = input.Parsed["sourceControlSyncJobId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sourceControlSyncJobId", input) } - if id.StreamId, ok = parsed.Parsed["streamId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamId", *parsed) + if id.StreamId, ok = input.Parsed["streamId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "streamId", input) } - return &id, nil + return nil } // ValidateSourceControlSyncJobStreamID checks that 'input' can be parsed as a Source Control Sync Job Stream ID diff --git a/resource-manager/automation/2023-11-01/statistics/id_automationaccount.go b/resource-manager/automation/2023-11-01/statistics/id_automationaccount.go index acb480c909f..f1006810ba4 100644 --- a/resource-manager/automation/2023-11-01/statistics/id_automationaccount.go +++ b/resource-manager/automation/2023-11-01/statistics/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2023-11-01/testjob/id_runbook.go b/resource-manager/automation/2023-11-01/testjob/id_runbook.go index 5ea2c22ce96..7a4b2bb504f 100644 --- a/resource-manager/automation/2023-11-01/testjob/id_runbook.go +++ b/resource-manager/automation/2023-11-01/testjob/id_runbook.go @@ -38,23 +38,9 @@ func ParseRunbookID(input string) (*RunbookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunbookId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.RunbookName, ok = parsed.Parsed["runbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runbookName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRunbookIDInsensitively(input string) (*RunbookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunbookId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RunbookId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.RunbookName, ok = parsed.Parsed["runbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runbookName", *parsed) + if id.RunbookName, ok = input.Parsed["runbookName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runbookName", input) } - return &id, nil + return nil } // ValidateRunbookID checks that 'input' can be parsed as a Runbook ID diff --git a/resource-manager/automation/2023-11-01/testjobstream/id_runbook.go b/resource-manager/automation/2023-11-01/testjobstream/id_runbook.go index b9602d1e074..2db9b3a2d82 100644 --- a/resource-manager/automation/2023-11-01/testjobstream/id_runbook.go +++ b/resource-manager/automation/2023-11-01/testjobstream/id_runbook.go @@ -38,23 +38,9 @@ func ParseRunbookID(input string) (*RunbookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunbookId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.RunbookName, ok = parsed.Parsed["runbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runbookName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRunbookIDInsensitively(input string) (*RunbookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunbookId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RunbookId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.RunbookName, ok = parsed.Parsed["runbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runbookName", *parsed) + if id.RunbookName, ok = input.Parsed["runbookName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runbookName", input) } - return &id, nil + return nil } // ValidateRunbookID checks that 'input' can be parsed as a Runbook ID diff --git a/resource-manager/automation/2023-11-01/testjobstream/id_testjobstream.go b/resource-manager/automation/2023-11-01/testjobstream/id_testjobstream.go index 7cfa557b55b..adb397aab0c 100644 --- a/resource-manager/automation/2023-11-01/testjobstream/id_testjobstream.go +++ b/resource-manager/automation/2023-11-01/testjobstream/id_testjobstream.go @@ -40,27 +40,9 @@ func ParseTestJobStreamID(input string) (*TestJobStreamId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TestJobStreamId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.RunbookName, ok = parsed.Parsed["runbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runbookName", *parsed) - } - - if id.JobStreamId, ok = parsed.Parsed["jobStreamId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobStreamId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseTestJobStreamIDInsensitively(input string) (*TestJobStreamId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TestJobStreamId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TestJobStreamId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.RunbookName, ok = parsed.Parsed["runbookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runbookName", *parsed) + if id.RunbookName, ok = input.Parsed["runbookName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runbookName", input) } - if id.JobStreamId, ok = parsed.Parsed["jobStreamId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobStreamId", *parsed) + if id.JobStreamId, ok = input.Parsed["jobStreamId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobStreamId", input) } - return &id, nil + return nil } // ValidateTestJobStreamID checks that 'input' can be parsed as a Test Job Stream ID diff --git a/resource-manager/automation/2023-11-01/typefields/id_type.go b/resource-manager/automation/2023-11-01/typefields/id_type.go index 494728e37cc..a8529df8d82 100644 --- a/resource-manager/automation/2023-11-01/typefields/id_type.go +++ b/resource-manager/automation/2023-11-01/typefields/id_type.go @@ -40,27 +40,9 @@ func ParseTypeID(input string) (*TypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TypeId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) - } - - if id.TypeName, ok = parsed.Parsed["typeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "typeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseTypeIDInsensitively(input string) (*TypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TypeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if id.ModuleName, ok = input.Parsed["moduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "moduleName", input) } - if id.TypeName, ok = parsed.Parsed["typeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "typeName", *parsed) + if id.TypeName, ok = input.Parsed["typeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "typeName", input) } - return &id, nil + return nil } // ValidateTypeID checks that 'input' can be parsed as a Type ID diff --git a/resource-manager/automation/2023-11-01/usages/id_automationaccount.go b/resource-manager/automation/2023-11-01/usages/id_automationaccount.go index 92d03475dfc..5325f60346c 100644 --- a/resource-manager/automation/2023-11-01/usages/id_automationaccount.go +++ b/resource-manager/automation/2023-11-01/usages/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2023-11-01/variable/id_automationaccount.go b/resource-manager/automation/2023-11-01/variable/id_automationaccount.go index 5e89d091247..55cc4873ac0 100644 --- a/resource-manager/automation/2023-11-01/variable/id_automationaccount.go +++ b/resource-manager/automation/2023-11-01/variable/id_automationaccount.go @@ -36,19 +36,9 @@ func ParseAutomationAccountID(input string) (*AutomationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationAccountIDInsensitively(input string) (*AutomationAccountId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - return &id, nil + return nil } // ValidateAutomationAccountID checks that 'input' can be parsed as a Automation Account ID diff --git a/resource-manager/automation/2023-11-01/variable/id_variable.go b/resource-manager/automation/2023-11-01/variable/id_variable.go index 6f4c6f2db0e..15c186227f2 100644 --- a/resource-manager/automation/2023-11-01/variable/id_variable.go +++ b/resource-manager/automation/2023-11-01/variable/id_variable.go @@ -38,23 +38,9 @@ func ParseVariableID(input string) (*VariableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VariableId{} - - 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.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) - } - - if id.VariableName, ok = parsed.Parsed["variableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "variableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVariableIDInsensitively(input string) (*VariableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VariableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VariableId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationAccountName, ok = parsed.Parsed["automationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", *parsed) + if id.AutomationAccountName, ok = input.Parsed["automationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationAccountName", input) } - if id.VariableName, ok = parsed.Parsed["variableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "variableName", *parsed) + if id.VariableName, ok = input.Parsed["variableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "variableName", input) } - return &id, nil + return nil } // ValidateVariableID checks that 'input' can be parsed as a Variable ID diff --git a/resource-manager/azureactivedirectory/2017-04-01/diagnosticsettings/id_diagnosticsetting.go b/resource-manager/azureactivedirectory/2017-04-01/diagnosticsettings/id_diagnosticsetting.go index 3e104ec51c6..8abf7a7174e 100644 --- a/resource-manager/azureactivedirectory/2017-04-01/diagnosticsettings/id_diagnosticsetting.go +++ b/resource-manager/azureactivedirectory/2017-04-01/diagnosticsettings/id_diagnosticsetting.go @@ -32,11 +32,9 @@ func ParseDiagnosticSettingID(input string) (*DiagnosticSettingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiagnosticSettingId{} - - if id.DiagnosticSettingName, ok = parsed.Parsed["diagnosticSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticSettingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseDiagnosticSettingIDInsensitively(input string) (*DiagnosticSettingId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiagnosticSettingId{} - - if id.DiagnosticSettingName, ok = parsed.Parsed["diagnosticSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticSettingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *DiagnosticSettingId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.DiagnosticSettingName, ok = input.Parsed["diagnosticSettingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "diagnosticSettingName", input) + } + + return nil +} + // ValidateDiagnosticSettingID checks that 'input' can be parsed as a Diagnostic Setting ID func ValidateDiagnosticSettingID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/azureactivedirectory/2020-03-01/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/azureactivedirectory/2020-03-01/privateendpointconnections/id_privateendpointconnection.go index 5beebd295d5..cbc99fa73c8 100644 --- a/resource-manager/azureactivedirectory/2020-03-01/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/azureactivedirectory/2020-03-01/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.PrivateLinkForAzureAdName, ok = parsed.Parsed["privateLinkForAzureAdName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkForAzureAdName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateLinkForAzureAdName, ok = parsed.Parsed["privateLinkForAzureAdName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkForAzureAdName", *parsed) + if id.PrivateLinkForAzureAdName, ok = input.Parsed["privateLinkForAzureAdName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkForAzureAdName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/azureactivedirectory/2020-03-01/privateendpointconnections/id_privatelinkforazuread.go b/resource-manager/azureactivedirectory/2020-03-01/privateendpointconnections/id_privatelinkforazuread.go index 15e3f65315d..5ec1b46763a 100644 --- a/resource-manager/azureactivedirectory/2020-03-01/privateendpointconnections/id_privatelinkforazuread.go +++ b/resource-manager/azureactivedirectory/2020-03-01/privateendpointconnections/id_privatelinkforazuread.go @@ -36,19 +36,9 @@ func ParsePrivateLinkForAzureAdID(input string) (*PrivateLinkForAzureAdId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkForAzureAdId{} - - 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.PrivateLinkForAzureAdName, ok = parsed.Parsed["privateLinkForAzureAdName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkForAzureAdName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePrivateLinkForAzureAdIDInsensitively(input string) (*PrivateLinkForAzu return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkForAzureAdId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PrivateLinkForAzureAdId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateLinkForAzureAdName, ok = parsed.Parsed["privateLinkForAzureAdName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkForAzureAdName", *parsed) + if id.PrivateLinkForAzureAdName, ok = input.Parsed["privateLinkForAzureAdName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkForAzureAdName", input) } - return &id, nil + return nil } // ValidatePrivateLinkForAzureAdID checks that 'input' can be parsed as a Private Link For Azure Ad ID diff --git a/resource-manager/azureactivedirectory/2020-03-01/privatelinkforazuread/id_privatelinkforazuread.go b/resource-manager/azureactivedirectory/2020-03-01/privatelinkforazuread/id_privatelinkforazuread.go index 58ab4bbfa02..aad0dc6b043 100644 --- a/resource-manager/azureactivedirectory/2020-03-01/privatelinkforazuread/id_privatelinkforazuread.go +++ b/resource-manager/azureactivedirectory/2020-03-01/privatelinkforazuread/id_privatelinkforazuread.go @@ -36,19 +36,9 @@ func ParsePrivateLinkForAzureAdID(input string) (*PrivateLinkForAzureAdId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkForAzureAdId{} - - 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.PrivateLinkForAzureAdName, ok = parsed.Parsed["privateLinkForAzureAdName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkForAzureAdName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePrivateLinkForAzureAdIDInsensitively(input string) (*PrivateLinkForAzu return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkForAzureAdId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PrivateLinkForAzureAdId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateLinkForAzureAdName, ok = parsed.Parsed["privateLinkForAzureAdName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkForAzureAdName", *parsed) + if id.PrivateLinkForAzureAdName, ok = input.Parsed["privateLinkForAzureAdName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkForAzureAdName", input) } - return &id, nil + return nil } // ValidatePrivateLinkForAzureAdID checks that 'input' can be parsed as a Private Link For Azure Ad ID diff --git a/resource-manager/azureactivedirectory/2020-03-01/privatelinkresources/id_privatelinkforazuread.go b/resource-manager/azureactivedirectory/2020-03-01/privatelinkresources/id_privatelinkforazuread.go index 60bce750596..2faa734d8e1 100644 --- a/resource-manager/azureactivedirectory/2020-03-01/privatelinkresources/id_privatelinkforazuread.go +++ b/resource-manager/azureactivedirectory/2020-03-01/privatelinkresources/id_privatelinkforazuread.go @@ -36,19 +36,9 @@ func ParsePrivateLinkForAzureAdID(input string) (*PrivateLinkForAzureAdId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkForAzureAdId{} - - 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.PrivateLinkForAzureAdName, ok = parsed.Parsed["privateLinkForAzureAdName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkForAzureAdName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePrivateLinkForAzureAdIDInsensitively(input string) (*PrivateLinkForAzu return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkForAzureAdId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PrivateLinkForAzureAdId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateLinkForAzureAdName, ok = parsed.Parsed["privateLinkForAzureAdName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkForAzureAdName", *parsed) + if id.PrivateLinkForAzureAdName, ok = input.Parsed["privateLinkForAzureAdName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkForAzureAdName", input) } - return &id, nil + return nil } // ValidatePrivateLinkForAzureAdID checks that 'input' can be parsed as a Private Link For Azure Ad ID diff --git a/resource-manager/azureactivedirectory/2020-03-01/privatelinkresources/id_privatelinkresource.go b/resource-manager/azureactivedirectory/2020-03-01/privatelinkresources/id_privatelinkresource.go index f78f6fef422..5746cb5bc4e 100644 --- a/resource-manager/azureactivedirectory/2020-03-01/privatelinkresources/id_privatelinkresource.go +++ b/resource-manager/azureactivedirectory/2020-03-01/privatelinkresources/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.PrivateLinkForAzureAdName, ok = parsed.Parsed["privateLinkForAzureAdName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkForAzureAdName", *parsed) - } - - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateLinkForAzureAdName, ok = parsed.Parsed["privateLinkForAzureAdName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkForAzureAdName", *parsed) + if id.PrivateLinkForAzureAdName, ok = input.Parsed["privateLinkForAzureAdName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkForAzureAdName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/azurestackhci/2023-03-01/arcsettings/id_arcsetting.go b/resource-manager/azurestackhci/2023-03-01/arcsettings/id_arcsetting.go index f126af6e3ff..b9efbac67ed 100644 --- a/resource-manager/azurestackhci/2023-03-01/arcsettings/id_arcsetting.go +++ b/resource-manager/azurestackhci/2023-03-01/arcsettings/id_arcsetting.go @@ -38,23 +38,9 @@ func ParseArcSettingID(input string) (*ArcSettingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ArcSettingId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.ArcSettingName, ok = parsed.Parsed["arcSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "arcSettingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseArcSettingIDInsensitively(input string) (*ArcSettingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ArcSettingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ArcSettingId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.ArcSettingName, ok = parsed.Parsed["arcSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "arcSettingName", *parsed) + if id.ArcSettingName, ok = input.Parsed["arcSettingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "arcSettingName", input) } - return &id, nil + return nil } // ValidateArcSettingID checks that 'input' can be parsed as a Arc Setting ID diff --git a/resource-manager/azurestackhci/2023-03-01/arcsettings/id_cluster.go b/resource-manager/azurestackhci/2023-03-01/arcsettings/id_cluster.go index 2c50f526410..85d91e2b16a 100644 --- a/resource-manager/azurestackhci/2023-03-01/arcsettings/id_cluster.go +++ b/resource-manager/azurestackhci/2023-03-01/arcsettings/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/azurestackhci/2023-03-01/cluster/id_cluster.go b/resource-manager/azurestackhci/2023-03-01/cluster/id_cluster.go index 342c6072fb6..89c47c1adb5 100644 --- a/resource-manager/azurestackhci/2023-03-01/cluster/id_cluster.go +++ b/resource-manager/azurestackhci/2023-03-01/cluster/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/azurestackhci/2023-03-01/clusters/id_cluster.go b/resource-manager/azurestackhci/2023-03-01/clusters/id_cluster.go index 4b5d6ee8ea7..a552fc4d6d5 100644 --- a/resource-manager/azurestackhci/2023-03-01/clusters/id_cluster.go +++ b/resource-manager/azurestackhci/2023-03-01/clusters/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/azurestackhci/2023-03-01/extensions/id_arcsetting.go b/resource-manager/azurestackhci/2023-03-01/extensions/id_arcsetting.go index f37e348672d..517db4fbed7 100644 --- a/resource-manager/azurestackhci/2023-03-01/extensions/id_arcsetting.go +++ b/resource-manager/azurestackhci/2023-03-01/extensions/id_arcsetting.go @@ -38,23 +38,9 @@ func ParseArcSettingID(input string) (*ArcSettingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ArcSettingId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.ArcSettingName, ok = parsed.Parsed["arcSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "arcSettingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseArcSettingIDInsensitively(input string) (*ArcSettingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ArcSettingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ArcSettingId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.ArcSettingName, ok = parsed.Parsed["arcSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "arcSettingName", *parsed) + if id.ArcSettingName, ok = input.Parsed["arcSettingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "arcSettingName", input) } - return &id, nil + return nil } // ValidateArcSettingID checks that 'input' can be parsed as a Arc Setting ID diff --git a/resource-manager/azurestackhci/2023-03-01/extensions/id_extension.go b/resource-manager/azurestackhci/2023-03-01/extensions/id_extension.go index d1760de7bfd..4a325da9fd9 100644 --- a/resource-manager/azurestackhci/2023-03-01/extensions/id_extension.go +++ b/resource-manager/azurestackhci/2023-03-01/extensions/id_extension.go @@ -40,27 +40,9 @@ func ParseExtensionID(input string) (*ExtensionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExtensionId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.ArcSettingName, ok = parsed.Parsed["arcSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "arcSettingName", *parsed) - } - - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseExtensionIDInsensitively(input string) (*ExtensionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExtensionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ExtensionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.ArcSettingName, ok = parsed.Parsed["arcSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "arcSettingName", *parsed) + if id.ArcSettingName, ok = input.Parsed["arcSettingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "arcSettingName", input) } - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if id.ExtensionName, ok = input.Parsed["extensionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "extensionName", input) } - return &id, nil + return nil } // ValidateExtensionID checks that 'input' can be parsed as a Extension ID diff --git a/resource-manager/azurestackhci/2023-03-01/offers/id_cluster.go b/resource-manager/azurestackhci/2023-03-01/offers/id_cluster.go index 2e541110031..a13927d7be2 100644 --- a/resource-manager/azurestackhci/2023-03-01/offers/id_cluster.go +++ b/resource-manager/azurestackhci/2023-03-01/offers/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/azurestackhci/2023-03-01/offers/id_offer.go b/resource-manager/azurestackhci/2023-03-01/offers/id_offer.go index 0042e2bdbc7..676f856d72c 100644 --- a/resource-manager/azurestackhci/2023-03-01/offers/id_offer.go +++ b/resource-manager/azurestackhci/2023-03-01/offers/id_offer.go @@ -40,27 +40,9 @@ func ParseOfferID(input string) (*OfferId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OfferId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) - } - - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseOfferIDInsensitively(input string) (*OfferId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OfferId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *OfferId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) + if id.OfferName, ok = input.Parsed["offerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerName", input) } - return &id, nil + return nil } // ValidateOfferID checks that 'input' can be parsed as a Offer ID diff --git a/resource-manager/azurestackhci/2023-03-01/offers/id_publisher.go b/resource-manager/azurestackhci/2023-03-01/offers/id_publisher.go index 38ccfe70693..18e5f87ecc0 100644 --- a/resource-manager/azurestackhci/2023-03-01/offers/id_publisher.go +++ b/resource-manager/azurestackhci/2023-03-01/offers/id_publisher.go @@ -38,23 +38,9 @@ func ParsePublisherID(input string) (*PublisherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PublisherId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePublisherIDInsensitively(input string) (*PublisherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PublisherId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PublisherId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - return &id, nil + return nil } // ValidatePublisherID checks that 'input' can be parsed as a Publisher ID diff --git a/resource-manager/azurestackhci/2023-03-01/publishers/id_cluster.go b/resource-manager/azurestackhci/2023-03-01/publishers/id_cluster.go index 118e2ff0de3..300868710e9 100644 --- a/resource-manager/azurestackhci/2023-03-01/publishers/id_cluster.go +++ b/resource-manager/azurestackhci/2023-03-01/publishers/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/azurestackhci/2023-03-01/publishers/id_publisher.go b/resource-manager/azurestackhci/2023-03-01/publishers/id_publisher.go index 78e9c1c4de1..41ece713a9b 100644 --- a/resource-manager/azurestackhci/2023-03-01/publishers/id_publisher.go +++ b/resource-manager/azurestackhci/2023-03-01/publishers/id_publisher.go @@ -38,23 +38,9 @@ func ParsePublisherID(input string) (*PublisherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PublisherId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePublisherIDInsensitively(input string) (*PublisherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PublisherId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PublisherId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - return &id, nil + return nil } // ValidatePublisherID checks that 'input' can be parsed as a Publisher ID diff --git a/resource-manager/azurestackhci/2023-03-01/skuses/id_offer.go b/resource-manager/azurestackhci/2023-03-01/skuses/id_offer.go index a58695f2bde..4c0a40c1ef7 100644 --- a/resource-manager/azurestackhci/2023-03-01/skuses/id_offer.go +++ b/resource-manager/azurestackhci/2023-03-01/skuses/id_offer.go @@ -40,27 +40,9 @@ func ParseOfferID(input string) (*OfferId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OfferId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) - } - - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseOfferIDInsensitively(input string) (*OfferId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OfferId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *OfferId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) + if id.OfferName, ok = input.Parsed["offerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerName", input) } - return &id, nil + return nil } // ValidateOfferID checks that 'input' can be parsed as a Offer ID diff --git a/resource-manager/azurestackhci/2023-03-01/skuses/id_sku.go b/resource-manager/azurestackhci/2023-03-01/skuses/id_sku.go index ac7c69edbb6..e3d1107f311 100644 --- a/resource-manager/azurestackhci/2023-03-01/skuses/id_sku.go +++ b/resource-manager/azurestackhci/2023-03-01/skuses/id_sku.go @@ -42,31 +42,9 @@ func ParseSkuID(input string) (*SkuId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SkuId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) - } - - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) - } - - if id.SkuName, ok = parsed.Parsed["skuName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "skuName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseSkuIDInsensitively(input string) (*SkuId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SkuId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SkuId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) + if id.OfferName, ok = input.Parsed["offerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerName", input) } - if id.SkuName, ok = parsed.Parsed["skuName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "skuName", *parsed) + if id.SkuName, ok = input.Parsed["skuName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "skuName", input) } - return &id, nil + return nil } // ValidateSkuID checks that 'input' can be parsed as a Sku ID diff --git a/resource-manager/azurestackhci/2023-03-01/updateruns/id_update.go b/resource-manager/azurestackhci/2023-03-01/updateruns/id_update.go index 3d261720d54..d095a318f13 100644 --- a/resource-manager/azurestackhci/2023-03-01/updateruns/id_update.go +++ b/resource-manager/azurestackhci/2023-03-01/updateruns/id_update.go @@ -38,23 +38,9 @@ func ParseUpdateID(input string) (*UpdateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UpdateId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.UpdateName, ok = parsed.Parsed["updateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "updateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseUpdateIDInsensitively(input string) (*UpdateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UpdateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UpdateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.UpdateName, ok = parsed.Parsed["updateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "updateName", *parsed) + if id.UpdateName, ok = input.Parsed["updateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "updateName", input) } - return &id, nil + return nil } // ValidateUpdateID checks that 'input' can be parsed as a Update ID diff --git a/resource-manager/azurestackhci/2023-03-01/updateruns/id_updaterun.go b/resource-manager/azurestackhci/2023-03-01/updateruns/id_updaterun.go index 6bfbc2436d3..5404c3aca80 100644 --- a/resource-manager/azurestackhci/2023-03-01/updateruns/id_updaterun.go +++ b/resource-manager/azurestackhci/2023-03-01/updateruns/id_updaterun.go @@ -40,27 +40,9 @@ func ParseUpdateRunID(input string) (*UpdateRunId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UpdateRunId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.UpdateName, ok = parsed.Parsed["updateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "updateName", *parsed) - } - - if id.UpdateRunName, ok = parsed.Parsed["updateRunName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "updateRunName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseUpdateRunIDInsensitively(input string) (*UpdateRunId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UpdateRunId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *UpdateRunId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.UpdateName, ok = parsed.Parsed["updateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "updateName", *parsed) + if id.UpdateName, ok = input.Parsed["updateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "updateName", input) } - if id.UpdateRunName, ok = parsed.Parsed["updateRunName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "updateRunName", *parsed) + if id.UpdateRunName, ok = input.Parsed["updateRunName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "updateRunName", input) } - return &id, nil + return nil } // ValidateUpdateRunID checks that 'input' can be parsed as a Update Run ID diff --git a/resource-manager/azurestackhci/2023-03-01/updates/id_cluster.go b/resource-manager/azurestackhci/2023-03-01/updates/id_cluster.go index 19104ecfcfd..5d5c57c157d 100644 --- a/resource-manager/azurestackhci/2023-03-01/updates/id_cluster.go +++ b/resource-manager/azurestackhci/2023-03-01/updates/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/azurestackhci/2023-03-01/updates/id_update.go b/resource-manager/azurestackhci/2023-03-01/updates/id_update.go index 3ed1403336c..f3a5a20a8fb 100644 --- a/resource-manager/azurestackhci/2023-03-01/updates/id_update.go +++ b/resource-manager/azurestackhci/2023-03-01/updates/id_update.go @@ -38,23 +38,9 @@ func ParseUpdateID(input string) (*UpdateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UpdateId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.UpdateName, ok = parsed.Parsed["updateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "updateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseUpdateIDInsensitively(input string) (*UpdateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UpdateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UpdateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.UpdateName, ok = parsed.Parsed["updateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "updateName", *parsed) + if id.UpdateName, ok = input.Parsed["updateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "updateName", input) } - return &id, nil + return nil } // ValidateUpdateID checks that 'input' can be parsed as a Update ID diff --git a/resource-manager/azurestackhci/2023-03-01/updatesummaries/id_cluster.go b/resource-manager/azurestackhci/2023-03-01/updatesummaries/id_cluster.go index b651c33a67f..8cf6fe94e8d 100644 --- a/resource-manager/azurestackhci/2023-03-01/updatesummaries/id_cluster.go +++ b/resource-manager/azurestackhci/2023-03-01/updatesummaries/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/azurestackhci/2023-06-01/arcsettings/id_arcsetting.go b/resource-manager/azurestackhci/2023-06-01/arcsettings/id_arcsetting.go index f126af6e3ff..b9efbac67ed 100644 --- a/resource-manager/azurestackhci/2023-06-01/arcsettings/id_arcsetting.go +++ b/resource-manager/azurestackhci/2023-06-01/arcsettings/id_arcsetting.go @@ -38,23 +38,9 @@ func ParseArcSettingID(input string) (*ArcSettingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ArcSettingId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.ArcSettingName, ok = parsed.Parsed["arcSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "arcSettingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseArcSettingIDInsensitively(input string) (*ArcSettingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ArcSettingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ArcSettingId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.ArcSettingName, ok = parsed.Parsed["arcSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "arcSettingName", *parsed) + if id.ArcSettingName, ok = input.Parsed["arcSettingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "arcSettingName", input) } - return &id, nil + return nil } // ValidateArcSettingID checks that 'input' can be parsed as a Arc Setting ID diff --git a/resource-manager/azurestackhci/2023-06-01/arcsettings/id_cluster.go b/resource-manager/azurestackhci/2023-06-01/arcsettings/id_cluster.go index 2c50f526410..85d91e2b16a 100644 --- a/resource-manager/azurestackhci/2023-06-01/arcsettings/id_cluster.go +++ b/resource-manager/azurestackhci/2023-06-01/arcsettings/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/azurestackhci/2023-06-01/cluster/id_cluster.go b/resource-manager/azurestackhci/2023-06-01/cluster/id_cluster.go index 342c6072fb6..89c47c1adb5 100644 --- a/resource-manager/azurestackhci/2023-06-01/cluster/id_cluster.go +++ b/resource-manager/azurestackhci/2023-06-01/cluster/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/azurestackhci/2023-06-01/clusters/id_cluster.go b/resource-manager/azurestackhci/2023-06-01/clusters/id_cluster.go index 4b5d6ee8ea7..a552fc4d6d5 100644 --- a/resource-manager/azurestackhci/2023-06-01/clusters/id_cluster.go +++ b/resource-manager/azurestackhci/2023-06-01/clusters/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/azurestackhci/2023-06-01/extensions/id_arcsetting.go b/resource-manager/azurestackhci/2023-06-01/extensions/id_arcsetting.go index f37e348672d..517db4fbed7 100644 --- a/resource-manager/azurestackhci/2023-06-01/extensions/id_arcsetting.go +++ b/resource-manager/azurestackhci/2023-06-01/extensions/id_arcsetting.go @@ -38,23 +38,9 @@ func ParseArcSettingID(input string) (*ArcSettingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ArcSettingId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.ArcSettingName, ok = parsed.Parsed["arcSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "arcSettingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseArcSettingIDInsensitively(input string) (*ArcSettingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ArcSettingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ArcSettingId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.ArcSettingName, ok = parsed.Parsed["arcSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "arcSettingName", *parsed) + if id.ArcSettingName, ok = input.Parsed["arcSettingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "arcSettingName", input) } - return &id, nil + return nil } // ValidateArcSettingID checks that 'input' can be parsed as a Arc Setting ID diff --git a/resource-manager/azurestackhci/2023-06-01/extensions/id_extension.go b/resource-manager/azurestackhci/2023-06-01/extensions/id_extension.go index d1760de7bfd..4a325da9fd9 100644 --- a/resource-manager/azurestackhci/2023-06-01/extensions/id_extension.go +++ b/resource-manager/azurestackhci/2023-06-01/extensions/id_extension.go @@ -40,27 +40,9 @@ func ParseExtensionID(input string) (*ExtensionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExtensionId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.ArcSettingName, ok = parsed.Parsed["arcSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "arcSettingName", *parsed) - } - - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseExtensionIDInsensitively(input string) (*ExtensionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExtensionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ExtensionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.ArcSettingName, ok = parsed.Parsed["arcSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "arcSettingName", *parsed) + if id.ArcSettingName, ok = input.Parsed["arcSettingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "arcSettingName", input) } - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if id.ExtensionName, ok = input.Parsed["extensionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "extensionName", input) } - return &id, nil + return nil } // ValidateExtensionID checks that 'input' can be parsed as a Extension ID diff --git a/resource-manager/azurestackhci/2023-06-01/offers/id_cluster.go b/resource-manager/azurestackhci/2023-06-01/offers/id_cluster.go index 2e541110031..a13927d7be2 100644 --- a/resource-manager/azurestackhci/2023-06-01/offers/id_cluster.go +++ b/resource-manager/azurestackhci/2023-06-01/offers/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/azurestackhci/2023-06-01/offers/id_offer.go b/resource-manager/azurestackhci/2023-06-01/offers/id_offer.go index 0042e2bdbc7..676f856d72c 100644 --- a/resource-manager/azurestackhci/2023-06-01/offers/id_offer.go +++ b/resource-manager/azurestackhci/2023-06-01/offers/id_offer.go @@ -40,27 +40,9 @@ func ParseOfferID(input string) (*OfferId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OfferId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) - } - - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseOfferIDInsensitively(input string) (*OfferId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OfferId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *OfferId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) + if id.OfferName, ok = input.Parsed["offerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerName", input) } - return &id, nil + return nil } // ValidateOfferID checks that 'input' can be parsed as a Offer ID diff --git a/resource-manager/azurestackhci/2023-06-01/offers/id_publisher.go b/resource-manager/azurestackhci/2023-06-01/offers/id_publisher.go index 38ccfe70693..18e5f87ecc0 100644 --- a/resource-manager/azurestackhci/2023-06-01/offers/id_publisher.go +++ b/resource-manager/azurestackhci/2023-06-01/offers/id_publisher.go @@ -38,23 +38,9 @@ func ParsePublisherID(input string) (*PublisherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PublisherId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePublisherIDInsensitively(input string) (*PublisherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PublisherId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PublisherId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - return &id, nil + return nil } // ValidatePublisherID checks that 'input' can be parsed as a Publisher ID diff --git a/resource-manager/azurestackhci/2023-06-01/publishers/id_cluster.go b/resource-manager/azurestackhci/2023-06-01/publishers/id_cluster.go index 118e2ff0de3..300868710e9 100644 --- a/resource-manager/azurestackhci/2023-06-01/publishers/id_cluster.go +++ b/resource-manager/azurestackhci/2023-06-01/publishers/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/azurestackhci/2023-06-01/publishers/id_publisher.go b/resource-manager/azurestackhci/2023-06-01/publishers/id_publisher.go index 78e9c1c4de1..41ece713a9b 100644 --- a/resource-manager/azurestackhci/2023-06-01/publishers/id_publisher.go +++ b/resource-manager/azurestackhci/2023-06-01/publishers/id_publisher.go @@ -38,23 +38,9 @@ func ParsePublisherID(input string) (*PublisherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PublisherId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePublisherIDInsensitively(input string) (*PublisherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PublisherId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PublisherId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - return &id, nil + return nil } // ValidatePublisherID checks that 'input' can be parsed as a Publisher ID diff --git a/resource-manager/azurestackhci/2023-06-01/skuses/id_offer.go b/resource-manager/azurestackhci/2023-06-01/skuses/id_offer.go index a58695f2bde..4c0a40c1ef7 100644 --- a/resource-manager/azurestackhci/2023-06-01/skuses/id_offer.go +++ b/resource-manager/azurestackhci/2023-06-01/skuses/id_offer.go @@ -40,27 +40,9 @@ func ParseOfferID(input string) (*OfferId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OfferId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) - } - - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseOfferIDInsensitively(input string) (*OfferId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OfferId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *OfferId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) + if id.OfferName, ok = input.Parsed["offerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerName", input) } - return &id, nil + return nil } // ValidateOfferID checks that 'input' can be parsed as a Offer ID diff --git a/resource-manager/azurestackhci/2023-06-01/skuses/id_sku.go b/resource-manager/azurestackhci/2023-06-01/skuses/id_sku.go index ac7c69edbb6..e3d1107f311 100644 --- a/resource-manager/azurestackhci/2023-06-01/skuses/id_sku.go +++ b/resource-manager/azurestackhci/2023-06-01/skuses/id_sku.go @@ -42,31 +42,9 @@ func ParseSkuID(input string) (*SkuId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SkuId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) - } - - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) - } - - if id.SkuName, ok = parsed.Parsed["skuName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "skuName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseSkuIDInsensitively(input string) (*SkuId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SkuId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SkuId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) + if id.OfferName, ok = input.Parsed["offerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerName", input) } - if id.SkuName, ok = parsed.Parsed["skuName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "skuName", *parsed) + if id.SkuName, ok = input.Parsed["skuName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "skuName", input) } - return &id, nil + return nil } // ValidateSkuID checks that 'input' can be parsed as a Sku ID diff --git a/resource-manager/azurestackhci/2023-06-01/updateruns/id_update.go b/resource-manager/azurestackhci/2023-06-01/updateruns/id_update.go index 3d261720d54..d095a318f13 100644 --- a/resource-manager/azurestackhci/2023-06-01/updateruns/id_update.go +++ b/resource-manager/azurestackhci/2023-06-01/updateruns/id_update.go @@ -38,23 +38,9 @@ func ParseUpdateID(input string) (*UpdateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UpdateId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.UpdateName, ok = parsed.Parsed["updateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "updateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseUpdateIDInsensitively(input string) (*UpdateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UpdateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UpdateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.UpdateName, ok = parsed.Parsed["updateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "updateName", *parsed) + if id.UpdateName, ok = input.Parsed["updateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "updateName", input) } - return &id, nil + return nil } // ValidateUpdateID checks that 'input' can be parsed as a Update ID diff --git a/resource-manager/azurestackhci/2023-06-01/updateruns/id_updaterun.go b/resource-manager/azurestackhci/2023-06-01/updateruns/id_updaterun.go index 6bfbc2436d3..5404c3aca80 100644 --- a/resource-manager/azurestackhci/2023-06-01/updateruns/id_updaterun.go +++ b/resource-manager/azurestackhci/2023-06-01/updateruns/id_updaterun.go @@ -40,27 +40,9 @@ func ParseUpdateRunID(input string) (*UpdateRunId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UpdateRunId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.UpdateName, ok = parsed.Parsed["updateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "updateName", *parsed) - } - - if id.UpdateRunName, ok = parsed.Parsed["updateRunName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "updateRunName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseUpdateRunIDInsensitively(input string) (*UpdateRunId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UpdateRunId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *UpdateRunId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.UpdateName, ok = parsed.Parsed["updateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "updateName", *parsed) + if id.UpdateName, ok = input.Parsed["updateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "updateName", input) } - if id.UpdateRunName, ok = parsed.Parsed["updateRunName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "updateRunName", *parsed) + if id.UpdateRunName, ok = input.Parsed["updateRunName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "updateRunName", input) } - return &id, nil + return nil } // ValidateUpdateRunID checks that 'input' can be parsed as a Update Run ID diff --git a/resource-manager/azurestackhci/2023-06-01/updates/id_cluster.go b/resource-manager/azurestackhci/2023-06-01/updates/id_cluster.go index 19104ecfcfd..5d5c57c157d 100644 --- a/resource-manager/azurestackhci/2023-06-01/updates/id_cluster.go +++ b/resource-manager/azurestackhci/2023-06-01/updates/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/azurestackhci/2023-06-01/updates/id_update.go b/resource-manager/azurestackhci/2023-06-01/updates/id_update.go index 3ed1403336c..f3a5a20a8fb 100644 --- a/resource-manager/azurestackhci/2023-06-01/updates/id_update.go +++ b/resource-manager/azurestackhci/2023-06-01/updates/id_update.go @@ -38,23 +38,9 @@ func ParseUpdateID(input string) (*UpdateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UpdateId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.UpdateName, ok = parsed.Parsed["updateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "updateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseUpdateIDInsensitively(input string) (*UpdateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UpdateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UpdateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.UpdateName, ok = parsed.Parsed["updateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "updateName", *parsed) + if id.UpdateName, ok = input.Parsed["updateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "updateName", input) } - return &id, nil + return nil } // ValidateUpdateID checks that 'input' can be parsed as a Update ID diff --git a/resource-manager/azurestackhci/2023-06-01/updatesummaries/id_cluster.go b/resource-manager/azurestackhci/2023-06-01/updatesummaries/id_cluster.go index b651c33a67f..8cf6fe94e8d 100644 --- a/resource-manager/azurestackhci/2023-06-01/updatesummaries/id_cluster.go +++ b/resource-manager/azurestackhci/2023-06-01/updatesummaries/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/azurestackhci/2023-08-01/arcsettings/id_arcsetting.go b/resource-manager/azurestackhci/2023-08-01/arcsettings/id_arcsetting.go index f126af6e3ff..b9efbac67ed 100644 --- a/resource-manager/azurestackhci/2023-08-01/arcsettings/id_arcsetting.go +++ b/resource-manager/azurestackhci/2023-08-01/arcsettings/id_arcsetting.go @@ -38,23 +38,9 @@ func ParseArcSettingID(input string) (*ArcSettingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ArcSettingId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.ArcSettingName, ok = parsed.Parsed["arcSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "arcSettingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseArcSettingIDInsensitively(input string) (*ArcSettingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ArcSettingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ArcSettingId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.ArcSettingName, ok = parsed.Parsed["arcSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "arcSettingName", *parsed) + if id.ArcSettingName, ok = input.Parsed["arcSettingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "arcSettingName", input) } - return &id, nil + return nil } // ValidateArcSettingID checks that 'input' can be parsed as a Arc Setting ID diff --git a/resource-manager/azurestackhci/2023-08-01/arcsettings/id_cluster.go b/resource-manager/azurestackhci/2023-08-01/arcsettings/id_cluster.go index 2c50f526410..85d91e2b16a 100644 --- a/resource-manager/azurestackhci/2023-08-01/arcsettings/id_cluster.go +++ b/resource-manager/azurestackhci/2023-08-01/arcsettings/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/azurestackhci/2023-08-01/cluster/id_cluster.go b/resource-manager/azurestackhci/2023-08-01/cluster/id_cluster.go index 342c6072fb6..89c47c1adb5 100644 --- a/resource-manager/azurestackhci/2023-08-01/cluster/id_cluster.go +++ b/resource-manager/azurestackhci/2023-08-01/cluster/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/azurestackhci/2023-08-01/clusters/id_cluster.go b/resource-manager/azurestackhci/2023-08-01/clusters/id_cluster.go index 4b5d6ee8ea7..a552fc4d6d5 100644 --- a/resource-manager/azurestackhci/2023-08-01/clusters/id_cluster.go +++ b/resource-manager/azurestackhci/2023-08-01/clusters/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/azurestackhci/2023-08-01/extensions/id_arcsetting.go b/resource-manager/azurestackhci/2023-08-01/extensions/id_arcsetting.go index f37e348672d..517db4fbed7 100644 --- a/resource-manager/azurestackhci/2023-08-01/extensions/id_arcsetting.go +++ b/resource-manager/azurestackhci/2023-08-01/extensions/id_arcsetting.go @@ -38,23 +38,9 @@ func ParseArcSettingID(input string) (*ArcSettingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ArcSettingId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.ArcSettingName, ok = parsed.Parsed["arcSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "arcSettingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseArcSettingIDInsensitively(input string) (*ArcSettingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ArcSettingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ArcSettingId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.ArcSettingName, ok = parsed.Parsed["arcSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "arcSettingName", *parsed) + if id.ArcSettingName, ok = input.Parsed["arcSettingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "arcSettingName", input) } - return &id, nil + return nil } // ValidateArcSettingID checks that 'input' can be parsed as a Arc Setting ID diff --git a/resource-manager/azurestackhci/2023-08-01/extensions/id_extension.go b/resource-manager/azurestackhci/2023-08-01/extensions/id_extension.go index d1760de7bfd..4a325da9fd9 100644 --- a/resource-manager/azurestackhci/2023-08-01/extensions/id_extension.go +++ b/resource-manager/azurestackhci/2023-08-01/extensions/id_extension.go @@ -40,27 +40,9 @@ func ParseExtensionID(input string) (*ExtensionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExtensionId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.ArcSettingName, ok = parsed.Parsed["arcSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "arcSettingName", *parsed) - } - - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseExtensionIDInsensitively(input string) (*ExtensionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExtensionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ExtensionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.ArcSettingName, ok = parsed.Parsed["arcSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "arcSettingName", *parsed) + if id.ArcSettingName, ok = input.Parsed["arcSettingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "arcSettingName", input) } - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if id.ExtensionName, ok = input.Parsed["extensionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "extensionName", input) } - return &id, nil + return nil } // ValidateExtensionID checks that 'input' can be parsed as a Extension ID diff --git a/resource-manager/azurestackhci/2023-08-01/offers/id_cluster.go b/resource-manager/azurestackhci/2023-08-01/offers/id_cluster.go index 2e541110031..a13927d7be2 100644 --- a/resource-manager/azurestackhci/2023-08-01/offers/id_cluster.go +++ b/resource-manager/azurestackhci/2023-08-01/offers/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/azurestackhci/2023-08-01/offers/id_offer.go b/resource-manager/azurestackhci/2023-08-01/offers/id_offer.go index 0042e2bdbc7..676f856d72c 100644 --- a/resource-manager/azurestackhci/2023-08-01/offers/id_offer.go +++ b/resource-manager/azurestackhci/2023-08-01/offers/id_offer.go @@ -40,27 +40,9 @@ func ParseOfferID(input string) (*OfferId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OfferId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) - } - - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseOfferIDInsensitively(input string) (*OfferId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OfferId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *OfferId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) + if id.OfferName, ok = input.Parsed["offerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerName", input) } - return &id, nil + return nil } // ValidateOfferID checks that 'input' can be parsed as a Offer ID diff --git a/resource-manager/azurestackhci/2023-08-01/offers/id_publisher.go b/resource-manager/azurestackhci/2023-08-01/offers/id_publisher.go index 38ccfe70693..18e5f87ecc0 100644 --- a/resource-manager/azurestackhci/2023-08-01/offers/id_publisher.go +++ b/resource-manager/azurestackhci/2023-08-01/offers/id_publisher.go @@ -38,23 +38,9 @@ func ParsePublisherID(input string) (*PublisherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PublisherId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePublisherIDInsensitively(input string) (*PublisherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PublisherId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PublisherId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - return &id, nil + return nil } // ValidatePublisherID checks that 'input' can be parsed as a Publisher ID diff --git a/resource-manager/azurestackhci/2023-08-01/publishers/id_cluster.go b/resource-manager/azurestackhci/2023-08-01/publishers/id_cluster.go index 118e2ff0de3..300868710e9 100644 --- a/resource-manager/azurestackhci/2023-08-01/publishers/id_cluster.go +++ b/resource-manager/azurestackhci/2023-08-01/publishers/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/azurestackhci/2023-08-01/publishers/id_publisher.go b/resource-manager/azurestackhci/2023-08-01/publishers/id_publisher.go index 78e9c1c4de1..41ece713a9b 100644 --- a/resource-manager/azurestackhci/2023-08-01/publishers/id_publisher.go +++ b/resource-manager/azurestackhci/2023-08-01/publishers/id_publisher.go @@ -38,23 +38,9 @@ func ParsePublisherID(input string) (*PublisherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PublisherId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePublisherIDInsensitively(input string) (*PublisherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PublisherId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PublisherId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - return &id, nil + return nil } // ValidatePublisherID checks that 'input' can be parsed as a Publisher ID diff --git a/resource-manager/azurestackhci/2023-08-01/skuses/id_offer.go b/resource-manager/azurestackhci/2023-08-01/skuses/id_offer.go index a58695f2bde..4c0a40c1ef7 100644 --- a/resource-manager/azurestackhci/2023-08-01/skuses/id_offer.go +++ b/resource-manager/azurestackhci/2023-08-01/skuses/id_offer.go @@ -40,27 +40,9 @@ func ParseOfferID(input string) (*OfferId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OfferId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) - } - - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseOfferIDInsensitively(input string) (*OfferId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OfferId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *OfferId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) + if id.OfferName, ok = input.Parsed["offerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerName", input) } - return &id, nil + return nil } // ValidateOfferID checks that 'input' can be parsed as a Offer ID diff --git a/resource-manager/azurestackhci/2023-08-01/skuses/id_sku.go b/resource-manager/azurestackhci/2023-08-01/skuses/id_sku.go index ac7c69edbb6..e3d1107f311 100644 --- a/resource-manager/azurestackhci/2023-08-01/skuses/id_sku.go +++ b/resource-manager/azurestackhci/2023-08-01/skuses/id_sku.go @@ -42,31 +42,9 @@ func ParseSkuID(input string) (*SkuId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SkuId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) - } - - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) - } - - if id.SkuName, ok = parsed.Parsed["skuName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "skuName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseSkuIDInsensitively(input string) (*SkuId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SkuId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SkuId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) + if id.OfferName, ok = input.Parsed["offerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerName", input) } - if id.SkuName, ok = parsed.Parsed["skuName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "skuName", *parsed) + if id.SkuName, ok = input.Parsed["skuName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "skuName", input) } - return &id, nil + return nil } // ValidateSkuID checks that 'input' can be parsed as a Sku ID diff --git a/resource-manager/azurestackhci/2023-08-01/updateruns/id_update.go b/resource-manager/azurestackhci/2023-08-01/updateruns/id_update.go index 3d261720d54..d095a318f13 100644 --- a/resource-manager/azurestackhci/2023-08-01/updateruns/id_update.go +++ b/resource-manager/azurestackhci/2023-08-01/updateruns/id_update.go @@ -38,23 +38,9 @@ func ParseUpdateID(input string) (*UpdateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UpdateId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.UpdateName, ok = parsed.Parsed["updateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "updateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseUpdateIDInsensitively(input string) (*UpdateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UpdateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UpdateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.UpdateName, ok = parsed.Parsed["updateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "updateName", *parsed) + if id.UpdateName, ok = input.Parsed["updateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "updateName", input) } - return &id, nil + return nil } // ValidateUpdateID checks that 'input' can be parsed as a Update ID diff --git a/resource-manager/azurestackhci/2023-08-01/updateruns/id_updaterun.go b/resource-manager/azurestackhci/2023-08-01/updateruns/id_updaterun.go index 6bfbc2436d3..5404c3aca80 100644 --- a/resource-manager/azurestackhci/2023-08-01/updateruns/id_updaterun.go +++ b/resource-manager/azurestackhci/2023-08-01/updateruns/id_updaterun.go @@ -40,27 +40,9 @@ func ParseUpdateRunID(input string) (*UpdateRunId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UpdateRunId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.UpdateName, ok = parsed.Parsed["updateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "updateName", *parsed) - } - - if id.UpdateRunName, ok = parsed.Parsed["updateRunName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "updateRunName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseUpdateRunIDInsensitively(input string) (*UpdateRunId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UpdateRunId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *UpdateRunId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.UpdateName, ok = parsed.Parsed["updateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "updateName", *parsed) + if id.UpdateName, ok = input.Parsed["updateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "updateName", input) } - if id.UpdateRunName, ok = parsed.Parsed["updateRunName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "updateRunName", *parsed) + if id.UpdateRunName, ok = input.Parsed["updateRunName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "updateRunName", input) } - return &id, nil + return nil } // ValidateUpdateRunID checks that 'input' can be parsed as a Update Run ID diff --git a/resource-manager/azurestackhci/2023-08-01/updates/id_cluster.go b/resource-manager/azurestackhci/2023-08-01/updates/id_cluster.go index 19104ecfcfd..5d5c57c157d 100644 --- a/resource-manager/azurestackhci/2023-08-01/updates/id_cluster.go +++ b/resource-manager/azurestackhci/2023-08-01/updates/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/azurestackhci/2023-08-01/updates/id_update.go b/resource-manager/azurestackhci/2023-08-01/updates/id_update.go index 3ed1403336c..f3a5a20a8fb 100644 --- a/resource-manager/azurestackhci/2023-08-01/updates/id_update.go +++ b/resource-manager/azurestackhci/2023-08-01/updates/id_update.go @@ -38,23 +38,9 @@ func ParseUpdateID(input string) (*UpdateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UpdateId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.UpdateName, ok = parsed.Parsed["updateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "updateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseUpdateIDInsensitively(input string) (*UpdateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UpdateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UpdateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.UpdateName, ok = parsed.Parsed["updateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "updateName", *parsed) + if id.UpdateName, ok = input.Parsed["updateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "updateName", input) } - return &id, nil + return nil } // ValidateUpdateID checks that 'input' can be parsed as a Update ID diff --git a/resource-manager/azurestackhci/2023-08-01/updatesummaries/id_cluster.go b/resource-manager/azurestackhci/2023-08-01/updatesummaries/id_cluster.go index b651c33a67f..8cf6fe94e8d 100644 --- a/resource-manager/azurestackhci/2023-08-01/updatesummaries/id_cluster.go +++ b/resource-manager/azurestackhci/2023-08-01/updatesummaries/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/batch/2023-05-01/application/id_application.go b/resource-manager/batch/2023-05-01/application/id_application.go index 4df2bc2fd40..5423db228ec 100644 --- a/resource-manager/batch/2023-05-01/application/id_application.go +++ b/resource-manager/batch/2023-05-01/application/id_application.go @@ -38,23 +38,9 @@ func ParseApplicationID(input string) (*ApplicationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationId{} - - 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.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchAccountName", *parsed) - } - - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApplicationIDInsensitively(input string) (*ApplicationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApplicationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchAccountName", *parsed) + if id.BatchAccountName, ok = input.Parsed["batchAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "batchAccountName", input) } - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) + if id.ApplicationName, ok = input.Parsed["applicationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationName", input) } - return &id, nil + return nil } // ValidateApplicationID checks that 'input' can be parsed as a Application ID diff --git a/resource-manager/batch/2023-05-01/application/id_batchaccount.go b/resource-manager/batch/2023-05-01/application/id_batchaccount.go index 9b487f42d5f..1dc31c99bd9 100644 --- a/resource-manager/batch/2023-05-01/application/id_batchaccount.go +++ b/resource-manager/batch/2023-05-01/application/id_batchaccount.go @@ -36,19 +36,9 @@ func ParseBatchAccountID(input string) (*BatchAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BatchAccountId{} - - 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.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseBatchAccountIDInsensitively(input string) (*BatchAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BatchAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *BatchAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchAccountName", *parsed) + if id.BatchAccountName, ok = input.Parsed["batchAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "batchAccountName", input) } - return &id, nil + return nil } // ValidateBatchAccountID checks that 'input' can be parsed as a Batch Account ID diff --git a/resource-manager/batch/2023-05-01/applicationpackage/id_application.go b/resource-manager/batch/2023-05-01/applicationpackage/id_application.go index a4f3e728de2..a46f6b245be 100644 --- a/resource-manager/batch/2023-05-01/applicationpackage/id_application.go +++ b/resource-manager/batch/2023-05-01/applicationpackage/id_application.go @@ -38,23 +38,9 @@ func ParseApplicationID(input string) (*ApplicationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationId{} - - 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.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchAccountName", *parsed) - } - - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApplicationIDInsensitively(input string) (*ApplicationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApplicationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchAccountName", *parsed) + if id.BatchAccountName, ok = input.Parsed["batchAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "batchAccountName", input) } - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) + if id.ApplicationName, ok = input.Parsed["applicationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationName", input) } - return &id, nil + return nil } // ValidateApplicationID checks that 'input' can be parsed as a Application ID diff --git a/resource-manager/batch/2023-05-01/applicationpackage/id_version.go b/resource-manager/batch/2023-05-01/applicationpackage/id_version.go index d254729d6be..774cc0e1ba4 100644 --- a/resource-manager/batch/2023-05-01/applicationpackage/id_version.go +++ b/resource-manager/batch/2023-05-01/applicationpackage/id_version.go @@ -40,27 +40,9 @@ func ParseVersionID(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} - - 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.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchAccountName", *parsed) - } - - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVersionIDInsensitively(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchAccountName", *parsed) + if id.BatchAccountName, ok = input.Parsed["batchAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "batchAccountName", input) } - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) + if id.ApplicationName, ok = input.Parsed["applicationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateVersionID checks that 'input' can be parsed as a Version ID diff --git a/resource-manager/batch/2023-05-01/batchaccount/id_batchaccount.go b/resource-manager/batch/2023-05-01/batchaccount/id_batchaccount.go index 59d4160a459..a535db3cf59 100644 --- a/resource-manager/batch/2023-05-01/batchaccount/id_batchaccount.go +++ b/resource-manager/batch/2023-05-01/batchaccount/id_batchaccount.go @@ -36,19 +36,9 @@ func ParseBatchAccountID(input string) (*BatchAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BatchAccountId{} - - 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.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseBatchAccountIDInsensitively(input string) (*BatchAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BatchAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *BatchAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchAccountName", *parsed) + if id.BatchAccountName, ok = input.Parsed["batchAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "batchAccountName", input) } - return &id, nil + return nil } // ValidateBatchAccountID checks that 'input' can be parsed as a Batch Account ID diff --git a/resource-manager/batch/2023-05-01/batchmanagements/id_batchaccount.go b/resource-manager/batch/2023-05-01/batchmanagements/id_batchaccount.go index 69c7c46ffcc..2db185013bf 100644 --- a/resource-manager/batch/2023-05-01/batchmanagements/id_batchaccount.go +++ b/resource-manager/batch/2023-05-01/batchmanagements/id_batchaccount.go @@ -36,19 +36,9 @@ func ParseBatchAccountID(input string) (*BatchAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BatchAccountId{} - - 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.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseBatchAccountIDInsensitively(input string) (*BatchAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BatchAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *BatchAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchAccountName", *parsed) + if id.BatchAccountName, ok = input.Parsed["batchAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "batchAccountName", input) } - return &id, nil + return nil } // ValidateBatchAccountID checks that 'input' can be parsed as a Batch Account ID diff --git a/resource-manager/batch/2023-05-01/batchmanagements/id_detector.go b/resource-manager/batch/2023-05-01/batchmanagements/id_detector.go index 260f3e0e681..6b59520a12b 100644 --- a/resource-manager/batch/2023-05-01/batchmanagements/id_detector.go +++ b/resource-manager/batch/2023-05-01/batchmanagements/id_detector.go @@ -38,23 +38,9 @@ func ParseDetectorID(input string) (*DetectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DetectorId{} - - 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.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchAccountName", *parsed) - } - - if id.DetectorId, ok = parsed.Parsed["detectorId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "detectorId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDetectorIDInsensitively(input string) (*DetectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DetectorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DetectorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchAccountName", *parsed) + if id.BatchAccountName, ok = input.Parsed["batchAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "batchAccountName", input) } - if id.DetectorId, ok = parsed.Parsed["detectorId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "detectorId", *parsed) + if id.DetectorId, ok = input.Parsed["detectorId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "detectorId", input) } - return &id, nil + return nil } // ValidateDetectorID checks that 'input' can be parsed as a Detector ID diff --git a/resource-manager/batch/2023-05-01/batchmanagements/id_location.go b/resource-manager/batch/2023-05-01/batchmanagements/id_location.go index 3fc4829f223..d3883e18a83 100644 --- a/resource-manager/batch/2023-05-01/batchmanagements/id_location.go +++ b/resource-manager/batch/2023-05-01/batchmanagements/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/batch/2023-05-01/certificate/id_batchaccount.go b/resource-manager/batch/2023-05-01/certificate/id_batchaccount.go index b86f8fcd161..c61d83f1e91 100644 --- a/resource-manager/batch/2023-05-01/certificate/id_batchaccount.go +++ b/resource-manager/batch/2023-05-01/certificate/id_batchaccount.go @@ -36,19 +36,9 @@ func ParseBatchAccountID(input string) (*BatchAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BatchAccountId{} - - 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.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseBatchAccountIDInsensitively(input string) (*BatchAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BatchAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *BatchAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchAccountName", *parsed) + if id.BatchAccountName, ok = input.Parsed["batchAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "batchAccountName", input) } - return &id, nil + return nil } // ValidateBatchAccountID checks that 'input' can be parsed as a Batch Account ID diff --git a/resource-manager/batch/2023-05-01/certificate/id_certificate.go b/resource-manager/batch/2023-05-01/certificate/id_certificate.go index 8953ef5ffae..51f6ac813f2 100644 --- a/resource-manager/batch/2023-05-01/certificate/id_certificate.go +++ b/resource-manager/batch/2023-05-01/certificate/id_certificate.go @@ -38,23 +38,9 @@ func ParseCertificateID(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} - - 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.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchAccountName", *parsed) - } - - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCertificateIDInsensitively(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchAccountName", *parsed) + if id.BatchAccountName, ok = input.Parsed["batchAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "batchAccountName", input) } - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if id.CertificateName, ok = input.Parsed["certificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateName", input) } - return &id, nil + return nil } // ValidateCertificateID checks that 'input' can be parsed as a Certificate ID diff --git a/resource-manager/batch/2023-05-01/location/id_location.go b/resource-manager/batch/2023-05-01/location/id_location.go index 74c042a0635..b17f5478308 100644 --- a/resource-manager/batch/2023-05-01/location/id_location.go +++ b/resource-manager/batch/2023-05-01/location/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/batch/2023-05-01/pool/id_batchaccount.go b/resource-manager/batch/2023-05-01/pool/id_batchaccount.go index 63b4a9fc1b5..2e306c3bf50 100644 --- a/resource-manager/batch/2023-05-01/pool/id_batchaccount.go +++ b/resource-manager/batch/2023-05-01/pool/id_batchaccount.go @@ -36,19 +36,9 @@ func ParseBatchAccountID(input string) (*BatchAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BatchAccountId{} - - 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.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseBatchAccountIDInsensitively(input string) (*BatchAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BatchAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *BatchAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchAccountName", *parsed) + if id.BatchAccountName, ok = input.Parsed["batchAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "batchAccountName", input) } - return &id, nil + return nil } // ValidateBatchAccountID checks that 'input' can be parsed as a Batch Account ID diff --git a/resource-manager/batch/2023-05-01/pool/id_pool.go b/resource-manager/batch/2023-05-01/pool/id_pool.go index 95c4ec6031b..3f2c4f53123 100644 --- a/resource-manager/batch/2023-05-01/pool/id_pool.go +++ b/resource-manager/batch/2023-05-01/pool/id_pool.go @@ -38,23 +38,9 @@ func ParsePoolID(input string) (*PoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PoolId{} - - 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.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchAccountName", *parsed) - } - - if id.PoolName, ok = parsed.Parsed["poolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "poolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePoolIDInsensitively(input string) (*PoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PoolId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchAccountName", *parsed) + if id.BatchAccountName, ok = input.Parsed["batchAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "batchAccountName", input) } - if id.PoolName, ok = parsed.Parsed["poolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "poolName", *parsed) + if id.PoolName, ok = input.Parsed["poolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "poolName", input) } - return &id, nil + return nil } // ValidatePoolID checks that 'input' can be parsed as a Pool ID diff --git a/resource-manager/batch/2023-05-01/privateendpointconnection/id_batchaccount.go b/resource-manager/batch/2023-05-01/privateendpointconnection/id_batchaccount.go index abd854e0e4c..ab7c17b8462 100644 --- a/resource-manager/batch/2023-05-01/privateendpointconnection/id_batchaccount.go +++ b/resource-manager/batch/2023-05-01/privateendpointconnection/id_batchaccount.go @@ -36,19 +36,9 @@ func ParseBatchAccountID(input string) (*BatchAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BatchAccountId{} - - 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.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseBatchAccountIDInsensitively(input string) (*BatchAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BatchAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *BatchAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchAccountName", *parsed) + if id.BatchAccountName, ok = input.Parsed["batchAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "batchAccountName", input) } - return &id, nil + return nil } // ValidateBatchAccountID checks that 'input' can be parsed as a Batch Account ID diff --git a/resource-manager/batch/2023-05-01/privateendpointconnection/id_privateendpointconnection.go b/resource-manager/batch/2023-05-01/privateendpointconnection/id_privateendpointconnection.go index b240dae2eb8..3b14f4c52dc 100644 --- a/resource-manager/batch/2023-05-01/privateendpointconnection/id_privateendpointconnection.go +++ b/resource-manager/batch/2023-05-01/privateendpointconnection/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchAccountName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchAccountName", *parsed) + if id.BatchAccountName, ok = input.Parsed["batchAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "batchAccountName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/batch/2023-05-01/privatelinkresource/id_batchaccount.go b/resource-manager/batch/2023-05-01/privatelinkresource/id_batchaccount.go index b47467658a2..b91d4209bfd 100644 --- a/resource-manager/batch/2023-05-01/privatelinkresource/id_batchaccount.go +++ b/resource-manager/batch/2023-05-01/privatelinkresource/id_batchaccount.go @@ -36,19 +36,9 @@ func ParseBatchAccountID(input string) (*BatchAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BatchAccountId{} - - 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.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseBatchAccountIDInsensitively(input string) (*BatchAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BatchAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *BatchAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchAccountName", *parsed) + if id.BatchAccountName, ok = input.Parsed["batchAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "batchAccountName", input) } - return &id, nil + return nil } // ValidateBatchAccountID checks that 'input' can be parsed as a Batch Account ID diff --git a/resource-manager/batch/2023-05-01/privatelinkresource/id_privatelinkresource.go b/resource-manager/batch/2023-05-01/privatelinkresource/id_privatelinkresource.go index 582c69de3ff..c60de64fdb3 100644 --- a/resource-manager/batch/2023-05-01/privatelinkresource/id_privatelinkresource.go +++ b/resource-manager/batch/2023-05-01/privatelinkresource/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchAccountName", *parsed) - } - - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BatchAccountName, ok = parsed.Parsed["batchAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchAccountName", *parsed) + if id.BatchAccountName, ok = input.Parsed["batchAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "batchAccountName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/blueprints/2018-11-01-preview/artifact/id_artifactscoped.go b/resource-manager/blueprints/2018-11-01-preview/artifact/id_artifactscoped.go index dd540ed5695..e9889389011 100644 --- a/resource-manager/blueprints/2018-11-01-preview/artifact/id_artifactscoped.go +++ b/resource-manager/blueprints/2018-11-01-preview/artifact/id_artifactscoped.go @@ -36,19 +36,9 @@ func ParseArtifactScopedID(input string) (*ArtifactScopedId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ArtifactScopedId{} - - if id.ResourceScope, ok = parsed.Parsed["resourceScope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceScope", *parsed) - } - - if id.BlueprintName, ok = parsed.Parsed["blueprintName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "blueprintName", *parsed) - } - - if id.ArtifactName, ok = parsed.Parsed["artifactName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "artifactName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseArtifactScopedIDInsensitively(input string) (*ArtifactScopedId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ArtifactScopedId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.ResourceScope, ok = parsed.Parsed["resourceScope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceScope", *parsed) +func (id *ArtifactScopedId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ResourceScope, ok = input.Parsed["resourceScope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceScope", input) } - if id.BlueprintName, ok = parsed.Parsed["blueprintName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "blueprintName", *parsed) + if id.BlueprintName, ok = input.Parsed["blueprintName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "blueprintName", input) } - if id.ArtifactName, ok = parsed.Parsed["artifactName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "artifactName", *parsed) + if id.ArtifactName, ok = input.Parsed["artifactName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "artifactName", input) } - return &id, nil + return nil } // ValidateArtifactScopedID checks that 'input' can be parsed as a Artifact Scoped ID diff --git a/resource-manager/blueprints/2018-11-01-preview/artifact/id_scopedblueprint.go b/resource-manager/blueprints/2018-11-01-preview/artifact/id_scopedblueprint.go index 4926803f8e0..2961ce822e7 100644 --- a/resource-manager/blueprints/2018-11-01-preview/artifact/id_scopedblueprint.go +++ b/resource-manager/blueprints/2018-11-01-preview/artifact/id_scopedblueprint.go @@ -34,15 +34,9 @@ func ParseScopedBlueprintID(input string) (*ScopedBlueprintId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedBlueprintId{} - - if id.ResourceScope, ok = parsed.Parsed["resourceScope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceScope", *parsed) - } - - if id.BlueprintName, ok = parsed.Parsed["blueprintName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "blueprintName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedBlueprintIDInsensitively(input string) (*ScopedBlueprintId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedBlueprintId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ResourceScope, ok = parsed.Parsed["resourceScope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceScope", *parsed) + return &id, nil +} + +func (id *ScopedBlueprintId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ResourceScope, ok = input.Parsed["resourceScope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceScope", input) } - if id.BlueprintName, ok = parsed.Parsed["blueprintName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "blueprintName", *parsed) + if id.BlueprintName, ok = input.Parsed["blueprintName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "blueprintName", input) } - return &id, nil + return nil } // ValidateScopedBlueprintID checks that 'input' can be parsed as a Scoped Blueprint ID diff --git a/resource-manager/blueprints/2018-11-01-preview/assignment/id_scopedblueprintassignment.go b/resource-manager/blueprints/2018-11-01-preview/assignment/id_scopedblueprintassignment.go index f6f2d50a8ac..d19fc368314 100644 --- a/resource-manager/blueprints/2018-11-01-preview/assignment/id_scopedblueprintassignment.go +++ b/resource-manager/blueprints/2018-11-01-preview/assignment/id_scopedblueprintassignment.go @@ -34,15 +34,9 @@ func ParseScopedBlueprintAssignmentID(input string) (*ScopedBlueprintAssignmentI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedBlueprintAssignmentId{} - - if id.ResourceScope, ok = parsed.Parsed["resourceScope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceScope", *parsed) - } - - if id.BlueprintAssignmentName, ok = parsed.Parsed["blueprintAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "blueprintAssignmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedBlueprintAssignmentIDInsensitively(input string) (*ScopedBluepri return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedBlueprintAssignmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ResourceScope, ok = parsed.Parsed["resourceScope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceScope", *parsed) + return &id, nil +} + +func (id *ScopedBlueprintAssignmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ResourceScope, ok = input.Parsed["resourceScope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceScope", input) } - if id.BlueprintAssignmentName, ok = parsed.Parsed["blueprintAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "blueprintAssignmentName", *parsed) + if id.BlueprintAssignmentName, ok = input.Parsed["blueprintAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "blueprintAssignmentName", input) } - return &id, nil + return nil } // ValidateScopedBlueprintAssignmentID checks that 'input' can be parsed as a Scoped Blueprint Assignment ID diff --git a/resource-manager/blueprints/2018-11-01-preview/assignmentoperations/id_scopedassignmentoperation.go b/resource-manager/blueprints/2018-11-01-preview/assignmentoperations/id_scopedassignmentoperation.go index cee319d9ef9..046f16aae90 100644 --- a/resource-manager/blueprints/2018-11-01-preview/assignmentoperations/id_scopedassignmentoperation.go +++ b/resource-manager/blueprints/2018-11-01-preview/assignmentoperations/id_scopedassignmentoperation.go @@ -36,19 +36,9 @@ func ParseScopedAssignmentOperationID(input string) (*ScopedAssignmentOperationI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedAssignmentOperationId{} - - if id.ResourceScope, ok = parsed.Parsed["resourceScope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceScope", *parsed) - } - - if id.BlueprintAssignmentName, ok = parsed.Parsed["blueprintAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "blueprintAssignmentName", *parsed) - } - - if id.AssignmentOperationName, ok = parsed.Parsed["assignmentOperationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "assignmentOperationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseScopedAssignmentOperationIDInsensitively(input string) (*ScopedAssignm return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedAssignmentOperationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.ResourceScope, ok = parsed.Parsed["resourceScope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceScope", *parsed) +func (id *ScopedAssignmentOperationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ResourceScope, ok = input.Parsed["resourceScope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceScope", input) } - if id.BlueprintAssignmentName, ok = parsed.Parsed["blueprintAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "blueprintAssignmentName", *parsed) + if id.BlueprintAssignmentName, ok = input.Parsed["blueprintAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "blueprintAssignmentName", input) } - if id.AssignmentOperationName, ok = parsed.Parsed["assignmentOperationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "assignmentOperationName", *parsed) + if id.AssignmentOperationName, ok = input.Parsed["assignmentOperationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "assignmentOperationName", input) } - return &id, nil + return nil } // ValidateScopedAssignmentOperationID checks that 'input' can be parsed as a Scoped Assignment Operation ID diff --git a/resource-manager/blueprints/2018-11-01-preview/assignmentoperations/id_scopedblueprintassignment.go b/resource-manager/blueprints/2018-11-01-preview/assignmentoperations/id_scopedblueprintassignment.go index 0d5d535804c..f0d41bcd356 100644 --- a/resource-manager/blueprints/2018-11-01-preview/assignmentoperations/id_scopedblueprintassignment.go +++ b/resource-manager/blueprints/2018-11-01-preview/assignmentoperations/id_scopedblueprintassignment.go @@ -34,15 +34,9 @@ func ParseScopedBlueprintAssignmentID(input string) (*ScopedBlueprintAssignmentI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedBlueprintAssignmentId{} - - if id.ResourceScope, ok = parsed.Parsed["resourceScope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceScope", *parsed) - } - - if id.BlueprintAssignmentName, ok = parsed.Parsed["blueprintAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "blueprintAssignmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedBlueprintAssignmentIDInsensitively(input string) (*ScopedBluepri return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedBlueprintAssignmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ResourceScope, ok = parsed.Parsed["resourceScope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceScope", *parsed) + return &id, nil +} + +func (id *ScopedBlueprintAssignmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ResourceScope, ok = input.Parsed["resourceScope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceScope", input) } - if id.BlueprintAssignmentName, ok = parsed.Parsed["blueprintAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "blueprintAssignmentName", *parsed) + if id.BlueprintAssignmentName, ok = input.Parsed["blueprintAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "blueprintAssignmentName", input) } - return &id, nil + return nil } // ValidateScopedBlueprintAssignmentID checks that 'input' can be parsed as a Scoped Blueprint Assignment ID diff --git a/resource-manager/blueprints/2018-11-01-preview/blueprint/id_scopedblueprint.go b/resource-manager/blueprints/2018-11-01-preview/blueprint/id_scopedblueprint.go index eb77efed044..e6027367207 100644 --- a/resource-manager/blueprints/2018-11-01-preview/blueprint/id_scopedblueprint.go +++ b/resource-manager/blueprints/2018-11-01-preview/blueprint/id_scopedblueprint.go @@ -34,15 +34,9 @@ func ParseScopedBlueprintID(input string) (*ScopedBlueprintId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedBlueprintId{} - - if id.ResourceScope, ok = parsed.Parsed["resourceScope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceScope", *parsed) - } - - if id.BlueprintName, ok = parsed.Parsed["blueprintName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "blueprintName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedBlueprintIDInsensitively(input string) (*ScopedBlueprintId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedBlueprintId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ResourceScope, ok = parsed.Parsed["resourceScope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceScope", *parsed) + return &id, nil +} + +func (id *ScopedBlueprintId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ResourceScope, ok = input.Parsed["resourceScope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceScope", input) } - if id.BlueprintName, ok = parsed.Parsed["blueprintName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "blueprintName", *parsed) + if id.BlueprintName, ok = input.Parsed["blueprintName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "blueprintName", input) } - return &id, nil + return nil } // ValidateScopedBlueprintID checks that 'input' can be parsed as a Scoped Blueprint ID diff --git a/resource-manager/blueprints/2018-11-01-preview/blueprintassignments/id_scopedblueprintassignment.go b/resource-manager/blueprints/2018-11-01-preview/blueprintassignments/id_scopedblueprintassignment.go index 78520ec1019..7d00a7ac8d0 100644 --- a/resource-manager/blueprints/2018-11-01-preview/blueprintassignments/id_scopedblueprintassignment.go +++ b/resource-manager/blueprints/2018-11-01-preview/blueprintassignments/id_scopedblueprintassignment.go @@ -34,15 +34,9 @@ func ParseScopedBlueprintAssignmentID(input string) (*ScopedBlueprintAssignmentI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedBlueprintAssignmentId{} - - if id.ResourceScope, ok = parsed.Parsed["resourceScope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceScope", *parsed) - } - - if id.BlueprintAssignmentName, ok = parsed.Parsed["blueprintAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "blueprintAssignmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedBlueprintAssignmentIDInsensitively(input string) (*ScopedBluepri return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedBlueprintAssignmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ResourceScope, ok = parsed.Parsed["resourceScope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceScope", *parsed) + return &id, nil +} + +func (id *ScopedBlueprintAssignmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ResourceScope, ok = input.Parsed["resourceScope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceScope", input) } - if id.BlueprintAssignmentName, ok = parsed.Parsed["blueprintAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "blueprintAssignmentName", *parsed) + if id.BlueprintAssignmentName, ok = input.Parsed["blueprintAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "blueprintAssignmentName", input) } - return &id, nil + return nil } // ValidateScopedBlueprintAssignmentID checks that 'input' can be parsed as a Scoped Blueprint Assignment ID diff --git a/resource-manager/blueprints/2018-11-01-preview/publishedartifact/id_scopedversion.go b/resource-manager/blueprints/2018-11-01-preview/publishedartifact/id_scopedversion.go index 5069645db4e..c44774c1955 100644 --- a/resource-manager/blueprints/2018-11-01-preview/publishedartifact/id_scopedversion.go +++ b/resource-manager/blueprints/2018-11-01-preview/publishedartifact/id_scopedversion.go @@ -36,19 +36,9 @@ func ParseScopedVersionID(input string) (*ScopedVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedVersionId{} - - if id.ResourceScope, ok = parsed.Parsed["resourceScope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceScope", *parsed) - } - - if id.BlueprintName, ok = parsed.Parsed["blueprintName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "blueprintName", *parsed) - } - - if id.VersionId, ok = parsed.Parsed["versionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseScopedVersionIDInsensitively(input string) (*ScopedVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.ResourceScope, ok = parsed.Parsed["resourceScope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceScope", *parsed) +func (id *ScopedVersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ResourceScope, ok = input.Parsed["resourceScope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceScope", input) } - if id.BlueprintName, ok = parsed.Parsed["blueprintName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "blueprintName", *parsed) + if id.BlueprintName, ok = input.Parsed["blueprintName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "blueprintName", input) } - if id.VersionId, ok = parsed.Parsed["versionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionId", *parsed) + if id.VersionId, ok = input.Parsed["versionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionId", input) } - return &id, nil + return nil } // ValidateScopedVersionID checks that 'input' can be parsed as a Scoped Version ID diff --git a/resource-manager/blueprints/2018-11-01-preview/publishedartifact/id_versionartifactscoped.go b/resource-manager/blueprints/2018-11-01-preview/publishedartifact/id_versionartifactscoped.go index 2b166eb0a20..3af95867467 100644 --- a/resource-manager/blueprints/2018-11-01-preview/publishedartifact/id_versionartifactscoped.go +++ b/resource-manager/blueprints/2018-11-01-preview/publishedartifact/id_versionartifactscoped.go @@ -38,23 +38,9 @@ func ParseVersionArtifactScopedID(input string) (*VersionArtifactScopedId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionArtifactScopedId{} - - if id.ResourceScope, ok = parsed.Parsed["resourceScope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceScope", *parsed) - } - - if id.BlueprintName, ok = parsed.Parsed["blueprintName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "blueprintName", *parsed) - } - - if id.VersionId, ok = parsed.Parsed["versionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionId", *parsed) - } - - if id.ArtifactName, ok = parsed.Parsed["artifactName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "artifactName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVersionArtifactScopedIDInsensitively(input string) (*VersionArtifactSc return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionArtifactScopedId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VersionArtifactScopedId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.ResourceScope, ok = parsed.Parsed["resourceScope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceScope", *parsed) + if id.ResourceScope, ok = input.Parsed["resourceScope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceScope", input) } - if id.BlueprintName, ok = parsed.Parsed["blueprintName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "blueprintName", *parsed) + if id.BlueprintName, ok = input.Parsed["blueprintName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "blueprintName", input) } - if id.VersionId, ok = parsed.Parsed["versionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionId", *parsed) + if id.VersionId, ok = input.Parsed["versionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionId", input) } - if id.ArtifactName, ok = parsed.Parsed["artifactName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "artifactName", *parsed) + if id.ArtifactName, ok = input.Parsed["artifactName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "artifactName", input) } - return &id, nil + return nil } // ValidateVersionArtifactScopedID checks that 'input' can be parsed as a Version Artifact Scoped ID diff --git a/resource-manager/blueprints/2018-11-01-preview/publishedblueprint/id_scopedblueprint.go b/resource-manager/blueprints/2018-11-01-preview/publishedblueprint/id_scopedblueprint.go index 4ce19f325c1..e45234381c8 100644 --- a/resource-manager/blueprints/2018-11-01-preview/publishedblueprint/id_scopedblueprint.go +++ b/resource-manager/blueprints/2018-11-01-preview/publishedblueprint/id_scopedblueprint.go @@ -34,15 +34,9 @@ func ParseScopedBlueprintID(input string) (*ScopedBlueprintId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedBlueprintId{} - - if id.ResourceScope, ok = parsed.Parsed["resourceScope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceScope", *parsed) - } - - if id.BlueprintName, ok = parsed.Parsed["blueprintName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "blueprintName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedBlueprintIDInsensitively(input string) (*ScopedBlueprintId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedBlueprintId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ResourceScope, ok = parsed.Parsed["resourceScope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceScope", *parsed) + return &id, nil +} + +func (id *ScopedBlueprintId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ResourceScope, ok = input.Parsed["resourceScope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceScope", input) } - if id.BlueprintName, ok = parsed.Parsed["blueprintName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "blueprintName", *parsed) + if id.BlueprintName, ok = input.Parsed["blueprintName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "blueprintName", input) } - return &id, nil + return nil } // ValidateScopedBlueprintID checks that 'input' can be parsed as a Scoped Blueprint ID diff --git a/resource-manager/blueprints/2018-11-01-preview/publishedblueprint/id_scopedversion.go b/resource-manager/blueprints/2018-11-01-preview/publishedblueprint/id_scopedversion.go index e205868b385..cfc6e91c252 100644 --- a/resource-manager/blueprints/2018-11-01-preview/publishedblueprint/id_scopedversion.go +++ b/resource-manager/blueprints/2018-11-01-preview/publishedblueprint/id_scopedversion.go @@ -36,19 +36,9 @@ func ParseScopedVersionID(input string) (*ScopedVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedVersionId{} - - if id.ResourceScope, ok = parsed.Parsed["resourceScope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceScope", *parsed) - } - - if id.BlueprintName, ok = parsed.Parsed["blueprintName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "blueprintName", *parsed) - } - - if id.VersionId, ok = parsed.Parsed["versionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseScopedVersionIDInsensitively(input string) (*ScopedVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.ResourceScope, ok = parsed.Parsed["resourceScope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceScope", *parsed) +func (id *ScopedVersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ResourceScope, ok = input.Parsed["resourceScope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceScope", input) } - if id.BlueprintName, ok = parsed.Parsed["blueprintName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "blueprintName", *parsed) + if id.BlueprintName, ok = input.Parsed["blueprintName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "blueprintName", input) } - if id.VersionId, ok = parsed.Parsed["versionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionId", *parsed) + if id.VersionId, ok = input.Parsed["versionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionId", input) } - return &id, nil + return nil } // ValidateScopedVersionID checks that 'input' can be parsed as a Scoped Version ID diff --git a/resource-manager/chaosstudio/2023-04-15-preview/capabilities/id_capabilitytype.go b/resource-manager/chaosstudio/2023-04-15-preview/capabilities/id_capabilitytype.go index c069b18e8cc..c7e47619519 100644 --- a/resource-manager/chaosstudio/2023-04-15-preview/capabilities/id_capabilitytype.go +++ b/resource-manager/chaosstudio/2023-04-15-preview/capabilities/id_capabilitytype.go @@ -38,23 +38,9 @@ func ParseCapabilityTypeID(input string) (*CapabilityTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapabilityTypeId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.TargetTypeName, ok = parsed.Parsed["targetTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetTypeName", *parsed) - } - - if id.CapabilityTypeName, ok = parsed.Parsed["capabilityTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capabilityTypeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCapabilityTypeIDInsensitively(input string) (*CapabilityTypeId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapabilityTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CapabilityTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.TargetTypeName, ok = parsed.Parsed["targetTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetTypeName", *parsed) + if id.TargetTypeName, ok = input.Parsed["targetTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "targetTypeName", input) } - if id.CapabilityTypeName, ok = parsed.Parsed["capabilityTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capabilityTypeName", *parsed) + if id.CapabilityTypeName, ok = input.Parsed["capabilityTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capabilityTypeName", input) } - return &id, nil + return nil } // ValidateCapabilityTypeID checks that 'input' can be parsed as a Capability Type ID diff --git a/resource-manager/chaosstudio/2023-04-15-preview/capabilities/id_scopedcapability.go b/resource-manager/chaosstudio/2023-04-15-preview/capabilities/id_scopedcapability.go index fd82054befd..36a78b9ae22 100644 --- a/resource-manager/chaosstudio/2023-04-15-preview/capabilities/id_scopedcapability.go +++ b/resource-manager/chaosstudio/2023-04-15-preview/capabilities/id_scopedcapability.go @@ -36,19 +36,9 @@ func ParseScopedCapabilityID(input string) (*ScopedCapabilityId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedCapabilityId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.TargetName, ok = parsed.Parsed["targetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetName", *parsed) - } - - if id.CapabilityName, ok = parsed.Parsed["capabilityName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capabilityName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseScopedCapabilityIDInsensitively(input string) (*ScopedCapabilityId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedCapabilityId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) +func (id *ScopedCapabilityId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.TargetName, ok = parsed.Parsed["targetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetName", *parsed) + if id.TargetName, ok = input.Parsed["targetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "targetName", input) } - if id.CapabilityName, ok = parsed.Parsed["capabilityName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capabilityName", *parsed) + if id.CapabilityName, ok = input.Parsed["capabilityName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capabilityName", input) } - return &id, nil + return nil } // ValidateScopedCapabilityID checks that 'input' can be parsed as a Scoped Capability ID diff --git a/resource-manager/chaosstudio/2023-04-15-preview/capabilities/id_scopedtarget.go b/resource-manager/chaosstudio/2023-04-15-preview/capabilities/id_scopedtarget.go index db102ba3d41..9e3a79b1dad 100644 --- a/resource-manager/chaosstudio/2023-04-15-preview/capabilities/id_scopedtarget.go +++ b/resource-manager/chaosstudio/2023-04-15-preview/capabilities/id_scopedtarget.go @@ -34,15 +34,9 @@ func ParseScopedTargetID(input string) (*ScopedTargetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedTargetId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.TargetName, ok = parsed.Parsed["targetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedTargetIDInsensitively(input string) (*ScopedTargetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedTargetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedTargetId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.TargetName, ok = parsed.Parsed["targetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetName", *parsed) + if id.TargetName, ok = input.Parsed["targetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "targetName", input) } - return &id, nil + return nil } // ValidateScopedTargetID checks that 'input' can be parsed as a Scoped Target ID diff --git a/resource-manager/chaosstudio/2023-04-15-preview/capabilitytypes/id_targettype.go b/resource-manager/chaosstudio/2023-04-15-preview/capabilitytypes/id_targettype.go index 3ec205f4c57..ed5fdf6336e 100644 --- a/resource-manager/chaosstudio/2023-04-15-preview/capabilitytypes/id_targettype.go +++ b/resource-manager/chaosstudio/2023-04-15-preview/capabilitytypes/id_targettype.go @@ -36,19 +36,9 @@ func ParseTargetTypeID(input string) (*TargetTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TargetTypeId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.TargetTypeName, ok = parsed.Parsed["targetTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetTypeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseTargetTypeIDInsensitively(input string) (*TargetTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TargetTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *TargetTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.TargetTypeName, ok = parsed.Parsed["targetTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetTypeName", *parsed) + if id.TargetTypeName, ok = input.Parsed["targetTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "targetTypeName", input) } - return &id, nil + return nil } // ValidateTargetTypeID checks that 'input' can be parsed as a Target Type ID diff --git a/resource-manager/chaosstudio/2023-04-15-preview/experiments/id_executiondetail.go b/resource-manager/chaosstudio/2023-04-15-preview/experiments/id_executiondetail.go index bf8cc62f1ad..01eca306658 100644 --- a/resource-manager/chaosstudio/2023-04-15-preview/experiments/id_executiondetail.go +++ b/resource-manager/chaosstudio/2023-04-15-preview/experiments/id_executiondetail.go @@ -38,23 +38,9 @@ func ParseExecutionDetailID(input string) (*ExecutionDetailId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExecutionDetailId{} - - 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.ExperimentName, ok = parsed.Parsed["experimentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "experimentName", *parsed) - } - - if id.ExecutionDetailsId, ok = parsed.Parsed["executionDetailsId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "executionDetailsId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseExecutionDetailIDInsensitively(input string) (*ExecutionDetailId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExecutionDetailId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ExecutionDetailId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExperimentName, ok = parsed.Parsed["experimentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "experimentName", *parsed) + if id.ExperimentName, ok = input.Parsed["experimentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "experimentName", input) } - if id.ExecutionDetailsId, ok = parsed.Parsed["executionDetailsId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "executionDetailsId", *parsed) + if id.ExecutionDetailsId, ok = input.Parsed["executionDetailsId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "executionDetailsId", input) } - return &id, nil + return nil } // ValidateExecutionDetailID checks that 'input' can be parsed as a Execution Detail ID diff --git a/resource-manager/chaosstudio/2023-04-15-preview/experiments/id_experiment.go b/resource-manager/chaosstudio/2023-04-15-preview/experiments/id_experiment.go index 2be012a20c1..c5d6be45f9c 100644 --- a/resource-manager/chaosstudio/2023-04-15-preview/experiments/id_experiment.go +++ b/resource-manager/chaosstudio/2023-04-15-preview/experiments/id_experiment.go @@ -36,19 +36,9 @@ func ParseExperimentID(input string) (*ExperimentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExperimentId{} - - 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.ExperimentName, ok = parsed.Parsed["experimentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "experimentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseExperimentIDInsensitively(input string) (*ExperimentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExperimentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ExperimentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExperimentName, ok = parsed.Parsed["experimentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "experimentName", *parsed) + if id.ExperimentName, ok = input.Parsed["experimentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "experimentName", input) } - return &id, nil + return nil } // ValidateExperimentID checks that 'input' can be parsed as a Experiment ID diff --git a/resource-manager/chaosstudio/2023-04-15-preview/experiments/id_status.go b/resource-manager/chaosstudio/2023-04-15-preview/experiments/id_status.go index b1167555618..00c67f54232 100644 --- a/resource-manager/chaosstudio/2023-04-15-preview/experiments/id_status.go +++ b/resource-manager/chaosstudio/2023-04-15-preview/experiments/id_status.go @@ -38,23 +38,9 @@ func ParseStatusID(input string) (*StatusId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StatusId{} - - 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.ExperimentName, ok = parsed.Parsed["experimentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "experimentName", *parsed) - } - - if id.StatusId, ok = parsed.Parsed["statusId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "statusId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseStatusIDInsensitively(input string) (*StatusId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StatusId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *StatusId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExperimentName, ok = parsed.Parsed["experimentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "experimentName", *parsed) + if id.ExperimentName, ok = input.Parsed["experimentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "experimentName", input) } - if id.StatusId, ok = parsed.Parsed["statusId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "statusId", *parsed) + if id.StatusId, ok = input.Parsed["statusId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "statusId", input) } - return &id, nil + return nil } // ValidateStatusID checks that 'input' can be parsed as a Status ID diff --git a/resource-manager/chaosstudio/2023-04-15-preview/targets/id_scopedtarget.go b/resource-manager/chaosstudio/2023-04-15-preview/targets/id_scopedtarget.go index 07e78a03d63..8f974b51d09 100644 --- a/resource-manager/chaosstudio/2023-04-15-preview/targets/id_scopedtarget.go +++ b/resource-manager/chaosstudio/2023-04-15-preview/targets/id_scopedtarget.go @@ -34,15 +34,9 @@ func ParseScopedTargetID(input string) (*ScopedTargetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedTargetId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.TargetName, ok = parsed.Parsed["targetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedTargetIDInsensitively(input string) (*ScopedTargetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedTargetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedTargetId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.TargetName, ok = parsed.Parsed["targetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetName", *parsed) + if id.TargetName, ok = input.Parsed["targetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "targetName", input) } - return &id, nil + return nil } // ValidateScopedTargetID checks that 'input' can be parsed as a Scoped Target ID diff --git a/resource-manager/chaosstudio/2023-04-15-preview/targettypes/id_location.go b/resource-manager/chaosstudio/2023-04-15-preview/targettypes/id_location.go index 0d31258b50f..5fbf500f9d5 100644 --- a/resource-manager/chaosstudio/2023-04-15-preview/targettypes/id_location.go +++ b/resource-manager/chaosstudio/2023-04-15-preview/targettypes/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/chaosstudio/2023-04-15-preview/targettypes/id_targettype.go b/resource-manager/chaosstudio/2023-04-15-preview/targettypes/id_targettype.go index ab4b4df0434..32ca94c54df 100644 --- a/resource-manager/chaosstudio/2023-04-15-preview/targettypes/id_targettype.go +++ b/resource-manager/chaosstudio/2023-04-15-preview/targettypes/id_targettype.go @@ -36,19 +36,9 @@ func ParseTargetTypeID(input string) (*TargetTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TargetTypeId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.TargetTypeName, ok = parsed.Parsed["targetTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetTypeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseTargetTypeIDInsensitively(input string) (*TargetTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TargetTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *TargetTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.TargetTypeName, ok = parsed.Parsed["targetTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetTypeName", *parsed) + if id.TargetTypeName, ok = input.Parsed["targetTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "targetTypeName", input) } - return &id, nil + return nil } // ValidateTargetTypeID checks that 'input' can be parsed as a Target Type ID diff --git a/resource-manager/chaosstudio/2023-11-01/asyncoperations/id_operationsstatus.go b/resource-manager/chaosstudio/2023-11-01/asyncoperations/id_operationsstatus.go index fab984390ee..2b20db6d867 100644 --- a/resource-manager/chaosstudio/2023-11-01/asyncoperations/id_operationsstatus.go +++ b/resource-manager/chaosstudio/2023-11-01/asyncoperations/id_operationsstatus.go @@ -36,19 +36,9 @@ func ParseOperationsStatusID(input string) (*OperationsStatusId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationsStatusId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.AsyncOperationId, ok = parsed.Parsed["asyncOperationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "asyncOperationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseOperationsStatusIDInsensitively(input string) (*OperationsStatusId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationsStatusId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *OperationsStatusId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.AsyncOperationId, ok = parsed.Parsed["asyncOperationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "asyncOperationId", *parsed) + if id.AsyncOperationId, ok = input.Parsed["asyncOperationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "asyncOperationId", input) } - return &id, nil + return nil } // ValidateOperationsStatusID checks that 'input' can be parsed as a Operations Status ID diff --git a/resource-manager/chaosstudio/2023-11-01/capabilities/id_capabilitytype.go b/resource-manager/chaosstudio/2023-11-01/capabilities/id_capabilitytype.go index c069b18e8cc..c7e47619519 100644 --- a/resource-manager/chaosstudio/2023-11-01/capabilities/id_capabilitytype.go +++ b/resource-manager/chaosstudio/2023-11-01/capabilities/id_capabilitytype.go @@ -38,23 +38,9 @@ func ParseCapabilityTypeID(input string) (*CapabilityTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapabilityTypeId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.TargetTypeName, ok = parsed.Parsed["targetTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetTypeName", *parsed) - } - - if id.CapabilityTypeName, ok = parsed.Parsed["capabilityTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capabilityTypeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCapabilityTypeIDInsensitively(input string) (*CapabilityTypeId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapabilityTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CapabilityTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.TargetTypeName, ok = parsed.Parsed["targetTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetTypeName", *parsed) + if id.TargetTypeName, ok = input.Parsed["targetTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "targetTypeName", input) } - if id.CapabilityTypeName, ok = parsed.Parsed["capabilityTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capabilityTypeName", *parsed) + if id.CapabilityTypeName, ok = input.Parsed["capabilityTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capabilityTypeName", input) } - return &id, nil + return nil } // ValidateCapabilityTypeID checks that 'input' can be parsed as a Capability Type ID diff --git a/resource-manager/chaosstudio/2023-11-01/capabilities/id_scopedcapability.go b/resource-manager/chaosstudio/2023-11-01/capabilities/id_scopedcapability.go index fd82054befd..36a78b9ae22 100644 --- a/resource-manager/chaosstudio/2023-11-01/capabilities/id_scopedcapability.go +++ b/resource-manager/chaosstudio/2023-11-01/capabilities/id_scopedcapability.go @@ -36,19 +36,9 @@ func ParseScopedCapabilityID(input string) (*ScopedCapabilityId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedCapabilityId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.TargetName, ok = parsed.Parsed["targetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetName", *parsed) - } - - if id.CapabilityName, ok = parsed.Parsed["capabilityName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capabilityName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseScopedCapabilityIDInsensitively(input string) (*ScopedCapabilityId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedCapabilityId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) +func (id *ScopedCapabilityId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.TargetName, ok = parsed.Parsed["targetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetName", *parsed) + if id.TargetName, ok = input.Parsed["targetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "targetName", input) } - if id.CapabilityName, ok = parsed.Parsed["capabilityName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capabilityName", *parsed) + if id.CapabilityName, ok = input.Parsed["capabilityName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capabilityName", input) } - return &id, nil + return nil } // ValidateScopedCapabilityID checks that 'input' can be parsed as a Scoped Capability ID diff --git a/resource-manager/chaosstudio/2023-11-01/capabilities/id_scopedtarget.go b/resource-manager/chaosstudio/2023-11-01/capabilities/id_scopedtarget.go index db102ba3d41..9e3a79b1dad 100644 --- a/resource-manager/chaosstudio/2023-11-01/capabilities/id_scopedtarget.go +++ b/resource-manager/chaosstudio/2023-11-01/capabilities/id_scopedtarget.go @@ -34,15 +34,9 @@ func ParseScopedTargetID(input string) (*ScopedTargetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedTargetId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.TargetName, ok = parsed.Parsed["targetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedTargetIDInsensitively(input string) (*ScopedTargetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedTargetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedTargetId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.TargetName, ok = parsed.Parsed["targetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetName", *parsed) + if id.TargetName, ok = input.Parsed["targetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "targetName", input) } - return &id, nil + return nil } // ValidateScopedTargetID checks that 'input' can be parsed as a Scoped Target ID diff --git a/resource-manager/chaosstudio/2023-11-01/capabilitytypes/id_targettype.go b/resource-manager/chaosstudio/2023-11-01/capabilitytypes/id_targettype.go index 3ec205f4c57..ed5fdf6336e 100644 --- a/resource-manager/chaosstudio/2023-11-01/capabilitytypes/id_targettype.go +++ b/resource-manager/chaosstudio/2023-11-01/capabilitytypes/id_targettype.go @@ -36,19 +36,9 @@ func ParseTargetTypeID(input string) (*TargetTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TargetTypeId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.TargetTypeName, ok = parsed.Parsed["targetTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetTypeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseTargetTypeIDInsensitively(input string) (*TargetTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TargetTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *TargetTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.TargetTypeName, ok = parsed.Parsed["targetTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetTypeName", *parsed) + if id.TargetTypeName, ok = input.Parsed["targetTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "targetTypeName", input) } - return &id, nil + return nil } // ValidateTargetTypeID checks that 'input' can be parsed as a Target Type ID diff --git a/resource-manager/chaosstudio/2023-11-01/experiments/id_execution.go b/resource-manager/chaosstudio/2023-11-01/experiments/id_execution.go index e56aec70120..e6471a1db7c 100644 --- a/resource-manager/chaosstudio/2023-11-01/experiments/id_execution.go +++ b/resource-manager/chaosstudio/2023-11-01/experiments/id_execution.go @@ -38,23 +38,9 @@ func ParseExecutionID(input string) (*ExecutionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExecutionId{} - - 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.ExperimentName, ok = parsed.Parsed["experimentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "experimentName", *parsed) - } - - if id.ExecutionId, ok = parsed.Parsed["executionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "executionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseExecutionIDInsensitively(input string) (*ExecutionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExecutionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ExecutionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExperimentName, ok = parsed.Parsed["experimentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "experimentName", *parsed) + if id.ExperimentName, ok = input.Parsed["experimentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "experimentName", input) } - if id.ExecutionId, ok = parsed.Parsed["executionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "executionId", *parsed) + if id.ExecutionId, ok = input.Parsed["executionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "executionId", input) } - return &id, nil + return nil } // ValidateExecutionID checks that 'input' can be parsed as a Execution ID diff --git a/resource-manager/chaosstudio/2023-11-01/experiments/id_experiment.go b/resource-manager/chaosstudio/2023-11-01/experiments/id_experiment.go index 2be012a20c1..c5d6be45f9c 100644 --- a/resource-manager/chaosstudio/2023-11-01/experiments/id_experiment.go +++ b/resource-manager/chaosstudio/2023-11-01/experiments/id_experiment.go @@ -36,19 +36,9 @@ func ParseExperimentID(input string) (*ExperimentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExperimentId{} - - 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.ExperimentName, ok = parsed.Parsed["experimentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "experimentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseExperimentIDInsensitively(input string) (*ExperimentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExperimentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ExperimentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExperimentName, ok = parsed.Parsed["experimentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "experimentName", *parsed) + if id.ExperimentName, ok = input.Parsed["experimentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "experimentName", input) } - return &id, nil + return nil } // ValidateExperimentID checks that 'input' can be parsed as a Experiment ID diff --git a/resource-manager/chaosstudio/2023-11-01/targets/id_scopedtarget.go b/resource-manager/chaosstudio/2023-11-01/targets/id_scopedtarget.go index 07e78a03d63..8f974b51d09 100644 --- a/resource-manager/chaosstudio/2023-11-01/targets/id_scopedtarget.go +++ b/resource-manager/chaosstudio/2023-11-01/targets/id_scopedtarget.go @@ -34,15 +34,9 @@ func ParseScopedTargetID(input string) (*ScopedTargetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedTargetId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.TargetName, ok = parsed.Parsed["targetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedTargetIDInsensitively(input string) (*ScopedTargetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedTargetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedTargetId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.TargetName, ok = parsed.Parsed["targetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetName", *parsed) + if id.TargetName, ok = input.Parsed["targetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "targetName", input) } - return &id, nil + return nil } // ValidateScopedTargetID checks that 'input' can be parsed as a Scoped Target ID diff --git a/resource-manager/chaosstudio/2023-11-01/targettypes/id_location.go b/resource-manager/chaosstudio/2023-11-01/targettypes/id_location.go index 0d31258b50f..5fbf500f9d5 100644 --- a/resource-manager/chaosstudio/2023-11-01/targettypes/id_location.go +++ b/resource-manager/chaosstudio/2023-11-01/targettypes/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/chaosstudio/2023-11-01/targettypes/id_targettype.go b/resource-manager/chaosstudio/2023-11-01/targettypes/id_targettype.go index ab4b4df0434..32ca94c54df 100644 --- a/resource-manager/chaosstudio/2023-11-01/targettypes/id_targettype.go +++ b/resource-manager/chaosstudio/2023-11-01/targettypes/id_targettype.go @@ -36,19 +36,9 @@ func ParseTargetTypeID(input string) (*TargetTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TargetTypeId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.TargetTypeName, ok = parsed.Parsed["targetTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetTypeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseTargetTypeIDInsensitively(input string) (*TargetTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TargetTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *TargetTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.TargetTypeName, ok = parsed.Parsed["targetTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetTypeName", *parsed) + if id.TargetTypeName, ok = input.Parsed["targetTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "targetTypeName", input) } - return &id, nil + return nil } // ValidateTargetTypeID checks that 'input' can be parsed as a Target Type ID diff --git a/resource-manager/cognitive/2023-05-01/cognitiveservicesaccounts/id_account.go b/resource-manager/cognitive/2023-05-01/cognitiveservicesaccounts/id_account.go index 083e7fdfbed..6c5fa6c5665 100644 --- a/resource-manager/cognitive/2023-05-01/cognitiveservicesaccounts/id_account.go +++ b/resource-manager/cognitive/2023-05-01/cognitiveservicesaccounts/id_account.go @@ -36,19 +36,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/cognitive/2023-05-01/cognitiveservicesaccounts/id_deletedaccount.go b/resource-manager/cognitive/2023-05-01/cognitiveservicesaccounts/id_deletedaccount.go index f16de8a0f13..bc58fbc512d 100644 --- a/resource-manager/cognitive/2023-05-01/cognitiveservicesaccounts/id_deletedaccount.go +++ b/resource-manager/cognitive/2023-05-01/cognitiveservicesaccounts/id_deletedaccount.go @@ -38,23 +38,9 @@ func ParseDeletedAccountID(input string) (*DeletedAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeletedAccountId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) - } - - if id.DeletedAccountName, ok = parsed.Parsed["deletedAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDeletedAccountIDInsensitively(input string) (*DeletedAccountId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeletedAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DeletedAccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DeletedAccountName, ok = parsed.Parsed["deletedAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedAccountName", *parsed) + if id.DeletedAccountName, ok = input.Parsed["deletedAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deletedAccountName", input) } - return &id, nil + return nil } // ValidateDeletedAccountID checks that 'input' can be parsed as a Deleted Account ID diff --git a/resource-manager/cognitive/2023-05-01/cognitiveservicesaccounts/id_location.go b/resource-manager/cognitive/2023-05-01/cognitiveservicesaccounts/id_location.go index 338b34bed02..fd579b6ac4b 100644 --- a/resource-manager/cognitive/2023-05-01/cognitiveservicesaccounts/id_location.go +++ b/resource-manager/cognitive/2023-05-01/cognitiveservicesaccounts/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/cognitive/2023-05-01/cognitiveservicescommitmentplans/id_commitmentplan.go b/resource-manager/cognitive/2023-05-01/cognitiveservicescommitmentplans/id_commitmentplan.go index 43d6f0bf0ce..71cfd89dcf3 100644 --- a/resource-manager/cognitive/2023-05-01/cognitiveservicescommitmentplans/id_commitmentplan.go +++ b/resource-manager/cognitive/2023-05-01/cognitiveservicescommitmentplans/id_commitmentplan.go @@ -36,19 +36,9 @@ func ParseCommitmentPlanID(input string) (*CommitmentPlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommitmentPlanId{} - - 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.CommitmentPlanName, ok = parsed.Parsed["commitmentPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "commitmentPlanName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseCommitmentPlanIDInsensitively(input string) (*CommitmentPlanId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommitmentPlanId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CommitmentPlanId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CommitmentPlanName, ok = parsed.Parsed["commitmentPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "commitmentPlanName", *parsed) + if id.CommitmentPlanName, ok = input.Parsed["commitmentPlanName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "commitmentPlanName", input) } - return &id, nil + return nil } // ValidateCommitmentPlanID checks that 'input' can be parsed as a Commitment Plan ID diff --git a/resource-manager/cognitive/2023-05-01/commitmentplans/id_account.go b/resource-manager/cognitive/2023-05-01/commitmentplans/id_account.go index 9f627390b40..17ccb408ee1 100644 --- a/resource-manager/cognitive/2023-05-01/commitmentplans/id_account.go +++ b/resource-manager/cognitive/2023-05-01/commitmentplans/id_account.go @@ -36,19 +36,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/cognitive/2023-05-01/commitmentplans/id_accountassociation.go b/resource-manager/cognitive/2023-05-01/commitmentplans/id_accountassociation.go index 3a438521831..e541010c73b 100644 --- a/resource-manager/cognitive/2023-05-01/commitmentplans/id_accountassociation.go +++ b/resource-manager/cognitive/2023-05-01/commitmentplans/id_accountassociation.go @@ -38,23 +38,9 @@ func ParseAccountAssociationID(input string) (*AccountAssociationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountAssociationId{} - - 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.CommitmentPlanName, ok = parsed.Parsed["commitmentPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "commitmentPlanName", *parsed) - } - - if id.AccountAssociationName, ok = parsed.Parsed["accountAssociationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountAssociationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAccountAssociationIDInsensitively(input string) (*AccountAssociationId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountAssociationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AccountAssociationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CommitmentPlanName, ok = parsed.Parsed["commitmentPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "commitmentPlanName", *parsed) + if id.CommitmentPlanName, ok = input.Parsed["commitmentPlanName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "commitmentPlanName", input) } - if id.AccountAssociationName, ok = parsed.Parsed["accountAssociationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountAssociationName", *parsed) + if id.AccountAssociationName, ok = input.Parsed["accountAssociationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountAssociationName", input) } - return &id, nil + return nil } // ValidateAccountAssociationID checks that 'input' can be parsed as a Account Association ID diff --git a/resource-manager/cognitive/2023-05-01/commitmentplans/id_accountcommitmentplan.go b/resource-manager/cognitive/2023-05-01/commitmentplans/id_accountcommitmentplan.go index 3285498a6b4..83c8b529eb8 100644 --- a/resource-manager/cognitive/2023-05-01/commitmentplans/id_accountcommitmentplan.go +++ b/resource-manager/cognitive/2023-05-01/commitmentplans/id_accountcommitmentplan.go @@ -38,23 +38,9 @@ func ParseAccountCommitmentPlanID(input string) (*AccountCommitmentPlanId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountCommitmentPlanId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.CommitmentPlanName, ok = parsed.Parsed["commitmentPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "commitmentPlanName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAccountCommitmentPlanIDInsensitively(input string) (*AccountCommitment return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountCommitmentPlanId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AccountCommitmentPlanId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.CommitmentPlanName, ok = parsed.Parsed["commitmentPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "commitmentPlanName", *parsed) + if id.CommitmentPlanName, ok = input.Parsed["commitmentPlanName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "commitmentPlanName", input) } - return &id, nil + return nil } // ValidateAccountCommitmentPlanID checks that 'input' can be parsed as a Account Commitment Plan ID diff --git a/resource-manager/cognitive/2023-05-01/commitmentplans/id_commitmentplan.go b/resource-manager/cognitive/2023-05-01/commitmentplans/id_commitmentplan.go index 1e2a8af4e9d..2df23fef88f 100644 --- a/resource-manager/cognitive/2023-05-01/commitmentplans/id_commitmentplan.go +++ b/resource-manager/cognitive/2023-05-01/commitmentplans/id_commitmentplan.go @@ -36,19 +36,9 @@ func ParseCommitmentPlanID(input string) (*CommitmentPlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommitmentPlanId{} - - 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.CommitmentPlanName, ok = parsed.Parsed["commitmentPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "commitmentPlanName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseCommitmentPlanIDInsensitively(input string) (*CommitmentPlanId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommitmentPlanId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CommitmentPlanId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CommitmentPlanName, ok = parsed.Parsed["commitmentPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "commitmentPlanName", *parsed) + if id.CommitmentPlanName, ok = input.Parsed["commitmentPlanName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "commitmentPlanName", input) } - return &id, nil + return nil } // ValidateCommitmentPlanID checks that 'input' can be parsed as a Commitment Plan ID diff --git a/resource-manager/cognitive/2023-05-01/commitmenttiers/id_location.go b/resource-manager/cognitive/2023-05-01/commitmenttiers/id_location.go index 5c7177d7ead..b4009ecc3c4 100644 --- a/resource-manager/cognitive/2023-05-01/commitmenttiers/id_location.go +++ b/resource-manager/cognitive/2023-05-01/commitmenttiers/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/cognitive/2023-05-01/deployments/id_account.go b/resource-manager/cognitive/2023-05-01/deployments/id_account.go index b0f74aaeafd..fc5e1a97e51 100644 --- a/resource-manager/cognitive/2023-05-01/deployments/id_account.go +++ b/resource-manager/cognitive/2023-05-01/deployments/id_account.go @@ -36,19 +36,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/cognitive/2023-05-01/deployments/id_deployment.go b/resource-manager/cognitive/2023-05-01/deployments/id_deployment.go index 55a493a1530..b9a8c8f2cbd 100644 --- a/resource-manager/cognitive/2023-05-01/deployments/id_deployment.go +++ b/resource-manager/cognitive/2023-05-01/deployments/id_deployment.go @@ -38,23 +38,9 @@ func ParseDeploymentID(input string) (*DeploymentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeploymentId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDeploymentIDInsensitively(input string) (*DeploymentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeploymentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DeploymentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if id.DeploymentName, ok = input.Parsed["deploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", input) } - return &id, nil + return nil } // ValidateDeploymentID checks that 'input' can be parsed as a Deployment ID diff --git a/resource-manager/cognitive/2023-05-01/models/id_location.go b/resource-manager/cognitive/2023-05-01/models/id_location.go index 4f1e97b3a38..2b6b5d8a5b1 100644 --- a/resource-manager/cognitive/2023-05-01/models/id_location.go +++ b/resource-manager/cognitive/2023-05-01/models/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/cognitive/2023-05-01/privateendpointconnections/id_account.go b/resource-manager/cognitive/2023-05-01/privateendpointconnections/id_account.go index aaa12e0d0c1..73d23f98a0e 100644 --- a/resource-manager/cognitive/2023-05-01/privateendpointconnections/id_account.go +++ b/resource-manager/cognitive/2023-05-01/privateendpointconnections/id_account.go @@ -36,19 +36,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/cognitive/2023-05-01/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/cognitive/2023-05-01/privateendpointconnections/id_privateendpointconnection.go index 1f2594b2cdb..77b37ae94c5 100644 --- a/resource-manager/cognitive/2023-05-01/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/cognitive/2023-05-01/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/cognitive/2023-05-01/privatelinkresources/id_account.go b/resource-manager/cognitive/2023-05-01/privatelinkresources/id_account.go index e74e592eb7f..2e8430f7e02 100644 --- a/resource-manager/cognitive/2023-05-01/privatelinkresources/id_account.go +++ b/resource-manager/cognitive/2023-05-01/privatelinkresources/id_account.go @@ -36,19 +36,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/cognitive/2023-05-01/usages/id_location.go b/resource-manager/cognitive/2023-05-01/usages/id_location.go index ca7264604e0..77b292d70fd 100644 --- a/resource-manager/cognitive/2023-05-01/usages/id_location.go +++ b/resource-manager/cognitive/2023-05-01/usages/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/communication/2023-03-31/communicationservices/id_communicationservice.go b/resource-manager/communication/2023-03-31/communicationservices/id_communicationservice.go index bfc7ec53aba..87d9f6a7383 100644 --- a/resource-manager/communication/2023-03-31/communicationservices/id_communicationservice.go +++ b/resource-manager/communication/2023-03-31/communicationservices/id_communicationservice.go @@ -36,19 +36,9 @@ func ParseCommunicationServiceID(input string) (*CommunicationServiceId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommunicationServiceId{} - - 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.CommunicationServiceName, ok = parsed.Parsed["communicationServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "communicationServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseCommunicationServiceIDInsensitively(input string) (*CommunicationServi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommunicationServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CommunicationServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CommunicationServiceName, ok = parsed.Parsed["communicationServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "communicationServiceName", *parsed) + if id.CommunicationServiceName, ok = input.Parsed["communicationServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "communicationServiceName", input) } - return &id, nil + return nil } // ValidateCommunicationServiceID checks that 'input' can be parsed as a Communication Service ID diff --git a/resource-manager/communication/2023-03-31/domains/id_domain.go b/resource-manager/communication/2023-03-31/domains/id_domain.go index a06b23b55a9..b65d702d489 100644 --- a/resource-manager/communication/2023-03-31/domains/id_domain.go +++ b/resource-manager/communication/2023-03-31/domains/id_domain.go @@ -38,23 +38,9 @@ func ParseDomainID(input string) (*DomainId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DomainId{} - - 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.EmailServiceName, ok = parsed.Parsed["emailServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "emailServiceName", *parsed) - } - - if id.DomainName, ok = parsed.Parsed["domainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDomainIDInsensitively(input string) (*DomainId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DomainId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DomainId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.EmailServiceName, ok = parsed.Parsed["emailServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "emailServiceName", *parsed) + if id.EmailServiceName, ok = input.Parsed["emailServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "emailServiceName", input) } - if id.DomainName, ok = parsed.Parsed["domainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainName", *parsed) + if id.DomainName, ok = input.Parsed["domainName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "domainName", input) } - return &id, nil + return nil } // ValidateDomainID checks that 'input' can be parsed as a Domain ID diff --git a/resource-manager/communication/2023-03-31/domains/id_emailservice.go b/resource-manager/communication/2023-03-31/domains/id_emailservice.go index 86507e568ab..e48bfba968a 100644 --- a/resource-manager/communication/2023-03-31/domains/id_emailservice.go +++ b/resource-manager/communication/2023-03-31/domains/id_emailservice.go @@ -36,19 +36,9 @@ func ParseEmailServiceID(input string) (*EmailServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EmailServiceId{} - - 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.EmailServiceName, ok = parsed.Parsed["emailServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "emailServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseEmailServiceIDInsensitively(input string) (*EmailServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EmailServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *EmailServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.EmailServiceName, ok = parsed.Parsed["emailServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "emailServiceName", *parsed) + if id.EmailServiceName, ok = input.Parsed["emailServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "emailServiceName", input) } - return &id, nil + return nil } // ValidateEmailServiceID checks that 'input' can be parsed as a Email Service ID diff --git a/resource-manager/communication/2023-03-31/emailservices/id_emailservice.go b/resource-manager/communication/2023-03-31/emailservices/id_emailservice.go index 3a2d023294f..d96232e8634 100644 --- a/resource-manager/communication/2023-03-31/emailservices/id_emailservice.go +++ b/resource-manager/communication/2023-03-31/emailservices/id_emailservice.go @@ -36,19 +36,9 @@ func ParseEmailServiceID(input string) (*EmailServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EmailServiceId{} - - 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.EmailServiceName, ok = parsed.Parsed["emailServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "emailServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseEmailServiceIDInsensitively(input string) (*EmailServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EmailServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *EmailServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.EmailServiceName, ok = parsed.Parsed["emailServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "emailServiceName", *parsed) + if id.EmailServiceName, ok = input.Parsed["emailServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "emailServiceName", input) } - return &id, nil + return nil } // ValidateEmailServiceID checks that 'input' can be parsed as a Email Service ID diff --git a/resource-manager/communication/2023-03-31/senderusernames/id_domain.go b/resource-manager/communication/2023-03-31/senderusernames/id_domain.go index ddc63d36770..99cd3d89cd9 100644 --- a/resource-manager/communication/2023-03-31/senderusernames/id_domain.go +++ b/resource-manager/communication/2023-03-31/senderusernames/id_domain.go @@ -38,23 +38,9 @@ func ParseDomainID(input string) (*DomainId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DomainId{} - - 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.EmailServiceName, ok = parsed.Parsed["emailServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "emailServiceName", *parsed) - } - - if id.DomainName, ok = parsed.Parsed["domainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDomainIDInsensitively(input string) (*DomainId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DomainId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DomainId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.EmailServiceName, ok = parsed.Parsed["emailServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "emailServiceName", *parsed) + if id.EmailServiceName, ok = input.Parsed["emailServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "emailServiceName", input) } - if id.DomainName, ok = parsed.Parsed["domainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainName", *parsed) + if id.DomainName, ok = input.Parsed["domainName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "domainName", input) } - return &id, nil + return nil } // ValidateDomainID checks that 'input' can be parsed as a Domain ID diff --git a/resource-manager/communication/2023-03-31/senderusernames/id_senderusername.go b/resource-manager/communication/2023-03-31/senderusernames/id_senderusername.go index d1d83eb4cfb..0bb21ebd947 100644 --- a/resource-manager/communication/2023-03-31/senderusernames/id_senderusername.go +++ b/resource-manager/communication/2023-03-31/senderusernames/id_senderusername.go @@ -40,27 +40,9 @@ func ParseSenderUsernameID(input string) (*SenderUsernameId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SenderUsernameId{} - - 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.EmailServiceName, ok = parsed.Parsed["emailServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "emailServiceName", *parsed) - } - - if id.DomainName, ok = parsed.Parsed["domainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainName", *parsed) - } - - if id.SenderUsernameName, ok = parsed.Parsed["senderUsernameName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "senderUsernameName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSenderUsernameIDInsensitively(input string) (*SenderUsernameId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SenderUsernameId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SenderUsernameId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.EmailServiceName, ok = parsed.Parsed["emailServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "emailServiceName", *parsed) + if id.EmailServiceName, ok = input.Parsed["emailServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "emailServiceName", input) } - if id.DomainName, ok = parsed.Parsed["domainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainName", *parsed) + if id.DomainName, ok = input.Parsed["domainName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "domainName", input) } - if id.SenderUsernameName, ok = parsed.Parsed["senderUsernameName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "senderUsernameName", *parsed) + if id.SenderUsernameName, ok = input.Parsed["senderUsernameName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "senderUsernameName", input) } - return &id, nil + return nil } // ValidateSenderUsernameID checks that 'input' can be parsed as a Sender Username ID diff --git a/resource-manager/communication/2023-04-01/communicationservices/id_communicationservice.go b/resource-manager/communication/2023-04-01/communicationservices/id_communicationservice.go index bfc7ec53aba..87d9f6a7383 100644 --- a/resource-manager/communication/2023-04-01/communicationservices/id_communicationservice.go +++ b/resource-manager/communication/2023-04-01/communicationservices/id_communicationservice.go @@ -36,19 +36,9 @@ func ParseCommunicationServiceID(input string) (*CommunicationServiceId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommunicationServiceId{} - - 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.CommunicationServiceName, ok = parsed.Parsed["communicationServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "communicationServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseCommunicationServiceIDInsensitively(input string) (*CommunicationServi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommunicationServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CommunicationServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CommunicationServiceName, ok = parsed.Parsed["communicationServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "communicationServiceName", *parsed) + if id.CommunicationServiceName, ok = input.Parsed["communicationServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "communicationServiceName", input) } - return &id, nil + return nil } // ValidateCommunicationServiceID checks that 'input' can be parsed as a Communication Service ID diff --git a/resource-manager/communication/2023-04-01/domains/id_domain.go b/resource-manager/communication/2023-04-01/domains/id_domain.go index a06b23b55a9..b65d702d489 100644 --- a/resource-manager/communication/2023-04-01/domains/id_domain.go +++ b/resource-manager/communication/2023-04-01/domains/id_domain.go @@ -38,23 +38,9 @@ func ParseDomainID(input string) (*DomainId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DomainId{} - - 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.EmailServiceName, ok = parsed.Parsed["emailServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "emailServiceName", *parsed) - } - - if id.DomainName, ok = parsed.Parsed["domainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDomainIDInsensitively(input string) (*DomainId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DomainId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DomainId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.EmailServiceName, ok = parsed.Parsed["emailServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "emailServiceName", *parsed) + if id.EmailServiceName, ok = input.Parsed["emailServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "emailServiceName", input) } - if id.DomainName, ok = parsed.Parsed["domainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainName", *parsed) + if id.DomainName, ok = input.Parsed["domainName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "domainName", input) } - return &id, nil + return nil } // ValidateDomainID checks that 'input' can be parsed as a Domain ID diff --git a/resource-manager/communication/2023-04-01/domains/id_emailservice.go b/resource-manager/communication/2023-04-01/domains/id_emailservice.go index 86507e568ab..e48bfba968a 100644 --- a/resource-manager/communication/2023-04-01/domains/id_emailservice.go +++ b/resource-manager/communication/2023-04-01/domains/id_emailservice.go @@ -36,19 +36,9 @@ func ParseEmailServiceID(input string) (*EmailServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EmailServiceId{} - - 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.EmailServiceName, ok = parsed.Parsed["emailServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "emailServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseEmailServiceIDInsensitively(input string) (*EmailServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EmailServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *EmailServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.EmailServiceName, ok = parsed.Parsed["emailServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "emailServiceName", *parsed) + if id.EmailServiceName, ok = input.Parsed["emailServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "emailServiceName", input) } - return &id, nil + return nil } // ValidateEmailServiceID checks that 'input' can be parsed as a Email Service ID diff --git a/resource-manager/communication/2023-04-01/emailservices/id_emailservice.go b/resource-manager/communication/2023-04-01/emailservices/id_emailservice.go index 3a2d023294f..d96232e8634 100644 --- a/resource-manager/communication/2023-04-01/emailservices/id_emailservice.go +++ b/resource-manager/communication/2023-04-01/emailservices/id_emailservice.go @@ -36,19 +36,9 @@ func ParseEmailServiceID(input string) (*EmailServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EmailServiceId{} - - 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.EmailServiceName, ok = parsed.Parsed["emailServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "emailServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseEmailServiceIDInsensitively(input string) (*EmailServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EmailServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *EmailServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.EmailServiceName, ok = parsed.Parsed["emailServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "emailServiceName", *parsed) + if id.EmailServiceName, ok = input.Parsed["emailServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "emailServiceName", input) } - return &id, nil + return nil } // ValidateEmailServiceID checks that 'input' can be parsed as a Email Service ID diff --git a/resource-manager/communication/2023-04-01/senderusernames/id_domain.go b/resource-manager/communication/2023-04-01/senderusernames/id_domain.go index ddc63d36770..99cd3d89cd9 100644 --- a/resource-manager/communication/2023-04-01/senderusernames/id_domain.go +++ b/resource-manager/communication/2023-04-01/senderusernames/id_domain.go @@ -38,23 +38,9 @@ func ParseDomainID(input string) (*DomainId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DomainId{} - - 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.EmailServiceName, ok = parsed.Parsed["emailServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "emailServiceName", *parsed) - } - - if id.DomainName, ok = parsed.Parsed["domainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDomainIDInsensitively(input string) (*DomainId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DomainId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DomainId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.EmailServiceName, ok = parsed.Parsed["emailServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "emailServiceName", *parsed) + if id.EmailServiceName, ok = input.Parsed["emailServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "emailServiceName", input) } - if id.DomainName, ok = parsed.Parsed["domainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainName", *parsed) + if id.DomainName, ok = input.Parsed["domainName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "domainName", input) } - return &id, nil + return nil } // ValidateDomainID checks that 'input' can be parsed as a Domain ID diff --git a/resource-manager/communication/2023-04-01/senderusernames/id_senderusername.go b/resource-manager/communication/2023-04-01/senderusernames/id_senderusername.go index d1d83eb4cfb..0bb21ebd947 100644 --- a/resource-manager/communication/2023-04-01/senderusernames/id_senderusername.go +++ b/resource-manager/communication/2023-04-01/senderusernames/id_senderusername.go @@ -40,27 +40,9 @@ func ParseSenderUsernameID(input string) (*SenderUsernameId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SenderUsernameId{} - - 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.EmailServiceName, ok = parsed.Parsed["emailServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "emailServiceName", *parsed) - } - - if id.DomainName, ok = parsed.Parsed["domainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainName", *parsed) - } - - if id.SenderUsernameName, ok = parsed.Parsed["senderUsernameName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "senderUsernameName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSenderUsernameIDInsensitively(input string) (*SenderUsernameId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SenderUsernameId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SenderUsernameId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.EmailServiceName, ok = parsed.Parsed["emailServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "emailServiceName", *parsed) + if id.EmailServiceName, ok = input.Parsed["emailServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "emailServiceName", input) } - if id.DomainName, ok = parsed.Parsed["domainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainName", *parsed) + if id.DomainName, ok = input.Parsed["domainName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "domainName", input) } - if id.SenderUsernameName, ok = parsed.Parsed["senderUsernameName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "senderUsernameName", *parsed) + if id.SenderUsernameName, ok = input.Parsed["senderUsernameName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "senderUsernameName", input) } - return &id, nil + return nil } // ValidateSenderUsernameID checks that 'input' can be parsed as a Sender Username ID diff --git a/resource-manager/compute/2021-07-01/capacityreservation/id_capacityreservationgroup.go b/resource-manager/compute/2021-07-01/capacityreservation/id_capacityreservationgroup.go index 4c5b6bbd697..56ded1c940b 100644 --- a/resource-manager/compute/2021-07-01/capacityreservation/id_capacityreservationgroup.go +++ b/resource-manager/compute/2021-07-01/capacityreservation/id_capacityreservationgroup.go @@ -36,19 +36,9 @@ func ParseCapacityReservationGroupID(input string) (*CapacityReservationGroupId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapacityReservationGroupId{} - - 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.CapacityReservationGroupName, ok = parsed.Parsed["capacityReservationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseCapacityReservationGroupIDInsensitively(input string) (*CapacityReserv return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapacityReservationGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CapacityReservationGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CapacityReservationGroupName, ok = parsed.Parsed["capacityReservationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationGroupName", *parsed) + if id.CapacityReservationGroupName, ok = input.Parsed["capacityReservationGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationGroupName", input) } - return &id, nil + return nil } // ValidateCapacityReservationGroupID checks that 'input' can be parsed as a Capacity Reservation Group ID diff --git a/resource-manager/compute/2021-07-01/capacityreservationgroups/id_capacityreservationgroup.go b/resource-manager/compute/2021-07-01/capacityreservationgroups/id_capacityreservationgroup.go index b974029515e..725ce39f033 100644 --- a/resource-manager/compute/2021-07-01/capacityreservationgroups/id_capacityreservationgroup.go +++ b/resource-manager/compute/2021-07-01/capacityreservationgroups/id_capacityreservationgroup.go @@ -36,19 +36,9 @@ func ParseCapacityReservationGroupID(input string) (*CapacityReservationGroupId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapacityReservationGroupId{} - - 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.CapacityReservationGroupName, ok = parsed.Parsed["capacityReservationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseCapacityReservationGroupIDInsensitively(input string) (*CapacityReserv return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapacityReservationGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CapacityReservationGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CapacityReservationGroupName, ok = parsed.Parsed["capacityReservationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationGroupName", *parsed) + if id.CapacityReservationGroupName, ok = input.Parsed["capacityReservationGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationGroupName", input) } - return &id, nil + return nil } // ValidateCapacityReservationGroupID checks that 'input' can be parsed as a Capacity Reservation Group ID diff --git a/resource-manager/compute/2021-07-01/capacityreservations/id_capacityreservation.go b/resource-manager/compute/2021-07-01/capacityreservations/id_capacityreservation.go index df25394758f..ac78ccbcc3e 100644 --- a/resource-manager/compute/2021-07-01/capacityreservations/id_capacityreservation.go +++ b/resource-manager/compute/2021-07-01/capacityreservations/id_capacityreservation.go @@ -38,23 +38,9 @@ func ParseCapacityReservationID(input string) (*CapacityReservationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapacityReservationId{} - - 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.CapacityReservationGroupName, ok = parsed.Parsed["capacityReservationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationGroupName", *parsed) - } - - if id.CapacityReservationName, ok = parsed.Parsed["capacityReservationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCapacityReservationIDInsensitively(input string) (*CapacityReservation return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapacityReservationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CapacityReservationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CapacityReservationGroupName, ok = parsed.Parsed["capacityReservationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationGroupName", *parsed) + if id.CapacityReservationGroupName, ok = input.Parsed["capacityReservationGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationGroupName", input) } - if id.CapacityReservationName, ok = parsed.Parsed["capacityReservationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationName", *parsed) + if id.CapacityReservationName, ok = input.Parsed["capacityReservationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationName", input) } - return &id, nil + return nil } // ValidateCapacityReservationID checks that 'input' can be parsed as a Capacity Reservation ID diff --git a/resource-manager/compute/2021-07-01/communitygalleries/id_communitygallery.go b/resource-manager/compute/2021-07-01/communitygalleries/id_communitygallery.go index e09a3fe35f4..bc2ebbcec12 100644 --- a/resource-manager/compute/2021-07-01/communitygalleries/id_communitygallery.go +++ b/resource-manager/compute/2021-07-01/communitygalleries/id_communitygallery.go @@ -36,19 +36,9 @@ func ParseCommunityGalleryID(input string) (*CommunityGalleryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommunityGalleryId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.CommunityGalleryName, ok = parsed.Parsed["communityGalleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "communityGalleryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseCommunityGalleryIDInsensitively(input string) (*CommunityGalleryId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommunityGalleryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CommunityGalleryId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.CommunityGalleryName, ok = parsed.Parsed["communityGalleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "communityGalleryName", *parsed) + if id.CommunityGalleryName, ok = input.Parsed["communityGalleryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "communityGalleryName", input) } - return &id, nil + return nil } // ValidateCommunityGalleryID checks that 'input' can be parsed as a Community Gallery ID diff --git a/resource-manager/compute/2021-07-01/communitygalleryimages/id_communitygalleryimage.go b/resource-manager/compute/2021-07-01/communitygalleryimages/id_communitygalleryimage.go index a0b84d3b21f..3cd48e13cd4 100644 --- a/resource-manager/compute/2021-07-01/communitygalleryimages/id_communitygalleryimage.go +++ b/resource-manager/compute/2021-07-01/communitygalleryimages/id_communitygalleryimage.go @@ -38,23 +38,9 @@ func ParseCommunityGalleryImageID(input string) (*CommunityGalleryImageId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommunityGalleryImageId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.CommunityGalleryName, ok = parsed.Parsed["communityGalleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "communityGalleryName", *parsed) - } - - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCommunityGalleryImageIDInsensitively(input string) (*CommunityGalleryI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool 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.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.CommunityGalleryName, ok = parsed.Parsed["communityGalleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "communityGalleryName", *parsed) + if id.CommunityGalleryName, ok = input.Parsed["communityGalleryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "communityGalleryName", input) } - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) + if id.ImageName, ok = input.Parsed["imageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "imageName", input) } - return &id, nil + return nil } // ValidateCommunityGalleryImageID checks that 'input' can be parsed as a Community Gallery Image ID diff --git a/resource-manager/compute/2021-07-01/communitygalleryimageversions/id_communitygalleryimageversion.go b/resource-manager/compute/2021-07-01/communitygalleryimageversions/id_communitygalleryimageversion.go index 23649c53fd7..3253b949939 100644 --- a/resource-manager/compute/2021-07-01/communitygalleryimageversions/id_communitygalleryimageversion.go +++ b/resource-manager/compute/2021-07-01/communitygalleryimageversions/id_communitygalleryimageversion.go @@ -40,27 +40,9 @@ func ParseCommunityGalleryImageVersionID(input string) (*CommunityGalleryImageVe return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommunityGalleryImageVersionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.CommunityGalleryName, ok = parsed.Parsed["communityGalleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "communityGalleryName", *parsed) - } - - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseCommunityGalleryImageVersionIDInsensitively(input string) (*CommunityG return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommunityGalleryImageVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *CommunityGalleryImageVersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.CommunityGalleryName, ok = parsed.Parsed["communityGalleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "communityGalleryName", *parsed) + if id.CommunityGalleryName, ok = input.Parsed["communityGalleryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "communityGalleryName", input) } - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) + if id.ImageName, ok = input.Parsed["imageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "imageName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateCommunityGalleryImageVersionID checks that 'input' can be parsed as a Community Gallery Image Version ID diff --git a/resource-manager/compute/2021-07-01/compute/id_restorepoint.go b/resource-manager/compute/2021-07-01/compute/id_restorepoint.go index 48e84f22683..e820b95604f 100644 --- a/resource-manager/compute/2021-07-01/compute/id_restorepoint.go +++ b/resource-manager/compute/2021-07-01/compute/id_restorepoint.go @@ -38,23 +38,9 @@ func ParseRestorePointID(input string) (*RestorePointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RestorePointId{} - - 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.RestorePointCollectionName, ok = parsed.Parsed["restorePointCollectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorePointCollectionName", *parsed) - } - - if id.RestorePointName, ok = parsed.Parsed["restorePointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorePointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRestorePointIDInsensitively(input string) (*RestorePointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RestorePointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RestorePointId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RestorePointCollectionName, ok = parsed.Parsed["restorePointCollectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorePointCollectionName", *parsed) + if id.RestorePointCollectionName, ok = input.Parsed["restorePointCollectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "restorePointCollectionName", input) } - if id.RestorePointName, ok = parsed.Parsed["restorePointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorePointName", *parsed) + if id.RestorePointName, ok = input.Parsed["restorePointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "restorePointName", input) } - return &id, nil + return nil } // ValidateRestorePointID checks that 'input' can be parsed as a Restore Point ID diff --git a/resource-manager/compute/2021-07-01/dedicatedhost/id_hostgroup.go b/resource-manager/compute/2021-07-01/dedicatedhost/id_hostgroup.go index 98371d9147a..4cc57240984 100644 --- a/resource-manager/compute/2021-07-01/dedicatedhost/id_hostgroup.go +++ b/resource-manager/compute/2021-07-01/dedicatedhost/id_hostgroup.go @@ -36,19 +36,9 @@ func ParseHostGroupID(input string) (*HostGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostGroupId{} - - 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.HostGroupName, ok = parsed.Parsed["hostGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseHostGroupIDInsensitively(input string) (*HostGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *HostGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostGroupName, ok = parsed.Parsed["hostGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostGroupName", *parsed) + if id.HostGroupName, ok = input.Parsed["hostGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostGroupName", input) } - return &id, nil + return nil } // ValidateHostGroupID checks that 'input' can be parsed as a Host Group ID diff --git a/resource-manager/compute/2021-07-01/dedicatedhostgroups/id_hostgroup.go b/resource-manager/compute/2021-07-01/dedicatedhostgroups/id_hostgroup.go index 74523582952..fea78a50c47 100644 --- a/resource-manager/compute/2021-07-01/dedicatedhostgroups/id_hostgroup.go +++ b/resource-manager/compute/2021-07-01/dedicatedhostgroups/id_hostgroup.go @@ -36,19 +36,9 @@ func ParseHostGroupID(input string) (*HostGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostGroupId{} - - 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.HostGroupName, ok = parsed.Parsed["hostGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseHostGroupIDInsensitively(input string) (*HostGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *HostGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostGroupName, ok = parsed.Parsed["hostGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostGroupName", *parsed) + if id.HostGroupName, ok = input.Parsed["hostGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostGroupName", input) } - return &id, nil + return nil } // ValidateHostGroupID checks that 'input' can be parsed as a Host Group ID diff --git a/resource-manager/compute/2021-07-01/dedicatedhosts/id_host.go b/resource-manager/compute/2021-07-01/dedicatedhosts/id_host.go index 762971eb041..4a087b87639 100644 --- a/resource-manager/compute/2021-07-01/dedicatedhosts/id_host.go +++ b/resource-manager/compute/2021-07-01/dedicatedhosts/id_host.go @@ -38,23 +38,9 @@ func ParseHostID(input string) (*HostId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostId{} - - 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.HostGroupName, ok = parsed.Parsed["hostGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostGroupName", *parsed) - } - - if id.HostName, ok = parsed.Parsed["hostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseHostIDInsensitively(input string) (*HostId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *HostId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostGroupName, ok = parsed.Parsed["hostGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostGroupName", *parsed) + if id.HostGroupName, ok = input.Parsed["hostGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostGroupName", input) } - if id.HostName, ok = parsed.Parsed["hostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostName", *parsed) + if id.HostName, ok = input.Parsed["hostName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostName", input) } - return &id, nil + return nil } // ValidateHostID checks that 'input' can be parsed as a Host ID diff --git a/resource-manager/compute/2021-07-01/galleryapplications/id_application.go b/resource-manager/compute/2021-07-01/galleryapplications/id_application.go index 8cfa3845ad5..e25e3c30008 100644 --- a/resource-manager/compute/2021-07-01/galleryapplications/id_application.go +++ b/resource-manager/compute/2021-07-01/galleryapplications/id_application.go @@ -38,23 +38,9 @@ func ParseApplicationID(input string) (*ApplicationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationId{} - - 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) - } - - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApplicationIDInsensitively(input string) (*ApplicationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApplicationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.GalleryName, ok = parsed.Parsed["galleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "galleryName", *parsed) + if id.GalleryName, ok = input.Parsed["galleryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "galleryName", input) } - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) + if id.ApplicationName, ok = input.Parsed["applicationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationName", input) } - return &id, nil + return nil } // ValidateApplicationID checks that 'input' can be parsed as a Application ID diff --git a/resource-manager/compute/2021-07-01/galleryapplicationversions/id_application.go b/resource-manager/compute/2021-07-01/galleryapplicationversions/id_application.go index 4b14e9a9b14..8065846d94a 100644 --- a/resource-manager/compute/2021-07-01/galleryapplicationversions/id_application.go +++ b/resource-manager/compute/2021-07-01/galleryapplicationversions/id_application.go @@ -38,23 +38,9 @@ func ParseApplicationID(input string) (*ApplicationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationId{} - - 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) - } - - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApplicationIDInsensitively(input string) (*ApplicationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApplicationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.GalleryName, ok = parsed.Parsed["galleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "galleryName", *parsed) + if id.GalleryName, ok = input.Parsed["galleryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "galleryName", input) } - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) + if id.ApplicationName, ok = input.Parsed["applicationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationName", input) } - return &id, nil + return nil } // ValidateApplicationID checks that 'input' can be parsed as a Application ID diff --git a/resource-manager/compute/2021-07-01/galleryapplicationversions/id_applicationversion.go b/resource-manager/compute/2021-07-01/galleryapplicationversions/id_applicationversion.go index 3a625169a43..7da1557e4c4 100644 --- a/resource-manager/compute/2021-07-01/galleryapplicationversions/id_applicationversion.go +++ b/resource-manager/compute/2021-07-01/galleryapplicationversions/id_applicationversion.go @@ -40,27 +40,9 @@ func ParseApplicationVersionID(input string) (*ApplicationVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationVersionId{} - - 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) - } - - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseApplicationVersionIDInsensitively(input string) (*ApplicationVersionId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ApplicationVersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.GalleryName, ok = parsed.Parsed["galleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "galleryName", *parsed) + if id.GalleryName, ok = input.Parsed["galleryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "galleryName", input) } - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) + if id.ApplicationName, ok = input.Parsed["applicationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateApplicationVersionID checks that 'input' can be parsed as a Application Version ID diff --git a/resource-manager/compute/2021-07-01/galleryimages/id_galleryimage.go b/resource-manager/compute/2021-07-01/galleryimages/id_galleryimage.go index fa85b61fc46..61485503fdc 100644 --- a/resource-manager/compute/2021-07-01/galleryimages/id_galleryimage.go +++ b/resource-manager/compute/2021-07-01/galleryimages/id_galleryimage.go @@ -38,23 +38,9 @@ func ParseGalleryImageID(input string) (*GalleryImageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GalleryImageId{} - - 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) - } - - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGalleryImageIDInsensitively(input string) (*GalleryImageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GalleryImageId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GalleryImageId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.GalleryName, ok = parsed.Parsed["galleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "galleryName", *parsed) + if id.GalleryName, ok = input.Parsed["galleryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "galleryName", input) } - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) + if id.ImageName, ok = input.Parsed["imageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "imageName", input) } - return &id, nil + return nil } // ValidateGalleryImageID checks that 'input' can be parsed as a Gallery Image ID diff --git a/resource-manager/compute/2021-07-01/galleryimageversions/id_galleryimage.go b/resource-manager/compute/2021-07-01/galleryimageversions/id_galleryimage.go index 5a618f37727..523e7b77c4b 100644 --- a/resource-manager/compute/2021-07-01/galleryimageversions/id_galleryimage.go +++ b/resource-manager/compute/2021-07-01/galleryimageversions/id_galleryimage.go @@ -38,23 +38,9 @@ func ParseGalleryImageID(input string) (*GalleryImageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GalleryImageId{} - - 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) - } - - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGalleryImageIDInsensitively(input string) (*GalleryImageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GalleryImageId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GalleryImageId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.GalleryName, ok = parsed.Parsed["galleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "galleryName", *parsed) + if id.GalleryName, ok = input.Parsed["galleryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "galleryName", input) } - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) + if id.ImageName, ok = input.Parsed["imageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "imageName", input) } - return &id, nil + return nil } // ValidateGalleryImageID checks that 'input' can be parsed as a Gallery Image ID diff --git a/resource-manager/compute/2021-07-01/galleryimageversions/id_imageversion.go b/resource-manager/compute/2021-07-01/galleryimageversions/id_imageversion.go index f93bf8d6de6..31e521b0eaf 100644 --- a/resource-manager/compute/2021-07-01/galleryimageversions/id_imageversion.go +++ b/resource-manager/compute/2021-07-01/galleryimageversions/id_imageversion.go @@ -40,27 +40,9 @@ func ParseImageVersionID(input string) (*ImageVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ImageVersionId{} - - 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) - } - - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseImageVersionIDInsensitively(input string) (*ImageVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ImageVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ImageVersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.GalleryName, ok = parsed.Parsed["galleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "galleryName", *parsed) + if id.GalleryName, ok = input.Parsed["galleryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "galleryName", input) } - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) + if id.ImageName, ok = input.Parsed["imageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "imageName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateImageVersionID checks that 'input' can be parsed as a Image Version ID diff --git a/resource-manager/compute/2021-07-01/images/id_image.go b/resource-manager/compute/2021-07-01/images/id_image.go index 048dbeac923..bd84d2f6092 100644 --- a/resource-manager/compute/2021-07-01/images/id_image.go +++ b/resource-manager/compute/2021-07-01/images/id_image.go @@ -36,19 +36,9 @@ func ParseImageID(input string) (*ImageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ImageId{} - - 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.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseImageIDInsensitively(input string) (*ImageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ImageId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ImageId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) + if id.ImageName, ok = input.Parsed["imageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "imageName", input) } - return &id, nil + return nil } // ValidateImageID checks that 'input' can be parsed as a Image ID diff --git a/resource-manager/compute/2021-07-01/loganalytics/id_location.go b/resource-manager/compute/2021-07-01/loganalytics/id_location.go index 9f246f8486e..fba54496f0a 100644 --- a/resource-manager/compute/2021-07-01/loganalytics/id_location.go +++ b/resource-manager/compute/2021-07-01/loganalytics/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/compute/2021-07-01/proximityplacementgroups/id_proximityplacementgroup.go b/resource-manager/compute/2021-07-01/proximityplacementgroups/id_proximityplacementgroup.go index b220644fa11..1232e950c85 100644 --- a/resource-manager/compute/2021-07-01/proximityplacementgroups/id_proximityplacementgroup.go +++ b/resource-manager/compute/2021-07-01/proximityplacementgroups/id_proximityplacementgroup.go @@ -36,19 +36,9 @@ func ParseProximityPlacementGroupID(input string) (*ProximityPlacementGroupId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProximityPlacementGroupId{} - - 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.ProximityPlacementGroupName, ok = parsed.Parsed["proximityPlacementGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "proximityPlacementGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProximityPlacementGroupIDInsensitively(input string) (*ProximityPlacem return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProximityPlacementGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProximityPlacementGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ProximityPlacementGroupName, ok = parsed.Parsed["proximityPlacementGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "proximityPlacementGroupName", *parsed) + if id.ProximityPlacementGroupName, ok = input.Parsed["proximityPlacementGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "proximityPlacementGroupName", input) } - return &id, nil + return nil } // ValidateProximityPlacementGroupID checks that 'input' can be parsed as a Proximity Placement Group ID diff --git a/resource-manager/compute/2021-07-01/restorepointcollections/id_restorepointcollection.go b/resource-manager/compute/2021-07-01/restorepointcollections/id_restorepointcollection.go index a51a6398432..9f496b37f89 100644 --- a/resource-manager/compute/2021-07-01/restorepointcollections/id_restorepointcollection.go +++ b/resource-manager/compute/2021-07-01/restorepointcollections/id_restorepointcollection.go @@ -36,19 +36,9 @@ func ParseRestorePointCollectionID(input string) (*RestorePointCollectionId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RestorePointCollectionId{} - - 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.RestorePointCollectionName, ok = parsed.Parsed["restorePointCollectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorePointCollectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRestorePointCollectionIDInsensitively(input string) (*RestorePointColl return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RestorePointCollectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RestorePointCollectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RestorePointCollectionName, ok = parsed.Parsed["restorePointCollectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorePointCollectionName", *parsed) + if id.RestorePointCollectionName, ok = input.Parsed["restorePointCollectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "restorePointCollectionName", input) } - return &id, nil + return nil } // ValidateRestorePointCollectionID checks that 'input' can be parsed as a Restore Point Collection ID diff --git a/resource-manager/compute/2021-07-01/sharedgalleries/id_location.go b/resource-manager/compute/2021-07-01/sharedgalleries/id_location.go index a9a2ea91b3c..640cca67e04 100644 --- a/resource-manager/compute/2021-07-01/sharedgalleries/id_location.go +++ b/resource-manager/compute/2021-07-01/sharedgalleries/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/compute/2021-07-01/sharedgalleries/id_sharedgallery.go b/resource-manager/compute/2021-07-01/sharedgalleries/id_sharedgallery.go index 232d58c40e2..89f2500e577 100644 --- a/resource-manager/compute/2021-07-01/sharedgalleries/id_sharedgallery.go +++ b/resource-manager/compute/2021-07-01/sharedgalleries/id_sharedgallery.go @@ -36,19 +36,9 @@ func ParseSharedGalleryID(input string) (*SharedGalleryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SharedGalleryId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.SharedGalleryName, ok = parsed.Parsed["sharedGalleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sharedGalleryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSharedGalleryIDInsensitively(input string) (*SharedGalleryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SharedGalleryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SharedGalleryId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.SharedGalleryName, ok = parsed.Parsed["sharedGalleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sharedGalleryName", *parsed) + if id.SharedGalleryName, ok = input.Parsed["sharedGalleryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sharedGalleryName", input) } - return &id, nil + return nil } // ValidateSharedGalleryID checks that 'input' can be parsed as a Shared Gallery ID diff --git a/resource-manager/compute/2021-07-01/sharedgalleryimages/id_image.go b/resource-manager/compute/2021-07-01/sharedgalleryimages/id_image.go index b36b143903f..2fcd53161fb 100644 --- a/resource-manager/compute/2021-07-01/sharedgalleryimages/id_image.go +++ b/resource-manager/compute/2021-07-01/sharedgalleryimages/id_image.go @@ -38,23 +38,9 @@ func ParseImageID(input string) (*ImageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ImageId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.SharedGalleryName, ok = parsed.Parsed["sharedGalleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sharedGalleryName", *parsed) - } - - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseImageIDInsensitively(input string) (*ImageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ImageId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ImageId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.SharedGalleryName, ok = parsed.Parsed["sharedGalleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sharedGalleryName", *parsed) + if id.SharedGalleryName, ok = input.Parsed["sharedGalleryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sharedGalleryName", input) } - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) + if id.ImageName, ok = input.Parsed["imageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "imageName", input) } - return &id, nil + return nil } // ValidateImageID checks that 'input' can be parsed as a Image ID diff --git a/resource-manager/compute/2021-07-01/sharedgalleryimages/id_sharedgallery.go b/resource-manager/compute/2021-07-01/sharedgalleryimages/id_sharedgallery.go index 8a17ecc45ce..75c58cfe40b 100644 --- a/resource-manager/compute/2021-07-01/sharedgalleryimages/id_sharedgallery.go +++ b/resource-manager/compute/2021-07-01/sharedgalleryimages/id_sharedgallery.go @@ -36,19 +36,9 @@ func ParseSharedGalleryID(input string) (*SharedGalleryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SharedGalleryId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.SharedGalleryName, ok = parsed.Parsed["sharedGalleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sharedGalleryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSharedGalleryIDInsensitively(input string) (*SharedGalleryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SharedGalleryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SharedGalleryId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.SharedGalleryName, ok = parsed.Parsed["sharedGalleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sharedGalleryName", *parsed) + if id.SharedGalleryName, ok = input.Parsed["sharedGalleryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sharedGalleryName", input) } - return &id, nil + return nil } // ValidateSharedGalleryID checks that 'input' can be parsed as a Shared Gallery ID diff --git a/resource-manager/compute/2021-07-01/sharedgalleryimageversions/id_image.go b/resource-manager/compute/2021-07-01/sharedgalleryimageversions/id_image.go index d73a83bfbc0..bfb3358ea0a 100644 --- a/resource-manager/compute/2021-07-01/sharedgalleryimageversions/id_image.go +++ b/resource-manager/compute/2021-07-01/sharedgalleryimageversions/id_image.go @@ -38,23 +38,9 @@ func ParseImageID(input string) (*ImageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ImageId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.SharedGalleryName, ok = parsed.Parsed["sharedGalleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sharedGalleryName", *parsed) - } - - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseImageIDInsensitively(input string) (*ImageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ImageId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ImageId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.SharedGalleryName, ok = parsed.Parsed["sharedGalleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sharedGalleryName", *parsed) + if id.SharedGalleryName, ok = input.Parsed["sharedGalleryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sharedGalleryName", input) } - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) + if id.ImageName, ok = input.Parsed["imageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "imageName", input) } - return &id, nil + return nil } // ValidateImageID checks that 'input' can be parsed as a Image ID diff --git a/resource-manager/compute/2021-07-01/sharedgalleryimageversions/id_version.go b/resource-manager/compute/2021-07-01/sharedgalleryimageversions/id_version.go index 4b8f5a9f4db..b2d435f07bc 100644 --- a/resource-manager/compute/2021-07-01/sharedgalleryimageversions/id_version.go +++ b/resource-manager/compute/2021-07-01/sharedgalleryimageversions/id_version.go @@ -40,27 +40,9 @@ func ParseVersionID(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.SharedGalleryName, ok = parsed.Parsed["sharedGalleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sharedGalleryName", *parsed) - } - - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVersionIDInsensitively(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.SharedGalleryName, ok = parsed.Parsed["sharedGalleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sharedGalleryName", *parsed) + if id.SharedGalleryName, ok = input.Parsed["sharedGalleryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sharedGalleryName", input) } - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) + if id.ImageName, ok = input.Parsed["imageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "imageName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateVersionID checks that 'input' can be parsed as a Version ID diff --git a/resource-manager/compute/2021-07-01/sshpublickeys/id_sshpublickey.go b/resource-manager/compute/2021-07-01/sshpublickeys/id_sshpublickey.go index 9c7f9ae62ba..9e9ee5ff0f6 100644 --- a/resource-manager/compute/2021-07-01/sshpublickeys/id_sshpublickey.go +++ b/resource-manager/compute/2021-07-01/sshpublickeys/id_sshpublickey.go @@ -36,19 +36,9 @@ func ParseSshPublicKeyID(input string) (*SshPublicKeyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SshPublicKeyId{} - - 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.SshPublicKeyName, ok = parsed.Parsed["sshPublicKeyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sshPublicKeyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSshPublicKeyIDInsensitively(input string) (*SshPublicKeyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SshPublicKeyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SshPublicKeyId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SshPublicKeyName, ok = parsed.Parsed["sshPublicKeyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sshPublicKeyName", *parsed) + if id.SshPublicKeyName, ok = input.Parsed["sshPublicKeyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sshPublicKeyName", input) } - return &id, nil + return nil } // ValidateSshPublicKeyID checks that 'input' can be parsed as a Ssh Public Key ID diff --git a/resource-manager/compute/2021-07-01/virtualmachineextensionimages/id_publisher.go b/resource-manager/compute/2021-07-01/virtualmachineextensionimages/id_publisher.go index b45241d6952..573fe07895b 100644 --- a/resource-manager/compute/2021-07-01/virtualmachineextensionimages/id_publisher.go +++ b/resource-manager/compute/2021-07-01/virtualmachineextensionimages/id_publisher.go @@ -36,19 +36,9 @@ func ParsePublisherID(input string) (*PublisherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PublisherId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePublisherIDInsensitively(input string) (*PublisherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PublisherId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PublisherId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - return &id, nil + return nil } // ValidatePublisherID checks that 'input' can be parsed as a Publisher ID diff --git a/resource-manager/compute/2021-07-01/virtualmachineextensionimages/id_type.go b/resource-manager/compute/2021-07-01/virtualmachineextensionimages/id_type.go index 95a118e7bca..90477651f07 100644 --- a/resource-manager/compute/2021-07-01/virtualmachineextensionimages/id_type.go +++ b/resource-manager/compute/2021-07-01/virtualmachineextensionimages/id_type.go @@ -38,23 +38,9 @@ func ParseTypeID(input string) (*TypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TypeId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) - } - - if id.TypeName, ok = parsed.Parsed["typeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "typeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTypeIDInsensitively(input string) (*TypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - if id.TypeName, ok = parsed.Parsed["typeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "typeName", *parsed) + if id.TypeName, ok = input.Parsed["typeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "typeName", input) } - return &id, nil + return nil } // ValidateTypeID checks that 'input' can be parsed as a Type ID diff --git a/resource-manager/compute/2021-07-01/virtualmachineextensionimages/id_version.go b/resource-manager/compute/2021-07-01/virtualmachineextensionimages/id_version.go index 686cc8d56f1..2bdac8ac968 100644 --- a/resource-manager/compute/2021-07-01/virtualmachineextensionimages/id_version.go +++ b/resource-manager/compute/2021-07-01/virtualmachineextensionimages/id_version.go @@ -40,27 +40,9 @@ func ParseVersionID(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) - } - - if id.TypeName, ok = parsed.Parsed["typeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "typeName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVersionIDInsensitively(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - if id.TypeName, ok = parsed.Parsed["typeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "typeName", *parsed) + if id.TypeName, ok = input.Parsed["typeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "typeName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateVersionID checks that 'input' can be parsed as a Version ID diff --git a/resource-manager/compute/2021-07-01/virtualmachineextensions/id_extension.go b/resource-manager/compute/2021-07-01/virtualmachineextensions/id_extension.go index 6183e0e16f0..e050e85df8b 100644 --- a/resource-manager/compute/2021-07-01/virtualmachineextensions/id_extension.go +++ b/resource-manager/compute/2021-07-01/virtualmachineextensions/id_extension.go @@ -38,23 +38,9 @@ func ParseExtensionID(input string) (*ExtensionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExtensionId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) - } - - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseExtensionIDInsensitively(input string) (*ExtensionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExtensionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ExtensionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if id.ExtensionName, ok = input.Parsed["extensionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "extensionName", input) } - return &id, nil + return nil } // ValidateExtensionID checks that 'input' can be parsed as a Extension ID diff --git a/resource-manager/compute/2021-07-01/virtualmachineextensions/id_virtualmachine.go b/resource-manager/compute/2021-07-01/virtualmachineextensions/id_virtualmachine.go index 548faba78a9..9c53613deaf 100644 --- a/resource-manager/compute/2021-07-01/virtualmachineextensions/id_virtualmachine.go +++ b/resource-manager/compute/2021-07-01/virtualmachineextensions/id_virtualmachine.go @@ -36,19 +36,9 @@ func ParseVirtualMachineID(input string) (*VirtualMachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineIDInsensitively(input string) (*VirtualMachineId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - return &id, nil + return nil } // ValidateVirtualMachineID checks that 'input' can be parsed as a Virtual Machine ID diff --git a/resource-manager/compute/2021-07-01/virtualmachineimages/id_edgezone.go b/resource-manager/compute/2021-07-01/virtualmachineimages/id_edgezone.go index 5c8edcd56e9..2dfaf445e78 100644 --- a/resource-manager/compute/2021-07-01/virtualmachineimages/id_edgezone.go +++ b/resource-manager/compute/2021-07-01/virtualmachineimages/id_edgezone.go @@ -36,19 +36,9 @@ func ParseEdgeZoneID(input string) (*EdgeZoneId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EdgeZoneId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.EdgeZoneName, ok = parsed.Parsed["edgeZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseEdgeZoneIDInsensitively(input string) (*EdgeZoneId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EdgeZoneId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *EdgeZoneId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.EdgeZoneName, ok = parsed.Parsed["edgeZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", *parsed) + if id.EdgeZoneName, ok = input.Parsed["edgeZoneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", input) } - return &id, nil + return nil } // ValidateEdgeZoneID checks that 'input' can be parsed as a Edge Zone ID diff --git a/resource-manager/compute/2021-07-01/virtualmachineimages/id_edgezonepublisher.go b/resource-manager/compute/2021-07-01/virtualmachineimages/id_edgezonepublisher.go index 4ba06023cc7..38e6d0fd8fa 100644 --- a/resource-manager/compute/2021-07-01/virtualmachineimages/id_edgezonepublisher.go +++ b/resource-manager/compute/2021-07-01/virtualmachineimages/id_edgezonepublisher.go @@ -38,23 +38,9 @@ func ParseEdgeZonePublisherID(input string) (*EdgeZonePublisherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EdgeZonePublisherId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.EdgeZoneName, ok = parsed.Parsed["edgeZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseEdgeZonePublisherIDInsensitively(input string) (*EdgeZonePublisherId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EdgeZonePublisherId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EdgeZonePublisherId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.EdgeZoneName, ok = parsed.Parsed["edgeZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", *parsed) + if id.EdgeZoneName, ok = input.Parsed["edgeZoneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - return &id, nil + return nil } // ValidateEdgeZonePublisherID checks that 'input' can be parsed as a Edge Zone Publisher ID diff --git a/resource-manager/compute/2021-07-01/virtualmachineimages/id_location.go b/resource-manager/compute/2021-07-01/virtualmachineimages/id_location.go index c1a3a5cc344..d61a6ec2f5d 100644 --- a/resource-manager/compute/2021-07-01/virtualmachineimages/id_location.go +++ b/resource-manager/compute/2021-07-01/virtualmachineimages/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/compute/2021-07-01/virtualmachineimages/id_offer.go b/resource-manager/compute/2021-07-01/virtualmachineimages/id_offer.go index 0069c32dbbd..ab703ca7b7c 100644 --- a/resource-manager/compute/2021-07-01/virtualmachineimages/id_offer.go +++ b/resource-manager/compute/2021-07-01/virtualmachineimages/id_offer.go @@ -38,23 +38,9 @@ func ParseOfferID(input string) (*OfferId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OfferId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) - } - - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseOfferIDInsensitively(input string) (*OfferId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OfferId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OfferId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) + if id.OfferName, ok = input.Parsed["offerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerName", input) } - return &id, nil + return nil } // ValidateOfferID checks that 'input' can be parsed as a Offer ID diff --git a/resource-manager/compute/2021-07-01/virtualmachineimages/id_offersku.go b/resource-manager/compute/2021-07-01/virtualmachineimages/id_offersku.go index 56e95375101..ff6f1e1b7d0 100644 --- a/resource-manager/compute/2021-07-01/virtualmachineimages/id_offersku.go +++ b/resource-manager/compute/2021-07-01/virtualmachineimages/id_offersku.go @@ -42,31 +42,9 @@ func ParseOfferSkuID(input string) (*OfferSkuId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OfferSkuId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.EdgeZoneName, ok = parsed.Parsed["edgeZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) - } - - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) - } - - if id.SkuName, ok = parsed.Parsed["skuName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "skuName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseOfferSkuIDInsensitively(input string) (*OfferSkuId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OfferSkuId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *OfferSkuId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.EdgeZoneName, ok = parsed.Parsed["edgeZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", *parsed) + if id.EdgeZoneName, ok = input.Parsed["edgeZoneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) + if id.OfferName, ok = input.Parsed["offerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerName", input) } - if id.SkuName, ok = parsed.Parsed["skuName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "skuName", *parsed) + if id.SkuName, ok = input.Parsed["skuName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "skuName", input) } - return &id, nil + return nil } // ValidateOfferSkuID checks that 'input' can be parsed as a Offer Sku ID diff --git a/resource-manager/compute/2021-07-01/virtualmachineimages/id_offerskuversion.go b/resource-manager/compute/2021-07-01/virtualmachineimages/id_offerskuversion.go index 36781641341..4131868dd27 100644 --- a/resource-manager/compute/2021-07-01/virtualmachineimages/id_offerskuversion.go +++ b/resource-manager/compute/2021-07-01/virtualmachineimages/id_offerskuversion.go @@ -44,35 +44,9 @@ func ParseOfferSkuVersionID(input string) (*OfferSkuVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OfferSkuVersionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.EdgeZoneName, ok = parsed.Parsed["edgeZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) - } - - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) - } - - if id.SkuName, ok = parsed.Parsed["skuName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "skuName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseOfferSkuVersionIDInsensitively(input string) (*OfferSkuVersionId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OfferSkuVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *OfferSkuVersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.EdgeZoneName, ok = parsed.Parsed["edgeZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", *parsed) + if id.EdgeZoneName, ok = input.Parsed["edgeZoneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) + if id.OfferName, ok = input.Parsed["offerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerName", input) } - if id.SkuName, ok = parsed.Parsed["skuName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "skuName", *parsed) + if id.SkuName, ok = input.Parsed["skuName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "skuName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateOfferSkuVersionID checks that 'input' can be parsed as a Offer Sku Version ID diff --git a/resource-manager/compute/2021-07-01/virtualmachineimages/id_publisher.go b/resource-manager/compute/2021-07-01/virtualmachineimages/id_publisher.go index 93295bff558..1a369b92ea6 100644 --- a/resource-manager/compute/2021-07-01/virtualmachineimages/id_publisher.go +++ b/resource-manager/compute/2021-07-01/virtualmachineimages/id_publisher.go @@ -36,19 +36,9 @@ func ParsePublisherID(input string) (*PublisherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PublisherId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePublisherIDInsensitively(input string) (*PublisherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PublisherId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PublisherId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - return &id, nil + return nil } // ValidatePublisherID checks that 'input' can be parsed as a Publisher ID diff --git a/resource-manager/compute/2021-07-01/virtualmachineimages/id_sku.go b/resource-manager/compute/2021-07-01/virtualmachineimages/id_sku.go index 90d2a26bcc9..acf369898fe 100644 --- a/resource-manager/compute/2021-07-01/virtualmachineimages/id_sku.go +++ b/resource-manager/compute/2021-07-01/virtualmachineimages/id_sku.go @@ -40,27 +40,9 @@ func ParseSkuID(input string) (*SkuId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SkuId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) - } - - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) - } - - if id.SkuName, ok = parsed.Parsed["skuName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "skuName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSkuIDInsensitively(input string) (*SkuId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SkuId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SkuId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) + if id.OfferName, ok = input.Parsed["offerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerName", input) } - if id.SkuName, ok = parsed.Parsed["skuName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "skuName", *parsed) + if id.SkuName, ok = input.Parsed["skuName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "skuName", input) } - return &id, nil + return nil } // ValidateSkuID checks that 'input' can be parsed as a Sku ID diff --git a/resource-manager/compute/2021-07-01/virtualmachineimages/id_skuversion.go b/resource-manager/compute/2021-07-01/virtualmachineimages/id_skuversion.go index 09bdbcf481c..e680bffa7aa 100644 --- a/resource-manager/compute/2021-07-01/virtualmachineimages/id_skuversion.go +++ b/resource-manager/compute/2021-07-01/virtualmachineimages/id_skuversion.go @@ -42,31 +42,9 @@ func ParseSkuVersionID(input string) (*SkuVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SkuVersionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) - } - - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) - } - - if id.SkuName, ok = parsed.Parsed["skuName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "skuName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseSkuVersionIDInsensitively(input string) (*SkuVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SkuVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SkuVersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) + if id.OfferName, ok = input.Parsed["offerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerName", input) } - if id.SkuName, ok = parsed.Parsed["skuName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "skuName", *parsed) + if id.SkuName, ok = input.Parsed["skuName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "skuName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateSkuVersionID checks that 'input' can be parsed as a Sku Version ID diff --git a/resource-manager/compute/2021-07-01/virtualmachineimages/id_vmimageoffer.go b/resource-manager/compute/2021-07-01/virtualmachineimages/id_vmimageoffer.go index 0c2069284b8..dec264d0099 100644 --- a/resource-manager/compute/2021-07-01/virtualmachineimages/id_vmimageoffer.go +++ b/resource-manager/compute/2021-07-01/virtualmachineimages/id_vmimageoffer.go @@ -40,27 +40,9 @@ func ParseVMImageOfferID(input string) (*VMImageOfferId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VMImageOfferId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.EdgeZoneName, ok = parsed.Parsed["edgeZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) - } - - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVMImageOfferIDInsensitively(input string) (*VMImageOfferId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VMImageOfferId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VMImageOfferId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.EdgeZoneName, ok = parsed.Parsed["edgeZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", *parsed) + if id.EdgeZoneName, ok = input.Parsed["edgeZoneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) + if id.OfferName, ok = input.Parsed["offerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerName", input) } - return &id, nil + return nil } // ValidateVMImageOfferID checks that 'input' can be parsed as a V M Image Offer ID diff --git a/resource-manager/compute/2021-07-01/virtualmachineruncommands/id_location.go b/resource-manager/compute/2021-07-01/virtualmachineruncommands/id_location.go index c93c2bef2a9..8a8238cc803 100644 --- a/resource-manager/compute/2021-07-01/virtualmachineruncommands/id_location.go +++ b/resource-manager/compute/2021-07-01/virtualmachineruncommands/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/compute/2021-07-01/virtualmachineruncommands/id_runcommand.go b/resource-manager/compute/2021-07-01/virtualmachineruncommands/id_runcommand.go index e82082c4ee1..8852e7f8ddc 100644 --- a/resource-manager/compute/2021-07-01/virtualmachineruncommands/id_runcommand.go +++ b/resource-manager/compute/2021-07-01/virtualmachineruncommands/id_runcommand.go @@ -36,19 +36,9 @@ func ParseRunCommandID(input string) (*RunCommandId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunCommandId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.CommandId, ok = parsed.Parsed["commandId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "commandId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRunCommandIDInsensitively(input string) (*RunCommandId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunCommandId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RunCommandId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.CommandId, ok = parsed.Parsed["commandId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "commandId", *parsed) + if id.CommandId, ok = input.Parsed["commandId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "commandId", input) } - return &id, nil + return nil } // ValidateRunCommandID checks that 'input' can be parsed as a Run Command ID diff --git a/resource-manager/compute/2021-07-01/virtualmachineruncommands/id_virtualmachine.go b/resource-manager/compute/2021-07-01/virtualmachineruncommands/id_virtualmachine.go index 2d4d8c99f10..07f5b7a3786 100644 --- a/resource-manager/compute/2021-07-01/virtualmachineruncommands/id_virtualmachine.go +++ b/resource-manager/compute/2021-07-01/virtualmachineruncommands/id_virtualmachine.go @@ -36,19 +36,9 @@ func ParseVirtualMachineID(input string) (*VirtualMachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineIDInsensitively(input string) (*VirtualMachineId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - return &id, nil + return nil } // ValidateVirtualMachineID checks that 'input' can be parsed as a Virtual Machine ID diff --git a/resource-manager/compute/2021-07-01/virtualmachineruncommands/id_virtualmachineruncommand.go b/resource-manager/compute/2021-07-01/virtualmachineruncommands/id_virtualmachineruncommand.go index f3d518d4e40..10d5aef8fce 100644 --- a/resource-manager/compute/2021-07-01/virtualmachineruncommands/id_virtualmachineruncommand.go +++ b/resource-manager/compute/2021-07-01/virtualmachineruncommands/id_virtualmachineruncommand.go @@ -38,23 +38,9 @@ func ParseVirtualMachineRunCommandID(input string) (*VirtualMachineRunCommandId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineRunCommandId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) - } - - if id.RunCommandName, ok = parsed.Parsed["runCommandName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runCommandName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualMachineRunCommandIDInsensitively(input string) (*VirtualMachine return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineRunCommandId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineRunCommandId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - if id.RunCommandName, ok = parsed.Parsed["runCommandName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runCommandName", *parsed) + if id.RunCommandName, ok = input.Parsed["runCommandName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runCommandName", input) } - return &id, nil + return nil } // ValidateVirtualMachineRunCommandID checks that 'input' can be parsed as a Virtual Machine Run Command ID diff --git a/resource-manager/compute/2021-07-01/virtualmachines/id_location.go b/resource-manager/compute/2021-07-01/virtualmachines/id_location.go index 4666b6bb106..8f54853528a 100644 --- a/resource-manager/compute/2021-07-01/virtualmachines/id_location.go +++ b/resource-manager/compute/2021-07-01/virtualmachines/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/compute/2021-07-01/virtualmachines/id_virtualmachine.go b/resource-manager/compute/2021-07-01/virtualmachines/id_virtualmachine.go index 3d3c57c3528..367cce21365 100644 --- a/resource-manager/compute/2021-07-01/virtualmachines/id_virtualmachine.go +++ b/resource-manager/compute/2021-07-01/virtualmachines/id_virtualmachine.go @@ -36,19 +36,9 @@ func ParseVirtualMachineID(input string) (*VirtualMachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineIDInsensitively(input string) (*VirtualMachineId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - return &id, nil + return nil } // ValidateVirtualMachineID checks that 'input' can be parsed as a Virtual Machine ID diff --git a/resource-manager/compute/2021-07-01/virtualmachinescalesetextensions/id_virtualmachinescaleset.go b/resource-manager/compute/2021-07-01/virtualmachinescalesetextensions/id_virtualmachinescaleset.go index 2c9fe5b0362..7b3d32af330 100644 --- a/resource-manager/compute/2021-07-01/virtualmachinescalesetextensions/id_virtualmachinescaleset.go +++ b/resource-manager/compute/2021-07-01/virtualmachinescalesetextensions/id_virtualmachinescaleset.go @@ -36,19 +36,9 @@ func ParseVirtualMachineScaleSetID(input string) (*VirtualMachineScaleSetId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineScaleSetIDInsensitively(input string) (*VirtualMachineSc return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineScaleSetId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - return &id, nil + return nil } // ValidateVirtualMachineScaleSetID checks that 'input' can be parsed as a Virtual Machine Scale Set ID diff --git a/resource-manager/compute/2021-07-01/virtualmachinescalesetextensions/id_virtualmachinescalesetextension.go b/resource-manager/compute/2021-07-01/virtualmachinescalesetextensions/id_virtualmachinescalesetextension.go index 3b656210a92..7124d08b494 100644 --- a/resource-manager/compute/2021-07-01/virtualmachinescalesetextensions/id_virtualmachinescalesetextension.go +++ b/resource-manager/compute/2021-07-01/virtualmachinescalesetextensions/id_virtualmachinescalesetextension.go @@ -38,23 +38,9 @@ func ParseVirtualMachineScaleSetExtensionID(input string) (*VirtualMachineScaleS return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetExtensionId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) - } - - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualMachineScaleSetExtensionIDInsensitively(input string) (*Virtual return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetExtensionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineScaleSetExtensionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if id.ExtensionName, ok = input.Parsed["extensionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "extensionName", input) } - return &id, nil + return nil } // ValidateVirtualMachineScaleSetExtensionID checks that 'input' can be parsed as a Virtual Machine Scale Set Extension ID diff --git a/resource-manager/compute/2021-07-01/virtualmachinescalesetrollingupgrades/id_virtualmachinescaleset.go b/resource-manager/compute/2021-07-01/virtualmachinescalesetrollingupgrades/id_virtualmachinescaleset.go index c6e19fcfa2a..9bc0d385bef 100644 --- a/resource-manager/compute/2021-07-01/virtualmachinescalesetrollingupgrades/id_virtualmachinescaleset.go +++ b/resource-manager/compute/2021-07-01/virtualmachinescalesetrollingupgrades/id_virtualmachinescaleset.go @@ -36,19 +36,9 @@ func ParseVirtualMachineScaleSetID(input string) (*VirtualMachineScaleSetId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineScaleSetIDInsensitively(input string) (*VirtualMachineSc return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineScaleSetId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - return &id, nil + return nil } // ValidateVirtualMachineScaleSetID checks that 'input' can be parsed as a Virtual Machine Scale Set ID diff --git a/resource-manager/compute/2021-07-01/virtualmachinescalesets/id_location.go b/resource-manager/compute/2021-07-01/virtualmachinescalesets/id_location.go index 64147f562bc..c9c4831a0b4 100644 --- a/resource-manager/compute/2021-07-01/virtualmachinescalesets/id_location.go +++ b/resource-manager/compute/2021-07-01/virtualmachinescalesets/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/compute/2021-07-01/virtualmachinescalesets/id_virtualmachinescaleset.go b/resource-manager/compute/2021-07-01/virtualmachinescalesets/id_virtualmachinescaleset.go index 92d812ec1a0..0dca997a232 100644 --- a/resource-manager/compute/2021-07-01/virtualmachinescalesets/id_virtualmachinescaleset.go +++ b/resource-manager/compute/2021-07-01/virtualmachinescalesets/id_virtualmachinescaleset.go @@ -36,19 +36,9 @@ func ParseVirtualMachineScaleSetID(input string) (*VirtualMachineScaleSetId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineScaleSetIDInsensitively(input string) (*VirtualMachineSc return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineScaleSetId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - return &id, nil + return nil } // ValidateVirtualMachineScaleSetID checks that 'input' can be parsed as a Virtual Machine Scale Set ID diff --git a/resource-manager/compute/2021-07-01/virtualmachinescalesetvmextensions/id_virtualmachineextension.go b/resource-manager/compute/2021-07-01/virtualmachinescalesetvmextensions/id_virtualmachineextension.go index 66266d9719e..1623fb4b631 100644 --- a/resource-manager/compute/2021-07-01/virtualmachinescalesetvmextensions/id_virtualmachineextension.go +++ b/resource-manager/compute/2021-07-01/virtualmachinescalesetvmextensions/id_virtualmachineextension.go @@ -40,27 +40,9 @@ func ParseVirtualMachineExtensionID(input string) (*VirtualMachineExtensionId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineExtensionId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) - } - - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) - } - - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVirtualMachineExtensionIDInsensitively(input string) (*VirtualMachineE return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineExtensionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VirtualMachineExtensionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if id.InstanceId, ok = input.Parsed["instanceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceId", input) } - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if id.ExtensionName, ok = input.Parsed["extensionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "extensionName", input) } - return &id, nil + return nil } // ValidateVirtualMachineExtensionID checks that 'input' can be parsed as a Virtual Machine Extension ID diff --git a/resource-manager/compute/2021-07-01/virtualmachinescalesetvmextensions/id_virtualmachinescalesetvirtualmachine.go b/resource-manager/compute/2021-07-01/virtualmachinescalesetvmextensions/id_virtualmachinescalesetvirtualmachine.go index 2cbc7556565..4a631b44413 100644 --- a/resource-manager/compute/2021-07-01/virtualmachinescalesetvmextensions/id_virtualmachinescalesetvirtualmachine.go +++ b/resource-manager/compute/2021-07-01/virtualmachinescalesetvmextensions/id_virtualmachinescalesetvirtualmachine.go @@ -38,23 +38,9 @@ func ParseVirtualMachineScaleSetVirtualMachineID(input string) (*VirtualMachineS return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetVirtualMachineId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) - } - - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualMachineScaleSetVirtualMachineIDInsensitively(input string) (*Vi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetVirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineScaleSetVirtualMachineId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if id.InstanceId, ok = input.Parsed["instanceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceId", input) } - return &id, nil + return nil } // ValidateVirtualMachineScaleSetVirtualMachineID checks that 'input' can be parsed as a Virtual Machine Scale Set Virtual Machine ID diff --git a/resource-manager/compute/2021-07-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachine.go b/resource-manager/compute/2021-07-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachine.go index 4e39acac92a..eae9c455cea 100644 --- a/resource-manager/compute/2021-07-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachine.go +++ b/resource-manager/compute/2021-07-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachine.go @@ -38,23 +38,9 @@ func ParseVirtualMachineScaleSetVirtualMachineID(input string) (*VirtualMachineS return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetVirtualMachineId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) - } - - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualMachineScaleSetVirtualMachineIDInsensitively(input string) (*Vi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetVirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineScaleSetVirtualMachineId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if id.InstanceId, ok = input.Parsed["instanceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceId", input) } - return &id, nil + return nil } // ValidateVirtualMachineScaleSetVirtualMachineID checks that 'input' can be parsed as a Virtual Machine Scale Set Virtual Machine ID diff --git a/resource-manager/compute/2021-07-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachineruncommand.go b/resource-manager/compute/2021-07-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachineruncommand.go index 31b9bd80ffc..dba7f64aa9a 100644 --- a/resource-manager/compute/2021-07-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachineruncommand.go +++ b/resource-manager/compute/2021-07-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachineruncommand.go @@ -40,27 +40,9 @@ func ParseVirtualMachineScaleSetVirtualMachineRunCommandID(input string) (*Virtu return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetVirtualMachineRunCommandId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) - } - - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) - } - - if id.RunCommandName, ok = parsed.Parsed["runCommandName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runCommandName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVirtualMachineScaleSetVirtualMachineRunCommandIDInsensitively(input st return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetVirtualMachineRunCommandId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VirtualMachineScaleSetVirtualMachineRunCommandId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if id.InstanceId, ok = input.Parsed["instanceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceId", input) } - if id.RunCommandName, ok = parsed.Parsed["runCommandName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runCommandName", *parsed) + if id.RunCommandName, ok = input.Parsed["runCommandName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runCommandName", input) } - return &id, nil + return nil } // ValidateVirtualMachineScaleSetVirtualMachineRunCommandID checks that 'input' can be parsed as a Virtual Machine Scale Set Virtual Machine Run Command ID diff --git a/resource-manager/compute/2021-07-01/virtualmachinescalesetvms/id_virtualmachinescaleset.go b/resource-manager/compute/2021-07-01/virtualmachinescalesetvms/id_virtualmachinescaleset.go index cd06d946474..d1d9b01f3c7 100644 --- a/resource-manager/compute/2021-07-01/virtualmachinescalesetvms/id_virtualmachinescaleset.go +++ b/resource-manager/compute/2021-07-01/virtualmachinescalesetvms/id_virtualmachinescaleset.go @@ -36,19 +36,9 @@ func ParseVirtualMachineScaleSetID(input string) (*VirtualMachineScaleSetId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineScaleSetIDInsensitively(input string) (*VirtualMachineSc return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineScaleSetId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - return &id, nil + return nil } // ValidateVirtualMachineScaleSetID checks that 'input' can be parsed as a Virtual Machine Scale Set ID diff --git a/resource-manager/compute/2021-07-01/virtualmachinescalesetvms/id_virtualmachinescalesetvirtualmachine.go b/resource-manager/compute/2021-07-01/virtualmachinescalesetvms/id_virtualmachinescalesetvirtualmachine.go index c6f1a6327f2..0413b4eb17c 100644 --- a/resource-manager/compute/2021-07-01/virtualmachinescalesetvms/id_virtualmachinescalesetvirtualmachine.go +++ b/resource-manager/compute/2021-07-01/virtualmachinescalesetvms/id_virtualmachinescalesetvirtualmachine.go @@ -38,23 +38,9 @@ func ParseVirtualMachineScaleSetVirtualMachineID(input string) (*VirtualMachineS return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetVirtualMachineId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) - } - - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualMachineScaleSetVirtualMachineIDInsensitively(input string) (*Vi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetVirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineScaleSetVirtualMachineId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if id.InstanceId, ok = input.Parsed["instanceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceId", input) } - return &id, nil + return nil } // ValidateVirtualMachineScaleSetVirtualMachineID checks that 'input' can be parsed as a Virtual Machine Scale Set Virtual Machine ID diff --git a/resource-manager/compute/2021-07-01/virtualmachinesizes/id_location.go b/resource-manager/compute/2021-07-01/virtualmachinesizes/id_location.go index 3bd0de508bf..99331262075 100644 --- a/resource-manager/compute/2021-07-01/virtualmachinesizes/id_location.go +++ b/resource-manager/compute/2021-07-01/virtualmachinesizes/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/compute/2021-11-01/availabilitysets/id_availabilityset.go b/resource-manager/compute/2021-11-01/availabilitysets/id_availabilityset.go index 8564b6ab2ac..2393723dfd3 100644 --- a/resource-manager/compute/2021-11-01/availabilitysets/id_availabilityset.go +++ b/resource-manager/compute/2021-11-01/availabilitysets/id_availabilityset.go @@ -36,19 +36,9 @@ func ParseAvailabilitySetID(input string) (*AvailabilitySetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AvailabilitySetId{} - - 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.AvailabilitySetName, ok = parsed.Parsed["availabilitySetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "availabilitySetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAvailabilitySetIDInsensitively(input string) (*AvailabilitySetId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AvailabilitySetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AvailabilitySetId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AvailabilitySetName, ok = parsed.Parsed["availabilitySetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "availabilitySetName", *parsed) + if id.AvailabilitySetName, ok = input.Parsed["availabilitySetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "availabilitySetName", input) } - return &id, nil + return nil } // ValidateAvailabilitySetID checks that 'input' can be parsed as a Availability Set ID diff --git a/resource-manager/compute/2021-11-01/capacityreservation/id_capacityreservationgroup.go b/resource-manager/compute/2021-11-01/capacityreservation/id_capacityreservationgroup.go index 4c5b6bbd697..56ded1c940b 100644 --- a/resource-manager/compute/2021-11-01/capacityreservation/id_capacityreservationgroup.go +++ b/resource-manager/compute/2021-11-01/capacityreservation/id_capacityreservationgroup.go @@ -36,19 +36,9 @@ func ParseCapacityReservationGroupID(input string) (*CapacityReservationGroupId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapacityReservationGroupId{} - - 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.CapacityReservationGroupName, ok = parsed.Parsed["capacityReservationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseCapacityReservationGroupIDInsensitively(input string) (*CapacityReserv return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapacityReservationGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CapacityReservationGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CapacityReservationGroupName, ok = parsed.Parsed["capacityReservationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationGroupName", *parsed) + if id.CapacityReservationGroupName, ok = input.Parsed["capacityReservationGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationGroupName", input) } - return &id, nil + return nil } // ValidateCapacityReservationGroupID checks that 'input' can be parsed as a Capacity Reservation Group ID diff --git a/resource-manager/compute/2021-11-01/capacityreservationgroups/id_capacityreservationgroup.go b/resource-manager/compute/2021-11-01/capacityreservationgroups/id_capacityreservationgroup.go index b974029515e..725ce39f033 100644 --- a/resource-manager/compute/2021-11-01/capacityreservationgroups/id_capacityreservationgroup.go +++ b/resource-manager/compute/2021-11-01/capacityreservationgroups/id_capacityreservationgroup.go @@ -36,19 +36,9 @@ func ParseCapacityReservationGroupID(input string) (*CapacityReservationGroupId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapacityReservationGroupId{} - - 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.CapacityReservationGroupName, ok = parsed.Parsed["capacityReservationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseCapacityReservationGroupIDInsensitively(input string) (*CapacityReserv return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapacityReservationGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CapacityReservationGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CapacityReservationGroupName, ok = parsed.Parsed["capacityReservationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationGroupName", *parsed) + if id.CapacityReservationGroupName, ok = input.Parsed["capacityReservationGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationGroupName", input) } - return &id, nil + return nil } // ValidateCapacityReservationGroupID checks that 'input' can be parsed as a Capacity Reservation Group ID diff --git a/resource-manager/compute/2021-11-01/capacityreservations/id_capacityreservation.go b/resource-manager/compute/2021-11-01/capacityreservations/id_capacityreservation.go index df25394758f..ac78ccbcc3e 100644 --- a/resource-manager/compute/2021-11-01/capacityreservations/id_capacityreservation.go +++ b/resource-manager/compute/2021-11-01/capacityreservations/id_capacityreservation.go @@ -38,23 +38,9 @@ func ParseCapacityReservationID(input string) (*CapacityReservationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapacityReservationId{} - - 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.CapacityReservationGroupName, ok = parsed.Parsed["capacityReservationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationGroupName", *parsed) - } - - if id.CapacityReservationName, ok = parsed.Parsed["capacityReservationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCapacityReservationIDInsensitively(input string) (*CapacityReservation return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapacityReservationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CapacityReservationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CapacityReservationGroupName, ok = parsed.Parsed["capacityReservationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationGroupName", *parsed) + if id.CapacityReservationGroupName, ok = input.Parsed["capacityReservationGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationGroupName", input) } - if id.CapacityReservationName, ok = parsed.Parsed["capacityReservationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationName", *parsed) + if id.CapacityReservationName, ok = input.Parsed["capacityReservationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationName", input) } - return &id, nil + return nil } // ValidateCapacityReservationID checks that 'input' can be parsed as a Capacity Reservation ID diff --git a/resource-manager/compute/2021-11-01/compute/id_restorepoint.go b/resource-manager/compute/2021-11-01/compute/id_restorepoint.go index 48e84f22683..e820b95604f 100644 --- a/resource-manager/compute/2021-11-01/compute/id_restorepoint.go +++ b/resource-manager/compute/2021-11-01/compute/id_restorepoint.go @@ -38,23 +38,9 @@ func ParseRestorePointID(input string) (*RestorePointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RestorePointId{} - - 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.RestorePointCollectionName, ok = parsed.Parsed["restorePointCollectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorePointCollectionName", *parsed) - } - - if id.RestorePointName, ok = parsed.Parsed["restorePointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorePointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRestorePointIDInsensitively(input string) (*RestorePointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RestorePointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RestorePointId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RestorePointCollectionName, ok = parsed.Parsed["restorePointCollectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorePointCollectionName", *parsed) + if id.RestorePointCollectionName, ok = input.Parsed["restorePointCollectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "restorePointCollectionName", input) } - if id.RestorePointName, ok = parsed.Parsed["restorePointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorePointName", *parsed) + if id.RestorePointName, ok = input.Parsed["restorePointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "restorePointName", input) } - return &id, nil + return nil } // ValidateRestorePointID checks that 'input' can be parsed as a Restore Point ID diff --git a/resource-manager/compute/2021-11-01/dedicatedhost/id_host.go b/resource-manager/compute/2021-11-01/dedicatedhost/id_host.go index 8e13e5816d4..277c92b2fe0 100644 --- a/resource-manager/compute/2021-11-01/dedicatedhost/id_host.go +++ b/resource-manager/compute/2021-11-01/dedicatedhost/id_host.go @@ -38,23 +38,9 @@ func ParseHostID(input string) (*HostId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostId{} - - 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.HostGroupName, ok = parsed.Parsed["hostGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostGroupName", *parsed) - } - - if id.HostName, ok = parsed.Parsed["hostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseHostIDInsensitively(input string) (*HostId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *HostId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostGroupName, ok = parsed.Parsed["hostGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostGroupName", *parsed) + if id.HostGroupName, ok = input.Parsed["hostGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostGroupName", input) } - if id.HostName, ok = parsed.Parsed["hostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostName", *parsed) + if id.HostName, ok = input.Parsed["hostName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostName", input) } - return &id, nil + return nil } // ValidateHostID checks that 'input' can be parsed as a Host ID diff --git a/resource-manager/compute/2021-11-01/dedicatedhost/id_hostgroup.go b/resource-manager/compute/2021-11-01/dedicatedhost/id_hostgroup.go index 98371d9147a..4cc57240984 100644 --- a/resource-manager/compute/2021-11-01/dedicatedhost/id_hostgroup.go +++ b/resource-manager/compute/2021-11-01/dedicatedhost/id_hostgroup.go @@ -36,19 +36,9 @@ func ParseHostGroupID(input string) (*HostGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostGroupId{} - - 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.HostGroupName, ok = parsed.Parsed["hostGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseHostGroupIDInsensitively(input string) (*HostGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *HostGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostGroupName, ok = parsed.Parsed["hostGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostGroupName", *parsed) + if id.HostGroupName, ok = input.Parsed["hostGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostGroupName", input) } - return &id, nil + return nil } // ValidateHostGroupID checks that 'input' can be parsed as a Host Group ID diff --git a/resource-manager/compute/2021-11-01/dedicatedhostgroups/id_hostgroup.go b/resource-manager/compute/2021-11-01/dedicatedhostgroups/id_hostgroup.go index 74523582952..fea78a50c47 100644 --- a/resource-manager/compute/2021-11-01/dedicatedhostgroups/id_hostgroup.go +++ b/resource-manager/compute/2021-11-01/dedicatedhostgroups/id_hostgroup.go @@ -36,19 +36,9 @@ func ParseHostGroupID(input string) (*HostGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostGroupId{} - - 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.HostGroupName, ok = parsed.Parsed["hostGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseHostGroupIDInsensitively(input string) (*HostGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *HostGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostGroupName, ok = parsed.Parsed["hostGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostGroupName", *parsed) + if id.HostGroupName, ok = input.Parsed["hostGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostGroupName", input) } - return &id, nil + return nil } // ValidateHostGroupID checks that 'input' can be parsed as a Host Group ID diff --git a/resource-manager/compute/2021-11-01/dedicatedhosts/id_host.go b/resource-manager/compute/2021-11-01/dedicatedhosts/id_host.go index 762971eb041..4a087b87639 100644 --- a/resource-manager/compute/2021-11-01/dedicatedhosts/id_host.go +++ b/resource-manager/compute/2021-11-01/dedicatedhosts/id_host.go @@ -38,23 +38,9 @@ func ParseHostID(input string) (*HostId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostId{} - - 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.HostGroupName, ok = parsed.Parsed["hostGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostGroupName", *parsed) - } - - if id.HostName, ok = parsed.Parsed["hostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseHostIDInsensitively(input string) (*HostId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *HostId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostGroupName, ok = parsed.Parsed["hostGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostGroupName", *parsed) + if id.HostGroupName, ok = input.Parsed["hostGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostGroupName", input) } - if id.HostName, ok = parsed.Parsed["hostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostName", *parsed) + if id.HostName, ok = input.Parsed["hostName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostName", input) } - return &id, nil + return nil } // ValidateHostID checks that 'input' can be parsed as a Host ID diff --git a/resource-manager/compute/2021-11-01/images/id_image.go b/resource-manager/compute/2021-11-01/images/id_image.go index 048dbeac923..bd84d2f6092 100644 --- a/resource-manager/compute/2021-11-01/images/id_image.go +++ b/resource-manager/compute/2021-11-01/images/id_image.go @@ -36,19 +36,9 @@ func ParseImageID(input string) (*ImageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ImageId{} - - 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.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseImageIDInsensitively(input string) (*ImageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ImageId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ImageId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) + if id.ImageName, ok = input.Parsed["imageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "imageName", input) } - return &id, nil + return nil } // ValidateImageID checks that 'input' can be parsed as a Image ID diff --git a/resource-manager/compute/2021-11-01/loganalytics/id_location.go b/resource-manager/compute/2021-11-01/loganalytics/id_location.go index 9f246f8486e..fba54496f0a 100644 --- a/resource-manager/compute/2021-11-01/loganalytics/id_location.go +++ b/resource-manager/compute/2021-11-01/loganalytics/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/compute/2021-11-01/proximityplacementgroups/id_proximityplacementgroup.go b/resource-manager/compute/2021-11-01/proximityplacementgroups/id_proximityplacementgroup.go index b220644fa11..1232e950c85 100644 --- a/resource-manager/compute/2021-11-01/proximityplacementgroups/id_proximityplacementgroup.go +++ b/resource-manager/compute/2021-11-01/proximityplacementgroups/id_proximityplacementgroup.go @@ -36,19 +36,9 @@ func ParseProximityPlacementGroupID(input string) (*ProximityPlacementGroupId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProximityPlacementGroupId{} - - 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.ProximityPlacementGroupName, ok = parsed.Parsed["proximityPlacementGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "proximityPlacementGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProximityPlacementGroupIDInsensitively(input string) (*ProximityPlacem return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProximityPlacementGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProximityPlacementGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ProximityPlacementGroupName, ok = parsed.Parsed["proximityPlacementGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "proximityPlacementGroupName", *parsed) + if id.ProximityPlacementGroupName, ok = input.Parsed["proximityPlacementGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "proximityPlacementGroupName", input) } - return &id, nil + return nil } // ValidateProximityPlacementGroupID checks that 'input' can be parsed as a Proximity Placement Group ID diff --git a/resource-manager/compute/2021-11-01/restorepointcollections/id_restorepointcollection.go b/resource-manager/compute/2021-11-01/restorepointcollections/id_restorepointcollection.go index a51a6398432..9f496b37f89 100644 --- a/resource-manager/compute/2021-11-01/restorepointcollections/id_restorepointcollection.go +++ b/resource-manager/compute/2021-11-01/restorepointcollections/id_restorepointcollection.go @@ -36,19 +36,9 @@ func ParseRestorePointCollectionID(input string) (*RestorePointCollectionId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RestorePointCollectionId{} - - 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.RestorePointCollectionName, ok = parsed.Parsed["restorePointCollectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorePointCollectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRestorePointCollectionIDInsensitively(input string) (*RestorePointColl return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RestorePointCollectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RestorePointCollectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RestorePointCollectionName, ok = parsed.Parsed["restorePointCollectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorePointCollectionName", *parsed) + if id.RestorePointCollectionName, ok = input.Parsed["restorePointCollectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "restorePointCollectionName", input) } - return &id, nil + return nil } // ValidateRestorePointCollectionID checks that 'input' can be parsed as a Restore Point Collection ID diff --git a/resource-manager/compute/2021-11-01/sshpublickeys/id_sshpublickey.go b/resource-manager/compute/2021-11-01/sshpublickeys/id_sshpublickey.go index 9c7f9ae62ba..9e9ee5ff0f6 100644 --- a/resource-manager/compute/2021-11-01/sshpublickeys/id_sshpublickey.go +++ b/resource-manager/compute/2021-11-01/sshpublickeys/id_sshpublickey.go @@ -36,19 +36,9 @@ func ParseSshPublicKeyID(input string) (*SshPublicKeyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SshPublicKeyId{} - - 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.SshPublicKeyName, ok = parsed.Parsed["sshPublicKeyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sshPublicKeyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSshPublicKeyIDInsensitively(input string) (*SshPublicKeyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SshPublicKeyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SshPublicKeyId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SshPublicKeyName, ok = parsed.Parsed["sshPublicKeyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sshPublicKeyName", *parsed) + if id.SshPublicKeyName, ok = input.Parsed["sshPublicKeyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sshPublicKeyName", input) } - return &id, nil + return nil } // ValidateSshPublicKeyID checks that 'input' can be parsed as a Ssh Public Key ID diff --git a/resource-manager/compute/2021-11-01/virtualmachineextensionimages/id_publisher.go b/resource-manager/compute/2021-11-01/virtualmachineextensionimages/id_publisher.go index b45241d6952..573fe07895b 100644 --- a/resource-manager/compute/2021-11-01/virtualmachineextensionimages/id_publisher.go +++ b/resource-manager/compute/2021-11-01/virtualmachineextensionimages/id_publisher.go @@ -36,19 +36,9 @@ func ParsePublisherID(input string) (*PublisherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PublisherId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePublisherIDInsensitively(input string) (*PublisherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PublisherId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PublisherId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - return &id, nil + return nil } // ValidatePublisherID checks that 'input' can be parsed as a Publisher ID diff --git a/resource-manager/compute/2021-11-01/virtualmachineextensionimages/id_type.go b/resource-manager/compute/2021-11-01/virtualmachineextensionimages/id_type.go index 95a118e7bca..90477651f07 100644 --- a/resource-manager/compute/2021-11-01/virtualmachineextensionimages/id_type.go +++ b/resource-manager/compute/2021-11-01/virtualmachineextensionimages/id_type.go @@ -38,23 +38,9 @@ func ParseTypeID(input string) (*TypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TypeId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) - } - - if id.TypeName, ok = parsed.Parsed["typeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "typeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTypeIDInsensitively(input string) (*TypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - if id.TypeName, ok = parsed.Parsed["typeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "typeName", *parsed) + if id.TypeName, ok = input.Parsed["typeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "typeName", input) } - return &id, nil + return nil } // ValidateTypeID checks that 'input' can be parsed as a Type ID diff --git a/resource-manager/compute/2021-11-01/virtualmachineextensionimages/id_version.go b/resource-manager/compute/2021-11-01/virtualmachineextensionimages/id_version.go index 686cc8d56f1..2bdac8ac968 100644 --- a/resource-manager/compute/2021-11-01/virtualmachineextensionimages/id_version.go +++ b/resource-manager/compute/2021-11-01/virtualmachineextensionimages/id_version.go @@ -40,27 +40,9 @@ func ParseVersionID(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) - } - - if id.TypeName, ok = parsed.Parsed["typeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "typeName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVersionIDInsensitively(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - if id.TypeName, ok = parsed.Parsed["typeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "typeName", *parsed) + if id.TypeName, ok = input.Parsed["typeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "typeName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateVersionID checks that 'input' can be parsed as a Version ID diff --git a/resource-manager/compute/2021-11-01/virtualmachineextensions/id_extension.go b/resource-manager/compute/2021-11-01/virtualmachineextensions/id_extension.go index 6183e0e16f0..e050e85df8b 100644 --- a/resource-manager/compute/2021-11-01/virtualmachineextensions/id_extension.go +++ b/resource-manager/compute/2021-11-01/virtualmachineextensions/id_extension.go @@ -38,23 +38,9 @@ func ParseExtensionID(input string) (*ExtensionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExtensionId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) - } - - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseExtensionIDInsensitively(input string) (*ExtensionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExtensionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ExtensionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if id.ExtensionName, ok = input.Parsed["extensionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "extensionName", input) } - return &id, nil + return nil } // ValidateExtensionID checks that 'input' can be parsed as a Extension ID diff --git a/resource-manager/compute/2021-11-01/virtualmachineextensions/id_virtualmachine.go b/resource-manager/compute/2021-11-01/virtualmachineextensions/id_virtualmachine.go index 548faba78a9..9c53613deaf 100644 --- a/resource-manager/compute/2021-11-01/virtualmachineextensions/id_virtualmachine.go +++ b/resource-manager/compute/2021-11-01/virtualmachineextensions/id_virtualmachine.go @@ -36,19 +36,9 @@ func ParseVirtualMachineID(input string) (*VirtualMachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineIDInsensitively(input string) (*VirtualMachineId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - return &id, nil + return nil } // ValidateVirtualMachineID checks that 'input' can be parsed as a Virtual Machine ID diff --git a/resource-manager/compute/2021-11-01/virtualmachineimages/id_edgezone.go b/resource-manager/compute/2021-11-01/virtualmachineimages/id_edgezone.go index 5c8edcd56e9..2dfaf445e78 100644 --- a/resource-manager/compute/2021-11-01/virtualmachineimages/id_edgezone.go +++ b/resource-manager/compute/2021-11-01/virtualmachineimages/id_edgezone.go @@ -36,19 +36,9 @@ func ParseEdgeZoneID(input string) (*EdgeZoneId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EdgeZoneId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.EdgeZoneName, ok = parsed.Parsed["edgeZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseEdgeZoneIDInsensitively(input string) (*EdgeZoneId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EdgeZoneId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *EdgeZoneId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.EdgeZoneName, ok = parsed.Parsed["edgeZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", *parsed) + if id.EdgeZoneName, ok = input.Parsed["edgeZoneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", input) } - return &id, nil + return nil } // ValidateEdgeZoneID checks that 'input' can be parsed as a Edge Zone ID diff --git a/resource-manager/compute/2021-11-01/virtualmachineimages/id_edgezonepublisher.go b/resource-manager/compute/2021-11-01/virtualmachineimages/id_edgezonepublisher.go index 4ba06023cc7..38e6d0fd8fa 100644 --- a/resource-manager/compute/2021-11-01/virtualmachineimages/id_edgezonepublisher.go +++ b/resource-manager/compute/2021-11-01/virtualmachineimages/id_edgezonepublisher.go @@ -38,23 +38,9 @@ func ParseEdgeZonePublisherID(input string) (*EdgeZonePublisherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EdgeZonePublisherId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.EdgeZoneName, ok = parsed.Parsed["edgeZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseEdgeZonePublisherIDInsensitively(input string) (*EdgeZonePublisherId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EdgeZonePublisherId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EdgeZonePublisherId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.EdgeZoneName, ok = parsed.Parsed["edgeZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", *parsed) + if id.EdgeZoneName, ok = input.Parsed["edgeZoneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - return &id, nil + return nil } // ValidateEdgeZonePublisherID checks that 'input' can be parsed as a Edge Zone Publisher ID diff --git a/resource-manager/compute/2021-11-01/virtualmachineimages/id_location.go b/resource-manager/compute/2021-11-01/virtualmachineimages/id_location.go index c1a3a5cc344..d61a6ec2f5d 100644 --- a/resource-manager/compute/2021-11-01/virtualmachineimages/id_location.go +++ b/resource-manager/compute/2021-11-01/virtualmachineimages/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/compute/2021-11-01/virtualmachineimages/id_offer.go b/resource-manager/compute/2021-11-01/virtualmachineimages/id_offer.go index 0069c32dbbd..ab703ca7b7c 100644 --- a/resource-manager/compute/2021-11-01/virtualmachineimages/id_offer.go +++ b/resource-manager/compute/2021-11-01/virtualmachineimages/id_offer.go @@ -38,23 +38,9 @@ func ParseOfferID(input string) (*OfferId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OfferId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) - } - - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseOfferIDInsensitively(input string) (*OfferId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OfferId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OfferId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) + if id.OfferName, ok = input.Parsed["offerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerName", input) } - return &id, nil + return nil } // ValidateOfferID checks that 'input' can be parsed as a Offer ID diff --git a/resource-manager/compute/2021-11-01/virtualmachineimages/id_offersku.go b/resource-manager/compute/2021-11-01/virtualmachineimages/id_offersku.go index 56e95375101..ff6f1e1b7d0 100644 --- a/resource-manager/compute/2021-11-01/virtualmachineimages/id_offersku.go +++ b/resource-manager/compute/2021-11-01/virtualmachineimages/id_offersku.go @@ -42,31 +42,9 @@ func ParseOfferSkuID(input string) (*OfferSkuId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OfferSkuId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.EdgeZoneName, ok = parsed.Parsed["edgeZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) - } - - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) - } - - if id.SkuName, ok = parsed.Parsed["skuName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "skuName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseOfferSkuIDInsensitively(input string) (*OfferSkuId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OfferSkuId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *OfferSkuId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.EdgeZoneName, ok = parsed.Parsed["edgeZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", *parsed) + if id.EdgeZoneName, ok = input.Parsed["edgeZoneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) + if id.OfferName, ok = input.Parsed["offerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerName", input) } - if id.SkuName, ok = parsed.Parsed["skuName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "skuName", *parsed) + if id.SkuName, ok = input.Parsed["skuName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "skuName", input) } - return &id, nil + return nil } // ValidateOfferSkuID checks that 'input' can be parsed as a Offer Sku ID diff --git a/resource-manager/compute/2021-11-01/virtualmachineimages/id_offerskuversion.go b/resource-manager/compute/2021-11-01/virtualmachineimages/id_offerskuversion.go index 36781641341..4131868dd27 100644 --- a/resource-manager/compute/2021-11-01/virtualmachineimages/id_offerskuversion.go +++ b/resource-manager/compute/2021-11-01/virtualmachineimages/id_offerskuversion.go @@ -44,35 +44,9 @@ func ParseOfferSkuVersionID(input string) (*OfferSkuVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OfferSkuVersionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.EdgeZoneName, ok = parsed.Parsed["edgeZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) - } - - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) - } - - if id.SkuName, ok = parsed.Parsed["skuName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "skuName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseOfferSkuVersionIDInsensitively(input string) (*OfferSkuVersionId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OfferSkuVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *OfferSkuVersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.EdgeZoneName, ok = parsed.Parsed["edgeZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", *parsed) + if id.EdgeZoneName, ok = input.Parsed["edgeZoneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) + if id.OfferName, ok = input.Parsed["offerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerName", input) } - if id.SkuName, ok = parsed.Parsed["skuName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "skuName", *parsed) + if id.SkuName, ok = input.Parsed["skuName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "skuName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateOfferSkuVersionID checks that 'input' can be parsed as a Offer Sku Version ID diff --git a/resource-manager/compute/2021-11-01/virtualmachineimages/id_publisher.go b/resource-manager/compute/2021-11-01/virtualmachineimages/id_publisher.go index 93295bff558..1a369b92ea6 100644 --- a/resource-manager/compute/2021-11-01/virtualmachineimages/id_publisher.go +++ b/resource-manager/compute/2021-11-01/virtualmachineimages/id_publisher.go @@ -36,19 +36,9 @@ func ParsePublisherID(input string) (*PublisherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PublisherId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePublisherIDInsensitively(input string) (*PublisherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PublisherId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PublisherId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - return &id, nil + return nil } // ValidatePublisherID checks that 'input' can be parsed as a Publisher ID diff --git a/resource-manager/compute/2021-11-01/virtualmachineimages/id_sku.go b/resource-manager/compute/2021-11-01/virtualmachineimages/id_sku.go index 90d2a26bcc9..acf369898fe 100644 --- a/resource-manager/compute/2021-11-01/virtualmachineimages/id_sku.go +++ b/resource-manager/compute/2021-11-01/virtualmachineimages/id_sku.go @@ -40,27 +40,9 @@ func ParseSkuID(input string) (*SkuId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SkuId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) - } - - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) - } - - if id.SkuName, ok = parsed.Parsed["skuName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "skuName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSkuIDInsensitively(input string) (*SkuId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SkuId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SkuId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) + if id.OfferName, ok = input.Parsed["offerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerName", input) } - if id.SkuName, ok = parsed.Parsed["skuName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "skuName", *parsed) + if id.SkuName, ok = input.Parsed["skuName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "skuName", input) } - return &id, nil + return nil } // ValidateSkuID checks that 'input' can be parsed as a Sku ID diff --git a/resource-manager/compute/2021-11-01/virtualmachineimages/id_skuversion.go b/resource-manager/compute/2021-11-01/virtualmachineimages/id_skuversion.go index 09bdbcf481c..e680bffa7aa 100644 --- a/resource-manager/compute/2021-11-01/virtualmachineimages/id_skuversion.go +++ b/resource-manager/compute/2021-11-01/virtualmachineimages/id_skuversion.go @@ -42,31 +42,9 @@ func ParseSkuVersionID(input string) (*SkuVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SkuVersionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) - } - - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) - } - - if id.SkuName, ok = parsed.Parsed["skuName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "skuName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseSkuVersionIDInsensitively(input string) (*SkuVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SkuVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SkuVersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) + if id.OfferName, ok = input.Parsed["offerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerName", input) } - if id.SkuName, ok = parsed.Parsed["skuName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "skuName", *parsed) + if id.SkuName, ok = input.Parsed["skuName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "skuName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateSkuVersionID checks that 'input' can be parsed as a Sku Version ID diff --git a/resource-manager/compute/2021-11-01/virtualmachineimages/id_vmimageoffer.go b/resource-manager/compute/2021-11-01/virtualmachineimages/id_vmimageoffer.go index 0c2069284b8..dec264d0099 100644 --- a/resource-manager/compute/2021-11-01/virtualmachineimages/id_vmimageoffer.go +++ b/resource-manager/compute/2021-11-01/virtualmachineimages/id_vmimageoffer.go @@ -40,27 +40,9 @@ func ParseVMImageOfferID(input string) (*VMImageOfferId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VMImageOfferId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.EdgeZoneName, ok = parsed.Parsed["edgeZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) - } - - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVMImageOfferIDInsensitively(input string) (*VMImageOfferId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VMImageOfferId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VMImageOfferId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.EdgeZoneName, ok = parsed.Parsed["edgeZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", *parsed) + if id.EdgeZoneName, ok = input.Parsed["edgeZoneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) + if id.OfferName, ok = input.Parsed["offerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerName", input) } - return &id, nil + return nil } // ValidateVMImageOfferID checks that 'input' can be parsed as a V M Image Offer ID diff --git a/resource-manager/compute/2021-11-01/virtualmachineruncommands/id_location.go b/resource-manager/compute/2021-11-01/virtualmachineruncommands/id_location.go index c93c2bef2a9..8a8238cc803 100644 --- a/resource-manager/compute/2021-11-01/virtualmachineruncommands/id_location.go +++ b/resource-manager/compute/2021-11-01/virtualmachineruncommands/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/compute/2021-11-01/virtualmachineruncommands/id_runcommand.go b/resource-manager/compute/2021-11-01/virtualmachineruncommands/id_runcommand.go index e82082c4ee1..8852e7f8ddc 100644 --- a/resource-manager/compute/2021-11-01/virtualmachineruncommands/id_runcommand.go +++ b/resource-manager/compute/2021-11-01/virtualmachineruncommands/id_runcommand.go @@ -36,19 +36,9 @@ func ParseRunCommandID(input string) (*RunCommandId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunCommandId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.CommandId, ok = parsed.Parsed["commandId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "commandId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRunCommandIDInsensitively(input string) (*RunCommandId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunCommandId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RunCommandId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.CommandId, ok = parsed.Parsed["commandId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "commandId", *parsed) + if id.CommandId, ok = input.Parsed["commandId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "commandId", input) } - return &id, nil + return nil } // ValidateRunCommandID checks that 'input' can be parsed as a Run Command ID diff --git a/resource-manager/compute/2021-11-01/virtualmachineruncommands/id_virtualmachine.go b/resource-manager/compute/2021-11-01/virtualmachineruncommands/id_virtualmachine.go index 2d4d8c99f10..07f5b7a3786 100644 --- a/resource-manager/compute/2021-11-01/virtualmachineruncommands/id_virtualmachine.go +++ b/resource-manager/compute/2021-11-01/virtualmachineruncommands/id_virtualmachine.go @@ -36,19 +36,9 @@ func ParseVirtualMachineID(input string) (*VirtualMachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineIDInsensitively(input string) (*VirtualMachineId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - return &id, nil + return nil } // ValidateVirtualMachineID checks that 'input' can be parsed as a Virtual Machine ID diff --git a/resource-manager/compute/2021-11-01/virtualmachineruncommands/id_virtualmachineruncommand.go b/resource-manager/compute/2021-11-01/virtualmachineruncommands/id_virtualmachineruncommand.go index f3d518d4e40..10d5aef8fce 100644 --- a/resource-manager/compute/2021-11-01/virtualmachineruncommands/id_virtualmachineruncommand.go +++ b/resource-manager/compute/2021-11-01/virtualmachineruncommands/id_virtualmachineruncommand.go @@ -38,23 +38,9 @@ func ParseVirtualMachineRunCommandID(input string) (*VirtualMachineRunCommandId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineRunCommandId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) - } - - if id.RunCommandName, ok = parsed.Parsed["runCommandName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runCommandName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualMachineRunCommandIDInsensitively(input string) (*VirtualMachine return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineRunCommandId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineRunCommandId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - if id.RunCommandName, ok = parsed.Parsed["runCommandName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runCommandName", *parsed) + if id.RunCommandName, ok = input.Parsed["runCommandName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runCommandName", input) } - return &id, nil + return nil } // ValidateVirtualMachineRunCommandID checks that 'input' can be parsed as a Virtual Machine Run Command ID diff --git a/resource-manager/compute/2021-11-01/virtualmachines/id_location.go b/resource-manager/compute/2021-11-01/virtualmachines/id_location.go index 4666b6bb106..8f54853528a 100644 --- a/resource-manager/compute/2021-11-01/virtualmachines/id_location.go +++ b/resource-manager/compute/2021-11-01/virtualmachines/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/compute/2021-11-01/virtualmachines/id_virtualmachine.go b/resource-manager/compute/2021-11-01/virtualmachines/id_virtualmachine.go index 3d3c57c3528..367cce21365 100644 --- a/resource-manager/compute/2021-11-01/virtualmachines/id_virtualmachine.go +++ b/resource-manager/compute/2021-11-01/virtualmachines/id_virtualmachine.go @@ -36,19 +36,9 @@ func ParseVirtualMachineID(input string) (*VirtualMachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineIDInsensitively(input string) (*VirtualMachineId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - return &id, nil + return nil } // ValidateVirtualMachineID checks that 'input' can be parsed as a Virtual Machine ID diff --git a/resource-manager/compute/2021-11-01/virtualmachinescalesetextensions/id_virtualmachinescaleset.go b/resource-manager/compute/2021-11-01/virtualmachinescalesetextensions/id_virtualmachinescaleset.go index 2c9fe5b0362..7b3d32af330 100644 --- a/resource-manager/compute/2021-11-01/virtualmachinescalesetextensions/id_virtualmachinescaleset.go +++ b/resource-manager/compute/2021-11-01/virtualmachinescalesetextensions/id_virtualmachinescaleset.go @@ -36,19 +36,9 @@ func ParseVirtualMachineScaleSetID(input string) (*VirtualMachineScaleSetId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineScaleSetIDInsensitively(input string) (*VirtualMachineSc return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineScaleSetId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - return &id, nil + return nil } // ValidateVirtualMachineScaleSetID checks that 'input' can be parsed as a Virtual Machine Scale Set ID diff --git a/resource-manager/compute/2021-11-01/virtualmachinescalesetextensions/id_virtualmachinescalesetextension.go b/resource-manager/compute/2021-11-01/virtualmachinescalesetextensions/id_virtualmachinescalesetextension.go index 3b656210a92..7124d08b494 100644 --- a/resource-manager/compute/2021-11-01/virtualmachinescalesetextensions/id_virtualmachinescalesetextension.go +++ b/resource-manager/compute/2021-11-01/virtualmachinescalesetextensions/id_virtualmachinescalesetextension.go @@ -38,23 +38,9 @@ func ParseVirtualMachineScaleSetExtensionID(input string) (*VirtualMachineScaleS return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetExtensionId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) - } - - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualMachineScaleSetExtensionIDInsensitively(input string) (*Virtual return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetExtensionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineScaleSetExtensionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if id.ExtensionName, ok = input.Parsed["extensionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "extensionName", input) } - return &id, nil + return nil } // ValidateVirtualMachineScaleSetExtensionID checks that 'input' can be parsed as a Virtual Machine Scale Set Extension ID diff --git a/resource-manager/compute/2021-11-01/virtualmachinescalesetrollingupgrades/id_virtualmachinescaleset.go b/resource-manager/compute/2021-11-01/virtualmachinescalesetrollingupgrades/id_virtualmachinescaleset.go index c6e19fcfa2a..9bc0d385bef 100644 --- a/resource-manager/compute/2021-11-01/virtualmachinescalesetrollingupgrades/id_virtualmachinescaleset.go +++ b/resource-manager/compute/2021-11-01/virtualmachinescalesetrollingupgrades/id_virtualmachinescaleset.go @@ -36,19 +36,9 @@ func ParseVirtualMachineScaleSetID(input string) (*VirtualMachineScaleSetId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineScaleSetIDInsensitively(input string) (*VirtualMachineSc return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineScaleSetId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - return &id, nil + return nil } // ValidateVirtualMachineScaleSetID checks that 'input' can be parsed as a Virtual Machine Scale Set ID diff --git a/resource-manager/compute/2021-11-01/virtualmachinescalesets/id_location.go b/resource-manager/compute/2021-11-01/virtualmachinescalesets/id_location.go index 64147f562bc..c9c4831a0b4 100644 --- a/resource-manager/compute/2021-11-01/virtualmachinescalesets/id_location.go +++ b/resource-manager/compute/2021-11-01/virtualmachinescalesets/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/compute/2021-11-01/virtualmachinescalesets/id_virtualmachinescaleset.go b/resource-manager/compute/2021-11-01/virtualmachinescalesets/id_virtualmachinescaleset.go index 92d812ec1a0..0dca997a232 100644 --- a/resource-manager/compute/2021-11-01/virtualmachinescalesets/id_virtualmachinescaleset.go +++ b/resource-manager/compute/2021-11-01/virtualmachinescalesets/id_virtualmachinescaleset.go @@ -36,19 +36,9 @@ func ParseVirtualMachineScaleSetID(input string) (*VirtualMachineScaleSetId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineScaleSetIDInsensitively(input string) (*VirtualMachineSc return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineScaleSetId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - return &id, nil + return nil } // ValidateVirtualMachineScaleSetID checks that 'input' can be parsed as a Virtual Machine Scale Set ID diff --git a/resource-manager/compute/2021-11-01/virtualmachinescalesetvmextensions/id_virtualmachineextension.go b/resource-manager/compute/2021-11-01/virtualmachinescalesetvmextensions/id_virtualmachineextension.go index 66266d9719e..1623fb4b631 100644 --- a/resource-manager/compute/2021-11-01/virtualmachinescalesetvmextensions/id_virtualmachineextension.go +++ b/resource-manager/compute/2021-11-01/virtualmachinescalesetvmextensions/id_virtualmachineextension.go @@ -40,27 +40,9 @@ func ParseVirtualMachineExtensionID(input string) (*VirtualMachineExtensionId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineExtensionId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) - } - - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) - } - - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVirtualMachineExtensionIDInsensitively(input string) (*VirtualMachineE return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineExtensionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VirtualMachineExtensionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if id.InstanceId, ok = input.Parsed["instanceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceId", input) } - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if id.ExtensionName, ok = input.Parsed["extensionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "extensionName", input) } - return &id, nil + return nil } // ValidateVirtualMachineExtensionID checks that 'input' can be parsed as a Virtual Machine Extension ID diff --git a/resource-manager/compute/2021-11-01/virtualmachinescalesetvmextensions/id_virtualmachinescalesetvirtualmachine.go b/resource-manager/compute/2021-11-01/virtualmachinescalesetvmextensions/id_virtualmachinescalesetvirtualmachine.go index 2cbc7556565..4a631b44413 100644 --- a/resource-manager/compute/2021-11-01/virtualmachinescalesetvmextensions/id_virtualmachinescalesetvirtualmachine.go +++ b/resource-manager/compute/2021-11-01/virtualmachinescalesetvmextensions/id_virtualmachinescalesetvirtualmachine.go @@ -38,23 +38,9 @@ func ParseVirtualMachineScaleSetVirtualMachineID(input string) (*VirtualMachineS return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetVirtualMachineId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) - } - - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualMachineScaleSetVirtualMachineIDInsensitively(input string) (*Vi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetVirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineScaleSetVirtualMachineId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if id.InstanceId, ok = input.Parsed["instanceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceId", input) } - return &id, nil + return nil } // ValidateVirtualMachineScaleSetVirtualMachineID checks that 'input' can be parsed as a Virtual Machine Scale Set Virtual Machine ID diff --git a/resource-manager/compute/2021-11-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachine.go b/resource-manager/compute/2021-11-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachine.go index 4e39acac92a..eae9c455cea 100644 --- a/resource-manager/compute/2021-11-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachine.go +++ b/resource-manager/compute/2021-11-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachine.go @@ -38,23 +38,9 @@ func ParseVirtualMachineScaleSetVirtualMachineID(input string) (*VirtualMachineS return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetVirtualMachineId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) - } - - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualMachineScaleSetVirtualMachineIDInsensitively(input string) (*Vi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetVirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineScaleSetVirtualMachineId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if id.InstanceId, ok = input.Parsed["instanceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceId", input) } - return &id, nil + return nil } // ValidateVirtualMachineScaleSetVirtualMachineID checks that 'input' can be parsed as a Virtual Machine Scale Set Virtual Machine ID diff --git a/resource-manager/compute/2021-11-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachineruncommand.go b/resource-manager/compute/2021-11-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachineruncommand.go index 31b9bd80ffc..dba7f64aa9a 100644 --- a/resource-manager/compute/2021-11-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachineruncommand.go +++ b/resource-manager/compute/2021-11-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachineruncommand.go @@ -40,27 +40,9 @@ func ParseVirtualMachineScaleSetVirtualMachineRunCommandID(input string) (*Virtu return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetVirtualMachineRunCommandId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) - } - - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) - } - - if id.RunCommandName, ok = parsed.Parsed["runCommandName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runCommandName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVirtualMachineScaleSetVirtualMachineRunCommandIDInsensitively(input st return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetVirtualMachineRunCommandId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VirtualMachineScaleSetVirtualMachineRunCommandId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if id.InstanceId, ok = input.Parsed["instanceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceId", input) } - if id.RunCommandName, ok = parsed.Parsed["runCommandName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runCommandName", *parsed) + if id.RunCommandName, ok = input.Parsed["runCommandName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runCommandName", input) } - return &id, nil + return nil } // ValidateVirtualMachineScaleSetVirtualMachineRunCommandID checks that 'input' can be parsed as a Virtual Machine Scale Set Virtual Machine Run Command ID diff --git a/resource-manager/compute/2021-11-01/virtualmachinescalesetvms/id_virtualmachinescaleset.go b/resource-manager/compute/2021-11-01/virtualmachinescalesetvms/id_virtualmachinescaleset.go index cd06d946474..d1d9b01f3c7 100644 --- a/resource-manager/compute/2021-11-01/virtualmachinescalesetvms/id_virtualmachinescaleset.go +++ b/resource-manager/compute/2021-11-01/virtualmachinescalesetvms/id_virtualmachinescaleset.go @@ -36,19 +36,9 @@ func ParseVirtualMachineScaleSetID(input string) (*VirtualMachineScaleSetId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineScaleSetIDInsensitively(input string) (*VirtualMachineSc return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineScaleSetId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - return &id, nil + return nil } // ValidateVirtualMachineScaleSetID checks that 'input' can be parsed as a Virtual Machine Scale Set ID diff --git a/resource-manager/compute/2021-11-01/virtualmachinescalesetvms/id_virtualmachinescalesetvirtualmachine.go b/resource-manager/compute/2021-11-01/virtualmachinescalesetvms/id_virtualmachinescalesetvirtualmachine.go index c6f1a6327f2..0413b4eb17c 100644 --- a/resource-manager/compute/2021-11-01/virtualmachinescalesetvms/id_virtualmachinescalesetvirtualmachine.go +++ b/resource-manager/compute/2021-11-01/virtualmachinescalesetvms/id_virtualmachinescalesetvirtualmachine.go @@ -38,23 +38,9 @@ func ParseVirtualMachineScaleSetVirtualMachineID(input string) (*VirtualMachineS return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetVirtualMachineId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) - } - - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualMachineScaleSetVirtualMachineIDInsensitively(input string) (*Vi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetVirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineScaleSetVirtualMachineId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if id.InstanceId, ok = input.Parsed["instanceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceId", input) } - return &id, nil + return nil } // ValidateVirtualMachineScaleSetVirtualMachineID checks that 'input' can be parsed as a Virtual Machine Scale Set Virtual Machine ID diff --git a/resource-manager/compute/2021-11-01/virtualmachinesizes/id_location.go b/resource-manager/compute/2021-11-01/virtualmachinesizes/id_location.go index 3bd0de508bf..99331262075 100644 --- a/resource-manager/compute/2021-11-01/virtualmachinesizes/id_location.go +++ b/resource-manager/compute/2021-11-01/virtualmachinesizes/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/compute/2022-03-01/availabilitysets/id_availabilityset.go b/resource-manager/compute/2022-03-01/availabilitysets/id_availabilityset.go index 8564b6ab2ac..2393723dfd3 100644 --- a/resource-manager/compute/2022-03-01/availabilitysets/id_availabilityset.go +++ b/resource-manager/compute/2022-03-01/availabilitysets/id_availabilityset.go @@ -36,19 +36,9 @@ func ParseAvailabilitySetID(input string) (*AvailabilitySetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AvailabilitySetId{} - - 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.AvailabilitySetName, ok = parsed.Parsed["availabilitySetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "availabilitySetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAvailabilitySetIDInsensitively(input string) (*AvailabilitySetId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AvailabilitySetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AvailabilitySetId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AvailabilitySetName, ok = parsed.Parsed["availabilitySetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "availabilitySetName", *parsed) + if id.AvailabilitySetName, ok = input.Parsed["availabilitySetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "availabilitySetName", input) } - return &id, nil + return nil } // ValidateAvailabilitySetID checks that 'input' can be parsed as a Availability Set ID diff --git a/resource-manager/compute/2022-03-01/capacityreservation/id_capacityreservationgroup.go b/resource-manager/compute/2022-03-01/capacityreservation/id_capacityreservationgroup.go index 4c5b6bbd697..56ded1c940b 100644 --- a/resource-manager/compute/2022-03-01/capacityreservation/id_capacityreservationgroup.go +++ b/resource-manager/compute/2022-03-01/capacityreservation/id_capacityreservationgroup.go @@ -36,19 +36,9 @@ func ParseCapacityReservationGroupID(input string) (*CapacityReservationGroupId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapacityReservationGroupId{} - - 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.CapacityReservationGroupName, ok = parsed.Parsed["capacityReservationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseCapacityReservationGroupIDInsensitively(input string) (*CapacityReserv return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapacityReservationGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CapacityReservationGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CapacityReservationGroupName, ok = parsed.Parsed["capacityReservationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationGroupName", *parsed) + if id.CapacityReservationGroupName, ok = input.Parsed["capacityReservationGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationGroupName", input) } - return &id, nil + return nil } // ValidateCapacityReservationGroupID checks that 'input' can be parsed as a Capacity Reservation Group ID diff --git a/resource-manager/compute/2022-03-01/capacityreservationgroups/id_capacityreservationgroup.go b/resource-manager/compute/2022-03-01/capacityreservationgroups/id_capacityreservationgroup.go index b974029515e..725ce39f033 100644 --- a/resource-manager/compute/2022-03-01/capacityreservationgroups/id_capacityreservationgroup.go +++ b/resource-manager/compute/2022-03-01/capacityreservationgroups/id_capacityreservationgroup.go @@ -36,19 +36,9 @@ func ParseCapacityReservationGroupID(input string) (*CapacityReservationGroupId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapacityReservationGroupId{} - - 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.CapacityReservationGroupName, ok = parsed.Parsed["capacityReservationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseCapacityReservationGroupIDInsensitively(input string) (*CapacityReserv return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapacityReservationGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CapacityReservationGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CapacityReservationGroupName, ok = parsed.Parsed["capacityReservationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationGroupName", *parsed) + if id.CapacityReservationGroupName, ok = input.Parsed["capacityReservationGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationGroupName", input) } - return &id, nil + return nil } // ValidateCapacityReservationGroupID checks that 'input' can be parsed as a Capacity Reservation Group ID diff --git a/resource-manager/compute/2022-03-01/capacityreservations/id_capacityreservation.go b/resource-manager/compute/2022-03-01/capacityreservations/id_capacityreservation.go index df25394758f..ac78ccbcc3e 100644 --- a/resource-manager/compute/2022-03-01/capacityreservations/id_capacityreservation.go +++ b/resource-manager/compute/2022-03-01/capacityreservations/id_capacityreservation.go @@ -38,23 +38,9 @@ func ParseCapacityReservationID(input string) (*CapacityReservationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapacityReservationId{} - - 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.CapacityReservationGroupName, ok = parsed.Parsed["capacityReservationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationGroupName", *parsed) - } - - if id.CapacityReservationName, ok = parsed.Parsed["capacityReservationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCapacityReservationIDInsensitively(input string) (*CapacityReservation return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapacityReservationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CapacityReservationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CapacityReservationGroupName, ok = parsed.Parsed["capacityReservationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationGroupName", *parsed) + if id.CapacityReservationGroupName, ok = input.Parsed["capacityReservationGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationGroupName", input) } - if id.CapacityReservationName, ok = parsed.Parsed["capacityReservationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationName", *parsed) + if id.CapacityReservationName, ok = input.Parsed["capacityReservationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationName", input) } - return &id, nil + return nil } // ValidateCapacityReservationID checks that 'input' can be parsed as a Capacity Reservation ID diff --git a/resource-manager/compute/2022-03-01/dedicatedhost/id_host.go b/resource-manager/compute/2022-03-01/dedicatedhost/id_host.go index 8e13e5816d4..277c92b2fe0 100644 --- a/resource-manager/compute/2022-03-01/dedicatedhost/id_host.go +++ b/resource-manager/compute/2022-03-01/dedicatedhost/id_host.go @@ -38,23 +38,9 @@ func ParseHostID(input string) (*HostId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostId{} - - 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.HostGroupName, ok = parsed.Parsed["hostGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostGroupName", *parsed) - } - - if id.HostName, ok = parsed.Parsed["hostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseHostIDInsensitively(input string) (*HostId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *HostId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostGroupName, ok = parsed.Parsed["hostGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostGroupName", *parsed) + if id.HostGroupName, ok = input.Parsed["hostGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostGroupName", input) } - if id.HostName, ok = parsed.Parsed["hostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostName", *parsed) + if id.HostName, ok = input.Parsed["hostName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostName", input) } - return &id, nil + return nil } // ValidateHostID checks that 'input' can be parsed as a Host ID diff --git a/resource-manager/compute/2022-03-01/dedicatedhost/id_hostgroup.go b/resource-manager/compute/2022-03-01/dedicatedhost/id_hostgroup.go index 98371d9147a..4cc57240984 100644 --- a/resource-manager/compute/2022-03-01/dedicatedhost/id_hostgroup.go +++ b/resource-manager/compute/2022-03-01/dedicatedhost/id_hostgroup.go @@ -36,19 +36,9 @@ func ParseHostGroupID(input string) (*HostGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostGroupId{} - - 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.HostGroupName, ok = parsed.Parsed["hostGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseHostGroupIDInsensitively(input string) (*HostGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *HostGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostGroupName, ok = parsed.Parsed["hostGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostGroupName", *parsed) + if id.HostGroupName, ok = input.Parsed["hostGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostGroupName", input) } - return &id, nil + return nil } // ValidateHostGroupID checks that 'input' can be parsed as a Host Group ID diff --git a/resource-manager/compute/2022-03-01/dedicatedhostgroups/id_hostgroup.go b/resource-manager/compute/2022-03-01/dedicatedhostgroups/id_hostgroup.go index 74523582952..fea78a50c47 100644 --- a/resource-manager/compute/2022-03-01/dedicatedhostgroups/id_hostgroup.go +++ b/resource-manager/compute/2022-03-01/dedicatedhostgroups/id_hostgroup.go @@ -36,19 +36,9 @@ func ParseHostGroupID(input string) (*HostGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostGroupId{} - - 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.HostGroupName, ok = parsed.Parsed["hostGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseHostGroupIDInsensitively(input string) (*HostGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *HostGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostGroupName, ok = parsed.Parsed["hostGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostGroupName", *parsed) + if id.HostGroupName, ok = input.Parsed["hostGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostGroupName", input) } - return &id, nil + return nil } // ValidateHostGroupID checks that 'input' can be parsed as a Host Group ID diff --git a/resource-manager/compute/2022-03-01/dedicatedhosts/id_host.go b/resource-manager/compute/2022-03-01/dedicatedhosts/id_host.go index 762971eb041..4a087b87639 100644 --- a/resource-manager/compute/2022-03-01/dedicatedhosts/id_host.go +++ b/resource-manager/compute/2022-03-01/dedicatedhosts/id_host.go @@ -38,23 +38,9 @@ func ParseHostID(input string) (*HostId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostId{} - - 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.HostGroupName, ok = parsed.Parsed["hostGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostGroupName", *parsed) - } - - if id.HostName, ok = parsed.Parsed["hostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseHostIDInsensitively(input string) (*HostId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *HostId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostGroupName, ok = parsed.Parsed["hostGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostGroupName", *parsed) + if id.HostGroupName, ok = input.Parsed["hostGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostGroupName", input) } - if id.HostName, ok = parsed.Parsed["hostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostName", *parsed) + if id.HostName, ok = input.Parsed["hostName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostName", input) } - return &id, nil + return nil } // ValidateHostID checks that 'input' can be parsed as a Host ID diff --git a/resource-manager/compute/2022-03-01/images/id_image.go b/resource-manager/compute/2022-03-01/images/id_image.go index 048dbeac923..bd84d2f6092 100644 --- a/resource-manager/compute/2022-03-01/images/id_image.go +++ b/resource-manager/compute/2022-03-01/images/id_image.go @@ -36,19 +36,9 @@ func ParseImageID(input string) (*ImageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ImageId{} - - 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.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseImageIDInsensitively(input string) (*ImageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ImageId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ImageId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) + if id.ImageName, ok = input.Parsed["imageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "imageName", input) } - return &id, nil + return nil } // ValidateImageID checks that 'input' can be parsed as a Image ID diff --git a/resource-manager/compute/2022-03-01/loganalytics/id_location.go b/resource-manager/compute/2022-03-01/loganalytics/id_location.go index 9f246f8486e..fba54496f0a 100644 --- a/resource-manager/compute/2022-03-01/loganalytics/id_location.go +++ b/resource-manager/compute/2022-03-01/loganalytics/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/compute/2022-03-01/proximityplacementgroups/id_proximityplacementgroup.go b/resource-manager/compute/2022-03-01/proximityplacementgroups/id_proximityplacementgroup.go index b220644fa11..1232e950c85 100644 --- a/resource-manager/compute/2022-03-01/proximityplacementgroups/id_proximityplacementgroup.go +++ b/resource-manager/compute/2022-03-01/proximityplacementgroups/id_proximityplacementgroup.go @@ -36,19 +36,9 @@ func ParseProximityPlacementGroupID(input string) (*ProximityPlacementGroupId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProximityPlacementGroupId{} - - 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.ProximityPlacementGroupName, ok = parsed.Parsed["proximityPlacementGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "proximityPlacementGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProximityPlacementGroupIDInsensitively(input string) (*ProximityPlacem return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProximityPlacementGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProximityPlacementGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ProximityPlacementGroupName, ok = parsed.Parsed["proximityPlacementGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "proximityPlacementGroupName", *parsed) + if id.ProximityPlacementGroupName, ok = input.Parsed["proximityPlacementGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "proximityPlacementGroupName", input) } - return &id, nil + return nil } // ValidateProximityPlacementGroupID checks that 'input' can be parsed as a Proximity Placement Group ID diff --git a/resource-manager/compute/2022-03-01/restorepointcollections/id_restorepointcollection.go b/resource-manager/compute/2022-03-01/restorepointcollections/id_restorepointcollection.go index a51a6398432..9f496b37f89 100644 --- a/resource-manager/compute/2022-03-01/restorepointcollections/id_restorepointcollection.go +++ b/resource-manager/compute/2022-03-01/restorepointcollections/id_restorepointcollection.go @@ -36,19 +36,9 @@ func ParseRestorePointCollectionID(input string) (*RestorePointCollectionId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RestorePointCollectionId{} - - 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.RestorePointCollectionName, ok = parsed.Parsed["restorePointCollectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorePointCollectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRestorePointCollectionIDInsensitively(input string) (*RestorePointColl return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RestorePointCollectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RestorePointCollectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RestorePointCollectionName, ok = parsed.Parsed["restorePointCollectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorePointCollectionName", *parsed) + if id.RestorePointCollectionName, ok = input.Parsed["restorePointCollectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "restorePointCollectionName", input) } - return &id, nil + return nil } // ValidateRestorePointCollectionID checks that 'input' can be parsed as a Restore Point Collection ID diff --git a/resource-manager/compute/2022-03-01/restorepoints/id_restorepoint.go b/resource-manager/compute/2022-03-01/restorepoints/id_restorepoint.go index 3344daaf70c..0a5b90ac0b5 100644 --- a/resource-manager/compute/2022-03-01/restorepoints/id_restorepoint.go +++ b/resource-manager/compute/2022-03-01/restorepoints/id_restorepoint.go @@ -38,23 +38,9 @@ func ParseRestorePointID(input string) (*RestorePointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RestorePointId{} - - 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.RestorePointCollectionName, ok = parsed.Parsed["restorePointCollectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorePointCollectionName", *parsed) - } - - if id.RestorePointName, ok = parsed.Parsed["restorePointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorePointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRestorePointIDInsensitively(input string) (*RestorePointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RestorePointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RestorePointId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RestorePointCollectionName, ok = parsed.Parsed["restorePointCollectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorePointCollectionName", *parsed) + if id.RestorePointCollectionName, ok = input.Parsed["restorePointCollectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "restorePointCollectionName", input) } - if id.RestorePointName, ok = parsed.Parsed["restorePointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorePointName", *parsed) + if id.RestorePointName, ok = input.Parsed["restorePointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "restorePointName", input) } - return &id, nil + return nil } // ValidateRestorePointID checks that 'input' can be parsed as a Restore Point ID diff --git a/resource-manager/compute/2022-03-01/sshpublickeys/id_sshpublickey.go b/resource-manager/compute/2022-03-01/sshpublickeys/id_sshpublickey.go index 9c7f9ae62ba..9e9ee5ff0f6 100644 --- a/resource-manager/compute/2022-03-01/sshpublickeys/id_sshpublickey.go +++ b/resource-manager/compute/2022-03-01/sshpublickeys/id_sshpublickey.go @@ -36,19 +36,9 @@ func ParseSshPublicKeyID(input string) (*SshPublicKeyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SshPublicKeyId{} - - 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.SshPublicKeyName, ok = parsed.Parsed["sshPublicKeyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sshPublicKeyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSshPublicKeyIDInsensitively(input string) (*SshPublicKeyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SshPublicKeyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SshPublicKeyId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SshPublicKeyName, ok = parsed.Parsed["sshPublicKeyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sshPublicKeyName", *parsed) + if id.SshPublicKeyName, ok = input.Parsed["sshPublicKeyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sshPublicKeyName", input) } - return &id, nil + return nil } // ValidateSshPublicKeyID checks that 'input' can be parsed as a Ssh Public Key ID diff --git a/resource-manager/compute/2022-03-01/virtualmachineextensionimages/id_publisher.go b/resource-manager/compute/2022-03-01/virtualmachineextensionimages/id_publisher.go index b45241d6952..573fe07895b 100644 --- a/resource-manager/compute/2022-03-01/virtualmachineextensionimages/id_publisher.go +++ b/resource-manager/compute/2022-03-01/virtualmachineextensionimages/id_publisher.go @@ -36,19 +36,9 @@ func ParsePublisherID(input string) (*PublisherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PublisherId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePublisherIDInsensitively(input string) (*PublisherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PublisherId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PublisherId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - return &id, nil + return nil } // ValidatePublisherID checks that 'input' can be parsed as a Publisher ID diff --git a/resource-manager/compute/2022-03-01/virtualmachineextensionimages/id_type.go b/resource-manager/compute/2022-03-01/virtualmachineextensionimages/id_type.go index 95a118e7bca..90477651f07 100644 --- a/resource-manager/compute/2022-03-01/virtualmachineextensionimages/id_type.go +++ b/resource-manager/compute/2022-03-01/virtualmachineextensionimages/id_type.go @@ -38,23 +38,9 @@ func ParseTypeID(input string) (*TypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TypeId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) - } - - if id.TypeName, ok = parsed.Parsed["typeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "typeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTypeIDInsensitively(input string) (*TypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - if id.TypeName, ok = parsed.Parsed["typeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "typeName", *parsed) + if id.TypeName, ok = input.Parsed["typeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "typeName", input) } - return &id, nil + return nil } // ValidateTypeID checks that 'input' can be parsed as a Type ID diff --git a/resource-manager/compute/2022-03-01/virtualmachineextensionimages/id_version.go b/resource-manager/compute/2022-03-01/virtualmachineextensionimages/id_version.go index 686cc8d56f1..2bdac8ac968 100644 --- a/resource-manager/compute/2022-03-01/virtualmachineextensionimages/id_version.go +++ b/resource-manager/compute/2022-03-01/virtualmachineextensionimages/id_version.go @@ -40,27 +40,9 @@ func ParseVersionID(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) - } - - if id.TypeName, ok = parsed.Parsed["typeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "typeName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVersionIDInsensitively(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - if id.TypeName, ok = parsed.Parsed["typeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "typeName", *parsed) + if id.TypeName, ok = input.Parsed["typeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "typeName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateVersionID checks that 'input' can be parsed as a Version ID diff --git a/resource-manager/compute/2022-03-01/virtualmachineextensions/id_extension.go b/resource-manager/compute/2022-03-01/virtualmachineextensions/id_extension.go index 6183e0e16f0..e050e85df8b 100644 --- a/resource-manager/compute/2022-03-01/virtualmachineextensions/id_extension.go +++ b/resource-manager/compute/2022-03-01/virtualmachineextensions/id_extension.go @@ -38,23 +38,9 @@ func ParseExtensionID(input string) (*ExtensionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExtensionId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) - } - - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseExtensionIDInsensitively(input string) (*ExtensionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExtensionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ExtensionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if id.ExtensionName, ok = input.Parsed["extensionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "extensionName", input) } - return &id, nil + return nil } // ValidateExtensionID checks that 'input' can be parsed as a Extension ID diff --git a/resource-manager/compute/2022-03-01/virtualmachineextensions/id_virtualmachine.go b/resource-manager/compute/2022-03-01/virtualmachineextensions/id_virtualmachine.go index 548faba78a9..9c53613deaf 100644 --- a/resource-manager/compute/2022-03-01/virtualmachineextensions/id_virtualmachine.go +++ b/resource-manager/compute/2022-03-01/virtualmachineextensions/id_virtualmachine.go @@ -36,19 +36,9 @@ func ParseVirtualMachineID(input string) (*VirtualMachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineIDInsensitively(input string) (*VirtualMachineId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - return &id, nil + return nil } // ValidateVirtualMachineID checks that 'input' can be parsed as a Virtual Machine ID diff --git a/resource-manager/compute/2022-03-01/virtualmachineimages/id_edgezone.go b/resource-manager/compute/2022-03-01/virtualmachineimages/id_edgezone.go index 5c8edcd56e9..2dfaf445e78 100644 --- a/resource-manager/compute/2022-03-01/virtualmachineimages/id_edgezone.go +++ b/resource-manager/compute/2022-03-01/virtualmachineimages/id_edgezone.go @@ -36,19 +36,9 @@ func ParseEdgeZoneID(input string) (*EdgeZoneId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EdgeZoneId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.EdgeZoneName, ok = parsed.Parsed["edgeZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseEdgeZoneIDInsensitively(input string) (*EdgeZoneId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EdgeZoneId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *EdgeZoneId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.EdgeZoneName, ok = parsed.Parsed["edgeZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", *parsed) + if id.EdgeZoneName, ok = input.Parsed["edgeZoneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", input) } - return &id, nil + return nil } // ValidateEdgeZoneID checks that 'input' can be parsed as a Edge Zone ID diff --git a/resource-manager/compute/2022-03-01/virtualmachineimages/id_edgezonepublisher.go b/resource-manager/compute/2022-03-01/virtualmachineimages/id_edgezonepublisher.go index 4ba06023cc7..38e6d0fd8fa 100644 --- a/resource-manager/compute/2022-03-01/virtualmachineimages/id_edgezonepublisher.go +++ b/resource-manager/compute/2022-03-01/virtualmachineimages/id_edgezonepublisher.go @@ -38,23 +38,9 @@ func ParseEdgeZonePublisherID(input string) (*EdgeZonePublisherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EdgeZonePublisherId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.EdgeZoneName, ok = parsed.Parsed["edgeZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseEdgeZonePublisherIDInsensitively(input string) (*EdgeZonePublisherId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EdgeZonePublisherId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EdgeZonePublisherId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.EdgeZoneName, ok = parsed.Parsed["edgeZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", *parsed) + if id.EdgeZoneName, ok = input.Parsed["edgeZoneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - return &id, nil + return nil } // ValidateEdgeZonePublisherID checks that 'input' can be parsed as a Edge Zone Publisher ID diff --git a/resource-manager/compute/2022-03-01/virtualmachineimages/id_location.go b/resource-manager/compute/2022-03-01/virtualmachineimages/id_location.go index c1a3a5cc344..d61a6ec2f5d 100644 --- a/resource-manager/compute/2022-03-01/virtualmachineimages/id_location.go +++ b/resource-manager/compute/2022-03-01/virtualmachineimages/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/compute/2022-03-01/virtualmachineimages/id_offer.go b/resource-manager/compute/2022-03-01/virtualmachineimages/id_offer.go index 0069c32dbbd..ab703ca7b7c 100644 --- a/resource-manager/compute/2022-03-01/virtualmachineimages/id_offer.go +++ b/resource-manager/compute/2022-03-01/virtualmachineimages/id_offer.go @@ -38,23 +38,9 @@ func ParseOfferID(input string) (*OfferId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OfferId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) - } - - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseOfferIDInsensitively(input string) (*OfferId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OfferId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OfferId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) + if id.OfferName, ok = input.Parsed["offerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerName", input) } - return &id, nil + return nil } // ValidateOfferID checks that 'input' can be parsed as a Offer ID diff --git a/resource-manager/compute/2022-03-01/virtualmachineimages/id_offersku.go b/resource-manager/compute/2022-03-01/virtualmachineimages/id_offersku.go index 56e95375101..ff6f1e1b7d0 100644 --- a/resource-manager/compute/2022-03-01/virtualmachineimages/id_offersku.go +++ b/resource-manager/compute/2022-03-01/virtualmachineimages/id_offersku.go @@ -42,31 +42,9 @@ func ParseOfferSkuID(input string) (*OfferSkuId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OfferSkuId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.EdgeZoneName, ok = parsed.Parsed["edgeZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) - } - - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) - } - - if id.SkuName, ok = parsed.Parsed["skuName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "skuName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseOfferSkuIDInsensitively(input string) (*OfferSkuId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OfferSkuId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *OfferSkuId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.EdgeZoneName, ok = parsed.Parsed["edgeZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", *parsed) + if id.EdgeZoneName, ok = input.Parsed["edgeZoneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) + if id.OfferName, ok = input.Parsed["offerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerName", input) } - if id.SkuName, ok = parsed.Parsed["skuName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "skuName", *parsed) + if id.SkuName, ok = input.Parsed["skuName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "skuName", input) } - return &id, nil + return nil } // ValidateOfferSkuID checks that 'input' can be parsed as a Offer Sku ID diff --git a/resource-manager/compute/2022-03-01/virtualmachineimages/id_offerskuversion.go b/resource-manager/compute/2022-03-01/virtualmachineimages/id_offerskuversion.go index 36781641341..4131868dd27 100644 --- a/resource-manager/compute/2022-03-01/virtualmachineimages/id_offerskuversion.go +++ b/resource-manager/compute/2022-03-01/virtualmachineimages/id_offerskuversion.go @@ -44,35 +44,9 @@ func ParseOfferSkuVersionID(input string) (*OfferSkuVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OfferSkuVersionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.EdgeZoneName, ok = parsed.Parsed["edgeZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) - } - - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) - } - - if id.SkuName, ok = parsed.Parsed["skuName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "skuName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseOfferSkuVersionIDInsensitively(input string) (*OfferSkuVersionId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OfferSkuVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *OfferSkuVersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.EdgeZoneName, ok = parsed.Parsed["edgeZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", *parsed) + if id.EdgeZoneName, ok = input.Parsed["edgeZoneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) + if id.OfferName, ok = input.Parsed["offerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerName", input) } - if id.SkuName, ok = parsed.Parsed["skuName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "skuName", *parsed) + if id.SkuName, ok = input.Parsed["skuName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "skuName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateOfferSkuVersionID checks that 'input' can be parsed as a Offer Sku Version ID diff --git a/resource-manager/compute/2022-03-01/virtualmachineimages/id_publisher.go b/resource-manager/compute/2022-03-01/virtualmachineimages/id_publisher.go index 93295bff558..1a369b92ea6 100644 --- a/resource-manager/compute/2022-03-01/virtualmachineimages/id_publisher.go +++ b/resource-manager/compute/2022-03-01/virtualmachineimages/id_publisher.go @@ -36,19 +36,9 @@ func ParsePublisherID(input string) (*PublisherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PublisherId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePublisherIDInsensitively(input string) (*PublisherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PublisherId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PublisherId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - return &id, nil + return nil } // ValidatePublisherID checks that 'input' can be parsed as a Publisher ID diff --git a/resource-manager/compute/2022-03-01/virtualmachineimages/id_sku.go b/resource-manager/compute/2022-03-01/virtualmachineimages/id_sku.go index 90d2a26bcc9..acf369898fe 100644 --- a/resource-manager/compute/2022-03-01/virtualmachineimages/id_sku.go +++ b/resource-manager/compute/2022-03-01/virtualmachineimages/id_sku.go @@ -40,27 +40,9 @@ func ParseSkuID(input string) (*SkuId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SkuId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) - } - - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) - } - - if id.SkuName, ok = parsed.Parsed["skuName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "skuName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSkuIDInsensitively(input string) (*SkuId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SkuId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SkuId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) + if id.OfferName, ok = input.Parsed["offerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerName", input) } - if id.SkuName, ok = parsed.Parsed["skuName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "skuName", *parsed) + if id.SkuName, ok = input.Parsed["skuName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "skuName", input) } - return &id, nil + return nil } // ValidateSkuID checks that 'input' can be parsed as a Sku ID diff --git a/resource-manager/compute/2022-03-01/virtualmachineimages/id_skuversion.go b/resource-manager/compute/2022-03-01/virtualmachineimages/id_skuversion.go index 09bdbcf481c..e680bffa7aa 100644 --- a/resource-manager/compute/2022-03-01/virtualmachineimages/id_skuversion.go +++ b/resource-manager/compute/2022-03-01/virtualmachineimages/id_skuversion.go @@ -42,31 +42,9 @@ func ParseSkuVersionID(input string) (*SkuVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SkuVersionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) - } - - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) - } - - if id.SkuName, ok = parsed.Parsed["skuName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "skuName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseSkuVersionIDInsensitively(input string) (*SkuVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SkuVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SkuVersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) + if id.OfferName, ok = input.Parsed["offerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerName", input) } - if id.SkuName, ok = parsed.Parsed["skuName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "skuName", *parsed) + if id.SkuName, ok = input.Parsed["skuName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "skuName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateSkuVersionID checks that 'input' can be parsed as a Sku Version ID diff --git a/resource-manager/compute/2022-03-01/virtualmachineimages/id_vmimageoffer.go b/resource-manager/compute/2022-03-01/virtualmachineimages/id_vmimageoffer.go index 0c2069284b8..dec264d0099 100644 --- a/resource-manager/compute/2022-03-01/virtualmachineimages/id_vmimageoffer.go +++ b/resource-manager/compute/2022-03-01/virtualmachineimages/id_vmimageoffer.go @@ -40,27 +40,9 @@ func ParseVMImageOfferID(input string) (*VMImageOfferId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VMImageOfferId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.EdgeZoneName, ok = parsed.Parsed["edgeZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) - } - - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVMImageOfferIDInsensitively(input string) (*VMImageOfferId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VMImageOfferId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VMImageOfferId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.EdgeZoneName, ok = parsed.Parsed["edgeZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", *parsed) + if id.EdgeZoneName, ok = input.Parsed["edgeZoneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) + if id.OfferName, ok = input.Parsed["offerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerName", input) } - return &id, nil + return nil } // ValidateVMImageOfferID checks that 'input' can be parsed as a V M Image Offer ID diff --git a/resource-manager/compute/2022-03-01/virtualmachineruncommands/id_location.go b/resource-manager/compute/2022-03-01/virtualmachineruncommands/id_location.go index c93c2bef2a9..8a8238cc803 100644 --- a/resource-manager/compute/2022-03-01/virtualmachineruncommands/id_location.go +++ b/resource-manager/compute/2022-03-01/virtualmachineruncommands/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/compute/2022-03-01/virtualmachineruncommands/id_runcommand.go b/resource-manager/compute/2022-03-01/virtualmachineruncommands/id_runcommand.go index e82082c4ee1..8852e7f8ddc 100644 --- a/resource-manager/compute/2022-03-01/virtualmachineruncommands/id_runcommand.go +++ b/resource-manager/compute/2022-03-01/virtualmachineruncommands/id_runcommand.go @@ -36,19 +36,9 @@ func ParseRunCommandID(input string) (*RunCommandId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunCommandId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.CommandId, ok = parsed.Parsed["commandId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "commandId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRunCommandIDInsensitively(input string) (*RunCommandId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunCommandId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RunCommandId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.CommandId, ok = parsed.Parsed["commandId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "commandId", *parsed) + if id.CommandId, ok = input.Parsed["commandId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "commandId", input) } - return &id, nil + return nil } // ValidateRunCommandID checks that 'input' can be parsed as a Run Command ID diff --git a/resource-manager/compute/2022-03-01/virtualmachineruncommands/id_virtualmachine.go b/resource-manager/compute/2022-03-01/virtualmachineruncommands/id_virtualmachine.go index 2d4d8c99f10..07f5b7a3786 100644 --- a/resource-manager/compute/2022-03-01/virtualmachineruncommands/id_virtualmachine.go +++ b/resource-manager/compute/2022-03-01/virtualmachineruncommands/id_virtualmachine.go @@ -36,19 +36,9 @@ func ParseVirtualMachineID(input string) (*VirtualMachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineIDInsensitively(input string) (*VirtualMachineId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - return &id, nil + return nil } // ValidateVirtualMachineID checks that 'input' can be parsed as a Virtual Machine ID diff --git a/resource-manager/compute/2022-03-01/virtualmachineruncommands/id_virtualmachineruncommand.go b/resource-manager/compute/2022-03-01/virtualmachineruncommands/id_virtualmachineruncommand.go index f3d518d4e40..10d5aef8fce 100644 --- a/resource-manager/compute/2022-03-01/virtualmachineruncommands/id_virtualmachineruncommand.go +++ b/resource-manager/compute/2022-03-01/virtualmachineruncommands/id_virtualmachineruncommand.go @@ -38,23 +38,9 @@ func ParseVirtualMachineRunCommandID(input string) (*VirtualMachineRunCommandId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineRunCommandId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) - } - - if id.RunCommandName, ok = parsed.Parsed["runCommandName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runCommandName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualMachineRunCommandIDInsensitively(input string) (*VirtualMachine return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineRunCommandId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineRunCommandId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - if id.RunCommandName, ok = parsed.Parsed["runCommandName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runCommandName", *parsed) + if id.RunCommandName, ok = input.Parsed["runCommandName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runCommandName", input) } - return &id, nil + return nil } // ValidateVirtualMachineRunCommandID checks that 'input' can be parsed as a Virtual Machine Run Command ID diff --git a/resource-manager/compute/2022-03-01/virtualmachines/id_location.go b/resource-manager/compute/2022-03-01/virtualmachines/id_location.go index 4666b6bb106..8f54853528a 100644 --- a/resource-manager/compute/2022-03-01/virtualmachines/id_location.go +++ b/resource-manager/compute/2022-03-01/virtualmachines/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/compute/2022-03-01/virtualmachines/id_virtualmachine.go b/resource-manager/compute/2022-03-01/virtualmachines/id_virtualmachine.go index 3d3c57c3528..367cce21365 100644 --- a/resource-manager/compute/2022-03-01/virtualmachines/id_virtualmachine.go +++ b/resource-manager/compute/2022-03-01/virtualmachines/id_virtualmachine.go @@ -36,19 +36,9 @@ func ParseVirtualMachineID(input string) (*VirtualMachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineIDInsensitively(input string) (*VirtualMachineId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - return &id, nil + return nil } // ValidateVirtualMachineID checks that 'input' can be parsed as a Virtual Machine ID diff --git a/resource-manager/compute/2022-03-01/virtualmachinescalesetextensions/id_virtualmachinescaleset.go b/resource-manager/compute/2022-03-01/virtualmachinescalesetextensions/id_virtualmachinescaleset.go index 2c9fe5b0362..7b3d32af330 100644 --- a/resource-manager/compute/2022-03-01/virtualmachinescalesetextensions/id_virtualmachinescaleset.go +++ b/resource-manager/compute/2022-03-01/virtualmachinescalesetextensions/id_virtualmachinescaleset.go @@ -36,19 +36,9 @@ func ParseVirtualMachineScaleSetID(input string) (*VirtualMachineScaleSetId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineScaleSetIDInsensitively(input string) (*VirtualMachineSc return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineScaleSetId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - return &id, nil + return nil } // ValidateVirtualMachineScaleSetID checks that 'input' can be parsed as a Virtual Machine Scale Set ID diff --git a/resource-manager/compute/2022-03-01/virtualmachinescalesetextensions/id_virtualmachinescalesetextension.go b/resource-manager/compute/2022-03-01/virtualmachinescalesetextensions/id_virtualmachinescalesetextension.go index 3b656210a92..7124d08b494 100644 --- a/resource-manager/compute/2022-03-01/virtualmachinescalesetextensions/id_virtualmachinescalesetextension.go +++ b/resource-manager/compute/2022-03-01/virtualmachinescalesetextensions/id_virtualmachinescalesetextension.go @@ -38,23 +38,9 @@ func ParseVirtualMachineScaleSetExtensionID(input string) (*VirtualMachineScaleS return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetExtensionId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) - } - - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualMachineScaleSetExtensionIDInsensitively(input string) (*Virtual return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetExtensionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineScaleSetExtensionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if id.ExtensionName, ok = input.Parsed["extensionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "extensionName", input) } - return &id, nil + return nil } // ValidateVirtualMachineScaleSetExtensionID checks that 'input' can be parsed as a Virtual Machine Scale Set Extension ID diff --git a/resource-manager/compute/2022-03-01/virtualmachinescalesetrollingupgrades/id_virtualmachinescaleset.go b/resource-manager/compute/2022-03-01/virtualmachinescalesetrollingupgrades/id_virtualmachinescaleset.go index c6e19fcfa2a..9bc0d385bef 100644 --- a/resource-manager/compute/2022-03-01/virtualmachinescalesetrollingupgrades/id_virtualmachinescaleset.go +++ b/resource-manager/compute/2022-03-01/virtualmachinescalesetrollingupgrades/id_virtualmachinescaleset.go @@ -36,19 +36,9 @@ func ParseVirtualMachineScaleSetID(input string) (*VirtualMachineScaleSetId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineScaleSetIDInsensitively(input string) (*VirtualMachineSc return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineScaleSetId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - return &id, nil + return nil } // ValidateVirtualMachineScaleSetID checks that 'input' can be parsed as a Virtual Machine Scale Set ID diff --git a/resource-manager/compute/2022-03-01/virtualmachinescalesets/id_location.go b/resource-manager/compute/2022-03-01/virtualmachinescalesets/id_location.go index 64147f562bc..c9c4831a0b4 100644 --- a/resource-manager/compute/2022-03-01/virtualmachinescalesets/id_location.go +++ b/resource-manager/compute/2022-03-01/virtualmachinescalesets/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/compute/2022-03-01/virtualmachinescalesets/id_virtualmachinescaleset.go b/resource-manager/compute/2022-03-01/virtualmachinescalesets/id_virtualmachinescaleset.go index 92d812ec1a0..0dca997a232 100644 --- a/resource-manager/compute/2022-03-01/virtualmachinescalesets/id_virtualmachinescaleset.go +++ b/resource-manager/compute/2022-03-01/virtualmachinescalesets/id_virtualmachinescaleset.go @@ -36,19 +36,9 @@ func ParseVirtualMachineScaleSetID(input string) (*VirtualMachineScaleSetId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineScaleSetIDInsensitively(input string) (*VirtualMachineSc return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineScaleSetId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - return &id, nil + return nil } // ValidateVirtualMachineScaleSetID checks that 'input' can be parsed as a Virtual Machine Scale Set ID diff --git a/resource-manager/compute/2022-03-01/virtualmachinescalesetvmextensions/id_virtualmachineextension.go b/resource-manager/compute/2022-03-01/virtualmachinescalesetvmextensions/id_virtualmachineextension.go index 66266d9719e..1623fb4b631 100644 --- a/resource-manager/compute/2022-03-01/virtualmachinescalesetvmextensions/id_virtualmachineextension.go +++ b/resource-manager/compute/2022-03-01/virtualmachinescalesetvmextensions/id_virtualmachineextension.go @@ -40,27 +40,9 @@ func ParseVirtualMachineExtensionID(input string) (*VirtualMachineExtensionId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineExtensionId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) - } - - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) - } - - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVirtualMachineExtensionIDInsensitively(input string) (*VirtualMachineE return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineExtensionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VirtualMachineExtensionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if id.InstanceId, ok = input.Parsed["instanceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceId", input) } - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if id.ExtensionName, ok = input.Parsed["extensionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "extensionName", input) } - return &id, nil + return nil } // ValidateVirtualMachineExtensionID checks that 'input' can be parsed as a Virtual Machine Extension ID diff --git a/resource-manager/compute/2022-03-01/virtualmachinescalesetvmextensions/id_virtualmachinescalesetvirtualmachine.go b/resource-manager/compute/2022-03-01/virtualmachinescalesetvmextensions/id_virtualmachinescalesetvirtualmachine.go index 2cbc7556565..4a631b44413 100644 --- a/resource-manager/compute/2022-03-01/virtualmachinescalesetvmextensions/id_virtualmachinescalesetvirtualmachine.go +++ b/resource-manager/compute/2022-03-01/virtualmachinescalesetvmextensions/id_virtualmachinescalesetvirtualmachine.go @@ -38,23 +38,9 @@ func ParseVirtualMachineScaleSetVirtualMachineID(input string) (*VirtualMachineS return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetVirtualMachineId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) - } - - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualMachineScaleSetVirtualMachineIDInsensitively(input string) (*Vi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetVirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineScaleSetVirtualMachineId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if id.InstanceId, ok = input.Parsed["instanceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceId", input) } - return &id, nil + return nil } // ValidateVirtualMachineScaleSetVirtualMachineID checks that 'input' can be parsed as a Virtual Machine Scale Set Virtual Machine ID diff --git a/resource-manager/compute/2022-03-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachine.go b/resource-manager/compute/2022-03-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachine.go index 4e39acac92a..eae9c455cea 100644 --- a/resource-manager/compute/2022-03-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachine.go +++ b/resource-manager/compute/2022-03-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachine.go @@ -38,23 +38,9 @@ func ParseVirtualMachineScaleSetVirtualMachineID(input string) (*VirtualMachineS return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetVirtualMachineId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) - } - - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualMachineScaleSetVirtualMachineIDInsensitively(input string) (*Vi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetVirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineScaleSetVirtualMachineId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if id.InstanceId, ok = input.Parsed["instanceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceId", input) } - return &id, nil + return nil } // ValidateVirtualMachineScaleSetVirtualMachineID checks that 'input' can be parsed as a Virtual Machine Scale Set Virtual Machine ID diff --git a/resource-manager/compute/2022-03-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachineruncommand.go b/resource-manager/compute/2022-03-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachineruncommand.go index 31b9bd80ffc..dba7f64aa9a 100644 --- a/resource-manager/compute/2022-03-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachineruncommand.go +++ b/resource-manager/compute/2022-03-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachineruncommand.go @@ -40,27 +40,9 @@ func ParseVirtualMachineScaleSetVirtualMachineRunCommandID(input string) (*Virtu return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetVirtualMachineRunCommandId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) - } - - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) - } - - if id.RunCommandName, ok = parsed.Parsed["runCommandName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runCommandName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVirtualMachineScaleSetVirtualMachineRunCommandIDInsensitively(input st return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetVirtualMachineRunCommandId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VirtualMachineScaleSetVirtualMachineRunCommandId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if id.InstanceId, ok = input.Parsed["instanceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceId", input) } - if id.RunCommandName, ok = parsed.Parsed["runCommandName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runCommandName", *parsed) + if id.RunCommandName, ok = input.Parsed["runCommandName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runCommandName", input) } - return &id, nil + return nil } // ValidateVirtualMachineScaleSetVirtualMachineRunCommandID checks that 'input' can be parsed as a Virtual Machine Scale Set Virtual Machine Run Command ID diff --git a/resource-manager/compute/2022-03-01/virtualmachinescalesetvms/id_virtualmachinescaleset.go b/resource-manager/compute/2022-03-01/virtualmachinescalesetvms/id_virtualmachinescaleset.go index cd06d946474..d1d9b01f3c7 100644 --- a/resource-manager/compute/2022-03-01/virtualmachinescalesetvms/id_virtualmachinescaleset.go +++ b/resource-manager/compute/2022-03-01/virtualmachinescalesetvms/id_virtualmachinescaleset.go @@ -36,19 +36,9 @@ func ParseVirtualMachineScaleSetID(input string) (*VirtualMachineScaleSetId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineScaleSetIDInsensitively(input string) (*VirtualMachineSc return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineScaleSetId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - return &id, nil + return nil } // ValidateVirtualMachineScaleSetID checks that 'input' can be parsed as a Virtual Machine Scale Set ID diff --git a/resource-manager/compute/2022-03-01/virtualmachinescalesetvms/id_virtualmachinescalesetvirtualmachine.go b/resource-manager/compute/2022-03-01/virtualmachinescalesetvms/id_virtualmachinescalesetvirtualmachine.go index c6f1a6327f2..0413b4eb17c 100644 --- a/resource-manager/compute/2022-03-01/virtualmachinescalesetvms/id_virtualmachinescalesetvirtualmachine.go +++ b/resource-manager/compute/2022-03-01/virtualmachinescalesetvms/id_virtualmachinescalesetvirtualmachine.go @@ -38,23 +38,9 @@ func ParseVirtualMachineScaleSetVirtualMachineID(input string) (*VirtualMachineS return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetVirtualMachineId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) - } - - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualMachineScaleSetVirtualMachineIDInsensitively(input string) (*Vi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetVirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineScaleSetVirtualMachineId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if id.InstanceId, ok = input.Parsed["instanceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceId", input) } - return &id, nil + return nil } // ValidateVirtualMachineScaleSetVirtualMachineID checks that 'input' can be parsed as a Virtual Machine Scale Set Virtual Machine ID diff --git a/resource-manager/compute/2022-03-01/virtualmachinesizes/id_location.go b/resource-manager/compute/2022-03-01/virtualmachinesizes/id_location.go index 3bd0de508bf..99331262075 100644 --- a/resource-manager/compute/2022-03-01/virtualmachinesizes/id_location.go +++ b/resource-manager/compute/2022-03-01/virtualmachinesizes/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/compute/2022-03-02/diskaccesses/id_diskaccess.go b/resource-manager/compute/2022-03-02/diskaccesses/id_diskaccess.go index 265eb676bec..06ceea1dc2a 100644 --- a/resource-manager/compute/2022-03-02/diskaccesses/id_diskaccess.go +++ b/resource-manager/compute/2022-03-02/diskaccesses/id_diskaccess.go @@ -36,19 +36,9 @@ func ParseDiskAccessID(input string) (*DiskAccessId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiskAccessId{} - - 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.DiskAccessName, ok = parsed.Parsed["diskAccessName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diskAccessName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDiskAccessIDInsensitively(input string) (*DiskAccessId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiskAccessId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DiskAccessId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DiskAccessName, ok = parsed.Parsed["diskAccessName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diskAccessName", *parsed) + if id.DiskAccessName, ok = input.Parsed["diskAccessName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "diskAccessName", input) } - return &id, nil + return nil } // ValidateDiskAccessID checks that 'input' can be parsed as a Disk Access ID diff --git a/resource-manager/compute/2022-03-02/diskaccesses/id_privateendpointconnection.go b/resource-manager/compute/2022-03-02/diskaccesses/id_privateendpointconnection.go index 6973d6ce8c0..304a5887be1 100644 --- a/resource-manager/compute/2022-03-02/diskaccesses/id_privateendpointconnection.go +++ b/resource-manager/compute/2022-03-02/diskaccesses/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.DiskAccessName, ok = parsed.Parsed["diskAccessName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diskAccessName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DiskAccessName, ok = parsed.Parsed["diskAccessName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diskAccessName", *parsed) + if id.DiskAccessName, ok = input.Parsed["diskAccessName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "diskAccessName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/compute/2022-03-02/diskencryptionsets/id_diskencryptionset.go b/resource-manager/compute/2022-03-02/diskencryptionsets/id_diskencryptionset.go index b62ee1a0de1..5b5a32d8f17 100644 --- a/resource-manager/compute/2022-03-02/diskencryptionsets/id_diskencryptionset.go +++ b/resource-manager/compute/2022-03-02/diskencryptionsets/id_diskencryptionset.go @@ -36,19 +36,9 @@ func ParseDiskEncryptionSetID(input string) (*DiskEncryptionSetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiskEncryptionSetId{} - - 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.DiskEncryptionSetName, ok = parsed.Parsed["diskEncryptionSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diskEncryptionSetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDiskEncryptionSetIDInsensitively(input string) (*DiskEncryptionSetId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiskEncryptionSetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DiskEncryptionSetId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DiskEncryptionSetName, ok = parsed.Parsed["diskEncryptionSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diskEncryptionSetName", *parsed) + if id.DiskEncryptionSetName, ok = input.Parsed["diskEncryptionSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "diskEncryptionSetName", input) } - return &id, nil + return nil } // ValidateDiskEncryptionSetID checks that 'input' can be parsed as a Disk Encryption Set ID diff --git a/resource-manager/compute/2022-03-02/disks/id_disk.go b/resource-manager/compute/2022-03-02/disks/id_disk.go index 3415c385da7..6266bcedb6d 100644 --- a/resource-manager/compute/2022-03-02/disks/id_disk.go +++ b/resource-manager/compute/2022-03-02/disks/id_disk.go @@ -36,19 +36,9 @@ func ParseDiskID(input string) (*DiskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiskId{} - - 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.DiskName, ok = parsed.Parsed["diskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diskName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDiskIDInsensitively(input string) (*DiskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiskId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DiskId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DiskName, ok = parsed.Parsed["diskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diskName", *parsed) + if id.DiskName, ok = input.Parsed["diskName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "diskName", input) } - return &id, nil + return nil } // ValidateDiskID checks that 'input' can be parsed as a Disk ID diff --git a/resource-manager/compute/2022-03-02/incrementalrestorepoints/id_diskrestorepoint.go b/resource-manager/compute/2022-03-02/incrementalrestorepoints/id_diskrestorepoint.go index 19f724bcade..6053626999d 100644 --- a/resource-manager/compute/2022-03-02/incrementalrestorepoints/id_diskrestorepoint.go +++ b/resource-manager/compute/2022-03-02/incrementalrestorepoints/id_diskrestorepoint.go @@ -40,27 +40,9 @@ func ParseDiskRestorePointID(input string) (*DiskRestorePointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiskRestorePointId{} - - 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.RestorePointCollectionName, ok = parsed.Parsed["restorePointCollectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorePointCollectionName", *parsed) - } - - if id.RestorePointName, ok = parsed.Parsed["restorePointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorePointName", *parsed) - } - - if id.DiskRestorePointName, ok = parsed.Parsed["diskRestorePointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diskRestorePointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseDiskRestorePointIDInsensitively(input string) (*DiskRestorePointId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiskRestorePointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DiskRestorePointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RestorePointCollectionName, ok = parsed.Parsed["restorePointCollectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorePointCollectionName", *parsed) + if id.RestorePointCollectionName, ok = input.Parsed["restorePointCollectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "restorePointCollectionName", input) } - if id.RestorePointName, ok = parsed.Parsed["restorePointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorePointName", *parsed) + if id.RestorePointName, ok = input.Parsed["restorePointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "restorePointName", input) } - if id.DiskRestorePointName, ok = parsed.Parsed["diskRestorePointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diskRestorePointName", *parsed) + if id.DiskRestorePointName, ok = input.Parsed["diskRestorePointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "diskRestorePointName", input) } - return &id, nil + return nil } // ValidateDiskRestorePointID checks that 'input' can be parsed as a Disk Restore Point ID diff --git a/resource-manager/compute/2022-03-02/incrementalrestorepoints/id_restorepoint.go b/resource-manager/compute/2022-03-02/incrementalrestorepoints/id_restorepoint.go index e45eaafdc2b..1d3fc04c8d3 100644 --- a/resource-manager/compute/2022-03-02/incrementalrestorepoints/id_restorepoint.go +++ b/resource-manager/compute/2022-03-02/incrementalrestorepoints/id_restorepoint.go @@ -38,23 +38,9 @@ func ParseRestorePointID(input string) (*RestorePointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RestorePointId{} - - 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.RestorePointCollectionName, ok = parsed.Parsed["restorePointCollectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorePointCollectionName", *parsed) - } - - if id.RestorePointName, ok = parsed.Parsed["restorePointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorePointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRestorePointIDInsensitively(input string) (*RestorePointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RestorePointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RestorePointId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RestorePointCollectionName, ok = parsed.Parsed["restorePointCollectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorePointCollectionName", *parsed) + if id.RestorePointCollectionName, ok = input.Parsed["restorePointCollectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "restorePointCollectionName", input) } - if id.RestorePointName, ok = parsed.Parsed["restorePointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorePointName", *parsed) + if id.RestorePointName, ok = input.Parsed["restorePointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "restorePointName", input) } - return &id, nil + return nil } // ValidateRestorePointID checks that 'input' can be parsed as a Restore Point ID diff --git a/resource-manager/compute/2022-03-02/snapshots/id_snapshot.go b/resource-manager/compute/2022-03-02/snapshots/id_snapshot.go index f51dc333454..50c70843657 100644 --- a/resource-manager/compute/2022-03-02/snapshots/id_snapshot.go +++ b/resource-manager/compute/2022-03-02/snapshots/id_snapshot.go @@ -36,19 +36,9 @@ func ParseSnapshotID(input string) (*SnapshotId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SnapshotId{} - - 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.SnapshotName, ok = parsed.Parsed["snapshotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSnapshotIDInsensitively(input string) (*SnapshotId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SnapshotId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SnapshotId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SnapshotName, ok = parsed.Parsed["snapshotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotName", *parsed) + if id.SnapshotName, ok = input.Parsed["snapshotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "snapshotName", input) } - return &id, nil + return nil } // ValidateSnapshotID checks that 'input' can be parsed as a Snapshot ID diff --git a/resource-manager/compute/2022-03-03/communitygalleries/id_communitygallery.go b/resource-manager/compute/2022-03-03/communitygalleries/id_communitygallery.go index e09a3fe35f4..bc2ebbcec12 100644 --- a/resource-manager/compute/2022-03-03/communitygalleries/id_communitygallery.go +++ b/resource-manager/compute/2022-03-03/communitygalleries/id_communitygallery.go @@ -36,19 +36,9 @@ func ParseCommunityGalleryID(input string) (*CommunityGalleryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommunityGalleryId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.CommunityGalleryName, ok = parsed.Parsed["communityGalleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "communityGalleryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseCommunityGalleryIDInsensitively(input string) (*CommunityGalleryId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommunityGalleryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CommunityGalleryId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.CommunityGalleryName, ok = parsed.Parsed["communityGalleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "communityGalleryName", *parsed) + if id.CommunityGalleryName, ok = input.Parsed["communityGalleryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "communityGalleryName", input) } - return &id, nil + return nil } // ValidateCommunityGalleryID checks that 'input' can be parsed as a Community Gallery ID diff --git a/resource-manager/compute/2022-03-03/communitygalleryimages/id_communitygallery.go b/resource-manager/compute/2022-03-03/communitygalleryimages/id_communitygallery.go index 14ada4a84f8..dc2ea050a31 100644 --- a/resource-manager/compute/2022-03-03/communitygalleryimages/id_communitygallery.go +++ b/resource-manager/compute/2022-03-03/communitygalleryimages/id_communitygallery.go @@ -36,19 +36,9 @@ func ParseCommunityGalleryID(input string) (*CommunityGalleryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommunityGalleryId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.CommunityGalleryName, ok = parsed.Parsed["communityGalleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "communityGalleryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseCommunityGalleryIDInsensitively(input string) (*CommunityGalleryId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommunityGalleryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CommunityGalleryId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.CommunityGalleryName, ok = parsed.Parsed["communityGalleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "communityGalleryName", *parsed) + if id.CommunityGalleryName, ok = input.Parsed["communityGalleryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "communityGalleryName", input) } - return &id, nil + return nil } // ValidateCommunityGalleryID checks that 'input' can be parsed as a Community Gallery ID diff --git a/resource-manager/compute/2022-03-03/communitygalleryimages/id_communitygalleryimage.go b/resource-manager/compute/2022-03-03/communitygalleryimages/id_communitygalleryimage.go index a0b84d3b21f..3cd48e13cd4 100644 --- a/resource-manager/compute/2022-03-03/communitygalleryimages/id_communitygalleryimage.go +++ b/resource-manager/compute/2022-03-03/communitygalleryimages/id_communitygalleryimage.go @@ -38,23 +38,9 @@ func ParseCommunityGalleryImageID(input string) (*CommunityGalleryImageId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommunityGalleryImageId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.CommunityGalleryName, ok = parsed.Parsed["communityGalleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "communityGalleryName", *parsed) - } - - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCommunityGalleryImageIDInsensitively(input string) (*CommunityGalleryI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool 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.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.CommunityGalleryName, ok = parsed.Parsed["communityGalleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "communityGalleryName", *parsed) + if id.CommunityGalleryName, ok = input.Parsed["communityGalleryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "communityGalleryName", input) } - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) + if id.ImageName, ok = input.Parsed["imageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "imageName", input) } - return &id, nil + return nil } // ValidateCommunityGalleryImageID checks that 'input' can be parsed as a Community Gallery Image ID diff --git a/resource-manager/compute/2022-03-03/communitygalleryimageversions/id_communitygalleryimage.go b/resource-manager/compute/2022-03-03/communitygalleryimageversions/id_communitygalleryimage.go index 4b1bfcdc341..0b9426a4efd 100644 --- a/resource-manager/compute/2022-03-03/communitygalleryimageversions/id_communitygalleryimage.go +++ b/resource-manager/compute/2022-03-03/communitygalleryimageversions/id_communitygalleryimage.go @@ -38,23 +38,9 @@ func ParseCommunityGalleryImageID(input string) (*CommunityGalleryImageId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommunityGalleryImageId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.CommunityGalleryName, ok = parsed.Parsed["communityGalleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "communityGalleryName", *parsed) - } - - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCommunityGalleryImageIDInsensitively(input string) (*CommunityGalleryI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool 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.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.CommunityGalleryName, ok = parsed.Parsed["communityGalleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "communityGalleryName", *parsed) + if id.CommunityGalleryName, ok = input.Parsed["communityGalleryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "communityGalleryName", input) } - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) + if id.ImageName, ok = input.Parsed["imageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "imageName", input) } - return &id, nil + return nil } // ValidateCommunityGalleryImageID checks that 'input' can be parsed as a Community Gallery Image ID diff --git a/resource-manager/compute/2022-03-03/communitygalleryimageversions/id_communitygalleryimageversion.go b/resource-manager/compute/2022-03-03/communitygalleryimageversions/id_communitygalleryimageversion.go index 23649c53fd7..3253b949939 100644 --- a/resource-manager/compute/2022-03-03/communitygalleryimageversions/id_communitygalleryimageversion.go +++ b/resource-manager/compute/2022-03-03/communitygalleryimageversions/id_communitygalleryimageversion.go @@ -40,27 +40,9 @@ func ParseCommunityGalleryImageVersionID(input string) (*CommunityGalleryImageVe return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommunityGalleryImageVersionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.CommunityGalleryName, ok = parsed.Parsed["communityGalleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "communityGalleryName", *parsed) - } - - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseCommunityGalleryImageVersionIDInsensitively(input string) (*CommunityG return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommunityGalleryImageVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *CommunityGalleryImageVersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.CommunityGalleryName, ok = parsed.Parsed["communityGalleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "communityGalleryName", *parsed) + if id.CommunityGalleryName, ok = input.Parsed["communityGalleryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "communityGalleryName", input) } - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) + if id.ImageName, ok = input.Parsed["imageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "imageName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateCommunityGalleryImageVersionID checks that 'input' can be parsed as a Community Gallery Image Version ID diff --git a/resource-manager/compute/2022-03-03/galleryapplications/id_application.go b/resource-manager/compute/2022-03-03/galleryapplications/id_application.go index 8cfa3845ad5..e25e3c30008 100644 --- a/resource-manager/compute/2022-03-03/galleryapplications/id_application.go +++ b/resource-manager/compute/2022-03-03/galleryapplications/id_application.go @@ -38,23 +38,9 @@ func ParseApplicationID(input string) (*ApplicationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationId{} - - 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) - } - - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApplicationIDInsensitively(input string) (*ApplicationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApplicationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.GalleryName, ok = parsed.Parsed["galleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "galleryName", *parsed) + if id.GalleryName, ok = input.Parsed["galleryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "galleryName", input) } - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) + if id.ApplicationName, ok = input.Parsed["applicationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationName", input) } - return &id, nil + return nil } // ValidateApplicationID checks that 'input' can be parsed as a Application ID diff --git a/resource-manager/compute/2022-03-03/galleryapplicationversions/id_application.go b/resource-manager/compute/2022-03-03/galleryapplicationversions/id_application.go index 4b14e9a9b14..8065846d94a 100644 --- a/resource-manager/compute/2022-03-03/galleryapplicationversions/id_application.go +++ b/resource-manager/compute/2022-03-03/galleryapplicationversions/id_application.go @@ -38,23 +38,9 @@ func ParseApplicationID(input string) (*ApplicationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationId{} - - 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) - } - - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApplicationIDInsensitively(input string) (*ApplicationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApplicationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.GalleryName, ok = parsed.Parsed["galleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "galleryName", *parsed) + if id.GalleryName, ok = input.Parsed["galleryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "galleryName", input) } - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) + if id.ApplicationName, ok = input.Parsed["applicationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationName", input) } - return &id, nil + return nil } // ValidateApplicationID checks that 'input' can be parsed as a Application ID diff --git a/resource-manager/compute/2022-03-03/galleryapplicationversions/id_applicationversion.go b/resource-manager/compute/2022-03-03/galleryapplicationversions/id_applicationversion.go index 3a625169a43..7da1557e4c4 100644 --- a/resource-manager/compute/2022-03-03/galleryapplicationversions/id_applicationversion.go +++ b/resource-manager/compute/2022-03-03/galleryapplicationversions/id_applicationversion.go @@ -40,27 +40,9 @@ func ParseApplicationVersionID(input string) (*ApplicationVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationVersionId{} - - 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) - } - - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseApplicationVersionIDInsensitively(input string) (*ApplicationVersionId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ApplicationVersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.GalleryName, ok = parsed.Parsed["galleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "galleryName", *parsed) + if id.GalleryName, ok = input.Parsed["galleryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "galleryName", input) } - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) + if id.ApplicationName, ok = input.Parsed["applicationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateApplicationVersionID checks that 'input' can be parsed as a Application Version ID diff --git a/resource-manager/compute/2022-03-03/galleryimages/id_galleryimage.go b/resource-manager/compute/2022-03-03/galleryimages/id_galleryimage.go index fa85b61fc46..61485503fdc 100644 --- a/resource-manager/compute/2022-03-03/galleryimages/id_galleryimage.go +++ b/resource-manager/compute/2022-03-03/galleryimages/id_galleryimage.go @@ -38,23 +38,9 @@ func ParseGalleryImageID(input string) (*GalleryImageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GalleryImageId{} - - 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) - } - - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGalleryImageIDInsensitively(input string) (*GalleryImageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GalleryImageId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GalleryImageId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.GalleryName, ok = parsed.Parsed["galleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "galleryName", *parsed) + if id.GalleryName, ok = input.Parsed["galleryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "galleryName", input) } - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) + if id.ImageName, ok = input.Parsed["imageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "imageName", input) } - return &id, nil + return nil } // ValidateGalleryImageID checks that 'input' can be parsed as a Gallery Image ID diff --git a/resource-manager/compute/2022-03-03/galleryimageversions/id_galleryimage.go b/resource-manager/compute/2022-03-03/galleryimageversions/id_galleryimage.go index 5a618f37727..523e7b77c4b 100644 --- a/resource-manager/compute/2022-03-03/galleryimageversions/id_galleryimage.go +++ b/resource-manager/compute/2022-03-03/galleryimageversions/id_galleryimage.go @@ -38,23 +38,9 @@ func ParseGalleryImageID(input string) (*GalleryImageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GalleryImageId{} - - 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) - } - - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGalleryImageIDInsensitively(input string) (*GalleryImageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GalleryImageId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GalleryImageId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.GalleryName, ok = parsed.Parsed["galleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "galleryName", *parsed) + if id.GalleryName, ok = input.Parsed["galleryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "galleryName", input) } - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) + if id.ImageName, ok = input.Parsed["imageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "imageName", input) } - return &id, nil + return nil } // ValidateGalleryImageID checks that 'input' can be parsed as a Gallery Image ID diff --git a/resource-manager/compute/2022-03-03/galleryimageversions/id_imageversion.go b/resource-manager/compute/2022-03-03/galleryimageversions/id_imageversion.go index f93bf8d6de6..31e521b0eaf 100644 --- a/resource-manager/compute/2022-03-03/galleryimageversions/id_imageversion.go +++ b/resource-manager/compute/2022-03-03/galleryimageversions/id_imageversion.go @@ -40,27 +40,9 @@ func ParseImageVersionID(input string) (*ImageVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ImageVersionId{} - - 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) - } - - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseImageVersionIDInsensitively(input string) (*ImageVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ImageVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ImageVersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.GalleryName, ok = parsed.Parsed["galleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "galleryName", *parsed) + if id.GalleryName, ok = input.Parsed["galleryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "galleryName", input) } - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) + if id.ImageName, ok = input.Parsed["imageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "imageName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateImageVersionID checks that 'input' can be parsed as a Image Version ID diff --git a/resource-manager/compute/2022-03-03/sharedgalleries/id_location.go b/resource-manager/compute/2022-03-03/sharedgalleries/id_location.go index a9a2ea91b3c..640cca67e04 100644 --- a/resource-manager/compute/2022-03-03/sharedgalleries/id_location.go +++ b/resource-manager/compute/2022-03-03/sharedgalleries/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/compute/2022-03-03/sharedgalleries/id_sharedgallery.go b/resource-manager/compute/2022-03-03/sharedgalleries/id_sharedgallery.go index 232d58c40e2..89f2500e577 100644 --- a/resource-manager/compute/2022-03-03/sharedgalleries/id_sharedgallery.go +++ b/resource-manager/compute/2022-03-03/sharedgalleries/id_sharedgallery.go @@ -36,19 +36,9 @@ func ParseSharedGalleryID(input string) (*SharedGalleryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SharedGalleryId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.SharedGalleryName, ok = parsed.Parsed["sharedGalleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sharedGalleryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSharedGalleryIDInsensitively(input string) (*SharedGalleryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SharedGalleryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SharedGalleryId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.SharedGalleryName, ok = parsed.Parsed["sharedGalleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sharedGalleryName", *parsed) + if id.SharedGalleryName, ok = input.Parsed["sharedGalleryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sharedGalleryName", input) } - return &id, nil + return nil } // ValidateSharedGalleryID checks that 'input' can be parsed as a Shared Gallery ID diff --git a/resource-manager/compute/2022-03-03/sharedgalleryimages/id_image.go b/resource-manager/compute/2022-03-03/sharedgalleryimages/id_image.go index b36b143903f..2fcd53161fb 100644 --- a/resource-manager/compute/2022-03-03/sharedgalleryimages/id_image.go +++ b/resource-manager/compute/2022-03-03/sharedgalleryimages/id_image.go @@ -38,23 +38,9 @@ func ParseImageID(input string) (*ImageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ImageId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.SharedGalleryName, ok = parsed.Parsed["sharedGalleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sharedGalleryName", *parsed) - } - - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseImageIDInsensitively(input string) (*ImageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ImageId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ImageId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.SharedGalleryName, ok = parsed.Parsed["sharedGalleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sharedGalleryName", *parsed) + if id.SharedGalleryName, ok = input.Parsed["sharedGalleryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sharedGalleryName", input) } - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) + if id.ImageName, ok = input.Parsed["imageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "imageName", input) } - return &id, nil + return nil } // ValidateImageID checks that 'input' can be parsed as a Image ID diff --git a/resource-manager/compute/2022-03-03/sharedgalleryimages/id_sharedgallery.go b/resource-manager/compute/2022-03-03/sharedgalleryimages/id_sharedgallery.go index 8a17ecc45ce..75c58cfe40b 100644 --- a/resource-manager/compute/2022-03-03/sharedgalleryimages/id_sharedgallery.go +++ b/resource-manager/compute/2022-03-03/sharedgalleryimages/id_sharedgallery.go @@ -36,19 +36,9 @@ func ParseSharedGalleryID(input string) (*SharedGalleryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SharedGalleryId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.SharedGalleryName, ok = parsed.Parsed["sharedGalleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sharedGalleryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSharedGalleryIDInsensitively(input string) (*SharedGalleryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SharedGalleryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SharedGalleryId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.SharedGalleryName, ok = parsed.Parsed["sharedGalleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sharedGalleryName", *parsed) + if id.SharedGalleryName, ok = input.Parsed["sharedGalleryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sharedGalleryName", input) } - return &id, nil + return nil } // ValidateSharedGalleryID checks that 'input' can be parsed as a Shared Gallery ID diff --git a/resource-manager/compute/2022-03-03/sharedgalleryimageversions/id_image.go b/resource-manager/compute/2022-03-03/sharedgalleryimageversions/id_image.go index d73a83bfbc0..bfb3358ea0a 100644 --- a/resource-manager/compute/2022-03-03/sharedgalleryimageversions/id_image.go +++ b/resource-manager/compute/2022-03-03/sharedgalleryimageversions/id_image.go @@ -38,23 +38,9 @@ func ParseImageID(input string) (*ImageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ImageId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.SharedGalleryName, ok = parsed.Parsed["sharedGalleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sharedGalleryName", *parsed) - } - - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseImageIDInsensitively(input string) (*ImageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ImageId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ImageId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.SharedGalleryName, ok = parsed.Parsed["sharedGalleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sharedGalleryName", *parsed) + if id.SharedGalleryName, ok = input.Parsed["sharedGalleryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sharedGalleryName", input) } - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) + if id.ImageName, ok = input.Parsed["imageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "imageName", input) } - return &id, nil + return nil } // ValidateImageID checks that 'input' can be parsed as a Image ID diff --git a/resource-manager/compute/2022-03-03/sharedgalleryimageversions/id_version.go b/resource-manager/compute/2022-03-03/sharedgalleryimageversions/id_version.go index 4b8f5a9f4db..b2d435f07bc 100644 --- a/resource-manager/compute/2022-03-03/sharedgalleryimageversions/id_version.go +++ b/resource-manager/compute/2022-03-03/sharedgalleryimageversions/id_version.go @@ -40,27 +40,9 @@ func ParseVersionID(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.SharedGalleryName, ok = parsed.Parsed["sharedGalleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sharedGalleryName", *parsed) - } - - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVersionIDInsensitively(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.SharedGalleryName, ok = parsed.Parsed["sharedGalleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sharedGalleryName", *parsed) + if id.SharedGalleryName, ok = input.Parsed["sharedGalleryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sharedGalleryName", input) } - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) + if id.ImageName, ok = input.Parsed["imageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "imageName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateVersionID checks that 'input' can be parsed as a Version ID diff --git a/resource-manager/compute/2023-03-01/availabilitysets/id_availabilityset.go b/resource-manager/compute/2023-03-01/availabilitysets/id_availabilityset.go index 8564b6ab2ac..2393723dfd3 100644 --- a/resource-manager/compute/2023-03-01/availabilitysets/id_availabilityset.go +++ b/resource-manager/compute/2023-03-01/availabilitysets/id_availabilityset.go @@ -36,19 +36,9 @@ func ParseAvailabilitySetID(input string) (*AvailabilitySetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AvailabilitySetId{} - - 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.AvailabilitySetName, ok = parsed.Parsed["availabilitySetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "availabilitySetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAvailabilitySetIDInsensitively(input string) (*AvailabilitySetId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AvailabilitySetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AvailabilitySetId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AvailabilitySetName, ok = parsed.Parsed["availabilitySetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "availabilitySetName", *parsed) + if id.AvailabilitySetName, ok = input.Parsed["availabilitySetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "availabilitySetName", input) } - return &id, nil + return nil } // ValidateAvailabilitySetID checks that 'input' can be parsed as a Availability Set ID diff --git a/resource-manager/compute/2023-03-01/capacityreservation/id_capacityreservationgroup.go b/resource-manager/compute/2023-03-01/capacityreservation/id_capacityreservationgroup.go index 4c5b6bbd697..56ded1c940b 100644 --- a/resource-manager/compute/2023-03-01/capacityreservation/id_capacityreservationgroup.go +++ b/resource-manager/compute/2023-03-01/capacityreservation/id_capacityreservationgroup.go @@ -36,19 +36,9 @@ func ParseCapacityReservationGroupID(input string) (*CapacityReservationGroupId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapacityReservationGroupId{} - - 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.CapacityReservationGroupName, ok = parsed.Parsed["capacityReservationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseCapacityReservationGroupIDInsensitively(input string) (*CapacityReserv return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapacityReservationGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CapacityReservationGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CapacityReservationGroupName, ok = parsed.Parsed["capacityReservationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationGroupName", *parsed) + if id.CapacityReservationGroupName, ok = input.Parsed["capacityReservationGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationGroupName", input) } - return &id, nil + return nil } // ValidateCapacityReservationGroupID checks that 'input' can be parsed as a Capacity Reservation Group ID diff --git a/resource-manager/compute/2023-03-01/capacityreservationgroups/id_capacityreservationgroup.go b/resource-manager/compute/2023-03-01/capacityreservationgroups/id_capacityreservationgroup.go index b974029515e..725ce39f033 100644 --- a/resource-manager/compute/2023-03-01/capacityreservationgroups/id_capacityreservationgroup.go +++ b/resource-manager/compute/2023-03-01/capacityreservationgroups/id_capacityreservationgroup.go @@ -36,19 +36,9 @@ func ParseCapacityReservationGroupID(input string) (*CapacityReservationGroupId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapacityReservationGroupId{} - - 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.CapacityReservationGroupName, ok = parsed.Parsed["capacityReservationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseCapacityReservationGroupIDInsensitively(input string) (*CapacityReserv return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapacityReservationGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CapacityReservationGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CapacityReservationGroupName, ok = parsed.Parsed["capacityReservationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationGroupName", *parsed) + if id.CapacityReservationGroupName, ok = input.Parsed["capacityReservationGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationGroupName", input) } - return &id, nil + return nil } // ValidateCapacityReservationGroupID checks that 'input' can be parsed as a Capacity Reservation Group ID diff --git a/resource-manager/compute/2023-03-01/capacityreservations/id_capacityreservation.go b/resource-manager/compute/2023-03-01/capacityreservations/id_capacityreservation.go index df25394758f..ac78ccbcc3e 100644 --- a/resource-manager/compute/2023-03-01/capacityreservations/id_capacityreservation.go +++ b/resource-manager/compute/2023-03-01/capacityreservations/id_capacityreservation.go @@ -38,23 +38,9 @@ func ParseCapacityReservationID(input string) (*CapacityReservationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapacityReservationId{} - - 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.CapacityReservationGroupName, ok = parsed.Parsed["capacityReservationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationGroupName", *parsed) - } - - if id.CapacityReservationName, ok = parsed.Parsed["capacityReservationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCapacityReservationIDInsensitively(input string) (*CapacityReservation return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapacityReservationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CapacityReservationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CapacityReservationGroupName, ok = parsed.Parsed["capacityReservationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationGroupName", *parsed) + if id.CapacityReservationGroupName, ok = input.Parsed["capacityReservationGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationGroupName", input) } - if id.CapacityReservationName, ok = parsed.Parsed["capacityReservationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationName", *parsed) + if id.CapacityReservationName, ok = input.Parsed["capacityReservationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationName", input) } - return &id, nil + return nil } // ValidateCapacityReservationID checks that 'input' can be parsed as a Capacity Reservation ID diff --git a/resource-manager/compute/2023-03-01/dedicatedhost/id_host.go b/resource-manager/compute/2023-03-01/dedicatedhost/id_host.go index 8e13e5816d4..277c92b2fe0 100644 --- a/resource-manager/compute/2023-03-01/dedicatedhost/id_host.go +++ b/resource-manager/compute/2023-03-01/dedicatedhost/id_host.go @@ -38,23 +38,9 @@ func ParseHostID(input string) (*HostId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostId{} - - 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.HostGroupName, ok = parsed.Parsed["hostGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostGroupName", *parsed) - } - - if id.HostName, ok = parsed.Parsed["hostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseHostIDInsensitively(input string) (*HostId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *HostId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostGroupName, ok = parsed.Parsed["hostGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostGroupName", *parsed) + if id.HostGroupName, ok = input.Parsed["hostGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostGroupName", input) } - if id.HostName, ok = parsed.Parsed["hostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostName", *parsed) + if id.HostName, ok = input.Parsed["hostName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostName", input) } - return &id, nil + return nil } // ValidateHostID checks that 'input' can be parsed as a Host ID diff --git a/resource-manager/compute/2023-03-01/dedicatedhost/id_hostgroup.go b/resource-manager/compute/2023-03-01/dedicatedhost/id_hostgroup.go index 98371d9147a..4cc57240984 100644 --- a/resource-manager/compute/2023-03-01/dedicatedhost/id_hostgroup.go +++ b/resource-manager/compute/2023-03-01/dedicatedhost/id_hostgroup.go @@ -36,19 +36,9 @@ func ParseHostGroupID(input string) (*HostGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostGroupId{} - - 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.HostGroupName, ok = parsed.Parsed["hostGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseHostGroupIDInsensitively(input string) (*HostGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *HostGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostGroupName, ok = parsed.Parsed["hostGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostGroupName", *parsed) + if id.HostGroupName, ok = input.Parsed["hostGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostGroupName", input) } - return &id, nil + return nil } // ValidateHostGroupID checks that 'input' can be parsed as a Host Group ID diff --git a/resource-manager/compute/2023-03-01/dedicatedhostgroups/id_hostgroup.go b/resource-manager/compute/2023-03-01/dedicatedhostgroups/id_hostgroup.go index 74523582952..fea78a50c47 100644 --- a/resource-manager/compute/2023-03-01/dedicatedhostgroups/id_hostgroup.go +++ b/resource-manager/compute/2023-03-01/dedicatedhostgroups/id_hostgroup.go @@ -36,19 +36,9 @@ func ParseHostGroupID(input string) (*HostGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostGroupId{} - - 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.HostGroupName, ok = parsed.Parsed["hostGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseHostGroupIDInsensitively(input string) (*HostGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *HostGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostGroupName, ok = parsed.Parsed["hostGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostGroupName", *parsed) + if id.HostGroupName, ok = input.Parsed["hostGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostGroupName", input) } - return &id, nil + return nil } // ValidateHostGroupID checks that 'input' can be parsed as a Host Group ID diff --git a/resource-manager/compute/2023-03-01/dedicatedhosts/id_host.go b/resource-manager/compute/2023-03-01/dedicatedhosts/id_host.go index 762971eb041..4a087b87639 100644 --- a/resource-manager/compute/2023-03-01/dedicatedhosts/id_host.go +++ b/resource-manager/compute/2023-03-01/dedicatedhosts/id_host.go @@ -38,23 +38,9 @@ func ParseHostID(input string) (*HostId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostId{} - - 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.HostGroupName, ok = parsed.Parsed["hostGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostGroupName", *parsed) - } - - if id.HostName, ok = parsed.Parsed["hostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseHostIDInsensitively(input string) (*HostId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *HostId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostGroupName, ok = parsed.Parsed["hostGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostGroupName", *parsed) + if id.HostGroupName, ok = input.Parsed["hostGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostGroupName", input) } - if id.HostName, ok = parsed.Parsed["hostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostName", *parsed) + if id.HostName, ok = input.Parsed["hostName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostName", input) } - return &id, nil + return nil } // ValidateHostID checks that 'input' can be parsed as a Host ID diff --git a/resource-manager/compute/2023-03-01/images/id_image.go b/resource-manager/compute/2023-03-01/images/id_image.go index 048dbeac923..bd84d2f6092 100644 --- a/resource-manager/compute/2023-03-01/images/id_image.go +++ b/resource-manager/compute/2023-03-01/images/id_image.go @@ -36,19 +36,9 @@ func ParseImageID(input string) (*ImageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ImageId{} - - 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.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseImageIDInsensitively(input string) (*ImageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ImageId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ImageId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) + if id.ImageName, ok = input.Parsed["imageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "imageName", input) } - return &id, nil + return nil } // ValidateImageID checks that 'input' can be parsed as a Image ID diff --git a/resource-manager/compute/2023-03-01/loganalytics/id_location.go b/resource-manager/compute/2023-03-01/loganalytics/id_location.go index 9f246f8486e..fba54496f0a 100644 --- a/resource-manager/compute/2023-03-01/loganalytics/id_location.go +++ b/resource-manager/compute/2023-03-01/loganalytics/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/compute/2023-03-01/proximityplacementgroups/id_proximityplacementgroup.go b/resource-manager/compute/2023-03-01/proximityplacementgroups/id_proximityplacementgroup.go index b220644fa11..1232e950c85 100644 --- a/resource-manager/compute/2023-03-01/proximityplacementgroups/id_proximityplacementgroup.go +++ b/resource-manager/compute/2023-03-01/proximityplacementgroups/id_proximityplacementgroup.go @@ -36,19 +36,9 @@ func ParseProximityPlacementGroupID(input string) (*ProximityPlacementGroupId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProximityPlacementGroupId{} - - 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.ProximityPlacementGroupName, ok = parsed.Parsed["proximityPlacementGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "proximityPlacementGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProximityPlacementGroupIDInsensitively(input string) (*ProximityPlacem return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProximityPlacementGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProximityPlacementGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ProximityPlacementGroupName, ok = parsed.Parsed["proximityPlacementGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "proximityPlacementGroupName", *parsed) + if id.ProximityPlacementGroupName, ok = input.Parsed["proximityPlacementGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "proximityPlacementGroupName", input) } - return &id, nil + return nil } // ValidateProximityPlacementGroupID checks that 'input' can be parsed as a Proximity Placement Group ID diff --git a/resource-manager/compute/2023-03-01/restorepointcollections/id_restorepointcollection.go b/resource-manager/compute/2023-03-01/restorepointcollections/id_restorepointcollection.go index a51a6398432..9f496b37f89 100644 --- a/resource-manager/compute/2023-03-01/restorepointcollections/id_restorepointcollection.go +++ b/resource-manager/compute/2023-03-01/restorepointcollections/id_restorepointcollection.go @@ -36,19 +36,9 @@ func ParseRestorePointCollectionID(input string) (*RestorePointCollectionId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RestorePointCollectionId{} - - 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.RestorePointCollectionName, ok = parsed.Parsed["restorePointCollectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorePointCollectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRestorePointCollectionIDInsensitively(input string) (*RestorePointColl return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RestorePointCollectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RestorePointCollectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RestorePointCollectionName, ok = parsed.Parsed["restorePointCollectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorePointCollectionName", *parsed) + if id.RestorePointCollectionName, ok = input.Parsed["restorePointCollectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "restorePointCollectionName", input) } - return &id, nil + return nil } // ValidateRestorePointCollectionID checks that 'input' can be parsed as a Restore Point Collection ID diff --git a/resource-manager/compute/2023-03-01/restorepoints/id_restorepoint.go b/resource-manager/compute/2023-03-01/restorepoints/id_restorepoint.go index 3344daaf70c..0a5b90ac0b5 100644 --- a/resource-manager/compute/2023-03-01/restorepoints/id_restorepoint.go +++ b/resource-manager/compute/2023-03-01/restorepoints/id_restorepoint.go @@ -38,23 +38,9 @@ func ParseRestorePointID(input string) (*RestorePointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RestorePointId{} - - 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.RestorePointCollectionName, ok = parsed.Parsed["restorePointCollectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorePointCollectionName", *parsed) - } - - if id.RestorePointName, ok = parsed.Parsed["restorePointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorePointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRestorePointIDInsensitively(input string) (*RestorePointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RestorePointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RestorePointId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RestorePointCollectionName, ok = parsed.Parsed["restorePointCollectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorePointCollectionName", *parsed) + if id.RestorePointCollectionName, ok = input.Parsed["restorePointCollectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "restorePointCollectionName", input) } - if id.RestorePointName, ok = parsed.Parsed["restorePointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorePointName", *parsed) + if id.RestorePointName, ok = input.Parsed["restorePointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "restorePointName", input) } - return &id, nil + return nil } // ValidateRestorePointID checks that 'input' can be parsed as a Restore Point ID diff --git a/resource-manager/compute/2023-03-01/sshpublickeys/id_sshpublickey.go b/resource-manager/compute/2023-03-01/sshpublickeys/id_sshpublickey.go index 9c7f9ae62ba..9e9ee5ff0f6 100644 --- a/resource-manager/compute/2023-03-01/sshpublickeys/id_sshpublickey.go +++ b/resource-manager/compute/2023-03-01/sshpublickeys/id_sshpublickey.go @@ -36,19 +36,9 @@ func ParseSshPublicKeyID(input string) (*SshPublicKeyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SshPublicKeyId{} - - 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.SshPublicKeyName, ok = parsed.Parsed["sshPublicKeyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sshPublicKeyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSshPublicKeyIDInsensitively(input string) (*SshPublicKeyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SshPublicKeyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SshPublicKeyId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SshPublicKeyName, ok = parsed.Parsed["sshPublicKeyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sshPublicKeyName", *parsed) + if id.SshPublicKeyName, ok = input.Parsed["sshPublicKeyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sshPublicKeyName", input) } - return &id, nil + return nil } // ValidateSshPublicKeyID checks that 'input' can be parsed as a Ssh Public Key ID diff --git a/resource-manager/compute/2023-03-01/virtualmachineextensionimages/id_publisher.go b/resource-manager/compute/2023-03-01/virtualmachineextensionimages/id_publisher.go index b45241d6952..573fe07895b 100644 --- a/resource-manager/compute/2023-03-01/virtualmachineextensionimages/id_publisher.go +++ b/resource-manager/compute/2023-03-01/virtualmachineextensionimages/id_publisher.go @@ -36,19 +36,9 @@ func ParsePublisherID(input string) (*PublisherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PublisherId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePublisherIDInsensitively(input string) (*PublisherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PublisherId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PublisherId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - return &id, nil + return nil } // ValidatePublisherID checks that 'input' can be parsed as a Publisher ID diff --git a/resource-manager/compute/2023-03-01/virtualmachineextensionimages/id_type.go b/resource-manager/compute/2023-03-01/virtualmachineextensionimages/id_type.go index 95a118e7bca..90477651f07 100644 --- a/resource-manager/compute/2023-03-01/virtualmachineextensionimages/id_type.go +++ b/resource-manager/compute/2023-03-01/virtualmachineextensionimages/id_type.go @@ -38,23 +38,9 @@ func ParseTypeID(input string) (*TypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TypeId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) - } - - if id.TypeName, ok = parsed.Parsed["typeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "typeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTypeIDInsensitively(input string) (*TypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - if id.TypeName, ok = parsed.Parsed["typeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "typeName", *parsed) + if id.TypeName, ok = input.Parsed["typeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "typeName", input) } - return &id, nil + return nil } // ValidateTypeID checks that 'input' can be parsed as a Type ID diff --git a/resource-manager/compute/2023-03-01/virtualmachineextensionimages/id_version.go b/resource-manager/compute/2023-03-01/virtualmachineextensionimages/id_version.go index 686cc8d56f1..2bdac8ac968 100644 --- a/resource-manager/compute/2023-03-01/virtualmachineextensionimages/id_version.go +++ b/resource-manager/compute/2023-03-01/virtualmachineextensionimages/id_version.go @@ -40,27 +40,9 @@ func ParseVersionID(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) - } - - if id.TypeName, ok = parsed.Parsed["typeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "typeName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVersionIDInsensitively(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - if id.TypeName, ok = parsed.Parsed["typeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "typeName", *parsed) + if id.TypeName, ok = input.Parsed["typeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "typeName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateVersionID checks that 'input' can be parsed as a Version ID diff --git a/resource-manager/compute/2023-03-01/virtualmachineextensions/id_extension.go b/resource-manager/compute/2023-03-01/virtualmachineextensions/id_extension.go index 6183e0e16f0..e050e85df8b 100644 --- a/resource-manager/compute/2023-03-01/virtualmachineextensions/id_extension.go +++ b/resource-manager/compute/2023-03-01/virtualmachineextensions/id_extension.go @@ -38,23 +38,9 @@ func ParseExtensionID(input string) (*ExtensionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExtensionId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) - } - - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseExtensionIDInsensitively(input string) (*ExtensionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExtensionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ExtensionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if id.ExtensionName, ok = input.Parsed["extensionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "extensionName", input) } - return &id, nil + return nil } // ValidateExtensionID checks that 'input' can be parsed as a Extension ID diff --git a/resource-manager/compute/2023-03-01/virtualmachineextensions/id_virtualmachine.go b/resource-manager/compute/2023-03-01/virtualmachineextensions/id_virtualmachine.go index 548faba78a9..9c53613deaf 100644 --- a/resource-manager/compute/2023-03-01/virtualmachineextensions/id_virtualmachine.go +++ b/resource-manager/compute/2023-03-01/virtualmachineextensions/id_virtualmachine.go @@ -36,19 +36,9 @@ func ParseVirtualMachineID(input string) (*VirtualMachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineIDInsensitively(input string) (*VirtualMachineId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - return &id, nil + return nil } // ValidateVirtualMachineID checks that 'input' can be parsed as a Virtual Machine ID diff --git a/resource-manager/compute/2023-03-01/virtualmachineimages/id_edgezone.go b/resource-manager/compute/2023-03-01/virtualmachineimages/id_edgezone.go index 5c8edcd56e9..2dfaf445e78 100644 --- a/resource-manager/compute/2023-03-01/virtualmachineimages/id_edgezone.go +++ b/resource-manager/compute/2023-03-01/virtualmachineimages/id_edgezone.go @@ -36,19 +36,9 @@ func ParseEdgeZoneID(input string) (*EdgeZoneId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EdgeZoneId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.EdgeZoneName, ok = parsed.Parsed["edgeZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseEdgeZoneIDInsensitively(input string) (*EdgeZoneId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EdgeZoneId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *EdgeZoneId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.EdgeZoneName, ok = parsed.Parsed["edgeZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", *parsed) + if id.EdgeZoneName, ok = input.Parsed["edgeZoneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", input) } - return &id, nil + return nil } // ValidateEdgeZoneID checks that 'input' can be parsed as a Edge Zone ID diff --git a/resource-manager/compute/2023-03-01/virtualmachineimages/id_edgezonepublisher.go b/resource-manager/compute/2023-03-01/virtualmachineimages/id_edgezonepublisher.go index 4ba06023cc7..38e6d0fd8fa 100644 --- a/resource-manager/compute/2023-03-01/virtualmachineimages/id_edgezonepublisher.go +++ b/resource-manager/compute/2023-03-01/virtualmachineimages/id_edgezonepublisher.go @@ -38,23 +38,9 @@ func ParseEdgeZonePublisherID(input string) (*EdgeZonePublisherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EdgeZonePublisherId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.EdgeZoneName, ok = parsed.Parsed["edgeZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseEdgeZonePublisherIDInsensitively(input string) (*EdgeZonePublisherId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EdgeZonePublisherId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EdgeZonePublisherId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.EdgeZoneName, ok = parsed.Parsed["edgeZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", *parsed) + if id.EdgeZoneName, ok = input.Parsed["edgeZoneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - return &id, nil + return nil } // ValidateEdgeZonePublisherID checks that 'input' can be parsed as a Edge Zone Publisher ID diff --git a/resource-manager/compute/2023-03-01/virtualmachineimages/id_location.go b/resource-manager/compute/2023-03-01/virtualmachineimages/id_location.go index c1a3a5cc344..d61a6ec2f5d 100644 --- a/resource-manager/compute/2023-03-01/virtualmachineimages/id_location.go +++ b/resource-manager/compute/2023-03-01/virtualmachineimages/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/compute/2023-03-01/virtualmachineimages/id_offer.go b/resource-manager/compute/2023-03-01/virtualmachineimages/id_offer.go index 0069c32dbbd..ab703ca7b7c 100644 --- a/resource-manager/compute/2023-03-01/virtualmachineimages/id_offer.go +++ b/resource-manager/compute/2023-03-01/virtualmachineimages/id_offer.go @@ -38,23 +38,9 @@ func ParseOfferID(input string) (*OfferId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OfferId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) - } - - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseOfferIDInsensitively(input string) (*OfferId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OfferId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OfferId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) + if id.OfferName, ok = input.Parsed["offerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerName", input) } - return &id, nil + return nil } // ValidateOfferID checks that 'input' can be parsed as a Offer ID diff --git a/resource-manager/compute/2023-03-01/virtualmachineimages/id_offersku.go b/resource-manager/compute/2023-03-01/virtualmachineimages/id_offersku.go index 56e95375101..ff6f1e1b7d0 100644 --- a/resource-manager/compute/2023-03-01/virtualmachineimages/id_offersku.go +++ b/resource-manager/compute/2023-03-01/virtualmachineimages/id_offersku.go @@ -42,31 +42,9 @@ func ParseOfferSkuID(input string) (*OfferSkuId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OfferSkuId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.EdgeZoneName, ok = parsed.Parsed["edgeZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) - } - - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) - } - - if id.SkuName, ok = parsed.Parsed["skuName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "skuName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseOfferSkuIDInsensitively(input string) (*OfferSkuId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OfferSkuId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *OfferSkuId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.EdgeZoneName, ok = parsed.Parsed["edgeZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", *parsed) + if id.EdgeZoneName, ok = input.Parsed["edgeZoneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) + if id.OfferName, ok = input.Parsed["offerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerName", input) } - if id.SkuName, ok = parsed.Parsed["skuName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "skuName", *parsed) + if id.SkuName, ok = input.Parsed["skuName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "skuName", input) } - return &id, nil + return nil } // ValidateOfferSkuID checks that 'input' can be parsed as a Offer Sku ID diff --git a/resource-manager/compute/2023-03-01/virtualmachineimages/id_offerskuversion.go b/resource-manager/compute/2023-03-01/virtualmachineimages/id_offerskuversion.go index 36781641341..4131868dd27 100644 --- a/resource-manager/compute/2023-03-01/virtualmachineimages/id_offerskuversion.go +++ b/resource-manager/compute/2023-03-01/virtualmachineimages/id_offerskuversion.go @@ -44,35 +44,9 @@ func ParseOfferSkuVersionID(input string) (*OfferSkuVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OfferSkuVersionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.EdgeZoneName, ok = parsed.Parsed["edgeZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) - } - - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) - } - - if id.SkuName, ok = parsed.Parsed["skuName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "skuName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseOfferSkuVersionIDInsensitively(input string) (*OfferSkuVersionId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OfferSkuVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *OfferSkuVersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.EdgeZoneName, ok = parsed.Parsed["edgeZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", *parsed) + if id.EdgeZoneName, ok = input.Parsed["edgeZoneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) + if id.OfferName, ok = input.Parsed["offerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerName", input) } - if id.SkuName, ok = parsed.Parsed["skuName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "skuName", *parsed) + if id.SkuName, ok = input.Parsed["skuName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "skuName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateOfferSkuVersionID checks that 'input' can be parsed as a Offer Sku Version ID diff --git a/resource-manager/compute/2023-03-01/virtualmachineimages/id_publisher.go b/resource-manager/compute/2023-03-01/virtualmachineimages/id_publisher.go index 93295bff558..1a369b92ea6 100644 --- a/resource-manager/compute/2023-03-01/virtualmachineimages/id_publisher.go +++ b/resource-manager/compute/2023-03-01/virtualmachineimages/id_publisher.go @@ -36,19 +36,9 @@ func ParsePublisherID(input string) (*PublisherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PublisherId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePublisherIDInsensitively(input string) (*PublisherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PublisherId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PublisherId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - return &id, nil + return nil } // ValidatePublisherID checks that 'input' can be parsed as a Publisher ID diff --git a/resource-manager/compute/2023-03-01/virtualmachineimages/id_sku.go b/resource-manager/compute/2023-03-01/virtualmachineimages/id_sku.go index 90d2a26bcc9..acf369898fe 100644 --- a/resource-manager/compute/2023-03-01/virtualmachineimages/id_sku.go +++ b/resource-manager/compute/2023-03-01/virtualmachineimages/id_sku.go @@ -40,27 +40,9 @@ func ParseSkuID(input string) (*SkuId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SkuId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) - } - - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) - } - - if id.SkuName, ok = parsed.Parsed["skuName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "skuName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSkuIDInsensitively(input string) (*SkuId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SkuId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SkuId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) + if id.OfferName, ok = input.Parsed["offerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerName", input) } - if id.SkuName, ok = parsed.Parsed["skuName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "skuName", *parsed) + if id.SkuName, ok = input.Parsed["skuName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "skuName", input) } - return &id, nil + return nil } // ValidateSkuID checks that 'input' can be parsed as a Sku ID diff --git a/resource-manager/compute/2023-03-01/virtualmachineimages/id_skuversion.go b/resource-manager/compute/2023-03-01/virtualmachineimages/id_skuversion.go index 09bdbcf481c..e680bffa7aa 100644 --- a/resource-manager/compute/2023-03-01/virtualmachineimages/id_skuversion.go +++ b/resource-manager/compute/2023-03-01/virtualmachineimages/id_skuversion.go @@ -42,31 +42,9 @@ func ParseSkuVersionID(input string) (*SkuVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SkuVersionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) - } - - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) - } - - if id.SkuName, ok = parsed.Parsed["skuName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "skuName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseSkuVersionIDInsensitively(input string) (*SkuVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SkuVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SkuVersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) + if id.OfferName, ok = input.Parsed["offerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerName", input) } - if id.SkuName, ok = parsed.Parsed["skuName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "skuName", *parsed) + if id.SkuName, ok = input.Parsed["skuName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "skuName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateSkuVersionID checks that 'input' can be parsed as a Sku Version ID diff --git a/resource-manager/compute/2023-03-01/virtualmachineimages/id_vmimageoffer.go b/resource-manager/compute/2023-03-01/virtualmachineimages/id_vmimageoffer.go index 0c2069284b8..dec264d0099 100644 --- a/resource-manager/compute/2023-03-01/virtualmachineimages/id_vmimageoffer.go +++ b/resource-manager/compute/2023-03-01/virtualmachineimages/id_vmimageoffer.go @@ -40,27 +40,9 @@ func ParseVMImageOfferID(input string) (*VMImageOfferId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VMImageOfferId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.EdgeZoneName, ok = parsed.Parsed["edgeZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) - } - - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVMImageOfferIDInsensitively(input string) (*VMImageOfferId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VMImageOfferId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VMImageOfferId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.EdgeZoneName, ok = parsed.Parsed["edgeZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", *parsed) + if id.EdgeZoneName, ok = input.Parsed["edgeZoneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - if id.OfferName, ok = parsed.Parsed["offerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerName", *parsed) + if id.OfferName, ok = input.Parsed["offerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerName", input) } - return &id, nil + return nil } // ValidateVMImageOfferID checks that 'input' can be parsed as a V M Image Offer ID diff --git a/resource-manager/compute/2023-03-01/virtualmachineruncommands/id_location.go b/resource-manager/compute/2023-03-01/virtualmachineruncommands/id_location.go index c93c2bef2a9..8a8238cc803 100644 --- a/resource-manager/compute/2023-03-01/virtualmachineruncommands/id_location.go +++ b/resource-manager/compute/2023-03-01/virtualmachineruncommands/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/compute/2023-03-01/virtualmachineruncommands/id_runcommand.go b/resource-manager/compute/2023-03-01/virtualmachineruncommands/id_runcommand.go index e82082c4ee1..8852e7f8ddc 100644 --- a/resource-manager/compute/2023-03-01/virtualmachineruncommands/id_runcommand.go +++ b/resource-manager/compute/2023-03-01/virtualmachineruncommands/id_runcommand.go @@ -36,19 +36,9 @@ func ParseRunCommandID(input string) (*RunCommandId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunCommandId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.CommandId, ok = parsed.Parsed["commandId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "commandId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRunCommandIDInsensitively(input string) (*RunCommandId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunCommandId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RunCommandId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.CommandId, ok = parsed.Parsed["commandId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "commandId", *parsed) + if id.CommandId, ok = input.Parsed["commandId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "commandId", input) } - return &id, nil + return nil } // ValidateRunCommandID checks that 'input' can be parsed as a Run Command ID diff --git a/resource-manager/compute/2023-03-01/virtualmachineruncommands/id_virtualmachine.go b/resource-manager/compute/2023-03-01/virtualmachineruncommands/id_virtualmachine.go index 2d4d8c99f10..07f5b7a3786 100644 --- a/resource-manager/compute/2023-03-01/virtualmachineruncommands/id_virtualmachine.go +++ b/resource-manager/compute/2023-03-01/virtualmachineruncommands/id_virtualmachine.go @@ -36,19 +36,9 @@ func ParseVirtualMachineID(input string) (*VirtualMachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineIDInsensitively(input string) (*VirtualMachineId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - return &id, nil + return nil } // ValidateVirtualMachineID checks that 'input' can be parsed as a Virtual Machine ID diff --git a/resource-manager/compute/2023-03-01/virtualmachineruncommands/id_virtualmachineruncommand.go b/resource-manager/compute/2023-03-01/virtualmachineruncommands/id_virtualmachineruncommand.go index f3d518d4e40..10d5aef8fce 100644 --- a/resource-manager/compute/2023-03-01/virtualmachineruncommands/id_virtualmachineruncommand.go +++ b/resource-manager/compute/2023-03-01/virtualmachineruncommands/id_virtualmachineruncommand.go @@ -38,23 +38,9 @@ func ParseVirtualMachineRunCommandID(input string) (*VirtualMachineRunCommandId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineRunCommandId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) - } - - if id.RunCommandName, ok = parsed.Parsed["runCommandName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runCommandName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualMachineRunCommandIDInsensitively(input string) (*VirtualMachine return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineRunCommandId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineRunCommandId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - if id.RunCommandName, ok = parsed.Parsed["runCommandName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runCommandName", *parsed) + if id.RunCommandName, ok = input.Parsed["runCommandName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runCommandName", input) } - return &id, nil + return nil } // ValidateVirtualMachineRunCommandID checks that 'input' can be parsed as a Virtual Machine Run Command ID diff --git a/resource-manager/compute/2023-03-01/virtualmachines/id_location.go b/resource-manager/compute/2023-03-01/virtualmachines/id_location.go index 4666b6bb106..8f54853528a 100644 --- a/resource-manager/compute/2023-03-01/virtualmachines/id_location.go +++ b/resource-manager/compute/2023-03-01/virtualmachines/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/compute/2023-03-01/virtualmachines/id_virtualmachine.go b/resource-manager/compute/2023-03-01/virtualmachines/id_virtualmachine.go index 3d3c57c3528..367cce21365 100644 --- a/resource-manager/compute/2023-03-01/virtualmachines/id_virtualmachine.go +++ b/resource-manager/compute/2023-03-01/virtualmachines/id_virtualmachine.go @@ -36,19 +36,9 @@ func ParseVirtualMachineID(input string) (*VirtualMachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineIDInsensitively(input string) (*VirtualMachineId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - return &id, nil + return nil } // ValidateVirtualMachineID checks that 'input' can be parsed as a Virtual Machine ID diff --git a/resource-manager/compute/2023-03-01/virtualmachinescalesetextensions/id_virtualmachinescaleset.go b/resource-manager/compute/2023-03-01/virtualmachinescalesetextensions/id_virtualmachinescaleset.go index 2c9fe5b0362..7b3d32af330 100644 --- a/resource-manager/compute/2023-03-01/virtualmachinescalesetextensions/id_virtualmachinescaleset.go +++ b/resource-manager/compute/2023-03-01/virtualmachinescalesetextensions/id_virtualmachinescaleset.go @@ -36,19 +36,9 @@ func ParseVirtualMachineScaleSetID(input string) (*VirtualMachineScaleSetId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineScaleSetIDInsensitively(input string) (*VirtualMachineSc return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineScaleSetId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - return &id, nil + return nil } // ValidateVirtualMachineScaleSetID checks that 'input' can be parsed as a Virtual Machine Scale Set ID diff --git a/resource-manager/compute/2023-03-01/virtualmachinescalesetextensions/id_virtualmachinescalesetextension.go b/resource-manager/compute/2023-03-01/virtualmachinescalesetextensions/id_virtualmachinescalesetextension.go index 3b656210a92..7124d08b494 100644 --- a/resource-manager/compute/2023-03-01/virtualmachinescalesetextensions/id_virtualmachinescalesetextension.go +++ b/resource-manager/compute/2023-03-01/virtualmachinescalesetextensions/id_virtualmachinescalesetextension.go @@ -38,23 +38,9 @@ func ParseVirtualMachineScaleSetExtensionID(input string) (*VirtualMachineScaleS return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetExtensionId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) - } - - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualMachineScaleSetExtensionIDInsensitively(input string) (*Virtual return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetExtensionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineScaleSetExtensionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if id.ExtensionName, ok = input.Parsed["extensionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "extensionName", input) } - return &id, nil + return nil } // ValidateVirtualMachineScaleSetExtensionID checks that 'input' can be parsed as a Virtual Machine Scale Set Extension ID diff --git a/resource-manager/compute/2023-03-01/virtualmachinescalesetrollingupgrades/id_virtualmachinescaleset.go b/resource-manager/compute/2023-03-01/virtualmachinescalesetrollingupgrades/id_virtualmachinescaleset.go index c6e19fcfa2a..9bc0d385bef 100644 --- a/resource-manager/compute/2023-03-01/virtualmachinescalesetrollingupgrades/id_virtualmachinescaleset.go +++ b/resource-manager/compute/2023-03-01/virtualmachinescalesetrollingupgrades/id_virtualmachinescaleset.go @@ -36,19 +36,9 @@ func ParseVirtualMachineScaleSetID(input string) (*VirtualMachineScaleSetId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineScaleSetIDInsensitively(input string) (*VirtualMachineSc return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineScaleSetId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - return &id, nil + return nil } // ValidateVirtualMachineScaleSetID checks that 'input' can be parsed as a Virtual Machine Scale Set ID diff --git a/resource-manager/compute/2023-03-01/virtualmachinescalesets/id_location.go b/resource-manager/compute/2023-03-01/virtualmachinescalesets/id_location.go index 64147f562bc..c9c4831a0b4 100644 --- a/resource-manager/compute/2023-03-01/virtualmachinescalesets/id_location.go +++ b/resource-manager/compute/2023-03-01/virtualmachinescalesets/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/compute/2023-03-01/virtualmachinescalesets/id_virtualmachinescaleset.go b/resource-manager/compute/2023-03-01/virtualmachinescalesets/id_virtualmachinescaleset.go index 92d812ec1a0..0dca997a232 100644 --- a/resource-manager/compute/2023-03-01/virtualmachinescalesets/id_virtualmachinescaleset.go +++ b/resource-manager/compute/2023-03-01/virtualmachinescalesets/id_virtualmachinescaleset.go @@ -36,19 +36,9 @@ func ParseVirtualMachineScaleSetID(input string) (*VirtualMachineScaleSetId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineScaleSetIDInsensitively(input string) (*VirtualMachineSc return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineScaleSetId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - return &id, nil + return nil } // ValidateVirtualMachineScaleSetID checks that 'input' can be parsed as a Virtual Machine Scale Set ID diff --git a/resource-manager/compute/2023-03-01/virtualmachinescalesetvmextensions/id_virtualmachineextension.go b/resource-manager/compute/2023-03-01/virtualmachinescalesetvmextensions/id_virtualmachineextension.go index 66266d9719e..1623fb4b631 100644 --- a/resource-manager/compute/2023-03-01/virtualmachinescalesetvmextensions/id_virtualmachineextension.go +++ b/resource-manager/compute/2023-03-01/virtualmachinescalesetvmextensions/id_virtualmachineextension.go @@ -40,27 +40,9 @@ func ParseVirtualMachineExtensionID(input string) (*VirtualMachineExtensionId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineExtensionId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) - } - - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) - } - - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVirtualMachineExtensionIDInsensitively(input string) (*VirtualMachineE return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineExtensionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VirtualMachineExtensionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if id.InstanceId, ok = input.Parsed["instanceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceId", input) } - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if id.ExtensionName, ok = input.Parsed["extensionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "extensionName", input) } - return &id, nil + return nil } // ValidateVirtualMachineExtensionID checks that 'input' can be parsed as a Virtual Machine Extension ID diff --git a/resource-manager/compute/2023-03-01/virtualmachinescalesetvmextensions/id_virtualmachinescalesetvirtualmachine.go b/resource-manager/compute/2023-03-01/virtualmachinescalesetvmextensions/id_virtualmachinescalesetvirtualmachine.go index 2cbc7556565..4a631b44413 100644 --- a/resource-manager/compute/2023-03-01/virtualmachinescalesetvmextensions/id_virtualmachinescalesetvirtualmachine.go +++ b/resource-manager/compute/2023-03-01/virtualmachinescalesetvmextensions/id_virtualmachinescalesetvirtualmachine.go @@ -38,23 +38,9 @@ func ParseVirtualMachineScaleSetVirtualMachineID(input string) (*VirtualMachineS return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetVirtualMachineId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) - } - - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualMachineScaleSetVirtualMachineIDInsensitively(input string) (*Vi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetVirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineScaleSetVirtualMachineId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if id.InstanceId, ok = input.Parsed["instanceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceId", input) } - return &id, nil + return nil } // ValidateVirtualMachineScaleSetVirtualMachineID checks that 'input' can be parsed as a Virtual Machine Scale Set Virtual Machine ID diff --git a/resource-manager/compute/2023-03-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachine.go b/resource-manager/compute/2023-03-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachine.go index 4e39acac92a..eae9c455cea 100644 --- a/resource-manager/compute/2023-03-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachine.go +++ b/resource-manager/compute/2023-03-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachine.go @@ -38,23 +38,9 @@ func ParseVirtualMachineScaleSetVirtualMachineID(input string) (*VirtualMachineS return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetVirtualMachineId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) - } - - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualMachineScaleSetVirtualMachineIDInsensitively(input string) (*Vi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetVirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineScaleSetVirtualMachineId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if id.InstanceId, ok = input.Parsed["instanceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceId", input) } - return &id, nil + return nil } // ValidateVirtualMachineScaleSetVirtualMachineID checks that 'input' can be parsed as a Virtual Machine Scale Set Virtual Machine ID diff --git a/resource-manager/compute/2023-03-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachineruncommand.go b/resource-manager/compute/2023-03-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachineruncommand.go index 31b9bd80ffc..dba7f64aa9a 100644 --- a/resource-manager/compute/2023-03-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachineruncommand.go +++ b/resource-manager/compute/2023-03-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachineruncommand.go @@ -40,27 +40,9 @@ func ParseVirtualMachineScaleSetVirtualMachineRunCommandID(input string) (*Virtu return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetVirtualMachineRunCommandId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) - } - - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) - } - - if id.RunCommandName, ok = parsed.Parsed["runCommandName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runCommandName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVirtualMachineScaleSetVirtualMachineRunCommandIDInsensitively(input st return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetVirtualMachineRunCommandId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VirtualMachineScaleSetVirtualMachineRunCommandId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if id.InstanceId, ok = input.Parsed["instanceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceId", input) } - if id.RunCommandName, ok = parsed.Parsed["runCommandName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runCommandName", *parsed) + if id.RunCommandName, ok = input.Parsed["runCommandName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runCommandName", input) } - return &id, nil + return nil } // ValidateVirtualMachineScaleSetVirtualMachineRunCommandID checks that 'input' can be parsed as a Virtual Machine Scale Set Virtual Machine Run Command ID diff --git a/resource-manager/compute/2023-03-01/virtualmachinescalesetvms/id_virtualmachinescaleset.go b/resource-manager/compute/2023-03-01/virtualmachinescalesetvms/id_virtualmachinescaleset.go index cd06d946474..d1d9b01f3c7 100644 --- a/resource-manager/compute/2023-03-01/virtualmachinescalesetvms/id_virtualmachinescaleset.go +++ b/resource-manager/compute/2023-03-01/virtualmachinescalesetvms/id_virtualmachinescaleset.go @@ -36,19 +36,9 @@ func ParseVirtualMachineScaleSetID(input string) (*VirtualMachineScaleSetId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineScaleSetIDInsensitively(input string) (*VirtualMachineSc return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineScaleSetId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - return &id, nil + return nil } // ValidateVirtualMachineScaleSetID checks that 'input' can be parsed as a Virtual Machine Scale Set ID diff --git a/resource-manager/compute/2023-03-01/virtualmachinescalesetvms/id_virtualmachinescalesetvirtualmachine.go b/resource-manager/compute/2023-03-01/virtualmachinescalesetvms/id_virtualmachinescalesetvirtualmachine.go index c6f1a6327f2..0413b4eb17c 100644 --- a/resource-manager/compute/2023-03-01/virtualmachinescalesetvms/id_virtualmachinescalesetvirtualmachine.go +++ b/resource-manager/compute/2023-03-01/virtualmachinescalesetvms/id_virtualmachinescalesetvirtualmachine.go @@ -38,23 +38,9 @@ func ParseVirtualMachineScaleSetVirtualMachineID(input string) (*VirtualMachineS return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetVirtualMachineId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) - } - - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualMachineScaleSetVirtualMachineIDInsensitively(input string) (*Vi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetVirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineScaleSetVirtualMachineId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if id.InstanceId, ok = input.Parsed["instanceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceId", input) } - return &id, nil + return nil } // ValidateVirtualMachineScaleSetVirtualMachineID checks that 'input' can be parsed as a Virtual Machine Scale Set Virtual Machine ID diff --git a/resource-manager/compute/2023-03-01/virtualmachinesizes/id_location.go b/resource-manager/compute/2023-03-01/virtualmachinesizes/id_location.go index 3bd0de508bf..99331262075 100644 --- a/resource-manager/compute/2023-03-01/virtualmachinesizes/id_location.go +++ b/resource-manager/compute/2023-03-01/virtualmachinesizes/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/compute/2023-04-02/diskaccesses/id_diskaccess.go b/resource-manager/compute/2023-04-02/diskaccesses/id_diskaccess.go index 265eb676bec..06ceea1dc2a 100644 --- a/resource-manager/compute/2023-04-02/diskaccesses/id_diskaccess.go +++ b/resource-manager/compute/2023-04-02/diskaccesses/id_diskaccess.go @@ -36,19 +36,9 @@ func ParseDiskAccessID(input string) (*DiskAccessId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiskAccessId{} - - 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.DiskAccessName, ok = parsed.Parsed["diskAccessName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diskAccessName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDiskAccessIDInsensitively(input string) (*DiskAccessId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiskAccessId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DiskAccessId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DiskAccessName, ok = parsed.Parsed["diskAccessName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diskAccessName", *parsed) + if id.DiskAccessName, ok = input.Parsed["diskAccessName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "diskAccessName", input) } - return &id, nil + return nil } // ValidateDiskAccessID checks that 'input' can be parsed as a Disk Access ID diff --git a/resource-manager/compute/2023-04-02/diskaccesses/id_privateendpointconnection.go b/resource-manager/compute/2023-04-02/diskaccesses/id_privateendpointconnection.go index 6973d6ce8c0..304a5887be1 100644 --- a/resource-manager/compute/2023-04-02/diskaccesses/id_privateendpointconnection.go +++ b/resource-manager/compute/2023-04-02/diskaccesses/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.DiskAccessName, ok = parsed.Parsed["diskAccessName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diskAccessName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DiskAccessName, ok = parsed.Parsed["diskAccessName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diskAccessName", *parsed) + if id.DiskAccessName, ok = input.Parsed["diskAccessName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "diskAccessName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/compute/2023-04-02/diskencryptionsets/id_diskencryptionset.go b/resource-manager/compute/2023-04-02/diskencryptionsets/id_diskencryptionset.go index b62ee1a0de1..5b5a32d8f17 100644 --- a/resource-manager/compute/2023-04-02/diskencryptionsets/id_diskencryptionset.go +++ b/resource-manager/compute/2023-04-02/diskencryptionsets/id_diskencryptionset.go @@ -36,19 +36,9 @@ func ParseDiskEncryptionSetID(input string) (*DiskEncryptionSetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiskEncryptionSetId{} - - 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.DiskEncryptionSetName, ok = parsed.Parsed["diskEncryptionSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diskEncryptionSetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDiskEncryptionSetIDInsensitively(input string) (*DiskEncryptionSetId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiskEncryptionSetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DiskEncryptionSetId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DiskEncryptionSetName, ok = parsed.Parsed["diskEncryptionSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diskEncryptionSetName", *parsed) + if id.DiskEncryptionSetName, ok = input.Parsed["diskEncryptionSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "diskEncryptionSetName", input) } - return &id, nil + return nil } // ValidateDiskEncryptionSetID checks that 'input' can be parsed as a Disk Encryption Set ID diff --git a/resource-manager/compute/2023-04-02/disks/id_disk.go b/resource-manager/compute/2023-04-02/disks/id_disk.go index 3415c385da7..6266bcedb6d 100644 --- a/resource-manager/compute/2023-04-02/disks/id_disk.go +++ b/resource-manager/compute/2023-04-02/disks/id_disk.go @@ -36,19 +36,9 @@ func ParseDiskID(input string) (*DiskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiskId{} - - 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.DiskName, ok = parsed.Parsed["diskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diskName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDiskIDInsensitively(input string) (*DiskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiskId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DiskId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DiskName, ok = parsed.Parsed["diskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diskName", *parsed) + if id.DiskName, ok = input.Parsed["diskName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "diskName", input) } - return &id, nil + return nil } // ValidateDiskID checks that 'input' can be parsed as a Disk ID diff --git a/resource-manager/compute/2023-04-02/incrementalrestorepoints/id_diskrestorepoint.go b/resource-manager/compute/2023-04-02/incrementalrestorepoints/id_diskrestorepoint.go index 19f724bcade..6053626999d 100644 --- a/resource-manager/compute/2023-04-02/incrementalrestorepoints/id_diskrestorepoint.go +++ b/resource-manager/compute/2023-04-02/incrementalrestorepoints/id_diskrestorepoint.go @@ -40,27 +40,9 @@ func ParseDiskRestorePointID(input string) (*DiskRestorePointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiskRestorePointId{} - - 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.RestorePointCollectionName, ok = parsed.Parsed["restorePointCollectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorePointCollectionName", *parsed) - } - - if id.RestorePointName, ok = parsed.Parsed["restorePointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorePointName", *parsed) - } - - if id.DiskRestorePointName, ok = parsed.Parsed["diskRestorePointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diskRestorePointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseDiskRestorePointIDInsensitively(input string) (*DiskRestorePointId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiskRestorePointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DiskRestorePointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RestorePointCollectionName, ok = parsed.Parsed["restorePointCollectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorePointCollectionName", *parsed) + if id.RestorePointCollectionName, ok = input.Parsed["restorePointCollectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "restorePointCollectionName", input) } - if id.RestorePointName, ok = parsed.Parsed["restorePointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorePointName", *parsed) + if id.RestorePointName, ok = input.Parsed["restorePointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "restorePointName", input) } - if id.DiskRestorePointName, ok = parsed.Parsed["diskRestorePointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diskRestorePointName", *parsed) + if id.DiskRestorePointName, ok = input.Parsed["diskRestorePointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "diskRestorePointName", input) } - return &id, nil + return nil } // ValidateDiskRestorePointID checks that 'input' can be parsed as a Disk Restore Point ID diff --git a/resource-manager/compute/2023-04-02/incrementalrestorepoints/id_restorepoint.go b/resource-manager/compute/2023-04-02/incrementalrestorepoints/id_restorepoint.go index e45eaafdc2b..1d3fc04c8d3 100644 --- a/resource-manager/compute/2023-04-02/incrementalrestorepoints/id_restorepoint.go +++ b/resource-manager/compute/2023-04-02/incrementalrestorepoints/id_restorepoint.go @@ -38,23 +38,9 @@ func ParseRestorePointID(input string) (*RestorePointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RestorePointId{} - - 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.RestorePointCollectionName, ok = parsed.Parsed["restorePointCollectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorePointCollectionName", *parsed) - } - - if id.RestorePointName, ok = parsed.Parsed["restorePointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorePointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRestorePointIDInsensitively(input string) (*RestorePointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RestorePointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RestorePointId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RestorePointCollectionName, ok = parsed.Parsed["restorePointCollectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorePointCollectionName", *parsed) + if id.RestorePointCollectionName, ok = input.Parsed["restorePointCollectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "restorePointCollectionName", input) } - if id.RestorePointName, ok = parsed.Parsed["restorePointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorePointName", *parsed) + if id.RestorePointName, ok = input.Parsed["restorePointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "restorePointName", input) } - return &id, nil + return nil } // ValidateRestorePointID checks that 'input' can be parsed as a Restore Point ID diff --git a/resource-manager/compute/2023-04-02/snapshots/id_snapshot.go b/resource-manager/compute/2023-04-02/snapshots/id_snapshot.go index f51dc333454..50c70843657 100644 --- a/resource-manager/compute/2023-04-02/snapshots/id_snapshot.go +++ b/resource-manager/compute/2023-04-02/snapshots/id_snapshot.go @@ -36,19 +36,9 @@ func ParseSnapshotID(input string) (*SnapshotId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SnapshotId{} - - 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.SnapshotName, ok = parsed.Parsed["snapshotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSnapshotIDInsensitively(input string) (*SnapshotId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SnapshotId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SnapshotId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SnapshotName, ok = parsed.Parsed["snapshotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotName", *parsed) + if id.SnapshotName, ok = input.Parsed["snapshotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "snapshotName", input) } - return &id, nil + return nil } // ValidateSnapshotID checks that 'input' can be parsed as a Snapshot ID diff --git a/resource-manager/confidentialledger/2022-05-13/confidentialledger/id_ledger.go b/resource-manager/confidentialledger/2022-05-13/confidentialledger/id_ledger.go index 9f6236e4407..5cfe57c7a0c 100644 --- a/resource-manager/confidentialledger/2022-05-13/confidentialledger/id_ledger.go +++ b/resource-manager/confidentialledger/2022-05-13/confidentialledger/id_ledger.go @@ -36,19 +36,9 @@ func ParseLedgerID(input string) (*LedgerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LedgerId{} - - 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.LedgerName, ok = parsed.Parsed["ledgerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ledgerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLedgerIDInsensitively(input string) (*LedgerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LedgerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LedgerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LedgerName, ok = parsed.Parsed["ledgerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ledgerName", *parsed) + if id.LedgerName, ok = input.Parsed["ledgerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ledgerName", input) } - return &id, nil + return nil } // ValidateLedgerID checks that 'input' can be parsed as a Ledger ID diff --git a/resource-manager/connectedvmware/2022-01-10-preview/clusters/id_cluster.go b/resource-manager/connectedvmware/2022-01-10-preview/clusters/id_cluster.go index f0ba6058faf..e1c8faa5059 100644 --- a/resource-manager/connectedvmware/2022-01-10-preview/clusters/id_cluster.go +++ b/resource-manager/connectedvmware/2022-01-10-preview/clusters/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/connectedvmware/2022-01-10-preview/datastores/id_datastore.go b/resource-manager/connectedvmware/2022-01-10-preview/datastores/id_datastore.go index 7cb77709980..059fb77670d 100644 --- a/resource-manager/connectedvmware/2022-01-10-preview/datastores/id_datastore.go +++ b/resource-manager/connectedvmware/2022-01-10-preview/datastores/id_datastore.go @@ -36,19 +36,9 @@ func ParseDataStoreID(input string) (*DataStoreId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataStoreId{} - - 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.DataStoreName, ok = parsed.Parsed["dataStoreName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataStoreName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDataStoreIDInsensitively(input string) (*DataStoreId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataStoreId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DataStoreId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataStoreName, ok = parsed.Parsed["dataStoreName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataStoreName", *parsed) + if id.DataStoreName, ok = input.Parsed["dataStoreName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataStoreName", input) } - return &id, nil + return nil } // ValidateDataStoreID checks that 'input' can be parsed as a Data Store ID diff --git a/resource-manager/connectedvmware/2022-01-10-preview/guestagents/id_guestagent.go b/resource-manager/connectedvmware/2022-01-10-preview/guestagents/id_guestagent.go index 95f20a703a2..9413357c7c7 100644 --- a/resource-manager/connectedvmware/2022-01-10-preview/guestagents/id_guestagent.go +++ b/resource-manager/connectedvmware/2022-01-10-preview/guestagents/id_guestagent.go @@ -38,23 +38,9 @@ func ParseGuestAgentID(input string) (*GuestAgentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GuestAgentId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) - } - - if id.GuestAgentName, ok = parsed.Parsed["guestAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "guestAgentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGuestAgentIDInsensitively(input string) (*GuestAgentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GuestAgentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GuestAgentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - if id.GuestAgentName, ok = parsed.Parsed["guestAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "guestAgentName", *parsed) + if id.GuestAgentName, ok = input.Parsed["guestAgentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "guestAgentName", input) } - return &id, nil + return nil } // ValidateGuestAgentID checks that 'input' can be parsed as a Guest Agent ID diff --git a/resource-manager/connectedvmware/2022-01-10-preview/guestagents/id_virtualmachine.go b/resource-manager/connectedvmware/2022-01-10-preview/guestagents/id_virtualmachine.go index a5fdabef265..e91e5f9ac15 100644 --- a/resource-manager/connectedvmware/2022-01-10-preview/guestagents/id_virtualmachine.go +++ b/resource-manager/connectedvmware/2022-01-10-preview/guestagents/id_virtualmachine.go @@ -36,19 +36,9 @@ func ParseVirtualMachineID(input string) (*VirtualMachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineIDInsensitively(input string) (*VirtualMachineId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - return &id, nil + return nil } // ValidateVirtualMachineID checks that 'input' can be parsed as a Virtual Machine ID diff --git a/resource-manager/connectedvmware/2022-01-10-preview/hosts/id_host.go b/resource-manager/connectedvmware/2022-01-10-preview/hosts/id_host.go index 9cebde774c1..6baa780a596 100644 --- a/resource-manager/connectedvmware/2022-01-10-preview/hosts/id_host.go +++ b/resource-manager/connectedvmware/2022-01-10-preview/hosts/id_host.go @@ -36,19 +36,9 @@ func ParseHostID(input string) (*HostId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostId{} - - 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.HostName, ok = parsed.Parsed["hostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseHostIDInsensitively(input string) (*HostId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *HostId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostName, ok = parsed.Parsed["hostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostName", *parsed) + if id.HostName, ok = input.Parsed["hostName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostName", input) } - return &id, nil + return nil } // ValidateHostID checks that 'input' can be parsed as a Host ID diff --git a/resource-manager/connectedvmware/2022-01-10-preview/hybrididentitymetadata/id_hybrididentitymetadata.go b/resource-manager/connectedvmware/2022-01-10-preview/hybrididentitymetadata/id_hybrididentitymetadata.go index bfdd7abcfac..6bc7c098d55 100644 --- a/resource-manager/connectedvmware/2022-01-10-preview/hybrididentitymetadata/id_hybrididentitymetadata.go +++ b/resource-manager/connectedvmware/2022-01-10-preview/hybrididentitymetadata/id_hybrididentitymetadata.go @@ -38,23 +38,9 @@ func ParseHybridIdentityMetadataID(input string) (*HybridIdentityMetadataId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HybridIdentityMetadataId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) - } - - if id.HybridIdentityMetadataName, ok = parsed.Parsed["hybridIdentityMetadataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridIdentityMetadataName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseHybridIdentityMetadataIDInsensitively(input string) (*HybridIdentityMe return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HybridIdentityMetadataId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *HybridIdentityMetadataId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - if id.HybridIdentityMetadataName, ok = parsed.Parsed["hybridIdentityMetadataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridIdentityMetadataName", *parsed) + if id.HybridIdentityMetadataName, ok = input.Parsed["hybridIdentityMetadataName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hybridIdentityMetadataName", input) } - return &id, nil + return nil } // ValidateHybridIdentityMetadataID checks that 'input' can be parsed as a Hybrid Identity Metadata ID diff --git a/resource-manager/connectedvmware/2022-01-10-preview/hybrididentitymetadata/id_virtualmachine.go b/resource-manager/connectedvmware/2022-01-10-preview/hybrididentitymetadata/id_virtualmachine.go index aa7556c5769..f9930559b61 100644 --- a/resource-manager/connectedvmware/2022-01-10-preview/hybrididentitymetadata/id_virtualmachine.go +++ b/resource-manager/connectedvmware/2022-01-10-preview/hybrididentitymetadata/id_virtualmachine.go @@ -36,19 +36,9 @@ func ParseVirtualMachineID(input string) (*VirtualMachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineIDInsensitively(input string) (*VirtualMachineId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - return &id, nil + return nil } // ValidateVirtualMachineID checks that 'input' can be parsed as a Virtual Machine ID diff --git a/resource-manager/connectedvmware/2022-01-10-preview/inventoryitems/id_inventoryitem.go b/resource-manager/connectedvmware/2022-01-10-preview/inventoryitems/id_inventoryitem.go index cab6785e4e1..e028bab2306 100644 --- a/resource-manager/connectedvmware/2022-01-10-preview/inventoryitems/id_inventoryitem.go +++ b/resource-manager/connectedvmware/2022-01-10-preview/inventoryitems/id_inventoryitem.go @@ -38,23 +38,9 @@ func ParseInventoryItemID(input string) (*InventoryItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InventoryItemId{} - - 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.VCenterName, ok = parsed.Parsed["vCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vCenterName", *parsed) - } - - if id.InventoryItemName, ok = parsed.Parsed["inventoryItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "inventoryItemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseInventoryItemIDInsensitively(input string) (*InventoryItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InventoryItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *InventoryItemId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VCenterName, ok = parsed.Parsed["vCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vCenterName", *parsed) + if id.VCenterName, ok = input.Parsed["vCenterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vCenterName", input) } - if id.InventoryItemName, ok = parsed.Parsed["inventoryItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "inventoryItemName", *parsed) + if id.InventoryItemName, ok = input.Parsed["inventoryItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "inventoryItemName", input) } - return &id, nil + return nil } // ValidateInventoryItemID checks that 'input' can be parsed as a Inventory Item ID diff --git a/resource-manager/connectedvmware/2022-01-10-preview/inventoryitems/id_vcenter.go b/resource-manager/connectedvmware/2022-01-10-preview/inventoryitems/id_vcenter.go index fc6ea6b74de..d52fbe4c5f8 100644 --- a/resource-manager/connectedvmware/2022-01-10-preview/inventoryitems/id_vcenter.go +++ b/resource-manager/connectedvmware/2022-01-10-preview/inventoryitems/id_vcenter.go @@ -36,19 +36,9 @@ func ParseVCenterID(input string) (*VCenterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VCenterId{} - - 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.VCenterName, ok = parsed.Parsed["vCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vCenterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVCenterIDInsensitively(input string) (*VCenterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VCenterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VCenterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VCenterName, ok = parsed.Parsed["vCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vCenterName", *parsed) + if id.VCenterName, ok = input.Parsed["vCenterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vCenterName", input) } - return &id, nil + return nil } // ValidateVCenterID checks that 'input' can be parsed as a V Center ID diff --git a/resource-manager/connectedvmware/2022-01-10-preview/machineextensions/id_extension.go b/resource-manager/connectedvmware/2022-01-10-preview/machineextensions/id_extension.go index 0819b0f023a..6aebfaa0f55 100644 --- a/resource-manager/connectedvmware/2022-01-10-preview/machineextensions/id_extension.go +++ b/resource-manager/connectedvmware/2022-01-10-preview/machineextensions/id_extension.go @@ -38,23 +38,9 @@ func ParseExtensionID(input string) (*ExtensionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExtensionId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) - } - - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseExtensionIDInsensitively(input string) (*ExtensionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExtensionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ExtensionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if id.ExtensionName, ok = input.Parsed["extensionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "extensionName", input) } - return &id, nil + return nil } // ValidateExtensionID checks that 'input' can be parsed as a Extension ID diff --git a/resource-manager/connectedvmware/2022-01-10-preview/machineextensions/id_virtualmachine.go b/resource-manager/connectedvmware/2022-01-10-preview/machineextensions/id_virtualmachine.go index cd233669293..fcbf70f9ff9 100644 --- a/resource-manager/connectedvmware/2022-01-10-preview/machineextensions/id_virtualmachine.go +++ b/resource-manager/connectedvmware/2022-01-10-preview/machineextensions/id_virtualmachine.go @@ -36,19 +36,9 @@ func ParseVirtualMachineID(input string) (*VirtualMachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineIDInsensitively(input string) (*VirtualMachineId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - return &id, nil + return nil } // ValidateVirtualMachineID checks that 'input' can be parsed as a Virtual Machine ID diff --git a/resource-manager/connectedvmware/2022-01-10-preview/resourcepools/id_resourcepool.go b/resource-manager/connectedvmware/2022-01-10-preview/resourcepools/id_resourcepool.go index d354d74c395..fa24fdc56d8 100644 --- a/resource-manager/connectedvmware/2022-01-10-preview/resourcepools/id_resourcepool.go +++ b/resource-manager/connectedvmware/2022-01-10-preview/resourcepools/id_resourcepool.go @@ -36,19 +36,9 @@ func ParseResourcePoolID(input string) (*ResourcePoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResourcePoolId{} - - 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.ResourcePoolName, ok = parsed.Parsed["resourcePoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourcePoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseResourcePoolIDInsensitively(input string) (*ResourcePoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResourcePoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ResourcePoolId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ResourcePoolName, ok = parsed.Parsed["resourcePoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourcePoolName", *parsed) + if id.ResourcePoolName, ok = input.Parsed["resourcePoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourcePoolName", input) } - return &id, nil + return nil } // ValidateResourcePoolID checks that 'input' can be parsed as a Resource Pool ID diff --git a/resource-manager/connectedvmware/2022-01-10-preview/vcenters/id_vcenter.go b/resource-manager/connectedvmware/2022-01-10-preview/vcenters/id_vcenter.go index ca8b07de4da..8dde791f9a7 100644 --- a/resource-manager/connectedvmware/2022-01-10-preview/vcenters/id_vcenter.go +++ b/resource-manager/connectedvmware/2022-01-10-preview/vcenters/id_vcenter.go @@ -36,19 +36,9 @@ func ParseVCenterID(input string) (*VCenterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VCenterId{} - - 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.VCenterName, ok = parsed.Parsed["vCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vCenterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVCenterIDInsensitively(input string) (*VCenterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VCenterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VCenterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VCenterName, ok = parsed.Parsed["vCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vCenterName", *parsed) + if id.VCenterName, ok = input.Parsed["vCenterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vCenterName", input) } - return &id, nil + return nil } // ValidateVCenterID checks that 'input' can be parsed as a V Center ID diff --git a/resource-manager/connectedvmware/2022-01-10-preview/virtualmachines/id_virtualmachine.go b/resource-manager/connectedvmware/2022-01-10-preview/virtualmachines/id_virtualmachine.go index 0d7e535a703..bddf3585bf7 100644 --- a/resource-manager/connectedvmware/2022-01-10-preview/virtualmachines/id_virtualmachine.go +++ b/resource-manager/connectedvmware/2022-01-10-preview/virtualmachines/id_virtualmachine.go @@ -36,19 +36,9 @@ func ParseVirtualMachineID(input string) (*VirtualMachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineIDInsensitively(input string) (*VirtualMachineId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - return &id, nil + return nil } // ValidateVirtualMachineID checks that 'input' can be parsed as a Virtual Machine ID diff --git a/resource-manager/connectedvmware/2022-01-10-preview/virtualmachinetemplates/id_virtualmachinetemplate.go b/resource-manager/connectedvmware/2022-01-10-preview/virtualmachinetemplates/id_virtualmachinetemplate.go index 13b5f90504d..7f8bb9f08de 100644 --- a/resource-manager/connectedvmware/2022-01-10-preview/virtualmachinetemplates/id_virtualmachinetemplate.go +++ b/resource-manager/connectedvmware/2022-01-10-preview/virtualmachinetemplates/id_virtualmachinetemplate.go @@ -36,19 +36,9 @@ func ParseVirtualMachineTemplateID(input string) (*VirtualMachineTemplateId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineTemplateId{} - - 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.VirtualMachineTemplateName, ok = parsed.Parsed["virtualMachineTemplateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineTemplateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineTemplateIDInsensitively(input string) (*VirtualMachineTe return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineTemplateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineTemplateId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineTemplateName, ok = parsed.Parsed["virtualMachineTemplateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineTemplateName", *parsed) + if id.VirtualMachineTemplateName, ok = input.Parsed["virtualMachineTemplateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineTemplateName", input) } - return &id, nil + return nil } // ValidateVirtualMachineTemplateID checks that 'input' can be parsed as a Virtual Machine Template ID diff --git a/resource-manager/connectedvmware/2022-01-10-preview/virtualnetworks/id_virtualnetwork.go b/resource-manager/connectedvmware/2022-01-10-preview/virtualnetworks/id_virtualnetwork.go index 6161b89a9ce..29fa66eb853 100644 --- a/resource-manager/connectedvmware/2022-01-10-preview/virtualnetworks/id_virtualnetwork.go +++ b/resource-manager/connectedvmware/2022-01-10-preview/virtualnetworks/id_virtualnetwork.go @@ -36,19 +36,9 @@ func ParseVirtualNetworkID(input string) (*VirtualNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkId{} - - 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.VirtualNetworkName, ok = parsed.Parsed["virtualNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualNetworkIDInsensitively(input string) (*VirtualNetworkId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualNetworkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualNetworkName, ok = parsed.Parsed["virtualNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkName", *parsed) + if id.VirtualNetworkName, ok = input.Parsed["virtualNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkName", input) } - return &id, nil + return nil } // ValidateVirtualNetworkID checks that 'input' can be parsed as a Virtual Network ID diff --git a/resource-manager/connectedvmware/2023-10-01/clusters/id_cluster.go b/resource-manager/connectedvmware/2023-10-01/clusters/id_cluster.go index f0ba6058faf..e1c8faa5059 100644 --- a/resource-manager/connectedvmware/2023-10-01/clusters/id_cluster.go +++ b/resource-manager/connectedvmware/2023-10-01/clusters/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/connectedvmware/2023-10-01/datastores/id_datastore.go b/resource-manager/connectedvmware/2023-10-01/datastores/id_datastore.go index 7cb77709980..059fb77670d 100644 --- a/resource-manager/connectedvmware/2023-10-01/datastores/id_datastore.go +++ b/resource-manager/connectedvmware/2023-10-01/datastores/id_datastore.go @@ -36,19 +36,9 @@ func ParseDataStoreID(input string) (*DataStoreId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataStoreId{} - - 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.DataStoreName, ok = parsed.Parsed["dataStoreName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataStoreName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDataStoreIDInsensitively(input string) (*DataStoreId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataStoreId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DataStoreId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataStoreName, ok = parsed.Parsed["dataStoreName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataStoreName", *parsed) + if id.DataStoreName, ok = input.Parsed["dataStoreName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataStoreName", input) } - return &id, nil + return nil } // ValidateDataStoreID checks that 'input' can be parsed as a Data Store ID diff --git a/resource-manager/connectedvmware/2023-10-01/hosts/id_host.go b/resource-manager/connectedvmware/2023-10-01/hosts/id_host.go index 9cebde774c1..6baa780a596 100644 --- a/resource-manager/connectedvmware/2023-10-01/hosts/id_host.go +++ b/resource-manager/connectedvmware/2023-10-01/hosts/id_host.go @@ -36,19 +36,9 @@ func ParseHostID(input string) (*HostId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostId{} - - 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.HostName, ok = parsed.Parsed["hostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseHostIDInsensitively(input string) (*HostId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *HostId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostName, ok = parsed.Parsed["hostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostName", *parsed) + if id.HostName, ok = input.Parsed["hostName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostName", input) } - return &id, nil + return nil } // ValidateHostID checks that 'input' can be parsed as a Host ID diff --git a/resource-manager/connectedvmware/2023-10-01/inventoryitems/id_inventoryitem.go b/resource-manager/connectedvmware/2023-10-01/inventoryitems/id_inventoryitem.go index cab6785e4e1..e028bab2306 100644 --- a/resource-manager/connectedvmware/2023-10-01/inventoryitems/id_inventoryitem.go +++ b/resource-manager/connectedvmware/2023-10-01/inventoryitems/id_inventoryitem.go @@ -38,23 +38,9 @@ func ParseInventoryItemID(input string) (*InventoryItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InventoryItemId{} - - 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.VCenterName, ok = parsed.Parsed["vCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vCenterName", *parsed) - } - - if id.InventoryItemName, ok = parsed.Parsed["inventoryItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "inventoryItemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseInventoryItemIDInsensitively(input string) (*InventoryItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InventoryItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *InventoryItemId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VCenterName, ok = parsed.Parsed["vCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vCenterName", *parsed) + if id.VCenterName, ok = input.Parsed["vCenterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vCenterName", input) } - if id.InventoryItemName, ok = parsed.Parsed["inventoryItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "inventoryItemName", *parsed) + if id.InventoryItemName, ok = input.Parsed["inventoryItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "inventoryItemName", input) } - return &id, nil + return nil } // ValidateInventoryItemID checks that 'input' can be parsed as a Inventory Item ID diff --git a/resource-manager/connectedvmware/2023-10-01/inventoryitems/id_vcenter.go b/resource-manager/connectedvmware/2023-10-01/inventoryitems/id_vcenter.go index fc6ea6b74de..d52fbe4c5f8 100644 --- a/resource-manager/connectedvmware/2023-10-01/inventoryitems/id_vcenter.go +++ b/resource-manager/connectedvmware/2023-10-01/inventoryitems/id_vcenter.go @@ -36,19 +36,9 @@ func ParseVCenterID(input string) (*VCenterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VCenterId{} - - 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.VCenterName, ok = parsed.Parsed["vCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vCenterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVCenterIDInsensitively(input string) (*VCenterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VCenterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VCenterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VCenterName, ok = parsed.Parsed["vCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vCenterName", *parsed) + if id.VCenterName, ok = input.Parsed["vCenterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vCenterName", input) } - return &id, nil + return nil } // ValidateVCenterID checks that 'input' can be parsed as a V Center ID diff --git a/resource-manager/connectedvmware/2023-10-01/resourcepools/id_resourcepool.go b/resource-manager/connectedvmware/2023-10-01/resourcepools/id_resourcepool.go index d354d74c395..fa24fdc56d8 100644 --- a/resource-manager/connectedvmware/2023-10-01/resourcepools/id_resourcepool.go +++ b/resource-manager/connectedvmware/2023-10-01/resourcepools/id_resourcepool.go @@ -36,19 +36,9 @@ func ParseResourcePoolID(input string) (*ResourcePoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResourcePoolId{} - - 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.ResourcePoolName, ok = parsed.Parsed["resourcePoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourcePoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseResourcePoolIDInsensitively(input string) (*ResourcePoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResourcePoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ResourcePoolId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ResourcePoolName, ok = parsed.Parsed["resourcePoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourcePoolName", *parsed) + if id.ResourcePoolName, ok = input.Parsed["resourcePoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourcePoolName", input) } - return &id, nil + return nil } // ValidateResourcePoolID checks that 'input' can be parsed as a Resource Pool ID diff --git a/resource-manager/connectedvmware/2023-10-01/vcenters/id_vcenter.go b/resource-manager/connectedvmware/2023-10-01/vcenters/id_vcenter.go index ca8b07de4da..8dde791f9a7 100644 --- a/resource-manager/connectedvmware/2023-10-01/vcenters/id_vcenter.go +++ b/resource-manager/connectedvmware/2023-10-01/vcenters/id_vcenter.go @@ -36,19 +36,9 @@ func ParseVCenterID(input string) (*VCenterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VCenterId{} - - 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.VCenterName, ok = parsed.Parsed["vCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vCenterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVCenterIDInsensitively(input string) (*VCenterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VCenterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VCenterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VCenterName, ok = parsed.Parsed["vCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vCenterName", *parsed) + if id.VCenterName, ok = input.Parsed["vCenterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vCenterName", input) } - return &id, nil + return nil } // ValidateVCenterID checks that 'input' can be parsed as a V Center ID diff --git a/resource-manager/connectedvmware/2023-10-01/virtualmachinetemplates/id_virtualmachinetemplate.go b/resource-manager/connectedvmware/2023-10-01/virtualmachinetemplates/id_virtualmachinetemplate.go index 13b5f90504d..7f8bb9f08de 100644 --- a/resource-manager/connectedvmware/2023-10-01/virtualmachinetemplates/id_virtualmachinetemplate.go +++ b/resource-manager/connectedvmware/2023-10-01/virtualmachinetemplates/id_virtualmachinetemplate.go @@ -36,19 +36,9 @@ func ParseVirtualMachineTemplateID(input string) (*VirtualMachineTemplateId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineTemplateId{} - - 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.VirtualMachineTemplateName, ok = parsed.Parsed["virtualMachineTemplateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineTemplateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineTemplateIDInsensitively(input string) (*VirtualMachineTe return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineTemplateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineTemplateId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineTemplateName, ok = parsed.Parsed["virtualMachineTemplateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineTemplateName", *parsed) + if id.VirtualMachineTemplateName, ok = input.Parsed["virtualMachineTemplateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineTemplateName", input) } - return &id, nil + return nil } // ValidateVirtualMachineTemplateID checks that 'input' can be parsed as a Virtual Machine Template ID diff --git a/resource-manager/connectedvmware/2023-10-01/virtualnetworks/id_virtualnetwork.go b/resource-manager/connectedvmware/2023-10-01/virtualnetworks/id_virtualnetwork.go index 6161b89a9ce..29fa66eb853 100644 --- a/resource-manager/connectedvmware/2023-10-01/virtualnetworks/id_virtualnetwork.go +++ b/resource-manager/connectedvmware/2023-10-01/virtualnetworks/id_virtualnetwork.go @@ -36,19 +36,9 @@ func ParseVirtualNetworkID(input string) (*VirtualNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkId{} - - 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.VirtualNetworkName, ok = parsed.Parsed["virtualNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualNetworkIDInsensitively(input string) (*VirtualNetworkId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualNetworkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualNetworkName, ok = parsed.Parsed["virtualNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkName", *parsed) + if id.VirtualNetworkName, ok = input.Parsed["virtualNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkName", input) } - return &id, nil + return nil } // ValidateVirtualNetworkID checks that 'input' can be parsed as a Virtual Network ID diff --git a/resource-manager/consumption/2019-10-01/aggregatedcost/id_providers2billingperiod.go b/resource-manager/consumption/2019-10-01/aggregatedcost/id_providers2billingperiod.go index 644391d80a0..d4d7e7d81ba 100644 --- a/resource-manager/consumption/2019-10-01/aggregatedcost/id_providers2billingperiod.go +++ b/resource-manager/consumption/2019-10-01/aggregatedcost/id_providers2billingperiod.go @@ -34,15 +34,9 @@ func ParseProviders2BillingPeriodID(input string) (*Providers2BillingPeriodId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2BillingPeriodId{} - - if id.ManagementGroupId, ok = parsed.Parsed["managementGroupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managementGroupId", *parsed) - } - - if id.BillingPeriodName, ok = parsed.Parsed["billingPeriodName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviders2BillingPeriodIDInsensitively(input string) (*Providers2Billi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2BillingPeriodId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ManagementGroupId, ok = parsed.Parsed["managementGroupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managementGroupId", *parsed) + return &id, nil +} + +func (id *Providers2BillingPeriodId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ManagementGroupId, ok = input.Parsed["managementGroupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managementGroupId", input) } - if id.BillingPeriodName, ok = parsed.Parsed["billingPeriodName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", *parsed) + if id.BillingPeriodName, ok = input.Parsed["billingPeriodName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", input) } - return &id, nil + return nil } // ValidateProviders2BillingPeriodID checks that 'input' can be parsed as a Providers 2 Billing Period ID diff --git a/resource-manager/consumption/2019-10-01/balances/id_billingaccount.go b/resource-manager/consumption/2019-10-01/balances/id_billingaccount.go index 40d28457b44..dc40b286b60 100644 --- a/resource-manager/consumption/2019-10-01/balances/id_billingaccount.go +++ b/resource-manager/consumption/2019-10-01/balances/id_billingaccount.go @@ -32,11 +32,9 @@ func ParseBillingAccountID(input string) (*BillingAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseBillingAccountIDInsensitively(input string) (*BillingAccountId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *BillingAccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) + } + + return nil +} + // ValidateBillingAccountID checks that 'input' can be parsed as a Billing Account ID func ValidateBillingAccountID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/consumption/2019-10-01/balances/id_billingaccountbillingperiod.go b/resource-manager/consumption/2019-10-01/balances/id_billingaccountbillingperiod.go index 6ef6c417bd9..7a90b562472 100644 --- a/resource-manager/consumption/2019-10-01/balances/id_billingaccountbillingperiod.go +++ b/resource-manager/consumption/2019-10-01/balances/id_billingaccountbillingperiod.go @@ -34,15 +34,9 @@ func ParseBillingAccountBillingPeriodID(input string) (*BillingAccountBillingPer return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountBillingPeriodId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) - } - - if id.BillingPeriodName, ok = parsed.Parsed["billingPeriodName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseBillingAccountBillingPeriodIDInsensitively(input string) (*BillingAcco return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountBillingPeriodId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + return &id, nil +} + +func (id *BillingAccountBillingPeriodId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) } - if id.BillingPeriodName, ok = parsed.Parsed["billingPeriodName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", *parsed) + if id.BillingPeriodName, ok = input.Parsed["billingPeriodName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", input) } - return &id, nil + return nil } // ValidateBillingAccountBillingPeriodID checks that 'input' can be parsed as a Billing Account Billing Period ID diff --git a/resource-manager/consumption/2019-10-01/budgets/id_scopedbudget.go b/resource-manager/consumption/2019-10-01/budgets/id_scopedbudget.go index f5eda7aa882..1084bf0ee86 100644 --- a/resource-manager/consumption/2019-10-01/budgets/id_scopedbudget.go +++ b/resource-manager/consumption/2019-10-01/budgets/id_scopedbudget.go @@ -34,15 +34,9 @@ func ParseScopedBudgetID(input string) (*ScopedBudgetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedBudgetId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.BudgetName, ok = parsed.Parsed["budgetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "budgetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedBudgetIDInsensitively(input string) (*ScopedBudgetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedBudgetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedBudgetId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.BudgetName, ok = parsed.Parsed["budgetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "budgetName", *parsed) + if id.BudgetName, ok = input.Parsed["budgetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "budgetName", input) } - return &id, nil + return nil } // ValidateScopedBudgetID checks that 'input' can be parsed as a Scoped Budget ID diff --git a/resource-manager/consumption/2019-10-01/pricesheet/id_billingperiod.go b/resource-manager/consumption/2019-10-01/pricesheet/id_billingperiod.go index 3a358d14b68..7670b1c49bb 100644 --- a/resource-manager/consumption/2019-10-01/pricesheet/id_billingperiod.go +++ b/resource-manager/consumption/2019-10-01/pricesheet/id_billingperiod.go @@ -34,15 +34,9 @@ func ParseBillingPeriodID(input string) (*BillingPeriodId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingPeriodId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.BillingPeriodName, ok = parsed.Parsed["billingPeriodName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseBillingPeriodIDInsensitively(input string) (*BillingPeriodId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingPeriodId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *BillingPeriodId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.BillingPeriodName, ok = parsed.Parsed["billingPeriodName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", *parsed) + if id.BillingPeriodName, ok = input.Parsed["billingPeriodName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", input) } - return &id, nil + return nil } // ValidateBillingPeriodID checks that 'input' can be parsed as a Billing Period ID diff --git a/resource-manager/consumption/2019-10-01/reservationdetails/id_reservation.go b/resource-manager/consumption/2019-10-01/reservationdetails/id_reservation.go index 927ca5bab9b..b869dfdda69 100644 --- a/resource-manager/consumption/2019-10-01/reservationdetails/id_reservation.go +++ b/resource-manager/consumption/2019-10-01/reservationdetails/id_reservation.go @@ -34,15 +34,9 @@ func ParseReservationID(input string) (*ReservationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReservationId{} - - if id.ReservationOrderId, ok = parsed.Parsed["reservationOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", *parsed) - } - - if id.ReservationId, ok = parsed.Parsed["reservationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseReservationIDInsensitively(input string) (*ReservationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReservationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ReservationOrderId, ok = parsed.Parsed["reservationOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", *parsed) + return &id, nil +} + +func (id *ReservationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ReservationOrderId, ok = input.Parsed["reservationOrderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", input) } - if id.ReservationId, ok = parsed.Parsed["reservationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationId", *parsed) + if id.ReservationId, ok = input.Parsed["reservationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reservationId", input) } - return &id, nil + return nil } // ValidateReservationID checks that 'input' can be parsed as a Reservation ID diff --git a/resource-manager/consumption/2019-10-01/reservationdetails/id_reservationorder.go b/resource-manager/consumption/2019-10-01/reservationdetails/id_reservationorder.go index 83f55f2e96c..2ba3e139a5c 100644 --- a/resource-manager/consumption/2019-10-01/reservationdetails/id_reservationorder.go +++ b/resource-manager/consumption/2019-10-01/reservationdetails/id_reservationorder.go @@ -32,11 +32,9 @@ func ParseReservationOrderID(input string) (*ReservationOrderId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReservationOrderId{} - - if id.ReservationOrderId, ok = parsed.Parsed["reservationOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseReservationOrderIDInsensitively(input string) (*ReservationOrderId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReservationOrderId{} - - if id.ReservationOrderId, ok = parsed.Parsed["reservationOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *ReservationOrderId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ReservationOrderId, ok = input.Parsed["reservationOrderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", input) + } + + return nil +} + // ValidateReservationOrderID checks that 'input' can be parsed as a Reservation Order ID func ValidateReservationOrderID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/consumption/2019-10-01/reservationsummaries/id_reservation.go b/resource-manager/consumption/2019-10-01/reservationsummaries/id_reservation.go index 2564474b91d..ca004e0ad93 100644 --- a/resource-manager/consumption/2019-10-01/reservationsummaries/id_reservation.go +++ b/resource-manager/consumption/2019-10-01/reservationsummaries/id_reservation.go @@ -34,15 +34,9 @@ func ParseReservationID(input string) (*ReservationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReservationId{} - - if id.ReservationOrderId, ok = parsed.Parsed["reservationOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", *parsed) - } - - if id.ReservationId, ok = parsed.Parsed["reservationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseReservationIDInsensitively(input string) (*ReservationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReservationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ReservationOrderId, ok = parsed.Parsed["reservationOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", *parsed) + return &id, nil +} + +func (id *ReservationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ReservationOrderId, ok = input.Parsed["reservationOrderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", input) } - if id.ReservationId, ok = parsed.Parsed["reservationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationId", *parsed) + if id.ReservationId, ok = input.Parsed["reservationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reservationId", input) } - return &id, nil + return nil } // ValidateReservationID checks that 'input' can be parsed as a Reservation ID diff --git a/resource-manager/consumption/2019-10-01/reservationsummaries/id_reservationorder.go b/resource-manager/consumption/2019-10-01/reservationsummaries/id_reservationorder.go index 58fe3dfbe0c..d07bb3750ef 100644 --- a/resource-manager/consumption/2019-10-01/reservationsummaries/id_reservationorder.go +++ b/resource-manager/consumption/2019-10-01/reservationsummaries/id_reservationorder.go @@ -32,11 +32,9 @@ func ParseReservationOrderID(input string) (*ReservationOrderId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReservationOrderId{} - - if id.ReservationOrderId, ok = parsed.Parsed["reservationOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseReservationOrderIDInsensitively(input string) (*ReservationOrderId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReservationOrderId{} - - if id.ReservationOrderId, ok = parsed.Parsed["reservationOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *ReservationOrderId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ReservationOrderId, ok = input.Parsed["reservationOrderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", input) + } + + return nil +} + // ValidateReservationOrderID checks that 'input' can be parsed as a Reservation Order ID func ValidateReservationOrderID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/consumption/2019-10-01/reservationtransactions/id_billingaccount.go b/resource-manager/consumption/2019-10-01/reservationtransactions/id_billingaccount.go index 61464e8781e..dadda8c6ab4 100644 --- a/resource-manager/consumption/2019-10-01/reservationtransactions/id_billingaccount.go +++ b/resource-manager/consumption/2019-10-01/reservationtransactions/id_billingaccount.go @@ -32,11 +32,9 @@ func ParseBillingAccountID(input string) (*BillingAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseBillingAccountIDInsensitively(input string) (*BillingAccountId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *BillingAccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) + } + + return nil +} + // ValidateBillingAccountID checks that 'input' can be parsed as a Billing Account ID func ValidateBillingAccountID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/consumption/2019-10-01/reservationtransactions/id_billingprofile.go b/resource-manager/consumption/2019-10-01/reservationtransactions/id_billingprofile.go index 9f36858e0aa..7ccfc804f72 100644 --- a/resource-manager/consumption/2019-10-01/reservationtransactions/id_billingprofile.go +++ b/resource-manager/consumption/2019-10-01/reservationtransactions/id_billingprofile.go @@ -34,15 +34,9 @@ func ParseBillingProfileID(input string) (*BillingProfileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) - } - - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseBillingProfileIDInsensitively(input string) (*BillingProfileId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + return &id, nil +} + +func (id *BillingProfileId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) } - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if id.BillingProfileId, ok = input.Parsed["billingProfileId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", input) } - return &id, nil + return nil } // ValidateBillingProfileID checks that 'input' can be parsed as a Billing Profile ID diff --git a/resource-manager/consumption/2021-10-01/aggregatedcost/id_providers2billingperiod.go b/resource-manager/consumption/2021-10-01/aggregatedcost/id_providers2billingperiod.go index 644391d80a0..d4d7e7d81ba 100644 --- a/resource-manager/consumption/2021-10-01/aggregatedcost/id_providers2billingperiod.go +++ b/resource-manager/consumption/2021-10-01/aggregatedcost/id_providers2billingperiod.go @@ -34,15 +34,9 @@ func ParseProviders2BillingPeriodID(input string) (*Providers2BillingPeriodId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2BillingPeriodId{} - - if id.ManagementGroupId, ok = parsed.Parsed["managementGroupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managementGroupId", *parsed) - } - - if id.BillingPeriodName, ok = parsed.Parsed["billingPeriodName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviders2BillingPeriodIDInsensitively(input string) (*Providers2Billi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2BillingPeriodId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ManagementGroupId, ok = parsed.Parsed["managementGroupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managementGroupId", *parsed) + return &id, nil +} + +func (id *Providers2BillingPeriodId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ManagementGroupId, ok = input.Parsed["managementGroupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managementGroupId", input) } - if id.BillingPeriodName, ok = parsed.Parsed["billingPeriodName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", *parsed) + if id.BillingPeriodName, ok = input.Parsed["billingPeriodName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", input) } - return &id, nil + return nil } // ValidateProviders2BillingPeriodID checks that 'input' can be parsed as a Providers 2 Billing Period ID diff --git a/resource-manager/consumption/2021-10-01/balances/id_billingaccount.go b/resource-manager/consumption/2021-10-01/balances/id_billingaccount.go index 40d28457b44..dc40b286b60 100644 --- a/resource-manager/consumption/2021-10-01/balances/id_billingaccount.go +++ b/resource-manager/consumption/2021-10-01/balances/id_billingaccount.go @@ -32,11 +32,9 @@ func ParseBillingAccountID(input string) (*BillingAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseBillingAccountIDInsensitively(input string) (*BillingAccountId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *BillingAccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) + } + + return nil +} + // ValidateBillingAccountID checks that 'input' can be parsed as a Billing Account ID func ValidateBillingAccountID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/consumption/2021-10-01/balances/id_billingaccountbillingperiod.go b/resource-manager/consumption/2021-10-01/balances/id_billingaccountbillingperiod.go index 6ef6c417bd9..7a90b562472 100644 --- a/resource-manager/consumption/2021-10-01/balances/id_billingaccountbillingperiod.go +++ b/resource-manager/consumption/2021-10-01/balances/id_billingaccountbillingperiod.go @@ -34,15 +34,9 @@ func ParseBillingAccountBillingPeriodID(input string) (*BillingAccountBillingPer return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountBillingPeriodId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) - } - - if id.BillingPeriodName, ok = parsed.Parsed["billingPeriodName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseBillingAccountBillingPeriodIDInsensitively(input string) (*BillingAcco return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountBillingPeriodId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + return &id, nil +} + +func (id *BillingAccountBillingPeriodId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) } - if id.BillingPeriodName, ok = parsed.Parsed["billingPeriodName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", *parsed) + if id.BillingPeriodName, ok = input.Parsed["billingPeriodName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", input) } - return &id, nil + return nil } // ValidateBillingAccountBillingPeriodID checks that 'input' can be parsed as a Billing Account Billing Period ID diff --git a/resource-manager/consumption/2021-10-01/budgets/id_scopedbudget.go b/resource-manager/consumption/2021-10-01/budgets/id_scopedbudget.go index f5eda7aa882..1084bf0ee86 100644 --- a/resource-manager/consumption/2021-10-01/budgets/id_scopedbudget.go +++ b/resource-manager/consumption/2021-10-01/budgets/id_scopedbudget.go @@ -34,15 +34,9 @@ func ParseScopedBudgetID(input string) (*ScopedBudgetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedBudgetId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.BudgetName, ok = parsed.Parsed["budgetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "budgetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedBudgetIDInsensitively(input string) (*ScopedBudgetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedBudgetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedBudgetId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.BudgetName, ok = parsed.Parsed["budgetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "budgetName", *parsed) + if id.BudgetName, ok = input.Parsed["budgetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "budgetName", input) } - return &id, nil + return nil } // ValidateScopedBudgetID checks that 'input' can be parsed as a Scoped Budget ID diff --git a/resource-manager/consumption/2021-10-01/credits/id_billingprofile.go b/resource-manager/consumption/2021-10-01/credits/id_billingprofile.go index d2f14371ba0..be5cb6e842f 100644 --- a/resource-manager/consumption/2021-10-01/credits/id_billingprofile.go +++ b/resource-manager/consumption/2021-10-01/credits/id_billingprofile.go @@ -34,15 +34,9 @@ func ParseBillingProfileID(input string) (*BillingProfileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) - } - - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseBillingProfileIDInsensitively(input string) (*BillingProfileId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + return &id, nil +} + +func (id *BillingProfileId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) } - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if id.BillingProfileId, ok = input.Parsed["billingProfileId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", input) } - return &id, nil + return nil } // ValidateBillingProfileID checks that 'input' can be parsed as a Billing Profile ID diff --git a/resource-manager/consumption/2021-10-01/events/id_billingaccount.go b/resource-manager/consumption/2021-10-01/events/id_billingaccount.go index ca68a453f33..c985967f3b1 100644 --- a/resource-manager/consumption/2021-10-01/events/id_billingaccount.go +++ b/resource-manager/consumption/2021-10-01/events/id_billingaccount.go @@ -32,11 +32,9 @@ func ParseBillingAccountID(input string) (*BillingAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseBillingAccountIDInsensitively(input string) (*BillingAccountId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *BillingAccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) + } + + return nil +} + // ValidateBillingAccountID checks that 'input' can be parsed as a Billing Account ID func ValidateBillingAccountID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/consumption/2021-10-01/events/id_billingprofile.go b/resource-manager/consumption/2021-10-01/events/id_billingprofile.go index acc36b88681..c1db5f140f1 100644 --- a/resource-manager/consumption/2021-10-01/events/id_billingprofile.go +++ b/resource-manager/consumption/2021-10-01/events/id_billingprofile.go @@ -34,15 +34,9 @@ func ParseBillingProfileID(input string) (*BillingProfileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) - } - - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseBillingProfileIDInsensitively(input string) (*BillingProfileId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + return &id, nil +} + +func (id *BillingProfileId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) } - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if id.BillingProfileId, ok = input.Parsed["billingProfileId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", input) } - return &id, nil + return nil } // ValidateBillingProfileID checks that 'input' can be parsed as a Billing Profile ID diff --git a/resource-manager/consumption/2021-10-01/lots/id_billingaccount.go b/resource-manager/consumption/2021-10-01/lots/id_billingaccount.go index c35f65a268e..a6648255fb0 100644 --- a/resource-manager/consumption/2021-10-01/lots/id_billingaccount.go +++ b/resource-manager/consumption/2021-10-01/lots/id_billingaccount.go @@ -32,11 +32,9 @@ func ParseBillingAccountID(input string) (*BillingAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseBillingAccountIDInsensitively(input string) (*BillingAccountId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *BillingAccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) + } + + return nil +} + // ValidateBillingAccountID checks that 'input' can be parsed as a Billing Account ID func ValidateBillingAccountID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/consumption/2021-10-01/lots/id_billingprofile.go b/resource-manager/consumption/2021-10-01/lots/id_billingprofile.go index 7e03196d19c..cd664210bc0 100644 --- a/resource-manager/consumption/2021-10-01/lots/id_billingprofile.go +++ b/resource-manager/consumption/2021-10-01/lots/id_billingprofile.go @@ -34,15 +34,9 @@ func ParseBillingProfileID(input string) (*BillingProfileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) - } - - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseBillingProfileIDInsensitively(input string) (*BillingProfileId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + return &id, nil +} + +func (id *BillingProfileId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) } - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if id.BillingProfileId, ok = input.Parsed["billingProfileId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", input) } - return &id, nil + return nil } // ValidateBillingProfileID checks that 'input' can be parsed as a Billing Profile ID diff --git a/resource-manager/consumption/2021-10-01/lots/id_customer.go b/resource-manager/consumption/2021-10-01/lots/id_customer.go index 730efbd35f7..85594ff3225 100644 --- a/resource-manager/consumption/2021-10-01/lots/id_customer.go +++ b/resource-manager/consumption/2021-10-01/lots/id_customer.go @@ -34,15 +34,9 @@ func ParseCustomerID(input string) (*CustomerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CustomerId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) - } - - if id.CustomerId, ok = parsed.Parsed["customerId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "customerId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseCustomerIDInsensitively(input string) (*CustomerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CustomerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + return &id, nil +} + +func (id *CustomerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) } - if id.CustomerId, ok = parsed.Parsed["customerId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "customerId", *parsed) + if id.CustomerId, ok = input.Parsed["customerId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "customerId", input) } - return &id, nil + return nil } // ValidateCustomerID checks that 'input' can be parsed as a Customer ID diff --git a/resource-manager/consumption/2021-10-01/pricesheet/id_billingperiod.go b/resource-manager/consumption/2021-10-01/pricesheet/id_billingperiod.go index 3a358d14b68..7670b1c49bb 100644 --- a/resource-manager/consumption/2021-10-01/pricesheet/id_billingperiod.go +++ b/resource-manager/consumption/2021-10-01/pricesheet/id_billingperiod.go @@ -34,15 +34,9 @@ func ParseBillingPeriodID(input string) (*BillingPeriodId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingPeriodId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.BillingPeriodName, ok = parsed.Parsed["billingPeriodName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseBillingPeriodIDInsensitively(input string) (*BillingPeriodId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingPeriodId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *BillingPeriodId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.BillingPeriodName, ok = parsed.Parsed["billingPeriodName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", *parsed) + if id.BillingPeriodName, ok = input.Parsed["billingPeriodName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", input) } - return &id, nil + return nil } // ValidateBillingPeriodID checks that 'input' can be parsed as a Billing Period ID diff --git a/resource-manager/consumption/2021-10-01/reservationdetails/id_reservation.go b/resource-manager/consumption/2021-10-01/reservationdetails/id_reservation.go index 927ca5bab9b..b869dfdda69 100644 --- a/resource-manager/consumption/2021-10-01/reservationdetails/id_reservation.go +++ b/resource-manager/consumption/2021-10-01/reservationdetails/id_reservation.go @@ -34,15 +34,9 @@ func ParseReservationID(input string) (*ReservationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReservationId{} - - if id.ReservationOrderId, ok = parsed.Parsed["reservationOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", *parsed) - } - - if id.ReservationId, ok = parsed.Parsed["reservationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseReservationIDInsensitively(input string) (*ReservationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReservationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ReservationOrderId, ok = parsed.Parsed["reservationOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", *parsed) + return &id, nil +} + +func (id *ReservationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ReservationOrderId, ok = input.Parsed["reservationOrderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", input) } - if id.ReservationId, ok = parsed.Parsed["reservationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationId", *parsed) + if id.ReservationId, ok = input.Parsed["reservationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reservationId", input) } - return &id, nil + return nil } // ValidateReservationID checks that 'input' can be parsed as a Reservation ID diff --git a/resource-manager/consumption/2021-10-01/reservationdetails/id_reservationorder.go b/resource-manager/consumption/2021-10-01/reservationdetails/id_reservationorder.go index 83f55f2e96c..2ba3e139a5c 100644 --- a/resource-manager/consumption/2021-10-01/reservationdetails/id_reservationorder.go +++ b/resource-manager/consumption/2021-10-01/reservationdetails/id_reservationorder.go @@ -32,11 +32,9 @@ func ParseReservationOrderID(input string) (*ReservationOrderId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReservationOrderId{} - - if id.ReservationOrderId, ok = parsed.Parsed["reservationOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseReservationOrderIDInsensitively(input string) (*ReservationOrderId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReservationOrderId{} - - if id.ReservationOrderId, ok = parsed.Parsed["reservationOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *ReservationOrderId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ReservationOrderId, ok = input.Parsed["reservationOrderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", input) + } + + return nil +} + // ValidateReservationOrderID checks that 'input' can be parsed as a Reservation Order ID func ValidateReservationOrderID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/consumption/2021-10-01/reservationsummaries/id_reservation.go b/resource-manager/consumption/2021-10-01/reservationsummaries/id_reservation.go index 2564474b91d..ca004e0ad93 100644 --- a/resource-manager/consumption/2021-10-01/reservationsummaries/id_reservation.go +++ b/resource-manager/consumption/2021-10-01/reservationsummaries/id_reservation.go @@ -34,15 +34,9 @@ func ParseReservationID(input string) (*ReservationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReservationId{} - - if id.ReservationOrderId, ok = parsed.Parsed["reservationOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", *parsed) - } - - if id.ReservationId, ok = parsed.Parsed["reservationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseReservationIDInsensitively(input string) (*ReservationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReservationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ReservationOrderId, ok = parsed.Parsed["reservationOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", *parsed) + return &id, nil +} + +func (id *ReservationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ReservationOrderId, ok = input.Parsed["reservationOrderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", input) } - if id.ReservationId, ok = parsed.Parsed["reservationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationId", *parsed) + if id.ReservationId, ok = input.Parsed["reservationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reservationId", input) } - return &id, nil + return nil } // ValidateReservationID checks that 'input' can be parsed as a Reservation ID diff --git a/resource-manager/consumption/2021-10-01/reservationsummaries/id_reservationorder.go b/resource-manager/consumption/2021-10-01/reservationsummaries/id_reservationorder.go index 58fe3dfbe0c..d07bb3750ef 100644 --- a/resource-manager/consumption/2021-10-01/reservationsummaries/id_reservationorder.go +++ b/resource-manager/consumption/2021-10-01/reservationsummaries/id_reservationorder.go @@ -32,11 +32,9 @@ func ParseReservationOrderID(input string) (*ReservationOrderId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReservationOrderId{} - - if id.ReservationOrderId, ok = parsed.Parsed["reservationOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseReservationOrderIDInsensitively(input string) (*ReservationOrderId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReservationOrderId{} - - if id.ReservationOrderId, ok = parsed.Parsed["reservationOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *ReservationOrderId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ReservationOrderId, ok = input.Parsed["reservationOrderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", input) + } + + return nil +} + // ValidateReservationOrderID checks that 'input' can be parsed as a Reservation Order ID func ValidateReservationOrderID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/consumption/2021-10-01/reservationtransactions/id_billingaccount.go b/resource-manager/consumption/2021-10-01/reservationtransactions/id_billingaccount.go index 61464e8781e..dadda8c6ab4 100644 --- a/resource-manager/consumption/2021-10-01/reservationtransactions/id_billingaccount.go +++ b/resource-manager/consumption/2021-10-01/reservationtransactions/id_billingaccount.go @@ -32,11 +32,9 @@ func ParseBillingAccountID(input string) (*BillingAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseBillingAccountIDInsensitively(input string) (*BillingAccountId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *BillingAccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) + } + + return nil +} + // ValidateBillingAccountID checks that 'input' can be parsed as a Billing Account ID func ValidateBillingAccountID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/consumption/2021-10-01/reservationtransactions/id_billingprofile.go b/resource-manager/consumption/2021-10-01/reservationtransactions/id_billingprofile.go index 9f36858e0aa..7ccfc804f72 100644 --- a/resource-manager/consumption/2021-10-01/reservationtransactions/id_billingprofile.go +++ b/resource-manager/consumption/2021-10-01/reservationtransactions/id_billingprofile.go @@ -34,15 +34,9 @@ func ParseBillingProfileID(input string) (*BillingProfileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) - } - - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseBillingProfileIDInsensitively(input string) (*BillingProfileId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + return &id, nil +} + +func (id *BillingProfileId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) } - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if id.BillingProfileId, ok = input.Parsed["billingProfileId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", input) } - return &id, nil + return nil } // ValidateBillingProfileID checks that 'input' can be parsed as a Billing Profile ID diff --git a/resource-manager/consumption/2022-09-01/aggregatedcost/id_providers2billingperiod.go b/resource-manager/consumption/2022-09-01/aggregatedcost/id_providers2billingperiod.go index 644391d80a0..d4d7e7d81ba 100644 --- a/resource-manager/consumption/2022-09-01/aggregatedcost/id_providers2billingperiod.go +++ b/resource-manager/consumption/2022-09-01/aggregatedcost/id_providers2billingperiod.go @@ -34,15 +34,9 @@ func ParseProviders2BillingPeriodID(input string) (*Providers2BillingPeriodId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2BillingPeriodId{} - - if id.ManagementGroupId, ok = parsed.Parsed["managementGroupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managementGroupId", *parsed) - } - - if id.BillingPeriodName, ok = parsed.Parsed["billingPeriodName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviders2BillingPeriodIDInsensitively(input string) (*Providers2Billi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2BillingPeriodId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ManagementGroupId, ok = parsed.Parsed["managementGroupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managementGroupId", *parsed) + return &id, nil +} + +func (id *Providers2BillingPeriodId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ManagementGroupId, ok = input.Parsed["managementGroupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managementGroupId", input) } - if id.BillingPeriodName, ok = parsed.Parsed["billingPeriodName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", *parsed) + if id.BillingPeriodName, ok = input.Parsed["billingPeriodName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", input) } - return &id, nil + return nil } // ValidateProviders2BillingPeriodID checks that 'input' can be parsed as a Providers 2 Billing Period ID diff --git a/resource-manager/consumption/2022-09-01/balances/id_billingaccount.go b/resource-manager/consumption/2022-09-01/balances/id_billingaccount.go index 40d28457b44..dc40b286b60 100644 --- a/resource-manager/consumption/2022-09-01/balances/id_billingaccount.go +++ b/resource-manager/consumption/2022-09-01/balances/id_billingaccount.go @@ -32,11 +32,9 @@ func ParseBillingAccountID(input string) (*BillingAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseBillingAccountIDInsensitively(input string) (*BillingAccountId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *BillingAccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) + } + + return nil +} + // ValidateBillingAccountID checks that 'input' can be parsed as a Billing Account ID func ValidateBillingAccountID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/consumption/2022-09-01/balances/id_billingaccountbillingperiod.go b/resource-manager/consumption/2022-09-01/balances/id_billingaccountbillingperiod.go index 6ef6c417bd9..7a90b562472 100644 --- a/resource-manager/consumption/2022-09-01/balances/id_billingaccountbillingperiod.go +++ b/resource-manager/consumption/2022-09-01/balances/id_billingaccountbillingperiod.go @@ -34,15 +34,9 @@ func ParseBillingAccountBillingPeriodID(input string) (*BillingAccountBillingPer return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountBillingPeriodId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) - } - - if id.BillingPeriodName, ok = parsed.Parsed["billingPeriodName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseBillingAccountBillingPeriodIDInsensitively(input string) (*BillingAcco return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountBillingPeriodId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + return &id, nil +} + +func (id *BillingAccountBillingPeriodId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) } - if id.BillingPeriodName, ok = parsed.Parsed["billingPeriodName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", *parsed) + if id.BillingPeriodName, ok = input.Parsed["billingPeriodName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", input) } - return &id, nil + return nil } // ValidateBillingAccountBillingPeriodID checks that 'input' can be parsed as a Billing Account Billing Period ID diff --git a/resource-manager/consumption/2022-09-01/budgets/id_scopedbudget.go b/resource-manager/consumption/2022-09-01/budgets/id_scopedbudget.go index f5eda7aa882..1084bf0ee86 100644 --- a/resource-manager/consumption/2022-09-01/budgets/id_scopedbudget.go +++ b/resource-manager/consumption/2022-09-01/budgets/id_scopedbudget.go @@ -34,15 +34,9 @@ func ParseScopedBudgetID(input string) (*ScopedBudgetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedBudgetId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.BudgetName, ok = parsed.Parsed["budgetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "budgetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedBudgetIDInsensitively(input string) (*ScopedBudgetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedBudgetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedBudgetId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.BudgetName, ok = parsed.Parsed["budgetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "budgetName", *parsed) + if id.BudgetName, ok = input.Parsed["budgetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "budgetName", input) } - return &id, nil + return nil } // ValidateScopedBudgetID checks that 'input' can be parsed as a Scoped Budget ID diff --git a/resource-manager/consumption/2022-09-01/credits/id_billingprofile.go b/resource-manager/consumption/2022-09-01/credits/id_billingprofile.go index d2f14371ba0..be5cb6e842f 100644 --- a/resource-manager/consumption/2022-09-01/credits/id_billingprofile.go +++ b/resource-manager/consumption/2022-09-01/credits/id_billingprofile.go @@ -34,15 +34,9 @@ func ParseBillingProfileID(input string) (*BillingProfileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) - } - - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseBillingProfileIDInsensitively(input string) (*BillingProfileId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + return &id, nil +} + +func (id *BillingProfileId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) } - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if id.BillingProfileId, ok = input.Parsed["billingProfileId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", input) } - return &id, nil + return nil } // ValidateBillingProfileID checks that 'input' can be parsed as a Billing Profile ID diff --git a/resource-manager/consumption/2022-09-01/events/id_billingaccount.go b/resource-manager/consumption/2022-09-01/events/id_billingaccount.go index ca68a453f33..c985967f3b1 100644 --- a/resource-manager/consumption/2022-09-01/events/id_billingaccount.go +++ b/resource-manager/consumption/2022-09-01/events/id_billingaccount.go @@ -32,11 +32,9 @@ func ParseBillingAccountID(input string) (*BillingAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseBillingAccountIDInsensitively(input string) (*BillingAccountId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *BillingAccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) + } + + return nil +} + // ValidateBillingAccountID checks that 'input' can be parsed as a Billing Account ID func ValidateBillingAccountID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/consumption/2022-09-01/events/id_billingprofile.go b/resource-manager/consumption/2022-09-01/events/id_billingprofile.go index acc36b88681..c1db5f140f1 100644 --- a/resource-manager/consumption/2022-09-01/events/id_billingprofile.go +++ b/resource-manager/consumption/2022-09-01/events/id_billingprofile.go @@ -34,15 +34,9 @@ func ParseBillingProfileID(input string) (*BillingProfileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) - } - - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseBillingProfileIDInsensitively(input string) (*BillingProfileId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + return &id, nil +} + +func (id *BillingProfileId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) } - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if id.BillingProfileId, ok = input.Parsed["billingProfileId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", input) } - return &id, nil + return nil } // ValidateBillingProfileID checks that 'input' can be parsed as a Billing Profile ID diff --git a/resource-manager/consumption/2022-09-01/lots/id_billingaccount.go b/resource-manager/consumption/2022-09-01/lots/id_billingaccount.go index c35f65a268e..a6648255fb0 100644 --- a/resource-manager/consumption/2022-09-01/lots/id_billingaccount.go +++ b/resource-manager/consumption/2022-09-01/lots/id_billingaccount.go @@ -32,11 +32,9 @@ func ParseBillingAccountID(input string) (*BillingAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseBillingAccountIDInsensitively(input string) (*BillingAccountId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *BillingAccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) + } + + return nil +} + // ValidateBillingAccountID checks that 'input' can be parsed as a Billing Account ID func ValidateBillingAccountID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/consumption/2022-09-01/lots/id_billingprofile.go b/resource-manager/consumption/2022-09-01/lots/id_billingprofile.go index 7e03196d19c..cd664210bc0 100644 --- a/resource-manager/consumption/2022-09-01/lots/id_billingprofile.go +++ b/resource-manager/consumption/2022-09-01/lots/id_billingprofile.go @@ -34,15 +34,9 @@ func ParseBillingProfileID(input string) (*BillingProfileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) - } - - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseBillingProfileIDInsensitively(input string) (*BillingProfileId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + return &id, nil +} + +func (id *BillingProfileId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) } - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if id.BillingProfileId, ok = input.Parsed["billingProfileId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", input) } - return &id, nil + return nil } // ValidateBillingProfileID checks that 'input' can be parsed as a Billing Profile ID diff --git a/resource-manager/consumption/2022-09-01/lots/id_customer.go b/resource-manager/consumption/2022-09-01/lots/id_customer.go index 730efbd35f7..85594ff3225 100644 --- a/resource-manager/consumption/2022-09-01/lots/id_customer.go +++ b/resource-manager/consumption/2022-09-01/lots/id_customer.go @@ -34,15 +34,9 @@ func ParseCustomerID(input string) (*CustomerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CustomerId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) - } - - if id.CustomerId, ok = parsed.Parsed["customerId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "customerId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseCustomerIDInsensitively(input string) (*CustomerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CustomerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + return &id, nil +} + +func (id *CustomerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) } - if id.CustomerId, ok = parsed.Parsed["customerId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "customerId", *parsed) + if id.CustomerId, ok = input.Parsed["customerId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "customerId", input) } - return &id, nil + return nil } // ValidateCustomerID checks that 'input' can be parsed as a Customer ID diff --git a/resource-manager/consumption/2022-09-01/pricesheet/id_billingperiod.go b/resource-manager/consumption/2022-09-01/pricesheet/id_billingperiod.go index 3a358d14b68..7670b1c49bb 100644 --- a/resource-manager/consumption/2022-09-01/pricesheet/id_billingperiod.go +++ b/resource-manager/consumption/2022-09-01/pricesheet/id_billingperiod.go @@ -34,15 +34,9 @@ func ParseBillingPeriodID(input string) (*BillingPeriodId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingPeriodId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.BillingPeriodName, ok = parsed.Parsed["billingPeriodName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseBillingPeriodIDInsensitively(input string) (*BillingPeriodId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingPeriodId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *BillingPeriodId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.BillingPeriodName, ok = parsed.Parsed["billingPeriodName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", *parsed) + if id.BillingPeriodName, ok = input.Parsed["billingPeriodName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", input) } - return &id, nil + return nil } // ValidateBillingPeriodID checks that 'input' can be parsed as a Billing Period ID diff --git a/resource-manager/consumption/2022-09-01/reservationdetails/id_reservation.go b/resource-manager/consumption/2022-09-01/reservationdetails/id_reservation.go index 927ca5bab9b..b869dfdda69 100644 --- a/resource-manager/consumption/2022-09-01/reservationdetails/id_reservation.go +++ b/resource-manager/consumption/2022-09-01/reservationdetails/id_reservation.go @@ -34,15 +34,9 @@ func ParseReservationID(input string) (*ReservationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReservationId{} - - if id.ReservationOrderId, ok = parsed.Parsed["reservationOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", *parsed) - } - - if id.ReservationId, ok = parsed.Parsed["reservationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseReservationIDInsensitively(input string) (*ReservationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReservationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ReservationOrderId, ok = parsed.Parsed["reservationOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", *parsed) + return &id, nil +} + +func (id *ReservationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ReservationOrderId, ok = input.Parsed["reservationOrderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", input) } - if id.ReservationId, ok = parsed.Parsed["reservationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationId", *parsed) + if id.ReservationId, ok = input.Parsed["reservationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reservationId", input) } - return &id, nil + return nil } // ValidateReservationID checks that 'input' can be parsed as a Reservation ID diff --git a/resource-manager/consumption/2022-09-01/reservationdetails/id_reservationorder.go b/resource-manager/consumption/2022-09-01/reservationdetails/id_reservationorder.go index 83f55f2e96c..2ba3e139a5c 100644 --- a/resource-manager/consumption/2022-09-01/reservationdetails/id_reservationorder.go +++ b/resource-manager/consumption/2022-09-01/reservationdetails/id_reservationorder.go @@ -32,11 +32,9 @@ func ParseReservationOrderID(input string) (*ReservationOrderId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReservationOrderId{} - - if id.ReservationOrderId, ok = parsed.Parsed["reservationOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseReservationOrderIDInsensitively(input string) (*ReservationOrderId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReservationOrderId{} - - if id.ReservationOrderId, ok = parsed.Parsed["reservationOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *ReservationOrderId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ReservationOrderId, ok = input.Parsed["reservationOrderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", input) + } + + return nil +} + // ValidateReservationOrderID checks that 'input' can be parsed as a Reservation Order ID func ValidateReservationOrderID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/consumption/2022-09-01/reservationsummaries/id_reservation.go b/resource-manager/consumption/2022-09-01/reservationsummaries/id_reservation.go index 2564474b91d..ca004e0ad93 100644 --- a/resource-manager/consumption/2022-09-01/reservationsummaries/id_reservation.go +++ b/resource-manager/consumption/2022-09-01/reservationsummaries/id_reservation.go @@ -34,15 +34,9 @@ func ParseReservationID(input string) (*ReservationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReservationId{} - - if id.ReservationOrderId, ok = parsed.Parsed["reservationOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", *parsed) - } - - if id.ReservationId, ok = parsed.Parsed["reservationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseReservationIDInsensitively(input string) (*ReservationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReservationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ReservationOrderId, ok = parsed.Parsed["reservationOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", *parsed) + return &id, nil +} + +func (id *ReservationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ReservationOrderId, ok = input.Parsed["reservationOrderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", input) } - if id.ReservationId, ok = parsed.Parsed["reservationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationId", *parsed) + if id.ReservationId, ok = input.Parsed["reservationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reservationId", input) } - return &id, nil + return nil } // ValidateReservationID checks that 'input' can be parsed as a Reservation ID diff --git a/resource-manager/consumption/2022-09-01/reservationsummaries/id_reservationorder.go b/resource-manager/consumption/2022-09-01/reservationsummaries/id_reservationorder.go index 58fe3dfbe0c..d07bb3750ef 100644 --- a/resource-manager/consumption/2022-09-01/reservationsummaries/id_reservationorder.go +++ b/resource-manager/consumption/2022-09-01/reservationsummaries/id_reservationorder.go @@ -32,11 +32,9 @@ func ParseReservationOrderID(input string) (*ReservationOrderId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReservationOrderId{} - - if id.ReservationOrderId, ok = parsed.Parsed["reservationOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseReservationOrderIDInsensitively(input string) (*ReservationOrderId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReservationOrderId{} - - if id.ReservationOrderId, ok = parsed.Parsed["reservationOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *ReservationOrderId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ReservationOrderId, ok = input.Parsed["reservationOrderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", input) + } + + return nil +} + // ValidateReservationOrderID checks that 'input' can be parsed as a Reservation Order ID func ValidateReservationOrderID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/consumption/2022-09-01/reservationtransactions/id_billingaccount.go b/resource-manager/consumption/2022-09-01/reservationtransactions/id_billingaccount.go index 61464e8781e..dadda8c6ab4 100644 --- a/resource-manager/consumption/2022-09-01/reservationtransactions/id_billingaccount.go +++ b/resource-manager/consumption/2022-09-01/reservationtransactions/id_billingaccount.go @@ -32,11 +32,9 @@ func ParseBillingAccountID(input string) (*BillingAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseBillingAccountIDInsensitively(input string) (*BillingAccountId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *BillingAccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) + } + + return nil +} + // ValidateBillingAccountID checks that 'input' can be parsed as a Billing Account ID func ValidateBillingAccountID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/consumption/2022-09-01/reservationtransactions/id_billingprofile.go b/resource-manager/consumption/2022-09-01/reservationtransactions/id_billingprofile.go index 9f36858e0aa..7ccfc804f72 100644 --- a/resource-manager/consumption/2022-09-01/reservationtransactions/id_billingprofile.go +++ b/resource-manager/consumption/2022-09-01/reservationtransactions/id_billingprofile.go @@ -34,15 +34,9 @@ func ParseBillingProfileID(input string) (*BillingProfileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) - } - - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseBillingProfileIDInsensitively(input string) (*BillingProfileId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + return &id, nil +} + +func (id *BillingProfileId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) } - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if id.BillingProfileId, ok = input.Parsed["billingProfileId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", input) } - return &id, nil + return nil } // ValidateBillingProfileID checks that 'input' can be parsed as a Billing Profile ID diff --git a/resource-manager/consumption/2023-05-01/aggregatedcost/id_providers2billingperiod.go b/resource-manager/consumption/2023-05-01/aggregatedcost/id_providers2billingperiod.go index 644391d80a0..d4d7e7d81ba 100644 --- a/resource-manager/consumption/2023-05-01/aggregatedcost/id_providers2billingperiod.go +++ b/resource-manager/consumption/2023-05-01/aggregatedcost/id_providers2billingperiod.go @@ -34,15 +34,9 @@ func ParseProviders2BillingPeriodID(input string) (*Providers2BillingPeriodId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2BillingPeriodId{} - - if id.ManagementGroupId, ok = parsed.Parsed["managementGroupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managementGroupId", *parsed) - } - - if id.BillingPeriodName, ok = parsed.Parsed["billingPeriodName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviders2BillingPeriodIDInsensitively(input string) (*Providers2Billi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2BillingPeriodId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ManagementGroupId, ok = parsed.Parsed["managementGroupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managementGroupId", *parsed) + return &id, nil +} + +func (id *Providers2BillingPeriodId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ManagementGroupId, ok = input.Parsed["managementGroupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managementGroupId", input) } - if id.BillingPeriodName, ok = parsed.Parsed["billingPeriodName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", *parsed) + if id.BillingPeriodName, ok = input.Parsed["billingPeriodName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", input) } - return &id, nil + return nil } // ValidateProviders2BillingPeriodID checks that 'input' can be parsed as a Providers 2 Billing Period ID diff --git a/resource-manager/consumption/2023-05-01/balances/id_billingaccount.go b/resource-manager/consumption/2023-05-01/balances/id_billingaccount.go index 40d28457b44..dc40b286b60 100644 --- a/resource-manager/consumption/2023-05-01/balances/id_billingaccount.go +++ b/resource-manager/consumption/2023-05-01/balances/id_billingaccount.go @@ -32,11 +32,9 @@ func ParseBillingAccountID(input string) (*BillingAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseBillingAccountIDInsensitively(input string) (*BillingAccountId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *BillingAccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) + } + + return nil +} + // ValidateBillingAccountID checks that 'input' can be parsed as a Billing Account ID func ValidateBillingAccountID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/consumption/2023-05-01/balances/id_billingaccountbillingperiod.go b/resource-manager/consumption/2023-05-01/balances/id_billingaccountbillingperiod.go index 6ef6c417bd9..7a90b562472 100644 --- a/resource-manager/consumption/2023-05-01/balances/id_billingaccountbillingperiod.go +++ b/resource-manager/consumption/2023-05-01/balances/id_billingaccountbillingperiod.go @@ -34,15 +34,9 @@ func ParseBillingAccountBillingPeriodID(input string) (*BillingAccountBillingPer return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountBillingPeriodId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) - } - - if id.BillingPeriodName, ok = parsed.Parsed["billingPeriodName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseBillingAccountBillingPeriodIDInsensitively(input string) (*BillingAcco return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountBillingPeriodId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + return &id, nil +} + +func (id *BillingAccountBillingPeriodId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) } - if id.BillingPeriodName, ok = parsed.Parsed["billingPeriodName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", *parsed) + if id.BillingPeriodName, ok = input.Parsed["billingPeriodName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", input) } - return &id, nil + return nil } // ValidateBillingAccountBillingPeriodID checks that 'input' can be parsed as a Billing Account Billing Period ID diff --git a/resource-manager/consumption/2023-05-01/budgets/id_scopedbudget.go b/resource-manager/consumption/2023-05-01/budgets/id_scopedbudget.go index f5eda7aa882..1084bf0ee86 100644 --- a/resource-manager/consumption/2023-05-01/budgets/id_scopedbudget.go +++ b/resource-manager/consumption/2023-05-01/budgets/id_scopedbudget.go @@ -34,15 +34,9 @@ func ParseScopedBudgetID(input string) (*ScopedBudgetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedBudgetId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.BudgetName, ok = parsed.Parsed["budgetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "budgetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedBudgetIDInsensitively(input string) (*ScopedBudgetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedBudgetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedBudgetId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.BudgetName, ok = parsed.Parsed["budgetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "budgetName", *parsed) + if id.BudgetName, ok = input.Parsed["budgetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "budgetName", input) } - return &id, nil + return nil } // ValidateScopedBudgetID checks that 'input' can be parsed as a Scoped Budget ID diff --git a/resource-manager/consumption/2023-05-01/credits/id_billingprofile.go b/resource-manager/consumption/2023-05-01/credits/id_billingprofile.go index d2f14371ba0..be5cb6e842f 100644 --- a/resource-manager/consumption/2023-05-01/credits/id_billingprofile.go +++ b/resource-manager/consumption/2023-05-01/credits/id_billingprofile.go @@ -34,15 +34,9 @@ func ParseBillingProfileID(input string) (*BillingProfileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) - } - - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseBillingProfileIDInsensitively(input string) (*BillingProfileId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + return &id, nil +} + +func (id *BillingProfileId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) } - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if id.BillingProfileId, ok = input.Parsed["billingProfileId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", input) } - return &id, nil + return nil } // ValidateBillingProfileID checks that 'input' can be parsed as a Billing Profile ID diff --git a/resource-manager/consumption/2023-05-01/events/id_billingaccount.go b/resource-manager/consumption/2023-05-01/events/id_billingaccount.go index ca68a453f33..c985967f3b1 100644 --- a/resource-manager/consumption/2023-05-01/events/id_billingaccount.go +++ b/resource-manager/consumption/2023-05-01/events/id_billingaccount.go @@ -32,11 +32,9 @@ func ParseBillingAccountID(input string) (*BillingAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseBillingAccountIDInsensitively(input string) (*BillingAccountId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *BillingAccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) + } + + return nil +} + // ValidateBillingAccountID checks that 'input' can be parsed as a Billing Account ID func ValidateBillingAccountID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/consumption/2023-05-01/events/id_billingprofile.go b/resource-manager/consumption/2023-05-01/events/id_billingprofile.go index acc36b88681..c1db5f140f1 100644 --- a/resource-manager/consumption/2023-05-01/events/id_billingprofile.go +++ b/resource-manager/consumption/2023-05-01/events/id_billingprofile.go @@ -34,15 +34,9 @@ func ParseBillingProfileID(input string) (*BillingProfileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) - } - - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseBillingProfileIDInsensitively(input string) (*BillingProfileId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + return &id, nil +} + +func (id *BillingProfileId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) } - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if id.BillingProfileId, ok = input.Parsed["billingProfileId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", input) } - return &id, nil + return nil } // ValidateBillingProfileID checks that 'input' can be parsed as a Billing Profile ID diff --git a/resource-manager/consumption/2023-05-01/lots/id_billingaccount.go b/resource-manager/consumption/2023-05-01/lots/id_billingaccount.go index c35f65a268e..a6648255fb0 100644 --- a/resource-manager/consumption/2023-05-01/lots/id_billingaccount.go +++ b/resource-manager/consumption/2023-05-01/lots/id_billingaccount.go @@ -32,11 +32,9 @@ func ParseBillingAccountID(input string) (*BillingAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseBillingAccountIDInsensitively(input string) (*BillingAccountId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *BillingAccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) + } + + return nil +} + // ValidateBillingAccountID checks that 'input' can be parsed as a Billing Account ID func ValidateBillingAccountID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/consumption/2023-05-01/lots/id_billingprofile.go b/resource-manager/consumption/2023-05-01/lots/id_billingprofile.go index 7e03196d19c..cd664210bc0 100644 --- a/resource-manager/consumption/2023-05-01/lots/id_billingprofile.go +++ b/resource-manager/consumption/2023-05-01/lots/id_billingprofile.go @@ -34,15 +34,9 @@ func ParseBillingProfileID(input string) (*BillingProfileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) - } - - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseBillingProfileIDInsensitively(input string) (*BillingProfileId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + return &id, nil +} + +func (id *BillingProfileId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) } - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if id.BillingProfileId, ok = input.Parsed["billingProfileId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", input) } - return &id, nil + return nil } // ValidateBillingProfileID checks that 'input' can be parsed as a Billing Profile ID diff --git a/resource-manager/consumption/2023-05-01/lots/id_customer.go b/resource-manager/consumption/2023-05-01/lots/id_customer.go index 730efbd35f7..85594ff3225 100644 --- a/resource-manager/consumption/2023-05-01/lots/id_customer.go +++ b/resource-manager/consumption/2023-05-01/lots/id_customer.go @@ -34,15 +34,9 @@ func ParseCustomerID(input string) (*CustomerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CustomerId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) - } - - if id.CustomerId, ok = parsed.Parsed["customerId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "customerId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseCustomerIDInsensitively(input string) (*CustomerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CustomerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + return &id, nil +} + +func (id *CustomerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) } - if id.CustomerId, ok = parsed.Parsed["customerId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "customerId", *parsed) + if id.CustomerId, ok = input.Parsed["customerId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "customerId", input) } - return &id, nil + return nil } // ValidateCustomerID checks that 'input' can be parsed as a Customer ID diff --git a/resource-manager/consumption/2023-05-01/pricesheet/id_billingaccountbillingperiod.go b/resource-manager/consumption/2023-05-01/pricesheet/id_billingaccountbillingperiod.go index cc48a48322f..23129ff3b9d 100644 --- a/resource-manager/consumption/2023-05-01/pricesheet/id_billingaccountbillingperiod.go +++ b/resource-manager/consumption/2023-05-01/pricesheet/id_billingaccountbillingperiod.go @@ -34,15 +34,9 @@ func ParseBillingAccountBillingPeriodID(input string) (*BillingAccountBillingPer return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountBillingPeriodId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) - } - - if id.BillingPeriodName, ok = parsed.Parsed["billingPeriodName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseBillingAccountBillingPeriodIDInsensitively(input string) (*BillingAcco return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountBillingPeriodId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + return &id, nil +} + +func (id *BillingAccountBillingPeriodId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) } - if id.BillingPeriodName, ok = parsed.Parsed["billingPeriodName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", *parsed) + if id.BillingPeriodName, ok = input.Parsed["billingPeriodName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", input) } - return &id, nil + return nil } // ValidateBillingAccountBillingPeriodID checks that 'input' can be parsed as a Billing Account Billing Period ID diff --git a/resource-manager/consumption/2023-05-01/pricesheet/id_billingperiod.go b/resource-manager/consumption/2023-05-01/pricesheet/id_billingperiod.go index 3a358d14b68..7670b1c49bb 100644 --- a/resource-manager/consumption/2023-05-01/pricesheet/id_billingperiod.go +++ b/resource-manager/consumption/2023-05-01/pricesheet/id_billingperiod.go @@ -34,15 +34,9 @@ func ParseBillingPeriodID(input string) (*BillingPeriodId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingPeriodId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.BillingPeriodName, ok = parsed.Parsed["billingPeriodName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseBillingPeriodIDInsensitively(input string) (*BillingPeriodId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingPeriodId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *BillingPeriodId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.BillingPeriodName, ok = parsed.Parsed["billingPeriodName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", *parsed) + if id.BillingPeriodName, ok = input.Parsed["billingPeriodName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", input) } - return &id, nil + return nil } // ValidateBillingPeriodID checks that 'input' can be parsed as a Billing Period ID diff --git a/resource-manager/consumption/2023-05-01/reservationdetails/id_reservation.go b/resource-manager/consumption/2023-05-01/reservationdetails/id_reservation.go index 927ca5bab9b..b869dfdda69 100644 --- a/resource-manager/consumption/2023-05-01/reservationdetails/id_reservation.go +++ b/resource-manager/consumption/2023-05-01/reservationdetails/id_reservation.go @@ -34,15 +34,9 @@ func ParseReservationID(input string) (*ReservationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReservationId{} - - if id.ReservationOrderId, ok = parsed.Parsed["reservationOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", *parsed) - } - - if id.ReservationId, ok = parsed.Parsed["reservationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseReservationIDInsensitively(input string) (*ReservationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReservationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ReservationOrderId, ok = parsed.Parsed["reservationOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", *parsed) + return &id, nil +} + +func (id *ReservationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ReservationOrderId, ok = input.Parsed["reservationOrderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", input) } - if id.ReservationId, ok = parsed.Parsed["reservationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationId", *parsed) + if id.ReservationId, ok = input.Parsed["reservationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reservationId", input) } - return &id, nil + return nil } // ValidateReservationID checks that 'input' can be parsed as a Reservation ID diff --git a/resource-manager/consumption/2023-05-01/reservationdetails/id_reservationorder.go b/resource-manager/consumption/2023-05-01/reservationdetails/id_reservationorder.go index 83f55f2e96c..2ba3e139a5c 100644 --- a/resource-manager/consumption/2023-05-01/reservationdetails/id_reservationorder.go +++ b/resource-manager/consumption/2023-05-01/reservationdetails/id_reservationorder.go @@ -32,11 +32,9 @@ func ParseReservationOrderID(input string) (*ReservationOrderId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReservationOrderId{} - - if id.ReservationOrderId, ok = parsed.Parsed["reservationOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseReservationOrderIDInsensitively(input string) (*ReservationOrderId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReservationOrderId{} - - if id.ReservationOrderId, ok = parsed.Parsed["reservationOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *ReservationOrderId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ReservationOrderId, ok = input.Parsed["reservationOrderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", input) + } + + return nil +} + // ValidateReservationOrderID checks that 'input' can be parsed as a Reservation Order ID func ValidateReservationOrderID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/consumption/2023-05-01/reservationsummaries/id_reservation.go b/resource-manager/consumption/2023-05-01/reservationsummaries/id_reservation.go index 2564474b91d..ca004e0ad93 100644 --- a/resource-manager/consumption/2023-05-01/reservationsummaries/id_reservation.go +++ b/resource-manager/consumption/2023-05-01/reservationsummaries/id_reservation.go @@ -34,15 +34,9 @@ func ParseReservationID(input string) (*ReservationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReservationId{} - - if id.ReservationOrderId, ok = parsed.Parsed["reservationOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", *parsed) - } - - if id.ReservationId, ok = parsed.Parsed["reservationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseReservationIDInsensitively(input string) (*ReservationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReservationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ReservationOrderId, ok = parsed.Parsed["reservationOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", *parsed) + return &id, nil +} + +func (id *ReservationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ReservationOrderId, ok = input.Parsed["reservationOrderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", input) } - if id.ReservationId, ok = parsed.Parsed["reservationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationId", *parsed) + if id.ReservationId, ok = input.Parsed["reservationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reservationId", input) } - return &id, nil + return nil } // ValidateReservationID checks that 'input' can be parsed as a Reservation ID diff --git a/resource-manager/consumption/2023-05-01/reservationsummaries/id_reservationorder.go b/resource-manager/consumption/2023-05-01/reservationsummaries/id_reservationorder.go index 58fe3dfbe0c..d07bb3750ef 100644 --- a/resource-manager/consumption/2023-05-01/reservationsummaries/id_reservationorder.go +++ b/resource-manager/consumption/2023-05-01/reservationsummaries/id_reservationorder.go @@ -32,11 +32,9 @@ func ParseReservationOrderID(input string) (*ReservationOrderId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReservationOrderId{} - - if id.ReservationOrderId, ok = parsed.Parsed["reservationOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseReservationOrderIDInsensitively(input string) (*ReservationOrderId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReservationOrderId{} - - if id.ReservationOrderId, ok = parsed.Parsed["reservationOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *ReservationOrderId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ReservationOrderId, ok = input.Parsed["reservationOrderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", input) + } + + return nil +} + // ValidateReservationOrderID checks that 'input' can be parsed as a Reservation Order ID func ValidateReservationOrderID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/consumption/2023-05-01/reservationtransactions/id_billingaccount.go b/resource-manager/consumption/2023-05-01/reservationtransactions/id_billingaccount.go index 61464e8781e..dadda8c6ab4 100644 --- a/resource-manager/consumption/2023-05-01/reservationtransactions/id_billingaccount.go +++ b/resource-manager/consumption/2023-05-01/reservationtransactions/id_billingaccount.go @@ -32,11 +32,9 @@ func ParseBillingAccountID(input string) (*BillingAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseBillingAccountIDInsensitively(input string) (*BillingAccountId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *BillingAccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) + } + + return nil +} + // ValidateBillingAccountID checks that 'input' can be parsed as a Billing Account ID func ValidateBillingAccountID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/consumption/2023-05-01/reservationtransactions/id_billingprofile.go b/resource-manager/consumption/2023-05-01/reservationtransactions/id_billingprofile.go index 9f36858e0aa..7ccfc804f72 100644 --- a/resource-manager/consumption/2023-05-01/reservationtransactions/id_billingprofile.go +++ b/resource-manager/consumption/2023-05-01/reservationtransactions/id_billingprofile.go @@ -34,15 +34,9 @@ func ParseBillingProfileID(input string) (*BillingProfileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) - } - - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseBillingProfileIDInsensitively(input string) (*BillingProfileId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + return &id, nil +} + +func (id *BillingProfileId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) } - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if id.BillingProfileId, ok = input.Parsed["billingProfileId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", input) } - return &id, nil + return nil } // ValidateBillingProfileID checks that 'input' can be parsed as a Billing Profile ID diff --git a/resource-manager/consumption/2023-11-01/aggregatedcost/id_providers2billingperiod.go b/resource-manager/consumption/2023-11-01/aggregatedcost/id_providers2billingperiod.go index 644391d80a0..d4d7e7d81ba 100644 --- a/resource-manager/consumption/2023-11-01/aggregatedcost/id_providers2billingperiod.go +++ b/resource-manager/consumption/2023-11-01/aggregatedcost/id_providers2billingperiod.go @@ -34,15 +34,9 @@ func ParseProviders2BillingPeriodID(input string) (*Providers2BillingPeriodId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2BillingPeriodId{} - - if id.ManagementGroupId, ok = parsed.Parsed["managementGroupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managementGroupId", *parsed) - } - - if id.BillingPeriodName, ok = parsed.Parsed["billingPeriodName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviders2BillingPeriodIDInsensitively(input string) (*Providers2Billi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2BillingPeriodId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ManagementGroupId, ok = parsed.Parsed["managementGroupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managementGroupId", *parsed) + return &id, nil +} + +func (id *Providers2BillingPeriodId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ManagementGroupId, ok = input.Parsed["managementGroupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managementGroupId", input) } - if id.BillingPeriodName, ok = parsed.Parsed["billingPeriodName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", *parsed) + if id.BillingPeriodName, ok = input.Parsed["billingPeriodName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", input) } - return &id, nil + return nil } // ValidateProviders2BillingPeriodID checks that 'input' can be parsed as a Providers 2 Billing Period ID diff --git a/resource-manager/consumption/2023-11-01/balances/id_billingaccount.go b/resource-manager/consumption/2023-11-01/balances/id_billingaccount.go index 40d28457b44..dc40b286b60 100644 --- a/resource-manager/consumption/2023-11-01/balances/id_billingaccount.go +++ b/resource-manager/consumption/2023-11-01/balances/id_billingaccount.go @@ -32,11 +32,9 @@ func ParseBillingAccountID(input string) (*BillingAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseBillingAccountIDInsensitively(input string) (*BillingAccountId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *BillingAccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) + } + + return nil +} + // ValidateBillingAccountID checks that 'input' can be parsed as a Billing Account ID func ValidateBillingAccountID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/consumption/2023-11-01/balances/id_billingaccountbillingperiod.go b/resource-manager/consumption/2023-11-01/balances/id_billingaccountbillingperiod.go index 6ef6c417bd9..7a90b562472 100644 --- a/resource-manager/consumption/2023-11-01/balances/id_billingaccountbillingperiod.go +++ b/resource-manager/consumption/2023-11-01/balances/id_billingaccountbillingperiod.go @@ -34,15 +34,9 @@ func ParseBillingAccountBillingPeriodID(input string) (*BillingAccountBillingPer return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountBillingPeriodId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) - } - - if id.BillingPeriodName, ok = parsed.Parsed["billingPeriodName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseBillingAccountBillingPeriodIDInsensitively(input string) (*BillingAcco return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountBillingPeriodId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + return &id, nil +} + +func (id *BillingAccountBillingPeriodId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) } - if id.BillingPeriodName, ok = parsed.Parsed["billingPeriodName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", *parsed) + if id.BillingPeriodName, ok = input.Parsed["billingPeriodName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", input) } - return &id, nil + return nil } // ValidateBillingAccountBillingPeriodID checks that 'input' can be parsed as a Billing Account Billing Period ID diff --git a/resource-manager/consumption/2023-11-01/budgets/id_scopedbudget.go b/resource-manager/consumption/2023-11-01/budgets/id_scopedbudget.go index f5eda7aa882..1084bf0ee86 100644 --- a/resource-manager/consumption/2023-11-01/budgets/id_scopedbudget.go +++ b/resource-manager/consumption/2023-11-01/budgets/id_scopedbudget.go @@ -34,15 +34,9 @@ func ParseScopedBudgetID(input string) (*ScopedBudgetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedBudgetId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.BudgetName, ok = parsed.Parsed["budgetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "budgetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedBudgetIDInsensitively(input string) (*ScopedBudgetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedBudgetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedBudgetId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.BudgetName, ok = parsed.Parsed["budgetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "budgetName", *parsed) + if id.BudgetName, ok = input.Parsed["budgetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "budgetName", input) } - return &id, nil + return nil } // ValidateScopedBudgetID checks that 'input' can be parsed as a Scoped Budget ID diff --git a/resource-manager/consumption/2023-11-01/credits/id_billingprofile.go b/resource-manager/consumption/2023-11-01/credits/id_billingprofile.go index d2f14371ba0..be5cb6e842f 100644 --- a/resource-manager/consumption/2023-11-01/credits/id_billingprofile.go +++ b/resource-manager/consumption/2023-11-01/credits/id_billingprofile.go @@ -34,15 +34,9 @@ func ParseBillingProfileID(input string) (*BillingProfileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) - } - - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseBillingProfileIDInsensitively(input string) (*BillingProfileId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + return &id, nil +} + +func (id *BillingProfileId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) } - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if id.BillingProfileId, ok = input.Parsed["billingProfileId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", input) } - return &id, nil + return nil } // ValidateBillingProfileID checks that 'input' can be parsed as a Billing Profile ID diff --git a/resource-manager/consumption/2023-11-01/events/id_billingaccount.go b/resource-manager/consumption/2023-11-01/events/id_billingaccount.go index ca68a453f33..c985967f3b1 100644 --- a/resource-manager/consumption/2023-11-01/events/id_billingaccount.go +++ b/resource-manager/consumption/2023-11-01/events/id_billingaccount.go @@ -32,11 +32,9 @@ func ParseBillingAccountID(input string) (*BillingAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseBillingAccountIDInsensitively(input string) (*BillingAccountId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *BillingAccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) + } + + return nil +} + // ValidateBillingAccountID checks that 'input' can be parsed as a Billing Account ID func ValidateBillingAccountID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/consumption/2023-11-01/events/id_billingprofile.go b/resource-manager/consumption/2023-11-01/events/id_billingprofile.go index acc36b88681..c1db5f140f1 100644 --- a/resource-manager/consumption/2023-11-01/events/id_billingprofile.go +++ b/resource-manager/consumption/2023-11-01/events/id_billingprofile.go @@ -34,15 +34,9 @@ func ParseBillingProfileID(input string) (*BillingProfileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) - } - - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseBillingProfileIDInsensitively(input string) (*BillingProfileId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + return &id, nil +} + +func (id *BillingProfileId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) } - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if id.BillingProfileId, ok = input.Parsed["billingProfileId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", input) } - return &id, nil + return nil } // ValidateBillingProfileID checks that 'input' can be parsed as a Billing Profile ID diff --git a/resource-manager/consumption/2023-11-01/lots/id_billingaccount.go b/resource-manager/consumption/2023-11-01/lots/id_billingaccount.go index c35f65a268e..a6648255fb0 100644 --- a/resource-manager/consumption/2023-11-01/lots/id_billingaccount.go +++ b/resource-manager/consumption/2023-11-01/lots/id_billingaccount.go @@ -32,11 +32,9 @@ func ParseBillingAccountID(input string) (*BillingAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseBillingAccountIDInsensitively(input string) (*BillingAccountId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *BillingAccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) + } + + return nil +} + // ValidateBillingAccountID checks that 'input' can be parsed as a Billing Account ID func ValidateBillingAccountID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/consumption/2023-11-01/lots/id_billingprofile.go b/resource-manager/consumption/2023-11-01/lots/id_billingprofile.go index 7e03196d19c..cd664210bc0 100644 --- a/resource-manager/consumption/2023-11-01/lots/id_billingprofile.go +++ b/resource-manager/consumption/2023-11-01/lots/id_billingprofile.go @@ -34,15 +34,9 @@ func ParseBillingProfileID(input string) (*BillingProfileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) - } - - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseBillingProfileIDInsensitively(input string) (*BillingProfileId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + return &id, nil +} + +func (id *BillingProfileId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) } - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if id.BillingProfileId, ok = input.Parsed["billingProfileId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", input) } - return &id, nil + return nil } // ValidateBillingProfileID checks that 'input' can be parsed as a Billing Profile ID diff --git a/resource-manager/consumption/2023-11-01/lots/id_customer.go b/resource-manager/consumption/2023-11-01/lots/id_customer.go index 730efbd35f7..85594ff3225 100644 --- a/resource-manager/consumption/2023-11-01/lots/id_customer.go +++ b/resource-manager/consumption/2023-11-01/lots/id_customer.go @@ -34,15 +34,9 @@ func ParseCustomerID(input string) (*CustomerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CustomerId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) - } - - if id.CustomerId, ok = parsed.Parsed["customerId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "customerId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseCustomerIDInsensitively(input string) (*CustomerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CustomerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + return &id, nil +} + +func (id *CustomerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) } - if id.CustomerId, ok = parsed.Parsed["customerId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "customerId", *parsed) + if id.CustomerId, ok = input.Parsed["customerId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "customerId", input) } - return &id, nil + return nil } // ValidateCustomerID checks that 'input' can be parsed as a Customer ID diff --git a/resource-manager/consumption/2023-11-01/pricesheet/id_billingaccountbillingperiod.go b/resource-manager/consumption/2023-11-01/pricesheet/id_billingaccountbillingperiod.go index cc48a48322f..23129ff3b9d 100644 --- a/resource-manager/consumption/2023-11-01/pricesheet/id_billingaccountbillingperiod.go +++ b/resource-manager/consumption/2023-11-01/pricesheet/id_billingaccountbillingperiod.go @@ -34,15 +34,9 @@ func ParseBillingAccountBillingPeriodID(input string) (*BillingAccountBillingPer return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountBillingPeriodId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) - } - - if id.BillingPeriodName, ok = parsed.Parsed["billingPeriodName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseBillingAccountBillingPeriodIDInsensitively(input string) (*BillingAcco return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountBillingPeriodId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + return &id, nil +} + +func (id *BillingAccountBillingPeriodId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) } - if id.BillingPeriodName, ok = parsed.Parsed["billingPeriodName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", *parsed) + if id.BillingPeriodName, ok = input.Parsed["billingPeriodName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", input) } - return &id, nil + return nil } // ValidateBillingAccountBillingPeriodID checks that 'input' can be parsed as a Billing Account Billing Period ID diff --git a/resource-manager/consumption/2023-11-01/pricesheet/id_billingperiod.go b/resource-manager/consumption/2023-11-01/pricesheet/id_billingperiod.go index 3a358d14b68..7670b1c49bb 100644 --- a/resource-manager/consumption/2023-11-01/pricesheet/id_billingperiod.go +++ b/resource-manager/consumption/2023-11-01/pricesheet/id_billingperiod.go @@ -34,15 +34,9 @@ func ParseBillingPeriodID(input string) (*BillingPeriodId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingPeriodId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.BillingPeriodName, ok = parsed.Parsed["billingPeriodName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseBillingPeriodIDInsensitively(input string) (*BillingPeriodId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingPeriodId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *BillingPeriodId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.BillingPeriodName, ok = parsed.Parsed["billingPeriodName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", *parsed) + if id.BillingPeriodName, ok = input.Parsed["billingPeriodName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingPeriodName", input) } - return &id, nil + return nil } // ValidateBillingPeriodID checks that 'input' can be parsed as a Billing Period ID diff --git a/resource-manager/consumption/2023-11-01/reservationdetails/id_reservation.go b/resource-manager/consumption/2023-11-01/reservationdetails/id_reservation.go index 927ca5bab9b..b869dfdda69 100644 --- a/resource-manager/consumption/2023-11-01/reservationdetails/id_reservation.go +++ b/resource-manager/consumption/2023-11-01/reservationdetails/id_reservation.go @@ -34,15 +34,9 @@ func ParseReservationID(input string) (*ReservationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReservationId{} - - if id.ReservationOrderId, ok = parsed.Parsed["reservationOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", *parsed) - } - - if id.ReservationId, ok = parsed.Parsed["reservationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseReservationIDInsensitively(input string) (*ReservationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReservationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ReservationOrderId, ok = parsed.Parsed["reservationOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", *parsed) + return &id, nil +} + +func (id *ReservationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ReservationOrderId, ok = input.Parsed["reservationOrderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", input) } - if id.ReservationId, ok = parsed.Parsed["reservationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationId", *parsed) + if id.ReservationId, ok = input.Parsed["reservationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reservationId", input) } - return &id, nil + return nil } // ValidateReservationID checks that 'input' can be parsed as a Reservation ID diff --git a/resource-manager/consumption/2023-11-01/reservationdetails/id_reservationorder.go b/resource-manager/consumption/2023-11-01/reservationdetails/id_reservationorder.go index 83f55f2e96c..2ba3e139a5c 100644 --- a/resource-manager/consumption/2023-11-01/reservationdetails/id_reservationorder.go +++ b/resource-manager/consumption/2023-11-01/reservationdetails/id_reservationorder.go @@ -32,11 +32,9 @@ func ParseReservationOrderID(input string) (*ReservationOrderId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReservationOrderId{} - - if id.ReservationOrderId, ok = parsed.Parsed["reservationOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseReservationOrderIDInsensitively(input string) (*ReservationOrderId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReservationOrderId{} - - if id.ReservationOrderId, ok = parsed.Parsed["reservationOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *ReservationOrderId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ReservationOrderId, ok = input.Parsed["reservationOrderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", input) + } + + return nil +} + // ValidateReservationOrderID checks that 'input' can be parsed as a Reservation Order ID func ValidateReservationOrderID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/consumption/2023-11-01/reservationsummaries/id_reservation.go b/resource-manager/consumption/2023-11-01/reservationsummaries/id_reservation.go index 2564474b91d..ca004e0ad93 100644 --- a/resource-manager/consumption/2023-11-01/reservationsummaries/id_reservation.go +++ b/resource-manager/consumption/2023-11-01/reservationsummaries/id_reservation.go @@ -34,15 +34,9 @@ func ParseReservationID(input string) (*ReservationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReservationId{} - - if id.ReservationOrderId, ok = parsed.Parsed["reservationOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", *parsed) - } - - if id.ReservationId, ok = parsed.Parsed["reservationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseReservationIDInsensitively(input string) (*ReservationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReservationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ReservationOrderId, ok = parsed.Parsed["reservationOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", *parsed) + return &id, nil +} + +func (id *ReservationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ReservationOrderId, ok = input.Parsed["reservationOrderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", input) } - if id.ReservationId, ok = parsed.Parsed["reservationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationId", *parsed) + if id.ReservationId, ok = input.Parsed["reservationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reservationId", input) } - return &id, nil + return nil } // ValidateReservationID checks that 'input' can be parsed as a Reservation ID diff --git a/resource-manager/consumption/2023-11-01/reservationsummaries/id_reservationorder.go b/resource-manager/consumption/2023-11-01/reservationsummaries/id_reservationorder.go index 58fe3dfbe0c..d07bb3750ef 100644 --- a/resource-manager/consumption/2023-11-01/reservationsummaries/id_reservationorder.go +++ b/resource-manager/consumption/2023-11-01/reservationsummaries/id_reservationorder.go @@ -32,11 +32,9 @@ func ParseReservationOrderID(input string) (*ReservationOrderId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReservationOrderId{} - - if id.ReservationOrderId, ok = parsed.Parsed["reservationOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseReservationOrderIDInsensitively(input string) (*ReservationOrderId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReservationOrderId{} - - if id.ReservationOrderId, ok = parsed.Parsed["reservationOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *ReservationOrderId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ReservationOrderId, ok = input.Parsed["reservationOrderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", input) + } + + return nil +} + // ValidateReservationOrderID checks that 'input' can be parsed as a Reservation Order ID func ValidateReservationOrderID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/consumption/2023-11-01/reservationtransactions/id_billingaccount.go b/resource-manager/consumption/2023-11-01/reservationtransactions/id_billingaccount.go index 61464e8781e..dadda8c6ab4 100644 --- a/resource-manager/consumption/2023-11-01/reservationtransactions/id_billingaccount.go +++ b/resource-manager/consumption/2023-11-01/reservationtransactions/id_billingaccount.go @@ -32,11 +32,9 @@ func ParseBillingAccountID(input string) (*BillingAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseBillingAccountIDInsensitively(input string) (*BillingAccountId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *BillingAccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) + } + + return nil +} + // ValidateBillingAccountID checks that 'input' can be parsed as a Billing Account ID func ValidateBillingAccountID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/consumption/2023-11-01/reservationtransactions/id_billingprofile.go b/resource-manager/consumption/2023-11-01/reservationtransactions/id_billingprofile.go index 9f36858e0aa..7ccfc804f72 100644 --- a/resource-manager/consumption/2023-11-01/reservationtransactions/id_billingprofile.go +++ b/resource-manager/consumption/2023-11-01/reservationtransactions/id_billingprofile.go @@ -34,15 +34,9 @@ func ParseBillingProfileID(input string) (*BillingProfileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) - } - - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseBillingProfileIDInsensitively(input string) (*BillingProfileId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + return &id, nil +} + +func (id *BillingProfileId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) } - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if id.BillingProfileId, ok = input.Parsed["billingProfileId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", input) } - return &id, nil + return nil } // ValidateBillingProfileID checks that 'input' can be parsed as a Billing Profile ID diff --git a/resource-manager/containerapps/2022-03-01/certificates/id_certificate.go b/resource-manager/containerapps/2022-03-01/certificates/id_certificate.go index fd232b2dd05..21b3813873f 100644 --- a/resource-manager/containerapps/2022-03-01/certificates/id_certificate.go +++ b/resource-manager/containerapps/2022-03-01/certificates/id_certificate.go @@ -38,23 +38,9 @@ func ParseCertificateID(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} - - 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.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) - } - - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCertificateIDInsensitively(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if id.ManagedEnvironmentName, ok = input.Parsed["managedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", input) } - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if id.CertificateName, ok = input.Parsed["certificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateName", input) } - return &id, nil + return nil } // ValidateCertificateID checks that 'input' can be parsed as a Certificate ID diff --git a/resource-manager/containerapps/2022-03-01/certificates/id_managedenvironment.go b/resource-manager/containerapps/2022-03-01/certificates/id_managedenvironment.go index 5301e3cbf40..dce7709f9a5 100644 --- a/resource-manager/containerapps/2022-03-01/certificates/id_managedenvironment.go +++ b/resource-manager/containerapps/2022-03-01/certificates/id_managedenvironment.go @@ -36,19 +36,9 @@ func ParseManagedEnvironmentID(input string) (*ManagedEnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedEnvironmentId{} - - 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.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagedEnvironmentIDInsensitively(input string) (*ManagedEnvironmentId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedEnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagedEnvironmentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if id.ManagedEnvironmentName, ok = input.Parsed["managedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", input) } - return &id, nil + return nil } // ValidateManagedEnvironmentID checks that 'input' can be parsed as a Managed Environment ID diff --git a/resource-manager/containerapps/2022-03-01/containerapps/id_containerapp.go b/resource-manager/containerapps/2022-03-01/containerapps/id_containerapp.go index bec76c9d8cd..b5cb92a4826 100644 --- a/resource-manager/containerapps/2022-03-01/containerapps/id_containerapp.go +++ b/resource-manager/containerapps/2022-03-01/containerapps/id_containerapp.go @@ -36,19 +36,9 @@ func ParseContainerAppID(input string) (*ContainerAppId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerAppId{} - - 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.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseContainerAppIDInsensitively(input string) (*ContainerAppId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerAppId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ContainerAppId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if id.ContainerAppName, ok = input.Parsed["containerAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", input) } - return &id, nil + return nil } // ValidateContainerAppID checks that 'input' can be parsed as a Container App ID diff --git a/resource-manager/containerapps/2022-03-01/containerappsauthconfigs/id_authconfig.go b/resource-manager/containerapps/2022-03-01/containerappsauthconfigs/id_authconfig.go index 29de8fd3278..b4b6adb350c 100644 --- a/resource-manager/containerapps/2022-03-01/containerappsauthconfigs/id_authconfig.go +++ b/resource-manager/containerapps/2022-03-01/containerappsauthconfigs/id_authconfig.go @@ -38,23 +38,9 @@ func ParseAuthConfigID(input string) (*AuthConfigId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthConfigId{} - - 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.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) - } - - if id.AuthConfigName, ok = parsed.Parsed["authConfigName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authConfigName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAuthConfigIDInsensitively(input string) (*AuthConfigId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthConfigId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AuthConfigId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if id.ContainerAppName, ok = input.Parsed["containerAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", input) } - if id.AuthConfigName, ok = parsed.Parsed["authConfigName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authConfigName", *parsed) + if id.AuthConfigName, ok = input.Parsed["authConfigName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authConfigName", input) } - return &id, nil + return nil } // ValidateAuthConfigID checks that 'input' can be parsed as a Auth Config ID diff --git a/resource-manager/containerapps/2022-03-01/containerappsauthconfigs/id_containerapp.go b/resource-manager/containerapps/2022-03-01/containerappsauthconfigs/id_containerapp.go index ebac43ec5e7..fc569300b37 100644 --- a/resource-manager/containerapps/2022-03-01/containerappsauthconfigs/id_containerapp.go +++ b/resource-manager/containerapps/2022-03-01/containerappsauthconfigs/id_containerapp.go @@ -36,19 +36,9 @@ func ParseContainerAppID(input string) (*ContainerAppId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerAppId{} - - 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.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseContainerAppIDInsensitively(input string) (*ContainerAppId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerAppId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ContainerAppId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if id.ContainerAppName, ok = input.Parsed["containerAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", input) } - return &id, nil + return nil } // ValidateContainerAppID checks that 'input' can be parsed as a Container App ID diff --git a/resource-manager/containerapps/2022-03-01/containerappsrevisionreplicas/id_replica.go b/resource-manager/containerapps/2022-03-01/containerappsrevisionreplicas/id_replica.go index ed6455be6dd..9afa046bdf6 100644 --- a/resource-manager/containerapps/2022-03-01/containerappsrevisionreplicas/id_replica.go +++ b/resource-manager/containerapps/2022-03-01/containerappsrevisionreplicas/id_replica.go @@ -40,27 +40,9 @@ func ParseReplicaID(input string) (*ReplicaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicaId{} - - 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.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) - } - - if id.RevisionName, ok = parsed.Parsed["revisionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "revisionName", *parsed) - } - - if id.ReplicaName, ok = parsed.Parsed["replicaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicaName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicaIDInsensitively(input string) (*ReplicaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicaId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicaId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if id.ContainerAppName, ok = input.Parsed["containerAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", input) } - if id.RevisionName, ok = parsed.Parsed["revisionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "revisionName", *parsed) + if id.RevisionName, ok = input.Parsed["revisionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "revisionName", input) } - if id.ReplicaName, ok = parsed.Parsed["replicaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicaName", *parsed) + if id.ReplicaName, ok = input.Parsed["replicaName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicaName", input) } - return &id, nil + return nil } // ValidateReplicaID checks that 'input' can be parsed as a Replica ID diff --git a/resource-manager/containerapps/2022-03-01/containerappsrevisionreplicas/id_revision.go b/resource-manager/containerapps/2022-03-01/containerappsrevisionreplicas/id_revision.go index 4840b9a4d4a..e4a73ba207a 100644 --- a/resource-manager/containerapps/2022-03-01/containerappsrevisionreplicas/id_revision.go +++ b/resource-manager/containerapps/2022-03-01/containerappsrevisionreplicas/id_revision.go @@ -38,23 +38,9 @@ func ParseRevisionID(input string) (*RevisionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RevisionId{} - - 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.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) - } - - if id.RevisionName, ok = parsed.Parsed["revisionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "revisionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRevisionIDInsensitively(input string) (*RevisionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RevisionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RevisionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if id.ContainerAppName, ok = input.Parsed["containerAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", input) } - if id.RevisionName, ok = parsed.Parsed["revisionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "revisionName", *parsed) + if id.RevisionName, ok = input.Parsed["revisionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "revisionName", input) } - return &id, nil + return nil } // ValidateRevisionID checks that 'input' can be parsed as a Revision ID diff --git a/resource-manager/containerapps/2022-03-01/containerappsrevisions/id_containerapp.go b/resource-manager/containerapps/2022-03-01/containerappsrevisions/id_containerapp.go index 0c58f29a8e4..3931986b1de 100644 --- a/resource-manager/containerapps/2022-03-01/containerappsrevisions/id_containerapp.go +++ b/resource-manager/containerapps/2022-03-01/containerappsrevisions/id_containerapp.go @@ -36,19 +36,9 @@ func ParseContainerAppID(input string) (*ContainerAppId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerAppId{} - - 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.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseContainerAppIDInsensitively(input string) (*ContainerAppId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerAppId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ContainerAppId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if id.ContainerAppName, ok = input.Parsed["containerAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", input) } - return &id, nil + return nil } // ValidateContainerAppID checks that 'input' can be parsed as a Container App ID diff --git a/resource-manager/containerapps/2022-03-01/containerappsrevisions/id_revision.go b/resource-manager/containerapps/2022-03-01/containerappsrevisions/id_revision.go index 3afb0fa480f..2183bef32af 100644 --- a/resource-manager/containerapps/2022-03-01/containerappsrevisions/id_revision.go +++ b/resource-manager/containerapps/2022-03-01/containerappsrevisions/id_revision.go @@ -38,23 +38,9 @@ func ParseRevisionID(input string) (*RevisionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RevisionId{} - - 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.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) - } - - if id.RevisionName, ok = parsed.Parsed["revisionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "revisionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRevisionIDInsensitively(input string) (*RevisionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RevisionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RevisionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if id.ContainerAppName, ok = input.Parsed["containerAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", input) } - if id.RevisionName, ok = parsed.Parsed["revisionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "revisionName", *parsed) + if id.RevisionName, ok = input.Parsed["revisionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "revisionName", input) } - return &id, nil + return nil } // ValidateRevisionID checks that 'input' can be parsed as a Revision ID diff --git a/resource-manager/containerapps/2022-03-01/containerappssourcecontrols/id_containerapp.go b/resource-manager/containerapps/2022-03-01/containerappssourcecontrols/id_containerapp.go index 6b1e707a2e3..2638a59e6b2 100644 --- a/resource-manager/containerapps/2022-03-01/containerappssourcecontrols/id_containerapp.go +++ b/resource-manager/containerapps/2022-03-01/containerappssourcecontrols/id_containerapp.go @@ -36,19 +36,9 @@ func ParseContainerAppID(input string) (*ContainerAppId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerAppId{} - - 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.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseContainerAppIDInsensitively(input string) (*ContainerAppId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerAppId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ContainerAppId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if id.ContainerAppName, ok = input.Parsed["containerAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", input) } - return &id, nil + return nil } // ValidateContainerAppID checks that 'input' can be parsed as a Container App ID diff --git a/resource-manager/containerapps/2022-03-01/containerappssourcecontrols/id_sourcecontrol.go b/resource-manager/containerapps/2022-03-01/containerappssourcecontrols/id_sourcecontrol.go index 5fc6fd24354..cb683ccc787 100644 --- a/resource-manager/containerapps/2022-03-01/containerappssourcecontrols/id_sourcecontrol.go +++ b/resource-manager/containerapps/2022-03-01/containerappssourcecontrols/id_sourcecontrol.go @@ -38,23 +38,9 @@ func ParseSourceControlID(input string) (*SourceControlId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlId{} - - 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.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) - } - - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSourceControlIDInsensitively(input string) (*SourceControlId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SourceControlId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if id.ContainerAppName, ok = input.Parsed["containerAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", input) } - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) + if id.SourceControlName, ok = input.Parsed["sourceControlName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", input) } - return &id, nil + return nil } // ValidateSourceControlID checks that 'input' can be parsed as a Source Control ID diff --git a/resource-manager/containerapps/2022-03-01/daprcomponents/id_daprcomponent.go b/resource-manager/containerapps/2022-03-01/daprcomponents/id_daprcomponent.go index 490cdc8217d..fb0b153db56 100644 --- a/resource-manager/containerapps/2022-03-01/daprcomponents/id_daprcomponent.go +++ b/resource-manager/containerapps/2022-03-01/daprcomponents/id_daprcomponent.go @@ -38,23 +38,9 @@ func ParseDaprComponentID(input string) (*DaprComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DaprComponentId{} - - 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.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) - } - - if id.DaprComponentName, ok = parsed.Parsed["daprComponentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "daprComponentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDaprComponentIDInsensitively(input string) (*DaprComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DaprComponentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DaprComponentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if id.ManagedEnvironmentName, ok = input.Parsed["managedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", input) } - if id.DaprComponentName, ok = parsed.Parsed["daprComponentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "daprComponentName", *parsed) + if id.DaprComponentName, ok = input.Parsed["daprComponentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "daprComponentName", input) } - return &id, nil + return nil } // ValidateDaprComponentID checks that 'input' can be parsed as a Dapr Component ID diff --git a/resource-manager/containerapps/2022-03-01/daprcomponents/id_managedenvironment.go b/resource-manager/containerapps/2022-03-01/daprcomponents/id_managedenvironment.go index 550d5ac0ba9..2337e0c4eac 100644 --- a/resource-manager/containerapps/2022-03-01/daprcomponents/id_managedenvironment.go +++ b/resource-manager/containerapps/2022-03-01/daprcomponents/id_managedenvironment.go @@ -36,19 +36,9 @@ func ParseManagedEnvironmentID(input string) (*ManagedEnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedEnvironmentId{} - - 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.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagedEnvironmentIDInsensitively(input string) (*ManagedEnvironmentId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedEnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagedEnvironmentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if id.ManagedEnvironmentName, ok = input.Parsed["managedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", input) } - return &id, nil + return nil } // ValidateManagedEnvironmentID checks that 'input' can be parsed as a Managed Environment ID diff --git a/resource-manager/containerapps/2022-03-01/managedenvironments/id_certificate.go b/resource-manager/containerapps/2022-03-01/managedenvironments/id_certificate.go index 05dfa0b7267..e62686ef744 100644 --- a/resource-manager/containerapps/2022-03-01/managedenvironments/id_certificate.go +++ b/resource-manager/containerapps/2022-03-01/managedenvironments/id_certificate.go @@ -38,23 +38,9 @@ func ParseCertificateID(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} - - 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.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) - } - - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCertificateIDInsensitively(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if id.ManagedEnvironmentName, ok = input.Parsed["managedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", input) } - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if id.CertificateName, ok = input.Parsed["certificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateName", input) } - return &id, nil + return nil } // ValidateCertificateID checks that 'input' can be parsed as a Certificate ID diff --git a/resource-manager/containerapps/2022-03-01/managedenvironments/id_managedenvironment.go b/resource-manager/containerapps/2022-03-01/managedenvironments/id_managedenvironment.go index 52a50616de8..a803b6275e4 100644 --- a/resource-manager/containerapps/2022-03-01/managedenvironments/id_managedenvironment.go +++ b/resource-manager/containerapps/2022-03-01/managedenvironments/id_managedenvironment.go @@ -36,19 +36,9 @@ func ParseManagedEnvironmentID(input string) (*ManagedEnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedEnvironmentId{} - - 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.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagedEnvironmentIDInsensitively(input string) (*ManagedEnvironmentId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedEnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagedEnvironmentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if id.ManagedEnvironmentName, ok = input.Parsed["managedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", input) } - return &id, nil + return nil } // ValidateManagedEnvironmentID checks that 'input' can be parsed as a Managed Environment ID diff --git a/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/id_managedenvironment.go b/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/id_managedenvironment.go index 04633e9d25c..a5fb5cd82ac 100644 --- a/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/id_managedenvironment.go +++ b/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/id_managedenvironment.go @@ -36,19 +36,9 @@ func ParseManagedEnvironmentID(input string) (*ManagedEnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedEnvironmentId{} - - 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.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagedEnvironmentIDInsensitively(input string) (*ManagedEnvironmentId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedEnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagedEnvironmentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if id.ManagedEnvironmentName, ok = input.Parsed["managedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", input) } - return &id, nil + return nil } // ValidateManagedEnvironmentID checks that 'input' can be parsed as a Managed Environment ID diff --git a/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/id_storage.go b/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/id_storage.go index 6539b485321..f66f3604baa 100644 --- a/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/id_storage.go +++ b/resource-manager/containerapps/2022-03-01/managedenvironmentsstorages/id_storage.go @@ -38,23 +38,9 @@ func ParseStorageID(input string) (*StorageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageId{} - - 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.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) - } - - if id.StorageName, ok = parsed.Parsed["storageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseStorageIDInsensitively(input string) (*StorageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *StorageId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if id.ManagedEnvironmentName, ok = input.Parsed["managedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", input) } - if id.StorageName, ok = parsed.Parsed["storageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageName", *parsed) + if id.StorageName, ok = input.Parsed["storageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageName", input) } - return &id, nil + return nil } // ValidateStorageID checks that 'input' can be parsed as a Storage ID diff --git a/resource-manager/containerapps/2022-11-01-preview/availableworkloadprofiles/id_location.go b/resource-manager/containerapps/2022-11-01-preview/availableworkloadprofiles/id_location.go index 653767d948b..d311af81703 100644 --- a/resource-manager/containerapps/2022-11-01-preview/availableworkloadprofiles/id_location.go +++ b/resource-manager/containerapps/2022-11-01-preview/availableworkloadprofiles/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/containerapps/2022-11-01-preview/billingmeters/id_location.go b/resource-manager/containerapps/2022-11-01-preview/billingmeters/id_location.go index 06e3587d9ee..ce3d51fe5a8 100644 --- a/resource-manager/containerapps/2022-11-01-preview/billingmeters/id_location.go +++ b/resource-manager/containerapps/2022-11-01-preview/billingmeters/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/containerapps/2022-11-01-preview/certificates/id_certificate.go b/resource-manager/containerapps/2022-11-01-preview/certificates/id_certificate.go index fd232b2dd05..21b3813873f 100644 --- a/resource-manager/containerapps/2022-11-01-preview/certificates/id_certificate.go +++ b/resource-manager/containerapps/2022-11-01-preview/certificates/id_certificate.go @@ -38,23 +38,9 @@ func ParseCertificateID(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} - - 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.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) - } - - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCertificateIDInsensitively(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if id.ManagedEnvironmentName, ok = input.Parsed["managedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", input) } - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if id.CertificateName, ok = input.Parsed["certificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateName", input) } - return &id, nil + return nil } // ValidateCertificateID checks that 'input' can be parsed as a Certificate ID diff --git a/resource-manager/containerapps/2022-11-01-preview/certificates/id_connectedenvironment.go b/resource-manager/containerapps/2022-11-01-preview/certificates/id_connectedenvironment.go index 2a6232f173a..1650e188f4d 100644 --- a/resource-manager/containerapps/2022-11-01-preview/certificates/id_connectedenvironment.go +++ b/resource-manager/containerapps/2022-11-01-preview/certificates/id_connectedenvironment.go @@ -36,19 +36,9 @@ func ParseConnectedEnvironmentID(input string) (*ConnectedEnvironmentId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectedEnvironmentId{} - - 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.ConnectedEnvironmentName, ok = parsed.Parsed["connectedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectedEnvironmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseConnectedEnvironmentIDInsensitively(input string) (*ConnectedEnvironme return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectedEnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ConnectedEnvironmentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ConnectedEnvironmentName, ok = parsed.Parsed["connectedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectedEnvironmentName", *parsed) + if id.ConnectedEnvironmentName, ok = input.Parsed["connectedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectedEnvironmentName", input) } - return &id, nil + return nil } // ValidateConnectedEnvironmentID checks that 'input' can be parsed as a Connected Environment ID diff --git a/resource-manager/containerapps/2022-11-01-preview/certificates/id_connectedenvironmentcertificate.go b/resource-manager/containerapps/2022-11-01-preview/certificates/id_connectedenvironmentcertificate.go index 85a6c7db3d2..26feae01aca 100644 --- a/resource-manager/containerapps/2022-11-01-preview/certificates/id_connectedenvironmentcertificate.go +++ b/resource-manager/containerapps/2022-11-01-preview/certificates/id_connectedenvironmentcertificate.go @@ -38,23 +38,9 @@ func ParseConnectedEnvironmentCertificateID(input string) (*ConnectedEnvironment return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectedEnvironmentCertificateId{} - - 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.ConnectedEnvironmentName, ok = parsed.Parsed["connectedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectedEnvironmentName", *parsed) - } - - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConnectedEnvironmentCertificateIDInsensitively(input string) (*Connect return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectedEnvironmentCertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConnectedEnvironmentCertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ConnectedEnvironmentName, ok = parsed.Parsed["connectedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectedEnvironmentName", *parsed) + if id.ConnectedEnvironmentName, ok = input.Parsed["connectedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectedEnvironmentName", input) } - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if id.CertificateName, ok = input.Parsed["certificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateName", input) } - return &id, nil + return nil } // ValidateConnectedEnvironmentCertificateID checks that 'input' can be parsed as a Connected Environment Certificate ID diff --git a/resource-manager/containerapps/2022-11-01-preview/certificates/id_managedenvironment.go b/resource-manager/containerapps/2022-11-01-preview/certificates/id_managedenvironment.go index 5301e3cbf40..dce7709f9a5 100644 --- a/resource-manager/containerapps/2022-11-01-preview/certificates/id_managedenvironment.go +++ b/resource-manager/containerapps/2022-11-01-preview/certificates/id_managedenvironment.go @@ -36,19 +36,9 @@ func ParseManagedEnvironmentID(input string) (*ManagedEnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedEnvironmentId{} - - 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.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagedEnvironmentIDInsensitively(input string) (*ManagedEnvironmentId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedEnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagedEnvironmentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if id.ManagedEnvironmentName, ok = input.Parsed["managedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", input) } - return &id, nil + return nil } // ValidateManagedEnvironmentID checks that 'input' can be parsed as a Managed Environment ID diff --git a/resource-manager/containerapps/2022-11-01-preview/connectedenvironments/id_connectedenvironment.go b/resource-manager/containerapps/2022-11-01-preview/connectedenvironments/id_connectedenvironment.go index 49698696b38..bc545cd11d7 100644 --- a/resource-manager/containerapps/2022-11-01-preview/connectedenvironments/id_connectedenvironment.go +++ b/resource-manager/containerapps/2022-11-01-preview/connectedenvironments/id_connectedenvironment.go @@ -36,19 +36,9 @@ func ParseConnectedEnvironmentID(input string) (*ConnectedEnvironmentId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectedEnvironmentId{} - - 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.ConnectedEnvironmentName, ok = parsed.Parsed["connectedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectedEnvironmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseConnectedEnvironmentIDInsensitively(input string) (*ConnectedEnvironme return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectedEnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ConnectedEnvironmentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ConnectedEnvironmentName, ok = parsed.Parsed["connectedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectedEnvironmentName", *parsed) + if id.ConnectedEnvironmentName, ok = input.Parsed["connectedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectedEnvironmentName", input) } - return &id, nil + return nil } // ValidateConnectedEnvironmentID checks that 'input' can be parsed as a Connected Environment ID diff --git a/resource-manager/containerapps/2022-11-01-preview/connectedenvironments/id_connectedenvironmentcertificate.go b/resource-manager/containerapps/2022-11-01-preview/connectedenvironments/id_connectedenvironmentcertificate.go index e1316bfb3c6..1cc2138d328 100644 --- a/resource-manager/containerapps/2022-11-01-preview/connectedenvironments/id_connectedenvironmentcertificate.go +++ b/resource-manager/containerapps/2022-11-01-preview/connectedenvironments/id_connectedenvironmentcertificate.go @@ -38,23 +38,9 @@ func ParseConnectedEnvironmentCertificateID(input string) (*ConnectedEnvironment return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectedEnvironmentCertificateId{} - - 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.ConnectedEnvironmentName, ok = parsed.Parsed["connectedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectedEnvironmentName", *parsed) - } - - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConnectedEnvironmentCertificateIDInsensitively(input string) (*Connect return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectedEnvironmentCertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConnectedEnvironmentCertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ConnectedEnvironmentName, ok = parsed.Parsed["connectedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectedEnvironmentName", *parsed) + if id.ConnectedEnvironmentName, ok = input.Parsed["connectedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectedEnvironmentName", input) } - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if id.CertificateName, ok = input.Parsed["certificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateName", input) } - return &id, nil + return nil } // ValidateConnectedEnvironmentCertificateID checks that 'input' can be parsed as a Connected Environment Certificate ID diff --git a/resource-manager/containerapps/2022-11-01-preview/connectedenvironmentsstorages/id_connectedenvironment.go b/resource-manager/containerapps/2022-11-01-preview/connectedenvironmentsstorages/id_connectedenvironment.go index f32c825e4ed..b95cf408568 100644 --- a/resource-manager/containerapps/2022-11-01-preview/connectedenvironmentsstorages/id_connectedenvironment.go +++ b/resource-manager/containerapps/2022-11-01-preview/connectedenvironmentsstorages/id_connectedenvironment.go @@ -36,19 +36,9 @@ func ParseConnectedEnvironmentID(input string) (*ConnectedEnvironmentId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectedEnvironmentId{} - - 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.ConnectedEnvironmentName, ok = parsed.Parsed["connectedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectedEnvironmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseConnectedEnvironmentIDInsensitively(input string) (*ConnectedEnvironme return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectedEnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ConnectedEnvironmentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ConnectedEnvironmentName, ok = parsed.Parsed["connectedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectedEnvironmentName", *parsed) + if id.ConnectedEnvironmentName, ok = input.Parsed["connectedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectedEnvironmentName", input) } - return &id, nil + return nil } // ValidateConnectedEnvironmentID checks that 'input' can be parsed as a Connected Environment ID diff --git a/resource-manager/containerapps/2022-11-01-preview/connectedenvironmentsstorages/id_connectedenvironmentstorage.go b/resource-manager/containerapps/2022-11-01-preview/connectedenvironmentsstorages/id_connectedenvironmentstorage.go index aa82c7c397e..1a4e8c5e542 100644 --- a/resource-manager/containerapps/2022-11-01-preview/connectedenvironmentsstorages/id_connectedenvironmentstorage.go +++ b/resource-manager/containerapps/2022-11-01-preview/connectedenvironmentsstorages/id_connectedenvironmentstorage.go @@ -38,23 +38,9 @@ func ParseConnectedEnvironmentStorageID(input string) (*ConnectedEnvironmentStor return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectedEnvironmentStorageId{} - - 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.ConnectedEnvironmentName, ok = parsed.Parsed["connectedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectedEnvironmentName", *parsed) - } - - if id.StorageName, ok = parsed.Parsed["storageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConnectedEnvironmentStorageIDInsensitively(input string) (*ConnectedEn return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectedEnvironmentStorageId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConnectedEnvironmentStorageId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ConnectedEnvironmentName, ok = parsed.Parsed["connectedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectedEnvironmentName", *parsed) + if id.ConnectedEnvironmentName, ok = input.Parsed["connectedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectedEnvironmentName", input) } - if id.StorageName, ok = parsed.Parsed["storageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageName", *parsed) + if id.StorageName, ok = input.Parsed["storageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageName", input) } - return &id, nil + return nil } // ValidateConnectedEnvironmentStorageID checks that 'input' can be parsed as a Connected Environment Storage ID diff --git a/resource-manager/containerapps/2022-11-01-preview/containerapps/id_containerapp.go b/resource-manager/containerapps/2022-11-01-preview/containerapps/id_containerapp.go index bec76c9d8cd..b5cb92a4826 100644 --- a/resource-manager/containerapps/2022-11-01-preview/containerapps/id_containerapp.go +++ b/resource-manager/containerapps/2022-11-01-preview/containerapps/id_containerapp.go @@ -36,19 +36,9 @@ func ParseContainerAppID(input string) (*ContainerAppId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerAppId{} - - 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.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseContainerAppIDInsensitively(input string) (*ContainerAppId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerAppId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ContainerAppId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if id.ContainerAppName, ok = input.Parsed["containerAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", input) } - return &id, nil + return nil } // ValidateContainerAppID checks that 'input' can be parsed as a Container App ID diff --git a/resource-manager/containerapps/2022-11-01-preview/containerapps/id_detector.go b/resource-manager/containerapps/2022-11-01-preview/containerapps/id_detector.go index e0635c42772..f868c0e9e85 100644 --- a/resource-manager/containerapps/2022-11-01-preview/containerapps/id_detector.go +++ b/resource-manager/containerapps/2022-11-01-preview/containerapps/id_detector.go @@ -38,23 +38,9 @@ func ParseDetectorID(input string) (*DetectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DetectorId{} - - 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.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) - } - - if id.DetectorName, ok = parsed.Parsed["detectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "detectorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDetectorIDInsensitively(input string) (*DetectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DetectorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DetectorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if id.ContainerAppName, ok = input.Parsed["containerAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", input) } - if id.DetectorName, ok = parsed.Parsed["detectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "detectorName", *parsed) + if id.DetectorName, ok = input.Parsed["detectorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "detectorName", input) } - return &id, nil + return nil } // ValidateDetectorID checks that 'input' can be parsed as a Detector ID diff --git a/resource-manager/containerapps/2022-11-01-preview/containerapps/id_revisionsapirevision.go b/resource-manager/containerapps/2022-11-01-preview/containerapps/id_revisionsapirevision.go index a46f51fe65e..384d409993a 100644 --- a/resource-manager/containerapps/2022-11-01-preview/containerapps/id_revisionsapirevision.go +++ b/resource-manager/containerapps/2022-11-01-preview/containerapps/id_revisionsapirevision.go @@ -38,23 +38,9 @@ func ParseRevisionsApiRevisionID(input string) (*RevisionsApiRevisionId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RevisionsApiRevisionId{} - - 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.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) - } - - if id.RevisionName, ok = parsed.Parsed["revisionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "revisionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRevisionsApiRevisionIDInsensitively(input string) (*RevisionsApiRevisi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RevisionsApiRevisionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RevisionsApiRevisionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if id.ContainerAppName, ok = input.Parsed["containerAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", input) } - if id.RevisionName, ok = parsed.Parsed["revisionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "revisionName", *parsed) + if id.RevisionName, ok = input.Parsed["revisionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "revisionName", input) } - return &id, nil + return nil } // ValidateRevisionsApiRevisionID checks that 'input' can be parsed as a Revisions Api Revision ID diff --git a/resource-manager/containerapps/2022-11-01-preview/containerappsauthconfigs/id_authconfig.go b/resource-manager/containerapps/2022-11-01-preview/containerappsauthconfigs/id_authconfig.go index 29de8fd3278..b4b6adb350c 100644 --- a/resource-manager/containerapps/2022-11-01-preview/containerappsauthconfigs/id_authconfig.go +++ b/resource-manager/containerapps/2022-11-01-preview/containerappsauthconfigs/id_authconfig.go @@ -38,23 +38,9 @@ func ParseAuthConfigID(input string) (*AuthConfigId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthConfigId{} - - 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.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) - } - - if id.AuthConfigName, ok = parsed.Parsed["authConfigName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authConfigName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAuthConfigIDInsensitively(input string) (*AuthConfigId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthConfigId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AuthConfigId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if id.ContainerAppName, ok = input.Parsed["containerAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", input) } - if id.AuthConfigName, ok = parsed.Parsed["authConfigName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authConfigName", *parsed) + if id.AuthConfigName, ok = input.Parsed["authConfigName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authConfigName", input) } - return &id, nil + return nil } // ValidateAuthConfigID checks that 'input' can be parsed as a Auth Config ID diff --git a/resource-manager/containerapps/2022-11-01-preview/containerappsauthconfigs/id_containerapp.go b/resource-manager/containerapps/2022-11-01-preview/containerappsauthconfigs/id_containerapp.go index ebac43ec5e7..fc569300b37 100644 --- a/resource-manager/containerapps/2022-11-01-preview/containerappsauthconfigs/id_containerapp.go +++ b/resource-manager/containerapps/2022-11-01-preview/containerappsauthconfigs/id_containerapp.go @@ -36,19 +36,9 @@ func ParseContainerAppID(input string) (*ContainerAppId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerAppId{} - - 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.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseContainerAppIDInsensitively(input string) (*ContainerAppId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerAppId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ContainerAppId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if id.ContainerAppName, ok = input.Parsed["containerAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", input) } - return &id, nil + return nil } // ValidateContainerAppID checks that 'input' can be parsed as a Container App ID diff --git a/resource-manager/containerapps/2022-11-01-preview/containerappsrevisionreplicas/id_replica.go b/resource-manager/containerapps/2022-11-01-preview/containerappsrevisionreplicas/id_replica.go index ed6455be6dd..9afa046bdf6 100644 --- a/resource-manager/containerapps/2022-11-01-preview/containerappsrevisionreplicas/id_replica.go +++ b/resource-manager/containerapps/2022-11-01-preview/containerappsrevisionreplicas/id_replica.go @@ -40,27 +40,9 @@ func ParseReplicaID(input string) (*ReplicaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicaId{} - - 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.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) - } - - if id.RevisionName, ok = parsed.Parsed["revisionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "revisionName", *parsed) - } - - if id.ReplicaName, ok = parsed.Parsed["replicaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicaName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicaIDInsensitively(input string) (*ReplicaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicaId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicaId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if id.ContainerAppName, ok = input.Parsed["containerAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", input) } - if id.RevisionName, ok = parsed.Parsed["revisionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "revisionName", *parsed) + if id.RevisionName, ok = input.Parsed["revisionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "revisionName", input) } - if id.ReplicaName, ok = parsed.Parsed["replicaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicaName", *parsed) + if id.ReplicaName, ok = input.Parsed["replicaName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicaName", input) } - return &id, nil + return nil } // ValidateReplicaID checks that 'input' can be parsed as a Replica ID diff --git a/resource-manager/containerapps/2022-11-01-preview/containerappsrevisionreplicas/id_revision.go b/resource-manager/containerapps/2022-11-01-preview/containerappsrevisionreplicas/id_revision.go index 4840b9a4d4a..e4a73ba207a 100644 --- a/resource-manager/containerapps/2022-11-01-preview/containerappsrevisionreplicas/id_revision.go +++ b/resource-manager/containerapps/2022-11-01-preview/containerappsrevisionreplicas/id_revision.go @@ -38,23 +38,9 @@ func ParseRevisionID(input string) (*RevisionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RevisionId{} - - 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.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) - } - - if id.RevisionName, ok = parsed.Parsed["revisionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "revisionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRevisionIDInsensitively(input string) (*RevisionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RevisionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RevisionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if id.ContainerAppName, ok = input.Parsed["containerAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", input) } - if id.RevisionName, ok = parsed.Parsed["revisionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "revisionName", *parsed) + if id.RevisionName, ok = input.Parsed["revisionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "revisionName", input) } - return &id, nil + return nil } // ValidateRevisionID checks that 'input' can be parsed as a Revision ID diff --git a/resource-manager/containerapps/2022-11-01-preview/containerappsrevisions/id_containerapp.go b/resource-manager/containerapps/2022-11-01-preview/containerappsrevisions/id_containerapp.go index 0c58f29a8e4..3931986b1de 100644 --- a/resource-manager/containerapps/2022-11-01-preview/containerappsrevisions/id_containerapp.go +++ b/resource-manager/containerapps/2022-11-01-preview/containerappsrevisions/id_containerapp.go @@ -36,19 +36,9 @@ func ParseContainerAppID(input string) (*ContainerAppId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerAppId{} - - 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.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseContainerAppIDInsensitively(input string) (*ContainerAppId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerAppId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ContainerAppId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if id.ContainerAppName, ok = input.Parsed["containerAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", input) } - return &id, nil + return nil } // ValidateContainerAppID checks that 'input' can be parsed as a Container App ID diff --git a/resource-manager/containerapps/2022-11-01-preview/containerappsrevisions/id_revision.go b/resource-manager/containerapps/2022-11-01-preview/containerappsrevisions/id_revision.go index 3afb0fa480f..2183bef32af 100644 --- a/resource-manager/containerapps/2022-11-01-preview/containerappsrevisions/id_revision.go +++ b/resource-manager/containerapps/2022-11-01-preview/containerappsrevisions/id_revision.go @@ -38,23 +38,9 @@ func ParseRevisionID(input string) (*RevisionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RevisionId{} - - 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.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) - } - - if id.RevisionName, ok = parsed.Parsed["revisionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "revisionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRevisionIDInsensitively(input string) (*RevisionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RevisionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RevisionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if id.ContainerAppName, ok = input.Parsed["containerAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", input) } - if id.RevisionName, ok = parsed.Parsed["revisionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "revisionName", *parsed) + if id.RevisionName, ok = input.Parsed["revisionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "revisionName", input) } - return &id, nil + return nil } // ValidateRevisionID checks that 'input' can be parsed as a Revision ID diff --git a/resource-manager/containerapps/2022-11-01-preview/containerappssourcecontrols/id_containerapp.go b/resource-manager/containerapps/2022-11-01-preview/containerappssourcecontrols/id_containerapp.go index 6b1e707a2e3..2638a59e6b2 100644 --- a/resource-manager/containerapps/2022-11-01-preview/containerappssourcecontrols/id_containerapp.go +++ b/resource-manager/containerapps/2022-11-01-preview/containerappssourcecontrols/id_containerapp.go @@ -36,19 +36,9 @@ func ParseContainerAppID(input string) (*ContainerAppId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerAppId{} - - 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.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseContainerAppIDInsensitively(input string) (*ContainerAppId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerAppId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ContainerAppId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if id.ContainerAppName, ok = input.Parsed["containerAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", input) } - return &id, nil + return nil } // ValidateContainerAppID checks that 'input' can be parsed as a Container App ID diff --git a/resource-manager/containerapps/2022-11-01-preview/containerappssourcecontrols/id_sourcecontrol.go b/resource-manager/containerapps/2022-11-01-preview/containerappssourcecontrols/id_sourcecontrol.go index 5fc6fd24354..cb683ccc787 100644 --- a/resource-manager/containerapps/2022-11-01-preview/containerappssourcecontrols/id_sourcecontrol.go +++ b/resource-manager/containerapps/2022-11-01-preview/containerappssourcecontrols/id_sourcecontrol.go @@ -38,23 +38,9 @@ func ParseSourceControlID(input string) (*SourceControlId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlId{} - - 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.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) - } - - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSourceControlIDInsensitively(input string) (*SourceControlId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SourceControlId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if id.ContainerAppName, ok = input.Parsed["containerAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", input) } - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) + if id.SourceControlName, ok = input.Parsed["sourceControlName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", input) } - return &id, nil + return nil } // ValidateSourceControlID checks that 'input' can be parsed as a Source Control ID diff --git a/resource-manager/containerapps/2022-11-01-preview/daprcomponents/id_connectedenvironment.go b/resource-manager/containerapps/2022-11-01-preview/daprcomponents/id_connectedenvironment.go index ac0bd53cbd0..4713405982f 100644 --- a/resource-manager/containerapps/2022-11-01-preview/daprcomponents/id_connectedenvironment.go +++ b/resource-manager/containerapps/2022-11-01-preview/daprcomponents/id_connectedenvironment.go @@ -36,19 +36,9 @@ func ParseConnectedEnvironmentID(input string) (*ConnectedEnvironmentId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectedEnvironmentId{} - - 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.ConnectedEnvironmentName, ok = parsed.Parsed["connectedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectedEnvironmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseConnectedEnvironmentIDInsensitively(input string) (*ConnectedEnvironme return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectedEnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ConnectedEnvironmentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ConnectedEnvironmentName, ok = parsed.Parsed["connectedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectedEnvironmentName", *parsed) + if id.ConnectedEnvironmentName, ok = input.Parsed["connectedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectedEnvironmentName", input) } - return &id, nil + return nil } // ValidateConnectedEnvironmentID checks that 'input' can be parsed as a Connected Environment ID diff --git a/resource-manager/containerapps/2022-11-01-preview/daprcomponents/id_connectedenvironmentdaprcomponent.go b/resource-manager/containerapps/2022-11-01-preview/daprcomponents/id_connectedenvironmentdaprcomponent.go index ee117ae73ec..677df196b68 100644 --- a/resource-manager/containerapps/2022-11-01-preview/daprcomponents/id_connectedenvironmentdaprcomponent.go +++ b/resource-manager/containerapps/2022-11-01-preview/daprcomponents/id_connectedenvironmentdaprcomponent.go @@ -38,23 +38,9 @@ func ParseConnectedEnvironmentDaprComponentID(input string) (*ConnectedEnvironme return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectedEnvironmentDaprComponentId{} - - 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.ConnectedEnvironmentName, ok = parsed.Parsed["connectedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectedEnvironmentName", *parsed) - } - - if id.DaprComponentName, ok = parsed.Parsed["daprComponentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "daprComponentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConnectedEnvironmentDaprComponentIDInsensitively(input string) (*Conne return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectedEnvironmentDaprComponentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConnectedEnvironmentDaprComponentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ConnectedEnvironmentName, ok = parsed.Parsed["connectedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectedEnvironmentName", *parsed) + if id.ConnectedEnvironmentName, ok = input.Parsed["connectedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectedEnvironmentName", input) } - if id.DaprComponentName, ok = parsed.Parsed["daprComponentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "daprComponentName", *parsed) + if id.DaprComponentName, ok = input.Parsed["daprComponentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "daprComponentName", input) } - return &id, nil + return nil } // ValidateConnectedEnvironmentDaprComponentID checks that 'input' can be parsed as a Connected Environment Dapr Component ID diff --git a/resource-manager/containerapps/2022-11-01-preview/daprcomponents/id_daprcomponent.go b/resource-manager/containerapps/2022-11-01-preview/daprcomponents/id_daprcomponent.go index 490cdc8217d..fb0b153db56 100644 --- a/resource-manager/containerapps/2022-11-01-preview/daprcomponents/id_daprcomponent.go +++ b/resource-manager/containerapps/2022-11-01-preview/daprcomponents/id_daprcomponent.go @@ -38,23 +38,9 @@ func ParseDaprComponentID(input string) (*DaprComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DaprComponentId{} - - 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.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) - } - - if id.DaprComponentName, ok = parsed.Parsed["daprComponentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "daprComponentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDaprComponentIDInsensitively(input string) (*DaprComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DaprComponentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DaprComponentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if id.ManagedEnvironmentName, ok = input.Parsed["managedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", input) } - if id.DaprComponentName, ok = parsed.Parsed["daprComponentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "daprComponentName", *parsed) + if id.DaprComponentName, ok = input.Parsed["daprComponentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "daprComponentName", input) } - return &id, nil + return nil } // ValidateDaprComponentID checks that 'input' can be parsed as a Dapr Component ID diff --git a/resource-manager/containerapps/2022-11-01-preview/daprcomponents/id_managedenvironment.go b/resource-manager/containerapps/2022-11-01-preview/daprcomponents/id_managedenvironment.go index 550d5ac0ba9..2337e0c4eac 100644 --- a/resource-manager/containerapps/2022-11-01-preview/daprcomponents/id_managedenvironment.go +++ b/resource-manager/containerapps/2022-11-01-preview/daprcomponents/id_managedenvironment.go @@ -36,19 +36,9 @@ func ParseManagedEnvironmentID(input string) (*ManagedEnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedEnvironmentId{} - - 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.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagedEnvironmentIDInsensitively(input string) (*ManagedEnvironmentId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedEnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagedEnvironmentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if id.ManagedEnvironmentName, ok = input.Parsed["managedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", input) } - return &id, nil + return nil } // ValidateManagedEnvironmentID checks that 'input' can be parsed as a Managed Environment ID diff --git a/resource-manager/containerapps/2022-11-01-preview/diagnostics/id_containerapp.go b/resource-manager/containerapps/2022-11-01-preview/diagnostics/id_containerapp.go index 0583b69b8c3..eaac16cb38d 100644 --- a/resource-manager/containerapps/2022-11-01-preview/diagnostics/id_containerapp.go +++ b/resource-manager/containerapps/2022-11-01-preview/diagnostics/id_containerapp.go @@ -36,19 +36,9 @@ func ParseContainerAppID(input string) (*ContainerAppId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerAppId{} - - 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.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseContainerAppIDInsensitively(input string) (*ContainerAppId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerAppId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ContainerAppId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if id.ContainerAppName, ok = input.Parsed["containerAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", input) } - return &id, nil + return nil } // ValidateContainerAppID checks that 'input' can be parsed as a Container App ID diff --git a/resource-manager/containerapps/2022-11-01-preview/diagnostics/id_detector.go b/resource-manager/containerapps/2022-11-01-preview/diagnostics/id_detector.go index bd3f03c3672..88a4c2b70f1 100644 --- a/resource-manager/containerapps/2022-11-01-preview/diagnostics/id_detector.go +++ b/resource-manager/containerapps/2022-11-01-preview/diagnostics/id_detector.go @@ -38,23 +38,9 @@ func ParseDetectorID(input string) (*DetectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DetectorId{} - - 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.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) - } - - if id.DetectorName, ok = parsed.Parsed["detectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "detectorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDetectorIDInsensitively(input string) (*DetectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DetectorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DetectorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if id.ContainerAppName, ok = input.Parsed["containerAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", input) } - if id.DetectorName, ok = parsed.Parsed["detectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "detectorName", *parsed) + if id.DetectorName, ok = input.Parsed["detectorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "detectorName", input) } - return &id, nil + return nil } // ValidateDetectorID checks that 'input' can be parsed as a Detector ID diff --git a/resource-manager/containerapps/2022-11-01-preview/diagnostics/id_managedenvironment.go b/resource-manager/containerapps/2022-11-01-preview/diagnostics/id_managedenvironment.go index 1585d25ab9b..5c773db9da9 100644 --- a/resource-manager/containerapps/2022-11-01-preview/diagnostics/id_managedenvironment.go +++ b/resource-manager/containerapps/2022-11-01-preview/diagnostics/id_managedenvironment.go @@ -36,19 +36,9 @@ func ParseManagedEnvironmentID(input string) (*ManagedEnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedEnvironmentId{} - - 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.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagedEnvironmentIDInsensitively(input string) (*ManagedEnvironmentId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedEnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagedEnvironmentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if id.ManagedEnvironmentName, ok = input.Parsed["managedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", input) } - return &id, nil + return nil } // ValidateManagedEnvironmentID checks that 'input' can be parsed as a Managed Environment ID diff --git a/resource-manager/containerapps/2022-11-01-preview/diagnostics/id_managedenvironmentdetector.go b/resource-manager/containerapps/2022-11-01-preview/diagnostics/id_managedenvironmentdetector.go index f7a0776d31d..86e45e85157 100644 --- a/resource-manager/containerapps/2022-11-01-preview/diagnostics/id_managedenvironmentdetector.go +++ b/resource-manager/containerapps/2022-11-01-preview/diagnostics/id_managedenvironmentdetector.go @@ -38,23 +38,9 @@ func ParseManagedEnvironmentDetectorID(input string) (*ManagedEnvironmentDetecto return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedEnvironmentDetectorId{} - - 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.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) - } - - if id.DetectorName, ok = parsed.Parsed["detectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "detectorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseManagedEnvironmentDetectorIDInsensitively(input string) (*ManagedEnvir return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedEnvironmentDetectorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ManagedEnvironmentDetectorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if id.ManagedEnvironmentName, ok = input.Parsed["managedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", input) } - if id.DetectorName, ok = parsed.Parsed["detectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "detectorName", *parsed) + if id.DetectorName, ok = input.Parsed["detectorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "detectorName", input) } - return &id, nil + return nil } // ValidateManagedEnvironmentDetectorID checks that 'input' can be parsed as a Managed Environment Detector ID diff --git a/resource-manager/containerapps/2022-11-01-preview/diagnostics/id_revisionsapirevision.go b/resource-manager/containerapps/2022-11-01-preview/diagnostics/id_revisionsapirevision.go index a7ba7b1ac66..1a607cec7d8 100644 --- a/resource-manager/containerapps/2022-11-01-preview/diagnostics/id_revisionsapirevision.go +++ b/resource-manager/containerapps/2022-11-01-preview/diagnostics/id_revisionsapirevision.go @@ -38,23 +38,9 @@ func ParseRevisionsApiRevisionID(input string) (*RevisionsApiRevisionId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RevisionsApiRevisionId{} - - 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.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) - } - - if id.RevisionName, ok = parsed.Parsed["revisionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "revisionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRevisionsApiRevisionIDInsensitively(input string) (*RevisionsApiRevisi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RevisionsApiRevisionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RevisionsApiRevisionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if id.ContainerAppName, ok = input.Parsed["containerAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", input) } - if id.RevisionName, ok = parsed.Parsed["revisionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "revisionName", *parsed) + if id.RevisionName, ok = input.Parsed["revisionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "revisionName", input) } - return &id, nil + return nil } // ValidateRevisionsApiRevisionID checks that 'input' can be parsed as a Revisions Api Revision ID diff --git a/resource-manager/containerapps/2022-11-01-preview/jobs/id_execution.go b/resource-manager/containerapps/2022-11-01-preview/jobs/id_execution.go index 1a4840084b8..2bdfd0181c7 100644 --- a/resource-manager/containerapps/2022-11-01-preview/jobs/id_execution.go +++ b/resource-manager/containerapps/2022-11-01-preview/jobs/id_execution.go @@ -38,23 +38,9 @@ func ParseExecutionID(input string) (*ExecutionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExecutionId{} - - 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.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) - } - - if id.ExecutionName, ok = parsed.Parsed["executionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "executionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseExecutionIDInsensitively(input string) (*ExecutionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExecutionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ExecutionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - if id.ExecutionName, ok = parsed.Parsed["executionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "executionName", *parsed) + if id.ExecutionName, ok = input.Parsed["executionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "executionName", input) } - return &id, nil + return nil } // ValidateExecutionID checks that 'input' can be parsed as a Execution ID diff --git a/resource-manager/containerapps/2022-11-01-preview/jobs/id_job.go b/resource-manager/containerapps/2022-11-01-preview/jobs/id_job.go index db7d0d36e7c..6f9116f368f 100644 --- a/resource-manager/containerapps/2022-11-01-preview/jobs/id_job.go +++ b/resource-manager/containerapps/2022-11-01-preview/jobs/id_job.go @@ -36,19 +36,9 @@ func ParseJobID(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} - - 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.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseJobIDInsensitively(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *JobId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - return &id, nil + return nil } // ValidateJobID checks that 'input' can be parsed as a Job ID diff --git a/resource-manager/containerapps/2022-11-01-preview/managedcertificates/id_managedcertificate.go b/resource-manager/containerapps/2022-11-01-preview/managedcertificates/id_managedcertificate.go index 8b51df7abc8..d2be5b0f6fa 100644 --- a/resource-manager/containerapps/2022-11-01-preview/managedcertificates/id_managedcertificate.go +++ b/resource-manager/containerapps/2022-11-01-preview/managedcertificates/id_managedcertificate.go @@ -38,23 +38,9 @@ func ParseManagedCertificateID(input string) (*ManagedCertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedCertificateId{} - - 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.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) - } - - if id.ManagedCertificateName, ok = parsed.Parsed["managedCertificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedCertificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseManagedCertificateIDInsensitively(input string) (*ManagedCertificateId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedCertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ManagedCertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if id.ManagedEnvironmentName, ok = input.Parsed["managedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", input) } - if id.ManagedCertificateName, ok = parsed.Parsed["managedCertificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedCertificateName", *parsed) + if id.ManagedCertificateName, ok = input.Parsed["managedCertificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedCertificateName", input) } - return &id, nil + return nil } // ValidateManagedCertificateID checks that 'input' can be parsed as a Managed Certificate ID diff --git a/resource-manager/containerapps/2022-11-01-preview/managedcertificates/id_managedenvironment.go b/resource-manager/containerapps/2022-11-01-preview/managedcertificates/id_managedenvironment.go index 99064655653..4db47504bf2 100644 --- a/resource-manager/containerapps/2022-11-01-preview/managedcertificates/id_managedenvironment.go +++ b/resource-manager/containerapps/2022-11-01-preview/managedcertificates/id_managedenvironment.go @@ -36,19 +36,9 @@ func ParseManagedEnvironmentID(input string) (*ManagedEnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedEnvironmentId{} - - 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.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagedEnvironmentIDInsensitively(input string) (*ManagedEnvironmentId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedEnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagedEnvironmentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if id.ManagedEnvironmentName, ok = input.Parsed["managedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", input) } - return &id, nil + return nil } // ValidateManagedEnvironmentID checks that 'input' can be parsed as a Managed Environment ID diff --git a/resource-manager/containerapps/2022-11-01-preview/managedenvironments/id_certificate.go b/resource-manager/containerapps/2022-11-01-preview/managedenvironments/id_certificate.go index 05dfa0b7267..e62686ef744 100644 --- a/resource-manager/containerapps/2022-11-01-preview/managedenvironments/id_certificate.go +++ b/resource-manager/containerapps/2022-11-01-preview/managedenvironments/id_certificate.go @@ -38,23 +38,9 @@ func ParseCertificateID(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} - - 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.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) - } - - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCertificateIDInsensitively(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if id.ManagedEnvironmentName, ok = input.Parsed["managedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", input) } - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if id.CertificateName, ok = input.Parsed["certificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateName", input) } - return &id, nil + return nil } // ValidateCertificateID checks that 'input' can be parsed as a Certificate ID diff --git a/resource-manager/containerapps/2022-11-01-preview/managedenvironments/id_managedcertificate.go b/resource-manager/containerapps/2022-11-01-preview/managedenvironments/id_managedcertificate.go index e862ec48850..17686c0b4a4 100644 --- a/resource-manager/containerapps/2022-11-01-preview/managedenvironments/id_managedcertificate.go +++ b/resource-manager/containerapps/2022-11-01-preview/managedenvironments/id_managedcertificate.go @@ -38,23 +38,9 @@ func ParseManagedCertificateID(input string) (*ManagedCertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedCertificateId{} - - 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.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) - } - - if id.ManagedCertificateName, ok = parsed.Parsed["managedCertificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedCertificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseManagedCertificateIDInsensitively(input string) (*ManagedCertificateId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedCertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ManagedCertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if id.ManagedEnvironmentName, ok = input.Parsed["managedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", input) } - if id.ManagedCertificateName, ok = parsed.Parsed["managedCertificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedCertificateName", *parsed) + if id.ManagedCertificateName, ok = input.Parsed["managedCertificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedCertificateName", input) } - return &id, nil + return nil } // ValidateManagedCertificateID checks that 'input' can be parsed as a Managed Certificate ID diff --git a/resource-manager/containerapps/2022-11-01-preview/managedenvironments/id_managedenvironment.go b/resource-manager/containerapps/2022-11-01-preview/managedenvironments/id_managedenvironment.go index 52a50616de8..a803b6275e4 100644 --- a/resource-manager/containerapps/2022-11-01-preview/managedenvironments/id_managedenvironment.go +++ b/resource-manager/containerapps/2022-11-01-preview/managedenvironments/id_managedenvironment.go @@ -36,19 +36,9 @@ func ParseManagedEnvironmentID(input string) (*ManagedEnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedEnvironmentId{} - - 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.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagedEnvironmentIDInsensitively(input string) (*ManagedEnvironmentId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedEnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagedEnvironmentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if id.ManagedEnvironmentName, ok = input.Parsed["managedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", input) } - return &id, nil + return nil } // ValidateManagedEnvironmentID checks that 'input' can be parsed as a Managed Environment ID diff --git a/resource-manager/containerapps/2022-11-01-preview/managedenvironments/id_managedenvironmentdetector.go b/resource-manager/containerapps/2022-11-01-preview/managedenvironments/id_managedenvironmentdetector.go index b564dfc7b20..c10cc4a440e 100644 --- a/resource-manager/containerapps/2022-11-01-preview/managedenvironments/id_managedenvironmentdetector.go +++ b/resource-manager/containerapps/2022-11-01-preview/managedenvironments/id_managedenvironmentdetector.go @@ -38,23 +38,9 @@ func ParseManagedEnvironmentDetectorID(input string) (*ManagedEnvironmentDetecto return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedEnvironmentDetectorId{} - - 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.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) - } - - if id.DetectorName, ok = parsed.Parsed["detectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "detectorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseManagedEnvironmentDetectorIDInsensitively(input string) (*ManagedEnvir return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedEnvironmentDetectorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ManagedEnvironmentDetectorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if id.ManagedEnvironmentName, ok = input.Parsed["managedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", input) } - if id.DetectorName, ok = parsed.Parsed["detectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "detectorName", *parsed) + if id.DetectorName, ok = input.Parsed["detectorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "detectorName", input) } - return &id, nil + return nil } // ValidateManagedEnvironmentDetectorID checks that 'input' can be parsed as a Managed Environment Detector ID diff --git a/resource-manager/containerapps/2022-11-01-preview/managedenvironmentsstorages/id_managedenvironment.go b/resource-manager/containerapps/2022-11-01-preview/managedenvironmentsstorages/id_managedenvironment.go index 04633e9d25c..a5fb5cd82ac 100644 --- a/resource-manager/containerapps/2022-11-01-preview/managedenvironmentsstorages/id_managedenvironment.go +++ b/resource-manager/containerapps/2022-11-01-preview/managedenvironmentsstorages/id_managedenvironment.go @@ -36,19 +36,9 @@ func ParseManagedEnvironmentID(input string) (*ManagedEnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedEnvironmentId{} - - 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.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagedEnvironmentIDInsensitively(input string) (*ManagedEnvironmentId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedEnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagedEnvironmentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if id.ManagedEnvironmentName, ok = input.Parsed["managedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", input) } - return &id, nil + return nil } // ValidateManagedEnvironmentID checks that 'input' can be parsed as a Managed Environment ID diff --git a/resource-manager/containerapps/2022-11-01-preview/managedenvironmentsstorages/id_storage.go b/resource-manager/containerapps/2022-11-01-preview/managedenvironmentsstorages/id_storage.go index 6539b485321..f66f3604baa 100644 --- a/resource-manager/containerapps/2022-11-01-preview/managedenvironmentsstorages/id_storage.go +++ b/resource-manager/containerapps/2022-11-01-preview/managedenvironmentsstorages/id_storage.go @@ -38,23 +38,9 @@ func ParseStorageID(input string) (*StorageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageId{} - - 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.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) - } - - if id.StorageName, ok = parsed.Parsed["storageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseStorageIDInsensitively(input string) (*StorageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *StorageId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if id.ManagedEnvironmentName, ok = input.Parsed["managedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", input) } - if id.StorageName, ok = parsed.Parsed["storageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageName", *parsed) + if id.StorageName, ok = input.Parsed["storageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageName", input) } - return &id, nil + return nil } // ValidateStorageID checks that 'input' can be parsed as a Storage ID diff --git a/resource-manager/containerapps/2023-05-01/availableworkloadprofiles/id_location.go b/resource-manager/containerapps/2023-05-01/availableworkloadprofiles/id_location.go index 653767d948b..d311af81703 100644 --- a/resource-manager/containerapps/2023-05-01/availableworkloadprofiles/id_location.go +++ b/resource-manager/containerapps/2023-05-01/availableworkloadprofiles/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/containerapps/2023-05-01/billingmeters/id_location.go b/resource-manager/containerapps/2023-05-01/billingmeters/id_location.go index 06e3587d9ee..ce3d51fe5a8 100644 --- a/resource-manager/containerapps/2023-05-01/billingmeters/id_location.go +++ b/resource-manager/containerapps/2023-05-01/billingmeters/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/containerapps/2023-05-01/certificates/id_certificate.go b/resource-manager/containerapps/2023-05-01/certificates/id_certificate.go index fd232b2dd05..21b3813873f 100644 --- a/resource-manager/containerapps/2023-05-01/certificates/id_certificate.go +++ b/resource-manager/containerapps/2023-05-01/certificates/id_certificate.go @@ -38,23 +38,9 @@ func ParseCertificateID(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} - - 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.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) - } - - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCertificateIDInsensitively(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if id.ManagedEnvironmentName, ok = input.Parsed["managedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", input) } - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if id.CertificateName, ok = input.Parsed["certificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateName", input) } - return &id, nil + return nil } // ValidateCertificateID checks that 'input' can be parsed as a Certificate ID diff --git a/resource-manager/containerapps/2023-05-01/certificates/id_connectedenvironment.go b/resource-manager/containerapps/2023-05-01/certificates/id_connectedenvironment.go index 2a6232f173a..1650e188f4d 100644 --- a/resource-manager/containerapps/2023-05-01/certificates/id_connectedenvironment.go +++ b/resource-manager/containerapps/2023-05-01/certificates/id_connectedenvironment.go @@ -36,19 +36,9 @@ func ParseConnectedEnvironmentID(input string) (*ConnectedEnvironmentId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectedEnvironmentId{} - - 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.ConnectedEnvironmentName, ok = parsed.Parsed["connectedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectedEnvironmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseConnectedEnvironmentIDInsensitively(input string) (*ConnectedEnvironme return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectedEnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ConnectedEnvironmentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ConnectedEnvironmentName, ok = parsed.Parsed["connectedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectedEnvironmentName", *parsed) + if id.ConnectedEnvironmentName, ok = input.Parsed["connectedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectedEnvironmentName", input) } - return &id, nil + return nil } // ValidateConnectedEnvironmentID checks that 'input' can be parsed as a Connected Environment ID diff --git a/resource-manager/containerapps/2023-05-01/certificates/id_connectedenvironmentcertificate.go b/resource-manager/containerapps/2023-05-01/certificates/id_connectedenvironmentcertificate.go index 85a6c7db3d2..26feae01aca 100644 --- a/resource-manager/containerapps/2023-05-01/certificates/id_connectedenvironmentcertificate.go +++ b/resource-manager/containerapps/2023-05-01/certificates/id_connectedenvironmentcertificate.go @@ -38,23 +38,9 @@ func ParseConnectedEnvironmentCertificateID(input string) (*ConnectedEnvironment return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectedEnvironmentCertificateId{} - - 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.ConnectedEnvironmentName, ok = parsed.Parsed["connectedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectedEnvironmentName", *parsed) - } - - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConnectedEnvironmentCertificateIDInsensitively(input string) (*Connect return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectedEnvironmentCertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConnectedEnvironmentCertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ConnectedEnvironmentName, ok = parsed.Parsed["connectedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectedEnvironmentName", *parsed) + if id.ConnectedEnvironmentName, ok = input.Parsed["connectedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectedEnvironmentName", input) } - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if id.CertificateName, ok = input.Parsed["certificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateName", input) } - return &id, nil + return nil } // ValidateConnectedEnvironmentCertificateID checks that 'input' can be parsed as a Connected Environment Certificate ID diff --git a/resource-manager/containerapps/2023-05-01/certificates/id_managedenvironment.go b/resource-manager/containerapps/2023-05-01/certificates/id_managedenvironment.go index 5301e3cbf40..dce7709f9a5 100644 --- a/resource-manager/containerapps/2023-05-01/certificates/id_managedenvironment.go +++ b/resource-manager/containerapps/2023-05-01/certificates/id_managedenvironment.go @@ -36,19 +36,9 @@ func ParseManagedEnvironmentID(input string) (*ManagedEnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedEnvironmentId{} - - 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.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagedEnvironmentIDInsensitively(input string) (*ManagedEnvironmentId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedEnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagedEnvironmentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if id.ManagedEnvironmentName, ok = input.Parsed["managedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", input) } - return &id, nil + return nil } // ValidateManagedEnvironmentID checks that 'input' can be parsed as a Managed Environment ID diff --git a/resource-manager/containerapps/2023-05-01/connectedenvironments/id_connectedenvironment.go b/resource-manager/containerapps/2023-05-01/connectedenvironments/id_connectedenvironment.go index 49698696b38..bc545cd11d7 100644 --- a/resource-manager/containerapps/2023-05-01/connectedenvironments/id_connectedenvironment.go +++ b/resource-manager/containerapps/2023-05-01/connectedenvironments/id_connectedenvironment.go @@ -36,19 +36,9 @@ func ParseConnectedEnvironmentID(input string) (*ConnectedEnvironmentId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectedEnvironmentId{} - - 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.ConnectedEnvironmentName, ok = parsed.Parsed["connectedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectedEnvironmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseConnectedEnvironmentIDInsensitively(input string) (*ConnectedEnvironme return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectedEnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ConnectedEnvironmentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ConnectedEnvironmentName, ok = parsed.Parsed["connectedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectedEnvironmentName", *parsed) + if id.ConnectedEnvironmentName, ok = input.Parsed["connectedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectedEnvironmentName", input) } - return &id, nil + return nil } // ValidateConnectedEnvironmentID checks that 'input' can be parsed as a Connected Environment ID diff --git a/resource-manager/containerapps/2023-05-01/connectedenvironments/id_connectedenvironmentcertificate.go b/resource-manager/containerapps/2023-05-01/connectedenvironments/id_connectedenvironmentcertificate.go index e1316bfb3c6..1cc2138d328 100644 --- a/resource-manager/containerapps/2023-05-01/connectedenvironments/id_connectedenvironmentcertificate.go +++ b/resource-manager/containerapps/2023-05-01/connectedenvironments/id_connectedenvironmentcertificate.go @@ -38,23 +38,9 @@ func ParseConnectedEnvironmentCertificateID(input string) (*ConnectedEnvironment return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectedEnvironmentCertificateId{} - - 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.ConnectedEnvironmentName, ok = parsed.Parsed["connectedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectedEnvironmentName", *parsed) - } - - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConnectedEnvironmentCertificateIDInsensitively(input string) (*Connect return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectedEnvironmentCertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConnectedEnvironmentCertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ConnectedEnvironmentName, ok = parsed.Parsed["connectedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectedEnvironmentName", *parsed) + if id.ConnectedEnvironmentName, ok = input.Parsed["connectedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectedEnvironmentName", input) } - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if id.CertificateName, ok = input.Parsed["certificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateName", input) } - return &id, nil + return nil } // ValidateConnectedEnvironmentCertificateID checks that 'input' can be parsed as a Connected Environment Certificate ID diff --git a/resource-manager/containerapps/2023-05-01/connectedenvironmentsstorages/id_connectedenvironment.go b/resource-manager/containerapps/2023-05-01/connectedenvironmentsstorages/id_connectedenvironment.go index f32c825e4ed..b95cf408568 100644 --- a/resource-manager/containerapps/2023-05-01/connectedenvironmentsstorages/id_connectedenvironment.go +++ b/resource-manager/containerapps/2023-05-01/connectedenvironmentsstorages/id_connectedenvironment.go @@ -36,19 +36,9 @@ func ParseConnectedEnvironmentID(input string) (*ConnectedEnvironmentId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectedEnvironmentId{} - - 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.ConnectedEnvironmentName, ok = parsed.Parsed["connectedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectedEnvironmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseConnectedEnvironmentIDInsensitively(input string) (*ConnectedEnvironme return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectedEnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ConnectedEnvironmentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ConnectedEnvironmentName, ok = parsed.Parsed["connectedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectedEnvironmentName", *parsed) + if id.ConnectedEnvironmentName, ok = input.Parsed["connectedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectedEnvironmentName", input) } - return &id, nil + return nil } // ValidateConnectedEnvironmentID checks that 'input' can be parsed as a Connected Environment ID diff --git a/resource-manager/containerapps/2023-05-01/connectedenvironmentsstorages/id_connectedenvironmentstorage.go b/resource-manager/containerapps/2023-05-01/connectedenvironmentsstorages/id_connectedenvironmentstorage.go index aa82c7c397e..1a4e8c5e542 100644 --- a/resource-manager/containerapps/2023-05-01/connectedenvironmentsstorages/id_connectedenvironmentstorage.go +++ b/resource-manager/containerapps/2023-05-01/connectedenvironmentsstorages/id_connectedenvironmentstorage.go @@ -38,23 +38,9 @@ func ParseConnectedEnvironmentStorageID(input string) (*ConnectedEnvironmentStor return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectedEnvironmentStorageId{} - - 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.ConnectedEnvironmentName, ok = parsed.Parsed["connectedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectedEnvironmentName", *parsed) - } - - if id.StorageName, ok = parsed.Parsed["storageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConnectedEnvironmentStorageIDInsensitively(input string) (*ConnectedEn return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectedEnvironmentStorageId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConnectedEnvironmentStorageId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ConnectedEnvironmentName, ok = parsed.Parsed["connectedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectedEnvironmentName", *parsed) + if id.ConnectedEnvironmentName, ok = input.Parsed["connectedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectedEnvironmentName", input) } - if id.StorageName, ok = parsed.Parsed["storageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageName", *parsed) + if id.StorageName, ok = input.Parsed["storageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageName", input) } - return &id, nil + return nil } // ValidateConnectedEnvironmentStorageID checks that 'input' can be parsed as a Connected Environment Storage ID diff --git a/resource-manager/containerapps/2023-05-01/containerapps/id_containerapp.go b/resource-manager/containerapps/2023-05-01/containerapps/id_containerapp.go index bec76c9d8cd..b5cb92a4826 100644 --- a/resource-manager/containerapps/2023-05-01/containerapps/id_containerapp.go +++ b/resource-manager/containerapps/2023-05-01/containerapps/id_containerapp.go @@ -36,19 +36,9 @@ func ParseContainerAppID(input string) (*ContainerAppId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerAppId{} - - 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.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseContainerAppIDInsensitively(input string) (*ContainerAppId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerAppId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ContainerAppId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if id.ContainerAppName, ok = input.Parsed["containerAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", input) } - return &id, nil + return nil } // ValidateContainerAppID checks that 'input' can be parsed as a Container App ID diff --git a/resource-manager/containerapps/2023-05-01/containerapps/id_detector.go b/resource-manager/containerapps/2023-05-01/containerapps/id_detector.go index e0635c42772..f868c0e9e85 100644 --- a/resource-manager/containerapps/2023-05-01/containerapps/id_detector.go +++ b/resource-manager/containerapps/2023-05-01/containerapps/id_detector.go @@ -38,23 +38,9 @@ func ParseDetectorID(input string) (*DetectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DetectorId{} - - 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.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) - } - - if id.DetectorName, ok = parsed.Parsed["detectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "detectorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDetectorIDInsensitively(input string) (*DetectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DetectorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DetectorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if id.ContainerAppName, ok = input.Parsed["containerAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", input) } - if id.DetectorName, ok = parsed.Parsed["detectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "detectorName", *parsed) + if id.DetectorName, ok = input.Parsed["detectorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "detectorName", input) } - return &id, nil + return nil } // ValidateDetectorID checks that 'input' can be parsed as a Detector ID diff --git a/resource-manager/containerapps/2023-05-01/containerapps/id_revisionsapirevision.go b/resource-manager/containerapps/2023-05-01/containerapps/id_revisionsapirevision.go index a46f51fe65e..384d409993a 100644 --- a/resource-manager/containerapps/2023-05-01/containerapps/id_revisionsapirevision.go +++ b/resource-manager/containerapps/2023-05-01/containerapps/id_revisionsapirevision.go @@ -38,23 +38,9 @@ func ParseRevisionsApiRevisionID(input string) (*RevisionsApiRevisionId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RevisionsApiRevisionId{} - - 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.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) - } - - if id.RevisionName, ok = parsed.Parsed["revisionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "revisionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRevisionsApiRevisionIDInsensitively(input string) (*RevisionsApiRevisi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RevisionsApiRevisionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RevisionsApiRevisionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if id.ContainerAppName, ok = input.Parsed["containerAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", input) } - if id.RevisionName, ok = parsed.Parsed["revisionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "revisionName", *parsed) + if id.RevisionName, ok = input.Parsed["revisionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "revisionName", input) } - return &id, nil + return nil } // ValidateRevisionsApiRevisionID checks that 'input' can be parsed as a Revisions Api Revision ID diff --git a/resource-manager/containerapps/2023-05-01/containerappsauthconfigs/id_authconfig.go b/resource-manager/containerapps/2023-05-01/containerappsauthconfigs/id_authconfig.go index 29de8fd3278..b4b6adb350c 100644 --- a/resource-manager/containerapps/2023-05-01/containerappsauthconfigs/id_authconfig.go +++ b/resource-manager/containerapps/2023-05-01/containerappsauthconfigs/id_authconfig.go @@ -38,23 +38,9 @@ func ParseAuthConfigID(input string) (*AuthConfigId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthConfigId{} - - 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.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) - } - - if id.AuthConfigName, ok = parsed.Parsed["authConfigName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authConfigName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAuthConfigIDInsensitively(input string) (*AuthConfigId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthConfigId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AuthConfigId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if id.ContainerAppName, ok = input.Parsed["containerAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", input) } - if id.AuthConfigName, ok = parsed.Parsed["authConfigName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authConfigName", *parsed) + if id.AuthConfigName, ok = input.Parsed["authConfigName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authConfigName", input) } - return &id, nil + return nil } // ValidateAuthConfigID checks that 'input' can be parsed as a Auth Config ID diff --git a/resource-manager/containerapps/2023-05-01/containerappsauthconfigs/id_containerapp.go b/resource-manager/containerapps/2023-05-01/containerappsauthconfigs/id_containerapp.go index ebac43ec5e7..fc569300b37 100644 --- a/resource-manager/containerapps/2023-05-01/containerappsauthconfigs/id_containerapp.go +++ b/resource-manager/containerapps/2023-05-01/containerappsauthconfigs/id_containerapp.go @@ -36,19 +36,9 @@ func ParseContainerAppID(input string) (*ContainerAppId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerAppId{} - - 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.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseContainerAppIDInsensitively(input string) (*ContainerAppId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerAppId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ContainerAppId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if id.ContainerAppName, ok = input.Parsed["containerAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", input) } - return &id, nil + return nil } // ValidateContainerAppID checks that 'input' can be parsed as a Container App ID diff --git a/resource-manager/containerapps/2023-05-01/containerappsrevisionreplicas/id_replica.go b/resource-manager/containerapps/2023-05-01/containerappsrevisionreplicas/id_replica.go index ed6455be6dd..9afa046bdf6 100644 --- a/resource-manager/containerapps/2023-05-01/containerappsrevisionreplicas/id_replica.go +++ b/resource-manager/containerapps/2023-05-01/containerappsrevisionreplicas/id_replica.go @@ -40,27 +40,9 @@ func ParseReplicaID(input string) (*ReplicaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicaId{} - - 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.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) - } - - if id.RevisionName, ok = parsed.Parsed["revisionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "revisionName", *parsed) - } - - if id.ReplicaName, ok = parsed.Parsed["replicaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicaName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicaIDInsensitively(input string) (*ReplicaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicaId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicaId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if id.ContainerAppName, ok = input.Parsed["containerAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", input) } - if id.RevisionName, ok = parsed.Parsed["revisionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "revisionName", *parsed) + if id.RevisionName, ok = input.Parsed["revisionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "revisionName", input) } - if id.ReplicaName, ok = parsed.Parsed["replicaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicaName", *parsed) + if id.ReplicaName, ok = input.Parsed["replicaName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicaName", input) } - return &id, nil + return nil } // ValidateReplicaID checks that 'input' can be parsed as a Replica ID diff --git a/resource-manager/containerapps/2023-05-01/containerappsrevisionreplicas/id_revision.go b/resource-manager/containerapps/2023-05-01/containerappsrevisionreplicas/id_revision.go index 4840b9a4d4a..e4a73ba207a 100644 --- a/resource-manager/containerapps/2023-05-01/containerappsrevisionreplicas/id_revision.go +++ b/resource-manager/containerapps/2023-05-01/containerappsrevisionreplicas/id_revision.go @@ -38,23 +38,9 @@ func ParseRevisionID(input string) (*RevisionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RevisionId{} - - 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.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) - } - - if id.RevisionName, ok = parsed.Parsed["revisionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "revisionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRevisionIDInsensitively(input string) (*RevisionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RevisionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RevisionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if id.ContainerAppName, ok = input.Parsed["containerAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", input) } - if id.RevisionName, ok = parsed.Parsed["revisionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "revisionName", *parsed) + if id.RevisionName, ok = input.Parsed["revisionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "revisionName", input) } - return &id, nil + return nil } // ValidateRevisionID checks that 'input' can be parsed as a Revision ID diff --git a/resource-manager/containerapps/2023-05-01/containerappsrevisions/id_containerapp.go b/resource-manager/containerapps/2023-05-01/containerappsrevisions/id_containerapp.go index 0c58f29a8e4..3931986b1de 100644 --- a/resource-manager/containerapps/2023-05-01/containerappsrevisions/id_containerapp.go +++ b/resource-manager/containerapps/2023-05-01/containerappsrevisions/id_containerapp.go @@ -36,19 +36,9 @@ func ParseContainerAppID(input string) (*ContainerAppId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerAppId{} - - 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.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseContainerAppIDInsensitively(input string) (*ContainerAppId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerAppId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ContainerAppId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if id.ContainerAppName, ok = input.Parsed["containerAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", input) } - return &id, nil + return nil } // ValidateContainerAppID checks that 'input' can be parsed as a Container App ID diff --git a/resource-manager/containerapps/2023-05-01/containerappsrevisions/id_revision.go b/resource-manager/containerapps/2023-05-01/containerappsrevisions/id_revision.go index 3afb0fa480f..2183bef32af 100644 --- a/resource-manager/containerapps/2023-05-01/containerappsrevisions/id_revision.go +++ b/resource-manager/containerapps/2023-05-01/containerappsrevisions/id_revision.go @@ -38,23 +38,9 @@ func ParseRevisionID(input string) (*RevisionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RevisionId{} - - 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.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) - } - - if id.RevisionName, ok = parsed.Parsed["revisionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "revisionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRevisionIDInsensitively(input string) (*RevisionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RevisionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RevisionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if id.ContainerAppName, ok = input.Parsed["containerAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", input) } - if id.RevisionName, ok = parsed.Parsed["revisionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "revisionName", *parsed) + if id.RevisionName, ok = input.Parsed["revisionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "revisionName", input) } - return &id, nil + return nil } // ValidateRevisionID checks that 'input' can be parsed as a Revision ID diff --git a/resource-manager/containerapps/2023-05-01/containerappssourcecontrols/id_containerapp.go b/resource-manager/containerapps/2023-05-01/containerappssourcecontrols/id_containerapp.go index 6b1e707a2e3..2638a59e6b2 100644 --- a/resource-manager/containerapps/2023-05-01/containerappssourcecontrols/id_containerapp.go +++ b/resource-manager/containerapps/2023-05-01/containerappssourcecontrols/id_containerapp.go @@ -36,19 +36,9 @@ func ParseContainerAppID(input string) (*ContainerAppId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerAppId{} - - 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.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseContainerAppIDInsensitively(input string) (*ContainerAppId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerAppId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ContainerAppId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if id.ContainerAppName, ok = input.Parsed["containerAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", input) } - return &id, nil + return nil } // ValidateContainerAppID checks that 'input' can be parsed as a Container App ID diff --git a/resource-manager/containerapps/2023-05-01/containerappssourcecontrols/id_sourcecontrol.go b/resource-manager/containerapps/2023-05-01/containerappssourcecontrols/id_sourcecontrol.go index 5fc6fd24354..cb683ccc787 100644 --- a/resource-manager/containerapps/2023-05-01/containerappssourcecontrols/id_sourcecontrol.go +++ b/resource-manager/containerapps/2023-05-01/containerappssourcecontrols/id_sourcecontrol.go @@ -38,23 +38,9 @@ func ParseSourceControlID(input string) (*SourceControlId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlId{} - - 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.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) - } - - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSourceControlIDInsensitively(input string) (*SourceControlId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SourceControlId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if id.ContainerAppName, ok = input.Parsed["containerAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", input) } - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) + if id.SourceControlName, ok = input.Parsed["sourceControlName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", input) } - return &id, nil + return nil } // ValidateSourceControlID checks that 'input' can be parsed as a Source Control ID diff --git a/resource-manager/containerapps/2023-05-01/daprcomponents/id_connectedenvironment.go b/resource-manager/containerapps/2023-05-01/daprcomponents/id_connectedenvironment.go index ac0bd53cbd0..4713405982f 100644 --- a/resource-manager/containerapps/2023-05-01/daprcomponents/id_connectedenvironment.go +++ b/resource-manager/containerapps/2023-05-01/daprcomponents/id_connectedenvironment.go @@ -36,19 +36,9 @@ func ParseConnectedEnvironmentID(input string) (*ConnectedEnvironmentId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectedEnvironmentId{} - - 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.ConnectedEnvironmentName, ok = parsed.Parsed["connectedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectedEnvironmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseConnectedEnvironmentIDInsensitively(input string) (*ConnectedEnvironme return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectedEnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ConnectedEnvironmentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ConnectedEnvironmentName, ok = parsed.Parsed["connectedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectedEnvironmentName", *parsed) + if id.ConnectedEnvironmentName, ok = input.Parsed["connectedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectedEnvironmentName", input) } - return &id, nil + return nil } // ValidateConnectedEnvironmentID checks that 'input' can be parsed as a Connected Environment ID diff --git a/resource-manager/containerapps/2023-05-01/daprcomponents/id_connectedenvironmentdaprcomponent.go b/resource-manager/containerapps/2023-05-01/daprcomponents/id_connectedenvironmentdaprcomponent.go index ee117ae73ec..677df196b68 100644 --- a/resource-manager/containerapps/2023-05-01/daprcomponents/id_connectedenvironmentdaprcomponent.go +++ b/resource-manager/containerapps/2023-05-01/daprcomponents/id_connectedenvironmentdaprcomponent.go @@ -38,23 +38,9 @@ func ParseConnectedEnvironmentDaprComponentID(input string) (*ConnectedEnvironme return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectedEnvironmentDaprComponentId{} - - 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.ConnectedEnvironmentName, ok = parsed.Parsed["connectedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectedEnvironmentName", *parsed) - } - - if id.DaprComponentName, ok = parsed.Parsed["daprComponentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "daprComponentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConnectedEnvironmentDaprComponentIDInsensitively(input string) (*Conne return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectedEnvironmentDaprComponentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConnectedEnvironmentDaprComponentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ConnectedEnvironmentName, ok = parsed.Parsed["connectedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectedEnvironmentName", *parsed) + if id.ConnectedEnvironmentName, ok = input.Parsed["connectedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectedEnvironmentName", input) } - if id.DaprComponentName, ok = parsed.Parsed["daprComponentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "daprComponentName", *parsed) + if id.DaprComponentName, ok = input.Parsed["daprComponentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "daprComponentName", input) } - return &id, nil + return nil } // ValidateConnectedEnvironmentDaprComponentID checks that 'input' can be parsed as a Connected Environment Dapr Component ID diff --git a/resource-manager/containerapps/2023-05-01/daprcomponents/id_daprcomponent.go b/resource-manager/containerapps/2023-05-01/daprcomponents/id_daprcomponent.go index 490cdc8217d..fb0b153db56 100644 --- a/resource-manager/containerapps/2023-05-01/daprcomponents/id_daprcomponent.go +++ b/resource-manager/containerapps/2023-05-01/daprcomponents/id_daprcomponent.go @@ -38,23 +38,9 @@ func ParseDaprComponentID(input string) (*DaprComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DaprComponentId{} - - 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.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) - } - - if id.DaprComponentName, ok = parsed.Parsed["daprComponentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "daprComponentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDaprComponentIDInsensitively(input string) (*DaprComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DaprComponentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DaprComponentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if id.ManagedEnvironmentName, ok = input.Parsed["managedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", input) } - if id.DaprComponentName, ok = parsed.Parsed["daprComponentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "daprComponentName", *parsed) + if id.DaprComponentName, ok = input.Parsed["daprComponentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "daprComponentName", input) } - return &id, nil + return nil } // ValidateDaprComponentID checks that 'input' can be parsed as a Dapr Component ID diff --git a/resource-manager/containerapps/2023-05-01/daprcomponents/id_managedenvironment.go b/resource-manager/containerapps/2023-05-01/daprcomponents/id_managedenvironment.go index 550d5ac0ba9..2337e0c4eac 100644 --- a/resource-manager/containerapps/2023-05-01/daprcomponents/id_managedenvironment.go +++ b/resource-manager/containerapps/2023-05-01/daprcomponents/id_managedenvironment.go @@ -36,19 +36,9 @@ func ParseManagedEnvironmentID(input string) (*ManagedEnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedEnvironmentId{} - - 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.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagedEnvironmentIDInsensitively(input string) (*ManagedEnvironmentId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedEnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagedEnvironmentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if id.ManagedEnvironmentName, ok = input.Parsed["managedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", input) } - return &id, nil + return nil } // ValidateManagedEnvironmentID checks that 'input' can be parsed as a Managed Environment ID diff --git a/resource-manager/containerapps/2023-05-01/diagnostics/id_containerapp.go b/resource-manager/containerapps/2023-05-01/diagnostics/id_containerapp.go index 0583b69b8c3..eaac16cb38d 100644 --- a/resource-manager/containerapps/2023-05-01/diagnostics/id_containerapp.go +++ b/resource-manager/containerapps/2023-05-01/diagnostics/id_containerapp.go @@ -36,19 +36,9 @@ func ParseContainerAppID(input string) (*ContainerAppId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerAppId{} - - 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.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseContainerAppIDInsensitively(input string) (*ContainerAppId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerAppId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ContainerAppId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if id.ContainerAppName, ok = input.Parsed["containerAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", input) } - return &id, nil + return nil } // ValidateContainerAppID checks that 'input' can be parsed as a Container App ID diff --git a/resource-manager/containerapps/2023-05-01/diagnostics/id_detector.go b/resource-manager/containerapps/2023-05-01/diagnostics/id_detector.go index bd3f03c3672..88a4c2b70f1 100644 --- a/resource-manager/containerapps/2023-05-01/diagnostics/id_detector.go +++ b/resource-manager/containerapps/2023-05-01/diagnostics/id_detector.go @@ -38,23 +38,9 @@ func ParseDetectorID(input string) (*DetectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DetectorId{} - - 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.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) - } - - if id.DetectorName, ok = parsed.Parsed["detectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "detectorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDetectorIDInsensitively(input string) (*DetectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DetectorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DetectorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if id.ContainerAppName, ok = input.Parsed["containerAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", input) } - if id.DetectorName, ok = parsed.Parsed["detectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "detectorName", *parsed) + if id.DetectorName, ok = input.Parsed["detectorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "detectorName", input) } - return &id, nil + return nil } // ValidateDetectorID checks that 'input' can be parsed as a Detector ID diff --git a/resource-manager/containerapps/2023-05-01/diagnostics/id_managedenvironment.go b/resource-manager/containerapps/2023-05-01/diagnostics/id_managedenvironment.go index 1585d25ab9b..5c773db9da9 100644 --- a/resource-manager/containerapps/2023-05-01/diagnostics/id_managedenvironment.go +++ b/resource-manager/containerapps/2023-05-01/diagnostics/id_managedenvironment.go @@ -36,19 +36,9 @@ func ParseManagedEnvironmentID(input string) (*ManagedEnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedEnvironmentId{} - - 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.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagedEnvironmentIDInsensitively(input string) (*ManagedEnvironmentId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedEnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagedEnvironmentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if id.ManagedEnvironmentName, ok = input.Parsed["managedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", input) } - return &id, nil + return nil } // ValidateManagedEnvironmentID checks that 'input' can be parsed as a Managed Environment ID diff --git a/resource-manager/containerapps/2023-05-01/diagnostics/id_managedenvironmentdetector.go b/resource-manager/containerapps/2023-05-01/diagnostics/id_managedenvironmentdetector.go index f7a0776d31d..86e45e85157 100644 --- a/resource-manager/containerapps/2023-05-01/diagnostics/id_managedenvironmentdetector.go +++ b/resource-manager/containerapps/2023-05-01/diagnostics/id_managedenvironmentdetector.go @@ -38,23 +38,9 @@ func ParseManagedEnvironmentDetectorID(input string) (*ManagedEnvironmentDetecto return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedEnvironmentDetectorId{} - - 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.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) - } - - if id.DetectorName, ok = parsed.Parsed["detectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "detectorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseManagedEnvironmentDetectorIDInsensitively(input string) (*ManagedEnvir return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedEnvironmentDetectorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ManagedEnvironmentDetectorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if id.ManagedEnvironmentName, ok = input.Parsed["managedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", input) } - if id.DetectorName, ok = parsed.Parsed["detectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "detectorName", *parsed) + if id.DetectorName, ok = input.Parsed["detectorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "detectorName", input) } - return &id, nil + return nil } // ValidateManagedEnvironmentDetectorID checks that 'input' can be parsed as a Managed Environment Detector ID diff --git a/resource-manager/containerapps/2023-05-01/diagnostics/id_revisionsapirevision.go b/resource-manager/containerapps/2023-05-01/diagnostics/id_revisionsapirevision.go index a7ba7b1ac66..1a607cec7d8 100644 --- a/resource-manager/containerapps/2023-05-01/diagnostics/id_revisionsapirevision.go +++ b/resource-manager/containerapps/2023-05-01/diagnostics/id_revisionsapirevision.go @@ -38,23 +38,9 @@ func ParseRevisionsApiRevisionID(input string) (*RevisionsApiRevisionId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RevisionsApiRevisionId{} - - 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.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) - } - - if id.RevisionName, ok = parsed.Parsed["revisionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "revisionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRevisionsApiRevisionIDInsensitively(input string) (*RevisionsApiRevisi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RevisionsApiRevisionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RevisionsApiRevisionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if id.ContainerAppName, ok = input.Parsed["containerAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", input) } - if id.RevisionName, ok = parsed.Parsed["revisionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "revisionName", *parsed) + if id.RevisionName, ok = input.Parsed["revisionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "revisionName", input) } - return &id, nil + return nil } // ValidateRevisionsApiRevisionID checks that 'input' can be parsed as a Revisions Api Revision ID diff --git a/resource-manager/containerapps/2023-05-01/jobs/id_execution.go b/resource-manager/containerapps/2023-05-01/jobs/id_execution.go index 1a4840084b8..2bdfd0181c7 100644 --- a/resource-manager/containerapps/2023-05-01/jobs/id_execution.go +++ b/resource-manager/containerapps/2023-05-01/jobs/id_execution.go @@ -38,23 +38,9 @@ func ParseExecutionID(input string) (*ExecutionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExecutionId{} - - 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.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) - } - - if id.ExecutionName, ok = parsed.Parsed["executionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "executionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseExecutionIDInsensitively(input string) (*ExecutionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExecutionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ExecutionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - if id.ExecutionName, ok = parsed.Parsed["executionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "executionName", *parsed) + if id.ExecutionName, ok = input.Parsed["executionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "executionName", input) } - return &id, nil + return nil } // ValidateExecutionID checks that 'input' can be parsed as a Execution ID diff --git a/resource-manager/containerapps/2023-05-01/jobs/id_job.go b/resource-manager/containerapps/2023-05-01/jobs/id_job.go index db7d0d36e7c..6f9116f368f 100644 --- a/resource-manager/containerapps/2023-05-01/jobs/id_job.go +++ b/resource-manager/containerapps/2023-05-01/jobs/id_job.go @@ -36,19 +36,9 @@ func ParseJobID(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} - - 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.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseJobIDInsensitively(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *JobId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - return &id, nil + return nil } // ValidateJobID checks that 'input' can be parsed as a Job ID diff --git a/resource-manager/containerapps/2023-05-01/managedcertificates/id_managedcertificate.go b/resource-manager/containerapps/2023-05-01/managedcertificates/id_managedcertificate.go index 8b51df7abc8..d2be5b0f6fa 100644 --- a/resource-manager/containerapps/2023-05-01/managedcertificates/id_managedcertificate.go +++ b/resource-manager/containerapps/2023-05-01/managedcertificates/id_managedcertificate.go @@ -38,23 +38,9 @@ func ParseManagedCertificateID(input string) (*ManagedCertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedCertificateId{} - - 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.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) - } - - if id.ManagedCertificateName, ok = parsed.Parsed["managedCertificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedCertificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseManagedCertificateIDInsensitively(input string) (*ManagedCertificateId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedCertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ManagedCertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if id.ManagedEnvironmentName, ok = input.Parsed["managedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", input) } - if id.ManagedCertificateName, ok = parsed.Parsed["managedCertificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedCertificateName", *parsed) + if id.ManagedCertificateName, ok = input.Parsed["managedCertificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedCertificateName", input) } - return &id, nil + return nil } // ValidateManagedCertificateID checks that 'input' can be parsed as a Managed Certificate ID diff --git a/resource-manager/containerapps/2023-05-01/managedcertificates/id_managedenvironment.go b/resource-manager/containerapps/2023-05-01/managedcertificates/id_managedenvironment.go index 99064655653..4db47504bf2 100644 --- a/resource-manager/containerapps/2023-05-01/managedcertificates/id_managedenvironment.go +++ b/resource-manager/containerapps/2023-05-01/managedcertificates/id_managedenvironment.go @@ -36,19 +36,9 @@ func ParseManagedEnvironmentID(input string) (*ManagedEnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedEnvironmentId{} - - 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.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagedEnvironmentIDInsensitively(input string) (*ManagedEnvironmentId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedEnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagedEnvironmentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if id.ManagedEnvironmentName, ok = input.Parsed["managedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", input) } - return &id, nil + return nil } // ValidateManagedEnvironmentID checks that 'input' can be parsed as a Managed Environment ID diff --git a/resource-manager/containerapps/2023-05-01/managedenvironments/id_certificate.go b/resource-manager/containerapps/2023-05-01/managedenvironments/id_certificate.go index 05dfa0b7267..e62686ef744 100644 --- a/resource-manager/containerapps/2023-05-01/managedenvironments/id_certificate.go +++ b/resource-manager/containerapps/2023-05-01/managedenvironments/id_certificate.go @@ -38,23 +38,9 @@ func ParseCertificateID(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} - - 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.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) - } - - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCertificateIDInsensitively(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if id.ManagedEnvironmentName, ok = input.Parsed["managedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", input) } - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if id.CertificateName, ok = input.Parsed["certificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateName", input) } - return &id, nil + return nil } // ValidateCertificateID checks that 'input' can be parsed as a Certificate ID diff --git a/resource-manager/containerapps/2023-05-01/managedenvironments/id_managedcertificate.go b/resource-manager/containerapps/2023-05-01/managedenvironments/id_managedcertificate.go index e862ec48850..17686c0b4a4 100644 --- a/resource-manager/containerapps/2023-05-01/managedenvironments/id_managedcertificate.go +++ b/resource-manager/containerapps/2023-05-01/managedenvironments/id_managedcertificate.go @@ -38,23 +38,9 @@ func ParseManagedCertificateID(input string) (*ManagedCertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedCertificateId{} - - 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.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) - } - - if id.ManagedCertificateName, ok = parsed.Parsed["managedCertificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedCertificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseManagedCertificateIDInsensitively(input string) (*ManagedCertificateId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedCertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ManagedCertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if id.ManagedEnvironmentName, ok = input.Parsed["managedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", input) } - if id.ManagedCertificateName, ok = parsed.Parsed["managedCertificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedCertificateName", *parsed) + if id.ManagedCertificateName, ok = input.Parsed["managedCertificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedCertificateName", input) } - return &id, nil + return nil } // ValidateManagedCertificateID checks that 'input' can be parsed as a Managed Certificate ID diff --git a/resource-manager/containerapps/2023-05-01/managedenvironments/id_managedenvironment.go b/resource-manager/containerapps/2023-05-01/managedenvironments/id_managedenvironment.go index 52a50616de8..a803b6275e4 100644 --- a/resource-manager/containerapps/2023-05-01/managedenvironments/id_managedenvironment.go +++ b/resource-manager/containerapps/2023-05-01/managedenvironments/id_managedenvironment.go @@ -36,19 +36,9 @@ func ParseManagedEnvironmentID(input string) (*ManagedEnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedEnvironmentId{} - - 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.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagedEnvironmentIDInsensitively(input string) (*ManagedEnvironmentId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedEnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagedEnvironmentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if id.ManagedEnvironmentName, ok = input.Parsed["managedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", input) } - return &id, nil + return nil } // ValidateManagedEnvironmentID checks that 'input' can be parsed as a Managed Environment ID diff --git a/resource-manager/containerapps/2023-05-01/managedenvironments/id_managedenvironmentdetector.go b/resource-manager/containerapps/2023-05-01/managedenvironments/id_managedenvironmentdetector.go index b564dfc7b20..c10cc4a440e 100644 --- a/resource-manager/containerapps/2023-05-01/managedenvironments/id_managedenvironmentdetector.go +++ b/resource-manager/containerapps/2023-05-01/managedenvironments/id_managedenvironmentdetector.go @@ -38,23 +38,9 @@ func ParseManagedEnvironmentDetectorID(input string) (*ManagedEnvironmentDetecto return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedEnvironmentDetectorId{} - - 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.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) - } - - if id.DetectorName, ok = parsed.Parsed["detectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "detectorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseManagedEnvironmentDetectorIDInsensitively(input string) (*ManagedEnvir return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedEnvironmentDetectorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ManagedEnvironmentDetectorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if id.ManagedEnvironmentName, ok = input.Parsed["managedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", input) } - if id.DetectorName, ok = parsed.Parsed["detectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "detectorName", *parsed) + if id.DetectorName, ok = input.Parsed["detectorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "detectorName", input) } - return &id, nil + return nil } // ValidateManagedEnvironmentDetectorID checks that 'input' can be parsed as a Managed Environment Detector ID diff --git a/resource-manager/containerapps/2023-05-01/managedenvironmentsstorages/id_managedenvironment.go b/resource-manager/containerapps/2023-05-01/managedenvironmentsstorages/id_managedenvironment.go index 04633e9d25c..a5fb5cd82ac 100644 --- a/resource-manager/containerapps/2023-05-01/managedenvironmentsstorages/id_managedenvironment.go +++ b/resource-manager/containerapps/2023-05-01/managedenvironmentsstorages/id_managedenvironment.go @@ -36,19 +36,9 @@ func ParseManagedEnvironmentID(input string) (*ManagedEnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedEnvironmentId{} - - 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.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagedEnvironmentIDInsensitively(input string) (*ManagedEnvironmentId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedEnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagedEnvironmentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if id.ManagedEnvironmentName, ok = input.Parsed["managedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", input) } - return &id, nil + return nil } // ValidateManagedEnvironmentID checks that 'input' can be parsed as a Managed Environment ID diff --git a/resource-manager/containerapps/2023-05-01/managedenvironmentsstorages/id_storage.go b/resource-manager/containerapps/2023-05-01/managedenvironmentsstorages/id_storage.go index 6539b485321..f66f3604baa 100644 --- a/resource-manager/containerapps/2023-05-01/managedenvironmentsstorages/id_storage.go +++ b/resource-manager/containerapps/2023-05-01/managedenvironmentsstorages/id_storage.go @@ -38,23 +38,9 @@ func ParseStorageID(input string) (*StorageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageId{} - - 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.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) - } - - if id.StorageName, ok = parsed.Parsed["storageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseStorageIDInsensitively(input string) (*StorageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *StorageId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedEnvironmentName, ok = parsed.Parsed["managedEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", *parsed) + if id.ManagedEnvironmentName, ok = input.Parsed["managedEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedEnvironmentName", input) } - if id.StorageName, ok = parsed.Parsed["storageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageName", *parsed) + if id.StorageName, ok = input.Parsed["storageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageName", input) } - return &id, nil + return nil } // ValidateStorageID checks that 'input' can be parsed as a Storage ID diff --git a/resource-manager/containerinstance/2023-05-01/containerinstance/id_container.go b/resource-manager/containerinstance/2023-05-01/containerinstance/id_container.go index c8ee393e72c..a8806a88bb0 100644 --- a/resource-manager/containerinstance/2023-05-01/containerinstance/id_container.go +++ b/resource-manager/containerinstance/2023-05-01/containerinstance/id_container.go @@ -38,23 +38,9 @@ func ParseContainerID(input string) (*ContainerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerId{} - - 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.ContainerGroupName, ok = parsed.Parsed["containerGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerGroupName", *parsed) - } - - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseContainerIDInsensitively(input string) (*ContainerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ContainerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ContainerGroupName, ok = parsed.Parsed["containerGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerGroupName", *parsed) + if id.ContainerGroupName, ok = input.Parsed["containerGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerGroupName", input) } - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) + if id.ContainerName, ok = input.Parsed["containerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerName", input) } - return &id, nil + return nil } // ValidateContainerID checks that 'input' can be parsed as a Container ID diff --git a/resource-manager/containerinstance/2023-05-01/containerinstance/id_containergroup.go b/resource-manager/containerinstance/2023-05-01/containerinstance/id_containergroup.go index 86c13cf8f7c..34310eedbca 100644 --- a/resource-manager/containerinstance/2023-05-01/containerinstance/id_containergroup.go +++ b/resource-manager/containerinstance/2023-05-01/containerinstance/id_containergroup.go @@ -36,19 +36,9 @@ func ParseContainerGroupID(input string) (*ContainerGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerGroupId{} - - 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.ContainerGroupName, ok = parsed.Parsed["containerGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseContainerGroupIDInsensitively(input string) (*ContainerGroupId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ContainerGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ContainerGroupName, ok = parsed.Parsed["containerGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerGroupName", *parsed) + if id.ContainerGroupName, ok = input.Parsed["containerGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerGroupName", input) } - return &id, nil + return nil } // ValidateContainerGroupID checks that 'input' can be parsed as a Container Group ID diff --git a/resource-manager/containerinstance/2023-05-01/containerinstance/id_location.go b/resource-manager/containerinstance/2023-05-01/containerinstance/id_location.go index 93da8a732d9..f9c550d73b7 100644 --- a/resource-manager/containerinstance/2023-05-01/containerinstance/id_location.go +++ b/resource-manager/containerinstance/2023-05-01/containerinstance/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/containerregistry/2019-06-01-preview/agentpools/id_agentpool.go b/resource-manager/containerregistry/2019-06-01-preview/agentpools/id_agentpool.go index 98184247fa3..22847489143 100644 --- a/resource-manager/containerregistry/2019-06-01-preview/agentpools/id_agentpool.go +++ b/resource-manager/containerregistry/2019-06-01-preview/agentpools/id_agentpool.go @@ -38,23 +38,9 @@ func ParseAgentPoolID(input string) (*AgentPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AgentPoolId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.AgentPoolName, ok = parsed.Parsed["agentPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "agentPoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAgentPoolIDInsensitively(input string) (*AgentPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AgentPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AgentPoolId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.AgentPoolName, ok = parsed.Parsed["agentPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "agentPoolName", *parsed) + if id.AgentPoolName, ok = input.Parsed["agentPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "agentPoolName", input) } - return &id, nil + return nil } // ValidateAgentPoolID checks that 'input' can be parsed as a Agent Pool ID diff --git a/resource-manager/containerregistry/2019-06-01-preview/agentpools/id_registry.go b/resource-manager/containerregistry/2019-06-01-preview/agentpools/id_registry.go index 244780b7f17..c64c075987b 100644 --- a/resource-manager/containerregistry/2019-06-01-preview/agentpools/id_registry.go +++ b/resource-manager/containerregistry/2019-06-01-preview/agentpools/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/containerregistry/2019-06-01-preview/registries/id_registry.go b/resource-manager/containerregistry/2019-06-01-preview/registries/id_registry.go index e45e8501b3f..ffeb4dae919 100644 --- a/resource-manager/containerregistry/2019-06-01-preview/registries/id_registry.go +++ b/resource-manager/containerregistry/2019-06-01-preview/registries/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/containerregistry/2019-06-01-preview/runs/id_registry.go b/resource-manager/containerregistry/2019-06-01-preview/runs/id_registry.go index 1606fb7d23f..aed98c64bd4 100644 --- a/resource-manager/containerregistry/2019-06-01-preview/runs/id_registry.go +++ b/resource-manager/containerregistry/2019-06-01-preview/runs/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/containerregistry/2019-06-01-preview/runs/id_run.go b/resource-manager/containerregistry/2019-06-01-preview/runs/id_run.go index 025e84219c6..9479e3a3cb3 100644 --- a/resource-manager/containerregistry/2019-06-01-preview/runs/id_run.go +++ b/resource-manager/containerregistry/2019-06-01-preview/runs/id_run.go @@ -38,23 +38,9 @@ func ParseRunID(input string) (*RunId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.RunId, ok = parsed.Parsed["runId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRunIDInsensitively(input string) (*RunId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RunId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.RunId, ok = parsed.Parsed["runId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runId", *parsed) + if id.RunId, ok = input.Parsed["runId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runId", input) } - return &id, nil + return nil } // ValidateRunID checks that 'input' can be parsed as a Run ID diff --git a/resource-manager/containerregistry/2019-06-01-preview/taskruns/id_registry.go b/resource-manager/containerregistry/2019-06-01-preview/taskruns/id_registry.go index 81c676662b8..be014a38a3e 100644 --- a/resource-manager/containerregistry/2019-06-01-preview/taskruns/id_registry.go +++ b/resource-manager/containerregistry/2019-06-01-preview/taskruns/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/containerregistry/2019-06-01-preview/taskruns/id_taskrun.go b/resource-manager/containerregistry/2019-06-01-preview/taskruns/id_taskrun.go index 89afd32bb5e..da73f72513b 100644 --- a/resource-manager/containerregistry/2019-06-01-preview/taskruns/id_taskrun.go +++ b/resource-manager/containerregistry/2019-06-01-preview/taskruns/id_taskrun.go @@ -38,23 +38,9 @@ func ParseTaskRunID(input string) (*TaskRunId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TaskRunId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.TaskRunName, ok = parsed.Parsed["taskRunName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "taskRunName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTaskRunIDInsensitively(input string) (*TaskRunId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TaskRunId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TaskRunId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.TaskRunName, ok = parsed.Parsed["taskRunName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "taskRunName", *parsed) + if id.TaskRunName, ok = input.Parsed["taskRunName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "taskRunName", input) } - return &id, nil + return nil } // ValidateTaskRunID checks that 'input' can be parsed as a Task Run ID diff --git a/resource-manager/containerregistry/2019-06-01-preview/tasks/id_registry.go b/resource-manager/containerregistry/2019-06-01-preview/tasks/id_registry.go index b956c09e991..c5e4bc0b497 100644 --- a/resource-manager/containerregistry/2019-06-01-preview/tasks/id_registry.go +++ b/resource-manager/containerregistry/2019-06-01-preview/tasks/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/containerregistry/2019-06-01-preview/tasks/id_task.go b/resource-manager/containerregistry/2019-06-01-preview/tasks/id_task.go index 2c905a51926..eb0a7f4d3ef 100644 --- a/resource-manager/containerregistry/2019-06-01-preview/tasks/id_task.go +++ b/resource-manager/containerregistry/2019-06-01-preview/tasks/id_task.go @@ -38,23 +38,9 @@ func ParseTaskID(input string) (*TaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TaskId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.TaskName, ok = parsed.Parsed["taskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "taskName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTaskIDInsensitively(input string) (*TaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TaskId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TaskId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.TaskName, ok = parsed.Parsed["taskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "taskName", *parsed) + if id.TaskName, ok = input.Parsed["taskName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "taskName", input) } - return &id, nil + return nil } // ValidateTaskID checks that 'input' can be parsed as a Task ID diff --git a/resource-manager/containerregistry/2021-08-01-preview/connectedregistries/id_connectedregistry.go b/resource-manager/containerregistry/2021-08-01-preview/connectedregistries/id_connectedregistry.go index 198aa0220fe..c4f2eb52f2a 100644 --- a/resource-manager/containerregistry/2021-08-01-preview/connectedregistries/id_connectedregistry.go +++ b/resource-manager/containerregistry/2021-08-01-preview/connectedregistries/id_connectedregistry.go @@ -38,23 +38,9 @@ func ParseConnectedRegistryID(input string) (*ConnectedRegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectedRegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.ConnectedRegistryName, ok = parsed.Parsed["connectedRegistryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectedRegistryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConnectedRegistryIDInsensitively(input string) (*ConnectedRegistryId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectedRegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConnectedRegistryId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.ConnectedRegistryName, ok = parsed.Parsed["connectedRegistryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectedRegistryName", *parsed) + if id.ConnectedRegistryName, ok = input.Parsed["connectedRegistryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectedRegistryName", input) } - return &id, nil + return nil } // ValidateConnectedRegistryID checks that 'input' can be parsed as a Connected Registry ID diff --git a/resource-manager/containerregistry/2021-08-01-preview/connectedregistries/id_registry.go b/resource-manager/containerregistry/2021-08-01-preview/connectedregistries/id_registry.go index 9216a770edf..1ce00ecc55e 100644 --- a/resource-manager/containerregistry/2021-08-01-preview/connectedregistries/id_registry.go +++ b/resource-manager/containerregistry/2021-08-01-preview/connectedregistries/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/containerregistry/2021-08-01-preview/exportpipelines/id_exportpipeline.go b/resource-manager/containerregistry/2021-08-01-preview/exportpipelines/id_exportpipeline.go index 9ba9002dc0a..881454df5e5 100644 --- a/resource-manager/containerregistry/2021-08-01-preview/exportpipelines/id_exportpipeline.go +++ b/resource-manager/containerregistry/2021-08-01-preview/exportpipelines/id_exportpipeline.go @@ -38,23 +38,9 @@ func ParseExportPipelineID(input string) (*ExportPipelineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExportPipelineId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.ExportPipelineName, ok = parsed.Parsed["exportPipelineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "exportPipelineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseExportPipelineIDInsensitively(input string) (*ExportPipelineId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExportPipelineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ExportPipelineId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.ExportPipelineName, ok = parsed.Parsed["exportPipelineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "exportPipelineName", *parsed) + if id.ExportPipelineName, ok = input.Parsed["exportPipelineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "exportPipelineName", input) } - return &id, nil + return nil } // ValidateExportPipelineID checks that 'input' can be parsed as a Export Pipeline ID diff --git a/resource-manager/containerregistry/2021-08-01-preview/exportpipelines/id_registry.go b/resource-manager/containerregistry/2021-08-01-preview/exportpipelines/id_registry.go index 414d1596ae5..056b44b557b 100644 --- a/resource-manager/containerregistry/2021-08-01-preview/exportpipelines/id_registry.go +++ b/resource-manager/containerregistry/2021-08-01-preview/exportpipelines/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/containerregistry/2021-08-01-preview/importpipelines/id_importpipeline.go b/resource-manager/containerregistry/2021-08-01-preview/importpipelines/id_importpipeline.go index 8485d497098..52ae73663ab 100644 --- a/resource-manager/containerregistry/2021-08-01-preview/importpipelines/id_importpipeline.go +++ b/resource-manager/containerregistry/2021-08-01-preview/importpipelines/id_importpipeline.go @@ -38,23 +38,9 @@ func ParseImportPipelineID(input string) (*ImportPipelineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ImportPipelineId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.ImportPipelineName, ok = parsed.Parsed["importPipelineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "importPipelineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseImportPipelineIDInsensitively(input string) (*ImportPipelineId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ImportPipelineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ImportPipelineId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.ImportPipelineName, ok = parsed.Parsed["importPipelineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "importPipelineName", *parsed) + if id.ImportPipelineName, ok = input.Parsed["importPipelineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "importPipelineName", input) } - return &id, nil + return nil } // ValidateImportPipelineID checks that 'input' can be parsed as a Import Pipeline ID diff --git a/resource-manager/containerregistry/2021-08-01-preview/importpipelines/id_registry.go b/resource-manager/containerregistry/2021-08-01-preview/importpipelines/id_registry.go index 92b0968b327..a4a12be164f 100644 --- a/resource-manager/containerregistry/2021-08-01-preview/importpipelines/id_registry.go +++ b/resource-manager/containerregistry/2021-08-01-preview/importpipelines/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/containerregistry/2021-08-01-preview/pipelineruns/id_pipelinerun.go b/resource-manager/containerregistry/2021-08-01-preview/pipelineruns/id_pipelinerun.go index 01ad98f1527..08b96320955 100644 --- a/resource-manager/containerregistry/2021-08-01-preview/pipelineruns/id_pipelinerun.go +++ b/resource-manager/containerregistry/2021-08-01-preview/pipelineruns/id_pipelinerun.go @@ -38,23 +38,9 @@ func ParsePipelineRunID(input string) (*PipelineRunId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PipelineRunId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.PipelineRunName, ok = parsed.Parsed["pipelineRunName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "pipelineRunName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePipelineRunIDInsensitively(input string) (*PipelineRunId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PipelineRunId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PipelineRunId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.PipelineRunName, ok = parsed.Parsed["pipelineRunName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "pipelineRunName", *parsed) + if id.PipelineRunName, ok = input.Parsed["pipelineRunName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "pipelineRunName", input) } - return &id, nil + return nil } // ValidatePipelineRunID checks that 'input' can be parsed as a Pipeline Run ID diff --git a/resource-manager/containerregistry/2021-08-01-preview/pipelineruns/id_registry.go b/resource-manager/containerregistry/2021-08-01-preview/pipelineruns/id_registry.go index e3788f768ec..3d6572ed1d8 100644 --- a/resource-manager/containerregistry/2021-08-01-preview/pipelineruns/id_registry.go +++ b/resource-manager/containerregistry/2021-08-01-preview/pipelineruns/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/containerregistry/2021-08-01-preview/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/containerregistry/2021-08-01-preview/privateendpointconnections/id_privateendpointconnection.go index cfcb50d14be..7eb8592cfae 100644 --- a/resource-manager/containerregistry/2021-08-01-preview/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/containerregistry/2021-08-01-preview/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/containerregistry/2021-08-01-preview/privateendpointconnections/id_registry.go b/resource-manager/containerregistry/2021-08-01-preview/privateendpointconnections/id_registry.go index 1adc54deebd..eb409b4bd6a 100644 --- a/resource-manager/containerregistry/2021-08-01-preview/privateendpointconnections/id_registry.go +++ b/resource-manager/containerregistry/2021-08-01-preview/privateendpointconnections/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/containerregistry/2021-08-01-preview/registries/id_registry.go b/resource-manager/containerregistry/2021-08-01-preview/registries/id_registry.go index e45e8501b3f..ffeb4dae919 100644 --- a/resource-manager/containerregistry/2021-08-01-preview/registries/id_registry.go +++ b/resource-manager/containerregistry/2021-08-01-preview/registries/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/containerregistry/2021-08-01-preview/replications/id_registry.go b/resource-manager/containerregistry/2021-08-01-preview/replications/id_registry.go index 457ec9c52f5..cbb00da8695 100644 --- a/resource-manager/containerregistry/2021-08-01-preview/replications/id_registry.go +++ b/resource-manager/containerregistry/2021-08-01-preview/replications/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/containerregistry/2021-08-01-preview/replications/id_replication.go b/resource-manager/containerregistry/2021-08-01-preview/replications/id_replication.go index 6402b1649ed..7f51f17366a 100644 --- a/resource-manager/containerregistry/2021-08-01-preview/replications/id_replication.go +++ b/resource-manager/containerregistry/2021-08-01-preview/replications/id_replication.go @@ -38,23 +38,9 @@ func ParseReplicationID(input string) (*ReplicationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.ReplicationName, ok = parsed.Parsed["replicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationIDInsensitively(input string) (*ReplicationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.ReplicationName, ok = parsed.Parsed["replicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationName", *parsed) + if id.ReplicationName, ok = input.Parsed["replicationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationName", input) } - return &id, nil + return nil } // ValidateReplicationID checks that 'input' can be parsed as a Replication ID diff --git a/resource-manager/containerregistry/2021-08-01-preview/scopemaps/id_registry.go b/resource-manager/containerregistry/2021-08-01-preview/scopemaps/id_registry.go index 1967fbf250a..8169983df55 100644 --- a/resource-manager/containerregistry/2021-08-01-preview/scopemaps/id_registry.go +++ b/resource-manager/containerregistry/2021-08-01-preview/scopemaps/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/containerregistry/2021-08-01-preview/scopemaps/id_scopemap.go b/resource-manager/containerregistry/2021-08-01-preview/scopemaps/id_scopemap.go index 1286cbbb29e..932f5b82fae 100644 --- a/resource-manager/containerregistry/2021-08-01-preview/scopemaps/id_scopemap.go +++ b/resource-manager/containerregistry/2021-08-01-preview/scopemaps/id_scopemap.go @@ -38,23 +38,9 @@ func ParseScopeMapID(input string) (*ScopeMapId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopeMapId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.ScopeMapName, ok = parsed.Parsed["scopeMapName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scopeMapName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseScopeMapIDInsensitively(input string) (*ScopeMapId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopeMapId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ScopeMapId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.ScopeMapName, ok = parsed.Parsed["scopeMapName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scopeMapName", *parsed) + if id.ScopeMapName, ok = input.Parsed["scopeMapName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scopeMapName", input) } - return &id, nil + return nil } // ValidateScopeMapID checks that 'input' can be parsed as a Scope Map ID diff --git a/resource-manager/containerregistry/2021-08-01-preview/tokens/id_registry.go b/resource-manager/containerregistry/2021-08-01-preview/tokens/id_registry.go index 4c7ee22e373..fd7beda105e 100644 --- a/resource-manager/containerregistry/2021-08-01-preview/tokens/id_registry.go +++ b/resource-manager/containerregistry/2021-08-01-preview/tokens/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/containerregistry/2021-08-01-preview/tokens/id_token.go b/resource-manager/containerregistry/2021-08-01-preview/tokens/id_token.go index 6d8c7149e6c..d9b9677eef9 100644 --- a/resource-manager/containerregistry/2021-08-01-preview/tokens/id_token.go +++ b/resource-manager/containerregistry/2021-08-01-preview/tokens/id_token.go @@ -38,23 +38,9 @@ func ParseTokenID(input string) (*TokenId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TokenId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.TokenName, ok = parsed.Parsed["tokenName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tokenName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTokenIDInsensitively(input string) (*TokenId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TokenId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TokenId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.TokenName, ok = parsed.Parsed["tokenName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tokenName", *parsed) + if id.TokenName, ok = input.Parsed["tokenName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tokenName", input) } - return &id, nil + return nil } // ValidateTokenID checks that 'input' can be parsed as a Token ID diff --git a/resource-manager/containerregistry/2021-08-01-preview/webhooks/id_registry.go b/resource-manager/containerregistry/2021-08-01-preview/webhooks/id_registry.go index 6a0695fe81d..c57285a575e 100644 --- a/resource-manager/containerregistry/2021-08-01-preview/webhooks/id_registry.go +++ b/resource-manager/containerregistry/2021-08-01-preview/webhooks/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/containerregistry/2021-08-01-preview/webhooks/id_webhook.go b/resource-manager/containerregistry/2021-08-01-preview/webhooks/id_webhook.go index 9764cd18a8c..eca5ddc35ce 100644 --- a/resource-manager/containerregistry/2021-08-01-preview/webhooks/id_webhook.go +++ b/resource-manager/containerregistry/2021-08-01-preview/webhooks/id_webhook.go @@ -38,23 +38,9 @@ func ParseWebHookID(input string) (*WebHookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WebHookId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.WebHookName, ok = parsed.Parsed["webHookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "webHookName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWebHookIDInsensitively(input string) (*WebHookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WebHookId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WebHookId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.WebHookName, ok = parsed.Parsed["webHookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "webHookName", *parsed) + if id.WebHookName, ok = input.Parsed["webHookName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "webHookName", input) } - return &id, nil + return nil } // ValidateWebHookID checks that 'input' can be parsed as a Web Hook ID diff --git a/resource-manager/containerregistry/2022-12-01/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/containerregistry/2022-12-01/privateendpointconnections/id_privateendpointconnection.go index cfcb50d14be..7eb8592cfae 100644 --- a/resource-manager/containerregistry/2022-12-01/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/containerregistry/2022-12-01/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/containerregistry/2022-12-01/privateendpointconnections/id_registry.go b/resource-manager/containerregistry/2022-12-01/privateendpointconnections/id_registry.go index 1adc54deebd..eb409b4bd6a 100644 --- a/resource-manager/containerregistry/2022-12-01/privateendpointconnections/id_registry.go +++ b/resource-manager/containerregistry/2022-12-01/privateendpointconnections/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/containerregistry/2022-12-01/registries/id_privatelinkresource.go b/resource-manager/containerregistry/2022-12-01/registries/id_privatelinkresource.go index 1a9ba519f8a..57be481042e 100644 --- a/resource-manager/containerregistry/2022-12-01/registries/id_privatelinkresource.go +++ b/resource-manager/containerregistry/2022-12-01/registries/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/containerregistry/2022-12-01/registries/id_registry.go b/resource-manager/containerregistry/2022-12-01/registries/id_registry.go index e45e8501b3f..ffeb4dae919 100644 --- a/resource-manager/containerregistry/2022-12-01/registries/id_registry.go +++ b/resource-manager/containerregistry/2022-12-01/registries/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/containerregistry/2022-12-01/replications/id_registry.go b/resource-manager/containerregistry/2022-12-01/replications/id_registry.go index 457ec9c52f5..cbb00da8695 100644 --- a/resource-manager/containerregistry/2022-12-01/replications/id_registry.go +++ b/resource-manager/containerregistry/2022-12-01/replications/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/containerregistry/2022-12-01/replications/id_replication.go b/resource-manager/containerregistry/2022-12-01/replications/id_replication.go index 6402b1649ed..7f51f17366a 100644 --- a/resource-manager/containerregistry/2022-12-01/replications/id_replication.go +++ b/resource-manager/containerregistry/2022-12-01/replications/id_replication.go @@ -38,23 +38,9 @@ func ParseReplicationID(input string) (*ReplicationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.ReplicationName, ok = parsed.Parsed["replicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationIDInsensitively(input string) (*ReplicationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.ReplicationName, ok = parsed.Parsed["replicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationName", *parsed) + if id.ReplicationName, ok = input.Parsed["replicationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationName", input) } - return &id, nil + return nil } // ValidateReplicationID checks that 'input' can be parsed as a Replication ID diff --git a/resource-manager/containerregistry/2022-12-01/scopemaps/id_registry.go b/resource-manager/containerregistry/2022-12-01/scopemaps/id_registry.go index 1967fbf250a..8169983df55 100644 --- a/resource-manager/containerregistry/2022-12-01/scopemaps/id_registry.go +++ b/resource-manager/containerregistry/2022-12-01/scopemaps/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/containerregistry/2022-12-01/scopemaps/id_scopemap.go b/resource-manager/containerregistry/2022-12-01/scopemaps/id_scopemap.go index 1286cbbb29e..932f5b82fae 100644 --- a/resource-manager/containerregistry/2022-12-01/scopemaps/id_scopemap.go +++ b/resource-manager/containerregistry/2022-12-01/scopemaps/id_scopemap.go @@ -38,23 +38,9 @@ func ParseScopeMapID(input string) (*ScopeMapId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopeMapId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.ScopeMapName, ok = parsed.Parsed["scopeMapName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scopeMapName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseScopeMapIDInsensitively(input string) (*ScopeMapId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopeMapId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ScopeMapId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.ScopeMapName, ok = parsed.Parsed["scopeMapName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scopeMapName", *parsed) + if id.ScopeMapName, ok = input.Parsed["scopeMapName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scopeMapName", input) } - return &id, nil + return nil } // ValidateScopeMapID checks that 'input' can be parsed as a Scope Map ID diff --git a/resource-manager/containerregistry/2022-12-01/tokens/id_registry.go b/resource-manager/containerregistry/2022-12-01/tokens/id_registry.go index 4c7ee22e373..fd7beda105e 100644 --- a/resource-manager/containerregistry/2022-12-01/tokens/id_registry.go +++ b/resource-manager/containerregistry/2022-12-01/tokens/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/containerregistry/2022-12-01/tokens/id_token.go b/resource-manager/containerregistry/2022-12-01/tokens/id_token.go index 6d8c7149e6c..d9b9677eef9 100644 --- a/resource-manager/containerregistry/2022-12-01/tokens/id_token.go +++ b/resource-manager/containerregistry/2022-12-01/tokens/id_token.go @@ -38,23 +38,9 @@ func ParseTokenID(input string) (*TokenId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TokenId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.TokenName, ok = parsed.Parsed["tokenName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tokenName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTokenIDInsensitively(input string) (*TokenId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TokenId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TokenId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.TokenName, ok = parsed.Parsed["tokenName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tokenName", *parsed) + if id.TokenName, ok = input.Parsed["tokenName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tokenName", input) } - return &id, nil + return nil } // ValidateTokenID checks that 'input' can be parsed as a Token ID diff --git a/resource-manager/containerregistry/2022-12-01/webhooks/id_registry.go b/resource-manager/containerregistry/2022-12-01/webhooks/id_registry.go index 6a0695fe81d..c57285a575e 100644 --- a/resource-manager/containerregistry/2022-12-01/webhooks/id_registry.go +++ b/resource-manager/containerregistry/2022-12-01/webhooks/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/containerregistry/2022-12-01/webhooks/id_webhook.go b/resource-manager/containerregistry/2022-12-01/webhooks/id_webhook.go index 9764cd18a8c..eca5ddc35ce 100644 --- a/resource-manager/containerregistry/2022-12-01/webhooks/id_webhook.go +++ b/resource-manager/containerregistry/2022-12-01/webhooks/id_webhook.go @@ -38,23 +38,9 @@ func ParseWebHookID(input string) (*WebHookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WebHookId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.WebHookName, ok = parsed.Parsed["webHookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "webHookName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWebHookIDInsensitively(input string) (*WebHookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WebHookId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WebHookId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.WebHookName, ok = parsed.Parsed["webHookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "webHookName", *parsed) + if id.WebHookName, ok = input.Parsed["webHookName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "webHookName", input) } - return &id, nil + return nil } // ValidateWebHookID checks that 'input' can be parsed as a Web Hook ID diff --git a/resource-manager/containerregistry/2023-06-01-preview/archives/id_archive.go b/resource-manager/containerregistry/2023-06-01-preview/archives/id_archive.go index 8f436c42c23..d7a42bbc233 100644 --- a/resource-manager/containerregistry/2023-06-01-preview/archives/id_archive.go +++ b/resource-manager/containerregistry/2023-06-01-preview/archives/id_archive.go @@ -40,27 +40,9 @@ func ParseArchiveID(input string) (*ArchiveId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ArchiveId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.PackageName, ok = parsed.Parsed["packageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packageName", *parsed) - } - - if id.ArchiveName, ok = parsed.Parsed["archiveName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "archiveName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseArchiveIDInsensitively(input string) (*ArchiveId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ArchiveId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ArchiveId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.PackageName, ok = parsed.Parsed["packageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packageName", *parsed) + if id.PackageName, ok = input.Parsed["packageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packageName", input) } - if id.ArchiveName, ok = parsed.Parsed["archiveName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "archiveName", *parsed) + if id.ArchiveName, ok = input.Parsed["archiveName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "archiveName", input) } - return &id, nil + return nil } // ValidateArchiveID checks that 'input' can be parsed as a Archive ID diff --git a/resource-manager/containerregistry/2023-06-01-preview/archives/id_package.go b/resource-manager/containerregistry/2023-06-01-preview/archives/id_package.go index 5637ae96ad6..74cbb4f5a2e 100644 --- a/resource-manager/containerregistry/2023-06-01-preview/archives/id_package.go +++ b/resource-manager/containerregistry/2023-06-01-preview/archives/id_package.go @@ -38,23 +38,9 @@ func ParsePackageID(input string) (*PackageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PackageId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.PackageName, ok = parsed.Parsed["packageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packageName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePackageIDInsensitively(input string) (*PackageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PackageId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PackageId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.PackageName, ok = parsed.Parsed["packageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packageName", *parsed) + if id.PackageName, ok = input.Parsed["packageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packageName", input) } - return &id, nil + return nil } // ValidatePackageID checks that 'input' can be parsed as a Package ID diff --git a/resource-manager/containerregistry/2023-06-01-preview/archiveversions/id_archive.go b/resource-manager/containerregistry/2023-06-01-preview/archiveversions/id_archive.go index b150a52acf7..d71232fbc55 100644 --- a/resource-manager/containerregistry/2023-06-01-preview/archiveversions/id_archive.go +++ b/resource-manager/containerregistry/2023-06-01-preview/archiveversions/id_archive.go @@ -40,27 +40,9 @@ func ParseArchiveID(input string) (*ArchiveId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ArchiveId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.PackageName, ok = parsed.Parsed["packageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packageName", *parsed) - } - - if id.ArchiveName, ok = parsed.Parsed["archiveName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "archiveName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseArchiveIDInsensitively(input string) (*ArchiveId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ArchiveId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ArchiveId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.PackageName, ok = parsed.Parsed["packageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packageName", *parsed) + if id.PackageName, ok = input.Parsed["packageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packageName", input) } - if id.ArchiveName, ok = parsed.Parsed["archiveName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "archiveName", *parsed) + if id.ArchiveName, ok = input.Parsed["archiveName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "archiveName", input) } - return &id, nil + return nil } // ValidateArchiveID checks that 'input' can be parsed as a Archive ID diff --git a/resource-manager/containerregistry/2023-06-01-preview/archiveversions/id_version.go b/resource-manager/containerregistry/2023-06-01-preview/archiveversions/id_version.go index 6edcf1a40ae..8ad492ca492 100644 --- a/resource-manager/containerregistry/2023-06-01-preview/archiveversions/id_version.go +++ b/resource-manager/containerregistry/2023-06-01-preview/archiveversions/id_version.go @@ -42,31 +42,9 @@ func ParseVersionID(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.PackageName, ok = parsed.Parsed["packageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packageName", *parsed) - } - - if id.ArchiveName, ok = parsed.Parsed["archiveName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "archiveName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseVersionIDInsensitively(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.PackageName, ok = parsed.Parsed["packageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packageName", *parsed) + if id.PackageName, ok = input.Parsed["packageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packageName", input) } - if id.ArchiveName, ok = parsed.Parsed["archiveName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "archiveName", *parsed) + if id.ArchiveName, ok = input.Parsed["archiveName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "archiveName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateVersionID checks that 'input' can be parsed as a Version ID diff --git a/resource-manager/containerregistry/2023-06-01-preview/cacherules/id_cacherule.go b/resource-manager/containerregistry/2023-06-01-preview/cacherules/id_cacherule.go index ffa12165199..c18e545094e 100644 --- a/resource-manager/containerregistry/2023-06-01-preview/cacherules/id_cacherule.go +++ b/resource-manager/containerregistry/2023-06-01-preview/cacherules/id_cacherule.go @@ -38,23 +38,9 @@ func ParseCacheRuleID(input string) (*CacheRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CacheRuleId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.CacheRuleName, ok = parsed.Parsed["cacheRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cacheRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCacheRuleIDInsensitively(input string) (*CacheRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CacheRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CacheRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.CacheRuleName, ok = parsed.Parsed["cacheRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cacheRuleName", *parsed) + if id.CacheRuleName, ok = input.Parsed["cacheRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cacheRuleName", input) } - return &id, nil + return nil } // ValidateCacheRuleID checks that 'input' can be parsed as a Cache Rule ID diff --git a/resource-manager/containerregistry/2023-06-01-preview/cacherules/id_registry.go b/resource-manager/containerregistry/2023-06-01-preview/cacherules/id_registry.go index 7b505f5e932..c4e941541b3 100644 --- a/resource-manager/containerregistry/2023-06-01-preview/cacherules/id_registry.go +++ b/resource-manager/containerregistry/2023-06-01-preview/cacherules/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/containerregistry/2023-06-01-preview/connectedregistries/id_connectedregistry.go b/resource-manager/containerregistry/2023-06-01-preview/connectedregistries/id_connectedregistry.go index 198aa0220fe..c4f2eb52f2a 100644 --- a/resource-manager/containerregistry/2023-06-01-preview/connectedregistries/id_connectedregistry.go +++ b/resource-manager/containerregistry/2023-06-01-preview/connectedregistries/id_connectedregistry.go @@ -38,23 +38,9 @@ func ParseConnectedRegistryID(input string) (*ConnectedRegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectedRegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.ConnectedRegistryName, ok = parsed.Parsed["connectedRegistryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectedRegistryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConnectedRegistryIDInsensitively(input string) (*ConnectedRegistryId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectedRegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConnectedRegistryId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.ConnectedRegistryName, ok = parsed.Parsed["connectedRegistryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectedRegistryName", *parsed) + if id.ConnectedRegistryName, ok = input.Parsed["connectedRegistryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectedRegistryName", input) } - return &id, nil + return nil } // ValidateConnectedRegistryID checks that 'input' can be parsed as a Connected Registry ID diff --git a/resource-manager/containerregistry/2023-06-01-preview/connectedregistries/id_registry.go b/resource-manager/containerregistry/2023-06-01-preview/connectedregistries/id_registry.go index 9216a770edf..1ce00ecc55e 100644 --- a/resource-manager/containerregistry/2023-06-01-preview/connectedregistries/id_registry.go +++ b/resource-manager/containerregistry/2023-06-01-preview/connectedregistries/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/containerregistry/2023-06-01-preview/credentialsets/id_credentialset.go b/resource-manager/containerregistry/2023-06-01-preview/credentialsets/id_credentialset.go index 4861a114019..eb10190689e 100644 --- a/resource-manager/containerregistry/2023-06-01-preview/credentialsets/id_credentialset.go +++ b/resource-manager/containerregistry/2023-06-01-preview/credentialsets/id_credentialset.go @@ -38,23 +38,9 @@ func ParseCredentialSetID(input string) (*CredentialSetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CredentialSetId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.CredentialSetName, ok = parsed.Parsed["credentialSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "credentialSetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCredentialSetIDInsensitively(input string) (*CredentialSetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CredentialSetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CredentialSetId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.CredentialSetName, ok = parsed.Parsed["credentialSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "credentialSetName", *parsed) + if id.CredentialSetName, ok = input.Parsed["credentialSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "credentialSetName", input) } - return &id, nil + return nil } // ValidateCredentialSetID checks that 'input' can be parsed as a Credential Set ID diff --git a/resource-manager/containerregistry/2023-06-01-preview/credentialsets/id_registry.go b/resource-manager/containerregistry/2023-06-01-preview/credentialsets/id_registry.go index a791778caf4..ac7554ab02b 100644 --- a/resource-manager/containerregistry/2023-06-01-preview/credentialsets/id_registry.go +++ b/resource-manager/containerregistry/2023-06-01-preview/credentialsets/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/containerregistry/2023-06-01-preview/exportpipelines/id_exportpipeline.go b/resource-manager/containerregistry/2023-06-01-preview/exportpipelines/id_exportpipeline.go index 9ba9002dc0a..881454df5e5 100644 --- a/resource-manager/containerregistry/2023-06-01-preview/exportpipelines/id_exportpipeline.go +++ b/resource-manager/containerregistry/2023-06-01-preview/exportpipelines/id_exportpipeline.go @@ -38,23 +38,9 @@ func ParseExportPipelineID(input string) (*ExportPipelineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExportPipelineId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.ExportPipelineName, ok = parsed.Parsed["exportPipelineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "exportPipelineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseExportPipelineIDInsensitively(input string) (*ExportPipelineId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExportPipelineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ExportPipelineId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.ExportPipelineName, ok = parsed.Parsed["exportPipelineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "exportPipelineName", *parsed) + if id.ExportPipelineName, ok = input.Parsed["exportPipelineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "exportPipelineName", input) } - return &id, nil + return nil } // ValidateExportPipelineID checks that 'input' can be parsed as a Export Pipeline ID diff --git a/resource-manager/containerregistry/2023-06-01-preview/exportpipelines/id_registry.go b/resource-manager/containerregistry/2023-06-01-preview/exportpipelines/id_registry.go index 414d1596ae5..056b44b557b 100644 --- a/resource-manager/containerregistry/2023-06-01-preview/exportpipelines/id_registry.go +++ b/resource-manager/containerregistry/2023-06-01-preview/exportpipelines/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/containerregistry/2023-06-01-preview/importpipelines/id_importpipeline.go b/resource-manager/containerregistry/2023-06-01-preview/importpipelines/id_importpipeline.go index 8485d497098..52ae73663ab 100644 --- a/resource-manager/containerregistry/2023-06-01-preview/importpipelines/id_importpipeline.go +++ b/resource-manager/containerregistry/2023-06-01-preview/importpipelines/id_importpipeline.go @@ -38,23 +38,9 @@ func ParseImportPipelineID(input string) (*ImportPipelineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ImportPipelineId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.ImportPipelineName, ok = parsed.Parsed["importPipelineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "importPipelineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseImportPipelineIDInsensitively(input string) (*ImportPipelineId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ImportPipelineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ImportPipelineId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.ImportPipelineName, ok = parsed.Parsed["importPipelineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "importPipelineName", *parsed) + if id.ImportPipelineName, ok = input.Parsed["importPipelineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "importPipelineName", input) } - return &id, nil + return nil } // ValidateImportPipelineID checks that 'input' can be parsed as a Import Pipeline ID diff --git a/resource-manager/containerregistry/2023-06-01-preview/importpipelines/id_registry.go b/resource-manager/containerregistry/2023-06-01-preview/importpipelines/id_registry.go index 92b0968b327..a4a12be164f 100644 --- a/resource-manager/containerregistry/2023-06-01-preview/importpipelines/id_registry.go +++ b/resource-manager/containerregistry/2023-06-01-preview/importpipelines/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/containerregistry/2023-06-01-preview/pipelineruns/id_pipelinerun.go b/resource-manager/containerregistry/2023-06-01-preview/pipelineruns/id_pipelinerun.go index 01ad98f1527..08b96320955 100644 --- a/resource-manager/containerregistry/2023-06-01-preview/pipelineruns/id_pipelinerun.go +++ b/resource-manager/containerregistry/2023-06-01-preview/pipelineruns/id_pipelinerun.go @@ -38,23 +38,9 @@ func ParsePipelineRunID(input string) (*PipelineRunId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PipelineRunId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.PipelineRunName, ok = parsed.Parsed["pipelineRunName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "pipelineRunName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePipelineRunIDInsensitively(input string) (*PipelineRunId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PipelineRunId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PipelineRunId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.PipelineRunName, ok = parsed.Parsed["pipelineRunName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "pipelineRunName", *parsed) + if id.PipelineRunName, ok = input.Parsed["pipelineRunName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "pipelineRunName", input) } - return &id, nil + return nil } // ValidatePipelineRunID checks that 'input' can be parsed as a Pipeline Run ID diff --git a/resource-manager/containerregistry/2023-06-01-preview/pipelineruns/id_registry.go b/resource-manager/containerregistry/2023-06-01-preview/pipelineruns/id_registry.go index e3788f768ec..3d6572ed1d8 100644 --- a/resource-manager/containerregistry/2023-06-01-preview/pipelineruns/id_registry.go +++ b/resource-manager/containerregistry/2023-06-01-preview/pipelineruns/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/containerregistry/2023-06-01-preview/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/containerregistry/2023-06-01-preview/privateendpointconnections/id_privateendpointconnection.go index cfcb50d14be..7eb8592cfae 100644 --- a/resource-manager/containerregistry/2023-06-01-preview/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/containerregistry/2023-06-01-preview/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/containerregistry/2023-06-01-preview/privateendpointconnections/id_registry.go b/resource-manager/containerregistry/2023-06-01-preview/privateendpointconnections/id_registry.go index 1adc54deebd..eb409b4bd6a 100644 --- a/resource-manager/containerregistry/2023-06-01-preview/privateendpointconnections/id_registry.go +++ b/resource-manager/containerregistry/2023-06-01-preview/privateendpointconnections/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/containerregistry/2023-06-01-preview/registries/id_privatelinkresource.go b/resource-manager/containerregistry/2023-06-01-preview/registries/id_privatelinkresource.go index 1a9ba519f8a..57be481042e 100644 --- a/resource-manager/containerregistry/2023-06-01-preview/registries/id_privatelinkresource.go +++ b/resource-manager/containerregistry/2023-06-01-preview/registries/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/containerregistry/2023-06-01-preview/registries/id_registry.go b/resource-manager/containerregistry/2023-06-01-preview/registries/id_registry.go index e45e8501b3f..ffeb4dae919 100644 --- a/resource-manager/containerregistry/2023-06-01-preview/registries/id_registry.go +++ b/resource-manager/containerregistry/2023-06-01-preview/registries/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/containerregistry/2023-06-01-preview/replications/id_registry.go b/resource-manager/containerregistry/2023-06-01-preview/replications/id_registry.go index 457ec9c52f5..cbb00da8695 100644 --- a/resource-manager/containerregistry/2023-06-01-preview/replications/id_registry.go +++ b/resource-manager/containerregistry/2023-06-01-preview/replications/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/containerregistry/2023-06-01-preview/replications/id_replication.go b/resource-manager/containerregistry/2023-06-01-preview/replications/id_replication.go index 6402b1649ed..7f51f17366a 100644 --- a/resource-manager/containerregistry/2023-06-01-preview/replications/id_replication.go +++ b/resource-manager/containerregistry/2023-06-01-preview/replications/id_replication.go @@ -38,23 +38,9 @@ func ParseReplicationID(input string) (*ReplicationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.ReplicationName, ok = parsed.Parsed["replicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationIDInsensitively(input string) (*ReplicationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.ReplicationName, ok = parsed.Parsed["replicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationName", *parsed) + if id.ReplicationName, ok = input.Parsed["replicationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationName", input) } - return &id, nil + return nil } // ValidateReplicationID checks that 'input' can be parsed as a Replication ID diff --git a/resource-manager/containerregistry/2023-06-01-preview/scopemaps/id_registry.go b/resource-manager/containerregistry/2023-06-01-preview/scopemaps/id_registry.go index 1967fbf250a..8169983df55 100644 --- a/resource-manager/containerregistry/2023-06-01-preview/scopemaps/id_registry.go +++ b/resource-manager/containerregistry/2023-06-01-preview/scopemaps/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/containerregistry/2023-06-01-preview/scopemaps/id_scopemap.go b/resource-manager/containerregistry/2023-06-01-preview/scopemaps/id_scopemap.go index 1286cbbb29e..932f5b82fae 100644 --- a/resource-manager/containerregistry/2023-06-01-preview/scopemaps/id_scopemap.go +++ b/resource-manager/containerregistry/2023-06-01-preview/scopemaps/id_scopemap.go @@ -38,23 +38,9 @@ func ParseScopeMapID(input string) (*ScopeMapId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopeMapId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.ScopeMapName, ok = parsed.Parsed["scopeMapName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scopeMapName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseScopeMapIDInsensitively(input string) (*ScopeMapId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopeMapId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ScopeMapId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.ScopeMapName, ok = parsed.Parsed["scopeMapName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scopeMapName", *parsed) + if id.ScopeMapName, ok = input.Parsed["scopeMapName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scopeMapName", input) } - return &id, nil + return nil } // ValidateScopeMapID checks that 'input' can be parsed as a Scope Map ID diff --git a/resource-manager/containerregistry/2023-06-01-preview/tokens/id_registry.go b/resource-manager/containerregistry/2023-06-01-preview/tokens/id_registry.go index 4c7ee22e373..fd7beda105e 100644 --- a/resource-manager/containerregistry/2023-06-01-preview/tokens/id_registry.go +++ b/resource-manager/containerregistry/2023-06-01-preview/tokens/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/containerregistry/2023-06-01-preview/tokens/id_token.go b/resource-manager/containerregistry/2023-06-01-preview/tokens/id_token.go index 6d8c7149e6c..d9b9677eef9 100644 --- a/resource-manager/containerregistry/2023-06-01-preview/tokens/id_token.go +++ b/resource-manager/containerregistry/2023-06-01-preview/tokens/id_token.go @@ -38,23 +38,9 @@ func ParseTokenID(input string) (*TokenId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TokenId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.TokenName, ok = parsed.Parsed["tokenName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tokenName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTokenIDInsensitively(input string) (*TokenId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TokenId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TokenId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.TokenName, ok = parsed.Parsed["tokenName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tokenName", *parsed) + if id.TokenName, ok = input.Parsed["tokenName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tokenName", input) } - return &id, nil + return nil } // ValidateTokenID checks that 'input' can be parsed as a Token ID diff --git a/resource-manager/containerregistry/2023-06-01-preview/webhooks/id_registry.go b/resource-manager/containerregistry/2023-06-01-preview/webhooks/id_registry.go index 6a0695fe81d..c57285a575e 100644 --- a/resource-manager/containerregistry/2023-06-01-preview/webhooks/id_registry.go +++ b/resource-manager/containerregistry/2023-06-01-preview/webhooks/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/containerregistry/2023-06-01-preview/webhooks/id_webhook.go b/resource-manager/containerregistry/2023-06-01-preview/webhooks/id_webhook.go index 9764cd18a8c..eca5ddc35ce 100644 --- a/resource-manager/containerregistry/2023-06-01-preview/webhooks/id_webhook.go +++ b/resource-manager/containerregistry/2023-06-01-preview/webhooks/id_webhook.go @@ -38,23 +38,9 @@ func ParseWebHookID(input string) (*WebHookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WebHookId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.WebHookName, ok = parsed.Parsed["webHookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "webHookName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWebHookIDInsensitively(input string) (*WebHookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WebHookId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WebHookId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.WebHookName, ok = parsed.Parsed["webHookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "webHookName", *parsed) + if id.WebHookName, ok = input.Parsed["webHookName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "webHookName", input) } - return &id, nil + return nil } // ValidateWebHookID checks that 'input' can be parsed as a Web Hook ID diff --git a/resource-manager/containerregistry/2023-07-01/cacherules/id_cacherule.go b/resource-manager/containerregistry/2023-07-01/cacherules/id_cacherule.go index ffa12165199..c18e545094e 100644 --- a/resource-manager/containerregistry/2023-07-01/cacherules/id_cacherule.go +++ b/resource-manager/containerregistry/2023-07-01/cacherules/id_cacherule.go @@ -38,23 +38,9 @@ func ParseCacheRuleID(input string) (*CacheRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CacheRuleId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.CacheRuleName, ok = parsed.Parsed["cacheRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cacheRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCacheRuleIDInsensitively(input string) (*CacheRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CacheRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CacheRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.CacheRuleName, ok = parsed.Parsed["cacheRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cacheRuleName", *parsed) + if id.CacheRuleName, ok = input.Parsed["cacheRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cacheRuleName", input) } - return &id, nil + return nil } // ValidateCacheRuleID checks that 'input' can be parsed as a Cache Rule ID diff --git a/resource-manager/containerregistry/2023-07-01/cacherules/id_registry.go b/resource-manager/containerregistry/2023-07-01/cacherules/id_registry.go index 7b505f5e932..c4e941541b3 100644 --- a/resource-manager/containerregistry/2023-07-01/cacherules/id_registry.go +++ b/resource-manager/containerregistry/2023-07-01/cacherules/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/containerregistry/2023-07-01/credentialsets/id_credentialset.go b/resource-manager/containerregistry/2023-07-01/credentialsets/id_credentialset.go index 4861a114019..eb10190689e 100644 --- a/resource-manager/containerregistry/2023-07-01/credentialsets/id_credentialset.go +++ b/resource-manager/containerregistry/2023-07-01/credentialsets/id_credentialset.go @@ -38,23 +38,9 @@ func ParseCredentialSetID(input string) (*CredentialSetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CredentialSetId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.CredentialSetName, ok = parsed.Parsed["credentialSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "credentialSetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCredentialSetIDInsensitively(input string) (*CredentialSetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CredentialSetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CredentialSetId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.CredentialSetName, ok = parsed.Parsed["credentialSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "credentialSetName", *parsed) + if id.CredentialSetName, ok = input.Parsed["credentialSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "credentialSetName", input) } - return &id, nil + return nil } // ValidateCredentialSetID checks that 'input' can be parsed as a Credential Set ID diff --git a/resource-manager/containerregistry/2023-07-01/credentialsets/id_registry.go b/resource-manager/containerregistry/2023-07-01/credentialsets/id_registry.go index a791778caf4..ac7554ab02b 100644 --- a/resource-manager/containerregistry/2023-07-01/credentialsets/id_registry.go +++ b/resource-manager/containerregistry/2023-07-01/credentialsets/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/containerregistry/2023-07-01/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/containerregistry/2023-07-01/privateendpointconnections/id_privateendpointconnection.go index cfcb50d14be..7eb8592cfae 100644 --- a/resource-manager/containerregistry/2023-07-01/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/containerregistry/2023-07-01/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/containerregistry/2023-07-01/privateendpointconnections/id_registry.go b/resource-manager/containerregistry/2023-07-01/privateendpointconnections/id_registry.go index 1adc54deebd..eb409b4bd6a 100644 --- a/resource-manager/containerregistry/2023-07-01/privateendpointconnections/id_registry.go +++ b/resource-manager/containerregistry/2023-07-01/privateendpointconnections/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/containerregistry/2023-07-01/registries/id_privatelinkresource.go b/resource-manager/containerregistry/2023-07-01/registries/id_privatelinkresource.go index 1a9ba519f8a..57be481042e 100644 --- a/resource-manager/containerregistry/2023-07-01/registries/id_privatelinkresource.go +++ b/resource-manager/containerregistry/2023-07-01/registries/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/containerregistry/2023-07-01/registries/id_registry.go b/resource-manager/containerregistry/2023-07-01/registries/id_registry.go index e45e8501b3f..ffeb4dae919 100644 --- a/resource-manager/containerregistry/2023-07-01/registries/id_registry.go +++ b/resource-manager/containerregistry/2023-07-01/registries/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/containerregistry/2023-07-01/replications/id_registry.go b/resource-manager/containerregistry/2023-07-01/replications/id_registry.go index 457ec9c52f5..cbb00da8695 100644 --- a/resource-manager/containerregistry/2023-07-01/replications/id_registry.go +++ b/resource-manager/containerregistry/2023-07-01/replications/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/containerregistry/2023-07-01/replications/id_replication.go b/resource-manager/containerregistry/2023-07-01/replications/id_replication.go index 6402b1649ed..7f51f17366a 100644 --- a/resource-manager/containerregistry/2023-07-01/replications/id_replication.go +++ b/resource-manager/containerregistry/2023-07-01/replications/id_replication.go @@ -38,23 +38,9 @@ func ParseReplicationID(input string) (*ReplicationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.ReplicationName, ok = parsed.Parsed["replicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationIDInsensitively(input string) (*ReplicationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.ReplicationName, ok = parsed.Parsed["replicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationName", *parsed) + if id.ReplicationName, ok = input.Parsed["replicationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationName", input) } - return &id, nil + return nil } // ValidateReplicationID checks that 'input' can be parsed as a Replication ID diff --git a/resource-manager/containerregistry/2023-07-01/scopemaps/id_registry.go b/resource-manager/containerregistry/2023-07-01/scopemaps/id_registry.go index 1967fbf250a..8169983df55 100644 --- a/resource-manager/containerregistry/2023-07-01/scopemaps/id_registry.go +++ b/resource-manager/containerregistry/2023-07-01/scopemaps/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/containerregistry/2023-07-01/scopemaps/id_scopemap.go b/resource-manager/containerregistry/2023-07-01/scopemaps/id_scopemap.go index 1286cbbb29e..932f5b82fae 100644 --- a/resource-manager/containerregistry/2023-07-01/scopemaps/id_scopemap.go +++ b/resource-manager/containerregistry/2023-07-01/scopemaps/id_scopemap.go @@ -38,23 +38,9 @@ func ParseScopeMapID(input string) (*ScopeMapId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopeMapId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.ScopeMapName, ok = parsed.Parsed["scopeMapName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scopeMapName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseScopeMapIDInsensitively(input string) (*ScopeMapId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopeMapId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ScopeMapId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.ScopeMapName, ok = parsed.Parsed["scopeMapName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scopeMapName", *parsed) + if id.ScopeMapName, ok = input.Parsed["scopeMapName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scopeMapName", input) } - return &id, nil + return nil } // ValidateScopeMapID checks that 'input' can be parsed as a Scope Map ID diff --git a/resource-manager/containerregistry/2023-07-01/tokens/id_registry.go b/resource-manager/containerregistry/2023-07-01/tokens/id_registry.go index 4c7ee22e373..fd7beda105e 100644 --- a/resource-manager/containerregistry/2023-07-01/tokens/id_registry.go +++ b/resource-manager/containerregistry/2023-07-01/tokens/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/containerregistry/2023-07-01/tokens/id_token.go b/resource-manager/containerregistry/2023-07-01/tokens/id_token.go index 6d8c7149e6c..d9b9677eef9 100644 --- a/resource-manager/containerregistry/2023-07-01/tokens/id_token.go +++ b/resource-manager/containerregistry/2023-07-01/tokens/id_token.go @@ -38,23 +38,9 @@ func ParseTokenID(input string) (*TokenId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TokenId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.TokenName, ok = parsed.Parsed["tokenName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tokenName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTokenIDInsensitively(input string) (*TokenId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TokenId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TokenId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.TokenName, ok = parsed.Parsed["tokenName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tokenName", *parsed) + if id.TokenName, ok = input.Parsed["tokenName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tokenName", input) } - return &id, nil + return nil } // ValidateTokenID checks that 'input' can be parsed as a Token ID diff --git a/resource-manager/containerregistry/2023-07-01/webhooks/id_registry.go b/resource-manager/containerregistry/2023-07-01/webhooks/id_registry.go index 6a0695fe81d..c57285a575e 100644 --- a/resource-manager/containerregistry/2023-07-01/webhooks/id_registry.go +++ b/resource-manager/containerregistry/2023-07-01/webhooks/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/containerregistry/2023-07-01/webhooks/id_webhook.go b/resource-manager/containerregistry/2023-07-01/webhooks/id_webhook.go index 9764cd18a8c..eca5ddc35ce 100644 --- a/resource-manager/containerregistry/2023-07-01/webhooks/id_webhook.go +++ b/resource-manager/containerregistry/2023-07-01/webhooks/id_webhook.go @@ -38,23 +38,9 @@ func ParseWebHookID(input string) (*WebHookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WebHookId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.WebHookName, ok = parsed.Parsed["webHookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "webHookName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWebHookIDInsensitively(input string) (*WebHookId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WebHookId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WebHookId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.WebHookName, ok = parsed.Parsed["webHookName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "webHookName", *parsed) + if id.WebHookName, ok = input.Parsed["webHookName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "webHookName", input) } - return &id, nil + return nil } // ValidateWebHookID checks that 'input' can be parsed as a Web Hook ID diff --git a/resource-manager/containerservice/2019-08-01/agentpools/id_agentpool.go b/resource-manager/containerservice/2019-08-01/agentpools/id_agentpool.go index 1f64140362b..1f73b8efc50 100644 --- a/resource-manager/containerservice/2019-08-01/agentpools/id_agentpool.go +++ b/resource-manager/containerservice/2019-08-01/agentpools/id_agentpool.go @@ -38,23 +38,9 @@ func ParseAgentPoolID(input string) (*AgentPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AgentPoolId{} - - 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.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) - } - - if id.AgentPoolName, ok = parsed.Parsed["agentPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "agentPoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAgentPoolIDInsensitively(input string) (*AgentPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AgentPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AgentPoolId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if id.ManagedClusterName, ok = input.Parsed["managedClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", input) } - if id.AgentPoolName, ok = parsed.Parsed["agentPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "agentPoolName", *parsed) + if id.AgentPoolName, ok = input.Parsed["agentPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "agentPoolName", input) } - return &id, nil + return nil } // ValidateAgentPoolID checks that 'input' can be parsed as a Agent Pool ID diff --git a/resource-manager/containerservice/2019-08-01/containerservices/id_location.go b/resource-manager/containerservice/2019-08-01/containerservices/id_location.go index 9a6721b79f8..3e586911410 100644 --- a/resource-manager/containerservice/2019-08-01/containerservices/id_location.go +++ b/resource-manager/containerservice/2019-08-01/containerservices/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/containerservice/2019-08-01/managedclusters/id_accessprofile.go b/resource-manager/containerservice/2019-08-01/managedclusters/id_accessprofile.go index 5da6342fca3..e838fda20b8 100644 --- a/resource-manager/containerservice/2019-08-01/managedclusters/id_accessprofile.go +++ b/resource-manager/containerservice/2019-08-01/managedclusters/id_accessprofile.go @@ -38,23 +38,9 @@ func ParseAccessProfileID(input string) (*AccessProfileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccessProfileId{} - - 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.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) - } - - if id.AccessProfileName, ok = parsed.Parsed["accessProfileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accessProfileName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAccessProfileIDInsensitively(input string) (*AccessProfileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccessProfileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AccessProfileId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if id.ManagedClusterName, ok = input.Parsed["managedClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", input) } - if id.AccessProfileName, ok = parsed.Parsed["accessProfileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accessProfileName", *parsed) + if id.AccessProfileName, ok = input.Parsed["accessProfileName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accessProfileName", input) } - return &id, nil + return nil } // ValidateAccessProfileID checks that 'input' can be parsed as a Access Profile ID diff --git a/resource-manager/containerservice/2022-09-02-preview/agentpools/id_agentpool.go b/resource-manager/containerservice/2022-09-02-preview/agentpools/id_agentpool.go index 1f64140362b..1f73b8efc50 100644 --- a/resource-manager/containerservice/2022-09-02-preview/agentpools/id_agentpool.go +++ b/resource-manager/containerservice/2022-09-02-preview/agentpools/id_agentpool.go @@ -38,23 +38,9 @@ func ParseAgentPoolID(input string) (*AgentPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AgentPoolId{} - - 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.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) - } - - if id.AgentPoolName, ok = parsed.Parsed["agentPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "agentPoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAgentPoolIDInsensitively(input string) (*AgentPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AgentPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AgentPoolId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if id.ManagedClusterName, ok = input.Parsed["managedClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", input) } - if id.AgentPoolName, ok = parsed.Parsed["agentPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "agentPoolName", *parsed) + if id.AgentPoolName, ok = input.Parsed["agentPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "agentPoolName", input) } - return &id, nil + return nil } // ValidateAgentPoolID checks that 'input' can be parsed as a Agent Pool ID diff --git a/resource-manager/containerservice/2022-09-02-preview/fleetmembers/id_fleet.go b/resource-manager/containerservice/2022-09-02-preview/fleetmembers/id_fleet.go index e7133b4c9e8..cdea5cf32fc 100644 --- a/resource-manager/containerservice/2022-09-02-preview/fleetmembers/id_fleet.go +++ b/resource-manager/containerservice/2022-09-02-preview/fleetmembers/id_fleet.go @@ -36,19 +36,9 @@ func ParseFleetID(input string) (*FleetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FleetId{} - - 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.FleetName, ok = parsed.Parsed["fleetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fleetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFleetIDInsensitively(input string) (*FleetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FleetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FleetId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FleetName, ok = parsed.Parsed["fleetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fleetName", *parsed) + if id.FleetName, ok = input.Parsed["fleetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fleetName", input) } - return &id, nil + return nil } // ValidateFleetID checks that 'input' can be parsed as a Fleet ID diff --git a/resource-manager/containerservice/2022-09-02-preview/fleetmembers/id_member.go b/resource-manager/containerservice/2022-09-02-preview/fleetmembers/id_member.go index 32f25a7891c..a344d3e6559 100644 --- a/resource-manager/containerservice/2022-09-02-preview/fleetmembers/id_member.go +++ b/resource-manager/containerservice/2022-09-02-preview/fleetmembers/id_member.go @@ -38,23 +38,9 @@ func ParseMemberID(input string) (*MemberId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MemberId{} - - 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.FleetName, ok = parsed.Parsed["fleetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fleetName", *parsed) - } - - if id.MemberName, ok = parsed.Parsed["memberName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "memberName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseMemberIDInsensitively(input string) (*MemberId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MemberId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *MemberId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FleetName, ok = parsed.Parsed["fleetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fleetName", *parsed) + if id.FleetName, ok = input.Parsed["fleetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fleetName", input) } - if id.MemberName, ok = parsed.Parsed["memberName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "memberName", *parsed) + if id.MemberName, ok = input.Parsed["memberName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "memberName", input) } - return &id, nil + return nil } // ValidateMemberID checks that 'input' can be parsed as a Member ID diff --git a/resource-manager/containerservice/2022-09-02-preview/fleets/id_fleet.go b/resource-manager/containerservice/2022-09-02-preview/fleets/id_fleet.go index 4e177208948..d7d7a775d3e 100644 --- a/resource-manager/containerservice/2022-09-02-preview/fleets/id_fleet.go +++ b/resource-manager/containerservice/2022-09-02-preview/fleets/id_fleet.go @@ -36,19 +36,9 @@ func ParseFleetID(input string) (*FleetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FleetId{} - - 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.FleetName, ok = parsed.Parsed["fleetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fleetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFleetIDInsensitively(input string) (*FleetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FleetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FleetId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FleetName, ok = parsed.Parsed["fleetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fleetName", *parsed) + if id.FleetName, ok = input.Parsed["fleetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fleetName", input) } - return &id, nil + return nil } // ValidateFleetID checks that 'input' can be parsed as a Fleet ID diff --git a/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/id_maintenanceconfiguration.go b/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/id_maintenanceconfiguration.go index 90a03b71946..c660a4ef60c 100644 --- a/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/id_maintenanceconfiguration.go +++ b/resource-manager/containerservice/2022-09-02-preview/maintenanceconfigurations/id_maintenanceconfiguration.go @@ -38,23 +38,9 @@ func ParseMaintenanceConfigurationID(input string) (*MaintenanceConfigurationId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MaintenanceConfigurationId{} - - 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.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) - } - - if id.MaintenanceConfigurationName, ok = parsed.Parsed["maintenanceConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "maintenanceConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseMaintenanceConfigurationIDInsensitively(input string) (*MaintenanceCon return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MaintenanceConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *MaintenanceConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if id.ManagedClusterName, ok = input.Parsed["managedClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", input) } - if id.MaintenanceConfigurationName, ok = parsed.Parsed["maintenanceConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "maintenanceConfigurationName", *parsed) + if id.MaintenanceConfigurationName, ok = input.Parsed["maintenanceConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "maintenanceConfigurationName", input) } - return &id, nil + return nil } // ValidateMaintenanceConfigurationID checks that 'input' can be parsed as a Maintenance Configuration ID diff --git a/resource-manager/containerservice/2022-09-02-preview/managedclusters/id_accessprofile.go b/resource-manager/containerservice/2022-09-02-preview/managedclusters/id_accessprofile.go index 5da6342fca3..e838fda20b8 100644 --- a/resource-manager/containerservice/2022-09-02-preview/managedclusters/id_accessprofile.go +++ b/resource-manager/containerservice/2022-09-02-preview/managedclusters/id_accessprofile.go @@ -38,23 +38,9 @@ func ParseAccessProfileID(input string) (*AccessProfileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccessProfileId{} - - 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.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) - } - - if id.AccessProfileName, ok = parsed.Parsed["accessProfileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accessProfileName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAccessProfileIDInsensitively(input string) (*AccessProfileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccessProfileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AccessProfileId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if id.ManagedClusterName, ok = input.Parsed["managedClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", input) } - if id.AccessProfileName, ok = parsed.Parsed["accessProfileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accessProfileName", *parsed) + if id.AccessProfileName, ok = input.Parsed["accessProfileName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accessProfileName", input) } - return &id, nil + return nil } // ValidateAccessProfileID checks that 'input' can be parsed as a Access Profile ID diff --git a/resource-manager/containerservice/2022-09-02-preview/managedclusters/id_commandresult.go b/resource-manager/containerservice/2022-09-02-preview/managedclusters/id_commandresult.go index 16be91bbdfd..db8b9ca40da 100644 --- a/resource-manager/containerservice/2022-09-02-preview/managedclusters/id_commandresult.go +++ b/resource-manager/containerservice/2022-09-02-preview/managedclusters/id_commandresult.go @@ -38,23 +38,9 @@ func ParseCommandResultID(input string) (*CommandResultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommandResultId{} - - 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.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) - } - - if id.CommandId, ok = parsed.Parsed["commandId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "commandId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCommandResultIDInsensitively(input string) (*CommandResultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommandResultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CommandResultId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if id.ManagedClusterName, ok = input.Parsed["managedClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", input) } - if id.CommandId, ok = parsed.Parsed["commandId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "commandId", *parsed) + if id.CommandId, ok = input.Parsed["commandId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "commandId", input) } - return &id, nil + return nil } // ValidateCommandResultID checks that 'input' can be parsed as a Command Result ID diff --git a/resource-manager/containerservice/2022-09-02-preview/managedclusters/id_location.go b/resource-manager/containerservice/2022-09-02-preview/managedclusters/id_location.go index e9153531da7..8af29300251 100644 --- a/resource-manager/containerservice/2022-09-02-preview/managedclusters/id_location.go +++ b/resource-manager/containerservice/2022-09-02-preview/managedclusters/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/id_managedclustersnapshot.go b/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/id_managedclustersnapshot.go index 56aae183e0d..e0763766294 100644 --- a/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/id_managedclustersnapshot.go +++ b/resource-manager/containerservice/2022-09-02-preview/managedclustersnapshots/id_managedclustersnapshot.go @@ -36,19 +36,9 @@ func ParseManagedClusterSnapshotID(input string) (*ManagedClusterSnapshotId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedClusterSnapshotId{} - - 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.ManagedClusterSnapshotName, ok = parsed.Parsed["managedClusterSnapshotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterSnapshotName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagedClusterSnapshotIDInsensitively(input string) (*ManagedClusterSn return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedClusterSnapshotId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagedClusterSnapshotId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedClusterSnapshotName, ok = parsed.Parsed["managedClusterSnapshotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterSnapshotName", *parsed) + if id.ManagedClusterSnapshotName, ok = input.Parsed["managedClusterSnapshotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterSnapshotName", input) } - return &id, nil + return nil } // ValidateManagedClusterSnapshotID checks that 'input' can be parsed as a Managed Cluster Snapshot ID diff --git a/resource-manager/containerservice/2022-09-02-preview/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/containerservice/2022-09-02-preview/privateendpointconnections/id_privateendpointconnection.go index 7957d5c208c..1d0e3202ace 100644 --- a/resource-manager/containerservice/2022-09-02-preview/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/containerservice/2022-09-02-preview/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if id.ManagedClusterName, ok = input.Parsed["managedClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/containerservice/2022-09-02-preview/snapshots/id_snapshot.go b/resource-manager/containerservice/2022-09-02-preview/snapshots/id_snapshot.go index eee9219c960..7e6f2b19753 100644 --- a/resource-manager/containerservice/2022-09-02-preview/snapshots/id_snapshot.go +++ b/resource-manager/containerservice/2022-09-02-preview/snapshots/id_snapshot.go @@ -36,19 +36,9 @@ func ParseSnapshotID(input string) (*SnapshotId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SnapshotId{} - - 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.SnapshotName, ok = parsed.Parsed["snapshotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSnapshotIDInsensitively(input string) (*SnapshotId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SnapshotId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SnapshotId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SnapshotName, ok = parsed.Parsed["snapshotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotName", *parsed) + if id.SnapshotName, ok = input.Parsed["snapshotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "snapshotName", input) } - return &id, nil + return nil } // ValidateSnapshotID checks that 'input' can be parsed as a Snapshot ID diff --git a/resource-manager/containerservice/2022-09-02-preview/trustedaccess/id_location.go b/resource-manager/containerservice/2022-09-02-preview/trustedaccess/id_location.go index 792145d00c9..23c1dd4cbee 100644 --- a/resource-manager/containerservice/2022-09-02-preview/trustedaccess/id_location.go +++ b/resource-manager/containerservice/2022-09-02-preview/trustedaccess/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/containerservice/2022-09-02-preview/trustedaccess/id_trustedaccessrolebinding.go b/resource-manager/containerservice/2022-09-02-preview/trustedaccess/id_trustedaccessrolebinding.go index e04f903658f..2ab0bd8e0d4 100644 --- a/resource-manager/containerservice/2022-09-02-preview/trustedaccess/id_trustedaccessrolebinding.go +++ b/resource-manager/containerservice/2022-09-02-preview/trustedaccess/id_trustedaccessrolebinding.go @@ -38,23 +38,9 @@ func ParseTrustedAccessRoleBindingID(input string) (*TrustedAccessRoleBindingId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TrustedAccessRoleBindingId{} - - 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.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) - } - - if id.TrustedAccessRoleBindingName, ok = parsed.Parsed["trustedAccessRoleBindingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "trustedAccessRoleBindingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTrustedAccessRoleBindingIDInsensitively(input string) (*TrustedAccessR return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TrustedAccessRoleBindingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TrustedAccessRoleBindingId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if id.ManagedClusterName, ok = input.Parsed["managedClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", input) } - if id.TrustedAccessRoleBindingName, ok = parsed.Parsed["trustedAccessRoleBindingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "trustedAccessRoleBindingName", *parsed) + if id.TrustedAccessRoleBindingName, ok = input.Parsed["trustedAccessRoleBindingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "trustedAccessRoleBindingName", input) } - return &id, nil + return nil } // ValidateTrustedAccessRoleBindingID checks that 'input' can be parsed as a Trusted Access Role Binding ID diff --git a/resource-manager/containerservice/2023-03-02-preview/agentpools/id_agentpool.go b/resource-manager/containerservice/2023-03-02-preview/agentpools/id_agentpool.go index 1f64140362b..1f73b8efc50 100644 --- a/resource-manager/containerservice/2023-03-02-preview/agentpools/id_agentpool.go +++ b/resource-manager/containerservice/2023-03-02-preview/agentpools/id_agentpool.go @@ -38,23 +38,9 @@ func ParseAgentPoolID(input string) (*AgentPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AgentPoolId{} - - 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.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) - } - - if id.AgentPoolName, ok = parsed.Parsed["agentPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "agentPoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAgentPoolIDInsensitively(input string) (*AgentPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AgentPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AgentPoolId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if id.ManagedClusterName, ok = input.Parsed["managedClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", input) } - if id.AgentPoolName, ok = parsed.Parsed["agentPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "agentPoolName", *parsed) + if id.AgentPoolName, ok = input.Parsed["agentPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "agentPoolName", input) } - return &id, nil + return nil } // ValidateAgentPoolID checks that 'input' can be parsed as a Agent Pool ID diff --git a/resource-manager/containerservice/2023-03-02-preview/maintenanceconfigurations/id_maintenanceconfiguration.go b/resource-manager/containerservice/2023-03-02-preview/maintenanceconfigurations/id_maintenanceconfiguration.go index 90a03b71946..c660a4ef60c 100644 --- a/resource-manager/containerservice/2023-03-02-preview/maintenanceconfigurations/id_maintenanceconfiguration.go +++ b/resource-manager/containerservice/2023-03-02-preview/maintenanceconfigurations/id_maintenanceconfiguration.go @@ -38,23 +38,9 @@ func ParseMaintenanceConfigurationID(input string) (*MaintenanceConfigurationId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MaintenanceConfigurationId{} - - 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.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) - } - - if id.MaintenanceConfigurationName, ok = parsed.Parsed["maintenanceConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "maintenanceConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseMaintenanceConfigurationIDInsensitively(input string) (*MaintenanceCon return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MaintenanceConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *MaintenanceConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if id.ManagedClusterName, ok = input.Parsed["managedClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", input) } - if id.MaintenanceConfigurationName, ok = parsed.Parsed["maintenanceConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "maintenanceConfigurationName", *parsed) + if id.MaintenanceConfigurationName, ok = input.Parsed["maintenanceConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "maintenanceConfigurationName", input) } - return &id, nil + return nil } // ValidateMaintenanceConfigurationID checks that 'input' can be parsed as a Maintenance Configuration ID diff --git a/resource-manager/containerservice/2023-03-02-preview/managedclusters/id_accessprofile.go b/resource-manager/containerservice/2023-03-02-preview/managedclusters/id_accessprofile.go index 5da6342fca3..e838fda20b8 100644 --- a/resource-manager/containerservice/2023-03-02-preview/managedclusters/id_accessprofile.go +++ b/resource-manager/containerservice/2023-03-02-preview/managedclusters/id_accessprofile.go @@ -38,23 +38,9 @@ func ParseAccessProfileID(input string) (*AccessProfileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccessProfileId{} - - 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.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) - } - - if id.AccessProfileName, ok = parsed.Parsed["accessProfileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accessProfileName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAccessProfileIDInsensitively(input string) (*AccessProfileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccessProfileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AccessProfileId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if id.ManagedClusterName, ok = input.Parsed["managedClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", input) } - if id.AccessProfileName, ok = parsed.Parsed["accessProfileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accessProfileName", *parsed) + if id.AccessProfileName, ok = input.Parsed["accessProfileName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accessProfileName", input) } - return &id, nil + return nil } // ValidateAccessProfileID checks that 'input' can be parsed as a Access Profile ID diff --git a/resource-manager/containerservice/2023-03-02-preview/managedclusters/id_commandresult.go b/resource-manager/containerservice/2023-03-02-preview/managedclusters/id_commandresult.go index 16be91bbdfd..db8b9ca40da 100644 --- a/resource-manager/containerservice/2023-03-02-preview/managedclusters/id_commandresult.go +++ b/resource-manager/containerservice/2023-03-02-preview/managedclusters/id_commandresult.go @@ -38,23 +38,9 @@ func ParseCommandResultID(input string) (*CommandResultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommandResultId{} - - 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.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) - } - - if id.CommandId, ok = parsed.Parsed["commandId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "commandId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCommandResultIDInsensitively(input string) (*CommandResultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommandResultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CommandResultId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if id.ManagedClusterName, ok = input.Parsed["managedClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", input) } - if id.CommandId, ok = parsed.Parsed["commandId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "commandId", *parsed) + if id.CommandId, ok = input.Parsed["commandId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "commandId", input) } - return &id, nil + return nil } // ValidateCommandResultID checks that 'input' can be parsed as a Command Result ID diff --git a/resource-manager/containerservice/2023-03-02-preview/managedclusters/id_location.go b/resource-manager/containerservice/2023-03-02-preview/managedclusters/id_location.go index e9153531da7..8af29300251 100644 --- a/resource-manager/containerservice/2023-03-02-preview/managedclusters/id_location.go +++ b/resource-manager/containerservice/2023-03-02-preview/managedclusters/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/id_managedclustersnapshot.go b/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/id_managedclustersnapshot.go index 56aae183e0d..e0763766294 100644 --- a/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/id_managedclustersnapshot.go +++ b/resource-manager/containerservice/2023-03-02-preview/managedclustersnapshots/id_managedclustersnapshot.go @@ -36,19 +36,9 @@ func ParseManagedClusterSnapshotID(input string) (*ManagedClusterSnapshotId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedClusterSnapshotId{} - - 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.ManagedClusterSnapshotName, ok = parsed.Parsed["managedClusterSnapshotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterSnapshotName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagedClusterSnapshotIDInsensitively(input string) (*ManagedClusterSn return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedClusterSnapshotId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagedClusterSnapshotId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedClusterSnapshotName, ok = parsed.Parsed["managedClusterSnapshotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterSnapshotName", *parsed) + if id.ManagedClusterSnapshotName, ok = input.Parsed["managedClusterSnapshotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterSnapshotName", input) } - return &id, nil + return nil } // ValidateManagedClusterSnapshotID checks that 'input' can be parsed as a Managed Cluster Snapshot ID diff --git a/resource-manager/containerservice/2023-03-02-preview/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/containerservice/2023-03-02-preview/privateendpointconnections/id_privateendpointconnection.go index 7957d5c208c..1d0e3202ace 100644 --- a/resource-manager/containerservice/2023-03-02-preview/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/containerservice/2023-03-02-preview/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if id.ManagedClusterName, ok = input.Parsed["managedClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/containerservice/2023-03-02-preview/snapshots/id_snapshot.go b/resource-manager/containerservice/2023-03-02-preview/snapshots/id_snapshot.go index eee9219c960..7e6f2b19753 100644 --- a/resource-manager/containerservice/2023-03-02-preview/snapshots/id_snapshot.go +++ b/resource-manager/containerservice/2023-03-02-preview/snapshots/id_snapshot.go @@ -36,19 +36,9 @@ func ParseSnapshotID(input string) (*SnapshotId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SnapshotId{} - - 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.SnapshotName, ok = parsed.Parsed["snapshotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSnapshotIDInsensitively(input string) (*SnapshotId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SnapshotId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SnapshotId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SnapshotName, ok = parsed.Parsed["snapshotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotName", *parsed) + if id.SnapshotName, ok = input.Parsed["snapshotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "snapshotName", input) } - return &id, nil + return nil } // ValidateSnapshotID checks that 'input' can be parsed as a Snapshot ID diff --git a/resource-manager/containerservice/2023-03-02-preview/trustedaccess/id_location.go b/resource-manager/containerservice/2023-03-02-preview/trustedaccess/id_location.go index 792145d00c9..23c1dd4cbee 100644 --- a/resource-manager/containerservice/2023-03-02-preview/trustedaccess/id_location.go +++ b/resource-manager/containerservice/2023-03-02-preview/trustedaccess/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/containerservice/2023-03-02-preview/trustedaccess/id_trustedaccessrolebinding.go b/resource-manager/containerservice/2023-03-02-preview/trustedaccess/id_trustedaccessrolebinding.go index e04f903658f..2ab0bd8e0d4 100644 --- a/resource-manager/containerservice/2023-03-02-preview/trustedaccess/id_trustedaccessrolebinding.go +++ b/resource-manager/containerservice/2023-03-02-preview/trustedaccess/id_trustedaccessrolebinding.go @@ -38,23 +38,9 @@ func ParseTrustedAccessRoleBindingID(input string) (*TrustedAccessRoleBindingId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TrustedAccessRoleBindingId{} - - 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.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) - } - - if id.TrustedAccessRoleBindingName, ok = parsed.Parsed["trustedAccessRoleBindingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "trustedAccessRoleBindingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTrustedAccessRoleBindingIDInsensitively(input string) (*TrustedAccessR return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TrustedAccessRoleBindingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TrustedAccessRoleBindingId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if id.ManagedClusterName, ok = input.Parsed["managedClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", input) } - if id.TrustedAccessRoleBindingName, ok = parsed.Parsed["trustedAccessRoleBindingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "trustedAccessRoleBindingName", *parsed) + if id.TrustedAccessRoleBindingName, ok = input.Parsed["trustedAccessRoleBindingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "trustedAccessRoleBindingName", input) } - return &id, nil + return nil } // ValidateTrustedAccessRoleBindingID checks that 'input' can be parsed as a Trusted Access Role Binding ID diff --git a/resource-manager/containerservice/2023-04-02-preview/agentpools/id_agentpool.go b/resource-manager/containerservice/2023-04-02-preview/agentpools/id_agentpool.go index 1f64140362b..1f73b8efc50 100644 --- a/resource-manager/containerservice/2023-04-02-preview/agentpools/id_agentpool.go +++ b/resource-manager/containerservice/2023-04-02-preview/agentpools/id_agentpool.go @@ -38,23 +38,9 @@ func ParseAgentPoolID(input string) (*AgentPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AgentPoolId{} - - 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.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) - } - - if id.AgentPoolName, ok = parsed.Parsed["agentPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "agentPoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAgentPoolIDInsensitively(input string) (*AgentPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AgentPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AgentPoolId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if id.ManagedClusterName, ok = input.Parsed["managedClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", input) } - if id.AgentPoolName, ok = parsed.Parsed["agentPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "agentPoolName", *parsed) + if id.AgentPoolName, ok = input.Parsed["agentPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "agentPoolName", input) } - return &id, nil + return nil } // ValidateAgentPoolID checks that 'input' can be parsed as a Agent Pool ID diff --git a/resource-manager/containerservice/2023-04-02-preview/maintenanceconfigurations/id_maintenanceconfiguration.go b/resource-manager/containerservice/2023-04-02-preview/maintenanceconfigurations/id_maintenanceconfiguration.go index 90a03b71946..c660a4ef60c 100644 --- a/resource-manager/containerservice/2023-04-02-preview/maintenanceconfigurations/id_maintenanceconfiguration.go +++ b/resource-manager/containerservice/2023-04-02-preview/maintenanceconfigurations/id_maintenanceconfiguration.go @@ -38,23 +38,9 @@ func ParseMaintenanceConfigurationID(input string) (*MaintenanceConfigurationId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MaintenanceConfigurationId{} - - 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.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) - } - - if id.MaintenanceConfigurationName, ok = parsed.Parsed["maintenanceConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "maintenanceConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseMaintenanceConfigurationIDInsensitively(input string) (*MaintenanceCon return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MaintenanceConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *MaintenanceConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if id.ManagedClusterName, ok = input.Parsed["managedClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", input) } - if id.MaintenanceConfigurationName, ok = parsed.Parsed["maintenanceConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "maintenanceConfigurationName", *parsed) + if id.MaintenanceConfigurationName, ok = input.Parsed["maintenanceConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "maintenanceConfigurationName", input) } - return &id, nil + return nil } // ValidateMaintenanceConfigurationID checks that 'input' can be parsed as a Maintenance Configuration ID diff --git a/resource-manager/containerservice/2023-04-02-preview/managedclusters/id_accessprofile.go b/resource-manager/containerservice/2023-04-02-preview/managedclusters/id_accessprofile.go index 5da6342fca3..e838fda20b8 100644 --- a/resource-manager/containerservice/2023-04-02-preview/managedclusters/id_accessprofile.go +++ b/resource-manager/containerservice/2023-04-02-preview/managedclusters/id_accessprofile.go @@ -38,23 +38,9 @@ func ParseAccessProfileID(input string) (*AccessProfileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccessProfileId{} - - 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.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) - } - - if id.AccessProfileName, ok = parsed.Parsed["accessProfileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accessProfileName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAccessProfileIDInsensitively(input string) (*AccessProfileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccessProfileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AccessProfileId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if id.ManagedClusterName, ok = input.Parsed["managedClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", input) } - if id.AccessProfileName, ok = parsed.Parsed["accessProfileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accessProfileName", *parsed) + if id.AccessProfileName, ok = input.Parsed["accessProfileName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accessProfileName", input) } - return &id, nil + return nil } // ValidateAccessProfileID checks that 'input' can be parsed as a Access Profile ID diff --git a/resource-manager/containerservice/2023-04-02-preview/managedclusters/id_commandresult.go b/resource-manager/containerservice/2023-04-02-preview/managedclusters/id_commandresult.go index 16be91bbdfd..db8b9ca40da 100644 --- a/resource-manager/containerservice/2023-04-02-preview/managedclusters/id_commandresult.go +++ b/resource-manager/containerservice/2023-04-02-preview/managedclusters/id_commandresult.go @@ -38,23 +38,9 @@ func ParseCommandResultID(input string) (*CommandResultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommandResultId{} - - 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.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) - } - - if id.CommandId, ok = parsed.Parsed["commandId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "commandId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCommandResultIDInsensitively(input string) (*CommandResultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommandResultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CommandResultId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if id.ManagedClusterName, ok = input.Parsed["managedClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", input) } - if id.CommandId, ok = parsed.Parsed["commandId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "commandId", *parsed) + if id.CommandId, ok = input.Parsed["commandId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "commandId", input) } - return &id, nil + return nil } // ValidateCommandResultID checks that 'input' can be parsed as a Command Result ID diff --git a/resource-manager/containerservice/2023-04-02-preview/managedclusters/id_location.go b/resource-manager/containerservice/2023-04-02-preview/managedclusters/id_location.go index e9153531da7..8af29300251 100644 --- a/resource-manager/containerservice/2023-04-02-preview/managedclusters/id_location.go +++ b/resource-manager/containerservice/2023-04-02-preview/managedclusters/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/containerservice/2023-04-02-preview/managedclustersnapshots/id_managedclustersnapshot.go b/resource-manager/containerservice/2023-04-02-preview/managedclustersnapshots/id_managedclustersnapshot.go index 56aae183e0d..e0763766294 100644 --- a/resource-manager/containerservice/2023-04-02-preview/managedclustersnapshots/id_managedclustersnapshot.go +++ b/resource-manager/containerservice/2023-04-02-preview/managedclustersnapshots/id_managedclustersnapshot.go @@ -36,19 +36,9 @@ func ParseManagedClusterSnapshotID(input string) (*ManagedClusterSnapshotId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedClusterSnapshotId{} - - 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.ManagedClusterSnapshotName, ok = parsed.Parsed["managedClusterSnapshotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterSnapshotName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagedClusterSnapshotIDInsensitively(input string) (*ManagedClusterSn return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedClusterSnapshotId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagedClusterSnapshotId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedClusterSnapshotName, ok = parsed.Parsed["managedClusterSnapshotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterSnapshotName", *parsed) + if id.ManagedClusterSnapshotName, ok = input.Parsed["managedClusterSnapshotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterSnapshotName", input) } - return &id, nil + return nil } // ValidateManagedClusterSnapshotID checks that 'input' can be parsed as a Managed Cluster Snapshot ID diff --git a/resource-manager/containerservice/2023-04-02-preview/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/containerservice/2023-04-02-preview/privateendpointconnections/id_privateendpointconnection.go index 7957d5c208c..1d0e3202ace 100644 --- a/resource-manager/containerservice/2023-04-02-preview/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/containerservice/2023-04-02-preview/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if id.ManagedClusterName, ok = input.Parsed["managedClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/containerservice/2023-04-02-preview/snapshots/id_snapshot.go b/resource-manager/containerservice/2023-04-02-preview/snapshots/id_snapshot.go index eee9219c960..7e6f2b19753 100644 --- a/resource-manager/containerservice/2023-04-02-preview/snapshots/id_snapshot.go +++ b/resource-manager/containerservice/2023-04-02-preview/snapshots/id_snapshot.go @@ -36,19 +36,9 @@ func ParseSnapshotID(input string) (*SnapshotId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SnapshotId{} - - 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.SnapshotName, ok = parsed.Parsed["snapshotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSnapshotIDInsensitively(input string) (*SnapshotId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SnapshotId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SnapshotId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SnapshotName, ok = parsed.Parsed["snapshotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotName", *parsed) + if id.SnapshotName, ok = input.Parsed["snapshotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "snapshotName", input) } - return &id, nil + return nil } // ValidateSnapshotID checks that 'input' can be parsed as a Snapshot ID diff --git a/resource-manager/containerservice/2023-04-02-preview/trustedaccess/id_location.go b/resource-manager/containerservice/2023-04-02-preview/trustedaccess/id_location.go index 792145d00c9..23c1dd4cbee 100644 --- a/resource-manager/containerservice/2023-04-02-preview/trustedaccess/id_location.go +++ b/resource-manager/containerservice/2023-04-02-preview/trustedaccess/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/containerservice/2023-04-02-preview/trustedaccess/id_trustedaccessrolebinding.go b/resource-manager/containerservice/2023-04-02-preview/trustedaccess/id_trustedaccessrolebinding.go index e04f903658f..2ab0bd8e0d4 100644 --- a/resource-manager/containerservice/2023-04-02-preview/trustedaccess/id_trustedaccessrolebinding.go +++ b/resource-manager/containerservice/2023-04-02-preview/trustedaccess/id_trustedaccessrolebinding.go @@ -38,23 +38,9 @@ func ParseTrustedAccessRoleBindingID(input string) (*TrustedAccessRoleBindingId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TrustedAccessRoleBindingId{} - - 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.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) - } - - if id.TrustedAccessRoleBindingName, ok = parsed.Parsed["trustedAccessRoleBindingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "trustedAccessRoleBindingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTrustedAccessRoleBindingIDInsensitively(input string) (*TrustedAccessR return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TrustedAccessRoleBindingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TrustedAccessRoleBindingId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if id.ManagedClusterName, ok = input.Parsed["managedClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", input) } - if id.TrustedAccessRoleBindingName, ok = parsed.Parsed["trustedAccessRoleBindingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "trustedAccessRoleBindingName", *parsed) + if id.TrustedAccessRoleBindingName, ok = input.Parsed["trustedAccessRoleBindingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "trustedAccessRoleBindingName", input) } - return &id, nil + return nil } // ValidateTrustedAccessRoleBindingID checks that 'input' can be parsed as a Trusted Access Role Binding ID diff --git a/resource-manager/containerservice/2023-10-15/fleetmembers/id_fleet.go b/resource-manager/containerservice/2023-10-15/fleetmembers/id_fleet.go index e7133b4c9e8..cdea5cf32fc 100644 --- a/resource-manager/containerservice/2023-10-15/fleetmembers/id_fleet.go +++ b/resource-manager/containerservice/2023-10-15/fleetmembers/id_fleet.go @@ -36,19 +36,9 @@ func ParseFleetID(input string) (*FleetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FleetId{} - - 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.FleetName, ok = parsed.Parsed["fleetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fleetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFleetIDInsensitively(input string) (*FleetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FleetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FleetId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FleetName, ok = parsed.Parsed["fleetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fleetName", *parsed) + if id.FleetName, ok = input.Parsed["fleetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fleetName", input) } - return &id, nil + return nil } // ValidateFleetID checks that 'input' can be parsed as a Fleet ID diff --git a/resource-manager/containerservice/2023-10-15/fleetmembers/id_member.go b/resource-manager/containerservice/2023-10-15/fleetmembers/id_member.go index 32f25a7891c..a344d3e6559 100644 --- a/resource-manager/containerservice/2023-10-15/fleetmembers/id_member.go +++ b/resource-manager/containerservice/2023-10-15/fleetmembers/id_member.go @@ -38,23 +38,9 @@ func ParseMemberID(input string) (*MemberId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MemberId{} - - 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.FleetName, ok = parsed.Parsed["fleetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fleetName", *parsed) - } - - if id.MemberName, ok = parsed.Parsed["memberName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "memberName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseMemberIDInsensitively(input string) (*MemberId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MemberId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *MemberId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FleetName, ok = parsed.Parsed["fleetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fleetName", *parsed) + if id.FleetName, ok = input.Parsed["fleetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fleetName", input) } - if id.MemberName, ok = parsed.Parsed["memberName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "memberName", *parsed) + if id.MemberName, ok = input.Parsed["memberName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "memberName", input) } - return &id, nil + return nil } // ValidateMemberID checks that 'input' can be parsed as a Member ID diff --git a/resource-manager/containerservice/2023-10-15/fleets/id_fleet.go b/resource-manager/containerservice/2023-10-15/fleets/id_fleet.go index 4e177208948..d7d7a775d3e 100644 --- a/resource-manager/containerservice/2023-10-15/fleets/id_fleet.go +++ b/resource-manager/containerservice/2023-10-15/fleets/id_fleet.go @@ -36,19 +36,9 @@ func ParseFleetID(input string) (*FleetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FleetId{} - - 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.FleetName, ok = parsed.Parsed["fleetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fleetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFleetIDInsensitively(input string) (*FleetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FleetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FleetId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FleetName, ok = parsed.Parsed["fleetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fleetName", *parsed) + if id.FleetName, ok = input.Parsed["fleetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fleetName", input) } - return &id, nil + return nil } // ValidateFleetID checks that 'input' can be parsed as a Fleet ID diff --git a/resource-manager/containerservice/2023-10-15/fleetupdatestrategies/id_fleet.go b/resource-manager/containerservice/2023-10-15/fleetupdatestrategies/id_fleet.go index e869b09adb2..fec85c2c85f 100644 --- a/resource-manager/containerservice/2023-10-15/fleetupdatestrategies/id_fleet.go +++ b/resource-manager/containerservice/2023-10-15/fleetupdatestrategies/id_fleet.go @@ -36,19 +36,9 @@ func ParseFleetID(input string) (*FleetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FleetId{} - - 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.FleetName, ok = parsed.Parsed["fleetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fleetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFleetIDInsensitively(input string) (*FleetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FleetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FleetId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FleetName, ok = parsed.Parsed["fleetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fleetName", *parsed) + if id.FleetName, ok = input.Parsed["fleetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fleetName", input) } - return &id, nil + return nil } // ValidateFleetID checks that 'input' can be parsed as a Fleet ID diff --git a/resource-manager/containerservice/2023-10-15/fleetupdatestrategies/id_updatestrategy.go b/resource-manager/containerservice/2023-10-15/fleetupdatestrategies/id_updatestrategy.go index e5386adc379..6b236372bd9 100644 --- a/resource-manager/containerservice/2023-10-15/fleetupdatestrategies/id_updatestrategy.go +++ b/resource-manager/containerservice/2023-10-15/fleetupdatestrategies/id_updatestrategy.go @@ -38,23 +38,9 @@ func ParseUpdateStrategyID(input string) (*UpdateStrategyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UpdateStrategyId{} - - 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.FleetName, ok = parsed.Parsed["fleetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fleetName", *parsed) - } - - if id.UpdateStrategyName, ok = parsed.Parsed["updateStrategyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "updateStrategyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseUpdateStrategyIDInsensitively(input string) (*UpdateStrategyId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UpdateStrategyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UpdateStrategyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FleetName, ok = parsed.Parsed["fleetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fleetName", *parsed) + if id.FleetName, ok = input.Parsed["fleetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fleetName", input) } - if id.UpdateStrategyName, ok = parsed.Parsed["updateStrategyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "updateStrategyName", *parsed) + if id.UpdateStrategyName, ok = input.Parsed["updateStrategyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "updateStrategyName", input) } - return &id, nil + return nil } // ValidateUpdateStrategyID checks that 'input' can be parsed as a Update Strategy ID diff --git a/resource-manager/containerservice/2023-10-15/updateruns/id_fleet.go b/resource-manager/containerservice/2023-10-15/updateruns/id_fleet.go index 1b2c83083b3..a133f3622cd 100644 --- a/resource-manager/containerservice/2023-10-15/updateruns/id_fleet.go +++ b/resource-manager/containerservice/2023-10-15/updateruns/id_fleet.go @@ -36,19 +36,9 @@ func ParseFleetID(input string) (*FleetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FleetId{} - - 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.FleetName, ok = parsed.Parsed["fleetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fleetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFleetIDInsensitively(input string) (*FleetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FleetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FleetId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FleetName, ok = parsed.Parsed["fleetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fleetName", *parsed) + if id.FleetName, ok = input.Parsed["fleetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fleetName", input) } - return &id, nil + return nil } // ValidateFleetID checks that 'input' can be parsed as a Fleet ID diff --git a/resource-manager/containerservice/2023-10-15/updateruns/id_updaterun.go b/resource-manager/containerservice/2023-10-15/updateruns/id_updaterun.go index aff422e4b54..ab390924316 100644 --- a/resource-manager/containerservice/2023-10-15/updateruns/id_updaterun.go +++ b/resource-manager/containerservice/2023-10-15/updateruns/id_updaterun.go @@ -38,23 +38,9 @@ func ParseUpdateRunID(input string) (*UpdateRunId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UpdateRunId{} - - 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.FleetName, ok = parsed.Parsed["fleetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fleetName", *parsed) - } - - if id.UpdateRunName, ok = parsed.Parsed["updateRunName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "updateRunName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseUpdateRunIDInsensitively(input string) (*UpdateRunId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UpdateRunId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UpdateRunId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FleetName, ok = parsed.Parsed["fleetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fleetName", *parsed) + if id.FleetName, ok = input.Parsed["fleetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fleetName", input) } - if id.UpdateRunName, ok = parsed.Parsed["updateRunName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "updateRunName", *parsed) + if id.UpdateRunName, ok = input.Parsed["updateRunName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "updateRunName", input) } - return &id, nil + return nil } // ValidateUpdateRunID checks that 'input' can be parsed as a Update Run ID diff --git a/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_cassandrakeyspace.go b/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_cassandrakeyspace.go index 9555cbf46b1..c0948748c2d 100644 --- a/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_cassandrakeyspace.go +++ b/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_cassandrakeyspace.go @@ -38,23 +38,9 @@ func ParseCassandraKeyspaceID(input string) (*CassandraKeyspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CassandraKeyspaceId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.CassandraKeyspaceName, ok = parsed.Parsed["cassandraKeyspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cassandraKeyspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCassandraKeyspaceIDInsensitively(input string) (*CassandraKeyspaceId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CassandraKeyspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CassandraKeyspaceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.CassandraKeyspaceName, ok = parsed.Parsed["cassandraKeyspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cassandraKeyspaceName", *parsed) + if id.CassandraKeyspaceName, ok = input.Parsed["cassandraKeyspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cassandraKeyspaceName", input) } - return &id, nil + return nil } // ValidateCassandraKeyspaceID checks that 'input' can be parsed as a Cassandra Keyspace ID diff --git a/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_cassandrakeyspacetable.go b/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_cassandrakeyspacetable.go index 66b3ea506a4..0e9b31b7d48 100644 --- a/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_cassandrakeyspacetable.go +++ b/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_cassandrakeyspacetable.go @@ -40,27 +40,9 @@ func ParseCassandraKeyspaceTableID(input string) (*CassandraKeyspaceTableId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CassandraKeyspaceTableId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.CassandraKeyspaceName, ok = parsed.Parsed["cassandraKeyspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cassandraKeyspaceName", *parsed) - } - - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseCassandraKeyspaceTableIDInsensitively(input string) (*CassandraKeyspac return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CassandraKeyspaceTableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *CassandraKeyspaceTableId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.CassandraKeyspaceName, ok = parsed.Parsed["cassandraKeyspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cassandraKeyspaceName", *parsed) + if id.CassandraKeyspaceName, ok = input.Parsed["cassandraKeyspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cassandraKeyspaceName", input) } - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if id.TableName, ok = input.Parsed["tableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tableName", input) } - return &id, nil + return nil } // ValidateCassandraKeyspaceTableID checks that 'input' can be parsed as a Cassandra Keyspace Table ID diff --git a/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_collection.go b/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_collection.go index a7e01b98015..06ba5f2c382 100644 --- a/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_collection.go +++ b/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_collection.go @@ -40,27 +40,9 @@ func ParseCollectionID(input string) (*CollectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CollectionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) - } - - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseCollectionIDInsensitively(input string) (*CollectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CollectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *CollectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if id.CollectionName, ok = input.Parsed["collectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "collectionName", input) } - return &id, nil + return nil } // ValidateCollectionID checks that 'input' can be parsed as a Collection ID diff --git a/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_collectionpartitionkeyrangeid.go b/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_collectionpartitionkeyrangeid.go index 5819216ab8d..af2697450ff 100644 --- a/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_collectionpartitionkeyrangeid.go +++ b/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_collectionpartitionkeyrangeid.go @@ -44,35 +44,9 @@ func ParseCollectionPartitionKeyRangeIdID(input string) (*CollectionPartitionKey return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CollectionPartitionKeyRangeIdId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.RegionName, ok = parsed.Parsed["regionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "regionName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) - } - - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) - } - - if id.PartitionKeyRangeId, ok = parsed.Parsed["partitionKeyRangeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "partitionKeyRangeId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseCollectionPartitionKeyRangeIdIDInsensitively(input string) (*Collectio return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CollectionPartitionKeyRangeIdId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *CollectionPartitionKeyRangeIdId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.RegionName, ok = parsed.Parsed["regionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "regionName", *parsed) + if id.RegionName, ok = input.Parsed["regionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "regionName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if id.CollectionName, ok = input.Parsed["collectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "collectionName", input) } - if id.PartitionKeyRangeId, ok = parsed.Parsed["partitionKeyRangeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "partitionKeyRangeId", *parsed) + if id.PartitionKeyRangeId, ok = input.Parsed["partitionKeyRangeId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "partitionKeyRangeId", input) } - return &id, nil + return nil } // ValidateCollectionPartitionKeyRangeIdID checks that 'input' can be parsed as a Collection Partition Key Range Id ID diff --git a/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_container.go b/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_container.go index 7a27bedb708..325844c7b0f 100644 --- a/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_container.go +++ b/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_container.go @@ -40,27 +40,9 @@ func ParseContainerID(input string) (*ContainerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) - } - - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseContainerIDInsensitively(input string) (*ContainerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ContainerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) + if id.SqlDatabaseName, ok = input.Parsed["sqlDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", input) } - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) + if id.ContainerName, ok = input.Parsed["containerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerName", input) } - return &id, nil + return nil } // ValidateContainerID checks that 'input' can be parsed as a Container ID diff --git a/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_database.go b/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_database.go index 06541d6f6c6..c52995f2bc9 100644 --- a/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_database.go +++ b/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_database.go @@ -38,23 +38,9 @@ func ParseDatabaseID(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDatabaseIDInsensitively(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - return &id, nil + return nil } // ValidateDatabaseID checks that 'input' can be parsed as a Database ID diff --git a/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_databaseaccount.go b/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_databaseaccount.go index 0e56a8d66f5..425f2c9b5ae 100644 --- a/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_databaseaccount.go +++ b/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_databaseaccount.go @@ -36,19 +36,9 @@ func ParseDatabaseAccountID(input string) (*DatabaseAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDatabaseAccountIDInsensitively(input string) (*DatabaseAccountId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DatabaseAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - return &id, nil + return nil } // ValidateDatabaseAccountID checks that 'input' can be parsed as a Database Account ID diff --git a/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_databaseaccountname.go b/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_databaseaccountname.go index 1ad2a926aa2..a2757f56303 100644 --- a/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_databaseaccountname.go +++ b/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_databaseaccountname.go @@ -32,11 +32,9 @@ func ParseDatabaseAccountNameID(input string) (*DatabaseAccountNameId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountNameId{} - - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseDatabaseAccountNameIDInsensitively(input string) (*DatabaseAccountName return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountNameId{} - - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *DatabaseAccountNameId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) + } + + return nil +} + // ValidateDatabaseAccountNameID checks that 'input' can be parsed as a Database Account Name ID func ValidateDatabaseAccountNameID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_databasecollection.go b/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_databasecollection.go index ae75117d04e..82742bb4c95 100644 --- a/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_databasecollection.go +++ b/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_databasecollection.go @@ -42,31 +42,9 @@ func ParseDatabaseCollectionID(input string) (*DatabaseCollectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseCollectionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.RegionName, ok = parsed.Parsed["regionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "regionName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) - } - - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseDatabaseCollectionIDInsensitively(input string) (*DatabaseCollectionId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseCollectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DatabaseCollectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.RegionName, ok = parsed.Parsed["regionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "regionName", *parsed) + if id.RegionName, ok = input.Parsed["regionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "regionName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if id.CollectionName, ok = input.Parsed["collectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "collectionName", input) } - return &id, nil + return nil } // ValidateDatabaseCollectionID checks that 'input' can be parsed as a Database Collection ID diff --git a/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_graph.go b/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_graph.go index 990cf689b19..87414bff4e5 100644 --- a/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_graph.go +++ b/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_graph.go @@ -40,27 +40,9 @@ func ParseGraphID(input string) (*GraphId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GraphId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.GremlinDatabaseName, ok = parsed.Parsed["gremlinDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gremlinDatabaseName", *parsed) - } - - if id.GraphName, ok = parsed.Parsed["graphName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "graphName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseGraphIDInsensitively(input string) (*GraphId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GraphId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *GraphId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.GremlinDatabaseName, ok = parsed.Parsed["gremlinDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gremlinDatabaseName", *parsed) + if id.GremlinDatabaseName, ok = input.Parsed["gremlinDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gremlinDatabaseName", input) } - if id.GraphName, ok = parsed.Parsed["graphName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "graphName", *parsed) + if id.GraphName, ok = input.Parsed["graphName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "graphName", input) } - return &id, nil + return nil } // ValidateGraphID checks that 'input' can be parsed as a Graph ID diff --git a/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_gremlindatabase.go b/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_gremlindatabase.go index 20095da53b2..62c750d65ce 100644 --- a/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_gremlindatabase.go +++ b/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_gremlindatabase.go @@ -38,23 +38,9 @@ func ParseGremlinDatabaseID(input string) (*GremlinDatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GremlinDatabaseId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.GremlinDatabaseName, ok = parsed.Parsed["gremlinDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gremlinDatabaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGremlinDatabaseIDInsensitively(input string) (*GremlinDatabaseId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GremlinDatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GremlinDatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.GremlinDatabaseName, ok = parsed.Parsed["gremlinDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gremlinDatabaseName", *parsed) + if id.GremlinDatabaseName, ok = input.Parsed["gremlinDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gremlinDatabaseName", input) } - return &id, nil + return nil } // ValidateGremlinDatabaseID checks that 'input' can be parsed as a Gremlin Database ID diff --git a/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_location.go b/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_location.go index bc6bbfc9d1d..2955e6dd543 100644 --- a/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_location.go +++ b/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_mongodbdatabase.go b/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_mongodbdatabase.go index 245c181e310..f156cc1f463 100644 --- a/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_mongodbdatabase.go +++ b/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_mongodbdatabase.go @@ -38,23 +38,9 @@ func ParseMongodbDatabaseID(input string) (*MongodbDatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MongodbDatabaseId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.MongodbDatabaseName, ok = parsed.Parsed["mongodbDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mongodbDatabaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseMongodbDatabaseIDInsensitively(input string) (*MongodbDatabaseId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MongodbDatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *MongodbDatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.MongodbDatabaseName, ok = parsed.Parsed["mongodbDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mongodbDatabaseName", *parsed) + if id.MongodbDatabaseName, ok = input.Parsed["mongodbDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mongodbDatabaseName", input) } - return &id, nil + return nil } // ValidateMongodbDatabaseID checks that 'input' can be parsed as a Mongodb Database ID diff --git a/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_mongodbdatabasecollection.go b/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_mongodbdatabasecollection.go index fd0ec8e076a..e571a8d6f95 100644 --- a/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_mongodbdatabasecollection.go +++ b/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_mongodbdatabasecollection.go @@ -40,27 +40,9 @@ func ParseMongodbDatabaseCollectionID(input string) (*MongodbDatabaseCollectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MongodbDatabaseCollectionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.MongodbDatabaseName, ok = parsed.Parsed["mongodbDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mongodbDatabaseName", *parsed) - } - - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseMongodbDatabaseCollectionIDInsensitively(input string) (*MongodbDataba return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MongodbDatabaseCollectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *MongodbDatabaseCollectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.MongodbDatabaseName, ok = parsed.Parsed["mongodbDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mongodbDatabaseName", *parsed) + if id.MongodbDatabaseName, ok = input.Parsed["mongodbDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mongodbDatabaseName", input) } - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if id.CollectionName, ok = input.Parsed["collectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "collectionName", input) } - return &id, nil + return nil } // ValidateMongodbDatabaseCollectionID checks that 'input' can be parsed as a Mongodb Database Collection ID diff --git a/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_partitionkeyrangeid.go b/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_partitionkeyrangeid.go index f90c9d9a225..991131e877a 100644 --- a/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_partitionkeyrangeid.go +++ b/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_partitionkeyrangeid.go @@ -42,31 +42,9 @@ func ParsePartitionKeyRangeIdID(input string) (*PartitionKeyRangeIdId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PartitionKeyRangeIdId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) - } - - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) - } - - if id.PartitionKeyRangeId, ok = parsed.Parsed["partitionKeyRangeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "partitionKeyRangeId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParsePartitionKeyRangeIdIDInsensitively(input string) (*PartitionKeyRangeId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PartitionKeyRangeIdId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PartitionKeyRangeIdId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if id.CollectionName, ok = input.Parsed["collectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "collectionName", input) } - if id.PartitionKeyRangeId, ok = parsed.Parsed["partitionKeyRangeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "partitionKeyRangeId", *parsed) + if id.PartitionKeyRangeId, ok = input.Parsed["partitionKeyRangeId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "partitionKeyRangeId", input) } - return &id, nil + return nil } // ValidatePartitionKeyRangeIdID checks that 'input' can be parsed as a Partition Key Range Id ID diff --git a/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_region.go b/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_region.go index cc2b2ed76b1..957458f0e99 100644 --- a/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_region.go +++ b/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_region.go @@ -38,23 +38,9 @@ func ParseRegionID(input string) (*RegionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.RegionName, ok = parsed.Parsed["regionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "regionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRegionIDInsensitively(input string) (*RegionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RegionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.RegionName, ok = parsed.Parsed["regionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "regionName", *parsed) + if id.RegionName, ok = input.Parsed["regionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "regionName", input) } - return &id, nil + return nil } // ValidateRegionID checks that 'input' can be parsed as a Region ID diff --git a/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_sourceregiontargetregion.go b/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_sourceregiontargetregion.go index 6482bb9bd1f..1b21054abf3 100644 --- a/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_sourceregiontargetregion.go +++ b/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_sourceregiontargetregion.go @@ -40,27 +40,9 @@ func ParseSourceRegionTargetRegionID(input string) (*SourceRegionTargetRegionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceRegionTargetRegionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.SourceRegionName, ok = parsed.Parsed["sourceRegionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceRegionName", *parsed) - } - - if id.TargetRegionName, ok = parsed.Parsed["targetRegionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetRegionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSourceRegionTargetRegionIDInsensitively(input string) (*SourceRegionTa return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceRegionTargetRegionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SourceRegionTargetRegionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.SourceRegionName, ok = parsed.Parsed["sourceRegionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceRegionName", *parsed) + if id.SourceRegionName, ok = input.Parsed["sourceRegionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sourceRegionName", input) } - if id.TargetRegionName, ok = parsed.Parsed["targetRegionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetRegionName", *parsed) + if id.TargetRegionName, ok = input.Parsed["targetRegionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "targetRegionName", input) } - return &id, nil + return nil } // ValidateSourceRegionTargetRegionID checks that 'input' can be parsed as a Source Region Target Region ID diff --git a/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_sqldatabase.go b/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_sqldatabase.go index 0efbaa7dbca..c8cd86949a8 100644 --- a/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_sqldatabase.go +++ b/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_sqldatabase.go @@ -38,23 +38,9 @@ func ParseSqlDatabaseID(input string) (*SqlDatabaseId, error) { 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSqlDatabaseIDInsensitively(input string) (*SqlDatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SqlDatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SqlDatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) + if id.SqlDatabaseName, ok = input.Parsed["sqlDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", input) } - return &id, nil + return nil } // ValidateSqlDatabaseID checks that 'input' can be parsed as a Sql Database ID diff --git a/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_storedprocedure.go b/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_storedprocedure.go index fd7480b7609..5468c795b65 100644 --- a/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_storedprocedure.go +++ b/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_storedprocedure.go @@ -42,31 +42,9 @@ func ParseStoredProcedureID(input string) (*StoredProcedureId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StoredProcedureId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) - } - - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) - } - - if id.StoredProcedureName, ok = parsed.Parsed["storedProcedureName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storedProcedureName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseStoredProcedureIDInsensitively(input string) (*StoredProcedureId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StoredProcedureId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *StoredProcedureId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) + if id.SqlDatabaseName, ok = input.Parsed["sqlDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", input) } - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) + if id.ContainerName, ok = input.Parsed["containerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerName", input) } - if id.StoredProcedureName, ok = parsed.Parsed["storedProcedureName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storedProcedureName", *parsed) + if id.StoredProcedureName, ok = input.Parsed["storedProcedureName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storedProcedureName", input) } - return &id, nil + return nil } // ValidateStoredProcedureID checks that 'input' can be parsed as a Stored Procedure ID diff --git a/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_table.go b/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_table.go index f4d64253830..006d2a6171b 100644 --- a/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_table.go +++ b/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_table.go @@ -38,23 +38,9 @@ func ParseTableID(input string) (*TableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TableId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTableIDInsensitively(input string) (*TableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TableId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if id.TableName, ok = input.Parsed["tableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tableName", input) } - return &id, nil + return nil } // ValidateTableID checks that 'input' can be parsed as a Table ID diff --git a/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_targetregion.go b/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_targetregion.go index 1604e4b598b..bbf4612af00 100644 --- a/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_targetregion.go +++ b/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_targetregion.go @@ -38,23 +38,9 @@ func ParseTargetRegionID(input string) (*TargetRegionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TargetRegionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.TargetRegionName, ok = parsed.Parsed["targetRegionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetRegionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTargetRegionIDInsensitively(input string) (*TargetRegionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TargetRegionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TargetRegionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.TargetRegionName, ok = parsed.Parsed["targetRegionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetRegionName", *parsed) + if id.TargetRegionName, ok = input.Parsed["targetRegionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "targetRegionName", input) } - return &id, nil + return nil } // ValidateTargetRegionID checks that 'input' can be parsed as a Target Region ID diff --git a/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_trigger.go b/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_trigger.go index 7c06746b92c..864ee0c2a38 100644 --- a/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_trigger.go +++ b/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_trigger.go @@ -42,31 +42,9 @@ func ParseTriggerID(input string) (*TriggerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TriggerId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) - } - - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) - } - - if id.TriggerName, ok = parsed.Parsed["triggerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseTriggerIDInsensitively(input string) (*TriggerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TriggerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *TriggerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) + if id.SqlDatabaseName, ok = input.Parsed["sqlDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", input) } - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) + if id.ContainerName, ok = input.Parsed["containerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerName", input) } - if id.TriggerName, ok = parsed.Parsed["triggerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggerName", *parsed) + if id.TriggerName, ok = input.Parsed["triggerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "triggerName", input) } - return &id, nil + return nil } // ValidateTriggerID checks that 'input' can be parsed as a Trigger ID diff --git a/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_userdefinedfunction.go b/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_userdefinedfunction.go index 54f09bc5f2d..90e49c6f84e 100644 --- a/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_userdefinedfunction.go +++ b/resource-manager/cosmosdb/2021-10-15/cosmosdb/id_userdefinedfunction.go @@ -42,31 +42,9 @@ func ParseUserDefinedFunctionID(input string) (*UserDefinedFunctionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserDefinedFunctionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) - } - - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) - } - - if id.UserDefinedFunctionName, ok = parsed.Parsed["userDefinedFunctionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userDefinedFunctionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseUserDefinedFunctionIDInsensitively(input string) (*UserDefinedFunction return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserDefinedFunctionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *UserDefinedFunctionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) + if id.SqlDatabaseName, ok = input.Parsed["sqlDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", input) } - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) + if id.ContainerName, ok = input.Parsed["containerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerName", input) } - if id.UserDefinedFunctionName, ok = parsed.Parsed["userDefinedFunctionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userDefinedFunctionName", *parsed) + if id.UserDefinedFunctionName, ok = input.Parsed["userDefinedFunctionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userDefinedFunctionName", input) } - return &id, nil + return nil } // ValidateUserDefinedFunctionID checks that 'input' can be parsed as a User Defined Function ID diff --git a/resource-manager/cosmosdb/2021-10-15/managedcassandras/id_cassandracluster.go b/resource-manager/cosmosdb/2021-10-15/managedcassandras/id_cassandracluster.go index 55c61f4a864..70b8aac3664 100644 --- a/resource-manager/cosmosdb/2021-10-15/managedcassandras/id_cassandracluster.go +++ b/resource-manager/cosmosdb/2021-10-15/managedcassandras/id_cassandracluster.go @@ -36,19 +36,9 @@ func ParseCassandraClusterID(input string) (*CassandraClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CassandraClusterId{} - - 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.CassandraClusterName, ok = parsed.Parsed["cassandraClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cassandraClusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseCassandraClusterIDInsensitively(input string) (*CassandraClusterId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CassandraClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CassandraClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CassandraClusterName, ok = parsed.Parsed["cassandraClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cassandraClusterName", *parsed) + if id.CassandraClusterName, ok = input.Parsed["cassandraClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cassandraClusterName", input) } - return &id, nil + return nil } // ValidateCassandraClusterID checks that 'input' can be parsed as a Cassandra Cluster ID diff --git a/resource-manager/cosmosdb/2021-10-15/managedcassandras/id_datacenter.go b/resource-manager/cosmosdb/2021-10-15/managedcassandras/id_datacenter.go index 8d8d8835013..0c8dfad5704 100644 --- a/resource-manager/cosmosdb/2021-10-15/managedcassandras/id_datacenter.go +++ b/resource-manager/cosmosdb/2021-10-15/managedcassandras/id_datacenter.go @@ -38,23 +38,9 @@ func ParseDataCenterID(input string) (*DataCenterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataCenterId{} - - 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.CassandraClusterName, ok = parsed.Parsed["cassandraClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cassandraClusterName", *parsed) - } - - if id.DataCenterName, ok = parsed.Parsed["dataCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataCenterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDataCenterIDInsensitively(input string) (*DataCenterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataCenterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DataCenterId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CassandraClusterName, ok = parsed.Parsed["cassandraClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cassandraClusterName", *parsed) + if id.CassandraClusterName, ok = input.Parsed["cassandraClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cassandraClusterName", input) } - if id.DataCenterName, ok = parsed.Parsed["dataCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataCenterName", *parsed) + if id.DataCenterName, ok = input.Parsed["dataCenterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataCenterName", input) } - return &id, nil + return nil } // ValidateDataCenterID checks that 'input' can be parsed as a Data Center ID diff --git a/resource-manager/cosmosdb/2021-10-15/notebookworkspacesresource/id_databaseaccount.go b/resource-manager/cosmosdb/2021-10-15/notebookworkspacesresource/id_databaseaccount.go index 6163d3bbe76..ce05f7ad501 100644 --- a/resource-manager/cosmosdb/2021-10-15/notebookworkspacesresource/id_databaseaccount.go +++ b/resource-manager/cosmosdb/2021-10-15/notebookworkspacesresource/id_databaseaccount.go @@ -36,19 +36,9 @@ func ParseDatabaseAccountID(input string) (*DatabaseAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDatabaseAccountIDInsensitively(input string) (*DatabaseAccountId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DatabaseAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - return &id, nil + return nil } // ValidateDatabaseAccountID checks that 'input' can be parsed as a Database Account ID diff --git a/resource-manager/cosmosdb/2021-10-15/privateendpointconnections/id_databaseaccount.go b/resource-manager/cosmosdb/2021-10-15/privateendpointconnections/id_databaseaccount.go index 1d3deea521d..819433a83df 100644 --- a/resource-manager/cosmosdb/2021-10-15/privateendpointconnections/id_databaseaccount.go +++ b/resource-manager/cosmosdb/2021-10-15/privateendpointconnections/id_databaseaccount.go @@ -36,19 +36,9 @@ func ParseDatabaseAccountID(input string) (*DatabaseAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDatabaseAccountIDInsensitively(input string) (*DatabaseAccountId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DatabaseAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - return &id, nil + return nil } // ValidateDatabaseAccountID checks that 'input' can be parsed as a Database Account ID diff --git a/resource-manager/cosmosdb/2021-10-15/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/cosmosdb/2021-10-15/privateendpointconnections/id_privateendpointconnection.go index 25382589736..13a94a5226b 100644 --- a/resource-manager/cosmosdb/2021-10-15/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/cosmosdb/2021-10-15/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/cosmosdb/2021-10-15/privatelinkresources/id_databaseaccount.go b/resource-manager/cosmosdb/2021-10-15/privatelinkresources/id_databaseaccount.go index 860bfb590a3..eedea1fcc5c 100644 --- a/resource-manager/cosmosdb/2021-10-15/privatelinkresources/id_databaseaccount.go +++ b/resource-manager/cosmosdb/2021-10-15/privatelinkresources/id_databaseaccount.go @@ -36,19 +36,9 @@ func ParseDatabaseAccountID(input string) (*DatabaseAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDatabaseAccountIDInsensitively(input string) (*DatabaseAccountId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DatabaseAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - return &id, nil + return nil } // ValidateDatabaseAccountID checks that 'input' can be parsed as a Database Account ID diff --git a/resource-manager/cosmosdb/2021-10-15/privatelinkresources/id_privatelinkresource.go b/resource-manager/cosmosdb/2021-10-15/privatelinkresources/id_privatelinkresource.go index 46003ca6e7b..e9f0c7e799e 100644 --- a/resource-manager/cosmosdb/2021-10-15/privatelinkresources/id_privatelinkresource.go +++ b/resource-manager/cosmosdb/2021-10-15/privatelinkresources/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/cosmosdb/2021-10-15/rbacs/id_account.go b/resource-manager/cosmosdb/2021-10-15/rbacs/id_account.go index d548f6b1a64..b9caf8a4482 100644 --- a/resource-manager/cosmosdb/2021-10-15/rbacs/id_account.go +++ b/resource-manager/cosmosdb/2021-10-15/rbacs/id_account.go @@ -38,23 +38,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.RoleAssignmentId, ok = parsed.Parsed["roleAssignmentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleAssignmentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.RoleAssignmentId, ok = parsed.Parsed["roleAssignmentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleAssignmentId", *parsed) + if id.RoleAssignmentId, ok = input.Parsed["roleAssignmentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "roleAssignmentId", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/cosmosdb/2021-10-15/rbacs/id_databaseaccount.go b/resource-manager/cosmosdb/2021-10-15/rbacs/id_databaseaccount.go index 878ca7762f4..856f00f92c8 100644 --- a/resource-manager/cosmosdb/2021-10-15/rbacs/id_databaseaccount.go +++ b/resource-manager/cosmosdb/2021-10-15/rbacs/id_databaseaccount.go @@ -36,19 +36,9 @@ func ParseDatabaseAccountID(input string) (*DatabaseAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDatabaseAccountIDInsensitively(input string) (*DatabaseAccountId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DatabaseAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - return &id, nil + return nil } // ValidateDatabaseAccountID checks that 'input' can be parsed as a Database Account ID diff --git a/resource-manager/cosmosdb/2021-10-15/rbacs/id_sqlroledefinition.go b/resource-manager/cosmosdb/2021-10-15/rbacs/id_sqlroledefinition.go index 292dcd692e5..522ce0762cf 100644 --- a/resource-manager/cosmosdb/2021-10-15/rbacs/id_sqlroledefinition.go +++ b/resource-manager/cosmosdb/2021-10-15/rbacs/id_sqlroledefinition.go @@ -38,23 +38,9 @@ func ParseSqlRoleDefinitionID(input string) (*SqlRoleDefinitionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SqlRoleDefinitionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.RoleDefinitionId, ok = parsed.Parsed["roleDefinitionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleDefinitionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSqlRoleDefinitionIDInsensitively(input string) (*SqlRoleDefinitionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SqlRoleDefinitionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SqlRoleDefinitionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.RoleDefinitionId, ok = parsed.Parsed["roleDefinitionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleDefinitionId", *parsed) + if id.RoleDefinitionId, ok = input.Parsed["roleDefinitionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "roleDefinitionId", input) } - return &id, nil + return nil } // ValidateSqlRoleDefinitionID checks that 'input' can be parsed as a Sql Role Definition ID diff --git a/resource-manager/cosmosdb/2021-10-15/restorables/id_container.go b/resource-manager/cosmosdb/2021-10-15/restorables/id_container.go index abf3171b109..c2b2177ed71 100644 --- a/resource-manager/cosmosdb/2021-10-15/restorables/id_container.go +++ b/resource-manager/cosmosdb/2021-10-15/restorables/id_container.go @@ -40,27 +40,9 @@ func ParseContainerID(input string) (*ContainerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) - } - - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseContainerIDInsensitively(input string) (*ContainerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ContainerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) + if id.SqlDatabaseName, ok = input.Parsed["sqlDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", input) } - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) + if id.ContainerName, ok = input.Parsed["containerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerName", input) } - return &id, nil + return nil } // ValidateContainerID checks that 'input' can be parsed as a Container ID diff --git a/resource-manager/cosmosdb/2021-10-15/restorables/id_location.go b/resource-manager/cosmosdb/2021-10-15/restorables/id_location.go index 0eb834cf4e6..35f17158125 100644 --- a/resource-manager/cosmosdb/2021-10-15/restorables/id_location.go +++ b/resource-manager/cosmosdb/2021-10-15/restorables/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/cosmosdb/2021-10-15/restorables/id_mongodbdatabasecollection.go b/resource-manager/cosmosdb/2021-10-15/restorables/id_mongodbdatabasecollection.go index 2d1dee24a26..576dcaff5d8 100644 --- a/resource-manager/cosmosdb/2021-10-15/restorables/id_mongodbdatabasecollection.go +++ b/resource-manager/cosmosdb/2021-10-15/restorables/id_mongodbdatabasecollection.go @@ -40,27 +40,9 @@ func ParseMongodbDatabaseCollectionID(input string) (*MongodbDatabaseCollectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MongodbDatabaseCollectionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.MongodbDatabaseName, ok = parsed.Parsed["mongodbDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mongodbDatabaseName", *parsed) - } - - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseMongodbDatabaseCollectionIDInsensitively(input string) (*MongodbDataba return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MongodbDatabaseCollectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *MongodbDatabaseCollectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.MongodbDatabaseName, ok = parsed.Parsed["mongodbDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mongodbDatabaseName", *parsed) + if id.MongodbDatabaseName, ok = input.Parsed["mongodbDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mongodbDatabaseName", input) } - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if id.CollectionName, ok = input.Parsed["collectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "collectionName", input) } - return &id, nil + return nil } // ValidateMongodbDatabaseCollectionID checks that 'input' can be parsed as a Mongodb Database Collection ID diff --git a/resource-manager/cosmosdb/2021-10-15/restorables/id_restorabledatabaseaccount.go b/resource-manager/cosmosdb/2021-10-15/restorables/id_restorabledatabaseaccount.go index f2c929a0130..25ee3deecab 100644 --- a/resource-manager/cosmosdb/2021-10-15/restorables/id_restorabledatabaseaccount.go +++ b/resource-manager/cosmosdb/2021-10-15/restorables/id_restorabledatabaseaccount.go @@ -36,19 +36,9 @@ func ParseRestorableDatabaseAccountID(input string) (*RestorableDatabaseAccountI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RestorableDatabaseAccountId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRestorableDatabaseAccountIDInsensitively(input string) (*RestorableDat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RestorableDatabaseAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RestorableDatabaseAccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if id.InstanceId, ok = input.Parsed["instanceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceId", input) } - return &id, nil + return nil } // ValidateRestorableDatabaseAccountID checks that 'input' can be parsed as a Restorable Database Account ID diff --git a/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_cassandrakeyspace.go b/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_cassandrakeyspace.go index 9555cbf46b1..c0948748c2d 100644 --- a/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_cassandrakeyspace.go +++ b/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_cassandrakeyspace.go @@ -38,23 +38,9 @@ func ParseCassandraKeyspaceID(input string) (*CassandraKeyspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CassandraKeyspaceId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.CassandraKeyspaceName, ok = parsed.Parsed["cassandraKeyspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cassandraKeyspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCassandraKeyspaceIDInsensitively(input string) (*CassandraKeyspaceId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CassandraKeyspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CassandraKeyspaceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.CassandraKeyspaceName, ok = parsed.Parsed["cassandraKeyspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cassandraKeyspaceName", *parsed) + if id.CassandraKeyspaceName, ok = input.Parsed["cassandraKeyspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cassandraKeyspaceName", input) } - return &id, nil + return nil } // ValidateCassandraKeyspaceID checks that 'input' can be parsed as a Cassandra Keyspace ID diff --git a/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_cassandrakeyspacetable.go b/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_cassandrakeyspacetable.go index 66b3ea506a4..0e9b31b7d48 100644 --- a/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_cassandrakeyspacetable.go +++ b/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_cassandrakeyspacetable.go @@ -40,27 +40,9 @@ func ParseCassandraKeyspaceTableID(input string) (*CassandraKeyspaceTableId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CassandraKeyspaceTableId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.CassandraKeyspaceName, ok = parsed.Parsed["cassandraKeyspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cassandraKeyspaceName", *parsed) - } - - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseCassandraKeyspaceTableIDInsensitively(input string) (*CassandraKeyspac return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CassandraKeyspaceTableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *CassandraKeyspaceTableId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.CassandraKeyspaceName, ok = parsed.Parsed["cassandraKeyspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cassandraKeyspaceName", *parsed) + if id.CassandraKeyspaceName, ok = input.Parsed["cassandraKeyspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cassandraKeyspaceName", input) } - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if id.TableName, ok = input.Parsed["tableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tableName", input) } - return &id, nil + return nil } // ValidateCassandraKeyspaceTableID checks that 'input' can be parsed as a Cassandra Keyspace Table ID diff --git a/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_collection.go b/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_collection.go index a7e01b98015..06ba5f2c382 100644 --- a/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_collection.go +++ b/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_collection.go @@ -40,27 +40,9 @@ func ParseCollectionID(input string) (*CollectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CollectionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) - } - - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseCollectionIDInsensitively(input string) (*CollectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CollectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *CollectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if id.CollectionName, ok = input.Parsed["collectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "collectionName", input) } - return &id, nil + return nil } // ValidateCollectionID checks that 'input' can be parsed as a Collection ID diff --git a/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_collectionpartitionkeyrangeid.go b/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_collectionpartitionkeyrangeid.go index 5819216ab8d..af2697450ff 100644 --- a/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_collectionpartitionkeyrangeid.go +++ b/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_collectionpartitionkeyrangeid.go @@ -44,35 +44,9 @@ func ParseCollectionPartitionKeyRangeIdID(input string) (*CollectionPartitionKey return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CollectionPartitionKeyRangeIdId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.RegionName, ok = parsed.Parsed["regionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "regionName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) - } - - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) - } - - if id.PartitionKeyRangeId, ok = parsed.Parsed["partitionKeyRangeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "partitionKeyRangeId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseCollectionPartitionKeyRangeIdIDInsensitively(input string) (*Collectio return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CollectionPartitionKeyRangeIdId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *CollectionPartitionKeyRangeIdId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.RegionName, ok = parsed.Parsed["regionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "regionName", *parsed) + if id.RegionName, ok = input.Parsed["regionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "regionName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if id.CollectionName, ok = input.Parsed["collectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "collectionName", input) } - if id.PartitionKeyRangeId, ok = parsed.Parsed["partitionKeyRangeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "partitionKeyRangeId", *parsed) + if id.PartitionKeyRangeId, ok = input.Parsed["partitionKeyRangeId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "partitionKeyRangeId", input) } - return &id, nil + return nil } // ValidateCollectionPartitionKeyRangeIdID checks that 'input' can be parsed as a Collection Partition Key Range Id ID diff --git a/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_container.go b/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_container.go index 7a27bedb708..325844c7b0f 100644 --- a/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_container.go +++ b/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_container.go @@ -40,27 +40,9 @@ func ParseContainerID(input string) (*ContainerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) - } - - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseContainerIDInsensitively(input string) (*ContainerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ContainerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) + if id.SqlDatabaseName, ok = input.Parsed["sqlDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", input) } - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) + if id.ContainerName, ok = input.Parsed["containerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerName", input) } - return &id, nil + return nil } // ValidateContainerID checks that 'input' can be parsed as a Container ID diff --git a/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_database.go b/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_database.go index 06541d6f6c6..c52995f2bc9 100644 --- a/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_database.go +++ b/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_database.go @@ -38,23 +38,9 @@ func ParseDatabaseID(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDatabaseIDInsensitively(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - return &id, nil + return nil } // ValidateDatabaseID checks that 'input' can be parsed as a Database ID diff --git a/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_databaseaccount.go b/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_databaseaccount.go index 0e56a8d66f5..425f2c9b5ae 100644 --- a/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_databaseaccount.go +++ b/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_databaseaccount.go @@ -36,19 +36,9 @@ func ParseDatabaseAccountID(input string) (*DatabaseAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDatabaseAccountIDInsensitively(input string) (*DatabaseAccountId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DatabaseAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - return &id, nil + return nil } // ValidateDatabaseAccountID checks that 'input' can be parsed as a Database Account ID diff --git a/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_databaseaccountname.go b/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_databaseaccountname.go index 1ad2a926aa2..a2757f56303 100644 --- a/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_databaseaccountname.go +++ b/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_databaseaccountname.go @@ -32,11 +32,9 @@ func ParseDatabaseAccountNameID(input string) (*DatabaseAccountNameId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountNameId{} - - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseDatabaseAccountNameIDInsensitively(input string) (*DatabaseAccountName return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountNameId{} - - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *DatabaseAccountNameId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) + } + + return nil +} + // ValidateDatabaseAccountNameID checks that 'input' can be parsed as a Database Account Name ID func ValidateDatabaseAccountNameID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_databasecollection.go b/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_databasecollection.go index ae75117d04e..82742bb4c95 100644 --- a/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_databasecollection.go +++ b/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_databasecollection.go @@ -42,31 +42,9 @@ func ParseDatabaseCollectionID(input string) (*DatabaseCollectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseCollectionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.RegionName, ok = parsed.Parsed["regionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "regionName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) - } - - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseDatabaseCollectionIDInsensitively(input string) (*DatabaseCollectionId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseCollectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DatabaseCollectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.RegionName, ok = parsed.Parsed["regionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "regionName", *parsed) + if id.RegionName, ok = input.Parsed["regionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "regionName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if id.CollectionName, ok = input.Parsed["collectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "collectionName", input) } - return &id, nil + return nil } // ValidateDatabaseCollectionID checks that 'input' can be parsed as a Database Collection ID diff --git a/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_graph.go b/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_graph.go index 990cf689b19..87414bff4e5 100644 --- a/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_graph.go +++ b/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_graph.go @@ -40,27 +40,9 @@ func ParseGraphID(input string) (*GraphId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GraphId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.GremlinDatabaseName, ok = parsed.Parsed["gremlinDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gremlinDatabaseName", *parsed) - } - - if id.GraphName, ok = parsed.Parsed["graphName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "graphName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseGraphIDInsensitively(input string) (*GraphId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GraphId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *GraphId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.GremlinDatabaseName, ok = parsed.Parsed["gremlinDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gremlinDatabaseName", *parsed) + if id.GremlinDatabaseName, ok = input.Parsed["gremlinDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gremlinDatabaseName", input) } - if id.GraphName, ok = parsed.Parsed["graphName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "graphName", *parsed) + if id.GraphName, ok = input.Parsed["graphName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "graphName", input) } - return &id, nil + return nil } // ValidateGraphID checks that 'input' can be parsed as a Graph ID diff --git a/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_gremlindatabase.go b/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_gremlindatabase.go index 20095da53b2..62c750d65ce 100644 --- a/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_gremlindatabase.go +++ b/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_gremlindatabase.go @@ -38,23 +38,9 @@ func ParseGremlinDatabaseID(input string) (*GremlinDatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GremlinDatabaseId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.GremlinDatabaseName, ok = parsed.Parsed["gremlinDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gremlinDatabaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGremlinDatabaseIDInsensitively(input string) (*GremlinDatabaseId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GremlinDatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GremlinDatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.GremlinDatabaseName, ok = parsed.Parsed["gremlinDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gremlinDatabaseName", *parsed) + if id.GremlinDatabaseName, ok = input.Parsed["gremlinDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gremlinDatabaseName", input) } - return &id, nil + return nil } // ValidateGremlinDatabaseID checks that 'input' can be parsed as a Gremlin Database ID diff --git a/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_location.go b/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_location.go index bc6bbfc9d1d..2955e6dd543 100644 --- a/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_location.go +++ b/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_mongodbdatabase.go b/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_mongodbdatabase.go index 245c181e310..f156cc1f463 100644 --- a/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_mongodbdatabase.go +++ b/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_mongodbdatabase.go @@ -38,23 +38,9 @@ func ParseMongodbDatabaseID(input string) (*MongodbDatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MongodbDatabaseId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.MongodbDatabaseName, ok = parsed.Parsed["mongodbDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mongodbDatabaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseMongodbDatabaseIDInsensitively(input string) (*MongodbDatabaseId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MongodbDatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *MongodbDatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.MongodbDatabaseName, ok = parsed.Parsed["mongodbDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mongodbDatabaseName", *parsed) + if id.MongodbDatabaseName, ok = input.Parsed["mongodbDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mongodbDatabaseName", input) } - return &id, nil + return nil } // ValidateMongodbDatabaseID checks that 'input' can be parsed as a Mongodb Database ID diff --git a/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_mongodbdatabasecollection.go b/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_mongodbdatabasecollection.go index fd0ec8e076a..e571a8d6f95 100644 --- a/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_mongodbdatabasecollection.go +++ b/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_mongodbdatabasecollection.go @@ -40,27 +40,9 @@ func ParseMongodbDatabaseCollectionID(input string) (*MongodbDatabaseCollectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MongodbDatabaseCollectionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.MongodbDatabaseName, ok = parsed.Parsed["mongodbDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mongodbDatabaseName", *parsed) - } - - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseMongodbDatabaseCollectionIDInsensitively(input string) (*MongodbDataba return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MongodbDatabaseCollectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *MongodbDatabaseCollectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.MongodbDatabaseName, ok = parsed.Parsed["mongodbDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mongodbDatabaseName", *parsed) + if id.MongodbDatabaseName, ok = input.Parsed["mongodbDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mongodbDatabaseName", input) } - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if id.CollectionName, ok = input.Parsed["collectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "collectionName", input) } - return &id, nil + return nil } // ValidateMongodbDatabaseCollectionID checks that 'input' can be parsed as a Mongodb Database Collection ID diff --git a/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_partitionkeyrangeid.go b/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_partitionkeyrangeid.go index f90c9d9a225..991131e877a 100644 --- a/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_partitionkeyrangeid.go +++ b/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_partitionkeyrangeid.go @@ -42,31 +42,9 @@ func ParsePartitionKeyRangeIdID(input string) (*PartitionKeyRangeIdId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PartitionKeyRangeIdId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) - } - - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) - } - - if id.PartitionKeyRangeId, ok = parsed.Parsed["partitionKeyRangeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "partitionKeyRangeId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParsePartitionKeyRangeIdIDInsensitively(input string) (*PartitionKeyRangeId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PartitionKeyRangeIdId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PartitionKeyRangeIdId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if id.CollectionName, ok = input.Parsed["collectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "collectionName", input) } - if id.PartitionKeyRangeId, ok = parsed.Parsed["partitionKeyRangeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "partitionKeyRangeId", *parsed) + if id.PartitionKeyRangeId, ok = input.Parsed["partitionKeyRangeId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "partitionKeyRangeId", input) } - return &id, nil + return nil } // ValidatePartitionKeyRangeIdID checks that 'input' can be parsed as a Partition Key Range Id ID diff --git a/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_region.go b/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_region.go index cc2b2ed76b1..957458f0e99 100644 --- a/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_region.go +++ b/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_region.go @@ -38,23 +38,9 @@ func ParseRegionID(input string) (*RegionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.RegionName, ok = parsed.Parsed["regionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "regionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRegionIDInsensitively(input string) (*RegionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RegionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.RegionName, ok = parsed.Parsed["regionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "regionName", *parsed) + if id.RegionName, ok = input.Parsed["regionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "regionName", input) } - return &id, nil + return nil } // ValidateRegionID checks that 'input' can be parsed as a Region ID diff --git a/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_sourceregiontargetregion.go b/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_sourceregiontargetregion.go index 6482bb9bd1f..1b21054abf3 100644 --- a/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_sourceregiontargetregion.go +++ b/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_sourceregiontargetregion.go @@ -40,27 +40,9 @@ func ParseSourceRegionTargetRegionID(input string) (*SourceRegionTargetRegionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceRegionTargetRegionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.SourceRegionName, ok = parsed.Parsed["sourceRegionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceRegionName", *parsed) - } - - if id.TargetRegionName, ok = parsed.Parsed["targetRegionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetRegionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSourceRegionTargetRegionIDInsensitively(input string) (*SourceRegionTa return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceRegionTargetRegionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SourceRegionTargetRegionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.SourceRegionName, ok = parsed.Parsed["sourceRegionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceRegionName", *parsed) + if id.SourceRegionName, ok = input.Parsed["sourceRegionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sourceRegionName", input) } - if id.TargetRegionName, ok = parsed.Parsed["targetRegionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetRegionName", *parsed) + if id.TargetRegionName, ok = input.Parsed["targetRegionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "targetRegionName", input) } - return &id, nil + return nil } // ValidateSourceRegionTargetRegionID checks that 'input' can be parsed as a Source Region Target Region ID diff --git a/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_sqldatabase.go b/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_sqldatabase.go index 0efbaa7dbca..c8cd86949a8 100644 --- a/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_sqldatabase.go +++ b/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_sqldatabase.go @@ -38,23 +38,9 @@ func ParseSqlDatabaseID(input string) (*SqlDatabaseId, error) { 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSqlDatabaseIDInsensitively(input string) (*SqlDatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SqlDatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SqlDatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) + if id.SqlDatabaseName, ok = input.Parsed["sqlDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", input) } - return &id, nil + return nil } // ValidateSqlDatabaseID checks that 'input' can be parsed as a Sql Database ID diff --git a/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_storedprocedure.go b/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_storedprocedure.go index fd7480b7609..5468c795b65 100644 --- a/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_storedprocedure.go +++ b/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_storedprocedure.go @@ -42,31 +42,9 @@ func ParseStoredProcedureID(input string) (*StoredProcedureId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StoredProcedureId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) - } - - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) - } - - if id.StoredProcedureName, ok = parsed.Parsed["storedProcedureName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storedProcedureName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseStoredProcedureIDInsensitively(input string) (*StoredProcedureId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StoredProcedureId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *StoredProcedureId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) + if id.SqlDatabaseName, ok = input.Parsed["sqlDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", input) } - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) + if id.ContainerName, ok = input.Parsed["containerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerName", input) } - if id.StoredProcedureName, ok = parsed.Parsed["storedProcedureName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storedProcedureName", *parsed) + if id.StoredProcedureName, ok = input.Parsed["storedProcedureName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storedProcedureName", input) } - return &id, nil + return nil } // ValidateStoredProcedureID checks that 'input' can be parsed as a Stored Procedure ID diff --git a/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_table.go b/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_table.go index f4d64253830..006d2a6171b 100644 --- a/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_table.go +++ b/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_table.go @@ -38,23 +38,9 @@ func ParseTableID(input string) (*TableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TableId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTableIDInsensitively(input string) (*TableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TableId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if id.TableName, ok = input.Parsed["tableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tableName", input) } - return &id, nil + return nil } // ValidateTableID checks that 'input' can be parsed as a Table ID diff --git a/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_targetregion.go b/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_targetregion.go index 1604e4b598b..bbf4612af00 100644 --- a/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_targetregion.go +++ b/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_targetregion.go @@ -38,23 +38,9 @@ func ParseTargetRegionID(input string) (*TargetRegionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TargetRegionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.TargetRegionName, ok = parsed.Parsed["targetRegionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetRegionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTargetRegionIDInsensitively(input string) (*TargetRegionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TargetRegionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TargetRegionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.TargetRegionName, ok = parsed.Parsed["targetRegionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetRegionName", *parsed) + if id.TargetRegionName, ok = input.Parsed["targetRegionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "targetRegionName", input) } - return &id, nil + return nil } // ValidateTargetRegionID checks that 'input' can be parsed as a Target Region ID diff --git a/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_trigger.go b/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_trigger.go index 7c06746b92c..864ee0c2a38 100644 --- a/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_trigger.go +++ b/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_trigger.go @@ -42,31 +42,9 @@ func ParseTriggerID(input string) (*TriggerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TriggerId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) - } - - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) - } - - if id.TriggerName, ok = parsed.Parsed["triggerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseTriggerIDInsensitively(input string) (*TriggerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TriggerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *TriggerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) + if id.SqlDatabaseName, ok = input.Parsed["sqlDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", input) } - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) + if id.ContainerName, ok = input.Parsed["containerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerName", input) } - if id.TriggerName, ok = parsed.Parsed["triggerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggerName", *parsed) + if id.TriggerName, ok = input.Parsed["triggerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "triggerName", input) } - return &id, nil + return nil } // ValidateTriggerID checks that 'input' can be parsed as a Trigger ID diff --git a/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_userdefinedfunction.go b/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_userdefinedfunction.go index 54f09bc5f2d..90e49c6f84e 100644 --- a/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_userdefinedfunction.go +++ b/resource-manager/cosmosdb/2022-05-15/cosmosdb/id_userdefinedfunction.go @@ -42,31 +42,9 @@ func ParseUserDefinedFunctionID(input string) (*UserDefinedFunctionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserDefinedFunctionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) - } - - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) - } - - if id.UserDefinedFunctionName, ok = parsed.Parsed["userDefinedFunctionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userDefinedFunctionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseUserDefinedFunctionIDInsensitively(input string) (*UserDefinedFunction return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserDefinedFunctionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *UserDefinedFunctionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) + if id.SqlDatabaseName, ok = input.Parsed["sqlDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", input) } - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) + if id.ContainerName, ok = input.Parsed["containerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerName", input) } - if id.UserDefinedFunctionName, ok = parsed.Parsed["userDefinedFunctionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userDefinedFunctionName", *parsed) + if id.UserDefinedFunctionName, ok = input.Parsed["userDefinedFunctionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userDefinedFunctionName", input) } - return &id, nil + return nil } // ValidateUserDefinedFunctionID checks that 'input' can be parsed as a User Defined Function ID diff --git a/resource-manager/cosmosdb/2022-05-15/datatransfer/id_service.go b/resource-manager/cosmosdb/2022-05-15/datatransfer/id_service.go index c2fba9c3c5d..5f0f6c16dc6 100644 --- a/resource-manager/cosmosdb/2022-05-15/datatransfer/id_service.go +++ b/resource-manager/cosmosdb/2022-05-15/datatransfer/id_service.go @@ -38,23 +38,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ServiceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/cosmosdb/2022-05-15/graphapicompute/id_service.go b/resource-manager/cosmosdb/2022-05-15/graphapicompute/id_service.go index 92c693864c7..41bd08f7b1c 100644 --- a/resource-manager/cosmosdb/2022-05-15/graphapicompute/id_service.go +++ b/resource-manager/cosmosdb/2022-05-15/graphapicompute/id_service.go @@ -38,23 +38,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ServiceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/cosmosdb/2022-05-15/managedcassandras/id_cassandracluster.go b/resource-manager/cosmosdb/2022-05-15/managedcassandras/id_cassandracluster.go index 55c61f4a864..70b8aac3664 100644 --- a/resource-manager/cosmosdb/2022-05-15/managedcassandras/id_cassandracluster.go +++ b/resource-manager/cosmosdb/2022-05-15/managedcassandras/id_cassandracluster.go @@ -36,19 +36,9 @@ func ParseCassandraClusterID(input string) (*CassandraClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CassandraClusterId{} - - 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.CassandraClusterName, ok = parsed.Parsed["cassandraClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cassandraClusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseCassandraClusterIDInsensitively(input string) (*CassandraClusterId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CassandraClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CassandraClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CassandraClusterName, ok = parsed.Parsed["cassandraClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cassandraClusterName", *parsed) + if id.CassandraClusterName, ok = input.Parsed["cassandraClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cassandraClusterName", input) } - return &id, nil + return nil } // ValidateCassandraClusterID checks that 'input' can be parsed as a Cassandra Cluster ID diff --git a/resource-manager/cosmosdb/2022-05-15/managedcassandras/id_datacenter.go b/resource-manager/cosmosdb/2022-05-15/managedcassandras/id_datacenter.go index 8d8d8835013..0c8dfad5704 100644 --- a/resource-manager/cosmosdb/2022-05-15/managedcassandras/id_datacenter.go +++ b/resource-manager/cosmosdb/2022-05-15/managedcassandras/id_datacenter.go @@ -38,23 +38,9 @@ func ParseDataCenterID(input string) (*DataCenterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataCenterId{} - - 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.CassandraClusterName, ok = parsed.Parsed["cassandraClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cassandraClusterName", *parsed) - } - - if id.DataCenterName, ok = parsed.Parsed["dataCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataCenterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDataCenterIDInsensitively(input string) (*DataCenterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataCenterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DataCenterId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CassandraClusterName, ok = parsed.Parsed["cassandraClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cassandraClusterName", *parsed) + if id.CassandraClusterName, ok = input.Parsed["cassandraClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cassandraClusterName", input) } - if id.DataCenterName, ok = parsed.Parsed["dataCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataCenterName", *parsed) + if id.DataCenterName, ok = input.Parsed["dataCenterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataCenterName", input) } - return &id, nil + return nil } // ValidateDataCenterID checks that 'input' can be parsed as a Data Center ID diff --git a/resource-manager/cosmosdb/2022-05-15/materializedviewsbuilder/id_service.go b/resource-manager/cosmosdb/2022-05-15/materializedviewsbuilder/id_service.go index a3c6ba915ec..4f5a2a474a6 100644 --- a/resource-manager/cosmosdb/2022-05-15/materializedviewsbuilder/id_service.go +++ b/resource-manager/cosmosdb/2022-05-15/materializedviewsbuilder/id_service.go @@ -38,23 +38,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ServiceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/cosmosdb/2022-05-15/notebookworkspacesresource/id_databaseaccount.go b/resource-manager/cosmosdb/2022-05-15/notebookworkspacesresource/id_databaseaccount.go index 6163d3bbe76..ce05f7ad501 100644 --- a/resource-manager/cosmosdb/2022-05-15/notebookworkspacesresource/id_databaseaccount.go +++ b/resource-manager/cosmosdb/2022-05-15/notebookworkspacesresource/id_databaseaccount.go @@ -36,19 +36,9 @@ func ParseDatabaseAccountID(input string) (*DatabaseAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDatabaseAccountIDInsensitively(input string) (*DatabaseAccountId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DatabaseAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - return &id, nil + return nil } // ValidateDatabaseAccountID checks that 'input' can be parsed as a Database Account ID diff --git a/resource-manager/cosmosdb/2022-05-15/privateendpointconnections/id_databaseaccount.go b/resource-manager/cosmosdb/2022-05-15/privateendpointconnections/id_databaseaccount.go index 1d3deea521d..819433a83df 100644 --- a/resource-manager/cosmosdb/2022-05-15/privateendpointconnections/id_databaseaccount.go +++ b/resource-manager/cosmosdb/2022-05-15/privateendpointconnections/id_databaseaccount.go @@ -36,19 +36,9 @@ func ParseDatabaseAccountID(input string) (*DatabaseAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDatabaseAccountIDInsensitively(input string) (*DatabaseAccountId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DatabaseAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - return &id, nil + return nil } // ValidateDatabaseAccountID checks that 'input' can be parsed as a Database Account ID diff --git a/resource-manager/cosmosdb/2022-05-15/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/cosmosdb/2022-05-15/privateendpointconnections/id_privateendpointconnection.go index 25382589736..13a94a5226b 100644 --- a/resource-manager/cosmosdb/2022-05-15/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/cosmosdb/2022-05-15/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/cosmosdb/2022-05-15/privatelinkresources/id_databaseaccount.go b/resource-manager/cosmosdb/2022-05-15/privatelinkresources/id_databaseaccount.go index 860bfb590a3..eedea1fcc5c 100644 --- a/resource-manager/cosmosdb/2022-05-15/privatelinkresources/id_databaseaccount.go +++ b/resource-manager/cosmosdb/2022-05-15/privatelinkresources/id_databaseaccount.go @@ -36,19 +36,9 @@ func ParseDatabaseAccountID(input string) (*DatabaseAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDatabaseAccountIDInsensitively(input string) (*DatabaseAccountId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DatabaseAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - return &id, nil + return nil } // ValidateDatabaseAccountID checks that 'input' can be parsed as a Database Account ID diff --git a/resource-manager/cosmosdb/2022-05-15/privatelinkresources/id_privatelinkresource.go b/resource-manager/cosmosdb/2022-05-15/privatelinkresources/id_privatelinkresource.go index 46003ca6e7b..e9f0c7e799e 100644 --- a/resource-manager/cosmosdb/2022-05-15/privatelinkresources/id_privatelinkresource.go +++ b/resource-manager/cosmosdb/2022-05-15/privatelinkresources/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/cosmosdb/2022-05-15/rbacs/id_account.go b/resource-manager/cosmosdb/2022-05-15/rbacs/id_account.go index d548f6b1a64..b9caf8a4482 100644 --- a/resource-manager/cosmosdb/2022-05-15/rbacs/id_account.go +++ b/resource-manager/cosmosdb/2022-05-15/rbacs/id_account.go @@ -38,23 +38,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.RoleAssignmentId, ok = parsed.Parsed["roleAssignmentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleAssignmentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.RoleAssignmentId, ok = parsed.Parsed["roleAssignmentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleAssignmentId", *parsed) + if id.RoleAssignmentId, ok = input.Parsed["roleAssignmentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "roleAssignmentId", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/cosmosdb/2022-05-15/rbacs/id_databaseaccount.go b/resource-manager/cosmosdb/2022-05-15/rbacs/id_databaseaccount.go index 878ca7762f4..856f00f92c8 100644 --- a/resource-manager/cosmosdb/2022-05-15/rbacs/id_databaseaccount.go +++ b/resource-manager/cosmosdb/2022-05-15/rbacs/id_databaseaccount.go @@ -36,19 +36,9 @@ func ParseDatabaseAccountID(input string) (*DatabaseAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDatabaseAccountIDInsensitively(input string) (*DatabaseAccountId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DatabaseAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - return &id, nil + return nil } // ValidateDatabaseAccountID checks that 'input' can be parsed as a Database Account ID diff --git a/resource-manager/cosmosdb/2022-05-15/rbacs/id_sqlroledefinition.go b/resource-manager/cosmosdb/2022-05-15/rbacs/id_sqlroledefinition.go index 292dcd692e5..522ce0762cf 100644 --- a/resource-manager/cosmosdb/2022-05-15/rbacs/id_sqlroledefinition.go +++ b/resource-manager/cosmosdb/2022-05-15/rbacs/id_sqlroledefinition.go @@ -38,23 +38,9 @@ func ParseSqlRoleDefinitionID(input string) (*SqlRoleDefinitionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SqlRoleDefinitionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.RoleDefinitionId, ok = parsed.Parsed["roleDefinitionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleDefinitionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSqlRoleDefinitionIDInsensitively(input string) (*SqlRoleDefinitionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SqlRoleDefinitionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SqlRoleDefinitionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.RoleDefinitionId, ok = parsed.Parsed["roleDefinitionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleDefinitionId", *parsed) + if id.RoleDefinitionId, ok = input.Parsed["roleDefinitionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "roleDefinitionId", input) } - return &id, nil + return nil } // ValidateSqlRoleDefinitionID checks that 'input' can be parsed as a Sql Role Definition ID diff --git a/resource-manager/cosmosdb/2022-05-15/restorables/id_container.go b/resource-manager/cosmosdb/2022-05-15/restorables/id_container.go index abf3171b109..c2b2177ed71 100644 --- a/resource-manager/cosmosdb/2022-05-15/restorables/id_container.go +++ b/resource-manager/cosmosdb/2022-05-15/restorables/id_container.go @@ -40,27 +40,9 @@ func ParseContainerID(input string) (*ContainerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) - } - - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseContainerIDInsensitively(input string) (*ContainerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ContainerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) + if id.SqlDatabaseName, ok = input.Parsed["sqlDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", input) } - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) + if id.ContainerName, ok = input.Parsed["containerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerName", input) } - return &id, nil + return nil } // ValidateContainerID checks that 'input' can be parsed as a Container ID diff --git a/resource-manager/cosmosdb/2022-05-15/restorables/id_location.go b/resource-manager/cosmosdb/2022-05-15/restorables/id_location.go index 0eb834cf4e6..35f17158125 100644 --- a/resource-manager/cosmosdb/2022-05-15/restorables/id_location.go +++ b/resource-manager/cosmosdb/2022-05-15/restorables/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/cosmosdb/2022-05-15/restorables/id_mongodbdatabasecollection.go b/resource-manager/cosmosdb/2022-05-15/restorables/id_mongodbdatabasecollection.go index 2d1dee24a26..576dcaff5d8 100644 --- a/resource-manager/cosmosdb/2022-05-15/restorables/id_mongodbdatabasecollection.go +++ b/resource-manager/cosmosdb/2022-05-15/restorables/id_mongodbdatabasecollection.go @@ -40,27 +40,9 @@ func ParseMongodbDatabaseCollectionID(input string) (*MongodbDatabaseCollectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MongodbDatabaseCollectionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.MongodbDatabaseName, ok = parsed.Parsed["mongodbDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mongodbDatabaseName", *parsed) - } - - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseMongodbDatabaseCollectionIDInsensitively(input string) (*MongodbDataba return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MongodbDatabaseCollectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *MongodbDatabaseCollectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.MongodbDatabaseName, ok = parsed.Parsed["mongodbDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mongodbDatabaseName", *parsed) + if id.MongodbDatabaseName, ok = input.Parsed["mongodbDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mongodbDatabaseName", input) } - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if id.CollectionName, ok = input.Parsed["collectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "collectionName", input) } - return &id, nil + return nil } // ValidateMongodbDatabaseCollectionID checks that 'input' can be parsed as a Mongodb Database Collection ID diff --git a/resource-manager/cosmosdb/2022-05-15/restorables/id_restorabledatabaseaccount.go b/resource-manager/cosmosdb/2022-05-15/restorables/id_restorabledatabaseaccount.go index f2c929a0130..25ee3deecab 100644 --- a/resource-manager/cosmosdb/2022-05-15/restorables/id_restorabledatabaseaccount.go +++ b/resource-manager/cosmosdb/2022-05-15/restorables/id_restorabledatabaseaccount.go @@ -36,19 +36,9 @@ func ParseRestorableDatabaseAccountID(input string) (*RestorableDatabaseAccountI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RestorableDatabaseAccountId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRestorableDatabaseAccountIDInsensitively(input string) (*RestorableDat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RestorableDatabaseAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RestorableDatabaseAccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if id.InstanceId, ok = input.Parsed["instanceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceId", input) } - return &id, nil + return nil } // ValidateRestorableDatabaseAccountID checks that 'input' can be parsed as a Restorable Database Account ID diff --git a/resource-manager/cosmosdb/2022-05-15/services/id_databaseaccount.go b/resource-manager/cosmosdb/2022-05-15/services/id_databaseaccount.go index fde95de221b..4a229a3b3b9 100644 --- a/resource-manager/cosmosdb/2022-05-15/services/id_databaseaccount.go +++ b/resource-manager/cosmosdb/2022-05-15/services/id_databaseaccount.go @@ -36,19 +36,9 @@ func ParseDatabaseAccountID(input string) (*DatabaseAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDatabaseAccountIDInsensitively(input string) (*DatabaseAccountId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DatabaseAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - return &id, nil + return nil } // ValidateDatabaseAccountID checks that 'input' can be parsed as a Database Account ID diff --git a/resource-manager/cosmosdb/2022-05-15/sqldedicatedgateway/id_service.go b/resource-manager/cosmosdb/2022-05-15/sqldedicatedgateway/id_service.go index 1a0173f1bdd..2ecf0e8462e 100644 --- a/resource-manager/cosmosdb/2022-05-15/sqldedicatedgateway/id_service.go +++ b/resource-manager/cosmosdb/2022-05-15/sqldedicatedgateway/id_service.go @@ -38,23 +38,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ServiceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_cassandrakeyspace.go b/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_cassandrakeyspace.go index 9555cbf46b1..c0948748c2d 100644 --- a/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_cassandrakeyspace.go +++ b/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_cassandrakeyspace.go @@ -38,23 +38,9 @@ func ParseCassandraKeyspaceID(input string) (*CassandraKeyspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CassandraKeyspaceId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.CassandraKeyspaceName, ok = parsed.Parsed["cassandraKeyspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cassandraKeyspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCassandraKeyspaceIDInsensitively(input string) (*CassandraKeyspaceId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CassandraKeyspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CassandraKeyspaceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.CassandraKeyspaceName, ok = parsed.Parsed["cassandraKeyspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cassandraKeyspaceName", *parsed) + if id.CassandraKeyspaceName, ok = input.Parsed["cassandraKeyspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cassandraKeyspaceName", input) } - return &id, nil + return nil } // ValidateCassandraKeyspaceID checks that 'input' can be parsed as a Cassandra Keyspace ID diff --git a/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_cassandrakeyspacetable.go b/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_cassandrakeyspacetable.go index 66b3ea506a4..0e9b31b7d48 100644 --- a/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_cassandrakeyspacetable.go +++ b/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_cassandrakeyspacetable.go @@ -40,27 +40,9 @@ func ParseCassandraKeyspaceTableID(input string) (*CassandraKeyspaceTableId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CassandraKeyspaceTableId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.CassandraKeyspaceName, ok = parsed.Parsed["cassandraKeyspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cassandraKeyspaceName", *parsed) - } - - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseCassandraKeyspaceTableIDInsensitively(input string) (*CassandraKeyspac return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CassandraKeyspaceTableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *CassandraKeyspaceTableId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.CassandraKeyspaceName, ok = parsed.Parsed["cassandraKeyspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cassandraKeyspaceName", *parsed) + if id.CassandraKeyspaceName, ok = input.Parsed["cassandraKeyspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cassandraKeyspaceName", input) } - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if id.TableName, ok = input.Parsed["tableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tableName", input) } - return &id, nil + return nil } // ValidateCassandraKeyspaceTableID checks that 'input' can be parsed as a Cassandra Keyspace Table ID diff --git a/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_clientencryptionkey.go b/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_clientencryptionkey.go index 8fcb741d96a..70599e3ea3d 100644 --- a/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_clientencryptionkey.go +++ b/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_clientencryptionkey.go @@ -40,27 +40,9 @@ func ParseClientEncryptionKeyID(input string) (*ClientEncryptionKeyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClientEncryptionKeyId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) - } - - if id.ClientEncryptionKeyName, ok = parsed.Parsed["clientEncryptionKeyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clientEncryptionKeyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseClientEncryptionKeyIDInsensitively(input string) (*ClientEncryptionKey return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClientEncryptionKeyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ClientEncryptionKeyId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) + if id.SqlDatabaseName, ok = input.Parsed["sqlDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", input) } - if id.ClientEncryptionKeyName, ok = parsed.Parsed["clientEncryptionKeyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clientEncryptionKeyName", *parsed) + if id.ClientEncryptionKeyName, ok = input.Parsed["clientEncryptionKeyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clientEncryptionKeyName", input) } - return &id, nil + return nil } // ValidateClientEncryptionKeyID checks that 'input' can be parsed as a Client Encryption Key ID diff --git a/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_collection.go b/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_collection.go index a7e01b98015..06ba5f2c382 100644 --- a/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_collection.go +++ b/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_collection.go @@ -40,27 +40,9 @@ func ParseCollectionID(input string) (*CollectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CollectionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) - } - - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseCollectionIDInsensitively(input string) (*CollectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CollectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *CollectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if id.CollectionName, ok = input.Parsed["collectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "collectionName", input) } - return &id, nil + return nil } // ValidateCollectionID checks that 'input' can be parsed as a Collection ID diff --git a/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_collectionpartitionkeyrangeid.go b/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_collectionpartitionkeyrangeid.go index 5819216ab8d..af2697450ff 100644 --- a/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_collectionpartitionkeyrangeid.go +++ b/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_collectionpartitionkeyrangeid.go @@ -44,35 +44,9 @@ func ParseCollectionPartitionKeyRangeIdID(input string) (*CollectionPartitionKey return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CollectionPartitionKeyRangeIdId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.RegionName, ok = parsed.Parsed["regionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "regionName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) - } - - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) - } - - if id.PartitionKeyRangeId, ok = parsed.Parsed["partitionKeyRangeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "partitionKeyRangeId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseCollectionPartitionKeyRangeIdIDInsensitively(input string) (*Collectio return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CollectionPartitionKeyRangeIdId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *CollectionPartitionKeyRangeIdId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.RegionName, ok = parsed.Parsed["regionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "regionName", *parsed) + if id.RegionName, ok = input.Parsed["regionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "regionName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if id.CollectionName, ok = input.Parsed["collectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "collectionName", input) } - if id.PartitionKeyRangeId, ok = parsed.Parsed["partitionKeyRangeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "partitionKeyRangeId", *parsed) + if id.PartitionKeyRangeId, ok = input.Parsed["partitionKeyRangeId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "partitionKeyRangeId", input) } - return &id, nil + return nil } // ValidateCollectionPartitionKeyRangeIdID checks that 'input' can be parsed as a Collection Partition Key Range Id ID diff --git a/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_container.go b/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_container.go index 7a27bedb708..325844c7b0f 100644 --- a/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_container.go +++ b/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_container.go @@ -40,27 +40,9 @@ func ParseContainerID(input string) (*ContainerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) - } - - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseContainerIDInsensitively(input string) (*ContainerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ContainerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) + if id.SqlDatabaseName, ok = input.Parsed["sqlDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", input) } - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) + if id.ContainerName, ok = input.Parsed["containerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerName", input) } - return &id, nil + return nil } // ValidateContainerID checks that 'input' can be parsed as a Container ID diff --git a/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_database.go b/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_database.go index 06541d6f6c6..c52995f2bc9 100644 --- a/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_database.go +++ b/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_database.go @@ -38,23 +38,9 @@ func ParseDatabaseID(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDatabaseIDInsensitively(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - return &id, nil + return nil } // ValidateDatabaseID checks that 'input' can be parsed as a Database ID diff --git a/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_databaseaccount.go b/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_databaseaccount.go index 0e56a8d66f5..425f2c9b5ae 100644 --- a/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_databaseaccount.go +++ b/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_databaseaccount.go @@ -36,19 +36,9 @@ func ParseDatabaseAccountID(input string) (*DatabaseAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDatabaseAccountIDInsensitively(input string) (*DatabaseAccountId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DatabaseAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - return &id, nil + return nil } // ValidateDatabaseAccountID checks that 'input' can be parsed as a Database Account ID diff --git a/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_databaseaccountname.go b/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_databaseaccountname.go index 1ad2a926aa2..a2757f56303 100644 --- a/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_databaseaccountname.go +++ b/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_databaseaccountname.go @@ -32,11 +32,9 @@ func ParseDatabaseAccountNameID(input string) (*DatabaseAccountNameId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountNameId{} - - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseDatabaseAccountNameIDInsensitively(input string) (*DatabaseAccountName return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountNameId{} - - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *DatabaseAccountNameId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) + } + + return nil +} + // ValidateDatabaseAccountNameID checks that 'input' can be parsed as a Database Account Name ID func ValidateDatabaseAccountNameID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_databasecollection.go b/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_databasecollection.go index ae75117d04e..82742bb4c95 100644 --- a/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_databasecollection.go +++ b/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_databasecollection.go @@ -42,31 +42,9 @@ func ParseDatabaseCollectionID(input string) (*DatabaseCollectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseCollectionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.RegionName, ok = parsed.Parsed["regionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "regionName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) - } - - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseDatabaseCollectionIDInsensitively(input string) (*DatabaseCollectionId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseCollectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DatabaseCollectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.RegionName, ok = parsed.Parsed["regionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "regionName", *parsed) + if id.RegionName, ok = input.Parsed["regionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "regionName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if id.CollectionName, ok = input.Parsed["collectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "collectionName", input) } - return &id, nil + return nil } // ValidateDatabaseCollectionID checks that 'input' can be parsed as a Database Collection ID diff --git a/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_graph.go b/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_graph.go index 990cf689b19..87414bff4e5 100644 --- a/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_graph.go +++ b/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_graph.go @@ -40,27 +40,9 @@ func ParseGraphID(input string) (*GraphId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GraphId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.GremlinDatabaseName, ok = parsed.Parsed["gremlinDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gremlinDatabaseName", *parsed) - } - - if id.GraphName, ok = parsed.Parsed["graphName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "graphName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseGraphIDInsensitively(input string) (*GraphId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GraphId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *GraphId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.GremlinDatabaseName, ok = parsed.Parsed["gremlinDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gremlinDatabaseName", *parsed) + if id.GremlinDatabaseName, ok = input.Parsed["gremlinDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gremlinDatabaseName", input) } - if id.GraphName, ok = parsed.Parsed["graphName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "graphName", *parsed) + if id.GraphName, ok = input.Parsed["graphName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "graphName", input) } - return &id, nil + return nil } // ValidateGraphID checks that 'input' can be parsed as a Graph ID diff --git a/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_gremlindatabase.go b/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_gremlindatabase.go index 20095da53b2..62c750d65ce 100644 --- a/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_gremlindatabase.go +++ b/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_gremlindatabase.go @@ -38,23 +38,9 @@ func ParseGremlinDatabaseID(input string) (*GremlinDatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GremlinDatabaseId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.GremlinDatabaseName, ok = parsed.Parsed["gremlinDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gremlinDatabaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGremlinDatabaseIDInsensitively(input string) (*GremlinDatabaseId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GremlinDatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GremlinDatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.GremlinDatabaseName, ok = parsed.Parsed["gremlinDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gremlinDatabaseName", *parsed) + if id.GremlinDatabaseName, ok = input.Parsed["gremlinDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gremlinDatabaseName", input) } - return &id, nil + return nil } // ValidateGremlinDatabaseID checks that 'input' can be parsed as a Gremlin Database ID diff --git a/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_location.go b/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_location.go index bc6bbfc9d1d..2955e6dd543 100644 --- a/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_location.go +++ b/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_mongodbdatabase.go b/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_mongodbdatabase.go index 245c181e310..f156cc1f463 100644 --- a/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_mongodbdatabase.go +++ b/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_mongodbdatabase.go @@ -38,23 +38,9 @@ func ParseMongodbDatabaseID(input string) (*MongodbDatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MongodbDatabaseId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.MongodbDatabaseName, ok = parsed.Parsed["mongodbDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mongodbDatabaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseMongodbDatabaseIDInsensitively(input string) (*MongodbDatabaseId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MongodbDatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *MongodbDatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.MongodbDatabaseName, ok = parsed.Parsed["mongodbDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mongodbDatabaseName", *parsed) + if id.MongodbDatabaseName, ok = input.Parsed["mongodbDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mongodbDatabaseName", input) } - return &id, nil + return nil } // ValidateMongodbDatabaseID checks that 'input' can be parsed as a Mongodb Database ID diff --git a/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_mongodbdatabasecollection.go b/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_mongodbdatabasecollection.go index fd0ec8e076a..e571a8d6f95 100644 --- a/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_mongodbdatabasecollection.go +++ b/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_mongodbdatabasecollection.go @@ -40,27 +40,9 @@ func ParseMongodbDatabaseCollectionID(input string) (*MongodbDatabaseCollectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MongodbDatabaseCollectionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.MongodbDatabaseName, ok = parsed.Parsed["mongodbDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mongodbDatabaseName", *parsed) - } - - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseMongodbDatabaseCollectionIDInsensitively(input string) (*MongodbDataba return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MongodbDatabaseCollectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *MongodbDatabaseCollectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.MongodbDatabaseName, ok = parsed.Parsed["mongodbDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mongodbDatabaseName", *parsed) + if id.MongodbDatabaseName, ok = input.Parsed["mongodbDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mongodbDatabaseName", input) } - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if id.CollectionName, ok = input.Parsed["collectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "collectionName", input) } - return &id, nil + return nil } // ValidateMongodbDatabaseCollectionID checks that 'input' can be parsed as a Mongodb Database Collection ID diff --git a/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_partitionkeyrangeid.go b/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_partitionkeyrangeid.go index f90c9d9a225..991131e877a 100644 --- a/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_partitionkeyrangeid.go +++ b/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_partitionkeyrangeid.go @@ -42,31 +42,9 @@ func ParsePartitionKeyRangeIdID(input string) (*PartitionKeyRangeIdId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PartitionKeyRangeIdId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) - } - - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) - } - - if id.PartitionKeyRangeId, ok = parsed.Parsed["partitionKeyRangeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "partitionKeyRangeId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParsePartitionKeyRangeIdIDInsensitively(input string) (*PartitionKeyRangeId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PartitionKeyRangeIdId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PartitionKeyRangeIdId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if id.CollectionName, ok = input.Parsed["collectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "collectionName", input) } - if id.PartitionKeyRangeId, ok = parsed.Parsed["partitionKeyRangeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "partitionKeyRangeId", *parsed) + if id.PartitionKeyRangeId, ok = input.Parsed["partitionKeyRangeId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "partitionKeyRangeId", input) } - return &id, nil + return nil } // ValidatePartitionKeyRangeIdID checks that 'input' can be parsed as a Partition Key Range Id ID diff --git a/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_region.go b/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_region.go index cc2b2ed76b1..957458f0e99 100644 --- a/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_region.go +++ b/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_region.go @@ -38,23 +38,9 @@ func ParseRegionID(input string) (*RegionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.RegionName, ok = parsed.Parsed["regionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "regionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRegionIDInsensitively(input string) (*RegionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RegionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.RegionName, ok = parsed.Parsed["regionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "regionName", *parsed) + if id.RegionName, ok = input.Parsed["regionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "regionName", input) } - return &id, nil + return nil } // ValidateRegionID checks that 'input' can be parsed as a Region ID diff --git a/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_sourceregiontargetregion.go b/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_sourceregiontargetregion.go index 6482bb9bd1f..1b21054abf3 100644 --- a/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_sourceregiontargetregion.go +++ b/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_sourceregiontargetregion.go @@ -40,27 +40,9 @@ func ParseSourceRegionTargetRegionID(input string) (*SourceRegionTargetRegionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceRegionTargetRegionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.SourceRegionName, ok = parsed.Parsed["sourceRegionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceRegionName", *parsed) - } - - if id.TargetRegionName, ok = parsed.Parsed["targetRegionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetRegionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSourceRegionTargetRegionIDInsensitively(input string) (*SourceRegionTa return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceRegionTargetRegionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SourceRegionTargetRegionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.SourceRegionName, ok = parsed.Parsed["sourceRegionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceRegionName", *parsed) + if id.SourceRegionName, ok = input.Parsed["sourceRegionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sourceRegionName", input) } - if id.TargetRegionName, ok = parsed.Parsed["targetRegionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetRegionName", *parsed) + if id.TargetRegionName, ok = input.Parsed["targetRegionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "targetRegionName", input) } - return &id, nil + return nil } // ValidateSourceRegionTargetRegionID checks that 'input' can be parsed as a Source Region Target Region ID diff --git a/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_sqldatabase.go b/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_sqldatabase.go index 0efbaa7dbca..c8cd86949a8 100644 --- a/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_sqldatabase.go +++ b/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_sqldatabase.go @@ -38,23 +38,9 @@ func ParseSqlDatabaseID(input string) (*SqlDatabaseId, error) { 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSqlDatabaseIDInsensitively(input string) (*SqlDatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SqlDatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SqlDatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) + if id.SqlDatabaseName, ok = input.Parsed["sqlDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", input) } - return &id, nil + return nil } // ValidateSqlDatabaseID checks that 'input' can be parsed as a Sql Database ID diff --git a/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_storedprocedure.go b/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_storedprocedure.go index fd7480b7609..5468c795b65 100644 --- a/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_storedprocedure.go +++ b/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_storedprocedure.go @@ -42,31 +42,9 @@ func ParseStoredProcedureID(input string) (*StoredProcedureId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StoredProcedureId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) - } - - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) - } - - if id.StoredProcedureName, ok = parsed.Parsed["storedProcedureName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storedProcedureName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseStoredProcedureIDInsensitively(input string) (*StoredProcedureId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StoredProcedureId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *StoredProcedureId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) + if id.SqlDatabaseName, ok = input.Parsed["sqlDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", input) } - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) + if id.ContainerName, ok = input.Parsed["containerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerName", input) } - if id.StoredProcedureName, ok = parsed.Parsed["storedProcedureName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storedProcedureName", *parsed) + if id.StoredProcedureName, ok = input.Parsed["storedProcedureName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storedProcedureName", input) } - return &id, nil + return nil } // ValidateStoredProcedureID checks that 'input' can be parsed as a Stored Procedure ID diff --git a/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_table.go b/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_table.go index f4d64253830..006d2a6171b 100644 --- a/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_table.go +++ b/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_table.go @@ -38,23 +38,9 @@ func ParseTableID(input string) (*TableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TableId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTableIDInsensitively(input string) (*TableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TableId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if id.TableName, ok = input.Parsed["tableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tableName", input) } - return &id, nil + return nil } // ValidateTableID checks that 'input' can be parsed as a Table ID diff --git a/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_targetregion.go b/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_targetregion.go index 1604e4b598b..bbf4612af00 100644 --- a/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_targetregion.go +++ b/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_targetregion.go @@ -38,23 +38,9 @@ func ParseTargetRegionID(input string) (*TargetRegionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TargetRegionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.TargetRegionName, ok = parsed.Parsed["targetRegionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetRegionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTargetRegionIDInsensitively(input string) (*TargetRegionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TargetRegionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TargetRegionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.TargetRegionName, ok = parsed.Parsed["targetRegionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetRegionName", *parsed) + if id.TargetRegionName, ok = input.Parsed["targetRegionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "targetRegionName", input) } - return &id, nil + return nil } // ValidateTargetRegionID checks that 'input' can be parsed as a Target Region ID diff --git a/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_trigger.go b/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_trigger.go index 7c06746b92c..864ee0c2a38 100644 --- a/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_trigger.go +++ b/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_trigger.go @@ -42,31 +42,9 @@ func ParseTriggerID(input string) (*TriggerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TriggerId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) - } - - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) - } - - if id.TriggerName, ok = parsed.Parsed["triggerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseTriggerIDInsensitively(input string) (*TriggerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TriggerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *TriggerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) + if id.SqlDatabaseName, ok = input.Parsed["sqlDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", input) } - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) + if id.ContainerName, ok = input.Parsed["containerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerName", input) } - if id.TriggerName, ok = parsed.Parsed["triggerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggerName", *parsed) + if id.TriggerName, ok = input.Parsed["triggerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "triggerName", input) } - return &id, nil + return nil } // ValidateTriggerID checks that 'input' can be parsed as a Trigger ID diff --git a/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_userdefinedfunction.go b/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_userdefinedfunction.go index 54f09bc5f2d..90e49c6f84e 100644 --- a/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_userdefinedfunction.go +++ b/resource-manager/cosmosdb/2022-11-15/cosmosdb/id_userdefinedfunction.go @@ -42,31 +42,9 @@ func ParseUserDefinedFunctionID(input string) (*UserDefinedFunctionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserDefinedFunctionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) - } - - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) - } - - if id.UserDefinedFunctionName, ok = parsed.Parsed["userDefinedFunctionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userDefinedFunctionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseUserDefinedFunctionIDInsensitively(input string) (*UserDefinedFunction return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserDefinedFunctionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *UserDefinedFunctionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) + if id.SqlDatabaseName, ok = input.Parsed["sqlDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", input) } - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) + if id.ContainerName, ok = input.Parsed["containerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerName", input) } - if id.UserDefinedFunctionName, ok = parsed.Parsed["userDefinedFunctionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userDefinedFunctionName", *parsed) + if id.UserDefinedFunctionName, ok = input.Parsed["userDefinedFunctionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userDefinedFunctionName", input) } - return &id, nil + return nil } // ValidateUserDefinedFunctionID checks that 'input' can be parsed as a User Defined Function ID diff --git a/resource-manager/cosmosdb/2022-11-15/datatransfer/id_service.go b/resource-manager/cosmosdb/2022-11-15/datatransfer/id_service.go index c2fba9c3c5d..5f0f6c16dc6 100644 --- a/resource-manager/cosmosdb/2022-11-15/datatransfer/id_service.go +++ b/resource-manager/cosmosdb/2022-11-15/datatransfer/id_service.go @@ -38,23 +38,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ServiceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/cosmosdb/2022-11-15/graphapicompute/id_service.go b/resource-manager/cosmosdb/2022-11-15/graphapicompute/id_service.go index 92c693864c7..41bd08f7b1c 100644 --- a/resource-manager/cosmosdb/2022-11-15/graphapicompute/id_service.go +++ b/resource-manager/cosmosdb/2022-11-15/graphapicompute/id_service.go @@ -38,23 +38,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ServiceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/cosmosdb/2022-11-15/managedcassandras/id_cassandracluster.go b/resource-manager/cosmosdb/2022-11-15/managedcassandras/id_cassandracluster.go index 55c61f4a864..70b8aac3664 100644 --- a/resource-manager/cosmosdb/2022-11-15/managedcassandras/id_cassandracluster.go +++ b/resource-manager/cosmosdb/2022-11-15/managedcassandras/id_cassandracluster.go @@ -36,19 +36,9 @@ func ParseCassandraClusterID(input string) (*CassandraClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CassandraClusterId{} - - 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.CassandraClusterName, ok = parsed.Parsed["cassandraClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cassandraClusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseCassandraClusterIDInsensitively(input string) (*CassandraClusterId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CassandraClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CassandraClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CassandraClusterName, ok = parsed.Parsed["cassandraClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cassandraClusterName", *parsed) + if id.CassandraClusterName, ok = input.Parsed["cassandraClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cassandraClusterName", input) } - return &id, nil + return nil } // ValidateCassandraClusterID checks that 'input' can be parsed as a Cassandra Cluster ID diff --git a/resource-manager/cosmosdb/2022-11-15/managedcassandras/id_datacenter.go b/resource-manager/cosmosdb/2022-11-15/managedcassandras/id_datacenter.go index 8d8d8835013..0c8dfad5704 100644 --- a/resource-manager/cosmosdb/2022-11-15/managedcassandras/id_datacenter.go +++ b/resource-manager/cosmosdb/2022-11-15/managedcassandras/id_datacenter.go @@ -38,23 +38,9 @@ func ParseDataCenterID(input string) (*DataCenterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataCenterId{} - - 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.CassandraClusterName, ok = parsed.Parsed["cassandraClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cassandraClusterName", *parsed) - } - - if id.DataCenterName, ok = parsed.Parsed["dataCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataCenterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDataCenterIDInsensitively(input string) (*DataCenterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataCenterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DataCenterId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CassandraClusterName, ok = parsed.Parsed["cassandraClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cassandraClusterName", *parsed) + if id.CassandraClusterName, ok = input.Parsed["cassandraClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cassandraClusterName", input) } - if id.DataCenterName, ok = parsed.Parsed["dataCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataCenterName", *parsed) + if id.DataCenterName, ok = input.Parsed["dataCenterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataCenterName", input) } - return &id, nil + return nil } // ValidateDataCenterID checks that 'input' can be parsed as a Data Center ID diff --git a/resource-manager/cosmosdb/2022-11-15/materializedviewsbuilder/id_service.go b/resource-manager/cosmosdb/2022-11-15/materializedviewsbuilder/id_service.go index a3c6ba915ec..4f5a2a474a6 100644 --- a/resource-manager/cosmosdb/2022-11-15/materializedviewsbuilder/id_service.go +++ b/resource-manager/cosmosdb/2022-11-15/materializedviewsbuilder/id_service.go @@ -38,23 +38,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ServiceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/cosmosdb/2022-11-15/mongorbacs/id_databaseaccount.go b/resource-manager/cosmosdb/2022-11-15/mongorbacs/id_databaseaccount.go index 9edb9717313..20b3172f6a2 100644 --- a/resource-manager/cosmosdb/2022-11-15/mongorbacs/id_databaseaccount.go +++ b/resource-manager/cosmosdb/2022-11-15/mongorbacs/id_databaseaccount.go @@ -36,19 +36,9 @@ func ParseDatabaseAccountID(input string) (*DatabaseAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDatabaseAccountIDInsensitively(input string) (*DatabaseAccountId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DatabaseAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - return &id, nil + return nil } // ValidateDatabaseAccountID checks that 'input' can be parsed as a Database Account ID diff --git a/resource-manager/cosmosdb/2022-11-15/mongorbacs/id_mongodbroledefinition.go b/resource-manager/cosmosdb/2022-11-15/mongorbacs/id_mongodbroledefinition.go index a5dad9eda74..737a561ca8a 100644 --- a/resource-manager/cosmosdb/2022-11-15/mongorbacs/id_mongodbroledefinition.go +++ b/resource-manager/cosmosdb/2022-11-15/mongorbacs/id_mongodbroledefinition.go @@ -38,23 +38,9 @@ func ParseMongodbRoleDefinitionID(input string) (*MongodbRoleDefinitionId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MongodbRoleDefinitionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.MongoRoleDefinitionId, ok = parsed.Parsed["mongoRoleDefinitionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mongoRoleDefinitionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseMongodbRoleDefinitionIDInsensitively(input string) (*MongodbRoleDefini return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MongodbRoleDefinitionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *MongodbRoleDefinitionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.MongoRoleDefinitionId, ok = parsed.Parsed["mongoRoleDefinitionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mongoRoleDefinitionId", *parsed) + if id.MongoRoleDefinitionId, ok = input.Parsed["mongoRoleDefinitionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mongoRoleDefinitionId", input) } - return &id, nil + return nil } // ValidateMongodbRoleDefinitionID checks that 'input' can be parsed as a Mongodb Role Definition ID diff --git a/resource-manager/cosmosdb/2022-11-15/mongorbacs/id_mongodbuserdefinition.go b/resource-manager/cosmosdb/2022-11-15/mongorbacs/id_mongodbuserdefinition.go index 5e5016590a7..f720d6bbf30 100644 --- a/resource-manager/cosmosdb/2022-11-15/mongorbacs/id_mongodbuserdefinition.go +++ b/resource-manager/cosmosdb/2022-11-15/mongorbacs/id_mongodbuserdefinition.go @@ -38,23 +38,9 @@ func ParseMongodbUserDefinitionID(input string) (*MongodbUserDefinitionId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MongodbUserDefinitionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.MongoUserDefinitionId, ok = parsed.Parsed["mongoUserDefinitionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mongoUserDefinitionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseMongodbUserDefinitionIDInsensitively(input string) (*MongodbUserDefini return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MongodbUserDefinitionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *MongodbUserDefinitionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.MongoUserDefinitionId, ok = parsed.Parsed["mongoUserDefinitionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mongoUserDefinitionId", *parsed) + if id.MongoUserDefinitionId, ok = input.Parsed["mongoUserDefinitionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mongoUserDefinitionId", input) } - return &id, nil + return nil } // ValidateMongodbUserDefinitionID checks that 'input' can be parsed as a Mongodb User Definition ID diff --git a/resource-manager/cosmosdb/2022-11-15/notebookworkspacesresource/id_databaseaccount.go b/resource-manager/cosmosdb/2022-11-15/notebookworkspacesresource/id_databaseaccount.go index 6163d3bbe76..ce05f7ad501 100644 --- a/resource-manager/cosmosdb/2022-11-15/notebookworkspacesresource/id_databaseaccount.go +++ b/resource-manager/cosmosdb/2022-11-15/notebookworkspacesresource/id_databaseaccount.go @@ -36,19 +36,9 @@ func ParseDatabaseAccountID(input string) (*DatabaseAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDatabaseAccountIDInsensitively(input string) (*DatabaseAccountId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DatabaseAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - return &id, nil + return nil } // ValidateDatabaseAccountID checks that 'input' can be parsed as a Database Account ID diff --git a/resource-manager/cosmosdb/2022-11-15/privateendpointconnections/id_databaseaccount.go b/resource-manager/cosmosdb/2022-11-15/privateendpointconnections/id_databaseaccount.go index 1d3deea521d..819433a83df 100644 --- a/resource-manager/cosmosdb/2022-11-15/privateendpointconnections/id_databaseaccount.go +++ b/resource-manager/cosmosdb/2022-11-15/privateendpointconnections/id_databaseaccount.go @@ -36,19 +36,9 @@ func ParseDatabaseAccountID(input string) (*DatabaseAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDatabaseAccountIDInsensitively(input string) (*DatabaseAccountId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DatabaseAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - return &id, nil + return nil } // ValidateDatabaseAccountID checks that 'input' can be parsed as a Database Account ID diff --git a/resource-manager/cosmosdb/2022-11-15/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/cosmosdb/2022-11-15/privateendpointconnections/id_privateendpointconnection.go index 25382589736..13a94a5226b 100644 --- a/resource-manager/cosmosdb/2022-11-15/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/cosmosdb/2022-11-15/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/cosmosdb/2022-11-15/privatelinkresources/id_databaseaccount.go b/resource-manager/cosmosdb/2022-11-15/privatelinkresources/id_databaseaccount.go index 860bfb590a3..eedea1fcc5c 100644 --- a/resource-manager/cosmosdb/2022-11-15/privatelinkresources/id_databaseaccount.go +++ b/resource-manager/cosmosdb/2022-11-15/privatelinkresources/id_databaseaccount.go @@ -36,19 +36,9 @@ func ParseDatabaseAccountID(input string) (*DatabaseAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDatabaseAccountIDInsensitively(input string) (*DatabaseAccountId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DatabaseAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - return &id, nil + return nil } // ValidateDatabaseAccountID checks that 'input' can be parsed as a Database Account ID diff --git a/resource-manager/cosmosdb/2022-11-15/privatelinkresources/id_privatelinkresource.go b/resource-manager/cosmosdb/2022-11-15/privatelinkresources/id_privatelinkresource.go index 46003ca6e7b..e9f0c7e799e 100644 --- a/resource-manager/cosmosdb/2022-11-15/privatelinkresources/id_privatelinkresource.go +++ b/resource-manager/cosmosdb/2022-11-15/privatelinkresources/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/cosmosdb/2022-11-15/rbacs/id_account.go b/resource-manager/cosmosdb/2022-11-15/rbacs/id_account.go index d548f6b1a64..b9caf8a4482 100644 --- a/resource-manager/cosmosdb/2022-11-15/rbacs/id_account.go +++ b/resource-manager/cosmosdb/2022-11-15/rbacs/id_account.go @@ -38,23 +38,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.RoleAssignmentId, ok = parsed.Parsed["roleAssignmentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleAssignmentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.RoleAssignmentId, ok = parsed.Parsed["roleAssignmentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleAssignmentId", *parsed) + if id.RoleAssignmentId, ok = input.Parsed["roleAssignmentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "roleAssignmentId", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/cosmosdb/2022-11-15/rbacs/id_databaseaccount.go b/resource-manager/cosmosdb/2022-11-15/rbacs/id_databaseaccount.go index 878ca7762f4..856f00f92c8 100644 --- a/resource-manager/cosmosdb/2022-11-15/rbacs/id_databaseaccount.go +++ b/resource-manager/cosmosdb/2022-11-15/rbacs/id_databaseaccount.go @@ -36,19 +36,9 @@ func ParseDatabaseAccountID(input string) (*DatabaseAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDatabaseAccountIDInsensitively(input string) (*DatabaseAccountId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DatabaseAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - return &id, nil + return nil } // ValidateDatabaseAccountID checks that 'input' can be parsed as a Database Account ID diff --git a/resource-manager/cosmosdb/2022-11-15/rbacs/id_sqlroledefinition.go b/resource-manager/cosmosdb/2022-11-15/rbacs/id_sqlroledefinition.go index 292dcd692e5..522ce0762cf 100644 --- a/resource-manager/cosmosdb/2022-11-15/rbacs/id_sqlroledefinition.go +++ b/resource-manager/cosmosdb/2022-11-15/rbacs/id_sqlroledefinition.go @@ -38,23 +38,9 @@ func ParseSqlRoleDefinitionID(input string) (*SqlRoleDefinitionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SqlRoleDefinitionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.RoleDefinitionId, ok = parsed.Parsed["roleDefinitionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleDefinitionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSqlRoleDefinitionIDInsensitively(input string) (*SqlRoleDefinitionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SqlRoleDefinitionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SqlRoleDefinitionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.RoleDefinitionId, ok = parsed.Parsed["roleDefinitionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleDefinitionId", *parsed) + if id.RoleDefinitionId, ok = input.Parsed["roleDefinitionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "roleDefinitionId", input) } - return &id, nil + return nil } // ValidateSqlRoleDefinitionID checks that 'input' can be parsed as a Sql Role Definition ID diff --git a/resource-manager/cosmosdb/2022-11-15/restorables/id_container.go b/resource-manager/cosmosdb/2022-11-15/restorables/id_container.go index abf3171b109..c2b2177ed71 100644 --- a/resource-manager/cosmosdb/2022-11-15/restorables/id_container.go +++ b/resource-manager/cosmosdb/2022-11-15/restorables/id_container.go @@ -40,27 +40,9 @@ func ParseContainerID(input string) (*ContainerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) - } - - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseContainerIDInsensitively(input string) (*ContainerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ContainerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) + if id.SqlDatabaseName, ok = input.Parsed["sqlDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", input) } - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) + if id.ContainerName, ok = input.Parsed["containerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerName", input) } - return &id, nil + return nil } // ValidateContainerID checks that 'input' can be parsed as a Container ID diff --git a/resource-manager/cosmosdb/2022-11-15/restorables/id_graph.go b/resource-manager/cosmosdb/2022-11-15/restorables/id_graph.go index ab652bd3a81..17e4e7dcc5d 100644 --- a/resource-manager/cosmosdb/2022-11-15/restorables/id_graph.go +++ b/resource-manager/cosmosdb/2022-11-15/restorables/id_graph.go @@ -40,27 +40,9 @@ func ParseGraphID(input string) (*GraphId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GraphId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.GremlinDatabaseName, ok = parsed.Parsed["gremlinDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gremlinDatabaseName", *parsed) - } - - if id.GraphName, ok = parsed.Parsed["graphName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "graphName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseGraphIDInsensitively(input string) (*GraphId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GraphId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *GraphId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.GremlinDatabaseName, ok = parsed.Parsed["gremlinDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gremlinDatabaseName", *parsed) + if id.GremlinDatabaseName, ok = input.Parsed["gremlinDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gremlinDatabaseName", input) } - if id.GraphName, ok = parsed.Parsed["graphName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "graphName", *parsed) + if id.GraphName, ok = input.Parsed["graphName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "graphName", input) } - return &id, nil + return nil } // ValidateGraphID checks that 'input' can be parsed as a Graph ID diff --git a/resource-manager/cosmosdb/2022-11-15/restorables/id_location.go b/resource-manager/cosmosdb/2022-11-15/restorables/id_location.go index 0eb834cf4e6..35f17158125 100644 --- a/resource-manager/cosmosdb/2022-11-15/restorables/id_location.go +++ b/resource-manager/cosmosdb/2022-11-15/restorables/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/cosmosdb/2022-11-15/restorables/id_mongodbdatabasecollection.go b/resource-manager/cosmosdb/2022-11-15/restorables/id_mongodbdatabasecollection.go index 2d1dee24a26..576dcaff5d8 100644 --- a/resource-manager/cosmosdb/2022-11-15/restorables/id_mongodbdatabasecollection.go +++ b/resource-manager/cosmosdb/2022-11-15/restorables/id_mongodbdatabasecollection.go @@ -40,27 +40,9 @@ func ParseMongodbDatabaseCollectionID(input string) (*MongodbDatabaseCollectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MongodbDatabaseCollectionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.MongodbDatabaseName, ok = parsed.Parsed["mongodbDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mongodbDatabaseName", *parsed) - } - - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseMongodbDatabaseCollectionIDInsensitively(input string) (*MongodbDataba return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MongodbDatabaseCollectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *MongodbDatabaseCollectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.MongodbDatabaseName, ok = parsed.Parsed["mongodbDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mongodbDatabaseName", *parsed) + if id.MongodbDatabaseName, ok = input.Parsed["mongodbDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mongodbDatabaseName", input) } - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if id.CollectionName, ok = input.Parsed["collectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "collectionName", input) } - return &id, nil + return nil } // ValidateMongodbDatabaseCollectionID checks that 'input' can be parsed as a Mongodb Database Collection ID diff --git a/resource-manager/cosmosdb/2022-11-15/restorables/id_restorabledatabaseaccount.go b/resource-manager/cosmosdb/2022-11-15/restorables/id_restorabledatabaseaccount.go index f2c929a0130..25ee3deecab 100644 --- a/resource-manager/cosmosdb/2022-11-15/restorables/id_restorabledatabaseaccount.go +++ b/resource-manager/cosmosdb/2022-11-15/restorables/id_restorabledatabaseaccount.go @@ -36,19 +36,9 @@ func ParseRestorableDatabaseAccountID(input string) (*RestorableDatabaseAccountI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RestorableDatabaseAccountId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRestorableDatabaseAccountIDInsensitively(input string) (*RestorableDat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RestorableDatabaseAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RestorableDatabaseAccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if id.InstanceId, ok = input.Parsed["instanceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceId", input) } - return &id, nil + return nil } // ValidateRestorableDatabaseAccountID checks that 'input' can be parsed as a Restorable Database Account ID diff --git a/resource-manager/cosmosdb/2022-11-15/restorables/id_table.go b/resource-manager/cosmosdb/2022-11-15/restorables/id_table.go index a2dd478f80b..e7ebd22e638 100644 --- a/resource-manager/cosmosdb/2022-11-15/restorables/id_table.go +++ b/resource-manager/cosmosdb/2022-11-15/restorables/id_table.go @@ -38,23 +38,9 @@ func ParseTableID(input string) (*TableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TableId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTableIDInsensitively(input string) (*TableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TableId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if id.TableName, ok = input.Parsed["tableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tableName", input) } - return &id, nil + return nil } // ValidateTableID checks that 'input' can be parsed as a Table ID diff --git a/resource-manager/cosmosdb/2022-11-15/services/id_databaseaccount.go b/resource-manager/cosmosdb/2022-11-15/services/id_databaseaccount.go index fde95de221b..4a229a3b3b9 100644 --- a/resource-manager/cosmosdb/2022-11-15/services/id_databaseaccount.go +++ b/resource-manager/cosmosdb/2022-11-15/services/id_databaseaccount.go @@ -36,19 +36,9 @@ func ParseDatabaseAccountID(input string) (*DatabaseAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDatabaseAccountIDInsensitively(input string) (*DatabaseAccountId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DatabaseAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - return &id, nil + return nil } // ValidateDatabaseAccountID checks that 'input' can be parsed as a Database Account ID diff --git a/resource-manager/cosmosdb/2022-11-15/sqldedicatedgateway/id_service.go b/resource-manager/cosmosdb/2022-11-15/sqldedicatedgateway/id_service.go index 1a0173f1bdd..2ecf0e8462e 100644 --- a/resource-manager/cosmosdb/2022-11-15/sqldedicatedgateway/id_service.go +++ b/resource-manager/cosmosdb/2022-11-15/sqldedicatedgateway/id_service.go @@ -38,23 +38,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ServiceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_cassandrakeyspace.go b/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_cassandrakeyspace.go index 9555cbf46b1..c0948748c2d 100644 --- a/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_cassandrakeyspace.go +++ b/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_cassandrakeyspace.go @@ -38,23 +38,9 @@ func ParseCassandraKeyspaceID(input string) (*CassandraKeyspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CassandraKeyspaceId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.CassandraKeyspaceName, ok = parsed.Parsed["cassandraKeyspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cassandraKeyspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCassandraKeyspaceIDInsensitively(input string) (*CassandraKeyspaceId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CassandraKeyspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CassandraKeyspaceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.CassandraKeyspaceName, ok = parsed.Parsed["cassandraKeyspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cassandraKeyspaceName", *parsed) + if id.CassandraKeyspaceName, ok = input.Parsed["cassandraKeyspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cassandraKeyspaceName", input) } - return &id, nil + return nil } // ValidateCassandraKeyspaceID checks that 'input' can be parsed as a Cassandra Keyspace ID diff --git a/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_cassandrakeyspacetable.go b/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_cassandrakeyspacetable.go index 66b3ea506a4..0e9b31b7d48 100644 --- a/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_cassandrakeyspacetable.go +++ b/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_cassandrakeyspacetable.go @@ -40,27 +40,9 @@ func ParseCassandraKeyspaceTableID(input string) (*CassandraKeyspaceTableId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CassandraKeyspaceTableId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.CassandraKeyspaceName, ok = parsed.Parsed["cassandraKeyspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cassandraKeyspaceName", *parsed) - } - - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseCassandraKeyspaceTableIDInsensitively(input string) (*CassandraKeyspac return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CassandraKeyspaceTableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *CassandraKeyspaceTableId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.CassandraKeyspaceName, ok = parsed.Parsed["cassandraKeyspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cassandraKeyspaceName", *parsed) + if id.CassandraKeyspaceName, ok = input.Parsed["cassandraKeyspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cassandraKeyspaceName", input) } - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if id.TableName, ok = input.Parsed["tableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tableName", input) } - return &id, nil + return nil } // ValidateCassandraKeyspaceTableID checks that 'input' can be parsed as a Cassandra Keyspace Table ID diff --git a/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_clientencryptionkey.go b/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_clientencryptionkey.go index 8fcb741d96a..70599e3ea3d 100644 --- a/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_clientencryptionkey.go +++ b/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_clientencryptionkey.go @@ -40,27 +40,9 @@ func ParseClientEncryptionKeyID(input string) (*ClientEncryptionKeyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClientEncryptionKeyId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) - } - - if id.ClientEncryptionKeyName, ok = parsed.Parsed["clientEncryptionKeyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clientEncryptionKeyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseClientEncryptionKeyIDInsensitively(input string) (*ClientEncryptionKey return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClientEncryptionKeyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ClientEncryptionKeyId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) + if id.SqlDatabaseName, ok = input.Parsed["sqlDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", input) } - if id.ClientEncryptionKeyName, ok = parsed.Parsed["clientEncryptionKeyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clientEncryptionKeyName", *parsed) + if id.ClientEncryptionKeyName, ok = input.Parsed["clientEncryptionKeyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clientEncryptionKeyName", input) } - return &id, nil + return nil } // ValidateClientEncryptionKeyID checks that 'input' can be parsed as a Client Encryption Key ID diff --git a/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_collection.go b/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_collection.go index a7e01b98015..06ba5f2c382 100644 --- a/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_collection.go +++ b/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_collection.go @@ -40,27 +40,9 @@ func ParseCollectionID(input string) (*CollectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CollectionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) - } - - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseCollectionIDInsensitively(input string) (*CollectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CollectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *CollectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if id.CollectionName, ok = input.Parsed["collectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "collectionName", input) } - return &id, nil + return nil } // ValidateCollectionID checks that 'input' can be parsed as a Collection ID diff --git a/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_collectionpartitionkeyrangeid.go b/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_collectionpartitionkeyrangeid.go index 5819216ab8d..af2697450ff 100644 --- a/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_collectionpartitionkeyrangeid.go +++ b/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_collectionpartitionkeyrangeid.go @@ -44,35 +44,9 @@ func ParseCollectionPartitionKeyRangeIdID(input string) (*CollectionPartitionKey return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CollectionPartitionKeyRangeIdId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.RegionName, ok = parsed.Parsed["regionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "regionName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) - } - - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) - } - - if id.PartitionKeyRangeId, ok = parsed.Parsed["partitionKeyRangeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "partitionKeyRangeId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseCollectionPartitionKeyRangeIdIDInsensitively(input string) (*Collectio return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CollectionPartitionKeyRangeIdId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *CollectionPartitionKeyRangeIdId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.RegionName, ok = parsed.Parsed["regionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "regionName", *parsed) + if id.RegionName, ok = input.Parsed["regionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "regionName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if id.CollectionName, ok = input.Parsed["collectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "collectionName", input) } - if id.PartitionKeyRangeId, ok = parsed.Parsed["partitionKeyRangeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "partitionKeyRangeId", *parsed) + if id.PartitionKeyRangeId, ok = input.Parsed["partitionKeyRangeId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "partitionKeyRangeId", input) } - return &id, nil + return nil } // ValidateCollectionPartitionKeyRangeIdID checks that 'input' can be parsed as a Collection Partition Key Range Id ID diff --git a/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_container.go b/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_container.go index 7a27bedb708..325844c7b0f 100644 --- a/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_container.go +++ b/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_container.go @@ -40,27 +40,9 @@ func ParseContainerID(input string) (*ContainerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) - } - - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseContainerIDInsensitively(input string) (*ContainerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ContainerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) + if id.SqlDatabaseName, ok = input.Parsed["sqlDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", input) } - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) + if id.ContainerName, ok = input.Parsed["containerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerName", input) } - return &id, nil + return nil } // ValidateContainerID checks that 'input' can be parsed as a Container ID diff --git a/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_database.go b/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_database.go index 06541d6f6c6..c52995f2bc9 100644 --- a/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_database.go +++ b/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_database.go @@ -38,23 +38,9 @@ func ParseDatabaseID(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDatabaseIDInsensitively(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - return &id, nil + return nil } // ValidateDatabaseID checks that 'input' can be parsed as a Database ID diff --git a/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_databaseaccount.go b/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_databaseaccount.go index 0e56a8d66f5..425f2c9b5ae 100644 --- a/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_databaseaccount.go +++ b/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_databaseaccount.go @@ -36,19 +36,9 @@ func ParseDatabaseAccountID(input string) (*DatabaseAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDatabaseAccountIDInsensitively(input string) (*DatabaseAccountId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DatabaseAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - return &id, nil + return nil } // ValidateDatabaseAccountID checks that 'input' can be parsed as a Database Account ID diff --git a/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_databaseaccountname.go b/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_databaseaccountname.go index 1ad2a926aa2..a2757f56303 100644 --- a/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_databaseaccountname.go +++ b/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_databaseaccountname.go @@ -32,11 +32,9 @@ func ParseDatabaseAccountNameID(input string) (*DatabaseAccountNameId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountNameId{} - - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseDatabaseAccountNameIDInsensitively(input string) (*DatabaseAccountName return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountNameId{} - - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *DatabaseAccountNameId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) + } + + return nil +} + // ValidateDatabaseAccountNameID checks that 'input' can be parsed as a Database Account Name ID func ValidateDatabaseAccountNameID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_databasecollection.go b/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_databasecollection.go index ae75117d04e..82742bb4c95 100644 --- a/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_databasecollection.go +++ b/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_databasecollection.go @@ -42,31 +42,9 @@ func ParseDatabaseCollectionID(input string) (*DatabaseCollectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseCollectionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.RegionName, ok = parsed.Parsed["regionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "regionName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) - } - - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseDatabaseCollectionIDInsensitively(input string) (*DatabaseCollectionId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseCollectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DatabaseCollectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.RegionName, ok = parsed.Parsed["regionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "regionName", *parsed) + if id.RegionName, ok = input.Parsed["regionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "regionName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if id.CollectionName, ok = input.Parsed["collectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "collectionName", input) } - return &id, nil + return nil } // ValidateDatabaseCollectionID checks that 'input' can be parsed as a Database Collection ID diff --git a/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_graph.go b/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_graph.go index 990cf689b19..87414bff4e5 100644 --- a/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_graph.go +++ b/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_graph.go @@ -40,27 +40,9 @@ func ParseGraphID(input string) (*GraphId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GraphId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.GremlinDatabaseName, ok = parsed.Parsed["gremlinDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gremlinDatabaseName", *parsed) - } - - if id.GraphName, ok = parsed.Parsed["graphName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "graphName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseGraphIDInsensitively(input string) (*GraphId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GraphId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *GraphId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.GremlinDatabaseName, ok = parsed.Parsed["gremlinDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gremlinDatabaseName", *parsed) + if id.GremlinDatabaseName, ok = input.Parsed["gremlinDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gremlinDatabaseName", input) } - if id.GraphName, ok = parsed.Parsed["graphName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "graphName", *parsed) + if id.GraphName, ok = input.Parsed["graphName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "graphName", input) } - return &id, nil + return nil } // ValidateGraphID checks that 'input' can be parsed as a Graph ID diff --git a/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_gremlindatabase.go b/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_gremlindatabase.go index 20095da53b2..62c750d65ce 100644 --- a/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_gremlindatabase.go +++ b/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_gremlindatabase.go @@ -38,23 +38,9 @@ func ParseGremlinDatabaseID(input string) (*GremlinDatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GremlinDatabaseId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.GremlinDatabaseName, ok = parsed.Parsed["gremlinDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gremlinDatabaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGremlinDatabaseIDInsensitively(input string) (*GremlinDatabaseId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GremlinDatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GremlinDatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.GremlinDatabaseName, ok = parsed.Parsed["gremlinDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gremlinDatabaseName", *parsed) + if id.GremlinDatabaseName, ok = input.Parsed["gremlinDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gremlinDatabaseName", input) } - return &id, nil + return nil } // ValidateGremlinDatabaseID checks that 'input' can be parsed as a Gremlin Database ID diff --git a/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_location.go b/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_location.go index bc6bbfc9d1d..2955e6dd543 100644 --- a/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_location.go +++ b/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_mongodbdatabase.go b/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_mongodbdatabase.go index 245c181e310..f156cc1f463 100644 --- a/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_mongodbdatabase.go +++ b/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_mongodbdatabase.go @@ -38,23 +38,9 @@ func ParseMongodbDatabaseID(input string) (*MongodbDatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MongodbDatabaseId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.MongodbDatabaseName, ok = parsed.Parsed["mongodbDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mongodbDatabaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseMongodbDatabaseIDInsensitively(input string) (*MongodbDatabaseId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MongodbDatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *MongodbDatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.MongodbDatabaseName, ok = parsed.Parsed["mongodbDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mongodbDatabaseName", *parsed) + if id.MongodbDatabaseName, ok = input.Parsed["mongodbDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mongodbDatabaseName", input) } - return &id, nil + return nil } // ValidateMongodbDatabaseID checks that 'input' can be parsed as a Mongodb Database ID diff --git a/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_mongodbdatabasecollection.go b/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_mongodbdatabasecollection.go index fd0ec8e076a..e571a8d6f95 100644 --- a/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_mongodbdatabasecollection.go +++ b/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_mongodbdatabasecollection.go @@ -40,27 +40,9 @@ func ParseMongodbDatabaseCollectionID(input string) (*MongodbDatabaseCollectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MongodbDatabaseCollectionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.MongodbDatabaseName, ok = parsed.Parsed["mongodbDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mongodbDatabaseName", *parsed) - } - - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseMongodbDatabaseCollectionIDInsensitively(input string) (*MongodbDataba return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MongodbDatabaseCollectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *MongodbDatabaseCollectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.MongodbDatabaseName, ok = parsed.Parsed["mongodbDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mongodbDatabaseName", *parsed) + if id.MongodbDatabaseName, ok = input.Parsed["mongodbDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mongodbDatabaseName", input) } - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if id.CollectionName, ok = input.Parsed["collectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "collectionName", input) } - return &id, nil + return nil } // ValidateMongodbDatabaseCollectionID checks that 'input' can be parsed as a Mongodb Database Collection ID diff --git a/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_partitionkeyrangeid.go b/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_partitionkeyrangeid.go index f90c9d9a225..991131e877a 100644 --- a/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_partitionkeyrangeid.go +++ b/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_partitionkeyrangeid.go @@ -42,31 +42,9 @@ func ParsePartitionKeyRangeIdID(input string) (*PartitionKeyRangeIdId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PartitionKeyRangeIdId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) - } - - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) - } - - if id.PartitionKeyRangeId, ok = parsed.Parsed["partitionKeyRangeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "partitionKeyRangeId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParsePartitionKeyRangeIdIDInsensitively(input string) (*PartitionKeyRangeId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PartitionKeyRangeIdId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PartitionKeyRangeIdId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if id.CollectionName, ok = input.Parsed["collectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "collectionName", input) } - if id.PartitionKeyRangeId, ok = parsed.Parsed["partitionKeyRangeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "partitionKeyRangeId", *parsed) + if id.PartitionKeyRangeId, ok = input.Parsed["partitionKeyRangeId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "partitionKeyRangeId", input) } - return &id, nil + return nil } // ValidatePartitionKeyRangeIdID checks that 'input' can be parsed as a Partition Key Range Id ID diff --git a/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_region.go b/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_region.go index cc2b2ed76b1..957458f0e99 100644 --- a/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_region.go +++ b/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_region.go @@ -38,23 +38,9 @@ func ParseRegionID(input string) (*RegionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.RegionName, ok = parsed.Parsed["regionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "regionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRegionIDInsensitively(input string) (*RegionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RegionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.RegionName, ok = parsed.Parsed["regionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "regionName", *parsed) + if id.RegionName, ok = input.Parsed["regionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "regionName", input) } - return &id, nil + return nil } // ValidateRegionID checks that 'input' can be parsed as a Region ID diff --git a/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_sourceregiontargetregion.go b/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_sourceregiontargetregion.go index 6482bb9bd1f..1b21054abf3 100644 --- a/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_sourceregiontargetregion.go +++ b/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_sourceregiontargetregion.go @@ -40,27 +40,9 @@ func ParseSourceRegionTargetRegionID(input string) (*SourceRegionTargetRegionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceRegionTargetRegionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.SourceRegionName, ok = parsed.Parsed["sourceRegionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceRegionName", *parsed) - } - - if id.TargetRegionName, ok = parsed.Parsed["targetRegionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetRegionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSourceRegionTargetRegionIDInsensitively(input string) (*SourceRegionTa return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceRegionTargetRegionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SourceRegionTargetRegionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.SourceRegionName, ok = parsed.Parsed["sourceRegionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceRegionName", *parsed) + if id.SourceRegionName, ok = input.Parsed["sourceRegionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sourceRegionName", input) } - if id.TargetRegionName, ok = parsed.Parsed["targetRegionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetRegionName", *parsed) + if id.TargetRegionName, ok = input.Parsed["targetRegionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "targetRegionName", input) } - return &id, nil + return nil } // ValidateSourceRegionTargetRegionID checks that 'input' can be parsed as a Source Region Target Region ID diff --git a/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_sqldatabase.go b/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_sqldatabase.go index 0efbaa7dbca..c8cd86949a8 100644 --- a/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_sqldatabase.go +++ b/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_sqldatabase.go @@ -38,23 +38,9 @@ func ParseSqlDatabaseID(input string) (*SqlDatabaseId, error) { 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSqlDatabaseIDInsensitively(input string) (*SqlDatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SqlDatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SqlDatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) + if id.SqlDatabaseName, ok = input.Parsed["sqlDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", input) } - return &id, nil + return nil } // ValidateSqlDatabaseID checks that 'input' can be parsed as a Sql Database ID diff --git a/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_storedprocedure.go b/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_storedprocedure.go index fd7480b7609..5468c795b65 100644 --- a/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_storedprocedure.go +++ b/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_storedprocedure.go @@ -42,31 +42,9 @@ func ParseStoredProcedureID(input string) (*StoredProcedureId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StoredProcedureId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) - } - - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) - } - - if id.StoredProcedureName, ok = parsed.Parsed["storedProcedureName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storedProcedureName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseStoredProcedureIDInsensitively(input string) (*StoredProcedureId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StoredProcedureId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *StoredProcedureId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) + if id.SqlDatabaseName, ok = input.Parsed["sqlDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", input) } - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) + if id.ContainerName, ok = input.Parsed["containerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerName", input) } - if id.StoredProcedureName, ok = parsed.Parsed["storedProcedureName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storedProcedureName", *parsed) + if id.StoredProcedureName, ok = input.Parsed["storedProcedureName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storedProcedureName", input) } - return &id, nil + return nil } // ValidateStoredProcedureID checks that 'input' can be parsed as a Stored Procedure ID diff --git a/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_table.go b/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_table.go index f4d64253830..006d2a6171b 100644 --- a/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_table.go +++ b/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_table.go @@ -38,23 +38,9 @@ func ParseTableID(input string) (*TableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TableId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTableIDInsensitively(input string) (*TableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TableId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if id.TableName, ok = input.Parsed["tableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tableName", input) } - return &id, nil + return nil } // ValidateTableID checks that 'input' can be parsed as a Table ID diff --git a/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_targetregion.go b/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_targetregion.go index 1604e4b598b..bbf4612af00 100644 --- a/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_targetregion.go +++ b/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_targetregion.go @@ -38,23 +38,9 @@ func ParseTargetRegionID(input string) (*TargetRegionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TargetRegionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.TargetRegionName, ok = parsed.Parsed["targetRegionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetRegionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTargetRegionIDInsensitively(input string) (*TargetRegionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TargetRegionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TargetRegionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.TargetRegionName, ok = parsed.Parsed["targetRegionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetRegionName", *parsed) + if id.TargetRegionName, ok = input.Parsed["targetRegionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "targetRegionName", input) } - return &id, nil + return nil } // ValidateTargetRegionID checks that 'input' can be parsed as a Target Region ID diff --git a/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_trigger.go b/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_trigger.go index 7c06746b92c..864ee0c2a38 100644 --- a/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_trigger.go +++ b/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_trigger.go @@ -42,31 +42,9 @@ func ParseTriggerID(input string) (*TriggerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TriggerId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) - } - - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) - } - - if id.TriggerName, ok = parsed.Parsed["triggerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseTriggerIDInsensitively(input string) (*TriggerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TriggerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *TriggerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) + if id.SqlDatabaseName, ok = input.Parsed["sqlDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", input) } - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) + if id.ContainerName, ok = input.Parsed["containerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerName", input) } - if id.TriggerName, ok = parsed.Parsed["triggerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggerName", *parsed) + if id.TriggerName, ok = input.Parsed["triggerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "triggerName", input) } - return &id, nil + return nil } // ValidateTriggerID checks that 'input' can be parsed as a Trigger ID diff --git a/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_userdefinedfunction.go b/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_userdefinedfunction.go index 54f09bc5f2d..90e49c6f84e 100644 --- a/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_userdefinedfunction.go +++ b/resource-manager/cosmosdb/2023-04-15/cosmosdb/id_userdefinedfunction.go @@ -42,31 +42,9 @@ func ParseUserDefinedFunctionID(input string) (*UserDefinedFunctionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserDefinedFunctionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) - } - - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) - } - - if id.UserDefinedFunctionName, ok = parsed.Parsed["userDefinedFunctionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userDefinedFunctionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseUserDefinedFunctionIDInsensitively(input string) (*UserDefinedFunction return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserDefinedFunctionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *UserDefinedFunctionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) + if id.SqlDatabaseName, ok = input.Parsed["sqlDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", input) } - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) + if id.ContainerName, ok = input.Parsed["containerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerName", input) } - if id.UserDefinedFunctionName, ok = parsed.Parsed["userDefinedFunctionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userDefinedFunctionName", *parsed) + if id.UserDefinedFunctionName, ok = input.Parsed["userDefinedFunctionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userDefinedFunctionName", input) } - return &id, nil + return nil } // ValidateUserDefinedFunctionID checks that 'input' can be parsed as a User Defined Function ID diff --git a/resource-manager/cosmosdb/2023-04-15/datatransfer/id_service.go b/resource-manager/cosmosdb/2023-04-15/datatransfer/id_service.go index c2fba9c3c5d..5f0f6c16dc6 100644 --- a/resource-manager/cosmosdb/2023-04-15/datatransfer/id_service.go +++ b/resource-manager/cosmosdb/2023-04-15/datatransfer/id_service.go @@ -38,23 +38,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ServiceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/cosmosdb/2023-04-15/graphapicompute/id_service.go b/resource-manager/cosmosdb/2023-04-15/graphapicompute/id_service.go index 92c693864c7..41bd08f7b1c 100644 --- a/resource-manager/cosmosdb/2023-04-15/graphapicompute/id_service.go +++ b/resource-manager/cosmosdb/2023-04-15/graphapicompute/id_service.go @@ -38,23 +38,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ServiceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/cosmosdb/2023-04-15/managedcassandras/id_cassandracluster.go b/resource-manager/cosmosdb/2023-04-15/managedcassandras/id_cassandracluster.go index 55c61f4a864..70b8aac3664 100644 --- a/resource-manager/cosmosdb/2023-04-15/managedcassandras/id_cassandracluster.go +++ b/resource-manager/cosmosdb/2023-04-15/managedcassandras/id_cassandracluster.go @@ -36,19 +36,9 @@ func ParseCassandraClusterID(input string) (*CassandraClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CassandraClusterId{} - - 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.CassandraClusterName, ok = parsed.Parsed["cassandraClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cassandraClusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseCassandraClusterIDInsensitively(input string) (*CassandraClusterId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CassandraClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CassandraClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CassandraClusterName, ok = parsed.Parsed["cassandraClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cassandraClusterName", *parsed) + if id.CassandraClusterName, ok = input.Parsed["cassandraClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cassandraClusterName", input) } - return &id, nil + return nil } // ValidateCassandraClusterID checks that 'input' can be parsed as a Cassandra Cluster ID diff --git a/resource-manager/cosmosdb/2023-04-15/managedcassandras/id_datacenter.go b/resource-manager/cosmosdb/2023-04-15/managedcassandras/id_datacenter.go index 8d8d8835013..0c8dfad5704 100644 --- a/resource-manager/cosmosdb/2023-04-15/managedcassandras/id_datacenter.go +++ b/resource-manager/cosmosdb/2023-04-15/managedcassandras/id_datacenter.go @@ -38,23 +38,9 @@ func ParseDataCenterID(input string) (*DataCenterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataCenterId{} - - 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.CassandraClusterName, ok = parsed.Parsed["cassandraClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cassandraClusterName", *parsed) - } - - if id.DataCenterName, ok = parsed.Parsed["dataCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataCenterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDataCenterIDInsensitively(input string) (*DataCenterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataCenterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DataCenterId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CassandraClusterName, ok = parsed.Parsed["cassandraClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cassandraClusterName", *parsed) + if id.CassandraClusterName, ok = input.Parsed["cassandraClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cassandraClusterName", input) } - if id.DataCenterName, ok = parsed.Parsed["dataCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataCenterName", *parsed) + if id.DataCenterName, ok = input.Parsed["dataCenterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataCenterName", input) } - return &id, nil + return nil } // ValidateDataCenterID checks that 'input' can be parsed as a Data Center ID diff --git a/resource-manager/cosmosdb/2023-04-15/materializedviewsbuilder/id_service.go b/resource-manager/cosmosdb/2023-04-15/materializedviewsbuilder/id_service.go index a3c6ba915ec..4f5a2a474a6 100644 --- a/resource-manager/cosmosdb/2023-04-15/materializedviewsbuilder/id_service.go +++ b/resource-manager/cosmosdb/2023-04-15/materializedviewsbuilder/id_service.go @@ -38,23 +38,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ServiceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/cosmosdb/2023-04-15/mongorbacs/id_databaseaccount.go b/resource-manager/cosmosdb/2023-04-15/mongorbacs/id_databaseaccount.go index 9edb9717313..20b3172f6a2 100644 --- a/resource-manager/cosmosdb/2023-04-15/mongorbacs/id_databaseaccount.go +++ b/resource-manager/cosmosdb/2023-04-15/mongorbacs/id_databaseaccount.go @@ -36,19 +36,9 @@ func ParseDatabaseAccountID(input string) (*DatabaseAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDatabaseAccountIDInsensitively(input string) (*DatabaseAccountId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DatabaseAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - return &id, nil + return nil } // ValidateDatabaseAccountID checks that 'input' can be parsed as a Database Account ID diff --git a/resource-manager/cosmosdb/2023-04-15/mongorbacs/id_mongodbroledefinition.go b/resource-manager/cosmosdb/2023-04-15/mongorbacs/id_mongodbroledefinition.go index a5dad9eda74..737a561ca8a 100644 --- a/resource-manager/cosmosdb/2023-04-15/mongorbacs/id_mongodbroledefinition.go +++ b/resource-manager/cosmosdb/2023-04-15/mongorbacs/id_mongodbroledefinition.go @@ -38,23 +38,9 @@ func ParseMongodbRoleDefinitionID(input string) (*MongodbRoleDefinitionId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MongodbRoleDefinitionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.MongoRoleDefinitionId, ok = parsed.Parsed["mongoRoleDefinitionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mongoRoleDefinitionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseMongodbRoleDefinitionIDInsensitively(input string) (*MongodbRoleDefini return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MongodbRoleDefinitionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *MongodbRoleDefinitionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.MongoRoleDefinitionId, ok = parsed.Parsed["mongoRoleDefinitionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mongoRoleDefinitionId", *parsed) + if id.MongoRoleDefinitionId, ok = input.Parsed["mongoRoleDefinitionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mongoRoleDefinitionId", input) } - return &id, nil + return nil } // ValidateMongodbRoleDefinitionID checks that 'input' can be parsed as a Mongodb Role Definition ID diff --git a/resource-manager/cosmosdb/2023-04-15/mongorbacs/id_mongodbuserdefinition.go b/resource-manager/cosmosdb/2023-04-15/mongorbacs/id_mongodbuserdefinition.go index 5e5016590a7..f720d6bbf30 100644 --- a/resource-manager/cosmosdb/2023-04-15/mongorbacs/id_mongodbuserdefinition.go +++ b/resource-manager/cosmosdb/2023-04-15/mongorbacs/id_mongodbuserdefinition.go @@ -38,23 +38,9 @@ func ParseMongodbUserDefinitionID(input string) (*MongodbUserDefinitionId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MongodbUserDefinitionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.MongoUserDefinitionId, ok = parsed.Parsed["mongoUserDefinitionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mongoUserDefinitionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseMongodbUserDefinitionIDInsensitively(input string) (*MongodbUserDefini return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MongodbUserDefinitionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *MongodbUserDefinitionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.MongoUserDefinitionId, ok = parsed.Parsed["mongoUserDefinitionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mongoUserDefinitionId", *parsed) + if id.MongoUserDefinitionId, ok = input.Parsed["mongoUserDefinitionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mongoUserDefinitionId", input) } - return &id, nil + return nil } // ValidateMongodbUserDefinitionID checks that 'input' can be parsed as a Mongodb User Definition ID diff --git a/resource-manager/cosmosdb/2023-04-15/notebookworkspacesresource/id_databaseaccount.go b/resource-manager/cosmosdb/2023-04-15/notebookworkspacesresource/id_databaseaccount.go index 6163d3bbe76..ce05f7ad501 100644 --- a/resource-manager/cosmosdb/2023-04-15/notebookworkspacesresource/id_databaseaccount.go +++ b/resource-manager/cosmosdb/2023-04-15/notebookworkspacesresource/id_databaseaccount.go @@ -36,19 +36,9 @@ func ParseDatabaseAccountID(input string) (*DatabaseAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDatabaseAccountIDInsensitively(input string) (*DatabaseAccountId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DatabaseAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - return &id, nil + return nil } // ValidateDatabaseAccountID checks that 'input' can be parsed as a Database Account ID diff --git a/resource-manager/cosmosdb/2023-04-15/privateendpointconnections/id_databaseaccount.go b/resource-manager/cosmosdb/2023-04-15/privateendpointconnections/id_databaseaccount.go index 1d3deea521d..819433a83df 100644 --- a/resource-manager/cosmosdb/2023-04-15/privateendpointconnections/id_databaseaccount.go +++ b/resource-manager/cosmosdb/2023-04-15/privateendpointconnections/id_databaseaccount.go @@ -36,19 +36,9 @@ func ParseDatabaseAccountID(input string) (*DatabaseAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDatabaseAccountIDInsensitively(input string) (*DatabaseAccountId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DatabaseAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - return &id, nil + return nil } // ValidateDatabaseAccountID checks that 'input' can be parsed as a Database Account ID diff --git a/resource-manager/cosmosdb/2023-04-15/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/cosmosdb/2023-04-15/privateendpointconnections/id_privateendpointconnection.go index 25382589736..13a94a5226b 100644 --- a/resource-manager/cosmosdb/2023-04-15/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/cosmosdb/2023-04-15/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/cosmosdb/2023-04-15/privatelinkresources/id_databaseaccount.go b/resource-manager/cosmosdb/2023-04-15/privatelinkresources/id_databaseaccount.go index 860bfb590a3..eedea1fcc5c 100644 --- a/resource-manager/cosmosdb/2023-04-15/privatelinkresources/id_databaseaccount.go +++ b/resource-manager/cosmosdb/2023-04-15/privatelinkresources/id_databaseaccount.go @@ -36,19 +36,9 @@ func ParseDatabaseAccountID(input string) (*DatabaseAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDatabaseAccountIDInsensitively(input string) (*DatabaseAccountId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DatabaseAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - return &id, nil + return nil } // ValidateDatabaseAccountID checks that 'input' can be parsed as a Database Account ID diff --git a/resource-manager/cosmosdb/2023-04-15/privatelinkresources/id_privatelinkresource.go b/resource-manager/cosmosdb/2023-04-15/privatelinkresources/id_privatelinkresource.go index 46003ca6e7b..e9f0c7e799e 100644 --- a/resource-manager/cosmosdb/2023-04-15/privatelinkresources/id_privatelinkresource.go +++ b/resource-manager/cosmosdb/2023-04-15/privatelinkresources/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/cosmosdb/2023-04-15/rbacs/id_account.go b/resource-manager/cosmosdb/2023-04-15/rbacs/id_account.go index d548f6b1a64..b9caf8a4482 100644 --- a/resource-manager/cosmosdb/2023-04-15/rbacs/id_account.go +++ b/resource-manager/cosmosdb/2023-04-15/rbacs/id_account.go @@ -38,23 +38,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.RoleAssignmentId, ok = parsed.Parsed["roleAssignmentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleAssignmentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.RoleAssignmentId, ok = parsed.Parsed["roleAssignmentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleAssignmentId", *parsed) + if id.RoleAssignmentId, ok = input.Parsed["roleAssignmentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "roleAssignmentId", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/cosmosdb/2023-04-15/rbacs/id_databaseaccount.go b/resource-manager/cosmosdb/2023-04-15/rbacs/id_databaseaccount.go index 878ca7762f4..856f00f92c8 100644 --- a/resource-manager/cosmosdb/2023-04-15/rbacs/id_databaseaccount.go +++ b/resource-manager/cosmosdb/2023-04-15/rbacs/id_databaseaccount.go @@ -36,19 +36,9 @@ func ParseDatabaseAccountID(input string) (*DatabaseAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDatabaseAccountIDInsensitively(input string) (*DatabaseAccountId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DatabaseAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - return &id, nil + return nil } // ValidateDatabaseAccountID checks that 'input' can be parsed as a Database Account ID diff --git a/resource-manager/cosmosdb/2023-04-15/rbacs/id_sqlroledefinition.go b/resource-manager/cosmosdb/2023-04-15/rbacs/id_sqlroledefinition.go index 292dcd692e5..522ce0762cf 100644 --- a/resource-manager/cosmosdb/2023-04-15/rbacs/id_sqlroledefinition.go +++ b/resource-manager/cosmosdb/2023-04-15/rbacs/id_sqlroledefinition.go @@ -38,23 +38,9 @@ func ParseSqlRoleDefinitionID(input string) (*SqlRoleDefinitionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SqlRoleDefinitionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.RoleDefinitionId, ok = parsed.Parsed["roleDefinitionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleDefinitionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSqlRoleDefinitionIDInsensitively(input string) (*SqlRoleDefinitionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SqlRoleDefinitionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SqlRoleDefinitionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.RoleDefinitionId, ok = parsed.Parsed["roleDefinitionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleDefinitionId", *parsed) + if id.RoleDefinitionId, ok = input.Parsed["roleDefinitionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "roleDefinitionId", input) } - return &id, nil + return nil } // ValidateSqlRoleDefinitionID checks that 'input' can be parsed as a Sql Role Definition ID diff --git a/resource-manager/cosmosdb/2023-04-15/restorables/id_container.go b/resource-manager/cosmosdb/2023-04-15/restorables/id_container.go index abf3171b109..c2b2177ed71 100644 --- a/resource-manager/cosmosdb/2023-04-15/restorables/id_container.go +++ b/resource-manager/cosmosdb/2023-04-15/restorables/id_container.go @@ -40,27 +40,9 @@ func ParseContainerID(input string) (*ContainerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) - } - - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseContainerIDInsensitively(input string) (*ContainerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ContainerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) + if id.SqlDatabaseName, ok = input.Parsed["sqlDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", input) } - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) + if id.ContainerName, ok = input.Parsed["containerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerName", input) } - return &id, nil + return nil } // ValidateContainerID checks that 'input' can be parsed as a Container ID diff --git a/resource-manager/cosmosdb/2023-04-15/restorables/id_graph.go b/resource-manager/cosmosdb/2023-04-15/restorables/id_graph.go index ab652bd3a81..17e4e7dcc5d 100644 --- a/resource-manager/cosmosdb/2023-04-15/restorables/id_graph.go +++ b/resource-manager/cosmosdb/2023-04-15/restorables/id_graph.go @@ -40,27 +40,9 @@ func ParseGraphID(input string) (*GraphId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GraphId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.GremlinDatabaseName, ok = parsed.Parsed["gremlinDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gremlinDatabaseName", *parsed) - } - - if id.GraphName, ok = parsed.Parsed["graphName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "graphName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseGraphIDInsensitively(input string) (*GraphId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GraphId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *GraphId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.GremlinDatabaseName, ok = parsed.Parsed["gremlinDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gremlinDatabaseName", *parsed) + if id.GremlinDatabaseName, ok = input.Parsed["gremlinDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gremlinDatabaseName", input) } - if id.GraphName, ok = parsed.Parsed["graphName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "graphName", *parsed) + if id.GraphName, ok = input.Parsed["graphName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "graphName", input) } - return &id, nil + return nil } // ValidateGraphID checks that 'input' can be parsed as a Graph ID diff --git a/resource-manager/cosmosdb/2023-04-15/restorables/id_location.go b/resource-manager/cosmosdb/2023-04-15/restorables/id_location.go index 0eb834cf4e6..35f17158125 100644 --- a/resource-manager/cosmosdb/2023-04-15/restorables/id_location.go +++ b/resource-manager/cosmosdb/2023-04-15/restorables/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/cosmosdb/2023-04-15/restorables/id_mongodbdatabasecollection.go b/resource-manager/cosmosdb/2023-04-15/restorables/id_mongodbdatabasecollection.go index 2d1dee24a26..576dcaff5d8 100644 --- a/resource-manager/cosmosdb/2023-04-15/restorables/id_mongodbdatabasecollection.go +++ b/resource-manager/cosmosdb/2023-04-15/restorables/id_mongodbdatabasecollection.go @@ -40,27 +40,9 @@ func ParseMongodbDatabaseCollectionID(input string) (*MongodbDatabaseCollectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MongodbDatabaseCollectionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.MongodbDatabaseName, ok = parsed.Parsed["mongodbDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mongodbDatabaseName", *parsed) - } - - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseMongodbDatabaseCollectionIDInsensitively(input string) (*MongodbDataba return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MongodbDatabaseCollectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *MongodbDatabaseCollectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.MongodbDatabaseName, ok = parsed.Parsed["mongodbDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mongodbDatabaseName", *parsed) + if id.MongodbDatabaseName, ok = input.Parsed["mongodbDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mongodbDatabaseName", input) } - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if id.CollectionName, ok = input.Parsed["collectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "collectionName", input) } - return &id, nil + return nil } // ValidateMongodbDatabaseCollectionID checks that 'input' can be parsed as a Mongodb Database Collection ID diff --git a/resource-manager/cosmosdb/2023-04-15/restorables/id_restorabledatabaseaccount.go b/resource-manager/cosmosdb/2023-04-15/restorables/id_restorabledatabaseaccount.go index f2c929a0130..25ee3deecab 100644 --- a/resource-manager/cosmosdb/2023-04-15/restorables/id_restorabledatabaseaccount.go +++ b/resource-manager/cosmosdb/2023-04-15/restorables/id_restorabledatabaseaccount.go @@ -36,19 +36,9 @@ func ParseRestorableDatabaseAccountID(input string) (*RestorableDatabaseAccountI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RestorableDatabaseAccountId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRestorableDatabaseAccountIDInsensitively(input string) (*RestorableDat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RestorableDatabaseAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RestorableDatabaseAccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if id.InstanceId, ok = input.Parsed["instanceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceId", input) } - return &id, nil + return nil } // ValidateRestorableDatabaseAccountID checks that 'input' can be parsed as a Restorable Database Account ID diff --git a/resource-manager/cosmosdb/2023-04-15/restorables/id_table.go b/resource-manager/cosmosdb/2023-04-15/restorables/id_table.go index a2dd478f80b..e7ebd22e638 100644 --- a/resource-manager/cosmosdb/2023-04-15/restorables/id_table.go +++ b/resource-manager/cosmosdb/2023-04-15/restorables/id_table.go @@ -38,23 +38,9 @@ func ParseTableID(input string) (*TableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TableId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTableIDInsensitively(input string) (*TableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TableId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if id.TableName, ok = input.Parsed["tableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tableName", input) } - return &id, nil + return nil } // ValidateTableID checks that 'input' can be parsed as a Table ID diff --git a/resource-manager/cosmosdb/2023-04-15/services/id_databaseaccount.go b/resource-manager/cosmosdb/2023-04-15/services/id_databaseaccount.go index fde95de221b..4a229a3b3b9 100644 --- a/resource-manager/cosmosdb/2023-04-15/services/id_databaseaccount.go +++ b/resource-manager/cosmosdb/2023-04-15/services/id_databaseaccount.go @@ -36,19 +36,9 @@ func ParseDatabaseAccountID(input string) (*DatabaseAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDatabaseAccountIDInsensitively(input string) (*DatabaseAccountId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DatabaseAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - return &id, nil + return nil } // ValidateDatabaseAccountID checks that 'input' can be parsed as a Database Account ID diff --git a/resource-manager/cosmosdb/2023-04-15/sqldedicatedgateway/id_service.go b/resource-manager/cosmosdb/2023-04-15/sqldedicatedgateway/id_service.go index 1a0173f1bdd..2ecf0e8462e 100644 --- a/resource-manager/cosmosdb/2023-04-15/sqldedicatedgateway/id_service.go +++ b/resource-manager/cosmosdb/2023-04-15/sqldedicatedgateway/id_service.go @@ -38,23 +38,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ServiceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_cassandrakeyspace.go b/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_cassandrakeyspace.go index 9555cbf46b1..c0948748c2d 100644 --- a/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_cassandrakeyspace.go +++ b/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_cassandrakeyspace.go @@ -38,23 +38,9 @@ func ParseCassandraKeyspaceID(input string) (*CassandraKeyspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CassandraKeyspaceId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.CassandraKeyspaceName, ok = parsed.Parsed["cassandraKeyspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cassandraKeyspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCassandraKeyspaceIDInsensitively(input string) (*CassandraKeyspaceId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CassandraKeyspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CassandraKeyspaceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.CassandraKeyspaceName, ok = parsed.Parsed["cassandraKeyspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cassandraKeyspaceName", *parsed) + if id.CassandraKeyspaceName, ok = input.Parsed["cassandraKeyspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cassandraKeyspaceName", input) } - return &id, nil + return nil } // ValidateCassandraKeyspaceID checks that 'input' can be parsed as a Cassandra Keyspace ID diff --git a/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_cassandrakeyspacetable.go b/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_cassandrakeyspacetable.go index 66b3ea506a4..0e9b31b7d48 100644 --- a/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_cassandrakeyspacetable.go +++ b/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_cassandrakeyspacetable.go @@ -40,27 +40,9 @@ func ParseCassandraKeyspaceTableID(input string) (*CassandraKeyspaceTableId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CassandraKeyspaceTableId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.CassandraKeyspaceName, ok = parsed.Parsed["cassandraKeyspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cassandraKeyspaceName", *parsed) - } - - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseCassandraKeyspaceTableIDInsensitively(input string) (*CassandraKeyspac return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CassandraKeyspaceTableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *CassandraKeyspaceTableId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.CassandraKeyspaceName, ok = parsed.Parsed["cassandraKeyspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cassandraKeyspaceName", *parsed) + if id.CassandraKeyspaceName, ok = input.Parsed["cassandraKeyspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cassandraKeyspaceName", input) } - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if id.TableName, ok = input.Parsed["tableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tableName", input) } - return &id, nil + return nil } // ValidateCassandraKeyspaceTableID checks that 'input' can be parsed as a Cassandra Keyspace Table ID diff --git a/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_clientencryptionkey.go b/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_clientencryptionkey.go index 8fcb741d96a..70599e3ea3d 100644 --- a/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_clientencryptionkey.go +++ b/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_clientencryptionkey.go @@ -40,27 +40,9 @@ func ParseClientEncryptionKeyID(input string) (*ClientEncryptionKeyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClientEncryptionKeyId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) - } - - if id.ClientEncryptionKeyName, ok = parsed.Parsed["clientEncryptionKeyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clientEncryptionKeyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseClientEncryptionKeyIDInsensitively(input string) (*ClientEncryptionKey return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClientEncryptionKeyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ClientEncryptionKeyId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) + if id.SqlDatabaseName, ok = input.Parsed["sqlDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", input) } - if id.ClientEncryptionKeyName, ok = parsed.Parsed["clientEncryptionKeyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clientEncryptionKeyName", *parsed) + if id.ClientEncryptionKeyName, ok = input.Parsed["clientEncryptionKeyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clientEncryptionKeyName", input) } - return &id, nil + return nil } // ValidateClientEncryptionKeyID checks that 'input' can be parsed as a Client Encryption Key ID diff --git a/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_collection.go b/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_collection.go index a7e01b98015..06ba5f2c382 100644 --- a/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_collection.go +++ b/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_collection.go @@ -40,27 +40,9 @@ func ParseCollectionID(input string) (*CollectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CollectionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) - } - - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseCollectionIDInsensitively(input string) (*CollectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CollectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *CollectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if id.CollectionName, ok = input.Parsed["collectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "collectionName", input) } - return &id, nil + return nil } // ValidateCollectionID checks that 'input' can be parsed as a Collection ID diff --git a/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_collectionpartitionkeyrangeid.go b/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_collectionpartitionkeyrangeid.go index 5819216ab8d..af2697450ff 100644 --- a/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_collectionpartitionkeyrangeid.go +++ b/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_collectionpartitionkeyrangeid.go @@ -44,35 +44,9 @@ func ParseCollectionPartitionKeyRangeIdID(input string) (*CollectionPartitionKey return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CollectionPartitionKeyRangeIdId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.RegionName, ok = parsed.Parsed["regionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "regionName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) - } - - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) - } - - if id.PartitionKeyRangeId, ok = parsed.Parsed["partitionKeyRangeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "partitionKeyRangeId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseCollectionPartitionKeyRangeIdIDInsensitively(input string) (*Collectio return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CollectionPartitionKeyRangeIdId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *CollectionPartitionKeyRangeIdId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.RegionName, ok = parsed.Parsed["regionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "regionName", *parsed) + if id.RegionName, ok = input.Parsed["regionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "regionName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if id.CollectionName, ok = input.Parsed["collectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "collectionName", input) } - if id.PartitionKeyRangeId, ok = parsed.Parsed["partitionKeyRangeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "partitionKeyRangeId", *parsed) + if id.PartitionKeyRangeId, ok = input.Parsed["partitionKeyRangeId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "partitionKeyRangeId", input) } - return &id, nil + return nil } // ValidateCollectionPartitionKeyRangeIdID checks that 'input' can be parsed as a Collection Partition Key Range Id ID diff --git a/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_container.go b/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_container.go index 7a27bedb708..325844c7b0f 100644 --- a/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_container.go +++ b/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_container.go @@ -40,27 +40,9 @@ func ParseContainerID(input string) (*ContainerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) - } - - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseContainerIDInsensitively(input string) (*ContainerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ContainerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) + if id.SqlDatabaseName, ok = input.Parsed["sqlDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", input) } - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) + if id.ContainerName, ok = input.Parsed["containerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerName", input) } - return &id, nil + return nil } // ValidateContainerID checks that 'input' can be parsed as a Container ID diff --git a/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_database.go b/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_database.go index 06541d6f6c6..c52995f2bc9 100644 --- a/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_database.go +++ b/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_database.go @@ -38,23 +38,9 @@ func ParseDatabaseID(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDatabaseIDInsensitively(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - return &id, nil + return nil } // ValidateDatabaseID checks that 'input' can be parsed as a Database ID diff --git a/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_databaseaccount.go b/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_databaseaccount.go index 0e56a8d66f5..425f2c9b5ae 100644 --- a/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_databaseaccount.go +++ b/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_databaseaccount.go @@ -36,19 +36,9 @@ func ParseDatabaseAccountID(input string) (*DatabaseAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDatabaseAccountIDInsensitively(input string) (*DatabaseAccountId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DatabaseAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - return &id, nil + return nil } // ValidateDatabaseAccountID checks that 'input' can be parsed as a Database Account ID diff --git a/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_databaseaccountname.go b/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_databaseaccountname.go index 1ad2a926aa2..a2757f56303 100644 --- a/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_databaseaccountname.go +++ b/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_databaseaccountname.go @@ -32,11 +32,9 @@ func ParseDatabaseAccountNameID(input string) (*DatabaseAccountNameId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountNameId{} - - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseDatabaseAccountNameIDInsensitively(input string) (*DatabaseAccountName return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountNameId{} - - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *DatabaseAccountNameId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) + } + + return nil +} + // ValidateDatabaseAccountNameID checks that 'input' can be parsed as a Database Account Name ID func ValidateDatabaseAccountNameID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_databasecollection.go b/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_databasecollection.go index ae75117d04e..82742bb4c95 100644 --- a/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_databasecollection.go +++ b/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_databasecollection.go @@ -42,31 +42,9 @@ func ParseDatabaseCollectionID(input string) (*DatabaseCollectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseCollectionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.RegionName, ok = parsed.Parsed["regionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "regionName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) - } - - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseDatabaseCollectionIDInsensitively(input string) (*DatabaseCollectionId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseCollectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DatabaseCollectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.RegionName, ok = parsed.Parsed["regionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "regionName", *parsed) + if id.RegionName, ok = input.Parsed["regionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "regionName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if id.CollectionName, ok = input.Parsed["collectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "collectionName", input) } - return &id, nil + return nil } // ValidateDatabaseCollectionID checks that 'input' can be parsed as a Database Collection ID diff --git a/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_graph.go b/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_graph.go index 990cf689b19..87414bff4e5 100644 --- a/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_graph.go +++ b/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_graph.go @@ -40,27 +40,9 @@ func ParseGraphID(input string) (*GraphId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GraphId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.GremlinDatabaseName, ok = parsed.Parsed["gremlinDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gremlinDatabaseName", *parsed) - } - - if id.GraphName, ok = parsed.Parsed["graphName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "graphName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseGraphIDInsensitively(input string) (*GraphId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GraphId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *GraphId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.GremlinDatabaseName, ok = parsed.Parsed["gremlinDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gremlinDatabaseName", *parsed) + if id.GremlinDatabaseName, ok = input.Parsed["gremlinDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gremlinDatabaseName", input) } - if id.GraphName, ok = parsed.Parsed["graphName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "graphName", *parsed) + if id.GraphName, ok = input.Parsed["graphName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "graphName", input) } - return &id, nil + return nil } // ValidateGraphID checks that 'input' can be parsed as a Graph ID diff --git a/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_gremlindatabase.go b/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_gremlindatabase.go index 20095da53b2..62c750d65ce 100644 --- a/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_gremlindatabase.go +++ b/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_gremlindatabase.go @@ -38,23 +38,9 @@ func ParseGremlinDatabaseID(input string) (*GremlinDatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GremlinDatabaseId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.GremlinDatabaseName, ok = parsed.Parsed["gremlinDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gremlinDatabaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGremlinDatabaseIDInsensitively(input string) (*GremlinDatabaseId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GremlinDatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GremlinDatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.GremlinDatabaseName, ok = parsed.Parsed["gremlinDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gremlinDatabaseName", *parsed) + if id.GremlinDatabaseName, ok = input.Parsed["gremlinDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gremlinDatabaseName", input) } - return &id, nil + return nil } // ValidateGremlinDatabaseID checks that 'input' can be parsed as a Gremlin Database ID diff --git a/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_location.go b/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_location.go index bc6bbfc9d1d..2955e6dd543 100644 --- a/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_location.go +++ b/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_mongodbdatabase.go b/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_mongodbdatabase.go index 245c181e310..f156cc1f463 100644 --- a/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_mongodbdatabase.go +++ b/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_mongodbdatabase.go @@ -38,23 +38,9 @@ func ParseMongodbDatabaseID(input string) (*MongodbDatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MongodbDatabaseId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.MongodbDatabaseName, ok = parsed.Parsed["mongodbDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mongodbDatabaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseMongodbDatabaseIDInsensitively(input string) (*MongodbDatabaseId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MongodbDatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *MongodbDatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.MongodbDatabaseName, ok = parsed.Parsed["mongodbDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mongodbDatabaseName", *parsed) + if id.MongodbDatabaseName, ok = input.Parsed["mongodbDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mongodbDatabaseName", input) } - return &id, nil + return nil } // ValidateMongodbDatabaseID checks that 'input' can be parsed as a Mongodb Database ID diff --git a/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_mongodbdatabasecollection.go b/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_mongodbdatabasecollection.go index fd0ec8e076a..e571a8d6f95 100644 --- a/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_mongodbdatabasecollection.go +++ b/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_mongodbdatabasecollection.go @@ -40,27 +40,9 @@ func ParseMongodbDatabaseCollectionID(input string) (*MongodbDatabaseCollectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MongodbDatabaseCollectionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.MongodbDatabaseName, ok = parsed.Parsed["mongodbDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mongodbDatabaseName", *parsed) - } - - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseMongodbDatabaseCollectionIDInsensitively(input string) (*MongodbDataba return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MongodbDatabaseCollectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *MongodbDatabaseCollectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.MongodbDatabaseName, ok = parsed.Parsed["mongodbDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mongodbDatabaseName", *parsed) + if id.MongodbDatabaseName, ok = input.Parsed["mongodbDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mongodbDatabaseName", input) } - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if id.CollectionName, ok = input.Parsed["collectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "collectionName", input) } - return &id, nil + return nil } // ValidateMongodbDatabaseCollectionID checks that 'input' can be parsed as a Mongodb Database Collection ID diff --git a/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_partitionkeyrangeid.go b/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_partitionkeyrangeid.go index f90c9d9a225..991131e877a 100644 --- a/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_partitionkeyrangeid.go +++ b/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_partitionkeyrangeid.go @@ -42,31 +42,9 @@ func ParsePartitionKeyRangeIdID(input string) (*PartitionKeyRangeIdId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PartitionKeyRangeIdId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) - } - - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) - } - - if id.PartitionKeyRangeId, ok = parsed.Parsed["partitionKeyRangeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "partitionKeyRangeId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParsePartitionKeyRangeIdIDInsensitively(input string) (*PartitionKeyRangeId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PartitionKeyRangeIdId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PartitionKeyRangeIdId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if id.CollectionName, ok = input.Parsed["collectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "collectionName", input) } - if id.PartitionKeyRangeId, ok = parsed.Parsed["partitionKeyRangeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "partitionKeyRangeId", *parsed) + if id.PartitionKeyRangeId, ok = input.Parsed["partitionKeyRangeId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "partitionKeyRangeId", input) } - return &id, nil + return nil } // ValidatePartitionKeyRangeIdID checks that 'input' can be parsed as a Partition Key Range Id ID diff --git a/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_region.go b/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_region.go index cc2b2ed76b1..957458f0e99 100644 --- a/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_region.go +++ b/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_region.go @@ -38,23 +38,9 @@ func ParseRegionID(input string) (*RegionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.RegionName, ok = parsed.Parsed["regionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "regionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRegionIDInsensitively(input string) (*RegionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RegionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.RegionName, ok = parsed.Parsed["regionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "regionName", *parsed) + if id.RegionName, ok = input.Parsed["regionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "regionName", input) } - return &id, nil + return nil } // ValidateRegionID checks that 'input' can be parsed as a Region ID diff --git a/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_sourceregiontargetregion.go b/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_sourceregiontargetregion.go index 6482bb9bd1f..1b21054abf3 100644 --- a/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_sourceregiontargetregion.go +++ b/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_sourceregiontargetregion.go @@ -40,27 +40,9 @@ func ParseSourceRegionTargetRegionID(input string) (*SourceRegionTargetRegionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceRegionTargetRegionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.SourceRegionName, ok = parsed.Parsed["sourceRegionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceRegionName", *parsed) - } - - if id.TargetRegionName, ok = parsed.Parsed["targetRegionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetRegionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSourceRegionTargetRegionIDInsensitively(input string) (*SourceRegionTa return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceRegionTargetRegionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SourceRegionTargetRegionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.SourceRegionName, ok = parsed.Parsed["sourceRegionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceRegionName", *parsed) + if id.SourceRegionName, ok = input.Parsed["sourceRegionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sourceRegionName", input) } - if id.TargetRegionName, ok = parsed.Parsed["targetRegionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetRegionName", *parsed) + if id.TargetRegionName, ok = input.Parsed["targetRegionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "targetRegionName", input) } - return &id, nil + return nil } // ValidateSourceRegionTargetRegionID checks that 'input' can be parsed as a Source Region Target Region ID diff --git a/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_sqldatabase.go b/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_sqldatabase.go index 0efbaa7dbca..c8cd86949a8 100644 --- a/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_sqldatabase.go +++ b/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_sqldatabase.go @@ -38,23 +38,9 @@ func ParseSqlDatabaseID(input string) (*SqlDatabaseId, error) { 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSqlDatabaseIDInsensitively(input string) (*SqlDatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SqlDatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SqlDatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) + if id.SqlDatabaseName, ok = input.Parsed["sqlDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", input) } - return &id, nil + return nil } // ValidateSqlDatabaseID checks that 'input' can be parsed as a Sql Database ID diff --git a/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_storedprocedure.go b/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_storedprocedure.go index fd7480b7609..5468c795b65 100644 --- a/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_storedprocedure.go +++ b/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_storedprocedure.go @@ -42,31 +42,9 @@ func ParseStoredProcedureID(input string) (*StoredProcedureId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StoredProcedureId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) - } - - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) - } - - if id.StoredProcedureName, ok = parsed.Parsed["storedProcedureName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storedProcedureName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseStoredProcedureIDInsensitively(input string) (*StoredProcedureId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StoredProcedureId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *StoredProcedureId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) + if id.SqlDatabaseName, ok = input.Parsed["sqlDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", input) } - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) + if id.ContainerName, ok = input.Parsed["containerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerName", input) } - if id.StoredProcedureName, ok = parsed.Parsed["storedProcedureName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storedProcedureName", *parsed) + if id.StoredProcedureName, ok = input.Parsed["storedProcedureName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storedProcedureName", input) } - return &id, nil + return nil } // ValidateStoredProcedureID checks that 'input' can be parsed as a Stored Procedure ID diff --git a/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_table.go b/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_table.go index f4d64253830..006d2a6171b 100644 --- a/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_table.go +++ b/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_table.go @@ -38,23 +38,9 @@ func ParseTableID(input string) (*TableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TableId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTableIDInsensitively(input string) (*TableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TableId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if id.TableName, ok = input.Parsed["tableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tableName", input) } - return &id, nil + return nil } // ValidateTableID checks that 'input' can be parsed as a Table ID diff --git a/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_targetregion.go b/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_targetregion.go index 1604e4b598b..bbf4612af00 100644 --- a/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_targetregion.go +++ b/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_targetregion.go @@ -38,23 +38,9 @@ func ParseTargetRegionID(input string) (*TargetRegionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TargetRegionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.TargetRegionName, ok = parsed.Parsed["targetRegionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetRegionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTargetRegionIDInsensitively(input string) (*TargetRegionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TargetRegionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TargetRegionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.TargetRegionName, ok = parsed.Parsed["targetRegionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetRegionName", *parsed) + if id.TargetRegionName, ok = input.Parsed["targetRegionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "targetRegionName", input) } - return &id, nil + return nil } // ValidateTargetRegionID checks that 'input' can be parsed as a Target Region ID diff --git a/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_trigger.go b/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_trigger.go index 7c06746b92c..864ee0c2a38 100644 --- a/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_trigger.go +++ b/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_trigger.go @@ -42,31 +42,9 @@ func ParseTriggerID(input string) (*TriggerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TriggerId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) - } - - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) - } - - if id.TriggerName, ok = parsed.Parsed["triggerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseTriggerIDInsensitively(input string) (*TriggerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TriggerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *TriggerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) + if id.SqlDatabaseName, ok = input.Parsed["sqlDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", input) } - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) + if id.ContainerName, ok = input.Parsed["containerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerName", input) } - if id.TriggerName, ok = parsed.Parsed["triggerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggerName", *parsed) + if id.TriggerName, ok = input.Parsed["triggerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "triggerName", input) } - return &id, nil + return nil } // ValidateTriggerID checks that 'input' can be parsed as a Trigger ID diff --git a/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_userdefinedfunction.go b/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_userdefinedfunction.go index 54f09bc5f2d..90e49c6f84e 100644 --- a/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_userdefinedfunction.go +++ b/resource-manager/cosmosdb/2023-09-15/cosmosdb/id_userdefinedfunction.go @@ -42,31 +42,9 @@ func ParseUserDefinedFunctionID(input string) (*UserDefinedFunctionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserDefinedFunctionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) - } - - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) - } - - if id.UserDefinedFunctionName, ok = parsed.Parsed["userDefinedFunctionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userDefinedFunctionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseUserDefinedFunctionIDInsensitively(input string) (*UserDefinedFunction return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserDefinedFunctionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *UserDefinedFunctionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) + if id.SqlDatabaseName, ok = input.Parsed["sqlDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", input) } - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) + if id.ContainerName, ok = input.Parsed["containerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerName", input) } - if id.UserDefinedFunctionName, ok = parsed.Parsed["userDefinedFunctionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userDefinedFunctionName", *parsed) + if id.UserDefinedFunctionName, ok = input.Parsed["userDefinedFunctionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userDefinedFunctionName", input) } - return &id, nil + return nil } // ValidateUserDefinedFunctionID checks that 'input' can be parsed as a User Defined Function ID diff --git a/resource-manager/cosmosdb/2023-09-15/datatransfer/id_service.go b/resource-manager/cosmosdb/2023-09-15/datatransfer/id_service.go index c2fba9c3c5d..5f0f6c16dc6 100644 --- a/resource-manager/cosmosdb/2023-09-15/datatransfer/id_service.go +++ b/resource-manager/cosmosdb/2023-09-15/datatransfer/id_service.go @@ -38,23 +38,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ServiceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/cosmosdb/2023-09-15/graphapicompute/id_service.go b/resource-manager/cosmosdb/2023-09-15/graphapicompute/id_service.go index 92c693864c7..41bd08f7b1c 100644 --- a/resource-manager/cosmosdb/2023-09-15/graphapicompute/id_service.go +++ b/resource-manager/cosmosdb/2023-09-15/graphapicompute/id_service.go @@ -38,23 +38,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ServiceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/cosmosdb/2023-09-15/managedcassandras/id_cassandracluster.go b/resource-manager/cosmosdb/2023-09-15/managedcassandras/id_cassandracluster.go index 55c61f4a864..70b8aac3664 100644 --- a/resource-manager/cosmosdb/2023-09-15/managedcassandras/id_cassandracluster.go +++ b/resource-manager/cosmosdb/2023-09-15/managedcassandras/id_cassandracluster.go @@ -36,19 +36,9 @@ func ParseCassandraClusterID(input string) (*CassandraClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CassandraClusterId{} - - 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.CassandraClusterName, ok = parsed.Parsed["cassandraClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cassandraClusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseCassandraClusterIDInsensitively(input string) (*CassandraClusterId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CassandraClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CassandraClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CassandraClusterName, ok = parsed.Parsed["cassandraClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cassandraClusterName", *parsed) + if id.CassandraClusterName, ok = input.Parsed["cassandraClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cassandraClusterName", input) } - return &id, nil + return nil } // ValidateCassandraClusterID checks that 'input' can be parsed as a Cassandra Cluster ID diff --git a/resource-manager/cosmosdb/2023-09-15/managedcassandras/id_datacenter.go b/resource-manager/cosmosdb/2023-09-15/managedcassandras/id_datacenter.go index 8d8d8835013..0c8dfad5704 100644 --- a/resource-manager/cosmosdb/2023-09-15/managedcassandras/id_datacenter.go +++ b/resource-manager/cosmosdb/2023-09-15/managedcassandras/id_datacenter.go @@ -38,23 +38,9 @@ func ParseDataCenterID(input string) (*DataCenterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataCenterId{} - - 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.CassandraClusterName, ok = parsed.Parsed["cassandraClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cassandraClusterName", *parsed) - } - - if id.DataCenterName, ok = parsed.Parsed["dataCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataCenterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDataCenterIDInsensitively(input string) (*DataCenterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataCenterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DataCenterId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CassandraClusterName, ok = parsed.Parsed["cassandraClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cassandraClusterName", *parsed) + if id.CassandraClusterName, ok = input.Parsed["cassandraClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cassandraClusterName", input) } - if id.DataCenterName, ok = parsed.Parsed["dataCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataCenterName", *parsed) + if id.DataCenterName, ok = input.Parsed["dataCenterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataCenterName", input) } - return &id, nil + return nil } // ValidateDataCenterID checks that 'input' can be parsed as a Data Center ID diff --git a/resource-manager/cosmosdb/2023-09-15/materializedviewsbuilder/id_service.go b/resource-manager/cosmosdb/2023-09-15/materializedviewsbuilder/id_service.go index a3c6ba915ec..4f5a2a474a6 100644 --- a/resource-manager/cosmosdb/2023-09-15/materializedviewsbuilder/id_service.go +++ b/resource-manager/cosmosdb/2023-09-15/materializedviewsbuilder/id_service.go @@ -38,23 +38,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ServiceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/cosmosdb/2023-09-15/mongorbacs/id_databaseaccount.go b/resource-manager/cosmosdb/2023-09-15/mongorbacs/id_databaseaccount.go index 9edb9717313..20b3172f6a2 100644 --- a/resource-manager/cosmosdb/2023-09-15/mongorbacs/id_databaseaccount.go +++ b/resource-manager/cosmosdb/2023-09-15/mongorbacs/id_databaseaccount.go @@ -36,19 +36,9 @@ func ParseDatabaseAccountID(input string) (*DatabaseAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDatabaseAccountIDInsensitively(input string) (*DatabaseAccountId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DatabaseAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - return &id, nil + return nil } // ValidateDatabaseAccountID checks that 'input' can be parsed as a Database Account ID diff --git a/resource-manager/cosmosdb/2023-09-15/mongorbacs/id_mongodbroledefinition.go b/resource-manager/cosmosdb/2023-09-15/mongorbacs/id_mongodbroledefinition.go index a5dad9eda74..737a561ca8a 100644 --- a/resource-manager/cosmosdb/2023-09-15/mongorbacs/id_mongodbroledefinition.go +++ b/resource-manager/cosmosdb/2023-09-15/mongorbacs/id_mongodbroledefinition.go @@ -38,23 +38,9 @@ func ParseMongodbRoleDefinitionID(input string) (*MongodbRoleDefinitionId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MongodbRoleDefinitionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.MongoRoleDefinitionId, ok = parsed.Parsed["mongoRoleDefinitionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mongoRoleDefinitionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseMongodbRoleDefinitionIDInsensitively(input string) (*MongodbRoleDefini return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MongodbRoleDefinitionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *MongodbRoleDefinitionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.MongoRoleDefinitionId, ok = parsed.Parsed["mongoRoleDefinitionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mongoRoleDefinitionId", *parsed) + if id.MongoRoleDefinitionId, ok = input.Parsed["mongoRoleDefinitionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mongoRoleDefinitionId", input) } - return &id, nil + return nil } // ValidateMongodbRoleDefinitionID checks that 'input' can be parsed as a Mongodb Role Definition ID diff --git a/resource-manager/cosmosdb/2023-09-15/mongorbacs/id_mongodbuserdefinition.go b/resource-manager/cosmosdb/2023-09-15/mongorbacs/id_mongodbuserdefinition.go index 5e5016590a7..f720d6bbf30 100644 --- a/resource-manager/cosmosdb/2023-09-15/mongorbacs/id_mongodbuserdefinition.go +++ b/resource-manager/cosmosdb/2023-09-15/mongorbacs/id_mongodbuserdefinition.go @@ -38,23 +38,9 @@ func ParseMongodbUserDefinitionID(input string) (*MongodbUserDefinitionId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MongodbUserDefinitionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.MongoUserDefinitionId, ok = parsed.Parsed["mongoUserDefinitionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mongoUserDefinitionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseMongodbUserDefinitionIDInsensitively(input string) (*MongodbUserDefini return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MongodbUserDefinitionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *MongodbUserDefinitionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.MongoUserDefinitionId, ok = parsed.Parsed["mongoUserDefinitionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mongoUserDefinitionId", *parsed) + if id.MongoUserDefinitionId, ok = input.Parsed["mongoUserDefinitionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mongoUserDefinitionId", input) } - return &id, nil + return nil } // ValidateMongodbUserDefinitionID checks that 'input' can be parsed as a Mongodb User Definition ID diff --git a/resource-manager/cosmosdb/2023-09-15/notebookworkspacesresource/id_databaseaccount.go b/resource-manager/cosmosdb/2023-09-15/notebookworkspacesresource/id_databaseaccount.go index 6163d3bbe76..ce05f7ad501 100644 --- a/resource-manager/cosmosdb/2023-09-15/notebookworkspacesresource/id_databaseaccount.go +++ b/resource-manager/cosmosdb/2023-09-15/notebookworkspacesresource/id_databaseaccount.go @@ -36,19 +36,9 @@ func ParseDatabaseAccountID(input string) (*DatabaseAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDatabaseAccountIDInsensitively(input string) (*DatabaseAccountId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DatabaseAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - return &id, nil + return nil } // ValidateDatabaseAccountID checks that 'input' can be parsed as a Database Account ID diff --git a/resource-manager/cosmosdb/2023-09-15/privateendpointconnections/id_databaseaccount.go b/resource-manager/cosmosdb/2023-09-15/privateendpointconnections/id_databaseaccount.go index 1d3deea521d..819433a83df 100644 --- a/resource-manager/cosmosdb/2023-09-15/privateendpointconnections/id_databaseaccount.go +++ b/resource-manager/cosmosdb/2023-09-15/privateendpointconnections/id_databaseaccount.go @@ -36,19 +36,9 @@ func ParseDatabaseAccountID(input string) (*DatabaseAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDatabaseAccountIDInsensitively(input string) (*DatabaseAccountId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DatabaseAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - return &id, nil + return nil } // ValidateDatabaseAccountID checks that 'input' can be parsed as a Database Account ID diff --git a/resource-manager/cosmosdb/2023-09-15/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/cosmosdb/2023-09-15/privateendpointconnections/id_privateendpointconnection.go index 25382589736..13a94a5226b 100644 --- a/resource-manager/cosmosdb/2023-09-15/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/cosmosdb/2023-09-15/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/cosmosdb/2023-09-15/privatelinkresources/id_databaseaccount.go b/resource-manager/cosmosdb/2023-09-15/privatelinkresources/id_databaseaccount.go index 860bfb590a3..eedea1fcc5c 100644 --- a/resource-manager/cosmosdb/2023-09-15/privatelinkresources/id_databaseaccount.go +++ b/resource-manager/cosmosdb/2023-09-15/privatelinkresources/id_databaseaccount.go @@ -36,19 +36,9 @@ func ParseDatabaseAccountID(input string) (*DatabaseAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDatabaseAccountIDInsensitively(input string) (*DatabaseAccountId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DatabaseAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - return &id, nil + return nil } // ValidateDatabaseAccountID checks that 'input' can be parsed as a Database Account ID diff --git a/resource-manager/cosmosdb/2023-09-15/privatelinkresources/id_privatelinkresource.go b/resource-manager/cosmosdb/2023-09-15/privatelinkresources/id_privatelinkresource.go index 46003ca6e7b..e9f0c7e799e 100644 --- a/resource-manager/cosmosdb/2023-09-15/privatelinkresources/id_privatelinkresource.go +++ b/resource-manager/cosmosdb/2023-09-15/privatelinkresources/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/cosmosdb/2023-09-15/rbacs/id_account.go b/resource-manager/cosmosdb/2023-09-15/rbacs/id_account.go index d548f6b1a64..b9caf8a4482 100644 --- a/resource-manager/cosmosdb/2023-09-15/rbacs/id_account.go +++ b/resource-manager/cosmosdb/2023-09-15/rbacs/id_account.go @@ -38,23 +38,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.RoleAssignmentId, ok = parsed.Parsed["roleAssignmentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleAssignmentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.RoleAssignmentId, ok = parsed.Parsed["roleAssignmentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleAssignmentId", *parsed) + if id.RoleAssignmentId, ok = input.Parsed["roleAssignmentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "roleAssignmentId", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/cosmosdb/2023-09-15/rbacs/id_databaseaccount.go b/resource-manager/cosmosdb/2023-09-15/rbacs/id_databaseaccount.go index 878ca7762f4..856f00f92c8 100644 --- a/resource-manager/cosmosdb/2023-09-15/rbacs/id_databaseaccount.go +++ b/resource-manager/cosmosdb/2023-09-15/rbacs/id_databaseaccount.go @@ -36,19 +36,9 @@ func ParseDatabaseAccountID(input string) (*DatabaseAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDatabaseAccountIDInsensitively(input string) (*DatabaseAccountId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DatabaseAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - return &id, nil + return nil } // ValidateDatabaseAccountID checks that 'input' can be parsed as a Database Account ID diff --git a/resource-manager/cosmosdb/2023-09-15/rbacs/id_sqlroledefinition.go b/resource-manager/cosmosdb/2023-09-15/rbacs/id_sqlroledefinition.go index 292dcd692e5..522ce0762cf 100644 --- a/resource-manager/cosmosdb/2023-09-15/rbacs/id_sqlroledefinition.go +++ b/resource-manager/cosmosdb/2023-09-15/rbacs/id_sqlroledefinition.go @@ -38,23 +38,9 @@ func ParseSqlRoleDefinitionID(input string) (*SqlRoleDefinitionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SqlRoleDefinitionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.RoleDefinitionId, ok = parsed.Parsed["roleDefinitionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleDefinitionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSqlRoleDefinitionIDInsensitively(input string) (*SqlRoleDefinitionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SqlRoleDefinitionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SqlRoleDefinitionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.RoleDefinitionId, ok = parsed.Parsed["roleDefinitionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleDefinitionId", *parsed) + if id.RoleDefinitionId, ok = input.Parsed["roleDefinitionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "roleDefinitionId", input) } - return &id, nil + return nil } // ValidateSqlRoleDefinitionID checks that 'input' can be parsed as a Sql Role Definition ID diff --git a/resource-manager/cosmosdb/2023-09-15/restorables/id_container.go b/resource-manager/cosmosdb/2023-09-15/restorables/id_container.go index abf3171b109..c2b2177ed71 100644 --- a/resource-manager/cosmosdb/2023-09-15/restorables/id_container.go +++ b/resource-manager/cosmosdb/2023-09-15/restorables/id_container.go @@ -40,27 +40,9 @@ func ParseContainerID(input string) (*ContainerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) - } - - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseContainerIDInsensitively(input string) (*ContainerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ContainerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.SqlDatabaseName, ok = parsed.Parsed["sqlDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", *parsed) + if id.SqlDatabaseName, ok = input.Parsed["sqlDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sqlDatabaseName", input) } - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) + if id.ContainerName, ok = input.Parsed["containerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerName", input) } - return &id, nil + return nil } // ValidateContainerID checks that 'input' can be parsed as a Container ID diff --git a/resource-manager/cosmosdb/2023-09-15/restorables/id_graph.go b/resource-manager/cosmosdb/2023-09-15/restorables/id_graph.go index ab652bd3a81..17e4e7dcc5d 100644 --- a/resource-manager/cosmosdb/2023-09-15/restorables/id_graph.go +++ b/resource-manager/cosmosdb/2023-09-15/restorables/id_graph.go @@ -40,27 +40,9 @@ func ParseGraphID(input string) (*GraphId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GraphId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.GremlinDatabaseName, ok = parsed.Parsed["gremlinDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gremlinDatabaseName", *parsed) - } - - if id.GraphName, ok = parsed.Parsed["graphName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "graphName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseGraphIDInsensitively(input string) (*GraphId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GraphId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *GraphId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.GremlinDatabaseName, ok = parsed.Parsed["gremlinDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gremlinDatabaseName", *parsed) + if id.GremlinDatabaseName, ok = input.Parsed["gremlinDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gremlinDatabaseName", input) } - if id.GraphName, ok = parsed.Parsed["graphName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "graphName", *parsed) + if id.GraphName, ok = input.Parsed["graphName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "graphName", input) } - return &id, nil + return nil } // ValidateGraphID checks that 'input' can be parsed as a Graph ID diff --git a/resource-manager/cosmosdb/2023-09-15/restorables/id_location.go b/resource-manager/cosmosdb/2023-09-15/restorables/id_location.go index 0eb834cf4e6..35f17158125 100644 --- a/resource-manager/cosmosdb/2023-09-15/restorables/id_location.go +++ b/resource-manager/cosmosdb/2023-09-15/restorables/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/cosmosdb/2023-09-15/restorables/id_mongodbdatabasecollection.go b/resource-manager/cosmosdb/2023-09-15/restorables/id_mongodbdatabasecollection.go index 2d1dee24a26..576dcaff5d8 100644 --- a/resource-manager/cosmosdb/2023-09-15/restorables/id_mongodbdatabasecollection.go +++ b/resource-manager/cosmosdb/2023-09-15/restorables/id_mongodbdatabasecollection.go @@ -40,27 +40,9 @@ func ParseMongodbDatabaseCollectionID(input string) (*MongodbDatabaseCollectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MongodbDatabaseCollectionId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.MongodbDatabaseName, ok = parsed.Parsed["mongodbDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mongodbDatabaseName", *parsed) - } - - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseMongodbDatabaseCollectionIDInsensitively(input string) (*MongodbDataba return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MongodbDatabaseCollectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *MongodbDatabaseCollectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.MongodbDatabaseName, ok = parsed.Parsed["mongodbDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mongodbDatabaseName", *parsed) + if id.MongodbDatabaseName, ok = input.Parsed["mongodbDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mongodbDatabaseName", input) } - if id.CollectionName, ok = parsed.Parsed["collectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectionName", *parsed) + if id.CollectionName, ok = input.Parsed["collectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "collectionName", input) } - return &id, nil + return nil } // ValidateMongodbDatabaseCollectionID checks that 'input' can be parsed as a Mongodb Database Collection ID diff --git a/resource-manager/cosmosdb/2023-09-15/restorables/id_restorabledatabaseaccount.go b/resource-manager/cosmosdb/2023-09-15/restorables/id_restorabledatabaseaccount.go index f2c929a0130..25ee3deecab 100644 --- a/resource-manager/cosmosdb/2023-09-15/restorables/id_restorabledatabaseaccount.go +++ b/resource-manager/cosmosdb/2023-09-15/restorables/id_restorabledatabaseaccount.go @@ -36,19 +36,9 @@ func ParseRestorableDatabaseAccountID(input string) (*RestorableDatabaseAccountI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RestorableDatabaseAccountId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRestorableDatabaseAccountIDInsensitively(input string) (*RestorableDat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RestorableDatabaseAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RestorableDatabaseAccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if id.InstanceId, ok = input.Parsed["instanceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceId", input) } - return &id, nil + return nil } // ValidateRestorableDatabaseAccountID checks that 'input' can be parsed as a Restorable Database Account ID diff --git a/resource-manager/cosmosdb/2023-09-15/restorables/id_table.go b/resource-manager/cosmosdb/2023-09-15/restorables/id_table.go index a2dd478f80b..e7ebd22e638 100644 --- a/resource-manager/cosmosdb/2023-09-15/restorables/id_table.go +++ b/resource-manager/cosmosdb/2023-09-15/restorables/id_table.go @@ -38,23 +38,9 @@ func ParseTableID(input string) (*TableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TableId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTableIDInsensitively(input string) (*TableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TableId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if id.TableName, ok = input.Parsed["tableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tableName", input) } - return &id, nil + return nil } // ValidateTableID checks that 'input' can be parsed as a Table ID diff --git a/resource-manager/cosmosdb/2023-09-15/services/id_databaseaccount.go b/resource-manager/cosmosdb/2023-09-15/services/id_databaseaccount.go index fde95de221b..4a229a3b3b9 100644 --- a/resource-manager/cosmosdb/2023-09-15/services/id_databaseaccount.go +++ b/resource-manager/cosmosdb/2023-09-15/services/id_databaseaccount.go @@ -36,19 +36,9 @@ func ParseDatabaseAccountID(input string) (*DatabaseAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDatabaseAccountIDInsensitively(input string) (*DatabaseAccountId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DatabaseAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - return &id, nil + return nil } // ValidateDatabaseAccountID checks that 'input' can be parsed as a Database Account ID diff --git a/resource-manager/cosmosdb/2023-09-15/sqldedicatedgateway/id_service.go b/resource-manager/cosmosdb/2023-09-15/sqldedicatedgateway/id_service.go index 1a0173f1bdd..2ecf0e8462e 100644 --- a/resource-manager/cosmosdb/2023-09-15/sqldedicatedgateway/id_service.go +++ b/resource-manager/cosmosdb/2023-09-15/sqldedicatedgateway/id_service.go @@ -38,23 +38,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) - } - - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ServiceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DatabaseAccountName, ok = parsed.Parsed["databaseAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", *parsed) + if id.DatabaseAccountName, ok = input.Parsed["databaseAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseAccountName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/costmanagement/2021-10-01/alerts/id_externalcloudprovidertype.go b/resource-manager/costmanagement/2021-10-01/alerts/id_externalcloudprovidertype.go index bc7a4d67b2b..1d1a1d8fad6 100644 --- a/resource-manager/costmanagement/2021-10-01/alerts/id_externalcloudprovidertype.go +++ b/resource-manager/costmanagement/2021-10-01/alerts/id_externalcloudprovidertype.go @@ -34,23 +34,9 @@ func ParseExternalCloudProviderTypeID(input string) (*ExternalCloudProviderTypeI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExternalCloudProviderTypeId{} - - if v, ok := parsed.Parsed["externalCloudProviderType"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderType", *parsed) - } - - externalCloudProviderType, err := parseExternalCloudProviderType(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.ExternalCloudProviderType = *externalCloudProviderType - } - - if id.ExternalCloudProviderId, ok = parsed.Parsed["externalCloudProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -65,26 +51,34 @@ func ParseExternalCloudProviderTypeIDInsensitively(input string) (*ExternalCloud return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExternalCloudProviderTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if v, ok := parsed.Parsed["externalCloudProviderType"]; true { + return &id, nil +} + +func (id *ExternalCloudProviderTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if v, ok := input.Parsed["externalCloudProviderType"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderType", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderType", input) } externalCloudProviderType, err := parseExternalCloudProviderType(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.ExternalCloudProviderType = *externalCloudProviderType } - if id.ExternalCloudProviderId, ok = parsed.Parsed["externalCloudProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderId", *parsed) + if id.ExternalCloudProviderId, ok = input.Parsed["externalCloudProviderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderId", input) } - return &id, nil + return nil } // ValidateExternalCloudProviderTypeID checks that 'input' can be parsed as a External Cloud Provider Type ID diff --git a/resource-manager/costmanagement/2021-10-01/alerts/id_scopedalert.go b/resource-manager/costmanagement/2021-10-01/alerts/id_scopedalert.go index 6420ed91bcb..79a690ab809 100644 --- a/resource-manager/costmanagement/2021-10-01/alerts/id_scopedalert.go +++ b/resource-manager/costmanagement/2021-10-01/alerts/id_scopedalert.go @@ -34,15 +34,9 @@ func ParseScopedAlertID(input string) (*ScopedAlertId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedAlertId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.AlertId, ok = parsed.Parsed["alertId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "alertId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedAlertIDInsensitively(input string) (*ScopedAlertId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedAlertId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedAlertId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.AlertId, ok = parsed.Parsed["alertId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "alertId", *parsed) + if id.AlertId, ok = input.Parsed["alertId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "alertId", input) } - return &id, nil + return nil } // ValidateScopedAlertID checks that 'input' can be parsed as a Scoped Alert ID diff --git a/resource-manager/costmanagement/2021-10-01/dimensions/id_externalcloudprovidertype.go b/resource-manager/costmanagement/2021-10-01/dimensions/id_externalcloudprovidertype.go index 10cbdac4f4c..84685793489 100644 --- a/resource-manager/costmanagement/2021-10-01/dimensions/id_externalcloudprovidertype.go +++ b/resource-manager/costmanagement/2021-10-01/dimensions/id_externalcloudprovidertype.go @@ -34,23 +34,9 @@ func ParseExternalCloudProviderTypeID(input string) (*ExternalCloudProviderTypeI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExternalCloudProviderTypeId{} - - if v, ok := parsed.Parsed["externalCloudProviderType"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderType", *parsed) - } - - externalCloudProviderType, err := parseExternalCloudProviderType(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.ExternalCloudProviderType = *externalCloudProviderType - } - - if id.ExternalCloudProviderId, ok = parsed.Parsed["externalCloudProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -65,26 +51,34 @@ func ParseExternalCloudProviderTypeIDInsensitively(input string) (*ExternalCloud return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExternalCloudProviderTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if v, ok := parsed.Parsed["externalCloudProviderType"]; true { + return &id, nil +} + +func (id *ExternalCloudProviderTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if v, ok := input.Parsed["externalCloudProviderType"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderType", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderType", input) } externalCloudProviderType, err := parseExternalCloudProviderType(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.ExternalCloudProviderType = *externalCloudProviderType } - if id.ExternalCloudProviderId, ok = parsed.Parsed["externalCloudProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderId", *parsed) + if id.ExternalCloudProviderId, ok = input.Parsed["externalCloudProviderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderId", input) } - return &id, nil + return nil } // ValidateExternalCloudProviderTypeID checks that 'input' can be parsed as a External Cloud Provider Type ID diff --git a/resource-manager/costmanagement/2021-10-01/exports/id_scopedexport.go b/resource-manager/costmanagement/2021-10-01/exports/id_scopedexport.go index a5546578efd..7bd79356882 100644 --- a/resource-manager/costmanagement/2021-10-01/exports/id_scopedexport.go +++ b/resource-manager/costmanagement/2021-10-01/exports/id_scopedexport.go @@ -34,15 +34,9 @@ func ParseScopedExportID(input string) (*ScopedExportId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedExportId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.ExportName, ok = parsed.Parsed["exportName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "exportName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedExportIDInsensitively(input string) (*ScopedExportId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedExportId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedExportId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.ExportName, ok = parsed.Parsed["exportName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "exportName", *parsed) + if id.ExportName, ok = input.Parsed["exportName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "exportName", input) } - return &id, nil + return nil } // ValidateScopedExportID checks that 'input' can be parsed as a Scoped Export ID diff --git a/resource-manager/costmanagement/2021-10-01/forecast/id_externalcloudprovidertype.go b/resource-manager/costmanagement/2021-10-01/forecast/id_externalcloudprovidertype.go index e43b76c4747..898f3fc76bf 100644 --- a/resource-manager/costmanagement/2021-10-01/forecast/id_externalcloudprovidertype.go +++ b/resource-manager/costmanagement/2021-10-01/forecast/id_externalcloudprovidertype.go @@ -34,23 +34,9 @@ func ParseExternalCloudProviderTypeID(input string) (*ExternalCloudProviderTypeI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExternalCloudProviderTypeId{} - - if v, ok := parsed.Parsed["externalCloudProviderType"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderType", *parsed) - } - - externalCloudProviderType, err := parseExternalCloudProviderType(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.ExternalCloudProviderType = *externalCloudProviderType - } - - if id.ExternalCloudProviderId, ok = parsed.Parsed["externalCloudProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -65,26 +51,34 @@ func ParseExternalCloudProviderTypeIDInsensitively(input string) (*ExternalCloud return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExternalCloudProviderTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if v, ok := parsed.Parsed["externalCloudProviderType"]; true { + return &id, nil +} + +func (id *ExternalCloudProviderTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if v, ok := input.Parsed["externalCloudProviderType"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderType", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderType", input) } externalCloudProviderType, err := parseExternalCloudProviderType(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.ExternalCloudProviderType = *externalCloudProviderType } - if id.ExternalCloudProviderId, ok = parsed.Parsed["externalCloudProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderId", *parsed) + if id.ExternalCloudProviderId, ok = input.Parsed["externalCloudProviderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderId", input) } - return &id, nil + return nil } // ValidateExternalCloudProviderTypeID checks that 'input' can be parsed as a External Cloud Provider Type ID diff --git a/resource-manager/costmanagement/2021-10-01/query/id_externalcloudprovidertype.go b/resource-manager/costmanagement/2021-10-01/query/id_externalcloudprovidertype.go index 54fabd4e45f..29ec40983bf 100644 --- a/resource-manager/costmanagement/2021-10-01/query/id_externalcloudprovidertype.go +++ b/resource-manager/costmanagement/2021-10-01/query/id_externalcloudprovidertype.go @@ -34,23 +34,9 @@ func ParseExternalCloudProviderTypeID(input string) (*ExternalCloudProviderTypeI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExternalCloudProviderTypeId{} - - if v, ok := parsed.Parsed["externalCloudProviderType"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderType", *parsed) - } - - externalCloudProviderType, err := parseExternalCloudProviderType(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.ExternalCloudProviderType = *externalCloudProviderType - } - - if id.ExternalCloudProviderId, ok = parsed.Parsed["externalCloudProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -65,26 +51,34 @@ func ParseExternalCloudProviderTypeIDInsensitively(input string) (*ExternalCloud return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExternalCloudProviderTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if v, ok := parsed.Parsed["externalCloudProviderType"]; true { + return &id, nil +} + +func (id *ExternalCloudProviderTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if v, ok := input.Parsed["externalCloudProviderType"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderType", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderType", input) } externalCloudProviderType, err := parseExternalCloudProviderType(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.ExternalCloudProviderType = *externalCloudProviderType } - if id.ExternalCloudProviderId, ok = parsed.Parsed["externalCloudProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderId", *parsed) + if id.ExternalCloudProviderId, ok = input.Parsed["externalCloudProviderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderId", input) } - return &id, nil + return nil } // ValidateExternalCloudProviderTypeID checks that 'input' can be parsed as a External Cloud Provider Type ID diff --git a/resource-manager/costmanagement/2021-10-01/reservedinstances/id_billingaccount.go b/resource-manager/costmanagement/2021-10-01/reservedinstances/id_billingaccount.go index ea6e51b561a..3a014995a80 100644 --- a/resource-manager/costmanagement/2021-10-01/reservedinstances/id_billingaccount.go +++ b/resource-manager/costmanagement/2021-10-01/reservedinstances/id_billingaccount.go @@ -32,11 +32,9 @@ func ParseBillingAccountID(input string) (*BillingAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseBillingAccountIDInsensitively(input string) (*BillingAccountId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *BillingAccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) + } + + return nil +} + // ValidateBillingAccountID checks that 'input' can be parsed as a Billing Account ID func ValidateBillingAccountID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/costmanagement/2021-10-01/reservedinstances/id_billingprofile.go b/resource-manager/costmanagement/2021-10-01/reservedinstances/id_billingprofile.go index 3d07dcd0f3e..d0923149768 100644 --- a/resource-manager/costmanagement/2021-10-01/reservedinstances/id_billingprofile.go +++ b/resource-manager/costmanagement/2021-10-01/reservedinstances/id_billingprofile.go @@ -34,15 +34,9 @@ func ParseBillingProfileID(input string) (*BillingProfileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) - } - - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseBillingProfileIDInsensitively(input string) (*BillingProfileId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + return &id, nil +} + +func (id *BillingProfileId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) } - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if id.BillingProfileId, ok = input.Parsed["billingProfileId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", input) } - return &id, nil + return nil } // ValidateBillingProfileID checks that 'input' can be parsed as a Billing Profile ID diff --git a/resource-manager/costmanagement/2021-10-01/views/id_scopedview.go b/resource-manager/costmanagement/2021-10-01/views/id_scopedview.go index 788d550f865..f2575e1e520 100644 --- a/resource-manager/costmanagement/2021-10-01/views/id_scopedview.go +++ b/resource-manager/costmanagement/2021-10-01/views/id_scopedview.go @@ -34,15 +34,9 @@ func ParseScopedViewID(input string) (*ScopedViewId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedViewId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.ViewName, ok = parsed.Parsed["viewName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "viewName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedViewIDInsensitively(input string) (*ScopedViewId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedViewId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedViewId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.ViewName, ok = parsed.Parsed["viewName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "viewName", *parsed) + if id.ViewName, ok = input.Parsed["viewName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "viewName", input) } - return &id, nil + return nil } // ValidateScopedViewID checks that 'input' can be parsed as a Scoped View ID diff --git a/resource-manager/costmanagement/2021-10-01/views/id_view.go b/resource-manager/costmanagement/2021-10-01/views/id_view.go index b4cc2295d4a..e1afb0fe35b 100644 --- a/resource-manager/costmanagement/2021-10-01/views/id_view.go +++ b/resource-manager/costmanagement/2021-10-01/views/id_view.go @@ -32,11 +32,9 @@ func ParseViewID(input string) (*ViewId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ViewId{} - - if id.ViewName, ok = parsed.Parsed["viewName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "viewName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseViewIDInsensitively(input string) (*ViewId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ViewId{} - - if id.ViewName, ok = parsed.Parsed["viewName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "viewName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *ViewId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ViewName, ok = input.Parsed["viewName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "viewName", input) + } + + return nil +} + // ValidateViewID checks that 'input' can be parsed as a View ID func ValidateViewID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/costmanagement/2022-06-01-preview/scheduledactions/id_scheduledaction.go b/resource-manager/costmanagement/2022-06-01-preview/scheduledactions/id_scheduledaction.go index b5d002d4286..69c04db60b5 100644 --- a/resource-manager/costmanagement/2022-06-01-preview/scheduledactions/id_scheduledaction.go +++ b/resource-manager/costmanagement/2022-06-01-preview/scheduledactions/id_scheduledaction.go @@ -32,11 +32,9 @@ func ParseScheduledActionID(input string) (*ScheduledActionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScheduledActionId{} - - if id.ScheduledActionName, ok = parsed.Parsed["scheduledActionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduledActionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseScheduledActionIDInsensitively(input string) (*ScheduledActionId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScheduledActionId{} - - if id.ScheduledActionName, ok = parsed.Parsed["scheduledActionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduledActionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *ScheduledActionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ScheduledActionName, ok = input.Parsed["scheduledActionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scheduledActionName", input) + } + + return nil +} + // ValidateScheduledActionID checks that 'input' can be parsed as a Scheduled Action ID func ValidateScheduledActionID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/costmanagement/2022-06-01-preview/scheduledactions/id_scopedscheduledaction.go b/resource-manager/costmanagement/2022-06-01-preview/scheduledactions/id_scopedscheduledaction.go index 3e166c601f4..a5b593cd533 100644 --- a/resource-manager/costmanagement/2022-06-01-preview/scheduledactions/id_scopedscheduledaction.go +++ b/resource-manager/costmanagement/2022-06-01-preview/scheduledactions/id_scopedscheduledaction.go @@ -34,15 +34,9 @@ func ParseScopedScheduledActionID(input string) (*ScopedScheduledActionId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedScheduledActionId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.ScheduledActionName, ok = parsed.Parsed["scheduledActionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduledActionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedScheduledActionIDInsensitively(input string) (*ScopedScheduledAc return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedScheduledActionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedScheduledActionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.ScheduledActionName, ok = parsed.Parsed["scheduledActionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduledActionName", *parsed) + if id.ScheduledActionName, ok = input.Parsed["scheduledActionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scheduledActionName", input) } - return &id, nil + return nil } // ValidateScopedScheduledActionID checks that 'input' can be parsed as a Scoped Scheduled Action ID diff --git a/resource-manager/costmanagement/2022-10-01/alerts/id_externalcloudprovidertype.go b/resource-manager/costmanagement/2022-10-01/alerts/id_externalcloudprovidertype.go index bc7a4d67b2b..1d1a1d8fad6 100644 --- a/resource-manager/costmanagement/2022-10-01/alerts/id_externalcloudprovidertype.go +++ b/resource-manager/costmanagement/2022-10-01/alerts/id_externalcloudprovidertype.go @@ -34,23 +34,9 @@ func ParseExternalCloudProviderTypeID(input string) (*ExternalCloudProviderTypeI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExternalCloudProviderTypeId{} - - if v, ok := parsed.Parsed["externalCloudProviderType"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderType", *parsed) - } - - externalCloudProviderType, err := parseExternalCloudProviderType(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.ExternalCloudProviderType = *externalCloudProviderType - } - - if id.ExternalCloudProviderId, ok = parsed.Parsed["externalCloudProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -65,26 +51,34 @@ func ParseExternalCloudProviderTypeIDInsensitively(input string) (*ExternalCloud return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExternalCloudProviderTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if v, ok := parsed.Parsed["externalCloudProviderType"]; true { + return &id, nil +} + +func (id *ExternalCloudProviderTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if v, ok := input.Parsed["externalCloudProviderType"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderType", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderType", input) } externalCloudProviderType, err := parseExternalCloudProviderType(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.ExternalCloudProviderType = *externalCloudProviderType } - if id.ExternalCloudProviderId, ok = parsed.Parsed["externalCloudProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderId", *parsed) + if id.ExternalCloudProviderId, ok = input.Parsed["externalCloudProviderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderId", input) } - return &id, nil + return nil } // ValidateExternalCloudProviderTypeID checks that 'input' can be parsed as a External Cloud Provider Type ID diff --git a/resource-manager/costmanagement/2022-10-01/alerts/id_scopedalert.go b/resource-manager/costmanagement/2022-10-01/alerts/id_scopedalert.go index 6420ed91bcb..79a690ab809 100644 --- a/resource-manager/costmanagement/2022-10-01/alerts/id_scopedalert.go +++ b/resource-manager/costmanagement/2022-10-01/alerts/id_scopedalert.go @@ -34,15 +34,9 @@ func ParseScopedAlertID(input string) (*ScopedAlertId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedAlertId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.AlertId, ok = parsed.Parsed["alertId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "alertId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedAlertIDInsensitively(input string) (*ScopedAlertId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedAlertId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedAlertId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.AlertId, ok = parsed.Parsed["alertId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "alertId", *parsed) + if id.AlertId, ok = input.Parsed["alertId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "alertId", input) } - return &id, nil + return nil } // ValidateScopedAlertID checks that 'input' can be parsed as a Scoped Alert ID diff --git a/resource-manager/costmanagement/2022-10-01/benefitutilizationsummaries/id_billingaccount.go b/resource-manager/costmanagement/2022-10-01/benefitutilizationsummaries/id_billingaccount.go index 6f0192eb4b7..40a5ecad16b 100644 --- a/resource-manager/costmanagement/2022-10-01/benefitutilizationsummaries/id_billingaccount.go +++ b/resource-manager/costmanagement/2022-10-01/benefitutilizationsummaries/id_billingaccount.go @@ -32,11 +32,9 @@ func ParseBillingAccountID(input string) (*BillingAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseBillingAccountIDInsensitively(input string) (*BillingAccountId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *BillingAccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) + } + + return nil +} + // ValidateBillingAccountID checks that 'input' can be parsed as a Billing Account ID func ValidateBillingAccountID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/costmanagement/2022-10-01/benefitutilizationsummaries/id_billingprofile.go b/resource-manager/costmanagement/2022-10-01/benefitutilizationsummaries/id_billingprofile.go index 6d38d677254..279ae3339bb 100644 --- a/resource-manager/costmanagement/2022-10-01/benefitutilizationsummaries/id_billingprofile.go +++ b/resource-manager/costmanagement/2022-10-01/benefitutilizationsummaries/id_billingprofile.go @@ -34,15 +34,9 @@ func ParseBillingProfileID(input string) (*BillingProfileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) - } - - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseBillingProfileIDInsensitively(input string) (*BillingProfileId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + return &id, nil +} + +func (id *BillingProfileId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) } - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if id.BillingProfileId, ok = input.Parsed["billingProfileId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", input) } - return &id, nil + return nil } // ValidateBillingProfileID checks that 'input' can be parsed as a Billing Profile ID diff --git a/resource-manager/costmanagement/2022-10-01/benefitutilizationsummaries/id_savingsplan.go b/resource-manager/costmanagement/2022-10-01/benefitutilizationsummaries/id_savingsplan.go index e5c1c50ddbd..423dcd832fc 100644 --- a/resource-manager/costmanagement/2022-10-01/benefitutilizationsummaries/id_savingsplan.go +++ b/resource-manager/costmanagement/2022-10-01/benefitutilizationsummaries/id_savingsplan.go @@ -34,15 +34,9 @@ func ParseSavingsPlanID(input string) (*SavingsPlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SavingsPlanId{} - - if id.SavingsPlanOrderId, ok = parsed.Parsed["savingsPlanOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "savingsPlanOrderId", *parsed) - } - - if id.SavingsPlanId, ok = parsed.Parsed["savingsPlanId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "savingsPlanId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseSavingsPlanIDInsensitively(input string) (*SavingsPlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SavingsPlanId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SavingsPlanOrderId, ok = parsed.Parsed["savingsPlanOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "savingsPlanOrderId", *parsed) + return &id, nil +} + +func (id *SavingsPlanId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SavingsPlanOrderId, ok = input.Parsed["savingsPlanOrderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "savingsPlanOrderId", input) } - if id.SavingsPlanId, ok = parsed.Parsed["savingsPlanId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "savingsPlanId", *parsed) + if id.SavingsPlanId, ok = input.Parsed["savingsPlanId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "savingsPlanId", input) } - return &id, nil + return nil } // ValidateSavingsPlanID checks that 'input' can be parsed as a Savings Plan ID diff --git a/resource-manager/costmanagement/2022-10-01/benefitutilizationsummaries/id_savingsplanorder.go b/resource-manager/costmanagement/2022-10-01/benefitutilizationsummaries/id_savingsplanorder.go index f3b22fdfd4a..b15a22d32d4 100644 --- a/resource-manager/costmanagement/2022-10-01/benefitutilizationsummaries/id_savingsplanorder.go +++ b/resource-manager/costmanagement/2022-10-01/benefitutilizationsummaries/id_savingsplanorder.go @@ -32,11 +32,9 @@ func ParseSavingsPlanOrderID(input string) (*SavingsPlanOrderId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SavingsPlanOrderId{} - - if id.SavingsPlanOrderId, ok = parsed.Parsed["savingsPlanOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "savingsPlanOrderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseSavingsPlanOrderIDInsensitively(input string) (*SavingsPlanOrderId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SavingsPlanOrderId{} - - if id.SavingsPlanOrderId, ok = parsed.Parsed["savingsPlanOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "savingsPlanOrderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *SavingsPlanOrderId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SavingsPlanOrderId, ok = input.Parsed["savingsPlanOrderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "savingsPlanOrderId", input) + } + + return nil +} + // ValidateSavingsPlanOrderID checks that 'input' can be parsed as a Savings Plan Order ID func ValidateSavingsPlanOrderID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/costmanagement/2022-10-01/dimensions/id_externalcloudprovidertype.go b/resource-manager/costmanagement/2022-10-01/dimensions/id_externalcloudprovidertype.go index 10cbdac4f4c..84685793489 100644 --- a/resource-manager/costmanagement/2022-10-01/dimensions/id_externalcloudprovidertype.go +++ b/resource-manager/costmanagement/2022-10-01/dimensions/id_externalcloudprovidertype.go @@ -34,23 +34,9 @@ func ParseExternalCloudProviderTypeID(input string) (*ExternalCloudProviderTypeI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExternalCloudProviderTypeId{} - - if v, ok := parsed.Parsed["externalCloudProviderType"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderType", *parsed) - } - - externalCloudProviderType, err := parseExternalCloudProviderType(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.ExternalCloudProviderType = *externalCloudProviderType - } - - if id.ExternalCloudProviderId, ok = parsed.Parsed["externalCloudProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -65,26 +51,34 @@ func ParseExternalCloudProviderTypeIDInsensitively(input string) (*ExternalCloud return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExternalCloudProviderTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if v, ok := parsed.Parsed["externalCloudProviderType"]; true { + return &id, nil +} + +func (id *ExternalCloudProviderTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if v, ok := input.Parsed["externalCloudProviderType"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderType", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderType", input) } externalCloudProviderType, err := parseExternalCloudProviderType(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.ExternalCloudProviderType = *externalCloudProviderType } - if id.ExternalCloudProviderId, ok = parsed.Parsed["externalCloudProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderId", *parsed) + if id.ExternalCloudProviderId, ok = input.Parsed["externalCloudProviderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderId", input) } - return &id, nil + return nil } // ValidateExternalCloudProviderTypeID checks that 'input' can be parsed as a External Cloud Provider Type ID diff --git a/resource-manager/costmanagement/2022-10-01/exports/id_scopedexport.go b/resource-manager/costmanagement/2022-10-01/exports/id_scopedexport.go index a5546578efd..7bd79356882 100644 --- a/resource-manager/costmanagement/2022-10-01/exports/id_scopedexport.go +++ b/resource-manager/costmanagement/2022-10-01/exports/id_scopedexport.go @@ -34,15 +34,9 @@ func ParseScopedExportID(input string) (*ScopedExportId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedExportId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.ExportName, ok = parsed.Parsed["exportName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "exportName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedExportIDInsensitively(input string) (*ScopedExportId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedExportId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedExportId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.ExportName, ok = parsed.Parsed["exportName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "exportName", *parsed) + if id.ExportName, ok = input.Parsed["exportName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "exportName", input) } - return &id, nil + return nil } // ValidateScopedExportID checks that 'input' can be parsed as a Scoped Export ID diff --git a/resource-manager/costmanagement/2022-10-01/forecast/id_externalcloudprovidertype.go b/resource-manager/costmanagement/2022-10-01/forecast/id_externalcloudprovidertype.go index e43b76c4747..898f3fc76bf 100644 --- a/resource-manager/costmanagement/2022-10-01/forecast/id_externalcloudprovidertype.go +++ b/resource-manager/costmanagement/2022-10-01/forecast/id_externalcloudprovidertype.go @@ -34,23 +34,9 @@ func ParseExternalCloudProviderTypeID(input string) (*ExternalCloudProviderTypeI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExternalCloudProviderTypeId{} - - if v, ok := parsed.Parsed["externalCloudProviderType"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderType", *parsed) - } - - externalCloudProviderType, err := parseExternalCloudProviderType(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.ExternalCloudProviderType = *externalCloudProviderType - } - - if id.ExternalCloudProviderId, ok = parsed.Parsed["externalCloudProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -65,26 +51,34 @@ func ParseExternalCloudProviderTypeIDInsensitively(input string) (*ExternalCloud return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExternalCloudProviderTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if v, ok := parsed.Parsed["externalCloudProviderType"]; true { + return &id, nil +} + +func (id *ExternalCloudProviderTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if v, ok := input.Parsed["externalCloudProviderType"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderType", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderType", input) } externalCloudProviderType, err := parseExternalCloudProviderType(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.ExternalCloudProviderType = *externalCloudProviderType } - if id.ExternalCloudProviderId, ok = parsed.Parsed["externalCloudProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderId", *parsed) + if id.ExternalCloudProviderId, ok = input.Parsed["externalCloudProviderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderId", input) } - return &id, nil + return nil } // ValidateExternalCloudProviderTypeID checks that 'input' can be parsed as a External Cloud Provider Type ID diff --git a/resource-manager/costmanagement/2022-10-01/pricesheets/id_billingprofile.go b/resource-manager/costmanagement/2022-10-01/pricesheets/id_billingprofile.go index dc8cf23d27d..f902603a082 100644 --- a/resource-manager/costmanagement/2022-10-01/pricesheets/id_billingprofile.go +++ b/resource-manager/costmanagement/2022-10-01/pricesheets/id_billingprofile.go @@ -34,15 +34,9 @@ func ParseBillingProfileID(input string) (*BillingProfileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) - } - - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseBillingProfileIDInsensitively(input string) (*BillingProfileId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + return &id, nil +} + +func (id *BillingProfileId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) } - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if id.BillingProfileId, ok = input.Parsed["billingProfileId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", input) } - return &id, nil + return nil } // ValidateBillingProfileID checks that 'input' can be parsed as a Billing Profile ID diff --git a/resource-manager/costmanagement/2022-10-01/pricesheets/id_invoice.go b/resource-manager/costmanagement/2022-10-01/pricesheets/id_invoice.go index 013cbe0f6d3..014474a91e3 100644 --- a/resource-manager/costmanagement/2022-10-01/pricesheets/id_invoice.go +++ b/resource-manager/costmanagement/2022-10-01/pricesheets/id_invoice.go @@ -36,19 +36,9 @@ func ParseInvoiceID(input string) (*InvoiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InvoiceId{} - - if id.BillingAccountName, ok = parsed.Parsed["billingAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountName", *parsed) - } - - if id.BillingProfileName, ok = parsed.Parsed["billingProfileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileName", *parsed) - } - - if id.InvoiceName, ok = parsed.Parsed["invoiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "invoiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseInvoiceIDInsensitively(input string) (*InvoiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InvoiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.BillingAccountName, ok = parsed.Parsed["billingAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountName", *parsed) +func (id *InvoiceId) 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 = parsed.Parsed["billingProfileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileName", *parsed) + if id.BillingProfileName, ok = input.Parsed["billingProfileName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingProfileName", input) } - if id.InvoiceName, ok = parsed.Parsed["invoiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "invoiceName", *parsed) + if id.InvoiceName, ok = input.Parsed["invoiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "invoiceName", input) } - return &id, nil + return nil } // ValidateInvoiceID checks that 'input' can be parsed as a Invoice ID diff --git a/resource-manager/costmanagement/2022-10-01/query/id_externalcloudprovidertype.go b/resource-manager/costmanagement/2022-10-01/query/id_externalcloudprovidertype.go index 54fabd4e45f..29ec40983bf 100644 --- a/resource-manager/costmanagement/2022-10-01/query/id_externalcloudprovidertype.go +++ b/resource-manager/costmanagement/2022-10-01/query/id_externalcloudprovidertype.go @@ -34,23 +34,9 @@ func ParseExternalCloudProviderTypeID(input string) (*ExternalCloudProviderTypeI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExternalCloudProviderTypeId{} - - if v, ok := parsed.Parsed["externalCloudProviderType"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderType", *parsed) - } - - externalCloudProviderType, err := parseExternalCloudProviderType(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.ExternalCloudProviderType = *externalCloudProviderType - } - - if id.ExternalCloudProviderId, ok = parsed.Parsed["externalCloudProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -65,26 +51,34 @@ func ParseExternalCloudProviderTypeIDInsensitively(input string) (*ExternalCloud return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExternalCloudProviderTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if v, ok := parsed.Parsed["externalCloudProviderType"]; true { + return &id, nil +} + +func (id *ExternalCloudProviderTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if v, ok := input.Parsed["externalCloudProviderType"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderType", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderType", input) } externalCloudProviderType, err := parseExternalCloudProviderType(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.ExternalCloudProviderType = *externalCloudProviderType } - if id.ExternalCloudProviderId, ok = parsed.Parsed["externalCloudProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderId", *parsed) + if id.ExternalCloudProviderId, ok = input.Parsed["externalCloudProviderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderId", input) } - return &id, nil + return nil } // ValidateExternalCloudProviderTypeID checks that 'input' can be parsed as a External Cloud Provider Type ID diff --git a/resource-manager/costmanagement/2022-10-01/reservedinstances/id_billingaccount.go b/resource-manager/costmanagement/2022-10-01/reservedinstances/id_billingaccount.go index ea6e51b561a..3a014995a80 100644 --- a/resource-manager/costmanagement/2022-10-01/reservedinstances/id_billingaccount.go +++ b/resource-manager/costmanagement/2022-10-01/reservedinstances/id_billingaccount.go @@ -32,11 +32,9 @@ func ParseBillingAccountID(input string) (*BillingAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseBillingAccountIDInsensitively(input string) (*BillingAccountId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *BillingAccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) + } + + return nil +} + // ValidateBillingAccountID checks that 'input' can be parsed as a Billing Account ID func ValidateBillingAccountID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/costmanagement/2022-10-01/reservedinstances/id_billingprofile.go b/resource-manager/costmanagement/2022-10-01/reservedinstances/id_billingprofile.go index 3d07dcd0f3e..d0923149768 100644 --- a/resource-manager/costmanagement/2022-10-01/reservedinstances/id_billingprofile.go +++ b/resource-manager/costmanagement/2022-10-01/reservedinstances/id_billingprofile.go @@ -34,15 +34,9 @@ func ParseBillingProfileID(input string) (*BillingProfileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) - } - - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseBillingProfileIDInsensitively(input string) (*BillingProfileId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + return &id, nil +} + +func (id *BillingProfileId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) } - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if id.BillingProfileId, ok = input.Parsed["billingProfileId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", input) } - return &id, nil + return nil } // ValidateBillingProfileID checks that 'input' can be parsed as a Billing Profile ID diff --git a/resource-manager/costmanagement/2022-10-01/scheduledactions/id_scheduledaction.go b/resource-manager/costmanagement/2022-10-01/scheduledactions/id_scheduledaction.go index b5d002d4286..69c04db60b5 100644 --- a/resource-manager/costmanagement/2022-10-01/scheduledactions/id_scheduledaction.go +++ b/resource-manager/costmanagement/2022-10-01/scheduledactions/id_scheduledaction.go @@ -32,11 +32,9 @@ func ParseScheduledActionID(input string) (*ScheduledActionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScheduledActionId{} - - if id.ScheduledActionName, ok = parsed.Parsed["scheduledActionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduledActionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseScheduledActionIDInsensitively(input string) (*ScheduledActionId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScheduledActionId{} - - if id.ScheduledActionName, ok = parsed.Parsed["scheduledActionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduledActionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *ScheduledActionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ScheduledActionName, ok = input.Parsed["scheduledActionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scheduledActionName", input) + } + + return nil +} + // ValidateScheduledActionID checks that 'input' can be parsed as a Scheduled Action ID func ValidateScheduledActionID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/costmanagement/2022-10-01/scheduledactions/id_scopedscheduledaction.go b/resource-manager/costmanagement/2022-10-01/scheduledactions/id_scopedscheduledaction.go index 3e166c601f4..a5b593cd533 100644 --- a/resource-manager/costmanagement/2022-10-01/scheduledactions/id_scopedscheduledaction.go +++ b/resource-manager/costmanagement/2022-10-01/scheduledactions/id_scopedscheduledaction.go @@ -34,15 +34,9 @@ func ParseScopedScheduledActionID(input string) (*ScopedScheduledActionId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedScheduledActionId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.ScheduledActionName, ok = parsed.Parsed["scheduledActionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduledActionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedScheduledActionIDInsensitively(input string) (*ScopedScheduledAc return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedScheduledActionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedScheduledActionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.ScheduledActionName, ok = parsed.Parsed["scheduledActionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduledActionName", *parsed) + if id.ScheduledActionName, ok = input.Parsed["scheduledActionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scheduledActionName", input) } - return &id, nil + return nil } // ValidateScopedScheduledActionID checks that 'input' can be parsed as a Scoped Scheduled Action ID diff --git a/resource-manager/costmanagement/2022-10-01/views/id_scopedview.go b/resource-manager/costmanagement/2022-10-01/views/id_scopedview.go index 788d550f865..f2575e1e520 100644 --- a/resource-manager/costmanagement/2022-10-01/views/id_scopedview.go +++ b/resource-manager/costmanagement/2022-10-01/views/id_scopedview.go @@ -34,15 +34,9 @@ func ParseScopedViewID(input string) (*ScopedViewId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedViewId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.ViewName, ok = parsed.Parsed["viewName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "viewName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedViewIDInsensitively(input string) (*ScopedViewId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedViewId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedViewId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.ViewName, ok = parsed.Parsed["viewName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "viewName", *parsed) + if id.ViewName, ok = input.Parsed["viewName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "viewName", input) } - return &id, nil + return nil } // ValidateScopedViewID checks that 'input' can be parsed as a Scoped View ID diff --git a/resource-manager/costmanagement/2022-10-01/views/id_view.go b/resource-manager/costmanagement/2022-10-01/views/id_view.go index b4cc2295d4a..e1afb0fe35b 100644 --- a/resource-manager/costmanagement/2022-10-01/views/id_view.go +++ b/resource-manager/costmanagement/2022-10-01/views/id_view.go @@ -32,11 +32,9 @@ func ParseViewID(input string) (*ViewId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ViewId{} - - if id.ViewName, ok = parsed.Parsed["viewName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "viewName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseViewIDInsensitively(input string) (*ViewId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ViewId{} - - if id.ViewName, ok = parsed.Parsed["viewName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "viewName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *ViewId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ViewName, ok = input.Parsed["viewName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "viewName", input) + } + + return nil +} + // ValidateViewID checks that 'input' can be parsed as a View ID func ValidateViewID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/costmanagement/2023-03-01/alerts/id_externalcloudprovidertype.go b/resource-manager/costmanagement/2023-03-01/alerts/id_externalcloudprovidertype.go index bc7a4d67b2b..1d1a1d8fad6 100644 --- a/resource-manager/costmanagement/2023-03-01/alerts/id_externalcloudprovidertype.go +++ b/resource-manager/costmanagement/2023-03-01/alerts/id_externalcloudprovidertype.go @@ -34,23 +34,9 @@ func ParseExternalCloudProviderTypeID(input string) (*ExternalCloudProviderTypeI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExternalCloudProviderTypeId{} - - if v, ok := parsed.Parsed["externalCloudProviderType"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderType", *parsed) - } - - externalCloudProviderType, err := parseExternalCloudProviderType(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.ExternalCloudProviderType = *externalCloudProviderType - } - - if id.ExternalCloudProviderId, ok = parsed.Parsed["externalCloudProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -65,26 +51,34 @@ func ParseExternalCloudProviderTypeIDInsensitively(input string) (*ExternalCloud return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExternalCloudProviderTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if v, ok := parsed.Parsed["externalCloudProviderType"]; true { + return &id, nil +} + +func (id *ExternalCloudProviderTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if v, ok := input.Parsed["externalCloudProviderType"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderType", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderType", input) } externalCloudProviderType, err := parseExternalCloudProviderType(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.ExternalCloudProviderType = *externalCloudProviderType } - if id.ExternalCloudProviderId, ok = parsed.Parsed["externalCloudProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderId", *parsed) + if id.ExternalCloudProviderId, ok = input.Parsed["externalCloudProviderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderId", input) } - return &id, nil + return nil } // ValidateExternalCloudProviderTypeID checks that 'input' can be parsed as a External Cloud Provider Type ID diff --git a/resource-manager/costmanagement/2023-03-01/alerts/id_scopedalert.go b/resource-manager/costmanagement/2023-03-01/alerts/id_scopedalert.go index 6420ed91bcb..79a690ab809 100644 --- a/resource-manager/costmanagement/2023-03-01/alerts/id_scopedalert.go +++ b/resource-manager/costmanagement/2023-03-01/alerts/id_scopedalert.go @@ -34,15 +34,9 @@ func ParseScopedAlertID(input string) (*ScopedAlertId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedAlertId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.AlertId, ok = parsed.Parsed["alertId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "alertId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedAlertIDInsensitively(input string) (*ScopedAlertId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedAlertId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedAlertId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.AlertId, ok = parsed.Parsed["alertId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "alertId", *parsed) + if id.AlertId, ok = input.Parsed["alertId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "alertId", input) } - return &id, nil + return nil } // ValidateScopedAlertID checks that 'input' can be parsed as a Scoped Alert ID diff --git a/resource-manager/costmanagement/2023-03-01/benefitutilizationsummaries/id_billingaccount.go b/resource-manager/costmanagement/2023-03-01/benefitutilizationsummaries/id_billingaccount.go index 6f0192eb4b7..40a5ecad16b 100644 --- a/resource-manager/costmanagement/2023-03-01/benefitutilizationsummaries/id_billingaccount.go +++ b/resource-manager/costmanagement/2023-03-01/benefitutilizationsummaries/id_billingaccount.go @@ -32,11 +32,9 @@ func ParseBillingAccountID(input string) (*BillingAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseBillingAccountIDInsensitively(input string) (*BillingAccountId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *BillingAccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) + } + + return nil +} + // ValidateBillingAccountID checks that 'input' can be parsed as a Billing Account ID func ValidateBillingAccountID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/costmanagement/2023-03-01/benefitutilizationsummaries/id_billingprofile.go b/resource-manager/costmanagement/2023-03-01/benefitutilizationsummaries/id_billingprofile.go index 6d38d677254..279ae3339bb 100644 --- a/resource-manager/costmanagement/2023-03-01/benefitutilizationsummaries/id_billingprofile.go +++ b/resource-manager/costmanagement/2023-03-01/benefitutilizationsummaries/id_billingprofile.go @@ -34,15 +34,9 @@ func ParseBillingProfileID(input string) (*BillingProfileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) - } - - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseBillingProfileIDInsensitively(input string) (*BillingProfileId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + return &id, nil +} + +func (id *BillingProfileId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) } - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if id.BillingProfileId, ok = input.Parsed["billingProfileId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", input) } - return &id, nil + return nil } // ValidateBillingProfileID checks that 'input' can be parsed as a Billing Profile ID diff --git a/resource-manager/costmanagement/2023-03-01/benefitutilizationsummaries/id_savingsplan.go b/resource-manager/costmanagement/2023-03-01/benefitutilizationsummaries/id_savingsplan.go index e5c1c50ddbd..423dcd832fc 100644 --- a/resource-manager/costmanagement/2023-03-01/benefitutilizationsummaries/id_savingsplan.go +++ b/resource-manager/costmanagement/2023-03-01/benefitutilizationsummaries/id_savingsplan.go @@ -34,15 +34,9 @@ func ParseSavingsPlanID(input string) (*SavingsPlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SavingsPlanId{} - - if id.SavingsPlanOrderId, ok = parsed.Parsed["savingsPlanOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "savingsPlanOrderId", *parsed) - } - - if id.SavingsPlanId, ok = parsed.Parsed["savingsPlanId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "savingsPlanId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseSavingsPlanIDInsensitively(input string) (*SavingsPlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SavingsPlanId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SavingsPlanOrderId, ok = parsed.Parsed["savingsPlanOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "savingsPlanOrderId", *parsed) + return &id, nil +} + +func (id *SavingsPlanId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SavingsPlanOrderId, ok = input.Parsed["savingsPlanOrderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "savingsPlanOrderId", input) } - if id.SavingsPlanId, ok = parsed.Parsed["savingsPlanId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "savingsPlanId", *parsed) + if id.SavingsPlanId, ok = input.Parsed["savingsPlanId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "savingsPlanId", input) } - return &id, nil + return nil } // ValidateSavingsPlanID checks that 'input' can be parsed as a Savings Plan ID diff --git a/resource-manager/costmanagement/2023-03-01/benefitutilizationsummaries/id_savingsplanorder.go b/resource-manager/costmanagement/2023-03-01/benefitutilizationsummaries/id_savingsplanorder.go index f3b22fdfd4a..b15a22d32d4 100644 --- a/resource-manager/costmanagement/2023-03-01/benefitutilizationsummaries/id_savingsplanorder.go +++ b/resource-manager/costmanagement/2023-03-01/benefitutilizationsummaries/id_savingsplanorder.go @@ -32,11 +32,9 @@ func ParseSavingsPlanOrderID(input string) (*SavingsPlanOrderId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SavingsPlanOrderId{} - - if id.SavingsPlanOrderId, ok = parsed.Parsed["savingsPlanOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "savingsPlanOrderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseSavingsPlanOrderIDInsensitively(input string) (*SavingsPlanOrderId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SavingsPlanOrderId{} - - if id.SavingsPlanOrderId, ok = parsed.Parsed["savingsPlanOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "savingsPlanOrderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *SavingsPlanOrderId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SavingsPlanOrderId, ok = input.Parsed["savingsPlanOrderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "savingsPlanOrderId", input) + } + + return nil +} + // ValidateSavingsPlanOrderID checks that 'input' can be parsed as a Savings Plan Order ID func ValidateSavingsPlanOrderID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/costmanagement/2023-03-01/benefitutilizationsummariesasync/id_billingaccount.go b/resource-manager/costmanagement/2023-03-01/benefitutilizationsummariesasync/id_billingaccount.go index 4266f68ba7f..9a272806c89 100644 --- a/resource-manager/costmanagement/2023-03-01/benefitutilizationsummariesasync/id_billingaccount.go +++ b/resource-manager/costmanagement/2023-03-01/benefitutilizationsummariesasync/id_billingaccount.go @@ -32,11 +32,9 @@ func ParseBillingAccountID(input string) (*BillingAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseBillingAccountIDInsensitively(input string) (*BillingAccountId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *BillingAccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) + } + + return nil +} + // ValidateBillingAccountID checks that 'input' can be parsed as a Billing Account ID func ValidateBillingAccountID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/costmanagement/2023-03-01/benefitutilizationsummariesasync/id_billingprofile.go b/resource-manager/costmanagement/2023-03-01/benefitutilizationsummariesasync/id_billingprofile.go index d25ff9a5af5..db3bfd90f0f 100644 --- a/resource-manager/costmanagement/2023-03-01/benefitutilizationsummariesasync/id_billingprofile.go +++ b/resource-manager/costmanagement/2023-03-01/benefitutilizationsummariesasync/id_billingprofile.go @@ -34,15 +34,9 @@ func ParseBillingProfileID(input string) (*BillingProfileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) - } - - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseBillingProfileIDInsensitively(input string) (*BillingProfileId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + return &id, nil +} + +func (id *BillingProfileId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) } - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if id.BillingProfileId, ok = input.Parsed["billingProfileId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", input) } - return &id, nil + return nil } // ValidateBillingProfileID checks that 'input' can be parsed as a Billing Profile ID diff --git a/resource-manager/costmanagement/2023-03-01/benefitutilizationsummariesasync/id_reservation.go b/resource-manager/costmanagement/2023-03-01/benefitutilizationsummariesasync/id_reservation.go index 7c38899cf87..0b6ddcaede6 100644 --- a/resource-manager/costmanagement/2023-03-01/benefitutilizationsummariesasync/id_reservation.go +++ b/resource-manager/costmanagement/2023-03-01/benefitutilizationsummariesasync/id_reservation.go @@ -34,15 +34,9 @@ func ParseReservationID(input string) (*ReservationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReservationId{} - - if id.ReservationOrderId, ok = parsed.Parsed["reservationOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", *parsed) - } - - if id.ReservationId, ok = parsed.Parsed["reservationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseReservationIDInsensitively(input string) (*ReservationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReservationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ReservationOrderId, ok = parsed.Parsed["reservationOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", *parsed) + return &id, nil +} + +func (id *ReservationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ReservationOrderId, ok = input.Parsed["reservationOrderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", input) } - if id.ReservationId, ok = parsed.Parsed["reservationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationId", *parsed) + if id.ReservationId, ok = input.Parsed["reservationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reservationId", input) } - return &id, nil + return nil } // ValidateReservationID checks that 'input' can be parsed as a Reservation ID diff --git a/resource-manager/costmanagement/2023-03-01/benefitutilizationsummariesasync/id_reservationorder.go b/resource-manager/costmanagement/2023-03-01/benefitutilizationsummariesasync/id_reservationorder.go index 7b18988106d..95f8bdcc31b 100644 --- a/resource-manager/costmanagement/2023-03-01/benefitutilizationsummariesasync/id_reservationorder.go +++ b/resource-manager/costmanagement/2023-03-01/benefitutilizationsummariesasync/id_reservationorder.go @@ -32,11 +32,9 @@ func ParseReservationOrderID(input string) (*ReservationOrderId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReservationOrderId{} - - if id.ReservationOrderId, ok = parsed.Parsed["reservationOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseReservationOrderIDInsensitively(input string) (*ReservationOrderId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReservationOrderId{} - - if id.ReservationOrderId, ok = parsed.Parsed["reservationOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *ReservationOrderId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ReservationOrderId, ok = input.Parsed["reservationOrderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", input) + } + + return nil +} + // ValidateReservationOrderID checks that 'input' can be parsed as a Reservation Order ID func ValidateReservationOrderID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/costmanagement/2023-03-01/benefitutilizationsummariesasync/id_savingsplan.go b/resource-manager/costmanagement/2023-03-01/benefitutilizationsummariesasync/id_savingsplan.go index 1d669441295..ade1d5fbc6d 100644 --- a/resource-manager/costmanagement/2023-03-01/benefitutilizationsummariesasync/id_savingsplan.go +++ b/resource-manager/costmanagement/2023-03-01/benefitutilizationsummariesasync/id_savingsplan.go @@ -34,15 +34,9 @@ func ParseSavingsPlanID(input string) (*SavingsPlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SavingsPlanId{} - - if id.SavingsPlanOrderId, ok = parsed.Parsed["savingsPlanOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "savingsPlanOrderId", *parsed) - } - - if id.SavingsPlanId, ok = parsed.Parsed["savingsPlanId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "savingsPlanId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseSavingsPlanIDInsensitively(input string) (*SavingsPlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SavingsPlanId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SavingsPlanOrderId, ok = parsed.Parsed["savingsPlanOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "savingsPlanOrderId", *parsed) + return &id, nil +} + +func (id *SavingsPlanId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SavingsPlanOrderId, ok = input.Parsed["savingsPlanOrderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "savingsPlanOrderId", input) } - if id.SavingsPlanId, ok = parsed.Parsed["savingsPlanId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "savingsPlanId", *parsed) + if id.SavingsPlanId, ok = input.Parsed["savingsPlanId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "savingsPlanId", input) } - return &id, nil + return nil } // ValidateSavingsPlanID checks that 'input' can be parsed as a Savings Plan ID diff --git a/resource-manager/costmanagement/2023-03-01/benefitutilizationsummariesasync/id_savingsplanorder.go b/resource-manager/costmanagement/2023-03-01/benefitutilizationsummariesasync/id_savingsplanorder.go index 52bd7945014..3127eeaf170 100644 --- a/resource-manager/costmanagement/2023-03-01/benefitutilizationsummariesasync/id_savingsplanorder.go +++ b/resource-manager/costmanagement/2023-03-01/benefitutilizationsummariesasync/id_savingsplanorder.go @@ -32,11 +32,9 @@ func ParseSavingsPlanOrderID(input string) (*SavingsPlanOrderId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SavingsPlanOrderId{} - - if id.SavingsPlanOrderId, ok = parsed.Parsed["savingsPlanOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "savingsPlanOrderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseSavingsPlanOrderIDInsensitively(input string) (*SavingsPlanOrderId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SavingsPlanOrderId{} - - if id.SavingsPlanOrderId, ok = parsed.Parsed["savingsPlanOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "savingsPlanOrderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *SavingsPlanOrderId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SavingsPlanOrderId, ok = input.Parsed["savingsPlanOrderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "savingsPlanOrderId", input) + } + + return nil +} + // ValidateSavingsPlanOrderID checks that 'input' can be parsed as a Savings Plan Order ID func ValidateSavingsPlanOrderID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/costmanagement/2023-03-01/dimensions/id_externalcloudprovidertype.go b/resource-manager/costmanagement/2023-03-01/dimensions/id_externalcloudprovidertype.go index 10cbdac4f4c..84685793489 100644 --- a/resource-manager/costmanagement/2023-03-01/dimensions/id_externalcloudprovidertype.go +++ b/resource-manager/costmanagement/2023-03-01/dimensions/id_externalcloudprovidertype.go @@ -34,23 +34,9 @@ func ParseExternalCloudProviderTypeID(input string) (*ExternalCloudProviderTypeI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExternalCloudProviderTypeId{} - - if v, ok := parsed.Parsed["externalCloudProviderType"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderType", *parsed) - } - - externalCloudProviderType, err := parseExternalCloudProviderType(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.ExternalCloudProviderType = *externalCloudProviderType - } - - if id.ExternalCloudProviderId, ok = parsed.Parsed["externalCloudProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -65,26 +51,34 @@ func ParseExternalCloudProviderTypeIDInsensitively(input string) (*ExternalCloud return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExternalCloudProviderTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if v, ok := parsed.Parsed["externalCloudProviderType"]; true { + return &id, nil +} + +func (id *ExternalCloudProviderTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if v, ok := input.Parsed["externalCloudProviderType"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderType", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderType", input) } externalCloudProviderType, err := parseExternalCloudProviderType(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.ExternalCloudProviderType = *externalCloudProviderType } - if id.ExternalCloudProviderId, ok = parsed.Parsed["externalCloudProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderId", *parsed) + if id.ExternalCloudProviderId, ok = input.Parsed["externalCloudProviderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderId", input) } - return &id, nil + return nil } // ValidateExternalCloudProviderTypeID checks that 'input' can be parsed as a External Cloud Provider Type ID diff --git a/resource-manager/costmanagement/2023-03-01/exports/id_scopedexport.go b/resource-manager/costmanagement/2023-03-01/exports/id_scopedexport.go index a5546578efd..7bd79356882 100644 --- a/resource-manager/costmanagement/2023-03-01/exports/id_scopedexport.go +++ b/resource-manager/costmanagement/2023-03-01/exports/id_scopedexport.go @@ -34,15 +34,9 @@ func ParseScopedExportID(input string) (*ScopedExportId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedExportId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.ExportName, ok = parsed.Parsed["exportName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "exportName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedExportIDInsensitively(input string) (*ScopedExportId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedExportId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedExportId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.ExportName, ok = parsed.Parsed["exportName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "exportName", *parsed) + if id.ExportName, ok = input.Parsed["exportName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "exportName", input) } - return &id, nil + return nil } // ValidateScopedExportID checks that 'input' can be parsed as a Scoped Export ID diff --git a/resource-manager/costmanagement/2023-03-01/forecast/id_externalcloudprovidertype.go b/resource-manager/costmanagement/2023-03-01/forecast/id_externalcloudprovidertype.go index e43b76c4747..898f3fc76bf 100644 --- a/resource-manager/costmanagement/2023-03-01/forecast/id_externalcloudprovidertype.go +++ b/resource-manager/costmanagement/2023-03-01/forecast/id_externalcloudprovidertype.go @@ -34,23 +34,9 @@ func ParseExternalCloudProviderTypeID(input string) (*ExternalCloudProviderTypeI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExternalCloudProviderTypeId{} - - if v, ok := parsed.Parsed["externalCloudProviderType"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderType", *parsed) - } - - externalCloudProviderType, err := parseExternalCloudProviderType(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.ExternalCloudProviderType = *externalCloudProviderType - } - - if id.ExternalCloudProviderId, ok = parsed.Parsed["externalCloudProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -65,26 +51,34 @@ func ParseExternalCloudProviderTypeIDInsensitively(input string) (*ExternalCloud return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExternalCloudProviderTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if v, ok := parsed.Parsed["externalCloudProviderType"]; true { + return &id, nil +} + +func (id *ExternalCloudProviderTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if v, ok := input.Parsed["externalCloudProviderType"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderType", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderType", input) } externalCloudProviderType, err := parseExternalCloudProviderType(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.ExternalCloudProviderType = *externalCloudProviderType } - if id.ExternalCloudProviderId, ok = parsed.Parsed["externalCloudProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderId", *parsed) + if id.ExternalCloudProviderId, ok = input.Parsed["externalCloudProviderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderId", input) } - return &id, nil + return nil } // ValidateExternalCloudProviderTypeID checks that 'input' can be parsed as a External Cloud Provider Type ID diff --git a/resource-manager/costmanagement/2023-03-01/pricesheets/id_billingprofile.go b/resource-manager/costmanagement/2023-03-01/pricesheets/id_billingprofile.go index dc8cf23d27d..f902603a082 100644 --- a/resource-manager/costmanagement/2023-03-01/pricesheets/id_billingprofile.go +++ b/resource-manager/costmanagement/2023-03-01/pricesheets/id_billingprofile.go @@ -34,15 +34,9 @@ func ParseBillingProfileID(input string) (*BillingProfileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) - } - - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseBillingProfileIDInsensitively(input string) (*BillingProfileId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + return &id, nil +} + +func (id *BillingProfileId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) } - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if id.BillingProfileId, ok = input.Parsed["billingProfileId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", input) } - return &id, nil + return nil } // ValidateBillingProfileID checks that 'input' can be parsed as a Billing Profile ID diff --git a/resource-manager/costmanagement/2023-03-01/pricesheets/id_invoice.go b/resource-manager/costmanagement/2023-03-01/pricesheets/id_invoice.go index 013cbe0f6d3..014474a91e3 100644 --- a/resource-manager/costmanagement/2023-03-01/pricesheets/id_invoice.go +++ b/resource-manager/costmanagement/2023-03-01/pricesheets/id_invoice.go @@ -36,19 +36,9 @@ func ParseInvoiceID(input string) (*InvoiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InvoiceId{} - - if id.BillingAccountName, ok = parsed.Parsed["billingAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountName", *parsed) - } - - if id.BillingProfileName, ok = parsed.Parsed["billingProfileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileName", *parsed) - } - - if id.InvoiceName, ok = parsed.Parsed["invoiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "invoiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseInvoiceIDInsensitively(input string) (*InvoiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InvoiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.BillingAccountName, ok = parsed.Parsed["billingAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountName", *parsed) +func (id *InvoiceId) 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 = parsed.Parsed["billingProfileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileName", *parsed) + if id.BillingProfileName, ok = input.Parsed["billingProfileName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingProfileName", input) } - if id.InvoiceName, ok = parsed.Parsed["invoiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "invoiceName", *parsed) + if id.InvoiceName, ok = input.Parsed["invoiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "invoiceName", input) } - return &id, nil + return nil } // ValidateInvoiceID checks that 'input' can be parsed as a Invoice ID diff --git a/resource-manager/costmanagement/2023-03-01/query/id_externalcloudprovidertype.go b/resource-manager/costmanagement/2023-03-01/query/id_externalcloudprovidertype.go index 54fabd4e45f..29ec40983bf 100644 --- a/resource-manager/costmanagement/2023-03-01/query/id_externalcloudprovidertype.go +++ b/resource-manager/costmanagement/2023-03-01/query/id_externalcloudprovidertype.go @@ -34,23 +34,9 @@ func ParseExternalCloudProviderTypeID(input string) (*ExternalCloudProviderTypeI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExternalCloudProviderTypeId{} - - if v, ok := parsed.Parsed["externalCloudProviderType"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderType", *parsed) - } - - externalCloudProviderType, err := parseExternalCloudProviderType(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.ExternalCloudProviderType = *externalCloudProviderType - } - - if id.ExternalCloudProviderId, ok = parsed.Parsed["externalCloudProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -65,26 +51,34 @@ func ParseExternalCloudProviderTypeIDInsensitively(input string) (*ExternalCloud return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExternalCloudProviderTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if v, ok := parsed.Parsed["externalCloudProviderType"]; true { + return &id, nil +} + +func (id *ExternalCloudProviderTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if v, ok := input.Parsed["externalCloudProviderType"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderType", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderType", input) } externalCloudProviderType, err := parseExternalCloudProviderType(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.ExternalCloudProviderType = *externalCloudProviderType } - if id.ExternalCloudProviderId, ok = parsed.Parsed["externalCloudProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderId", *parsed) + if id.ExternalCloudProviderId, ok = input.Parsed["externalCloudProviderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderId", input) } - return &id, nil + return nil } // ValidateExternalCloudProviderTypeID checks that 'input' can be parsed as a External Cloud Provider Type ID diff --git a/resource-manager/costmanagement/2023-03-01/reservedinstances/id_billingaccount.go b/resource-manager/costmanagement/2023-03-01/reservedinstances/id_billingaccount.go index ea6e51b561a..3a014995a80 100644 --- a/resource-manager/costmanagement/2023-03-01/reservedinstances/id_billingaccount.go +++ b/resource-manager/costmanagement/2023-03-01/reservedinstances/id_billingaccount.go @@ -32,11 +32,9 @@ func ParseBillingAccountID(input string) (*BillingAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseBillingAccountIDInsensitively(input string) (*BillingAccountId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *BillingAccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) + } + + return nil +} + // ValidateBillingAccountID checks that 'input' can be parsed as a Billing Account ID func ValidateBillingAccountID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/costmanagement/2023-03-01/reservedinstances/id_billingprofile.go b/resource-manager/costmanagement/2023-03-01/reservedinstances/id_billingprofile.go index 3d07dcd0f3e..d0923149768 100644 --- a/resource-manager/costmanagement/2023-03-01/reservedinstances/id_billingprofile.go +++ b/resource-manager/costmanagement/2023-03-01/reservedinstances/id_billingprofile.go @@ -34,15 +34,9 @@ func ParseBillingProfileID(input string) (*BillingProfileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) - } - - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseBillingProfileIDInsensitively(input string) (*BillingProfileId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + return &id, nil +} + +func (id *BillingProfileId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) } - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if id.BillingProfileId, ok = input.Parsed["billingProfileId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", input) } - return &id, nil + return nil } // ValidateBillingProfileID checks that 'input' can be parsed as a Billing Profile ID diff --git a/resource-manager/costmanagement/2023-03-01/scheduledactions/id_scheduledaction.go b/resource-manager/costmanagement/2023-03-01/scheduledactions/id_scheduledaction.go index b5d002d4286..69c04db60b5 100644 --- a/resource-manager/costmanagement/2023-03-01/scheduledactions/id_scheduledaction.go +++ b/resource-manager/costmanagement/2023-03-01/scheduledactions/id_scheduledaction.go @@ -32,11 +32,9 @@ func ParseScheduledActionID(input string) (*ScheduledActionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScheduledActionId{} - - if id.ScheduledActionName, ok = parsed.Parsed["scheduledActionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduledActionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseScheduledActionIDInsensitively(input string) (*ScheduledActionId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScheduledActionId{} - - if id.ScheduledActionName, ok = parsed.Parsed["scheduledActionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduledActionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *ScheduledActionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ScheduledActionName, ok = input.Parsed["scheduledActionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scheduledActionName", input) + } + + return nil +} + // ValidateScheduledActionID checks that 'input' can be parsed as a Scheduled Action ID func ValidateScheduledActionID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/costmanagement/2023-03-01/scheduledactions/id_scopedscheduledaction.go b/resource-manager/costmanagement/2023-03-01/scheduledactions/id_scopedscheduledaction.go index 3e166c601f4..a5b593cd533 100644 --- a/resource-manager/costmanagement/2023-03-01/scheduledactions/id_scopedscheduledaction.go +++ b/resource-manager/costmanagement/2023-03-01/scheduledactions/id_scopedscheduledaction.go @@ -34,15 +34,9 @@ func ParseScopedScheduledActionID(input string) (*ScopedScheduledActionId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedScheduledActionId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.ScheduledActionName, ok = parsed.Parsed["scheduledActionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduledActionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedScheduledActionIDInsensitively(input string) (*ScopedScheduledAc return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedScheduledActionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedScheduledActionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.ScheduledActionName, ok = parsed.Parsed["scheduledActionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduledActionName", *parsed) + if id.ScheduledActionName, ok = input.Parsed["scheduledActionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scheduledActionName", input) } - return &id, nil + return nil } // ValidateScopedScheduledActionID checks that 'input' can be parsed as a Scoped Scheduled Action ID diff --git a/resource-manager/costmanagement/2023-03-01/views/id_scopedview.go b/resource-manager/costmanagement/2023-03-01/views/id_scopedview.go index 788d550f865..f2575e1e520 100644 --- a/resource-manager/costmanagement/2023-03-01/views/id_scopedview.go +++ b/resource-manager/costmanagement/2023-03-01/views/id_scopedview.go @@ -34,15 +34,9 @@ func ParseScopedViewID(input string) (*ScopedViewId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedViewId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.ViewName, ok = parsed.Parsed["viewName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "viewName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedViewIDInsensitively(input string) (*ScopedViewId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedViewId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedViewId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.ViewName, ok = parsed.Parsed["viewName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "viewName", *parsed) + if id.ViewName, ok = input.Parsed["viewName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "viewName", input) } - return &id, nil + return nil } // ValidateScopedViewID checks that 'input' can be parsed as a Scoped View ID diff --git a/resource-manager/costmanagement/2023-03-01/views/id_view.go b/resource-manager/costmanagement/2023-03-01/views/id_view.go index b4cc2295d4a..e1afb0fe35b 100644 --- a/resource-manager/costmanagement/2023-03-01/views/id_view.go +++ b/resource-manager/costmanagement/2023-03-01/views/id_view.go @@ -32,11 +32,9 @@ func ParseViewID(input string) (*ViewId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ViewId{} - - if id.ViewName, ok = parsed.Parsed["viewName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "viewName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseViewIDInsensitively(input string) (*ViewId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ViewId{} - - if id.ViewName, ok = parsed.Parsed["viewName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "viewName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *ViewId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ViewName, ok = input.Parsed["viewName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "viewName", input) + } + + return nil +} + // ValidateViewID checks that 'input' can be parsed as a View ID func ValidateViewID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/costmanagement/2023-08-01/alerts/id_externalcloudprovidertype.go b/resource-manager/costmanagement/2023-08-01/alerts/id_externalcloudprovidertype.go index bc7a4d67b2b..1d1a1d8fad6 100644 --- a/resource-manager/costmanagement/2023-08-01/alerts/id_externalcloudprovidertype.go +++ b/resource-manager/costmanagement/2023-08-01/alerts/id_externalcloudprovidertype.go @@ -34,23 +34,9 @@ func ParseExternalCloudProviderTypeID(input string) (*ExternalCloudProviderTypeI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExternalCloudProviderTypeId{} - - if v, ok := parsed.Parsed["externalCloudProviderType"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderType", *parsed) - } - - externalCloudProviderType, err := parseExternalCloudProviderType(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.ExternalCloudProviderType = *externalCloudProviderType - } - - if id.ExternalCloudProviderId, ok = parsed.Parsed["externalCloudProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -65,26 +51,34 @@ func ParseExternalCloudProviderTypeIDInsensitively(input string) (*ExternalCloud return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExternalCloudProviderTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if v, ok := parsed.Parsed["externalCloudProviderType"]; true { + return &id, nil +} + +func (id *ExternalCloudProviderTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if v, ok := input.Parsed["externalCloudProviderType"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderType", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderType", input) } externalCloudProviderType, err := parseExternalCloudProviderType(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.ExternalCloudProviderType = *externalCloudProviderType } - if id.ExternalCloudProviderId, ok = parsed.Parsed["externalCloudProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderId", *parsed) + if id.ExternalCloudProviderId, ok = input.Parsed["externalCloudProviderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderId", input) } - return &id, nil + return nil } // ValidateExternalCloudProviderTypeID checks that 'input' can be parsed as a External Cloud Provider Type ID diff --git a/resource-manager/costmanagement/2023-08-01/alerts/id_scopedalert.go b/resource-manager/costmanagement/2023-08-01/alerts/id_scopedalert.go index 6420ed91bcb..79a690ab809 100644 --- a/resource-manager/costmanagement/2023-08-01/alerts/id_scopedalert.go +++ b/resource-manager/costmanagement/2023-08-01/alerts/id_scopedalert.go @@ -34,15 +34,9 @@ func ParseScopedAlertID(input string) (*ScopedAlertId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedAlertId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.AlertId, ok = parsed.Parsed["alertId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "alertId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedAlertIDInsensitively(input string) (*ScopedAlertId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedAlertId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedAlertId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.AlertId, ok = parsed.Parsed["alertId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "alertId", *parsed) + if id.AlertId, ok = input.Parsed["alertId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "alertId", input) } - return &id, nil + return nil } // ValidateScopedAlertID checks that 'input' can be parsed as a Scoped Alert ID diff --git a/resource-manager/costmanagement/2023-08-01/benefitutilizationsummaries/id_billingaccount.go b/resource-manager/costmanagement/2023-08-01/benefitutilizationsummaries/id_billingaccount.go index 6f0192eb4b7..40a5ecad16b 100644 --- a/resource-manager/costmanagement/2023-08-01/benefitutilizationsummaries/id_billingaccount.go +++ b/resource-manager/costmanagement/2023-08-01/benefitutilizationsummaries/id_billingaccount.go @@ -32,11 +32,9 @@ func ParseBillingAccountID(input string) (*BillingAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseBillingAccountIDInsensitively(input string) (*BillingAccountId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *BillingAccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) + } + + return nil +} + // ValidateBillingAccountID checks that 'input' can be parsed as a Billing Account ID func ValidateBillingAccountID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/costmanagement/2023-08-01/benefitutilizationsummaries/id_billingprofile.go b/resource-manager/costmanagement/2023-08-01/benefitutilizationsummaries/id_billingprofile.go index 6d38d677254..279ae3339bb 100644 --- a/resource-manager/costmanagement/2023-08-01/benefitutilizationsummaries/id_billingprofile.go +++ b/resource-manager/costmanagement/2023-08-01/benefitutilizationsummaries/id_billingprofile.go @@ -34,15 +34,9 @@ func ParseBillingProfileID(input string) (*BillingProfileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) - } - - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseBillingProfileIDInsensitively(input string) (*BillingProfileId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + return &id, nil +} + +func (id *BillingProfileId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) } - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if id.BillingProfileId, ok = input.Parsed["billingProfileId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", input) } - return &id, nil + return nil } // ValidateBillingProfileID checks that 'input' can be parsed as a Billing Profile ID diff --git a/resource-manager/costmanagement/2023-08-01/benefitutilizationsummaries/id_savingsplan.go b/resource-manager/costmanagement/2023-08-01/benefitutilizationsummaries/id_savingsplan.go index e5c1c50ddbd..423dcd832fc 100644 --- a/resource-manager/costmanagement/2023-08-01/benefitutilizationsummaries/id_savingsplan.go +++ b/resource-manager/costmanagement/2023-08-01/benefitutilizationsummaries/id_savingsplan.go @@ -34,15 +34,9 @@ func ParseSavingsPlanID(input string) (*SavingsPlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SavingsPlanId{} - - if id.SavingsPlanOrderId, ok = parsed.Parsed["savingsPlanOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "savingsPlanOrderId", *parsed) - } - - if id.SavingsPlanId, ok = parsed.Parsed["savingsPlanId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "savingsPlanId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseSavingsPlanIDInsensitively(input string) (*SavingsPlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SavingsPlanId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SavingsPlanOrderId, ok = parsed.Parsed["savingsPlanOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "savingsPlanOrderId", *parsed) + return &id, nil +} + +func (id *SavingsPlanId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SavingsPlanOrderId, ok = input.Parsed["savingsPlanOrderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "savingsPlanOrderId", input) } - if id.SavingsPlanId, ok = parsed.Parsed["savingsPlanId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "savingsPlanId", *parsed) + if id.SavingsPlanId, ok = input.Parsed["savingsPlanId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "savingsPlanId", input) } - return &id, nil + return nil } // ValidateSavingsPlanID checks that 'input' can be parsed as a Savings Plan ID diff --git a/resource-manager/costmanagement/2023-08-01/benefitutilizationsummaries/id_savingsplanorder.go b/resource-manager/costmanagement/2023-08-01/benefitutilizationsummaries/id_savingsplanorder.go index f3b22fdfd4a..b15a22d32d4 100644 --- a/resource-manager/costmanagement/2023-08-01/benefitutilizationsummaries/id_savingsplanorder.go +++ b/resource-manager/costmanagement/2023-08-01/benefitutilizationsummaries/id_savingsplanorder.go @@ -32,11 +32,9 @@ func ParseSavingsPlanOrderID(input string) (*SavingsPlanOrderId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SavingsPlanOrderId{} - - if id.SavingsPlanOrderId, ok = parsed.Parsed["savingsPlanOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "savingsPlanOrderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseSavingsPlanOrderIDInsensitively(input string) (*SavingsPlanOrderId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SavingsPlanOrderId{} - - if id.SavingsPlanOrderId, ok = parsed.Parsed["savingsPlanOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "savingsPlanOrderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *SavingsPlanOrderId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SavingsPlanOrderId, ok = input.Parsed["savingsPlanOrderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "savingsPlanOrderId", input) + } + + return nil +} + // ValidateSavingsPlanOrderID checks that 'input' can be parsed as a Savings Plan Order ID func ValidateSavingsPlanOrderID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/costmanagement/2023-08-01/benefitutilizationsummariesasync/id_billingaccount.go b/resource-manager/costmanagement/2023-08-01/benefitutilizationsummariesasync/id_billingaccount.go index 4266f68ba7f..9a272806c89 100644 --- a/resource-manager/costmanagement/2023-08-01/benefitutilizationsummariesasync/id_billingaccount.go +++ b/resource-manager/costmanagement/2023-08-01/benefitutilizationsummariesasync/id_billingaccount.go @@ -32,11 +32,9 @@ func ParseBillingAccountID(input string) (*BillingAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseBillingAccountIDInsensitively(input string) (*BillingAccountId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *BillingAccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) + } + + return nil +} + // ValidateBillingAccountID checks that 'input' can be parsed as a Billing Account ID func ValidateBillingAccountID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/costmanagement/2023-08-01/benefitutilizationsummariesasync/id_billingprofile.go b/resource-manager/costmanagement/2023-08-01/benefitutilizationsummariesasync/id_billingprofile.go index d25ff9a5af5..db3bfd90f0f 100644 --- a/resource-manager/costmanagement/2023-08-01/benefitutilizationsummariesasync/id_billingprofile.go +++ b/resource-manager/costmanagement/2023-08-01/benefitutilizationsummariesasync/id_billingprofile.go @@ -34,15 +34,9 @@ func ParseBillingProfileID(input string) (*BillingProfileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) - } - - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseBillingProfileIDInsensitively(input string) (*BillingProfileId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + return &id, nil +} + +func (id *BillingProfileId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) } - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if id.BillingProfileId, ok = input.Parsed["billingProfileId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", input) } - return &id, nil + return nil } // ValidateBillingProfileID checks that 'input' can be parsed as a Billing Profile ID diff --git a/resource-manager/costmanagement/2023-08-01/benefitutilizationsummariesasync/id_reservation.go b/resource-manager/costmanagement/2023-08-01/benefitutilizationsummariesasync/id_reservation.go index 7c38899cf87..0b6ddcaede6 100644 --- a/resource-manager/costmanagement/2023-08-01/benefitutilizationsummariesasync/id_reservation.go +++ b/resource-manager/costmanagement/2023-08-01/benefitutilizationsummariesasync/id_reservation.go @@ -34,15 +34,9 @@ func ParseReservationID(input string) (*ReservationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReservationId{} - - if id.ReservationOrderId, ok = parsed.Parsed["reservationOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", *parsed) - } - - if id.ReservationId, ok = parsed.Parsed["reservationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseReservationIDInsensitively(input string) (*ReservationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReservationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ReservationOrderId, ok = parsed.Parsed["reservationOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", *parsed) + return &id, nil +} + +func (id *ReservationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ReservationOrderId, ok = input.Parsed["reservationOrderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", input) } - if id.ReservationId, ok = parsed.Parsed["reservationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationId", *parsed) + if id.ReservationId, ok = input.Parsed["reservationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reservationId", input) } - return &id, nil + return nil } // ValidateReservationID checks that 'input' can be parsed as a Reservation ID diff --git a/resource-manager/costmanagement/2023-08-01/benefitutilizationsummariesasync/id_reservationorder.go b/resource-manager/costmanagement/2023-08-01/benefitutilizationsummariesasync/id_reservationorder.go index 7b18988106d..95f8bdcc31b 100644 --- a/resource-manager/costmanagement/2023-08-01/benefitutilizationsummariesasync/id_reservationorder.go +++ b/resource-manager/costmanagement/2023-08-01/benefitutilizationsummariesasync/id_reservationorder.go @@ -32,11 +32,9 @@ func ParseReservationOrderID(input string) (*ReservationOrderId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReservationOrderId{} - - if id.ReservationOrderId, ok = parsed.Parsed["reservationOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseReservationOrderIDInsensitively(input string) (*ReservationOrderId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReservationOrderId{} - - if id.ReservationOrderId, ok = parsed.Parsed["reservationOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *ReservationOrderId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ReservationOrderId, ok = input.Parsed["reservationOrderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reservationOrderId", input) + } + + return nil +} + // ValidateReservationOrderID checks that 'input' can be parsed as a Reservation Order ID func ValidateReservationOrderID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/costmanagement/2023-08-01/benefitutilizationsummariesasync/id_savingsplan.go b/resource-manager/costmanagement/2023-08-01/benefitutilizationsummariesasync/id_savingsplan.go index 1d669441295..ade1d5fbc6d 100644 --- a/resource-manager/costmanagement/2023-08-01/benefitutilizationsummariesasync/id_savingsplan.go +++ b/resource-manager/costmanagement/2023-08-01/benefitutilizationsummariesasync/id_savingsplan.go @@ -34,15 +34,9 @@ func ParseSavingsPlanID(input string) (*SavingsPlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SavingsPlanId{} - - if id.SavingsPlanOrderId, ok = parsed.Parsed["savingsPlanOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "savingsPlanOrderId", *parsed) - } - - if id.SavingsPlanId, ok = parsed.Parsed["savingsPlanId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "savingsPlanId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseSavingsPlanIDInsensitively(input string) (*SavingsPlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SavingsPlanId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SavingsPlanOrderId, ok = parsed.Parsed["savingsPlanOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "savingsPlanOrderId", *parsed) + return &id, nil +} + +func (id *SavingsPlanId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SavingsPlanOrderId, ok = input.Parsed["savingsPlanOrderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "savingsPlanOrderId", input) } - if id.SavingsPlanId, ok = parsed.Parsed["savingsPlanId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "savingsPlanId", *parsed) + if id.SavingsPlanId, ok = input.Parsed["savingsPlanId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "savingsPlanId", input) } - return &id, nil + return nil } // ValidateSavingsPlanID checks that 'input' can be parsed as a Savings Plan ID diff --git a/resource-manager/costmanagement/2023-08-01/benefitutilizationsummariesasync/id_savingsplanorder.go b/resource-manager/costmanagement/2023-08-01/benefitutilizationsummariesasync/id_savingsplanorder.go index 52bd7945014..3127eeaf170 100644 --- a/resource-manager/costmanagement/2023-08-01/benefitutilizationsummariesasync/id_savingsplanorder.go +++ b/resource-manager/costmanagement/2023-08-01/benefitutilizationsummariesasync/id_savingsplanorder.go @@ -32,11 +32,9 @@ func ParseSavingsPlanOrderID(input string) (*SavingsPlanOrderId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SavingsPlanOrderId{} - - if id.SavingsPlanOrderId, ok = parsed.Parsed["savingsPlanOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "savingsPlanOrderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseSavingsPlanOrderIDInsensitively(input string) (*SavingsPlanOrderId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SavingsPlanOrderId{} - - if id.SavingsPlanOrderId, ok = parsed.Parsed["savingsPlanOrderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "savingsPlanOrderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *SavingsPlanOrderId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SavingsPlanOrderId, ok = input.Parsed["savingsPlanOrderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "savingsPlanOrderId", input) + } + + return nil +} + // ValidateSavingsPlanOrderID checks that 'input' can be parsed as a Savings Plan Order ID func ValidateSavingsPlanOrderID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/costmanagement/2023-08-01/budgets/id_scopedbudget.go b/resource-manager/costmanagement/2023-08-01/budgets/id_scopedbudget.go index d64ed2d6d92..6b1653d6c11 100644 --- a/resource-manager/costmanagement/2023-08-01/budgets/id_scopedbudget.go +++ b/resource-manager/costmanagement/2023-08-01/budgets/id_scopedbudget.go @@ -34,15 +34,9 @@ func ParseScopedBudgetID(input string) (*ScopedBudgetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedBudgetId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.BudgetName, ok = parsed.Parsed["budgetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "budgetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedBudgetIDInsensitively(input string) (*ScopedBudgetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedBudgetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedBudgetId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.BudgetName, ok = parsed.Parsed["budgetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "budgetName", *parsed) + if id.BudgetName, ok = input.Parsed["budgetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "budgetName", input) } - return &id, nil + return nil } // ValidateScopedBudgetID checks that 'input' can be parsed as a Scoped Budget ID diff --git a/resource-manager/costmanagement/2023-08-01/costallocationrules/id_billingaccount.go b/resource-manager/costmanagement/2023-08-01/costallocationrules/id_billingaccount.go index 8483d87d0e7..9e4b3409c04 100644 --- a/resource-manager/costmanagement/2023-08-01/costallocationrules/id_billingaccount.go +++ b/resource-manager/costmanagement/2023-08-01/costallocationrules/id_billingaccount.go @@ -32,11 +32,9 @@ func ParseBillingAccountID(input string) (*BillingAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseBillingAccountIDInsensitively(input string) (*BillingAccountId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *BillingAccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) + } + + return nil +} + // ValidateBillingAccountID checks that 'input' can be parsed as a Billing Account ID func ValidateBillingAccountID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/costmanagement/2023-08-01/costallocationrules/id_costallocationrule.go b/resource-manager/costmanagement/2023-08-01/costallocationrules/id_costallocationrule.go index 5f283cf057e..e2c5c51d2ed 100644 --- a/resource-manager/costmanagement/2023-08-01/costallocationrules/id_costallocationrule.go +++ b/resource-manager/costmanagement/2023-08-01/costallocationrules/id_costallocationrule.go @@ -34,15 +34,9 @@ func ParseCostAllocationRuleID(input string) (*CostAllocationRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CostAllocationRuleId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) - } - - if id.CostAllocationRuleName, ok = parsed.Parsed["costAllocationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "costAllocationRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseCostAllocationRuleIDInsensitively(input string) (*CostAllocationRuleId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CostAllocationRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + return &id, nil +} + +func (id *CostAllocationRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) } - if id.CostAllocationRuleName, ok = parsed.Parsed["costAllocationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "costAllocationRuleName", *parsed) + if id.CostAllocationRuleName, ok = input.Parsed["costAllocationRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "costAllocationRuleName", input) } - return &id, nil + return nil } // ValidateCostAllocationRuleID checks that 'input' can be parsed as a Cost Allocation Rule ID diff --git a/resource-manager/costmanagement/2023-08-01/dimensions/id_externalcloudprovidertype.go b/resource-manager/costmanagement/2023-08-01/dimensions/id_externalcloudprovidertype.go index 10cbdac4f4c..84685793489 100644 --- a/resource-manager/costmanagement/2023-08-01/dimensions/id_externalcloudprovidertype.go +++ b/resource-manager/costmanagement/2023-08-01/dimensions/id_externalcloudprovidertype.go @@ -34,23 +34,9 @@ func ParseExternalCloudProviderTypeID(input string) (*ExternalCloudProviderTypeI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExternalCloudProviderTypeId{} - - if v, ok := parsed.Parsed["externalCloudProviderType"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderType", *parsed) - } - - externalCloudProviderType, err := parseExternalCloudProviderType(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.ExternalCloudProviderType = *externalCloudProviderType - } - - if id.ExternalCloudProviderId, ok = parsed.Parsed["externalCloudProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -65,26 +51,34 @@ func ParseExternalCloudProviderTypeIDInsensitively(input string) (*ExternalCloud return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExternalCloudProviderTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if v, ok := parsed.Parsed["externalCloudProviderType"]; true { + return &id, nil +} + +func (id *ExternalCloudProviderTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if v, ok := input.Parsed["externalCloudProviderType"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderType", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderType", input) } externalCloudProviderType, err := parseExternalCloudProviderType(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.ExternalCloudProviderType = *externalCloudProviderType } - if id.ExternalCloudProviderId, ok = parsed.Parsed["externalCloudProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderId", *parsed) + if id.ExternalCloudProviderId, ok = input.Parsed["externalCloudProviderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderId", input) } - return &id, nil + return nil } // ValidateExternalCloudProviderTypeID checks that 'input' can be parsed as a External Cloud Provider Type ID diff --git a/resource-manager/costmanagement/2023-08-01/exports/id_scopedexport.go b/resource-manager/costmanagement/2023-08-01/exports/id_scopedexport.go index a5546578efd..7bd79356882 100644 --- a/resource-manager/costmanagement/2023-08-01/exports/id_scopedexport.go +++ b/resource-manager/costmanagement/2023-08-01/exports/id_scopedexport.go @@ -34,15 +34,9 @@ func ParseScopedExportID(input string) (*ScopedExportId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedExportId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.ExportName, ok = parsed.Parsed["exportName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "exportName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedExportIDInsensitively(input string) (*ScopedExportId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedExportId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedExportId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.ExportName, ok = parsed.Parsed["exportName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "exportName", *parsed) + if id.ExportName, ok = input.Parsed["exportName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "exportName", input) } - return &id, nil + return nil } // ValidateScopedExportID checks that 'input' can be parsed as a Scoped Export ID diff --git a/resource-manager/costmanagement/2023-08-01/forecast/id_externalcloudprovidertype.go b/resource-manager/costmanagement/2023-08-01/forecast/id_externalcloudprovidertype.go index e43b76c4747..898f3fc76bf 100644 --- a/resource-manager/costmanagement/2023-08-01/forecast/id_externalcloudprovidertype.go +++ b/resource-manager/costmanagement/2023-08-01/forecast/id_externalcloudprovidertype.go @@ -34,23 +34,9 @@ func ParseExternalCloudProviderTypeID(input string) (*ExternalCloudProviderTypeI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExternalCloudProviderTypeId{} - - if v, ok := parsed.Parsed["externalCloudProviderType"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderType", *parsed) - } - - externalCloudProviderType, err := parseExternalCloudProviderType(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.ExternalCloudProviderType = *externalCloudProviderType - } - - if id.ExternalCloudProviderId, ok = parsed.Parsed["externalCloudProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -65,26 +51,34 @@ func ParseExternalCloudProviderTypeIDInsensitively(input string) (*ExternalCloud return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExternalCloudProviderTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if v, ok := parsed.Parsed["externalCloudProviderType"]; true { + return &id, nil +} + +func (id *ExternalCloudProviderTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if v, ok := input.Parsed["externalCloudProviderType"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderType", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderType", input) } externalCloudProviderType, err := parseExternalCloudProviderType(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.ExternalCloudProviderType = *externalCloudProviderType } - if id.ExternalCloudProviderId, ok = parsed.Parsed["externalCloudProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderId", *parsed) + if id.ExternalCloudProviderId, ok = input.Parsed["externalCloudProviderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderId", input) } - return &id, nil + return nil } // ValidateExternalCloudProviderTypeID checks that 'input' can be parsed as a External Cloud Provider Type ID diff --git a/resource-manager/costmanagement/2023-08-01/pricesheets/id_billingprofile.go b/resource-manager/costmanagement/2023-08-01/pricesheets/id_billingprofile.go index dc8cf23d27d..f902603a082 100644 --- a/resource-manager/costmanagement/2023-08-01/pricesheets/id_billingprofile.go +++ b/resource-manager/costmanagement/2023-08-01/pricesheets/id_billingprofile.go @@ -34,15 +34,9 @@ func ParseBillingProfileID(input string) (*BillingProfileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) - } - - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseBillingProfileIDInsensitively(input string) (*BillingProfileId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + return &id, nil +} + +func (id *BillingProfileId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) } - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if id.BillingProfileId, ok = input.Parsed["billingProfileId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", input) } - return &id, nil + return nil } // ValidateBillingProfileID checks that 'input' can be parsed as a Billing Profile ID diff --git a/resource-manager/costmanagement/2023-08-01/pricesheets/id_invoice.go b/resource-manager/costmanagement/2023-08-01/pricesheets/id_invoice.go index 013cbe0f6d3..014474a91e3 100644 --- a/resource-manager/costmanagement/2023-08-01/pricesheets/id_invoice.go +++ b/resource-manager/costmanagement/2023-08-01/pricesheets/id_invoice.go @@ -36,19 +36,9 @@ func ParseInvoiceID(input string) (*InvoiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InvoiceId{} - - if id.BillingAccountName, ok = parsed.Parsed["billingAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountName", *parsed) - } - - if id.BillingProfileName, ok = parsed.Parsed["billingProfileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileName", *parsed) - } - - if id.InvoiceName, ok = parsed.Parsed["invoiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "invoiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseInvoiceIDInsensitively(input string) (*InvoiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InvoiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.BillingAccountName, ok = parsed.Parsed["billingAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountName", *parsed) +func (id *InvoiceId) 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 = parsed.Parsed["billingProfileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileName", *parsed) + if id.BillingProfileName, ok = input.Parsed["billingProfileName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingProfileName", input) } - if id.InvoiceName, ok = parsed.Parsed["invoiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "invoiceName", *parsed) + if id.InvoiceName, ok = input.Parsed["invoiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "invoiceName", input) } - return &id, nil + return nil } // ValidateInvoiceID checks that 'input' can be parsed as a Invoice ID diff --git a/resource-manager/costmanagement/2023-08-01/query/id_externalcloudprovidertype.go b/resource-manager/costmanagement/2023-08-01/query/id_externalcloudprovidertype.go index 54fabd4e45f..29ec40983bf 100644 --- a/resource-manager/costmanagement/2023-08-01/query/id_externalcloudprovidertype.go +++ b/resource-manager/costmanagement/2023-08-01/query/id_externalcloudprovidertype.go @@ -34,23 +34,9 @@ func ParseExternalCloudProviderTypeID(input string) (*ExternalCloudProviderTypeI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExternalCloudProviderTypeId{} - - if v, ok := parsed.Parsed["externalCloudProviderType"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderType", *parsed) - } - - externalCloudProviderType, err := parseExternalCloudProviderType(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.ExternalCloudProviderType = *externalCloudProviderType - } - - if id.ExternalCloudProviderId, ok = parsed.Parsed["externalCloudProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -65,26 +51,34 @@ func ParseExternalCloudProviderTypeIDInsensitively(input string) (*ExternalCloud return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExternalCloudProviderTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if v, ok := parsed.Parsed["externalCloudProviderType"]; true { + return &id, nil +} + +func (id *ExternalCloudProviderTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if v, ok := input.Parsed["externalCloudProviderType"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderType", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderType", input) } externalCloudProviderType, err := parseExternalCloudProviderType(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.ExternalCloudProviderType = *externalCloudProviderType } - if id.ExternalCloudProviderId, ok = parsed.Parsed["externalCloudProviderId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderId", *parsed) + if id.ExternalCloudProviderId, ok = input.Parsed["externalCloudProviderId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "externalCloudProviderId", input) } - return &id, nil + return nil } // ValidateExternalCloudProviderTypeID checks that 'input' can be parsed as a External Cloud Provider Type ID diff --git a/resource-manager/costmanagement/2023-08-01/reservedinstances/id_billingaccount.go b/resource-manager/costmanagement/2023-08-01/reservedinstances/id_billingaccount.go index ea6e51b561a..3a014995a80 100644 --- a/resource-manager/costmanagement/2023-08-01/reservedinstances/id_billingaccount.go +++ b/resource-manager/costmanagement/2023-08-01/reservedinstances/id_billingaccount.go @@ -32,11 +32,9 @@ func ParseBillingAccountID(input string) (*BillingAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseBillingAccountIDInsensitively(input string) (*BillingAccountId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *BillingAccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) + } + + return nil +} + // ValidateBillingAccountID checks that 'input' can be parsed as a Billing Account ID func ValidateBillingAccountID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/costmanagement/2023-08-01/reservedinstances/id_billingprofile.go b/resource-manager/costmanagement/2023-08-01/reservedinstances/id_billingprofile.go index 3d07dcd0f3e..d0923149768 100644 --- a/resource-manager/costmanagement/2023-08-01/reservedinstances/id_billingprofile.go +++ b/resource-manager/costmanagement/2023-08-01/reservedinstances/id_billingprofile.go @@ -34,15 +34,9 @@ func ParseBillingProfileID(input string) (*BillingProfileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) - } - - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseBillingProfileIDInsensitively(input string) (*BillingProfileId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingProfileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + return &id, nil +} + +func (id *BillingProfileId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) } - if id.BillingProfileId, ok = parsed.Parsed["billingProfileId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", *parsed) + if id.BillingProfileId, ok = input.Parsed["billingProfileId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingProfileId", input) } - return &id, nil + return nil } // ValidateBillingProfileID checks that 'input' can be parsed as a Billing Profile ID diff --git a/resource-manager/costmanagement/2023-08-01/scheduledactions/id_scheduledaction.go b/resource-manager/costmanagement/2023-08-01/scheduledactions/id_scheduledaction.go index b5d002d4286..69c04db60b5 100644 --- a/resource-manager/costmanagement/2023-08-01/scheduledactions/id_scheduledaction.go +++ b/resource-manager/costmanagement/2023-08-01/scheduledactions/id_scheduledaction.go @@ -32,11 +32,9 @@ func ParseScheduledActionID(input string) (*ScheduledActionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScheduledActionId{} - - if id.ScheduledActionName, ok = parsed.Parsed["scheduledActionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduledActionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseScheduledActionIDInsensitively(input string) (*ScheduledActionId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScheduledActionId{} - - if id.ScheduledActionName, ok = parsed.Parsed["scheduledActionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduledActionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *ScheduledActionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ScheduledActionName, ok = input.Parsed["scheduledActionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scheduledActionName", input) + } + + return nil +} + // ValidateScheduledActionID checks that 'input' can be parsed as a Scheduled Action ID func ValidateScheduledActionID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/costmanagement/2023-08-01/scheduledactions/id_scopedscheduledaction.go b/resource-manager/costmanagement/2023-08-01/scheduledactions/id_scopedscheduledaction.go index 3e166c601f4..a5b593cd533 100644 --- a/resource-manager/costmanagement/2023-08-01/scheduledactions/id_scopedscheduledaction.go +++ b/resource-manager/costmanagement/2023-08-01/scheduledactions/id_scopedscheduledaction.go @@ -34,15 +34,9 @@ func ParseScopedScheduledActionID(input string) (*ScopedScheduledActionId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedScheduledActionId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.ScheduledActionName, ok = parsed.Parsed["scheduledActionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduledActionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedScheduledActionIDInsensitively(input string) (*ScopedScheduledAc return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedScheduledActionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedScheduledActionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.ScheduledActionName, ok = parsed.Parsed["scheduledActionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduledActionName", *parsed) + if id.ScheduledActionName, ok = input.Parsed["scheduledActionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scheduledActionName", input) } - return &id, nil + return nil } // ValidateScopedScheduledActionID checks that 'input' can be parsed as a Scoped Scheduled Action ID diff --git a/resource-manager/costmanagement/2023-08-01/views/id_scopedview.go b/resource-manager/costmanagement/2023-08-01/views/id_scopedview.go index 788d550f865..f2575e1e520 100644 --- a/resource-manager/costmanagement/2023-08-01/views/id_scopedview.go +++ b/resource-manager/costmanagement/2023-08-01/views/id_scopedview.go @@ -34,15 +34,9 @@ func ParseScopedViewID(input string) (*ScopedViewId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedViewId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.ViewName, ok = parsed.Parsed["viewName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "viewName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedViewIDInsensitively(input string) (*ScopedViewId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedViewId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedViewId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.ViewName, ok = parsed.Parsed["viewName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "viewName", *parsed) + if id.ViewName, ok = input.Parsed["viewName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "viewName", input) } - return &id, nil + return nil } // ValidateScopedViewID checks that 'input' can be parsed as a Scoped View ID diff --git a/resource-manager/costmanagement/2023-08-01/views/id_view.go b/resource-manager/costmanagement/2023-08-01/views/id_view.go index b4cc2295d4a..e1afb0fe35b 100644 --- a/resource-manager/costmanagement/2023-08-01/views/id_view.go +++ b/resource-manager/costmanagement/2023-08-01/views/id_view.go @@ -32,11 +32,9 @@ func ParseViewID(input string) (*ViewId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ViewId{} - - if id.ViewName, ok = parsed.Parsed["viewName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "viewName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseViewIDInsensitively(input string) (*ViewId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ViewId{} - - if id.ViewName, ok = parsed.Parsed["viewName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "viewName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *ViewId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ViewName, ok = input.Parsed["viewName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "viewName", input) + } + + return nil +} + // ValidateViewID checks that 'input' can be parsed as a View ID func ValidateViewID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/customproviders/2018-09-01-preview/associations/id_scopedassociation.go b/resource-manager/customproviders/2018-09-01-preview/associations/id_scopedassociation.go index deeff1b8069..1f583a820fa 100644 --- a/resource-manager/customproviders/2018-09-01-preview/associations/id_scopedassociation.go +++ b/resource-manager/customproviders/2018-09-01-preview/associations/id_scopedassociation.go @@ -34,15 +34,9 @@ func ParseScopedAssociationID(input string) (*ScopedAssociationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedAssociationId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.AssociationName, ok = parsed.Parsed["associationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "associationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedAssociationIDInsensitively(input string) (*ScopedAssociationId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedAssociationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedAssociationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.AssociationName, ok = parsed.Parsed["associationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "associationName", *parsed) + if id.AssociationName, ok = input.Parsed["associationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "associationName", input) } - return &id, nil + return nil } // ValidateScopedAssociationID checks that 'input' can be parsed as a Scoped Association ID diff --git a/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/id_resourceprovider.go b/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/id_resourceprovider.go index ac013405c30..f6051ffe53a 100644 --- a/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/id_resourceprovider.go +++ b/resource-manager/customproviders/2018-09-01-preview/customresourceprovider/id_resourceprovider.go @@ -36,19 +36,9 @@ func ParseResourceProviderID(input string) (*ResourceProviderId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResourceProviderId{} - - 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.ResourceProviderName, ok = parsed.Parsed["resourceProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceProviderName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseResourceProviderIDInsensitively(input string) (*ResourceProviderId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResourceProviderId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ResourceProviderId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ResourceProviderName, ok = parsed.Parsed["resourceProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceProviderName", *parsed) + if id.ResourceProviderName, ok = input.Parsed["resourceProviderName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceProviderName", input) } - return &id, nil + return nil } // ValidateResourceProviderID checks that 'input' can be parsed as a Resource Provider ID diff --git a/resource-manager/dashboard/2022-08-01/grafanaresource/id_grafana.go b/resource-manager/dashboard/2022-08-01/grafanaresource/id_grafana.go index c3aece524bb..36a2ddf9463 100644 --- a/resource-manager/dashboard/2022-08-01/grafanaresource/id_grafana.go +++ b/resource-manager/dashboard/2022-08-01/grafanaresource/id_grafana.go @@ -36,19 +36,9 @@ func ParseGrafanaID(input string) (*GrafanaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GrafanaId{} - - 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.GrafanaName, ok = parsed.Parsed["grafanaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "grafanaName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseGrafanaIDInsensitively(input string) (*GrafanaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GrafanaId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *GrafanaId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.GrafanaName, ok = parsed.Parsed["grafanaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "grafanaName", *parsed) + if id.GrafanaName, ok = input.Parsed["grafanaName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "grafanaName", input) } - return &id, nil + return nil } // ValidateGrafanaID checks that 'input' can be parsed as a Grafana ID diff --git a/resource-manager/dashboard/2022-08-01/privateendpointconnection/id_grafana.go b/resource-manager/dashboard/2022-08-01/privateendpointconnection/id_grafana.go index 140d65a927b..2a10a6de5dc 100644 --- a/resource-manager/dashboard/2022-08-01/privateendpointconnection/id_grafana.go +++ b/resource-manager/dashboard/2022-08-01/privateendpointconnection/id_grafana.go @@ -36,19 +36,9 @@ func ParseGrafanaID(input string) (*GrafanaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GrafanaId{} - - 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.GrafanaName, ok = parsed.Parsed["grafanaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "grafanaName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseGrafanaIDInsensitively(input string) (*GrafanaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GrafanaId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *GrafanaId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.GrafanaName, ok = parsed.Parsed["grafanaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "grafanaName", *parsed) + if id.GrafanaName, ok = input.Parsed["grafanaName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "grafanaName", input) } - return &id, nil + return nil } // ValidateGrafanaID checks that 'input' can be parsed as a Grafana ID diff --git a/resource-manager/dashboard/2022-08-01/privateendpointconnection/id_privateendpointconnection.go b/resource-manager/dashboard/2022-08-01/privateendpointconnection/id_privateendpointconnection.go index 0c0b09c5187..17698eded4e 100644 --- a/resource-manager/dashboard/2022-08-01/privateendpointconnection/id_privateendpointconnection.go +++ b/resource-manager/dashboard/2022-08-01/privateendpointconnection/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.GrafanaName, ok = parsed.Parsed["grafanaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "grafanaName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.GrafanaName, ok = parsed.Parsed["grafanaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "grafanaName", *parsed) + if id.GrafanaName, ok = input.Parsed["grafanaName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "grafanaName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/dashboard/2022-08-01/privatelinkresource/id_grafana.go b/resource-manager/dashboard/2022-08-01/privatelinkresource/id_grafana.go index 7eae1c37fd8..7cd971ce3ac 100644 --- a/resource-manager/dashboard/2022-08-01/privatelinkresource/id_grafana.go +++ b/resource-manager/dashboard/2022-08-01/privatelinkresource/id_grafana.go @@ -36,19 +36,9 @@ func ParseGrafanaID(input string) (*GrafanaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GrafanaId{} - - 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.GrafanaName, ok = parsed.Parsed["grafanaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "grafanaName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseGrafanaIDInsensitively(input string) (*GrafanaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GrafanaId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *GrafanaId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.GrafanaName, ok = parsed.Parsed["grafanaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "grafanaName", *parsed) + if id.GrafanaName, ok = input.Parsed["grafanaName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "grafanaName", input) } - return &id, nil + return nil } // ValidateGrafanaID checks that 'input' can be parsed as a Grafana ID diff --git a/resource-manager/dashboard/2022-08-01/privatelinkresource/id_privatelinkresource.go b/resource-manager/dashboard/2022-08-01/privatelinkresource/id_privatelinkresource.go index ac7fafd48ec..951e1c7c2c0 100644 --- a/resource-manager/dashboard/2022-08-01/privatelinkresource/id_privatelinkresource.go +++ b/resource-manager/dashboard/2022-08-01/privatelinkresource/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.GrafanaName, ok = parsed.Parsed["grafanaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "grafanaName", *parsed) - } - - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.GrafanaName, ok = parsed.Parsed["grafanaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "grafanaName", *parsed) + if id.GrafanaName, ok = input.Parsed["grafanaName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "grafanaName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/dashboard/2023-09-01/grafanaplugin/id_grafana.go b/resource-manager/dashboard/2023-09-01/grafanaplugin/id_grafana.go index 2f1f6d73cdc..cba75876734 100644 --- a/resource-manager/dashboard/2023-09-01/grafanaplugin/id_grafana.go +++ b/resource-manager/dashboard/2023-09-01/grafanaplugin/id_grafana.go @@ -36,19 +36,9 @@ func ParseGrafanaID(input string) (*GrafanaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GrafanaId{} - - 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.GrafanaName, ok = parsed.Parsed["grafanaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "grafanaName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseGrafanaIDInsensitively(input string) (*GrafanaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GrafanaId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *GrafanaId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.GrafanaName, ok = parsed.Parsed["grafanaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "grafanaName", *parsed) + if id.GrafanaName, ok = input.Parsed["grafanaName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "grafanaName", input) } - return &id, nil + return nil } // ValidateGrafanaID checks that 'input' can be parsed as a Grafana ID diff --git a/resource-manager/dashboard/2023-09-01/grafanaresource/id_grafana.go b/resource-manager/dashboard/2023-09-01/grafanaresource/id_grafana.go index c3aece524bb..36a2ddf9463 100644 --- a/resource-manager/dashboard/2023-09-01/grafanaresource/id_grafana.go +++ b/resource-manager/dashboard/2023-09-01/grafanaresource/id_grafana.go @@ -36,19 +36,9 @@ func ParseGrafanaID(input string) (*GrafanaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GrafanaId{} - - 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.GrafanaName, ok = parsed.Parsed["grafanaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "grafanaName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseGrafanaIDInsensitively(input string) (*GrafanaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GrafanaId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *GrafanaId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.GrafanaName, ok = parsed.Parsed["grafanaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "grafanaName", *parsed) + if id.GrafanaName, ok = input.Parsed["grafanaName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "grafanaName", input) } - return &id, nil + return nil } // ValidateGrafanaID checks that 'input' can be parsed as a Grafana ID diff --git a/resource-manager/dashboard/2023-09-01/managedprivateendpoints/id_grafana.go b/resource-manager/dashboard/2023-09-01/managedprivateendpoints/id_grafana.go index 204ca398b6e..474a5314e30 100644 --- a/resource-manager/dashboard/2023-09-01/managedprivateendpoints/id_grafana.go +++ b/resource-manager/dashboard/2023-09-01/managedprivateendpoints/id_grafana.go @@ -36,19 +36,9 @@ func ParseGrafanaID(input string) (*GrafanaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GrafanaId{} - - 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.GrafanaName, ok = parsed.Parsed["grafanaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "grafanaName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseGrafanaIDInsensitively(input string) (*GrafanaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GrafanaId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *GrafanaId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.GrafanaName, ok = parsed.Parsed["grafanaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "grafanaName", *parsed) + if id.GrafanaName, ok = input.Parsed["grafanaName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "grafanaName", input) } - return &id, nil + return nil } // ValidateGrafanaID checks that 'input' can be parsed as a Grafana ID diff --git a/resource-manager/dashboard/2023-09-01/managedprivateendpoints/id_managedprivateendpoint.go b/resource-manager/dashboard/2023-09-01/managedprivateendpoints/id_managedprivateendpoint.go index bd4931db92f..18e20446e7f 100644 --- a/resource-manager/dashboard/2023-09-01/managedprivateendpoints/id_managedprivateendpoint.go +++ b/resource-manager/dashboard/2023-09-01/managedprivateendpoints/id_managedprivateendpoint.go @@ -38,23 +38,9 @@ func ParseManagedPrivateEndpointID(input string) (*ManagedPrivateEndpointId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedPrivateEndpointId{} - - 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.GrafanaName, ok = parsed.Parsed["grafanaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "grafanaName", *parsed) - } - - if id.ManagedPrivateEndpointName, ok = parsed.Parsed["managedPrivateEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedPrivateEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseManagedPrivateEndpointIDInsensitively(input string) (*ManagedPrivateEn return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedPrivateEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ManagedPrivateEndpointId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.GrafanaName, ok = parsed.Parsed["grafanaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "grafanaName", *parsed) + if id.GrafanaName, ok = input.Parsed["grafanaName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "grafanaName", input) } - if id.ManagedPrivateEndpointName, ok = parsed.Parsed["managedPrivateEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedPrivateEndpointName", *parsed) + if id.ManagedPrivateEndpointName, ok = input.Parsed["managedPrivateEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedPrivateEndpointName", input) } - return &id, nil + return nil } // ValidateManagedPrivateEndpointID checks that 'input' can be parsed as a Managed Private Endpoint ID diff --git a/resource-manager/dashboard/2023-09-01/privateendpointconnection/id_grafana.go b/resource-manager/dashboard/2023-09-01/privateendpointconnection/id_grafana.go index 140d65a927b..2a10a6de5dc 100644 --- a/resource-manager/dashboard/2023-09-01/privateendpointconnection/id_grafana.go +++ b/resource-manager/dashboard/2023-09-01/privateendpointconnection/id_grafana.go @@ -36,19 +36,9 @@ func ParseGrafanaID(input string) (*GrafanaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GrafanaId{} - - 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.GrafanaName, ok = parsed.Parsed["grafanaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "grafanaName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseGrafanaIDInsensitively(input string) (*GrafanaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GrafanaId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *GrafanaId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.GrafanaName, ok = parsed.Parsed["grafanaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "grafanaName", *parsed) + if id.GrafanaName, ok = input.Parsed["grafanaName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "grafanaName", input) } - return &id, nil + return nil } // ValidateGrafanaID checks that 'input' can be parsed as a Grafana ID diff --git a/resource-manager/dashboard/2023-09-01/privateendpointconnection/id_privateendpointconnection.go b/resource-manager/dashboard/2023-09-01/privateendpointconnection/id_privateendpointconnection.go index 0c0b09c5187..17698eded4e 100644 --- a/resource-manager/dashboard/2023-09-01/privateendpointconnection/id_privateendpointconnection.go +++ b/resource-manager/dashboard/2023-09-01/privateendpointconnection/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.GrafanaName, ok = parsed.Parsed["grafanaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "grafanaName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.GrafanaName, ok = parsed.Parsed["grafanaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "grafanaName", *parsed) + if id.GrafanaName, ok = input.Parsed["grafanaName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "grafanaName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/dashboard/2023-09-01/privatelinkresource/id_grafana.go b/resource-manager/dashboard/2023-09-01/privatelinkresource/id_grafana.go index 7eae1c37fd8..7cd971ce3ac 100644 --- a/resource-manager/dashboard/2023-09-01/privatelinkresource/id_grafana.go +++ b/resource-manager/dashboard/2023-09-01/privatelinkresource/id_grafana.go @@ -36,19 +36,9 @@ func ParseGrafanaID(input string) (*GrafanaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GrafanaId{} - - 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.GrafanaName, ok = parsed.Parsed["grafanaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "grafanaName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseGrafanaIDInsensitively(input string) (*GrafanaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GrafanaId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *GrafanaId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.GrafanaName, ok = parsed.Parsed["grafanaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "grafanaName", *parsed) + if id.GrafanaName, ok = input.Parsed["grafanaName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "grafanaName", input) } - return &id, nil + return nil } // ValidateGrafanaID checks that 'input' can be parsed as a Grafana ID diff --git a/resource-manager/dashboard/2023-09-01/privatelinkresource/id_privatelinkresource.go b/resource-manager/dashboard/2023-09-01/privatelinkresource/id_privatelinkresource.go index ac7fafd48ec..951e1c7c2c0 100644 --- a/resource-manager/dashboard/2023-09-01/privatelinkresource/id_privatelinkresource.go +++ b/resource-manager/dashboard/2023-09-01/privatelinkresource/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.GrafanaName, ok = parsed.Parsed["grafanaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "grafanaName", *parsed) - } - - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.GrafanaName, ok = parsed.Parsed["grafanaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "grafanaName", *parsed) + if id.GrafanaName, ok = input.Parsed["grafanaName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "grafanaName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/databoxedge/2022-03-01/addons/id_addon.go b/resource-manager/databoxedge/2022-03-01/addons/id_addon.go index 483144b96c7..d31ab7ee49e 100644 --- a/resource-manager/databoxedge/2022-03-01/addons/id_addon.go +++ b/resource-manager/databoxedge/2022-03-01/addons/id_addon.go @@ -40,27 +40,9 @@ func ParseAddonID(input string) (*AddonId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AddonId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) - } - - if id.RoleName, ok = parsed.Parsed["roleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleName", *parsed) - } - - if id.AddonName, ok = parsed.Parsed["addonName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "addonName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseAddonIDInsensitively(input string) (*AddonId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AddonId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *AddonId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - if id.RoleName, ok = parsed.Parsed["roleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleName", *parsed) + if id.RoleName, ok = input.Parsed["roleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "roleName", input) } - if id.AddonName, ok = parsed.Parsed["addonName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "addonName", *parsed) + if id.AddonName, ok = input.Parsed["addonName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "addonName", input) } - return &id, nil + return nil } // ValidateAddonID checks that 'input' can be parsed as a Addon ID diff --git a/resource-manager/databoxedge/2022-03-01/addons/id_role.go b/resource-manager/databoxedge/2022-03-01/addons/id_role.go index b28fe219108..d7c1fa7c2aa 100644 --- a/resource-manager/databoxedge/2022-03-01/addons/id_role.go +++ b/resource-manager/databoxedge/2022-03-01/addons/id_role.go @@ -38,23 +38,9 @@ func ParseRoleID(input string) (*RoleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RoleId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) - } - - if id.RoleName, ok = parsed.Parsed["roleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRoleIDInsensitively(input string) (*RoleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RoleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RoleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - if id.RoleName, ok = parsed.Parsed["roleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleName", *parsed) + if id.RoleName, ok = input.Parsed["roleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "roleName", input) } - return &id, nil + return nil } // ValidateRoleID checks that 'input' can be parsed as a Role ID diff --git a/resource-manager/databoxedge/2022-03-01/alerts/id_alert.go b/resource-manager/databoxedge/2022-03-01/alerts/id_alert.go index 7b6d135e9a9..7aad7204964 100644 --- a/resource-manager/databoxedge/2022-03-01/alerts/id_alert.go +++ b/resource-manager/databoxedge/2022-03-01/alerts/id_alert.go @@ -38,23 +38,9 @@ func ParseAlertID(input string) (*AlertId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) - } - - if id.AlertName, ok = parsed.Parsed["alertName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "alertName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAlertIDInsensitively(input string) (*AlertId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AlertId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - if id.AlertName, ok = parsed.Parsed["alertName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "alertName", *parsed) + if id.AlertName, ok = input.Parsed["alertName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "alertName", input) } - return &id, nil + return nil } // ValidateAlertID checks that 'input' can be parsed as a Alert ID diff --git a/resource-manager/databoxedge/2022-03-01/alerts/id_databoxedgedevice.go b/resource-manager/databoxedge/2022-03-01/alerts/id_databoxedgedevice.go index 580e5892235..91056c15fff 100644 --- a/resource-manager/databoxedge/2022-03-01/alerts/id_databoxedgedevice.go +++ b/resource-manager/databoxedge/2022-03-01/alerts/id_databoxedgedevice.go @@ -36,19 +36,9 @@ func ParseDataBoxEdgeDeviceID(input string) (*DataBoxEdgeDeviceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDataBoxEdgeDeviceIDInsensitively(input string) (*DataBoxEdgeDeviceId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DataBoxEdgeDeviceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - return &id, nil + return nil } // ValidateDataBoxEdgeDeviceID checks that 'input' can be parsed as a Data Box Edge Device ID diff --git a/resource-manager/databoxedge/2022-03-01/bandwidthschedules/id_bandwidthschedule.go b/resource-manager/databoxedge/2022-03-01/bandwidthschedules/id_bandwidthschedule.go index d26975dc0fa..e4abdd8f5d6 100644 --- a/resource-manager/databoxedge/2022-03-01/bandwidthschedules/id_bandwidthschedule.go +++ b/resource-manager/databoxedge/2022-03-01/bandwidthschedules/id_bandwidthschedule.go @@ -38,23 +38,9 @@ func ParseBandwidthScheduleID(input string) (*BandwidthScheduleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BandwidthScheduleId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) - } - - if id.BandwidthScheduleName, ok = parsed.Parsed["bandwidthScheduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bandwidthScheduleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBandwidthScheduleIDInsensitively(input string) (*BandwidthScheduleId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BandwidthScheduleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BandwidthScheduleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - if id.BandwidthScheduleName, ok = parsed.Parsed["bandwidthScheduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bandwidthScheduleName", *parsed) + if id.BandwidthScheduleName, ok = input.Parsed["bandwidthScheduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "bandwidthScheduleName", input) } - return &id, nil + return nil } // ValidateBandwidthScheduleID checks that 'input' can be parsed as a Bandwidth Schedule ID diff --git a/resource-manager/databoxedge/2022-03-01/bandwidthschedules/id_databoxedgedevice.go b/resource-manager/databoxedge/2022-03-01/bandwidthschedules/id_databoxedgedevice.go index 705dc57a55b..bb3a1d49cdc 100644 --- a/resource-manager/databoxedge/2022-03-01/bandwidthschedules/id_databoxedgedevice.go +++ b/resource-manager/databoxedge/2022-03-01/bandwidthschedules/id_databoxedgedevice.go @@ -36,19 +36,9 @@ func ParseDataBoxEdgeDeviceID(input string) (*DataBoxEdgeDeviceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDataBoxEdgeDeviceIDInsensitively(input string) (*DataBoxEdgeDeviceId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DataBoxEdgeDeviceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - return &id, nil + return nil } // ValidateDataBoxEdgeDeviceID checks that 'input' can be parsed as a Data Box Edge Device ID diff --git a/resource-manager/databoxedge/2022-03-01/containers/id_container.go b/resource-manager/databoxedge/2022-03-01/containers/id_container.go index ee5cd7d4bdd..0e4e1f909d8 100644 --- a/resource-manager/databoxedge/2022-03-01/containers/id_container.go +++ b/resource-manager/databoxedge/2022-03-01/containers/id_container.go @@ -40,27 +40,9 @@ func ParseContainerID(input string) (*ContainerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) - } - - if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) - } - - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseContainerIDInsensitively(input string) (*ContainerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ContainerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) + if id.StorageAccountName, ok = input.Parsed["storageAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", input) } - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) + if id.ContainerName, ok = input.Parsed["containerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerName", input) } - return &id, nil + return nil } // ValidateContainerID checks that 'input' can be parsed as a Container ID diff --git a/resource-manager/databoxedge/2022-03-01/containers/id_storageaccount.go b/resource-manager/databoxedge/2022-03-01/containers/id_storageaccount.go index f061b966624..657be903067 100644 --- a/resource-manager/databoxedge/2022-03-01/containers/id_storageaccount.go +++ b/resource-manager/databoxedge/2022-03-01/containers/id_storageaccount.go @@ -38,23 +38,9 @@ func ParseStorageAccountID(input string) (*StorageAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageAccountId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) - } - - if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseStorageAccountIDInsensitively(input string) (*StorageAccountId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *StorageAccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) + if id.StorageAccountName, ok = input.Parsed["storageAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", input) } - return &id, nil + return nil } // ValidateStorageAccountID checks that 'input' can be parsed as a Storage Account ID diff --git a/resource-manager/databoxedge/2022-03-01/devicecapacitycheck/id_databoxedgedevice.go b/resource-manager/databoxedge/2022-03-01/devicecapacitycheck/id_databoxedgedevice.go index a3a10424f0c..3ec0fb44ea4 100644 --- a/resource-manager/databoxedge/2022-03-01/devicecapacitycheck/id_databoxedgedevice.go +++ b/resource-manager/databoxedge/2022-03-01/devicecapacitycheck/id_databoxedgedevice.go @@ -36,19 +36,9 @@ func ParseDataBoxEdgeDeviceID(input string) (*DataBoxEdgeDeviceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDataBoxEdgeDeviceIDInsensitively(input string) (*DataBoxEdgeDeviceId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DataBoxEdgeDeviceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - return &id, nil + return nil } // ValidateDataBoxEdgeDeviceID checks that 'input' can be parsed as a Data Box Edge Device ID diff --git a/resource-manager/databoxedge/2022-03-01/devicecapacityinfo/id_databoxedgedevice.go b/resource-manager/databoxedge/2022-03-01/devicecapacityinfo/id_databoxedgedevice.go index ba45f9a75bb..c3e90fd1c5e 100644 --- a/resource-manager/databoxedge/2022-03-01/devicecapacityinfo/id_databoxedgedevice.go +++ b/resource-manager/databoxedge/2022-03-01/devicecapacityinfo/id_databoxedgedevice.go @@ -36,19 +36,9 @@ func ParseDataBoxEdgeDeviceID(input string) (*DataBoxEdgeDeviceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDataBoxEdgeDeviceIDInsensitively(input string) (*DataBoxEdgeDeviceId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DataBoxEdgeDeviceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - return &id, nil + return nil } // ValidateDataBoxEdgeDeviceID checks that 'input' can be parsed as a Data Box Edge Device ID diff --git a/resource-manager/databoxedge/2022-03-01/devices/id_databoxedgedevice.go b/resource-manager/databoxedge/2022-03-01/devices/id_databoxedgedevice.go index 055d38cf5aa..dd95c70ba23 100644 --- a/resource-manager/databoxedge/2022-03-01/devices/id_databoxedgedevice.go +++ b/resource-manager/databoxedge/2022-03-01/devices/id_databoxedgedevice.go @@ -36,19 +36,9 @@ func ParseDataBoxEdgeDeviceID(input string) (*DataBoxEdgeDeviceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDataBoxEdgeDeviceIDInsensitively(input string) (*DataBoxEdgeDeviceId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DataBoxEdgeDeviceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - return &id, nil + return nil } // ValidateDataBoxEdgeDeviceID checks that 'input' can be parsed as a Data Box Edge Device ID diff --git a/resource-manager/databoxedge/2022-03-01/diagnosticsettings/id_databoxedgedevice.go b/resource-manager/databoxedge/2022-03-01/diagnosticsettings/id_databoxedgedevice.go index 4e7c2e3893b..26f878f6425 100644 --- a/resource-manager/databoxedge/2022-03-01/diagnosticsettings/id_databoxedgedevice.go +++ b/resource-manager/databoxedge/2022-03-01/diagnosticsettings/id_databoxedgedevice.go @@ -36,19 +36,9 @@ func ParseDataBoxEdgeDeviceID(input string) (*DataBoxEdgeDeviceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDataBoxEdgeDeviceIDInsensitively(input string) (*DataBoxEdgeDeviceId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DataBoxEdgeDeviceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - return &id, nil + return nil } // ValidateDataBoxEdgeDeviceID checks that 'input' can be parsed as a Data Box Edge Device ID diff --git a/resource-manager/databoxedge/2022-03-01/jobs/id_job.go b/resource-manager/databoxedge/2022-03-01/jobs/id_job.go index 194bfcc1306..d437e028845 100644 --- a/resource-manager/databoxedge/2022-03-01/jobs/id_job.go +++ b/resource-manager/databoxedge/2022-03-01/jobs/id_job.go @@ -38,23 +38,9 @@ func ParseJobID(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) - } - - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseJobIDInsensitively(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *JobId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - return &id, nil + return nil } // ValidateJobID checks that 'input' can be parsed as a Job ID diff --git a/resource-manager/databoxedge/2022-03-01/monitoringconfig/id_role.go b/resource-manager/databoxedge/2022-03-01/monitoringconfig/id_role.go index a35c1f453d8..2bbd9ba4631 100644 --- a/resource-manager/databoxedge/2022-03-01/monitoringconfig/id_role.go +++ b/resource-manager/databoxedge/2022-03-01/monitoringconfig/id_role.go @@ -38,23 +38,9 @@ func ParseRoleID(input string) (*RoleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RoleId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) - } - - if id.RoleName, ok = parsed.Parsed["roleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRoleIDInsensitively(input string) (*RoleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RoleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RoleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - if id.RoleName, ok = parsed.Parsed["roleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleName", *parsed) + if id.RoleName, ok = input.Parsed["roleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "roleName", input) } - return &id, nil + return nil } // ValidateRoleID checks that 'input' can be parsed as a Role ID diff --git a/resource-manager/databoxedge/2022-03-01/nodes/id_databoxedgedevice.go b/resource-manager/databoxedge/2022-03-01/nodes/id_databoxedgedevice.go index b411568757f..4211fbcb366 100644 --- a/resource-manager/databoxedge/2022-03-01/nodes/id_databoxedgedevice.go +++ b/resource-manager/databoxedge/2022-03-01/nodes/id_databoxedgedevice.go @@ -36,19 +36,9 @@ func ParseDataBoxEdgeDeviceID(input string) (*DataBoxEdgeDeviceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDataBoxEdgeDeviceIDInsensitively(input string) (*DataBoxEdgeDeviceId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DataBoxEdgeDeviceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - return &id, nil + return nil } // ValidateDataBoxEdgeDeviceID checks that 'input' can be parsed as a Data Box Edge Device ID diff --git a/resource-manager/databoxedge/2022-03-01/orders/id_databoxedgedevice.go b/resource-manager/databoxedge/2022-03-01/orders/id_databoxedgedevice.go index da50ab36235..feca815cec2 100644 --- a/resource-manager/databoxedge/2022-03-01/orders/id_databoxedgedevice.go +++ b/resource-manager/databoxedge/2022-03-01/orders/id_databoxedgedevice.go @@ -36,19 +36,9 @@ func ParseDataBoxEdgeDeviceID(input string) (*DataBoxEdgeDeviceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDataBoxEdgeDeviceIDInsensitively(input string) (*DataBoxEdgeDeviceId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DataBoxEdgeDeviceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - return &id, nil + return nil } // ValidateDataBoxEdgeDeviceID checks that 'input' can be parsed as a Data Box Edge Device ID diff --git a/resource-manager/databoxedge/2022-03-01/roles/id_databoxedgedevice.go b/resource-manager/databoxedge/2022-03-01/roles/id_databoxedgedevice.go index 70e1837c189..5a25dec8880 100644 --- a/resource-manager/databoxedge/2022-03-01/roles/id_databoxedgedevice.go +++ b/resource-manager/databoxedge/2022-03-01/roles/id_databoxedgedevice.go @@ -36,19 +36,9 @@ func ParseDataBoxEdgeDeviceID(input string) (*DataBoxEdgeDeviceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDataBoxEdgeDeviceIDInsensitively(input string) (*DataBoxEdgeDeviceId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DataBoxEdgeDeviceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - return &id, nil + return nil } // ValidateDataBoxEdgeDeviceID checks that 'input' can be parsed as a Data Box Edge Device ID diff --git a/resource-manager/databoxedge/2022-03-01/roles/id_role.go b/resource-manager/databoxedge/2022-03-01/roles/id_role.go index 78d02157218..98a20639ad0 100644 --- a/resource-manager/databoxedge/2022-03-01/roles/id_role.go +++ b/resource-manager/databoxedge/2022-03-01/roles/id_role.go @@ -38,23 +38,9 @@ func ParseRoleID(input string) (*RoleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RoleId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) - } - - if id.RoleName, ok = parsed.Parsed["roleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRoleIDInsensitively(input string) (*RoleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RoleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RoleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - if id.RoleName, ok = parsed.Parsed["roleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleName", *parsed) + if id.RoleName, ok = input.Parsed["roleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "roleName", input) } - return &id, nil + return nil } // ValidateRoleID checks that 'input' can be parsed as a Role ID diff --git a/resource-manager/databoxedge/2022-03-01/shares/id_databoxedgedevice.go b/resource-manager/databoxedge/2022-03-01/shares/id_databoxedgedevice.go index 2d0b3c52e0c..f13dc5d178c 100644 --- a/resource-manager/databoxedge/2022-03-01/shares/id_databoxedgedevice.go +++ b/resource-manager/databoxedge/2022-03-01/shares/id_databoxedgedevice.go @@ -36,19 +36,9 @@ func ParseDataBoxEdgeDeviceID(input string) (*DataBoxEdgeDeviceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDataBoxEdgeDeviceIDInsensitively(input string) (*DataBoxEdgeDeviceId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DataBoxEdgeDeviceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - return &id, nil + return nil } // ValidateDataBoxEdgeDeviceID checks that 'input' can be parsed as a Data Box Edge Device ID diff --git a/resource-manager/databoxedge/2022-03-01/shares/id_share.go b/resource-manager/databoxedge/2022-03-01/shares/id_share.go index eecb6a836f6..4cf9edba2a2 100644 --- a/resource-manager/databoxedge/2022-03-01/shares/id_share.go +++ b/resource-manager/databoxedge/2022-03-01/shares/id_share.go @@ -38,23 +38,9 @@ func ParseShareID(input string) (*ShareId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ShareId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) - } - - if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseShareIDInsensitively(input string) (*ShareId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ShareId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ShareId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareName", *parsed) + if id.ShareName, ok = input.Parsed["shareName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "shareName", input) } - return &id, nil + return nil } // ValidateShareID checks that 'input' can be parsed as a Share ID diff --git a/resource-manager/databoxedge/2022-03-01/storageaccountcredentials/id_databoxedgedevice.go b/resource-manager/databoxedge/2022-03-01/storageaccountcredentials/id_databoxedgedevice.go index 3fb4ffb2e9f..b5faa2f3c40 100644 --- a/resource-manager/databoxedge/2022-03-01/storageaccountcredentials/id_databoxedgedevice.go +++ b/resource-manager/databoxedge/2022-03-01/storageaccountcredentials/id_databoxedgedevice.go @@ -36,19 +36,9 @@ func ParseDataBoxEdgeDeviceID(input string) (*DataBoxEdgeDeviceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDataBoxEdgeDeviceIDInsensitively(input string) (*DataBoxEdgeDeviceId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DataBoxEdgeDeviceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - return &id, nil + return nil } // ValidateDataBoxEdgeDeviceID checks that 'input' can be parsed as a Data Box Edge Device ID diff --git a/resource-manager/databoxedge/2022-03-01/storageaccountcredentials/id_storageaccountcredential.go b/resource-manager/databoxedge/2022-03-01/storageaccountcredentials/id_storageaccountcredential.go index 5218e359707..c1b578ede21 100644 --- a/resource-manager/databoxedge/2022-03-01/storageaccountcredentials/id_storageaccountcredential.go +++ b/resource-manager/databoxedge/2022-03-01/storageaccountcredentials/id_storageaccountcredential.go @@ -38,23 +38,9 @@ func ParseStorageAccountCredentialID(input string) (*StorageAccountCredentialId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageAccountCredentialId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) - } - - if id.StorageAccountCredentialName, ok = parsed.Parsed["storageAccountCredentialName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountCredentialName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseStorageAccountCredentialIDInsensitively(input string) (*StorageAccount return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageAccountCredentialId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *StorageAccountCredentialId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - if id.StorageAccountCredentialName, ok = parsed.Parsed["storageAccountCredentialName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountCredentialName", *parsed) + if id.StorageAccountCredentialName, ok = input.Parsed["storageAccountCredentialName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageAccountCredentialName", input) } - return &id, nil + return nil } // ValidateStorageAccountCredentialID checks that 'input' can be parsed as a Storage Account Credential ID diff --git a/resource-manager/databoxedge/2022-03-01/storageaccounts/id_databoxedgedevice.go b/resource-manager/databoxedge/2022-03-01/storageaccounts/id_databoxedgedevice.go index 2d103a81a8f..d0b763e81d9 100644 --- a/resource-manager/databoxedge/2022-03-01/storageaccounts/id_databoxedgedevice.go +++ b/resource-manager/databoxedge/2022-03-01/storageaccounts/id_databoxedgedevice.go @@ -36,19 +36,9 @@ func ParseDataBoxEdgeDeviceID(input string) (*DataBoxEdgeDeviceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDataBoxEdgeDeviceIDInsensitively(input string) (*DataBoxEdgeDeviceId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DataBoxEdgeDeviceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - return &id, nil + return nil } // ValidateDataBoxEdgeDeviceID checks that 'input' can be parsed as a Data Box Edge Device ID diff --git a/resource-manager/databoxedge/2022-03-01/storageaccounts/id_storageaccount.go b/resource-manager/databoxedge/2022-03-01/storageaccounts/id_storageaccount.go index 452af3f20a0..35e7920d66c 100644 --- a/resource-manager/databoxedge/2022-03-01/storageaccounts/id_storageaccount.go +++ b/resource-manager/databoxedge/2022-03-01/storageaccounts/id_storageaccount.go @@ -38,23 +38,9 @@ func ParseStorageAccountID(input string) (*StorageAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageAccountId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) - } - - if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseStorageAccountIDInsensitively(input string) (*StorageAccountId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *StorageAccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) + if id.StorageAccountName, ok = input.Parsed["storageAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", input) } - return &id, nil + return nil } // ValidateStorageAccountID checks that 'input' can be parsed as a Storage Account ID diff --git a/resource-manager/databoxedge/2022-03-01/supportpackages/id_databoxedgedevice.go b/resource-manager/databoxedge/2022-03-01/supportpackages/id_databoxedgedevice.go index 7d605384670..a9b72b85fcf 100644 --- a/resource-manager/databoxedge/2022-03-01/supportpackages/id_databoxedgedevice.go +++ b/resource-manager/databoxedge/2022-03-01/supportpackages/id_databoxedgedevice.go @@ -36,19 +36,9 @@ func ParseDataBoxEdgeDeviceID(input string) (*DataBoxEdgeDeviceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDataBoxEdgeDeviceIDInsensitively(input string) (*DataBoxEdgeDeviceId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DataBoxEdgeDeviceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - return &id, nil + return nil } // ValidateDataBoxEdgeDeviceID checks that 'input' can be parsed as a Data Box Edge Device ID diff --git a/resource-manager/databoxedge/2022-03-01/triggers/id_databoxedgedevice.go b/resource-manager/databoxedge/2022-03-01/triggers/id_databoxedgedevice.go index fd25943b94b..37fa31a674d 100644 --- a/resource-manager/databoxedge/2022-03-01/triggers/id_databoxedgedevice.go +++ b/resource-manager/databoxedge/2022-03-01/triggers/id_databoxedgedevice.go @@ -36,19 +36,9 @@ func ParseDataBoxEdgeDeviceID(input string) (*DataBoxEdgeDeviceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDataBoxEdgeDeviceIDInsensitively(input string) (*DataBoxEdgeDeviceId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DataBoxEdgeDeviceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - return &id, nil + return nil } // ValidateDataBoxEdgeDeviceID checks that 'input' can be parsed as a Data Box Edge Device ID diff --git a/resource-manager/databoxedge/2022-03-01/triggers/id_trigger.go b/resource-manager/databoxedge/2022-03-01/triggers/id_trigger.go index de612427668..9bce4fb6c60 100644 --- a/resource-manager/databoxedge/2022-03-01/triggers/id_trigger.go +++ b/resource-manager/databoxedge/2022-03-01/triggers/id_trigger.go @@ -38,23 +38,9 @@ func ParseTriggerID(input string) (*TriggerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TriggerId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) - } - - if id.TriggerName, ok = parsed.Parsed["triggerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTriggerIDInsensitively(input string) (*TriggerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TriggerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TriggerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - if id.TriggerName, ok = parsed.Parsed["triggerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggerName", *parsed) + if id.TriggerName, ok = input.Parsed["triggerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "triggerName", input) } - return &id, nil + return nil } // ValidateTriggerID checks that 'input' can be parsed as a Trigger ID diff --git a/resource-manager/databoxedge/2022-03-01/users/id_databoxedgedevice.go b/resource-manager/databoxedge/2022-03-01/users/id_databoxedgedevice.go index f558d6e1a10..60f86b9c8e5 100644 --- a/resource-manager/databoxedge/2022-03-01/users/id_databoxedgedevice.go +++ b/resource-manager/databoxedge/2022-03-01/users/id_databoxedgedevice.go @@ -36,19 +36,9 @@ func ParseDataBoxEdgeDeviceID(input string) (*DataBoxEdgeDeviceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDataBoxEdgeDeviceIDInsensitively(input string) (*DataBoxEdgeDeviceId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DataBoxEdgeDeviceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - return &id, nil + return nil } // ValidateDataBoxEdgeDeviceID checks that 'input' can be parsed as a Data Box Edge Device ID diff --git a/resource-manager/databoxedge/2022-03-01/users/id_user.go b/resource-manager/databoxedge/2022-03-01/users/id_user.go index e9c8a92f433..bc3f6516947 100644 --- a/resource-manager/databoxedge/2022-03-01/users/id_user.go +++ b/resource-manager/databoxedge/2022-03-01/users/id_user.go @@ -38,23 +38,9 @@ func ParseUserID(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) - } - - if id.UserName, ok = parsed.Parsed["userName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseUserIDInsensitively(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UserId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - if id.UserName, ok = parsed.Parsed["userName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userName", *parsed) + if id.UserName, ok = input.Parsed["userName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userName", input) } - return &id, nil + return nil } // ValidateUserID checks that 'input' can be parsed as a User ID diff --git a/resource-manager/databoxedge/2023-07-01/addons/id_addon.go b/resource-manager/databoxedge/2023-07-01/addons/id_addon.go index 483144b96c7..d31ab7ee49e 100644 --- a/resource-manager/databoxedge/2023-07-01/addons/id_addon.go +++ b/resource-manager/databoxedge/2023-07-01/addons/id_addon.go @@ -40,27 +40,9 @@ func ParseAddonID(input string) (*AddonId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AddonId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) - } - - if id.RoleName, ok = parsed.Parsed["roleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleName", *parsed) - } - - if id.AddonName, ok = parsed.Parsed["addonName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "addonName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseAddonIDInsensitively(input string) (*AddonId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AddonId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *AddonId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - if id.RoleName, ok = parsed.Parsed["roleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleName", *parsed) + if id.RoleName, ok = input.Parsed["roleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "roleName", input) } - if id.AddonName, ok = parsed.Parsed["addonName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "addonName", *parsed) + if id.AddonName, ok = input.Parsed["addonName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "addonName", input) } - return &id, nil + return nil } // ValidateAddonID checks that 'input' can be parsed as a Addon ID diff --git a/resource-manager/databoxedge/2023-07-01/addons/id_role.go b/resource-manager/databoxedge/2023-07-01/addons/id_role.go index b28fe219108..d7c1fa7c2aa 100644 --- a/resource-manager/databoxedge/2023-07-01/addons/id_role.go +++ b/resource-manager/databoxedge/2023-07-01/addons/id_role.go @@ -38,23 +38,9 @@ func ParseRoleID(input string) (*RoleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RoleId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) - } - - if id.RoleName, ok = parsed.Parsed["roleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRoleIDInsensitively(input string) (*RoleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RoleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RoleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - if id.RoleName, ok = parsed.Parsed["roleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleName", *parsed) + if id.RoleName, ok = input.Parsed["roleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "roleName", input) } - return &id, nil + return nil } // ValidateRoleID checks that 'input' can be parsed as a Role ID diff --git a/resource-manager/databoxedge/2023-07-01/alerts/id_alert.go b/resource-manager/databoxedge/2023-07-01/alerts/id_alert.go index 7b6d135e9a9..7aad7204964 100644 --- a/resource-manager/databoxedge/2023-07-01/alerts/id_alert.go +++ b/resource-manager/databoxedge/2023-07-01/alerts/id_alert.go @@ -38,23 +38,9 @@ func ParseAlertID(input string) (*AlertId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) - } - - if id.AlertName, ok = parsed.Parsed["alertName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "alertName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAlertIDInsensitively(input string) (*AlertId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AlertId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - if id.AlertName, ok = parsed.Parsed["alertName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "alertName", *parsed) + if id.AlertName, ok = input.Parsed["alertName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "alertName", input) } - return &id, nil + return nil } // ValidateAlertID checks that 'input' can be parsed as a Alert ID diff --git a/resource-manager/databoxedge/2023-07-01/alerts/id_databoxedgedevice.go b/resource-manager/databoxedge/2023-07-01/alerts/id_databoxedgedevice.go index 580e5892235..91056c15fff 100644 --- a/resource-manager/databoxedge/2023-07-01/alerts/id_databoxedgedevice.go +++ b/resource-manager/databoxedge/2023-07-01/alerts/id_databoxedgedevice.go @@ -36,19 +36,9 @@ func ParseDataBoxEdgeDeviceID(input string) (*DataBoxEdgeDeviceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDataBoxEdgeDeviceIDInsensitively(input string) (*DataBoxEdgeDeviceId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DataBoxEdgeDeviceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - return &id, nil + return nil } // ValidateDataBoxEdgeDeviceID checks that 'input' can be parsed as a Data Box Edge Device ID diff --git a/resource-manager/databoxedge/2023-07-01/bandwidthschedules/id_bandwidthschedule.go b/resource-manager/databoxedge/2023-07-01/bandwidthschedules/id_bandwidthschedule.go index d26975dc0fa..e4abdd8f5d6 100644 --- a/resource-manager/databoxedge/2023-07-01/bandwidthschedules/id_bandwidthschedule.go +++ b/resource-manager/databoxedge/2023-07-01/bandwidthschedules/id_bandwidthschedule.go @@ -38,23 +38,9 @@ func ParseBandwidthScheduleID(input string) (*BandwidthScheduleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BandwidthScheduleId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) - } - - if id.BandwidthScheduleName, ok = parsed.Parsed["bandwidthScheduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bandwidthScheduleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBandwidthScheduleIDInsensitively(input string) (*BandwidthScheduleId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BandwidthScheduleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BandwidthScheduleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - if id.BandwidthScheduleName, ok = parsed.Parsed["bandwidthScheduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bandwidthScheduleName", *parsed) + if id.BandwidthScheduleName, ok = input.Parsed["bandwidthScheduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "bandwidthScheduleName", input) } - return &id, nil + return nil } // ValidateBandwidthScheduleID checks that 'input' can be parsed as a Bandwidth Schedule ID diff --git a/resource-manager/databoxedge/2023-07-01/bandwidthschedules/id_databoxedgedevice.go b/resource-manager/databoxedge/2023-07-01/bandwidthschedules/id_databoxedgedevice.go index 705dc57a55b..bb3a1d49cdc 100644 --- a/resource-manager/databoxedge/2023-07-01/bandwidthschedules/id_databoxedgedevice.go +++ b/resource-manager/databoxedge/2023-07-01/bandwidthschedules/id_databoxedgedevice.go @@ -36,19 +36,9 @@ func ParseDataBoxEdgeDeviceID(input string) (*DataBoxEdgeDeviceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDataBoxEdgeDeviceIDInsensitively(input string) (*DataBoxEdgeDeviceId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DataBoxEdgeDeviceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - return &id, nil + return nil } // ValidateDataBoxEdgeDeviceID checks that 'input' can be parsed as a Data Box Edge Device ID diff --git a/resource-manager/databoxedge/2023-07-01/containers/id_container.go b/resource-manager/databoxedge/2023-07-01/containers/id_container.go index ee5cd7d4bdd..0e4e1f909d8 100644 --- a/resource-manager/databoxedge/2023-07-01/containers/id_container.go +++ b/resource-manager/databoxedge/2023-07-01/containers/id_container.go @@ -40,27 +40,9 @@ func ParseContainerID(input string) (*ContainerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) - } - - if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) - } - - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseContainerIDInsensitively(input string) (*ContainerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ContainerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) + if id.StorageAccountName, ok = input.Parsed["storageAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", input) } - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) + if id.ContainerName, ok = input.Parsed["containerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerName", input) } - return &id, nil + return nil } // ValidateContainerID checks that 'input' can be parsed as a Container ID diff --git a/resource-manager/databoxedge/2023-07-01/containers/id_storageaccount.go b/resource-manager/databoxedge/2023-07-01/containers/id_storageaccount.go index f061b966624..657be903067 100644 --- a/resource-manager/databoxedge/2023-07-01/containers/id_storageaccount.go +++ b/resource-manager/databoxedge/2023-07-01/containers/id_storageaccount.go @@ -38,23 +38,9 @@ func ParseStorageAccountID(input string) (*StorageAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageAccountId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) - } - - if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseStorageAccountIDInsensitively(input string) (*StorageAccountId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *StorageAccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) + if id.StorageAccountName, ok = input.Parsed["storageAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", input) } - return &id, nil + return nil } // ValidateStorageAccountID checks that 'input' can be parsed as a Storage Account ID diff --git a/resource-manager/databoxedge/2023-07-01/devicecapacitycheck/id_databoxedgedevice.go b/resource-manager/databoxedge/2023-07-01/devicecapacitycheck/id_databoxedgedevice.go index a3a10424f0c..3ec0fb44ea4 100644 --- a/resource-manager/databoxedge/2023-07-01/devicecapacitycheck/id_databoxedgedevice.go +++ b/resource-manager/databoxedge/2023-07-01/devicecapacitycheck/id_databoxedgedevice.go @@ -36,19 +36,9 @@ func ParseDataBoxEdgeDeviceID(input string) (*DataBoxEdgeDeviceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDataBoxEdgeDeviceIDInsensitively(input string) (*DataBoxEdgeDeviceId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DataBoxEdgeDeviceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - return &id, nil + return nil } // ValidateDataBoxEdgeDeviceID checks that 'input' can be parsed as a Data Box Edge Device ID diff --git a/resource-manager/databoxedge/2023-07-01/devicecapacityinfo/id_databoxedgedevice.go b/resource-manager/databoxedge/2023-07-01/devicecapacityinfo/id_databoxedgedevice.go index ba45f9a75bb..c3e90fd1c5e 100644 --- a/resource-manager/databoxedge/2023-07-01/devicecapacityinfo/id_databoxedgedevice.go +++ b/resource-manager/databoxedge/2023-07-01/devicecapacityinfo/id_databoxedgedevice.go @@ -36,19 +36,9 @@ func ParseDataBoxEdgeDeviceID(input string) (*DataBoxEdgeDeviceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDataBoxEdgeDeviceIDInsensitively(input string) (*DataBoxEdgeDeviceId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DataBoxEdgeDeviceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - return &id, nil + return nil } // ValidateDataBoxEdgeDeviceID checks that 'input' can be parsed as a Data Box Edge Device ID diff --git a/resource-manager/databoxedge/2023-07-01/devices/id_databoxedgedevice.go b/resource-manager/databoxedge/2023-07-01/devices/id_databoxedgedevice.go index 055d38cf5aa..dd95c70ba23 100644 --- a/resource-manager/databoxedge/2023-07-01/devices/id_databoxedgedevice.go +++ b/resource-manager/databoxedge/2023-07-01/devices/id_databoxedgedevice.go @@ -36,19 +36,9 @@ func ParseDataBoxEdgeDeviceID(input string) (*DataBoxEdgeDeviceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDataBoxEdgeDeviceIDInsensitively(input string) (*DataBoxEdgeDeviceId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DataBoxEdgeDeviceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - return &id, nil + return nil } // ValidateDataBoxEdgeDeviceID checks that 'input' can be parsed as a Data Box Edge Device ID diff --git a/resource-manager/databoxedge/2023-07-01/diagnosticsettings/id_databoxedgedevice.go b/resource-manager/databoxedge/2023-07-01/diagnosticsettings/id_databoxedgedevice.go index 4e7c2e3893b..26f878f6425 100644 --- a/resource-manager/databoxedge/2023-07-01/diagnosticsettings/id_databoxedgedevice.go +++ b/resource-manager/databoxedge/2023-07-01/diagnosticsettings/id_databoxedgedevice.go @@ -36,19 +36,9 @@ func ParseDataBoxEdgeDeviceID(input string) (*DataBoxEdgeDeviceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDataBoxEdgeDeviceIDInsensitively(input string) (*DataBoxEdgeDeviceId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DataBoxEdgeDeviceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - return &id, nil + return nil } // ValidateDataBoxEdgeDeviceID checks that 'input' can be parsed as a Data Box Edge Device ID diff --git a/resource-manager/databoxedge/2023-07-01/jobs/id_job.go b/resource-manager/databoxedge/2023-07-01/jobs/id_job.go index 194bfcc1306..d437e028845 100644 --- a/resource-manager/databoxedge/2023-07-01/jobs/id_job.go +++ b/resource-manager/databoxedge/2023-07-01/jobs/id_job.go @@ -38,23 +38,9 @@ func ParseJobID(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) - } - - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseJobIDInsensitively(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *JobId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - return &id, nil + return nil } // ValidateJobID checks that 'input' can be parsed as a Job ID diff --git a/resource-manager/databoxedge/2023-07-01/monitoringconfig/id_role.go b/resource-manager/databoxedge/2023-07-01/monitoringconfig/id_role.go index a35c1f453d8..2bbd9ba4631 100644 --- a/resource-manager/databoxedge/2023-07-01/monitoringconfig/id_role.go +++ b/resource-manager/databoxedge/2023-07-01/monitoringconfig/id_role.go @@ -38,23 +38,9 @@ func ParseRoleID(input string) (*RoleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RoleId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) - } - - if id.RoleName, ok = parsed.Parsed["roleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRoleIDInsensitively(input string) (*RoleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RoleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RoleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - if id.RoleName, ok = parsed.Parsed["roleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleName", *parsed) + if id.RoleName, ok = input.Parsed["roleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "roleName", input) } - return &id, nil + return nil } // ValidateRoleID checks that 'input' can be parsed as a Role ID diff --git a/resource-manager/databoxedge/2023-07-01/nodes/id_databoxedgedevice.go b/resource-manager/databoxedge/2023-07-01/nodes/id_databoxedgedevice.go index b411568757f..4211fbcb366 100644 --- a/resource-manager/databoxedge/2023-07-01/nodes/id_databoxedgedevice.go +++ b/resource-manager/databoxedge/2023-07-01/nodes/id_databoxedgedevice.go @@ -36,19 +36,9 @@ func ParseDataBoxEdgeDeviceID(input string) (*DataBoxEdgeDeviceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDataBoxEdgeDeviceIDInsensitively(input string) (*DataBoxEdgeDeviceId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DataBoxEdgeDeviceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - return &id, nil + return nil } // ValidateDataBoxEdgeDeviceID checks that 'input' can be parsed as a Data Box Edge Device ID diff --git a/resource-manager/databoxedge/2023-07-01/orders/id_databoxedgedevice.go b/resource-manager/databoxedge/2023-07-01/orders/id_databoxedgedevice.go index da50ab36235..feca815cec2 100644 --- a/resource-manager/databoxedge/2023-07-01/orders/id_databoxedgedevice.go +++ b/resource-manager/databoxedge/2023-07-01/orders/id_databoxedgedevice.go @@ -36,19 +36,9 @@ func ParseDataBoxEdgeDeviceID(input string) (*DataBoxEdgeDeviceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDataBoxEdgeDeviceIDInsensitively(input string) (*DataBoxEdgeDeviceId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DataBoxEdgeDeviceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - return &id, nil + return nil } // ValidateDataBoxEdgeDeviceID checks that 'input' can be parsed as a Data Box Edge Device ID diff --git a/resource-manager/databoxedge/2023-07-01/roles/id_databoxedgedevice.go b/resource-manager/databoxedge/2023-07-01/roles/id_databoxedgedevice.go index 70e1837c189..5a25dec8880 100644 --- a/resource-manager/databoxedge/2023-07-01/roles/id_databoxedgedevice.go +++ b/resource-manager/databoxedge/2023-07-01/roles/id_databoxedgedevice.go @@ -36,19 +36,9 @@ func ParseDataBoxEdgeDeviceID(input string) (*DataBoxEdgeDeviceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDataBoxEdgeDeviceIDInsensitively(input string) (*DataBoxEdgeDeviceId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DataBoxEdgeDeviceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - return &id, nil + return nil } // ValidateDataBoxEdgeDeviceID checks that 'input' can be parsed as a Data Box Edge Device ID diff --git a/resource-manager/databoxedge/2023-07-01/roles/id_role.go b/resource-manager/databoxedge/2023-07-01/roles/id_role.go index 78d02157218..98a20639ad0 100644 --- a/resource-manager/databoxedge/2023-07-01/roles/id_role.go +++ b/resource-manager/databoxedge/2023-07-01/roles/id_role.go @@ -38,23 +38,9 @@ func ParseRoleID(input string) (*RoleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RoleId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) - } - - if id.RoleName, ok = parsed.Parsed["roleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRoleIDInsensitively(input string) (*RoleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RoleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RoleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - if id.RoleName, ok = parsed.Parsed["roleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleName", *parsed) + if id.RoleName, ok = input.Parsed["roleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "roleName", input) } - return &id, nil + return nil } // ValidateRoleID checks that 'input' can be parsed as a Role ID diff --git a/resource-manager/databoxedge/2023-07-01/shares/id_databoxedgedevice.go b/resource-manager/databoxedge/2023-07-01/shares/id_databoxedgedevice.go index 2d0b3c52e0c..f13dc5d178c 100644 --- a/resource-manager/databoxedge/2023-07-01/shares/id_databoxedgedevice.go +++ b/resource-manager/databoxedge/2023-07-01/shares/id_databoxedgedevice.go @@ -36,19 +36,9 @@ func ParseDataBoxEdgeDeviceID(input string) (*DataBoxEdgeDeviceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDataBoxEdgeDeviceIDInsensitively(input string) (*DataBoxEdgeDeviceId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DataBoxEdgeDeviceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - return &id, nil + return nil } // ValidateDataBoxEdgeDeviceID checks that 'input' can be parsed as a Data Box Edge Device ID diff --git a/resource-manager/databoxedge/2023-07-01/shares/id_share.go b/resource-manager/databoxedge/2023-07-01/shares/id_share.go index eecb6a836f6..4cf9edba2a2 100644 --- a/resource-manager/databoxedge/2023-07-01/shares/id_share.go +++ b/resource-manager/databoxedge/2023-07-01/shares/id_share.go @@ -38,23 +38,9 @@ func ParseShareID(input string) (*ShareId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ShareId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) - } - - if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseShareIDInsensitively(input string) (*ShareId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ShareId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ShareId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareName", *parsed) + if id.ShareName, ok = input.Parsed["shareName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "shareName", input) } - return &id, nil + return nil } // ValidateShareID checks that 'input' can be parsed as a Share ID diff --git a/resource-manager/databoxedge/2023-07-01/storageaccountcredentials/id_databoxedgedevice.go b/resource-manager/databoxedge/2023-07-01/storageaccountcredentials/id_databoxedgedevice.go index 3fb4ffb2e9f..b5faa2f3c40 100644 --- a/resource-manager/databoxedge/2023-07-01/storageaccountcredentials/id_databoxedgedevice.go +++ b/resource-manager/databoxedge/2023-07-01/storageaccountcredentials/id_databoxedgedevice.go @@ -36,19 +36,9 @@ func ParseDataBoxEdgeDeviceID(input string) (*DataBoxEdgeDeviceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDataBoxEdgeDeviceIDInsensitively(input string) (*DataBoxEdgeDeviceId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DataBoxEdgeDeviceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - return &id, nil + return nil } // ValidateDataBoxEdgeDeviceID checks that 'input' can be parsed as a Data Box Edge Device ID diff --git a/resource-manager/databoxedge/2023-07-01/storageaccountcredentials/id_storageaccountcredential.go b/resource-manager/databoxedge/2023-07-01/storageaccountcredentials/id_storageaccountcredential.go index 5218e359707..c1b578ede21 100644 --- a/resource-manager/databoxedge/2023-07-01/storageaccountcredentials/id_storageaccountcredential.go +++ b/resource-manager/databoxedge/2023-07-01/storageaccountcredentials/id_storageaccountcredential.go @@ -38,23 +38,9 @@ func ParseStorageAccountCredentialID(input string) (*StorageAccountCredentialId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageAccountCredentialId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) - } - - if id.StorageAccountCredentialName, ok = parsed.Parsed["storageAccountCredentialName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountCredentialName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseStorageAccountCredentialIDInsensitively(input string) (*StorageAccount return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageAccountCredentialId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *StorageAccountCredentialId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - if id.StorageAccountCredentialName, ok = parsed.Parsed["storageAccountCredentialName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountCredentialName", *parsed) + if id.StorageAccountCredentialName, ok = input.Parsed["storageAccountCredentialName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageAccountCredentialName", input) } - return &id, nil + return nil } // ValidateStorageAccountCredentialID checks that 'input' can be parsed as a Storage Account Credential ID diff --git a/resource-manager/databoxedge/2023-07-01/storageaccounts/id_databoxedgedevice.go b/resource-manager/databoxedge/2023-07-01/storageaccounts/id_databoxedgedevice.go index 2d103a81a8f..d0b763e81d9 100644 --- a/resource-manager/databoxedge/2023-07-01/storageaccounts/id_databoxedgedevice.go +++ b/resource-manager/databoxedge/2023-07-01/storageaccounts/id_databoxedgedevice.go @@ -36,19 +36,9 @@ func ParseDataBoxEdgeDeviceID(input string) (*DataBoxEdgeDeviceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDataBoxEdgeDeviceIDInsensitively(input string) (*DataBoxEdgeDeviceId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DataBoxEdgeDeviceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - return &id, nil + return nil } // ValidateDataBoxEdgeDeviceID checks that 'input' can be parsed as a Data Box Edge Device ID diff --git a/resource-manager/databoxedge/2023-07-01/storageaccounts/id_storageaccount.go b/resource-manager/databoxedge/2023-07-01/storageaccounts/id_storageaccount.go index 452af3f20a0..35e7920d66c 100644 --- a/resource-manager/databoxedge/2023-07-01/storageaccounts/id_storageaccount.go +++ b/resource-manager/databoxedge/2023-07-01/storageaccounts/id_storageaccount.go @@ -38,23 +38,9 @@ func ParseStorageAccountID(input string) (*StorageAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageAccountId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) - } - - if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseStorageAccountIDInsensitively(input string) (*StorageAccountId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *StorageAccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) + if id.StorageAccountName, ok = input.Parsed["storageAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", input) } - return &id, nil + return nil } // ValidateStorageAccountID checks that 'input' can be parsed as a Storage Account ID diff --git a/resource-manager/databoxedge/2023-07-01/supportpackages/id_databoxedgedevice.go b/resource-manager/databoxedge/2023-07-01/supportpackages/id_databoxedgedevice.go index 7d605384670..a9b72b85fcf 100644 --- a/resource-manager/databoxedge/2023-07-01/supportpackages/id_databoxedgedevice.go +++ b/resource-manager/databoxedge/2023-07-01/supportpackages/id_databoxedgedevice.go @@ -36,19 +36,9 @@ func ParseDataBoxEdgeDeviceID(input string) (*DataBoxEdgeDeviceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDataBoxEdgeDeviceIDInsensitively(input string) (*DataBoxEdgeDeviceId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DataBoxEdgeDeviceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - return &id, nil + return nil } // ValidateDataBoxEdgeDeviceID checks that 'input' can be parsed as a Data Box Edge Device ID diff --git a/resource-manager/databoxedge/2023-07-01/triggers/id_databoxedgedevice.go b/resource-manager/databoxedge/2023-07-01/triggers/id_databoxedgedevice.go index fd25943b94b..37fa31a674d 100644 --- a/resource-manager/databoxedge/2023-07-01/triggers/id_databoxedgedevice.go +++ b/resource-manager/databoxedge/2023-07-01/triggers/id_databoxedgedevice.go @@ -36,19 +36,9 @@ func ParseDataBoxEdgeDeviceID(input string) (*DataBoxEdgeDeviceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDataBoxEdgeDeviceIDInsensitively(input string) (*DataBoxEdgeDeviceId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DataBoxEdgeDeviceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - return &id, nil + return nil } // ValidateDataBoxEdgeDeviceID checks that 'input' can be parsed as a Data Box Edge Device ID diff --git a/resource-manager/databoxedge/2023-07-01/triggers/id_trigger.go b/resource-manager/databoxedge/2023-07-01/triggers/id_trigger.go index de612427668..9bce4fb6c60 100644 --- a/resource-manager/databoxedge/2023-07-01/triggers/id_trigger.go +++ b/resource-manager/databoxedge/2023-07-01/triggers/id_trigger.go @@ -38,23 +38,9 @@ func ParseTriggerID(input string) (*TriggerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TriggerId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) - } - - if id.TriggerName, ok = parsed.Parsed["triggerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTriggerIDInsensitively(input string) (*TriggerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TriggerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TriggerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - if id.TriggerName, ok = parsed.Parsed["triggerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggerName", *parsed) + if id.TriggerName, ok = input.Parsed["triggerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "triggerName", input) } - return &id, nil + return nil } // ValidateTriggerID checks that 'input' can be parsed as a Trigger ID diff --git a/resource-manager/databoxedge/2023-07-01/users/id_databoxedgedevice.go b/resource-manager/databoxedge/2023-07-01/users/id_databoxedgedevice.go index f558d6e1a10..60f86b9c8e5 100644 --- a/resource-manager/databoxedge/2023-07-01/users/id_databoxedgedevice.go +++ b/resource-manager/databoxedge/2023-07-01/users/id_databoxedgedevice.go @@ -36,19 +36,9 @@ func ParseDataBoxEdgeDeviceID(input string) (*DataBoxEdgeDeviceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDataBoxEdgeDeviceIDInsensitively(input string) (*DataBoxEdgeDeviceId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataBoxEdgeDeviceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DataBoxEdgeDeviceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - return &id, nil + return nil } // ValidateDataBoxEdgeDeviceID checks that 'input' can be parsed as a Data Box Edge Device ID diff --git a/resource-manager/databoxedge/2023-07-01/users/id_user.go b/resource-manager/databoxedge/2023-07-01/users/id_user.go index e9c8a92f433..bc3f6516947 100644 --- a/resource-manager/databoxedge/2023-07-01/users/id_user.go +++ b/resource-manager/databoxedge/2023-07-01/users/id_user.go @@ -38,23 +38,9 @@ func ParseUserID(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} - - 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.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) - } - - if id.UserName, ok = parsed.Parsed["userName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseUserIDInsensitively(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UserId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataBoxEdgeDeviceName, ok = parsed.Parsed["dataBoxEdgeDeviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", *parsed) + if id.DataBoxEdgeDeviceName, ok = input.Parsed["dataBoxEdgeDeviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataBoxEdgeDeviceName", input) } - if id.UserName, ok = parsed.Parsed["userName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userName", *parsed) + if id.UserName, ok = input.Parsed["userName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userName", input) } - return &id, nil + return nil } // ValidateUserID checks that 'input' can be parsed as a User ID diff --git a/resource-manager/databricks/2022-04-01-preview/accessconnector/id_accessconnector.go b/resource-manager/databricks/2022-04-01-preview/accessconnector/id_accessconnector.go index 73e40286db1..e5bfb7b650d 100644 --- a/resource-manager/databricks/2022-04-01-preview/accessconnector/id_accessconnector.go +++ b/resource-manager/databricks/2022-04-01-preview/accessconnector/id_accessconnector.go @@ -36,19 +36,9 @@ func ParseAccessConnectorID(input string) (*AccessConnectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccessConnectorId{} - - 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.AccessConnectorName, ok = parsed.Parsed["accessConnectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accessConnectorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAccessConnectorIDInsensitively(input string) (*AccessConnectorId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccessConnectorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AccessConnectorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccessConnectorName, ok = parsed.Parsed["accessConnectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accessConnectorName", *parsed) + if id.AccessConnectorName, ok = input.Parsed["accessConnectorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accessConnectorName", input) } - return &id, nil + return nil } // ValidateAccessConnectorID checks that 'input' can be parsed as a Access Connector ID diff --git a/resource-manager/databricks/2022-04-01-preview/delete/id_privateendpointconnection.go b/resource-manager/databricks/2022-04-01-preview/delete/id_privateendpointconnection.go index b20e9fb17da..5d8c9e10d20 100644 --- a/resource-manager/databricks/2022-04-01-preview/delete/id_privateendpointconnection.go +++ b/resource-manager/databricks/2022-04-01-preview/delete/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/databricks/2022-04-01-preview/outboundnetworkdependenciesendpoints/id_workspace.go b/resource-manager/databricks/2022-04-01-preview/outboundnetworkdependenciesendpoints/id_workspace.go index 947c3eaa8cb..50f18859d92 100644 --- a/resource-manager/databricks/2022-04-01-preview/outboundnetworkdependenciesendpoints/id_workspace.go +++ b/resource-manager/databricks/2022-04-01-preview/outboundnetworkdependenciesendpoints/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/databricks/2022-04-01-preview/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/databricks/2022-04-01-preview/privateendpointconnections/id_privateendpointconnection.go index 72c0ea6120b..546ebe6ef9b 100644 --- a/resource-manager/databricks/2022-04-01-preview/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/databricks/2022-04-01-preview/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/databricks/2022-04-01-preview/privateendpointconnections/id_workspace.go b/resource-manager/databricks/2022-04-01-preview/privateendpointconnections/id_workspace.go index 52aa1ee2a76..1265e5bbf94 100644 --- a/resource-manager/databricks/2022-04-01-preview/privateendpointconnections/id_workspace.go +++ b/resource-manager/databricks/2022-04-01-preview/privateendpointconnections/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/databricks/2022-04-01-preview/privatelinkresources/id_privatelinkresource.go b/resource-manager/databricks/2022-04-01-preview/privatelinkresources/id_privatelinkresource.go index 3113d082b09..1178f4f1184 100644 --- a/resource-manager/databricks/2022-04-01-preview/privatelinkresources/id_privatelinkresource.go +++ b/resource-manager/databricks/2022-04-01-preview/privatelinkresources/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + if id.GroupId, ok = input.Parsed["groupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "groupId", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/databricks/2022-04-01-preview/privatelinkresources/id_workspace.go b/resource-manager/databricks/2022-04-01-preview/privatelinkresources/id_workspace.go index d46f687938f..c280b6ef52f 100644 --- a/resource-manager/databricks/2022-04-01-preview/privatelinkresources/id_workspace.go +++ b/resource-manager/databricks/2022-04-01-preview/privatelinkresources/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/databricks/2022-04-01-preview/put/id_privateendpointconnection.go b/resource-manager/databricks/2022-04-01-preview/put/id_privateendpointconnection.go index 39b1bc3c9f2..b9eb6811990 100644 --- a/resource-manager/databricks/2022-04-01-preview/put/id_privateendpointconnection.go +++ b/resource-manager/databricks/2022-04-01-preview/put/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/databricks/2022-04-01-preview/vnetpeering/id_virtualnetworkpeering.go b/resource-manager/databricks/2022-04-01-preview/vnetpeering/id_virtualnetworkpeering.go index a4e54a29ac6..a1f544dfd6f 100644 --- a/resource-manager/databricks/2022-04-01-preview/vnetpeering/id_virtualnetworkpeering.go +++ b/resource-manager/databricks/2022-04-01-preview/vnetpeering/id_virtualnetworkpeering.go @@ -38,23 +38,9 @@ func ParseVirtualNetworkPeeringID(input string) (*VirtualNetworkPeeringId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkPeeringId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.VirtualNetworkPeeringName, ok = parsed.Parsed["virtualNetworkPeeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkPeeringName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualNetworkPeeringIDInsensitively(input string) (*VirtualNetworkPee return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkPeeringId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualNetworkPeeringId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.VirtualNetworkPeeringName, ok = parsed.Parsed["virtualNetworkPeeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkPeeringName", *parsed) + if id.VirtualNetworkPeeringName, ok = input.Parsed["virtualNetworkPeeringName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkPeeringName", input) } - return &id, nil + return nil } // ValidateVirtualNetworkPeeringID checks that 'input' can be parsed as a Virtual Network Peering ID diff --git a/resource-manager/databricks/2022-04-01-preview/vnetpeering/id_workspace.go b/resource-manager/databricks/2022-04-01-preview/vnetpeering/id_workspace.go index 75d5d7939dd..81b86965d91 100644 --- a/resource-manager/databricks/2022-04-01-preview/vnetpeering/id_workspace.go +++ b/resource-manager/databricks/2022-04-01-preview/vnetpeering/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/databricks/2022-04-01-preview/workspaces/id_workspace.go b/resource-manager/databricks/2022-04-01-preview/workspaces/id_workspace.go index ca5679d8f92..7bf23b118eb 100644 --- a/resource-manager/databricks/2022-04-01-preview/workspaces/id_workspace.go +++ b/resource-manager/databricks/2022-04-01-preview/workspaces/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/databricks/2022-10-01-preview/accessconnector/id_accessconnector.go b/resource-manager/databricks/2022-10-01-preview/accessconnector/id_accessconnector.go index 73e40286db1..e5bfb7b650d 100644 --- a/resource-manager/databricks/2022-10-01-preview/accessconnector/id_accessconnector.go +++ b/resource-manager/databricks/2022-10-01-preview/accessconnector/id_accessconnector.go @@ -36,19 +36,9 @@ func ParseAccessConnectorID(input string) (*AccessConnectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccessConnectorId{} - - 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.AccessConnectorName, ok = parsed.Parsed["accessConnectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accessConnectorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAccessConnectorIDInsensitively(input string) (*AccessConnectorId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccessConnectorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AccessConnectorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccessConnectorName, ok = parsed.Parsed["accessConnectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accessConnectorName", *parsed) + if id.AccessConnectorName, ok = input.Parsed["accessConnectorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accessConnectorName", input) } - return &id, nil + return nil } // ValidateAccessConnectorID checks that 'input' can be parsed as a Access Connector ID diff --git a/resource-manager/databricks/2023-02-01/delete/id_privateendpointconnection.go b/resource-manager/databricks/2023-02-01/delete/id_privateendpointconnection.go index b20e9fb17da..5d8c9e10d20 100644 --- a/resource-manager/databricks/2023-02-01/delete/id_privateendpointconnection.go +++ b/resource-manager/databricks/2023-02-01/delete/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/databricks/2023-02-01/outboundnetworkdependenciesendpoints/id_workspace.go b/resource-manager/databricks/2023-02-01/outboundnetworkdependenciesendpoints/id_workspace.go index 947c3eaa8cb..50f18859d92 100644 --- a/resource-manager/databricks/2023-02-01/outboundnetworkdependenciesendpoints/id_workspace.go +++ b/resource-manager/databricks/2023-02-01/outboundnetworkdependenciesendpoints/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/databricks/2023-02-01/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/databricks/2023-02-01/privateendpointconnections/id_privateendpointconnection.go index 72c0ea6120b..546ebe6ef9b 100644 --- a/resource-manager/databricks/2023-02-01/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/databricks/2023-02-01/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/databricks/2023-02-01/privateendpointconnections/id_workspace.go b/resource-manager/databricks/2023-02-01/privateendpointconnections/id_workspace.go index 52aa1ee2a76..1265e5bbf94 100644 --- a/resource-manager/databricks/2023-02-01/privateendpointconnections/id_workspace.go +++ b/resource-manager/databricks/2023-02-01/privateendpointconnections/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/databricks/2023-02-01/privatelinkresources/id_privatelinkresource.go b/resource-manager/databricks/2023-02-01/privatelinkresources/id_privatelinkresource.go index 3113d082b09..1178f4f1184 100644 --- a/resource-manager/databricks/2023-02-01/privatelinkresources/id_privatelinkresource.go +++ b/resource-manager/databricks/2023-02-01/privatelinkresources/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + if id.GroupId, ok = input.Parsed["groupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "groupId", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/databricks/2023-02-01/privatelinkresources/id_workspace.go b/resource-manager/databricks/2023-02-01/privatelinkresources/id_workspace.go index d46f687938f..c280b6ef52f 100644 --- a/resource-manager/databricks/2023-02-01/privatelinkresources/id_workspace.go +++ b/resource-manager/databricks/2023-02-01/privatelinkresources/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/databricks/2023-02-01/put/id_privateendpointconnection.go b/resource-manager/databricks/2023-02-01/put/id_privateendpointconnection.go index 39b1bc3c9f2..b9eb6811990 100644 --- a/resource-manager/databricks/2023-02-01/put/id_privateendpointconnection.go +++ b/resource-manager/databricks/2023-02-01/put/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/databricks/2023-02-01/vnetpeering/id_virtualnetworkpeering.go b/resource-manager/databricks/2023-02-01/vnetpeering/id_virtualnetworkpeering.go index a4e54a29ac6..a1f544dfd6f 100644 --- a/resource-manager/databricks/2023-02-01/vnetpeering/id_virtualnetworkpeering.go +++ b/resource-manager/databricks/2023-02-01/vnetpeering/id_virtualnetworkpeering.go @@ -38,23 +38,9 @@ func ParseVirtualNetworkPeeringID(input string) (*VirtualNetworkPeeringId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkPeeringId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.VirtualNetworkPeeringName, ok = parsed.Parsed["virtualNetworkPeeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkPeeringName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualNetworkPeeringIDInsensitively(input string) (*VirtualNetworkPee return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkPeeringId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualNetworkPeeringId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.VirtualNetworkPeeringName, ok = parsed.Parsed["virtualNetworkPeeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkPeeringName", *parsed) + if id.VirtualNetworkPeeringName, ok = input.Parsed["virtualNetworkPeeringName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkPeeringName", input) } - return &id, nil + return nil } // ValidateVirtualNetworkPeeringID checks that 'input' can be parsed as a Virtual Network Peering ID diff --git a/resource-manager/databricks/2023-02-01/vnetpeering/id_workspace.go b/resource-manager/databricks/2023-02-01/vnetpeering/id_workspace.go index 75d5d7939dd..81b86965d91 100644 --- a/resource-manager/databricks/2023-02-01/vnetpeering/id_workspace.go +++ b/resource-manager/databricks/2023-02-01/vnetpeering/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/databricks/2023-02-01/workspaces/id_workspace.go b/resource-manager/databricks/2023-02-01/workspaces/id_workspace.go index ca5679d8f92..7bf23b118eb 100644 --- a/resource-manager/databricks/2023-02-01/workspaces/id_workspace.go +++ b/resource-manager/databricks/2023-02-01/workspaces/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/databricks/2023-05-01/accessconnector/id_accessconnector.go b/resource-manager/databricks/2023-05-01/accessconnector/id_accessconnector.go index 73e40286db1..e5bfb7b650d 100644 --- a/resource-manager/databricks/2023-05-01/accessconnector/id_accessconnector.go +++ b/resource-manager/databricks/2023-05-01/accessconnector/id_accessconnector.go @@ -36,19 +36,9 @@ func ParseAccessConnectorID(input string) (*AccessConnectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccessConnectorId{} - - 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.AccessConnectorName, ok = parsed.Parsed["accessConnectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accessConnectorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAccessConnectorIDInsensitively(input string) (*AccessConnectorId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccessConnectorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AccessConnectorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccessConnectorName, ok = parsed.Parsed["accessConnectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accessConnectorName", *parsed) + if id.AccessConnectorName, ok = input.Parsed["accessConnectorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accessConnectorName", input) } - return &id, nil + return nil } // ValidateAccessConnectorID checks that 'input' can be parsed as a Access Connector ID diff --git a/resource-manager/datadog/2021-03-01/apikey/id_monitor.go b/resource-manager/datadog/2021-03-01/apikey/id_monitor.go index f2fc72f83d0..72284fd13d9 100644 --- a/resource-manager/datadog/2021-03-01/apikey/id_monitor.go +++ b/resource-manager/datadog/2021-03-01/apikey/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/datadog/2021-03-01/hosts/id_monitor.go b/resource-manager/datadog/2021-03-01/hosts/id_monitor.go index 365bc358163..13465f863f9 100644 --- a/resource-manager/datadog/2021-03-01/hosts/id_monitor.go +++ b/resource-manager/datadog/2021-03-01/hosts/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/datadog/2021-03-01/linkedresources/id_monitor.go b/resource-manager/datadog/2021-03-01/linkedresources/id_monitor.go index cdda6e3c2e8..7ef85c016d7 100644 --- a/resource-manager/datadog/2021-03-01/linkedresources/id_monitor.go +++ b/resource-manager/datadog/2021-03-01/linkedresources/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/datadog/2021-03-01/monitoredresources/id_monitor.go b/resource-manager/datadog/2021-03-01/monitoredresources/id_monitor.go index 49925b3c647..825f2f113fa 100644 --- a/resource-manager/datadog/2021-03-01/monitoredresources/id_monitor.go +++ b/resource-manager/datadog/2021-03-01/monitoredresources/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/datadog/2021-03-01/monitorsresource/id_monitor.go b/resource-manager/datadog/2021-03-01/monitorsresource/id_monitor.go index 44564802c48..b2b27eeaa9a 100644 --- a/resource-manager/datadog/2021-03-01/monitorsresource/id_monitor.go +++ b/resource-manager/datadog/2021-03-01/monitorsresource/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/datadog/2021-03-01/refreshsetpasswordlink/id_monitor.go b/resource-manager/datadog/2021-03-01/refreshsetpasswordlink/id_monitor.go index 591cce6202c..ecfe987a66e 100644 --- a/resource-manager/datadog/2021-03-01/refreshsetpasswordlink/id_monitor.go +++ b/resource-manager/datadog/2021-03-01/refreshsetpasswordlink/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/datadog/2021-03-01/rules/id_monitor.go b/resource-manager/datadog/2021-03-01/rules/id_monitor.go index 77503953b28..bf61b2c04ff 100644 --- a/resource-manager/datadog/2021-03-01/rules/id_monitor.go +++ b/resource-manager/datadog/2021-03-01/rules/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/datadog/2021-03-01/rules/id_tagrule.go b/resource-manager/datadog/2021-03-01/rules/id_tagrule.go index 9068f37981d..f8c6a9c9000 100644 --- a/resource-manager/datadog/2021-03-01/rules/id_tagrule.go +++ b/resource-manager/datadog/2021-03-01/rules/id_tagrule.go @@ -38,23 +38,9 @@ func ParseTagRuleID(input string) (*TagRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TagRuleId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) - } - - if id.TagRuleName, ok = parsed.Parsed["tagRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTagRuleIDInsensitively(input string) (*TagRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TagRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TagRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - if id.TagRuleName, ok = parsed.Parsed["tagRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagRuleName", *parsed) + if id.TagRuleName, ok = input.Parsed["tagRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tagRuleName", input) } - return &id, nil + return nil } // ValidateTagRuleID checks that 'input' can be parsed as a Tag Rule ID diff --git a/resource-manager/datadog/2021-03-01/singlesignon/id_monitor.go b/resource-manager/datadog/2021-03-01/singlesignon/id_monitor.go index 48f831acf3a..607eb2d0358 100644 --- a/resource-manager/datadog/2021-03-01/singlesignon/id_monitor.go +++ b/resource-manager/datadog/2021-03-01/singlesignon/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/datadog/2021-03-01/singlesignon/id_singlesignonconfiguration.go b/resource-manager/datadog/2021-03-01/singlesignon/id_singlesignonconfiguration.go index a20e52c3236..dc39e12ece4 100644 --- a/resource-manager/datadog/2021-03-01/singlesignon/id_singlesignonconfiguration.go +++ b/resource-manager/datadog/2021-03-01/singlesignon/id_singlesignonconfiguration.go @@ -38,23 +38,9 @@ func ParseSingleSignOnConfigurationID(input string) (*SingleSignOnConfigurationI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SingleSignOnConfigurationId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) - } - - if id.SingleSignOnConfigurationName, ok = parsed.Parsed["singleSignOnConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "singleSignOnConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSingleSignOnConfigurationIDInsensitively(input string) (*SingleSignOnC return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SingleSignOnConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SingleSignOnConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - if id.SingleSignOnConfigurationName, ok = parsed.Parsed["singleSignOnConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "singleSignOnConfigurationName", *parsed) + if id.SingleSignOnConfigurationName, ok = input.Parsed["singleSignOnConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "singleSignOnConfigurationName", input) } - return &id, nil + return nil } // ValidateSingleSignOnConfigurationID checks that 'input' can be parsed as a Single Sign On Configuration ID diff --git a/resource-manager/datadog/2022-06-01/apikey/id_monitor.go b/resource-manager/datadog/2022-06-01/apikey/id_monitor.go index f2fc72f83d0..72284fd13d9 100644 --- a/resource-manager/datadog/2022-06-01/apikey/id_monitor.go +++ b/resource-manager/datadog/2022-06-01/apikey/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/datadog/2022-06-01/hosts/id_monitor.go b/resource-manager/datadog/2022-06-01/hosts/id_monitor.go index 365bc358163..13465f863f9 100644 --- a/resource-manager/datadog/2022-06-01/hosts/id_monitor.go +++ b/resource-manager/datadog/2022-06-01/hosts/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/datadog/2022-06-01/linkedresources/id_monitor.go b/resource-manager/datadog/2022-06-01/linkedresources/id_monitor.go index cdda6e3c2e8..7ef85c016d7 100644 --- a/resource-manager/datadog/2022-06-01/linkedresources/id_monitor.go +++ b/resource-manager/datadog/2022-06-01/linkedresources/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/datadog/2022-06-01/monitoredresources/id_monitor.go b/resource-manager/datadog/2022-06-01/monitoredresources/id_monitor.go index 49925b3c647..825f2f113fa 100644 --- a/resource-manager/datadog/2022-06-01/monitoredresources/id_monitor.go +++ b/resource-manager/datadog/2022-06-01/monitoredresources/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/datadog/2022-06-01/monitorsresource/id_monitor.go b/resource-manager/datadog/2022-06-01/monitorsresource/id_monitor.go index 44564802c48..b2b27eeaa9a 100644 --- a/resource-manager/datadog/2022-06-01/monitorsresource/id_monitor.go +++ b/resource-manager/datadog/2022-06-01/monitorsresource/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/datadog/2022-06-01/refreshsetpasswordlink/id_monitor.go b/resource-manager/datadog/2022-06-01/refreshsetpasswordlink/id_monitor.go index 591cce6202c..ecfe987a66e 100644 --- a/resource-manager/datadog/2022-06-01/refreshsetpasswordlink/id_monitor.go +++ b/resource-manager/datadog/2022-06-01/refreshsetpasswordlink/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/datadog/2022-06-01/rules/id_monitor.go b/resource-manager/datadog/2022-06-01/rules/id_monitor.go index 77503953b28..bf61b2c04ff 100644 --- a/resource-manager/datadog/2022-06-01/rules/id_monitor.go +++ b/resource-manager/datadog/2022-06-01/rules/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/datadog/2022-06-01/rules/id_tagrule.go b/resource-manager/datadog/2022-06-01/rules/id_tagrule.go index 9068f37981d..f8c6a9c9000 100644 --- a/resource-manager/datadog/2022-06-01/rules/id_tagrule.go +++ b/resource-manager/datadog/2022-06-01/rules/id_tagrule.go @@ -38,23 +38,9 @@ func ParseTagRuleID(input string) (*TagRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TagRuleId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) - } - - if id.TagRuleName, ok = parsed.Parsed["tagRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTagRuleIDInsensitively(input string) (*TagRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TagRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TagRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - if id.TagRuleName, ok = parsed.Parsed["tagRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagRuleName", *parsed) + if id.TagRuleName, ok = input.Parsed["tagRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tagRuleName", input) } - return &id, nil + return nil } // ValidateTagRuleID checks that 'input' can be parsed as a Tag Rule ID diff --git a/resource-manager/datadog/2022-06-01/singlesignon/id_monitor.go b/resource-manager/datadog/2022-06-01/singlesignon/id_monitor.go index 48f831acf3a..607eb2d0358 100644 --- a/resource-manager/datadog/2022-06-01/singlesignon/id_monitor.go +++ b/resource-manager/datadog/2022-06-01/singlesignon/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/datadog/2022-06-01/singlesignon/id_singlesignonconfiguration.go b/resource-manager/datadog/2022-06-01/singlesignon/id_singlesignonconfiguration.go index a20e52c3236..dc39e12ece4 100644 --- a/resource-manager/datadog/2022-06-01/singlesignon/id_singlesignonconfiguration.go +++ b/resource-manager/datadog/2022-06-01/singlesignon/id_singlesignonconfiguration.go @@ -38,23 +38,9 @@ func ParseSingleSignOnConfigurationID(input string) (*SingleSignOnConfigurationI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SingleSignOnConfigurationId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) - } - - if id.SingleSignOnConfigurationName, ok = parsed.Parsed["singleSignOnConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "singleSignOnConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSingleSignOnConfigurationIDInsensitively(input string) (*SingleSignOnC return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SingleSignOnConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SingleSignOnConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - if id.SingleSignOnConfigurationName, ok = parsed.Parsed["singleSignOnConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "singleSignOnConfigurationName", *parsed) + if id.SingleSignOnConfigurationName, ok = input.Parsed["singleSignOnConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "singleSignOnConfigurationName", input) } - return &id, nil + return nil } // ValidateSingleSignOnConfigurationID checks that 'input' can be parsed as a Single Sign On Configuration ID diff --git a/resource-manager/datadog/2023-01-01/apikey/id_monitor.go b/resource-manager/datadog/2023-01-01/apikey/id_monitor.go index f2fc72f83d0..72284fd13d9 100644 --- a/resource-manager/datadog/2023-01-01/apikey/id_monitor.go +++ b/resource-manager/datadog/2023-01-01/apikey/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/datadog/2023-01-01/hosts/id_monitor.go b/resource-manager/datadog/2023-01-01/hosts/id_monitor.go index 365bc358163..13465f863f9 100644 --- a/resource-manager/datadog/2023-01-01/hosts/id_monitor.go +++ b/resource-manager/datadog/2023-01-01/hosts/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/datadog/2023-01-01/linkedresources/id_monitor.go b/resource-manager/datadog/2023-01-01/linkedresources/id_monitor.go index cdda6e3c2e8..7ef85c016d7 100644 --- a/resource-manager/datadog/2023-01-01/linkedresources/id_monitor.go +++ b/resource-manager/datadog/2023-01-01/linkedresources/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/datadog/2023-01-01/monitoredresources/id_monitor.go b/resource-manager/datadog/2023-01-01/monitoredresources/id_monitor.go index 49925b3c647..825f2f113fa 100644 --- a/resource-manager/datadog/2023-01-01/monitoredresources/id_monitor.go +++ b/resource-manager/datadog/2023-01-01/monitoredresources/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/datadog/2023-01-01/monitoredsubscriptions/id_monitor.go b/resource-manager/datadog/2023-01-01/monitoredsubscriptions/id_monitor.go index 0d52b568e5a..4f586a437e1 100644 --- a/resource-manager/datadog/2023-01-01/monitoredsubscriptions/id_monitor.go +++ b/resource-manager/datadog/2023-01-01/monitoredsubscriptions/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/datadog/2023-01-01/monitoredsubscriptions/id_monitoredsubscription.go b/resource-manager/datadog/2023-01-01/monitoredsubscriptions/id_monitoredsubscription.go index 4c0babf2ef3..2028d6399ed 100644 --- a/resource-manager/datadog/2023-01-01/monitoredsubscriptions/id_monitoredsubscription.go +++ b/resource-manager/datadog/2023-01-01/monitoredsubscriptions/id_monitoredsubscription.go @@ -38,23 +38,9 @@ func ParseMonitoredSubscriptionID(input string) (*MonitoredSubscriptionId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitoredSubscriptionId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) - } - - if id.MonitoredSubscriptionName, ok = parsed.Parsed["monitoredSubscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitoredSubscriptionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseMonitoredSubscriptionIDInsensitively(input string) (*MonitoredSubscrip return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitoredSubscriptionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *MonitoredSubscriptionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - if id.MonitoredSubscriptionName, ok = parsed.Parsed["monitoredSubscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitoredSubscriptionName", *parsed) + if id.MonitoredSubscriptionName, ok = input.Parsed["monitoredSubscriptionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitoredSubscriptionName", input) } - return &id, nil + return nil } // ValidateMonitoredSubscriptionID checks that 'input' can be parsed as a Monitored Subscription ID diff --git a/resource-manager/datadog/2023-01-01/monitorsresource/id_monitor.go b/resource-manager/datadog/2023-01-01/monitorsresource/id_monitor.go index 44564802c48..b2b27eeaa9a 100644 --- a/resource-manager/datadog/2023-01-01/monitorsresource/id_monitor.go +++ b/resource-manager/datadog/2023-01-01/monitorsresource/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/datadog/2023-01-01/refreshsetpasswordlink/id_monitor.go b/resource-manager/datadog/2023-01-01/refreshsetpasswordlink/id_monitor.go index 591cce6202c..ecfe987a66e 100644 --- a/resource-manager/datadog/2023-01-01/refreshsetpasswordlink/id_monitor.go +++ b/resource-manager/datadog/2023-01-01/refreshsetpasswordlink/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/datadog/2023-01-01/rules/id_monitor.go b/resource-manager/datadog/2023-01-01/rules/id_monitor.go index 77503953b28..bf61b2c04ff 100644 --- a/resource-manager/datadog/2023-01-01/rules/id_monitor.go +++ b/resource-manager/datadog/2023-01-01/rules/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/datadog/2023-01-01/rules/id_tagrule.go b/resource-manager/datadog/2023-01-01/rules/id_tagrule.go index 9068f37981d..f8c6a9c9000 100644 --- a/resource-manager/datadog/2023-01-01/rules/id_tagrule.go +++ b/resource-manager/datadog/2023-01-01/rules/id_tagrule.go @@ -38,23 +38,9 @@ func ParseTagRuleID(input string) (*TagRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TagRuleId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) - } - - if id.TagRuleName, ok = parsed.Parsed["tagRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTagRuleIDInsensitively(input string) (*TagRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TagRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TagRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - if id.TagRuleName, ok = parsed.Parsed["tagRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagRuleName", *parsed) + if id.TagRuleName, ok = input.Parsed["tagRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tagRuleName", input) } - return &id, nil + return nil } // ValidateTagRuleID checks that 'input' can be parsed as a Tag Rule ID diff --git a/resource-manager/datadog/2023-01-01/singlesignon/id_monitor.go b/resource-manager/datadog/2023-01-01/singlesignon/id_monitor.go index 48f831acf3a..607eb2d0358 100644 --- a/resource-manager/datadog/2023-01-01/singlesignon/id_monitor.go +++ b/resource-manager/datadog/2023-01-01/singlesignon/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/datadog/2023-01-01/singlesignon/id_singlesignonconfiguration.go b/resource-manager/datadog/2023-01-01/singlesignon/id_singlesignonconfiguration.go index a20e52c3236..dc39e12ece4 100644 --- a/resource-manager/datadog/2023-01-01/singlesignon/id_singlesignonconfiguration.go +++ b/resource-manager/datadog/2023-01-01/singlesignon/id_singlesignonconfiguration.go @@ -38,23 +38,9 @@ func ParseSingleSignOnConfigurationID(input string) (*SingleSignOnConfigurationI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SingleSignOnConfigurationId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) - } - - if id.SingleSignOnConfigurationName, ok = parsed.Parsed["singleSignOnConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "singleSignOnConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSingleSignOnConfigurationIDInsensitively(input string) (*SingleSignOnC return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SingleSignOnConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SingleSignOnConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - if id.SingleSignOnConfigurationName, ok = parsed.Parsed["singleSignOnConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "singleSignOnConfigurationName", *parsed) + if id.SingleSignOnConfigurationName, ok = input.Parsed["singleSignOnConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "singleSignOnConfigurationName", input) } - return &id, nil + return nil } // ValidateSingleSignOnConfigurationID checks that 'input' can be parsed as a Single Sign On Configuration ID diff --git a/resource-manager/datafactory/2018-06-01/activityruns/id_pipelinerun.go b/resource-manager/datafactory/2018-06-01/activityruns/id_pipelinerun.go index 94ad81e1f38..a9fa229821e 100644 --- a/resource-manager/datafactory/2018-06-01/activityruns/id_pipelinerun.go +++ b/resource-manager/datafactory/2018-06-01/activityruns/id_pipelinerun.go @@ -38,23 +38,9 @@ func ParsePipelineRunID(input string) (*PipelineRunId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PipelineRunId{} - - 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.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) - } - - if id.RunId, ok = parsed.Parsed["runId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePipelineRunIDInsensitively(input string) (*PipelineRunId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PipelineRunId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PipelineRunId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if id.FactoryName, ok = input.Parsed["factoryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "factoryName", input) } - if id.RunId, ok = parsed.Parsed["runId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runId", *parsed) + if id.RunId, ok = input.Parsed["runId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runId", input) } - return &id, nil + return nil } // ValidatePipelineRunID checks that 'input' can be parsed as a Pipeline Run ID diff --git a/resource-manager/datafactory/2018-06-01/changedatacapture/id_adfcdc.go b/resource-manager/datafactory/2018-06-01/changedatacapture/id_adfcdc.go index 79d97894707..2e80c997f1d 100644 --- a/resource-manager/datafactory/2018-06-01/changedatacapture/id_adfcdc.go +++ b/resource-manager/datafactory/2018-06-01/changedatacapture/id_adfcdc.go @@ -38,23 +38,9 @@ func ParseAdfcdcID(input string) (*AdfcdcId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AdfcdcId{} - - 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.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) - } - - if id.AdfcdcName, ok = parsed.Parsed["adfcdcName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "adfcdcName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAdfcdcIDInsensitively(input string) (*AdfcdcId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AdfcdcId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AdfcdcId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if id.FactoryName, ok = input.Parsed["factoryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "factoryName", input) } - if id.AdfcdcName, ok = parsed.Parsed["adfcdcName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "adfcdcName", *parsed) + if id.AdfcdcName, ok = input.Parsed["adfcdcName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "adfcdcName", input) } - return &id, nil + return nil } // ValidateAdfcdcID checks that 'input' can be parsed as a Adfcdc ID diff --git a/resource-manager/datafactory/2018-06-01/changedatacapture/id_factory.go b/resource-manager/datafactory/2018-06-01/changedatacapture/id_factory.go index a252272ec63..9d9e5f2588c 100644 --- a/resource-manager/datafactory/2018-06-01/changedatacapture/id_factory.go +++ b/resource-manager/datafactory/2018-06-01/changedatacapture/id_factory.go @@ -36,19 +36,9 @@ func ParseFactoryID(input string) (*FactoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FactoryId{} - - 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.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFactoryIDInsensitively(input string) (*FactoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FactoryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FactoryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if id.FactoryName, ok = input.Parsed["factoryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "factoryName", input) } - return &id, nil + return nil } // ValidateFactoryID checks that 'input' can be parsed as a Factory ID diff --git a/resource-manager/datafactory/2018-06-01/credentials/id_credential.go b/resource-manager/datafactory/2018-06-01/credentials/id_credential.go index 230f01cc341..97469b0a6be 100644 --- a/resource-manager/datafactory/2018-06-01/credentials/id_credential.go +++ b/resource-manager/datafactory/2018-06-01/credentials/id_credential.go @@ -38,23 +38,9 @@ func ParseCredentialID(input string) (*CredentialId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CredentialId{} - - 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.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) - } - - if id.CredentialName, ok = parsed.Parsed["credentialName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "credentialName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCredentialIDInsensitively(input string) (*CredentialId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CredentialId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CredentialId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if id.FactoryName, ok = input.Parsed["factoryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "factoryName", input) } - if id.CredentialName, ok = parsed.Parsed["credentialName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "credentialName", *parsed) + if id.CredentialName, ok = input.Parsed["credentialName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "credentialName", input) } - return &id, nil + return nil } // ValidateCredentialID checks that 'input' can be parsed as a Credential ID diff --git a/resource-manager/datafactory/2018-06-01/credentials/id_factory.go b/resource-manager/datafactory/2018-06-01/credentials/id_factory.go index 732d305e352..13d718f7fa0 100644 --- a/resource-manager/datafactory/2018-06-01/credentials/id_factory.go +++ b/resource-manager/datafactory/2018-06-01/credentials/id_factory.go @@ -36,19 +36,9 @@ func ParseFactoryID(input string) (*FactoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FactoryId{} - - 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.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFactoryIDInsensitively(input string) (*FactoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FactoryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FactoryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if id.FactoryName, ok = input.Parsed["factoryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "factoryName", input) } - return &id, nil + return nil } // ValidateFactoryID checks that 'input' can be parsed as a Factory ID diff --git a/resource-manager/datafactory/2018-06-01/dataflowdebugsession/id_factory.go b/resource-manager/datafactory/2018-06-01/dataflowdebugsession/id_factory.go index 2df8d7a144d..b9a9de4dde2 100644 --- a/resource-manager/datafactory/2018-06-01/dataflowdebugsession/id_factory.go +++ b/resource-manager/datafactory/2018-06-01/dataflowdebugsession/id_factory.go @@ -36,19 +36,9 @@ func ParseFactoryID(input string) (*FactoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FactoryId{} - - 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.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFactoryIDInsensitively(input string) (*FactoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FactoryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FactoryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if id.FactoryName, ok = input.Parsed["factoryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "factoryName", input) } - return &id, nil + return nil } // ValidateFactoryID checks that 'input' can be parsed as a Factory ID diff --git a/resource-manager/datafactory/2018-06-01/dataflows/id_dataflow.go b/resource-manager/datafactory/2018-06-01/dataflows/id_dataflow.go index 1ff903ae133..266c4dc10a2 100644 --- a/resource-manager/datafactory/2018-06-01/dataflows/id_dataflow.go +++ b/resource-manager/datafactory/2018-06-01/dataflows/id_dataflow.go @@ -38,23 +38,9 @@ func ParseDataflowID(input string) (*DataflowId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataflowId{} - - 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.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) - } - - if id.DataflowName, ok = parsed.Parsed["dataflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataflowName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDataflowIDInsensitively(input string) (*DataflowId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataflowId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DataflowId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if id.FactoryName, ok = input.Parsed["factoryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "factoryName", input) } - if id.DataflowName, ok = parsed.Parsed["dataflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataflowName", *parsed) + if id.DataflowName, ok = input.Parsed["dataflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataflowName", input) } - return &id, nil + return nil } // ValidateDataflowID checks that 'input' can be parsed as a Dataflow ID diff --git a/resource-manager/datafactory/2018-06-01/dataflows/id_factory.go b/resource-manager/datafactory/2018-06-01/dataflows/id_factory.go index c478ee1282e..eeced479992 100644 --- a/resource-manager/datafactory/2018-06-01/dataflows/id_factory.go +++ b/resource-manager/datafactory/2018-06-01/dataflows/id_factory.go @@ -36,19 +36,9 @@ func ParseFactoryID(input string) (*FactoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FactoryId{} - - 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.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFactoryIDInsensitively(input string) (*FactoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FactoryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FactoryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if id.FactoryName, ok = input.Parsed["factoryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "factoryName", input) } - return &id, nil + return nil } // ValidateFactoryID checks that 'input' can be parsed as a Factory ID diff --git a/resource-manager/datafactory/2018-06-01/datasets/id_dataset.go b/resource-manager/datafactory/2018-06-01/datasets/id_dataset.go index 9f95c66f627..e2bb1b94a41 100644 --- a/resource-manager/datafactory/2018-06-01/datasets/id_dataset.go +++ b/resource-manager/datafactory/2018-06-01/datasets/id_dataset.go @@ -38,23 +38,9 @@ func ParseDatasetID(input string) (*DatasetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatasetId{} - - 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.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) - } - - if id.DatasetName, ok = parsed.Parsed["datasetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "datasetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDatasetIDInsensitively(input string) (*DatasetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatasetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DatasetId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if id.FactoryName, ok = input.Parsed["factoryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "factoryName", input) } - if id.DatasetName, ok = parsed.Parsed["datasetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "datasetName", *parsed) + if id.DatasetName, ok = input.Parsed["datasetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "datasetName", input) } - return &id, nil + return nil } // ValidateDatasetID checks that 'input' can be parsed as a Dataset ID diff --git a/resource-manager/datafactory/2018-06-01/datasets/id_factory.go b/resource-manager/datafactory/2018-06-01/datasets/id_factory.go index b02d40ae90e..7e5773ab54a 100644 --- a/resource-manager/datafactory/2018-06-01/datasets/id_factory.go +++ b/resource-manager/datafactory/2018-06-01/datasets/id_factory.go @@ -36,19 +36,9 @@ func ParseFactoryID(input string) (*FactoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FactoryId{} - - 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.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFactoryIDInsensitively(input string) (*FactoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FactoryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FactoryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if id.FactoryName, ok = input.Parsed["factoryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "factoryName", input) } - return &id, nil + return nil } // ValidateFactoryID checks that 'input' can be parsed as a Factory ID diff --git a/resource-manager/datafactory/2018-06-01/exposurecontrol/id_factory.go b/resource-manager/datafactory/2018-06-01/exposurecontrol/id_factory.go index 31f87d3d34a..2af139ac519 100644 --- a/resource-manager/datafactory/2018-06-01/exposurecontrol/id_factory.go +++ b/resource-manager/datafactory/2018-06-01/exposurecontrol/id_factory.go @@ -36,19 +36,9 @@ func ParseFactoryID(input string) (*FactoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FactoryId{} - - 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.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFactoryIDInsensitively(input string) (*FactoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FactoryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FactoryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if id.FactoryName, ok = input.Parsed["factoryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "factoryName", input) } - return &id, nil + return nil } // ValidateFactoryID checks that 'input' can be parsed as a Factory ID diff --git a/resource-manager/datafactory/2018-06-01/exposurecontrol/id_location.go b/resource-manager/datafactory/2018-06-01/exposurecontrol/id_location.go index 27a15fda244..4ae53b02322 100644 --- a/resource-manager/datafactory/2018-06-01/exposurecontrol/id_location.go +++ b/resource-manager/datafactory/2018-06-01/exposurecontrol/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationId, ok = parsed.Parsed["locationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationId, ok = parsed.Parsed["locationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationId", *parsed) + if id.LocationId, ok = input.Parsed["locationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationId", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/datafactory/2018-06-01/factories/id_factory.go b/resource-manager/datafactory/2018-06-01/factories/id_factory.go index b17f4b5c2e8..b766e311fb2 100644 --- a/resource-manager/datafactory/2018-06-01/factories/id_factory.go +++ b/resource-manager/datafactory/2018-06-01/factories/id_factory.go @@ -36,19 +36,9 @@ func ParseFactoryID(input string) (*FactoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FactoryId{} - - 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.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFactoryIDInsensitively(input string) (*FactoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FactoryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FactoryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if id.FactoryName, ok = input.Parsed["factoryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "factoryName", input) } - return &id, nil + return nil } // ValidateFactoryID checks that 'input' can be parsed as a Factory ID diff --git a/resource-manager/datafactory/2018-06-01/factories/id_location.go b/resource-manager/datafactory/2018-06-01/factories/id_location.go index 33ed5b5089f..bc709adf10a 100644 --- a/resource-manager/datafactory/2018-06-01/factories/id_location.go +++ b/resource-manager/datafactory/2018-06-01/factories/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationId, ok = parsed.Parsed["locationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationId, ok = parsed.Parsed["locationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationId", *parsed) + if id.LocationId, ok = input.Parsed["locationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationId", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/datafactory/2018-06-01/globalparameters/id_factory.go b/resource-manager/datafactory/2018-06-01/globalparameters/id_factory.go index 84936a8467c..48909011a4e 100644 --- a/resource-manager/datafactory/2018-06-01/globalparameters/id_factory.go +++ b/resource-manager/datafactory/2018-06-01/globalparameters/id_factory.go @@ -36,19 +36,9 @@ func ParseFactoryID(input string) (*FactoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FactoryId{} - - 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.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFactoryIDInsensitively(input string) (*FactoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FactoryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FactoryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if id.FactoryName, ok = input.Parsed["factoryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "factoryName", input) } - return &id, nil + return nil } // ValidateFactoryID checks that 'input' can be parsed as a Factory ID diff --git a/resource-manager/datafactory/2018-06-01/globalparameters/id_globalparameter.go b/resource-manager/datafactory/2018-06-01/globalparameters/id_globalparameter.go index bbe614f7fbc..6b33dbde761 100644 --- a/resource-manager/datafactory/2018-06-01/globalparameters/id_globalparameter.go +++ b/resource-manager/datafactory/2018-06-01/globalparameters/id_globalparameter.go @@ -38,23 +38,9 @@ func ParseGlobalParameterID(input string) (*GlobalParameterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GlobalParameterId{} - - 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.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) - } - - if id.GlobalParameterName, ok = parsed.Parsed["globalParameterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalParameterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGlobalParameterIDInsensitively(input string) (*GlobalParameterId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GlobalParameterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GlobalParameterId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if id.FactoryName, ok = input.Parsed["factoryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "factoryName", input) } - if id.GlobalParameterName, ok = parsed.Parsed["globalParameterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalParameterName", *parsed) + if id.GlobalParameterName, ok = input.Parsed["globalParameterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "globalParameterName", input) } - return &id, nil + return nil } // ValidateGlobalParameterID checks that 'input' can be parsed as a Global Parameter ID diff --git a/resource-manager/datafactory/2018-06-01/integrationruntimenodes/id_node.go b/resource-manager/datafactory/2018-06-01/integrationruntimenodes/id_node.go index ec219de1d00..d465d59685d 100644 --- a/resource-manager/datafactory/2018-06-01/integrationruntimenodes/id_node.go +++ b/resource-manager/datafactory/2018-06-01/integrationruntimenodes/id_node.go @@ -40,27 +40,9 @@ func ParseNodeID(input string) (*NodeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NodeId{} - - 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.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) - } - - if id.IntegrationRuntimeName, ok = parsed.Parsed["integrationRuntimeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationRuntimeName", *parsed) - } - - if id.NodeName, ok = parsed.Parsed["nodeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nodeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseNodeIDInsensitively(input string) (*NodeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NodeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *NodeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if id.FactoryName, ok = input.Parsed["factoryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "factoryName", input) } - if id.IntegrationRuntimeName, ok = parsed.Parsed["integrationRuntimeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationRuntimeName", *parsed) + if id.IntegrationRuntimeName, ok = input.Parsed["integrationRuntimeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "integrationRuntimeName", input) } - if id.NodeName, ok = parsed.Parsed["nodeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nodeName", *parsed) + if id.NodeName, ok = input.Parsed["nodeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "nodeName", input) } - return &id, nil + return nil } // ValidateNodeID checks that 'input' can be parsed as a Node ID diff --git a/resource-manager/datafactory/2018-06-01/integrationruntimeobjectmetadata/id_integrationruntime.go b/resource-manager/datafactory/2018-06-01/integrationruntimeobjectmetadata/id_integrationruntime.go index db371882e8b..64f5645f486 100644 --- a/resource-manager/datafactory/2018-06-01/integrationruntimeobjectmetadata/id_integrationruntime.go +++ b/resource-manager/datafactory/2018-06-01/integrationruntimeobjectmetadata/id_integrationruntime.go @@ -38,23 +38,9 @@ func ParseIntegrationRuntimeID(input string) (*IntegrationRuntimeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IntegrationRuntimeId{} - - 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.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) - } - - if id.IntegrationRuntimeName, ok = parsed.Parsed["integrationRuntimeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationRuntimeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIntegrationRuntimeIDInsensitively(input string) (*IntegrationRuntimeId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IntegrationRuntimeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IntegrationRuntimeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if id.FactoryName, ok = input.Parsed["factoryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "factoryName", input) } - if id.IntegrationRuntimeName, ok = parsed.Parsed["integrationRuntimeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationRuntimeName", *parsed) + if id.IntegrationRuntimeName, ok = input.Parsed["integrationRuntimeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "integrationRuntimeName", input) } - return &id, nil + return nil } // ValidateIntegrationRuntimeID checks that 'input' can be parsed as a Integration Runtime ID diff --git a/resource-manager/datafactory/2018-06-01/integrationruntimes/id_factory.go b/resource-manager/datafactory/2018-06-01/integrationruntimes/id_factory.go index 56784c9b4ce..10d62a65f43 100644 --- a/resource-manager/datafactory/2018-06-01/integrationruntimes/id_factory.go +++ b/resource-manager/datafactory/2018-06-01/integrationruntimes/id_factory.go @@ -36,19 +36,9 @@ func ParseFactoryID(input string) (*FactoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FactoryId{} - - 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.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFactoryIDInsensitively(input string) (*FactoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FactoryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FactoryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if id.FactoryName, ok = input.Parsed["factoryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "factoryName", input) } - return &id, nil + return nil } // ValidateFactoryID checks that 'input' can be parsed as a Factory ID diff --git a/resource-manager/datafactory/2018-06-01/integrationruntimes/id_integrationruntime.go b/resource-manager/datafactory/2018-06-01/integrationruntimes/id_integrationruntime.go index a3e63f3353a..1fbaf1ea9c7 100644 --- a/resource-manager/datafactory/2018-06-01/integrationruntimes/id_integrationruntime.go +++ b/resource-manager/datafactory/2018-06-01/integrationruntimes/id_integrationruntime.go @@ -38,23 +38,9 @@ func ParseIntegrationRuntimeID(input string) (*IntegrationRuntimeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IntegrationRuntimeId{} - - 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.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) - } - - if id.IntegrationRuntimeName, ok = parsed.Parsed["integrationRuntimeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationRuntimeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIntegrationRuntimeIDInsensitively(input string) (*IntegrationRuntimeId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IntegrationRuntimeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IntegrationRuntimeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if id.FactoryName, ok = input.Parsed["factoryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "factoryName", input) } - if id.IntegrationRuntimeName, ok = parsed.Parsed["integrationRuntimeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationRuntimeName", *parsed) + if id.IntegrationRuntimeName, ok = input.Parsed["integrationRuntimeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "integrationRuntimeName", input) } - return &id, nil + return nil } // ValidateIntegrationRuntimeID checks that 'input' can be parsed as a Integration Runtime ID diff --git a/resource-manager/datafactory/2018-06-01/linkedservices/id_factory.go b/resource-manager/datafactory/2018-06-01/linkedservices/id_factory.go index 160f9d3ee9f..0d433cc2cbf 100644 --- a/resource-manager/datafactory/2018-06-01/linkedservices/id_factory.go +++ b/resource-manager/datafactory/2018-06-01/linkedservices/id_factory.go @@ -36,19 +36,9 @@ func ParseFactoryID(input string) (*FactoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FactoryId{} - - 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.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFactoryIDInsensitively(input string) (*FactoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FactoryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FactoryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if id.FactoryName, ok = input.Parsed["factoryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "factoryName", input) } - return &id, nil + return nil } // ValidateFactoryID checks that 'input' can be parsed as a Factory ID diff --git a/resource-manager/datafactory/2018-06-01/linkedservices/id_linkedservice.go b/resource-manager/datafactory/2018-06-01/linkedservices/id_linkedservice.go index f28ece88b5e..d7e15a5f6d6 100644 --- a/resource-manager/datafactory/2018-06-01/linkedservices/id_linkedservice.go +++ b/resource-manager/datafactory/2018-06-01/linkedservices/id_linkedservice.go @@ -38,23 +38,9 @@ func ParseLinkedServiceID(input string) (*LinkedServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LinkedServiceId{} - - 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.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) - } - - if id.LinkedServiceName, ok = parsed.Parsed["linkedServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "linkedServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLinkedServiceIDInsensitively(input string) (*LinkedServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LinkedServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LinkedServiceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if id.FactoryName, ok = input.Parsed["factoryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "factoryName", input) } - if id.LinkedServiceName, ok = parsed.Parsed["linkedServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "linkedServiceName", *parsed) + if id.LinkedServiceName, ok = input.Parsed["linkedServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "linkedServiceName", input) } - return &id, nil + return nil } // ValidateLinkedServiceID checks that 'input' can be parsed as a Linked Service ID diff --git a/resource-manager/datafactory/2018-06-01/managedprivateendpoints/id_managedprivateendpoint.go b/resource-manager/datafactory/2018-06-01/managedprivateendpoints/id_managedprivateendpoint.go index ecf3547d2b5..5308e6fe45a 100644 --- a/resource-manager/datafactory/2018-06-01/managedprivateendpoints/id_managedprivateendpoint.go +++ b/resource-manager/datafactory/2018-06-01/managedprivateendpoints/id_managedprivateendpoint.go @@ -40,27 +40,9 @@ func ParseManagedPrivateEndpointID(input string) (*ManagedPrivateEndpointId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedPrivateEndpointId{} - - 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.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) - } - - if id.ManagedVirtualNetworkName, ok = parsed.Parsed["managedVirtualNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedVirtualNetworkName", *parsed) - } - - if id.ManagedPrivateEndpointName, ok = parsed.Parsed["managedPrivateEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedPrivateEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseManagedPrivateEndpointIDInsensitively(input string) (*ManagedPrivateEn return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedPrivateEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ManagedPrivateEndpointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if id.FactoryName, ok = input.Parsed["factoryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "factoryName", input) } - if id.ManagedVirtualNetworkName, ok = parsed.Parsed["managedVirtualNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedVirtualNetworkName", *parsed) + if id.ManagedVirtualNetworkName, ok = input.Parsed["managedVirtualNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedVirtualNetworkName", input) } - if id.ManagedPrivateEndpointName, ok = parsed.Parsed["managedPrivateEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedPrivateEndpointName", *parsed) + if id.ManagedPrivateEndpointName, ok = input.Parsed["managedPrivateEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedPrivateEndpointName", input) } - return &id, nil + return nil } // ValidateManagedPrivateEndpointID checks that 'input' can be parsed as a Managed Private Endpoint ID diff --git a/resource-manager/datafactory/2018-06-01/managedprivateendpoints/id_managedvirtualnetwork.go b/resource-manager/datafactory/2018-06-01/managedprivateendpoints/id_managedvirtualnetwork.go index 6a3aed5c525..3bf1c0d131f 100644 --- a/resource-manager/datafactory/2018-06-01/managedprivateendpoints/id_managedvirtualnetwork.go +++ b/resource-manager/datafactory/2018-06-01/managedprivateendpoints/id_managedvirtualnetwork.go @@ -38,23 +38,9 @@ func ParseManagedVirtualNetworkID(input string) (*ManagedVirtualNetworkId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedVirtualNetworkId{} - - 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.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) - } - - if id.ManagedVirtualNetworkName, ok = parsed.Parsed["managedVirtualNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedVirtualNetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseManagedVirtualNetworkIDInsensitively(input string) (*ManagedVirtualNet return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedVirtualNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ManagedVirtualNetworkId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if id.FactoryName, ok = input.Parsed["factoryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "factoryName", input) } - if id.ManagedVirtualNetworkName, ok = parsed.Parsed["managedVirtualNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedVirtualNetworkName", *parsed) + if id.ManagedVirtualNetworkName, ok = input.Parsed["managedVirtualNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedVirtualNetworkName", input) } - return &id, nil + return nil } // ValidateManagedVirtualNetworkID checks that 'input' can be parsed as a Managed Virtual Network ID diff --git a/resource-manager/datafactory/2018-06-01/managedvirtualnetworks/id_factory.go b/resource-manager/datafactory/2018-06-01/managedvirtualnetworks/id_factory.go index 1364a5f7f47..954327b0237 100644 --- a/resource-manager/datafactory/2018-06-01/managedvirtualnetworks/id_factory.go +++ b/resource-manager/datafactory/2018-06-01/managedvirtualnetworks/id_factory.go @@ -36,19 +36,9 @@ func ParseFactoryID(input string) (*FactoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FactoryId{} - - 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.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFactoryIDInsensitively(input string) (*FactoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FactoryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FactoryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if id.FactoryName, ok = input.Parsed["factoryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "factoryName", input) } - return &id, nil + return nil } // ValidateFactoryID checks that 'input' can be parsed as a Factory ID diff --git a/resource-manager/datafactory/2018-06-01/managedvirtualnetworks/id_managedvirtualnetwork.go b/resource-manager/datafactory/2018-06-01/managedvirtualnetworks/id_managedvirtualnetwork.go index 4e9c01a1936..2a6e35cfcdb 100644 --- a/resource-manager/datafactory/2018-06-01/managedvirtualnetworks/id_managedvirtualnetwork.go +++ b/resource-manager/datafactory/2018-06-01/managedvirtualnetworks/id_managedvirtualnetwork.go @@ -38,23 +38,9 @@ func ParseManagedVirtualNetworkID(input string) (*ManagedVirtualNetworkId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedVirtualNetworkId{} - - 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.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) - } - - if id.ManagedVirtualNetworkName, ok = parsed.Parsed["managedVirtualNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedVirtualNetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseManagedVirtualNetworkIDInsensitively(input string) (*ManagedVirtualNet return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedVirtualNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ManagedVirtualNetworkId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if id.FactoryName, ok = input.Parsed["factoryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "factoryName", input) } - if id.ManagedVirtualNetworkName, ok = parsed.Parsed["managedVirtualNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedVirtualNetworkName", *parsed) + if id.ManagedVirtualNetworkName, ok = input.Parsed["managedVirtualNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedVirtualNetworkName", input) } - return &id, nil + return nil } // ValidateManagedVirtualNetworkID checks that 'input' can be parsed as a Managed Virtual Network ID diff --git a/resource-manager/datafactory/2018-06-01/pipelineruns/id_factory.go b/resource-manager/datafactory/2018-06-01/pipelineruns/id_factory.go index 135aef3a7af..3b784a40e66 100644 --- a/resource-manager/datafactory/2018-06-01/pipelineruns/id_factory.go +++ b/resource-manager/datafactory/2018-06-01/pipelineruns/id_factory.go @@ -36,19 +36,9 @@ func ParseFactoryID(input string) (*FactoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FactoryId{} - - 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.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFactoryIDInsensitively(input string) (*FactoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FactoryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FactoryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if id.FactoryName, ok = input.Parsed["factoryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "factoryName", input) } - return &id, nil + return nil } // ValidateFactoryID checks that 'input' can be parsed as a Factory ID diff --git a/resource-manager/datafactory/2018-06-01/pipelineruns/id_pipelinerun.go b/resource-manager/datafactory/2018-06-01/pipelineruns/id_pipelinerun.go index 019676dcde9..81ac951527c 100644 --- a/resource-manager/datafactory/2018-06-01/pipelineruns/id_pipelinerun.go +++ b/resource-manager/datafactory/2018-06-01/pipelineruns/id_pipelinerun.go @@ -38,23 +38,9 @@ func ParsePipelineRunID(input string) (*PipelineRunId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PipelineRunId{} - - 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.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) - } - - if id.RunId, ok = parsed.Parsed["runId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePipelineRunIDInsensitively(input string) (*PipelineRunId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PipelineRunId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PipelineRunId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if id.FactoryName, ok = input.Parsed["factoryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "factoryName", input) } - if id.RunId, ok = parsed.Parsed["runId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runId", *parsed) + if id.RunId, ok = input.Parsed["runId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runId", input) } - return &id, nil + return nil } // ValidatePipelineRunID checks that 'input' can be parsed as a Pipeline Run ID diff --git a/resource-manager/datafactory/2018-06-01/pipelines/id_factory.go b/resource-manager/datafactory/2018-06-01/pipelines/id_factory.go index 1379c27b9d1..062103d6938 100644 --- a/resource-manager/datafactory/2018-06-01/pipelines/id_factory.go +++ b/resource-manager/datafactory/2018-06-01/pipelines/id_factory.go @@ -36,19 +36,9 @@ func ParseFactoryID(input string) (*FactoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FactoryId{} - - 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.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFactoryIDInsensitively(input string) (*FactoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FactoryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FactoryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if id.FactoryName, ok = input.Parsed["factoryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "factoryName", input) } - return &id, nil + return nil } // ValidateFactoryID checks that 'input' can be parsed as a Factory ID diff --git a/resource-manager/datafactory/2018-06-01/pipelines/id_pipeline.go b/resource-manager/datafactory/2018-06-01/pipelines/id_pipeline.go index e830081ea43..1209008a239 100644 --- a/resource-manager/datafactory/2018-06-01/pipelines/id_pipeline.go +++ b/resource-manager/datafactory/2018-06-01/pipelines/id_pipeline.go @@ -38,23 +38,9 @@ func ParsePipelineID(input string) (*PipelineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PipelineId{} - - 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.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) - } - - if id.PipelineName, ok = parsed.Parsed["pipelineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "pipelineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePipelineIDInsensitively(input string) (*PipelineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PipelineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PipelineId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if id.FactoryName, ok = input.Parsed["factoryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "factoryName", input) } - if id.PipelineName, ok = parsed.Parsed["pipelineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "pipelineName", *parsed) + if id.PipelineName, ok = input.Parsed["pipelineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "pipelineName", input) } - return &id, nil + return nil } // ValidatePipelineID checks that 'input' can be parsed as a Pipeline ID diff --git a/resource-manager/datafactory/2018-06-01/privateendpointconnections/id_factory.go b/resource-manager/datafactory/2018-06-01/privateendpointconnections/id_factory.go index ba833bffe22..94a14ed2619 100644 --- a/resource-manager/datafactory/2018-06-01/privateendpointconnections/id_factory.go +++ b/resource-manager/datafactory/2018-06-01/privateendpointconnections/id_factory.go @@ -36,19 +36,9 @@ func ParseFactoryID(input string) (*FactoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FactoryId{} - - 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.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFactoryIDInsensitively(input string) (*FactoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FactoryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FactoryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if id.FactoryName, ok = input.Parsed["factoryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "factoryName", input) } - return &id, nil + return nil } // ValidateFactoryID checks that 'input' can be parsed as a Factory ID diff --git a/resource-manager/datafactory/2018-06-01/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/datafactory/2018-06-01/privateendpointconnections/id_privateendpointconnection.go index a8283cbdbc9..b835b066b02 100644 --- a/resource-manager/datafactory/2018-06-01/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/datafactory/2018-06-01/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if id.FactoryName, ok = input.Parsed["factoryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "factoryName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/datafactory/2018-06-01/privatelinkresources/id_factory.go b/resource-manager/datafactory/2018-06-01/privatelinkresources/id_factory.go index a4f9756cd80..cdc170a7e84 100644 --- a/resource-manager/datafactory/2018-06-01/privatelinkresources/id_factory.go +++ b/resource-manager/datafactory/2018-06-01/privatelinkresources/id_factory.go @@ -36,19 +36,9 @@ func ParseFactoryID(input string) (*FactoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FactoryId{} - - 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.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFactoryIDInsensitively(input string) (*FactoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FactoryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FactoryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if id.FactoryName, ok = input.Parsed["factoryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "factoryName", input) } - return &id, nil + return nil } // ValidateFactoryID checks that 'input' can be parsed as a Factory ID diff --git a/resource-manager/datafactory/2018-06-01/trigger/id_trigger.go b/resource-manager/datafactory/2018-06-01/trigger/id_trigger.go index 35d07833da9..e3f177c344c 100644 --- a/resource-manager/datafactory/2018-06-01/trigger/id_trigger.go +++ b/resource-manager/datafactory/2018-06-01/trigger/id_trigger.go @@ -38,23 +38,9 @@ func ParseTriggerID(input string) (*TriggerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TriggerId{} - - 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.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) - } - - if id.TriggerName, ok = parsed.Parsed["triggerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTriggerIDInsensitively(input string) (*TriggerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TriggerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TriggerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if id.FactoryName, ok = input.Parsed["factoryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "factoryName", input) } - if id.TriggerName, ok = parsed.Parsed["triggerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggerName", *parsed) + if id.TriggerName, ok = input.Parsed["triggerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "triggerName", input) } - return &id, nil + return nil } // ValidateTriggerID checks that 'input' can be parsed as a Trigger ID diff --git a/resource-manager/datafactory/2018-06-01/triggerruns/id_factory.go b/resource-manager/datafactory/2018-06-01/triggerruns/id_factory.go index b423be16128..778620d9a95 100644 --- a/resource-manager/datafactory/2018-06-01/triggerruns/id_factory.go +++ b/resource-manager/datafactory/2018-06-01/triggerruns/id_factory.go @@ -36,19 +36,9 @@ func ParseFactoryID(input string) (*FactoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FactoryId{} - - 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.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFactoryIDInsensitively(input string) (*FactoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FactoryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FactoryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if id.FactoryName, ok = input.Parsed["factoryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "factoryName", input) } - return &id, nil + return nil } // ValidateFactoryID checks that 'input' can be parsed as a Factory ID diff --git a/resource-manager/datafactory/2018-06-01/triggerruns/id_triggerrun.go b/resource-manager/datafactory/2018-06-01/triggerruns/id_triggerrun.go index ea84a591cfc..f48deffc45d 100644 --- a/resource-manager/datafactory/2018-06-01/triggerruns/id_triggerrun.go +++ b/resource-manager/datafactory/2018-06-01/triggerruns/id_triggerrun.go @@ -40,27 +40,9 @@ func ParseTriggerRunID(input string) (*TriggerRunId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TriggerRunId{} - - 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.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) - } - - if id.TriggerName, ok = parsed.Parsed["triggerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggerName", *parsed) - } - - if id.RunId, ok = parsed.Parsed["runId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseTriggerRunIDInsensitively(input string) (*TriggerRunId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TriggerRunId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TriggerRunId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if id.FactoryName, ok = input.Parsed["factoryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "factoryName", input) } - if id.TriggerName, ok = parsed.Parsed["triggerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggerName", *parsed) + if id.TriggerName, ok = input.Parsed["triggerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "triggerName", input) } - if id.RunId, ok = parsed.Parsed["runId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runId", *parsed) + if id.RunId, ok = input.Parsed["runId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runId", input) } - return &id, nil + return nil } // ValidateTriggerRunID checks that 'input' can be parsed as a Trigger Run ID diff --git a/resource-manager/datafactory/2018-06-01/triggers/id_factory.go b/resource-manager/datafactory/2018-06-01/triggers/id_factory.go index 7f2da5c3a12..5eb7b6e0662 100644 --- a/resource-manager/datafactory/2018-06-01/triggers/id_factory.go +++ b/resource-manager/datafactory/2018-06-01/triggers/id_factory.go @@ -36,19 +36,9 @@ func ParseFactoryID(input string) (*FactoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FactoryId{} - - 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.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFactoryIDInsensitively(input string) (*FactoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FactoryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FactoryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if id.FactoryName, ok = input.Parsed["factoryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "factoryName", input) } - return &id, nil + return nil } // ValidateFactoryID checks that 'input' can be parsed as a Factory ID diff --git a/resource-manager/datafactory/2018-06-01/triggers/id_trigger.go b/resource-manager/datafactory/2018-06-01/triggers/id_trigger.go index 1749ff1d692..9a6e7eb78a7 100644 --- a/resource-manager/datafactory/2018-06-01/triggers/id_trigger.go +++ b/resource-manager/datafactory/2018-06-01/triggers/id_trigger.go @@ -38,23 +38,9 @@ func ParseTriggerID(input string) (*TriggerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TriggerId{} - - 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.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) - } - - if id.TriggerName, ok = parsed.Parsed["triggerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTriggerIDInsensitively(input string) (*TriggerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TriggerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TriggerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FactoryName, ok = parsed.Parsed["factoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "factoryName", *parsed) + if id.FactoryName, ok = input.Parsed["factoryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "factoryName", input) } - if id.TriggerName, ok = parsed.Parsed["triggerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggerName", *parsed) + if id.TriggerName, ok = input.Parsed["triggerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "triggerName", input) } - return &id, nil + return nil } // ValidateTriggerID checks that 'input' can be parsed as a Trigger ID diff --git a/resource-manager/datalakeanalytics/2016-11-01/accounts/id_account.go b/resource-manager/datalakeanalytics/2016-11-01/accounts/id_account.go index 9d66c609ce5..b4ff02ed349 100644 --- a/resource-manager/datalakeanalytics/2016-11-01/accounts/id_account.go +++ b/resource-manager/datalakeanalytics/2016-11-01/accounts/id_account.go @@ -36,19 +36,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/datalakeanalytics/2016-11-01/accounts/id_location.go b/resource-manager/datalakeanalytics/2016-11-01/accounts/id_location.go index 8f19a496e13..ef0057f31a3 100644 --- a/resource-manager/datalakeanalytics/2016-11-01/accounts/id_location.go +++ b/resource-manager/datalakeanalytics/2016-11-01/accounts/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/datalakeanalytics/2016-11-01/computepolicies/id_account.go b/resource-manager/datalakeanalytics/2016-11-01/computepolicies/id_account.go index fc6350dae29..7686b5b1ef2 100644 --- a/resource-manager/datalakeanalytics/2016-11-01/computepolicies/id_account.go +++ b/resource-manager/datalakeanalytics/2016-11-01/computepolicies/id_account.go @@ -36,19 +36,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/datalakeanalytics/2016-11-01/computepolicies/id_computepolicy.go b/resource-manager/datalakeanalytics/2016-11-01/computepolicies/id_computepolicy.go index c3cc32e1ff2..d3e65713d4a 100644 --- a/resource-manager/datalakeanalytics/2016-11-01/computepolicies/id_computepolicy.go +++ b/resource-manager/datalakeanalytics/2016-11-01/computepolicies/id_computepolicy.go @@ -38,23 +38,9 @@ func ParseComputePolicyID(input string) (*ComputePolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComputePolicyId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.ComputePolicyName, ok = parsed.Parsed["computePolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "computePolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseComputePolicyIDInsensitively(input string) (*ComputePolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComputePolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ComputePolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.ComputePolicyName, ok = parsed.Parsed["computePolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "computePolicyName", *parsed) + if id.ComputePolicyName, ok = input.Parsed["computePolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "computePolicyName", input) } - return &id, nil + return nil } // ValidateComputePolicyID checks that 'input' can be parsed as a Compute Policy ID diff --git a/resource-manager/datalakeanalytics/2016-11-01/datalakestoreaccounts/id_account.go b/resource-manager/datalakeanalytics/2016-11-01/datalakestoreaccounts/id_account.go index 7c4332e21af..b04f41e1ae3 100644 --- a/resource-manager/datalakeanalytics/2016-11-01/datalakestoreaccounts/id_account.go +++ b/resource-manager/datalakeanalytics/2016-11-01/datalakestoreaccounts/id_account.go @@ -36,19 +36,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/datalakeanalytics/2016-11-01/datalakestoreaccounts/id_datalakestoreaccount.go b/resource-manager/datalakeanalytics/2016-11-01/datalakestoreaccounts/id_datalakestoreaccount.go index 775f356766e..2cf01ec2528 100644 --- a/resource-manager/datalakeanalytics/2016-11-01/datalakestoreaccounts/id_datalakestoreaccount.go +++ b/resource-manager/datalakeanalytics/2016-11-01/datalakestoreaccounts/id_datalakestoreaccount.go @@ -38,23 +38,9 @@ func ParseDataLakeStoreAccountID(input string) (*DataLakeStoreAccountId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataLakeStoreAccountId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.DataLakeStoreAccountName, ok = parsed.Parsed["dataLakeStoreAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataLakeStoreAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDataLakeStoreAccountIDInsensitively(input string) (*DataLakeStoreAccou return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataLakeStoreAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DataLakeStoreAccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.DataLakeStoreAccountName, ok = parsed.Parsed["dataLakeStoreAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataLakeStoreAccountName", *parsed) + if id.DataLakeStoreAccountName, ok = input.Parsed["dataLakeStoreAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataLakeStoreAccountName", input) } - return &id, nil + return nil } // ValidateDataLakeStoreAccountID checks that 'input' can be parsed as a Data Lake Store Account ID diff --git a/resource-manager/datalakeanalytics/2016-11-01/firewallrules/id_account.go b/resource-manager/datalakeanalytics/2016-11-01/firewallrules/id_account.go index 284143ea018..c081cf54b32 100644 --- a/resource-manager/datalakeanalytics/2016-11-01/firewallrules/id_account.go +++ b/resource-manager/datalakeanalytics/2016-11-01/firewallrules/id_account.go @@ -36,19 +36,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/datalakeanalytics/2016-11-01/firewallrules/id_firewallrule.go b/resource-manager/datalakeanalytics/2016-11-01/firewallrules/id_firewallrule.go index ae150df4b81..74ae5643386 100644 --- a/resource-manager/datalakeanalytics/2016-11-01/firewallrules/id_firewallrule.go +++ b/resource-manager/datalakeanalytics/2016-11-01/firewallrules/id_firewallrule.go @@ -38,23 +38,9 @@ func ParseFirewallRuleID(input string) (*FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallRuleId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFirewallRuleIDInsensitively(input string) (*FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FirewallRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + if id.FirewallRuleName, ok = input.Parsed["firewallRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", input) } - return &id, nil + return nil } // ValidateFirewallRuleID checks that 'input' can be parsed as a Firewall Rule ID diff --git a/resource-manager/datalakeanalytics/2016-11-01/locations/id_location.go b/resource-manager/datalakeanalytics/2016-11-01/locations/id_location.go index 8087a1e61aa..709c9a1df06 100644 --- a/resource-manager/datalakeanalytics/2016-11-01/locations/id_location.go +++ b/resource-manager/datalakeanalytics/2016-11-01/locations/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/datalakeanalytics/2016-11-01/storageaccounts/id_account.go b/resource-manager/datalakeanalytics/2016-11-01/storageaccounts/id_account.go index c0f518a46bd..f8490a11161 100644 --- a/resource-manager/datalakeanalytics/2016-11-01/storageaccounts/id_account.go +++ b/resource-manager/datalakeanalytics/2016-11-01/storageaccounts/id_account.go @@ -36,19 +36,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/datalakeanalytics/2016-11-01/storageaccounts/id_container.go b/resource-manager/datalakeanalytics/2016-11-01/storageaccounts/id_container.go index b77ea45cda7..a6960ac1e63 100644 --- a/resource-manager/datalakeanalytics/2016-11-01/storageaccounts/id_container.go +++ b/resource-manager/datalakeanalytics/2016-11-01/storageaccounts/id_container.go @@ -40,27 +40,9 @@ func ParseContainerID(input string) (*ContainerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) - } - - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseContainerIDInsensitively(input string) (*ContainerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ContainerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) + if id.StorageAccountName, ok = input.Parsed["storageAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", input) } - if id.ContainerName, ok = parsed.Parsed["containerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerName", *parsed) + if id.ContainerName, ok = input.Parsed["containerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerName", input) } - return &id, nil + return nil } // ValidateContainerID checks that 'input' can be parsed as a Container ID diff --git a/resource-manager/datalakeanalytics/2016-11-01/storageaccounts/id_storageaccount.go b/resource-manager/datalakeanalytics/2016-11-01/storageaccounts/id_storageaccount.go index de04ecf0e9b..75f90e7da1b 100644 --- a/resource-manager/datalakeanalytics/2016-11-01/storageaccounts/id_storageaccount.go +++ b/resource-manager/datalakeanalytics/2016-11-01/storageaccounts/id_storageaccount.go @@ -38,23 +38,9 @@ func ParseStorageAccountID(input string) (*StorageAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageAccountId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseStorageAccountIDInsensitively(input string) (*StorageAccountId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *StorageAccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) + if id.StorageAccountName, ok = input.Parsed["storageAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", input) } - return &id, nil + return nil } // ValidateStorageAccountID checks that 'input' can be parsed as a Storage Account ID diff --git a/resource-manager/datalakestore/2016-11-01/accounts/id_account.go b/resource-manager/datalakestore/2016-11-01/accounts/id_account.go index 98023884c74..dcad593e4d1 100644 --- a/resource-manager/datalakestore/2016-11-01/accounts/id_account.go +++ b/resource-manager/datalakestore/2016-11-01/accounts/id_account.go @@ -36,19 +36,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/datalakestore/2016-11-01/accounts/id_location.go b/resource-manager/datalakestore/2016-11-01/accounts/id_location.go index 36aa8591c49..37e8f1fa42b 100644 --- a/resource-manager/datalakestore/2016-11-01/accounts/id_location.go +++ b/resource-manager/datalakestore/2016-11-01/accounts/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/datalakestore/2016-11-01/firewallrules/id_account.go b/resource-manager/datalakestore/2016-11-01/firewallrules/id_account.go index da98ec4008b..4dcb9fd8371 100644 --- a/resource-manager/datalakestore/2016-11-01/firewallrules/id_account.go +++ b/resource-manager/datalakestore/2016-11-01/firewallrules/id_account.go @@ -36,19 +36,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/datalakestore/2016-11-01/firewallrules/id_firewallrule.go b/resource-manager/datalakestore/2016-11-01/firewallrules/id_firewallrule.go index e288b20074e..3a5d7b43281 100644 --- a/resource-manager/datalakestore/2016-11-01/firewallrules/id_firewallrule.go +++ b/resource-manager/datalakestore/2016-11-01/firewallrules/id_firewallrule.go @@ -38,23 +38,9 @@ func ParseFirewallRuleID(input string) (*FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallRuleId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFirewallRuleIDInsensitively(input string) (*FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FirewallRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + if id.FirewallRuleName, ok = input.Parsed["firewallRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", input) } - return &id, nil + return nil } // ValidateFirewallRuleID checks that 'input' can be parsed as a Firewall Rule ID diff --git a/resource-manager/datalakestore/2016-11-01/locations/id_location.go b/resource-manager/datalakestore/2016-11-01/locations/id_location.go index 3820ccc737b..880609fc9e1 100644 --- a/resource-manager/datalakestore/2016-11-01/locations/id_location.go +++ b/resource-manager/datalakestore/2016-11-01/locations/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/datalakestore/2016-11-01/trustedidproviders/id_account.go b/resource-manager/datalakestore/2016-11-01/trustedidproviders/id_account.go index fecdaad98c9..eafc5ea167e 100644 --- a/resource-manager/datalakestore/2016-11-01/trustedidproviders/id_account.go +++ b/resource-manager/datalakestore/2016-11-01/trustedidproviders/id_account.go @@ -36,19 +36,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/datalakestore/2016-11-01/trustedidproviders/id_trustedidprovider.go b/resource-manager/datalakestore/2016-11-01/trustedidproviders/id_trustedidprovider.go index 3070342fe4d..a7e9c6abdd9 100644 --- a/resource-manager/datalakestore/2016-11-01/trustedidproviders/id_trustedidprovider.go +++ b/resource-manager/datalakestore/2016-11-01/trustedidproviders/id_trustedidprovider.go @@ -38,23 +38,9 @@ func ParseTrustedIdProviderID(input string) (*TrustedIdProviderId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TrustedIdProviderId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.TrustedIdProviderName, ok = parsed.Parsed["trustedIdProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "trustedIdProviderName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTrustedIdProviderIDInsensitively(input string) (*TrustedIdProviderId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TrustedIdProviderId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TrustedIdProviderId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.TrustedIdProviderName, ok = parsed.Parsed["trustedIdProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "trustedIdProviderName", *parsed) + if id.TrustedIdProviderName, ok = input.Parsed["trustedIdProviderName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "trustedIdProviderName", input) } - return &id, nil + return nil } // ValidateTrustedIdProviderID checks that 'input' can be parsed as a Trusted Id Provider ID diff --git a/resource-manager/datalakestore/2016-11-01/virtualnetworkrules/id_account.go b/resource-manager/datalakestore/2016-11-01/virtualnetworkrules/id_account.go index 9a0568212ca..01218c3edbf 100644 --- a/resource-manager/datalakestore/2016-11-01/virtualnetworkrules/id_account.go +++ b/resource-manager/datalakestore/2016-11-01/virtualnetworkrules/id_account.go @@ -36,19 +36,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/datalakestore/2016-11-01/virtualnetworkrules/id_virtualnetworkrule.go b/resource-manager/datalakestore/2016-11-01/virtualnetworkrules/id_virtualnetworkrule.go index bb93c16e074..5cebcc3d145 100644 --- a/resource-manager/datalakestore/2016-11-01/virtualnetworkrules/id_virtualnetworkrule.go +++ b/resource-manager/datalakestore/2016-11-01/virtualnetworkrules/id_virtualnetworkrule.go @@ -38,23 +38,9 @@ func ParseVirtualNetworkRuleID(input string) (*VirtualNetworkRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkRuleId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.VirtualNetworkRuleName, ok = parsed.Parsed["virtualNetworkRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualNetworkRuleIDInsensitively(input string) (*VirtualNetworkRuleId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualNetworkRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.VirtualNetworkRuleName, ok = parsed.Parsed["virtualNetworkRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkRuleName", *parsed) + if id.VirtualNetworkRuleName, ok = input.Parsed["virtualNetworkRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkRuleName", input) } - return &id, nil + return nil } // ValidateVirtualNetworkRuleID checks that 'input' can be parsed as a Virtual Network Rule ID diff --git a/resource-manager/datamigration/2018-04-19/customoperation/id_service.go b/resource-manager/datamigration/2018-04-19/customoperation/id_service.go index 5afce043799..8cdd4c14526 100644 --- a/resource-manager/datamigration/2018-04-19/customoperation/id_service.go +++ b/resource-manager/datamigration/2018-04-19/customoperation/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/datamigration/2018-04-19/customoperation/id_task.go b/resource-manager/datamigration/2018-04-19/customoperation/id_task.go index d2bbbf2625b..4a3ca523215 100644 --- a/resource-manager/datamigration/2018-04-19/customoperation/id_task.go +++ b/resource-manager/datamigration/2018-04-19/customoperation/id_task.go @@ -40,27 +40,9 @@ func ParseTaskID(input string) (*TaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TaskId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) - } - - if id.TaskName, ok = parsed.Parsed["taskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "taskName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseTaskIDInsensitively(input string) (*TaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TaskId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TaskId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - if id.TaskName, ok = parsed.Parsed["taskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "taskName", *parsed) + if id.TaskName, ok = input.Parsed["taskName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "taskName", input) } - return &id, nil + return nil } // ValidateTaskID checks that 'input' can be parsed as a Task ID diff --git a/resource-manager/datamigration/2018-04-19/delete/id_project.go b/resource-manager/datamigration/2018-04-19/delete/id_project.go index b2309ca1567..f5f8184e59f 100644 --- a/resource-manager/datamigration/2018-04-19/delete/id_project.go +++ b/resource-manager/datamigration/2018-04-19/delete/id_project.go @@ -38,23 +38,9 @@ func ParseProjectID(input string) (*ProjectId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProjectId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProjectIDInsensitively(input string) (*ProjectId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProjectId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProjectId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - return &id, nil + return nil } // ValidateProjectID checks that 'input' can be parsed as a Project ID diff --git a/resource-manager/datamigration/2018-04-19/delete/id_service.go b/resource-manager/datamigration/2018-04-19/delete/id_service.go index efd83fde691..630cc94475a 100644 --- a/resource-manager/datamigration/2018-04-19/delete/id_service.go +++ b/resource-manager/datamigration/2018-04-19/delete/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/datamigration/2018-04-19/delete/id_task.go b/resource-manager/datamigration/2018-04-19/delete/id_task.go index 84ed6d419ed..04f33e58cc6 100644 --- a/resource-manager/datamigration/2018-04-19/delete/id_task.go +++ b/resource-manager/datamigration/2018-04-19/delete/id_task.go @@ -40,27 +40,9 @@ func ParseTaskID(input string) (*TaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TaskId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) - } - - if id.TaskName, ok = parsed.Parsed["taskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "taskName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseTaskIDInsensitively(input string) (*TaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TaskId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TaskId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - if id.TaskName, ok = parsed.Parsed["taskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "taskName", *parsed) + if id.TaskName, ok = input.Parsed["taskName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "taskName", input) } - return &id, nil + return nil } // ValidateTaskID checks that 'input' can be parsed as a Task ID diff --git a/resource-manager/datamigration/2018-04-19/get/id_location.go b/resource-manager/datamigration/2018-04-19/get/id_location.go index ee581e3a074..92dc30088dc 100644 --- a/resource-manager/datamigration/2018-04-19/get/id_location.go +++ b/resource-manager/datamigration/2018-04-19/get/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/datamigration/2018-04-19/get/id_project.go b/resource-manager/datamigration/2018-04-19/get/id_project.go index b510c5b6b6b..2f4a31b14b3 100644 --- a/resource-manager/datamigration/2018-04-19/get/id_project.go +++ b/resource-manager/datamigration/2018-04-19/get/id_project.go @@ -38,23 +38,9 @@ func ParseProjectID(input string) (*ProjectId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProjectId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProjectIDInsensitively(input string) (*ProjectId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProjectId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProjectId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - return &id, nil + return nil } // ValidateProjectID checks that 'input' can be parsed as a Project ID diff --git a/resource-manager/datamigration/2018-04-19/get/id_resourcegroup.go b/resource-manager/datamigration/2018-04-19/get/id_resourcegroup.go index d4a515a4fcd..3c40dfc87c4 100644 --- a/resource-manager/datamigration/2018-04-19/get/id_resourcegroup.go +++ b/resource-manager/datamigration/2018-04-19/get/id_resourcegroup.go @@ -34,15 +34,9 @@ func ParseResourceGroupID(input string) (*ResourceGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResourceGroupId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseResourceGroupIDInsensitively(input string) (*ResourceGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResourceGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ResourceGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - return &id, nil + return nil } // ValidateResourceGroupID checks that 'input' can be parsed as a Resource Group ID diff --git a/resource-manager/datamigration/2018-04-19/get/id_service.go b/resource-manager/datamigration/2018-04-19/get/id_service.go index 30e212e2f2d..15686270103 100644 --- a/resource-manager/datamigration/2018-04-19/get/id_service.go +++ b/resource-manager/datamigration/2018-04-19/get/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/datamigration/2018-04-19/get/id_task.go b/resource-manager/datamigration/2018-04-19/get/id_task.go index 51019167ba8..ba2417d247c 100644 --- a/resource-manager/datamigration/2018-04-19/get/id_task.go +++ b/resource-manager/datamigration/2018-04-19/get/id_task.go @@ -40,27 +40,9 @@ func ParseTaskID(input string) (*TaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TaskId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) - } - - if id.TaskName, ok = parsed.Parsed["taskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "taskName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseTaskIDInsensitively(input string) (*TaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TaskId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TaskId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - if id.TaskName, ok = parsed.Parsed["taskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "taskName", *parsed) + if id.TaskName, ok = input.Parsed["taskName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "taskName", input) } - return &id, nil + return nil } // ValidateTaskID checks that 'input' can be parsed as a Task ID diff --git a/resource-manager/datamigration/2018-04-19/patch/id_project.go b/resource-manager/datamigration/2018-04-19/patch/id_project.go index c77c07c60f6..5306285b9ab 100644 --- a/resource-manager/datamigration/2018-04-19/patch/id_project.go +++ b/resource-manager/datamigration/2018-04-19/patch/id_project.go @@ -38,23 +38,9 @@ func ParseProjectID(input string) (*ProjectId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProjectId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProjectIDInsensitively(input string) (*ProjectId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProjectId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProjectId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - return &id, nil + return nil } // ValidateProjectID checks that 'input' can be parsed as a Project ID diff --git a/resource-manager/datamigration/2018-04-19/patch/id_service.go b/resource-manager/datamigration/2018-04-19/patch/id_service.go index 72799a5a7e2..c6c32012211 100644 --- a/resource-manager/datamigration/2018-04-19/patch/id_service.go +++ b/resource-manager/datamigration/2018-04-19/patch/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/datamigration/2018-04-19/patch/id_task.go b/resource-manager/datamigration/2018-04-19/patch/id_task.go index b1bb39c752b..7e7c63a723a 100644 --- a/resource-manager/datamigration/2018-04-19/patch/id_task.go +++ b/resource-manager/datamigration/2018-04-19/patch/id_task.go @@ -40,27 +40,9 @@ func ParseTaskID(input string) (*TaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TaskId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) - } - - if id.TaskName, ok = parsed.Parsed["taskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "taskName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseTaskIDInsensitively(input string) (*TaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TaskId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TaskId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - if id.TaskName, ok = parsed.Parsed["taskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "taskName", *parsed) + if id.TaskName, ok = input.Parsed["taskName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "taskName", input) } - return &id, nil + return nil } // ValidateTaskID checks that 'input' can be parsed as a Task ID diff --git a/resource-manager/datamigration/2018-04-19/post/id_location.go b/resource-manager/datamigration/2018-04-19/post/id_location.go index 0361eeaa7ef..3eb20e21715 100644 --- a/resource-manager/datamigration/2018-04-19/post/id_location.go +++ b/resource-manager/datamigration/2018-04-19/post/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/datamigration/2018-04-19/post/id_service.go b/resource-manager/datamigration/2018-04-19/post/id_service.go index f299246447d..bddec686097 100644 --- a/resource-manager/datamigration/2018-04-19/post/id_service.go +++ b/resource-manager/datamigration/2018-04-19/post/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/datamigration/2018-04-19/post/id_task.go b/resource-manager/datamigration/2018-04-19/post/id_task.go index a3432d1c135..046bd760bce 100644 --- a/resource-manager/datamigration/2018-04-19/post/id_task.go +++ b/resource-manager/datamigration/2018-04-19/post/id_task.go @@ -40,27 +40,9 @@ func ParseTaskID(input string) (*TaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TaskId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) - } - - if id.TaskName, ok = parsed.Parsed["taskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "taskName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseTaskIDInsensitively(input string) (*TaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TaskId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TaskId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - if id.TaskName, ok = parsed.Parsed["taskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "taskName", *parsed) + if id.TaskName, ok = input.Parsed["taskName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "taskName", input) } - return &id, nil + return nil } // ValidateTaskID checks that 'input' can be parsed as a Task ID diff --git a/resource-manager/datamigration/2018-04-19/projectresource/id_project.go b/resource-manager/datamigration/2018-04-19/projectresource/id_project.go index 4c2e34433e9..58a495e7c53 100644 --- a/resource-manager/datamigration/2018-04-19/projectresource/id_project.go +++ b/resource-manager/datamigration/2018-04-19/projectresource/id_project.go @@ -38,23 +38,9 @@ func ParseProjectID(input string) (*ProjectId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProjectId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProjectIDInsensitively(input string) (*ProjectId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProjectId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProjectId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - return &id, nil + return nil } // ValidateProjectID checks that 'input' can be parsed as a Project ID diff --git a/resource-manager/datamigration/2018-04-19/projectresource/id_service.go b/resource-manager/datamigration/2018-04-19/projectresource/id_service.go index 73311ba8625..a8ea11d90ff 100644 --- a/resource-manager/datamigration/2018-04-19/projectresource/id_service.go +++ b/resource-manager/datamigration/2018-04-19/projectresource/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/datamigration/2018-04-19/put/id_project.go b/resource-manager/datamigration/2018-04-19/put/id_project.go index 61e42499e57..04347edf4d1 100644 --- a/resource-manager/datamigration/2018-04-19/put/id_project.go +++ b/resource-manager/datamigration/2018-04-19/put/id_project.go @@ -38,23 +38,9 @@ func ParseProjectID(input string) (*ProjectId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProjectId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProjectIDInsensitively(input string) (*ProjectId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProjectId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProjectId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - return &id, nil + return nil } // ValidateProjectID checks that 'input' can be parsed as a Project ID diff --git a/resource-manager/datamigration/2018-04-19/put/id_service.go b/resource-manager/datamigration/2018-04-19/put/id_service.go index ab06a5ab223..1608d8faaf1 100644 --- a/resource-manager/datamigration/2018-04-19/put/id_service.go +++ b/resource-manager/datamigration/2018-04-19/put/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/datamigration/2018-04-19/put/id_task.go b/resource-manager/datamigration/2018-04-19/put/id_task.go index 787e86c965d..8683a286883 100644 --- a/resource-manager/datamigration/2018-04-19/put/id_task.go +++ b/resource-manager/datamigration/2018-04-19/put/id_task.go @@ -40,27 +40,9 @@ func ParseTaskID(input string) (*TaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TaskId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) - } - - if id.TaskName, ok = parsed.Parsed["taskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "taskName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseTaskIDInsensitively(input string) (*TaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TaskId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TaskId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - if id.TaskName, ok = parsed.Parsed["taskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "taskName", *parsed) + if id.TaskName, ok = input.Parsed["taskName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "taskName", input) } - return &id, nil + return nil } // ValidateTaskID checks that 'input' can be parsed as a Task ID diff --git a/resource-manager/datamigration/2018-04-19/serviceresource/id_project.go b/resource-manager/datamigration/2018-04-19/serviceresource/id_project.go index 8bb57a1432d..b8b736c65ad 100644 --- a/resource-manager/datamigration/2018-04-19/serviceresource/id_project.go +++ b/resource-manager/datamigration/2018-04-19/serviceresource/id_project.go @@ -38,23 +38,9 @@ func ParseProjectID(input string) (*ProjectId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProjectId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProjectIDInsensitively(input string) (*ProjectId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProjectId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProjectId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - return &id, nil + return nil } // ValidateProjectID checks that 'input' can be parsed as a Project ID diff --git a/resource-manager/datamigration/2018-04-19/serviceresource/id_resourcegroup.go b/resource-manager/datamigration/2018-04-19/serviceresource/id_resourcegroup.go index edee5aba35c..6ffd61eefce 100644 --- a/resource-manager/datamigration/2018-04-19/serviceresource/id_resourcegroup.go +++ b/resource-manager/datamigration/2018-04-19/serviceresource/id_resourcegroup.go @@ -34,15 +34,9 @@ func ParseResourceGroupID(input string) (*ResourceGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResourceGroupId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseResourceGroupIDInsensitively(input string) (*ResourceGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResourceGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ResourceGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - return &id, nil + return nil } // ValidateResourceGroupID checks that 'input' can be parsed as a Resource Group ID diff --git a/resource-manager/datamigration/2018-04-19/serviceresource/id_service.go b/resource-manager/datamigration/2018-04-19/serviceresource/id_service.go index dd3a2f5f341..53645707db4 100644 --- a/resource-manager/datamigration/2018-04-19/serviceresource/id_service.go +++ b/resource-manager/datamigration/2018-04-19/serviceresource/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/datamigration/2018-04-19/standardoperation/id_location.go b/resource-manager/datamigration/2018-04-19/standardoperation/id_location.go index d04d9d090d9..7474210c14c 100644 --- a/resource-manager/datamigration/2018-04-19/standardoperation/id_location.go +++ b/resource-manager/datamigration/2018-04-19/standardoperation/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/datamigration/2018-04-19/standardoperation/id_project.go b/resource-manager/datamigration/2018-04-19/standardoperation/id_project.go index d3423a317d7..df53d7841ea 100644 --- a/resource-manager/datamigration/2018-04-19/standardoperation/id_project.go +++ b/resource-manager/datamigration/2018-04-19/standardoperation/id_project.go @@ -38,23 +38,9 @@ func ParseProjectID(input string) (*ProjectId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProjectId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProjectIDInsensitively(input string) (*ProjectId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProjectId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProjectId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - return &id, nil + return nil } // ValidateProjectID checks that 'input' can be parsed as a Project ID diff --git a/resource-manager/datamigration/2018-04-19/standardoperation/id_resourcegroup.go b/resource-manager/datamigration/2018-04-19/standardoperation/id_resourcegroup.go index 7c9a1115ba1..a27d85e4fe0 100644 --- a/resource-manager/datamigration/2018-04-19/standardoperation/id_resourcegroup.go +++ b/resource-manager/datamigration/2018-04-19/standardoperation/id_resourcegroup.go @@ -34,15 +34,9 @@ func ParseResourceGroupID(input string) (*ResourceGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResourceGroupId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseResourceGroupIDInsensitively(input string) (*ResourceGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResourceGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ResourceGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - return &id, nil + return nil } // ValidateResourceGroupID checks that 'input' can be parsed as a Resource Group ID diff --git a/resource-manager/datamigration/2018-04-19/standardoperation/id_service.go b/resource-manager/datamigration/2018-04-19/standardoperation/id_service.go index 3264aa01295..68ed7d6ad57 100644 --- a/resource-manager/datamigration/2018-04-19/standardoperation/id_service.go +++ b/resource-manager/datamigration/2018-04-19/standardoperation/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/datamigration/2018-04-19/standardoperation/id_task.go b/resource-manager/datamigration/2018-04-19/standardoperation/id_task.go index 98ae55b71f3..f561e2b648e 100644 --- a/resource-manager/datamigration/2018-04-19/standardoperation/id_task.go +++ b/resource-manager/datamigration/2018-04-19/standardoperation/id_task.go @@ -40,27 +40,9 @@ func ParseTaskID(input string) (*TaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TaskId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) - } - - if id.TaskName, ok = parsed.Parsed["taskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "taskName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseTaskIDInsensitively(input string) (*TaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TaskId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TaskId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - if id.TaskName, ok = parsed.Parsed["taskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "taskName", *parsed) + if id.TaskName, ok = input.Parsed["taskName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "taskName", input) } - return &id, nil + return nil } // ValidateTaskID checks that 'input' can be parsed as a Task ID diff --git a/resource-manager/datamigration/2018-04-19/taskresource/id_task.go b/resource-manager/datamigration/2018-04-19/taskresource/id_task.go index 3fde3cf4360..1351d2259d2 100644 --- a/resource-manager/datamigration/2018-04-19/taskresource/id_task.go +++ b/resource-manager/datamigration/2018-04-19/taskresource/id_task.go @@ -40,27 +40,9 @@ func ParseTaskID(input string) (*TaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TaskId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) - } - - if id.TaskName, ok = parsed.Parsed["taskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "taskName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseTaskIDInsensitively(input string) (*TaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TaskId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TaskId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - if id.TaskName, ok = parsed.Parsed["taskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "taskName", *parsed) + if id.TaskName, ok = input.Parsed["taskName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "taskName", input) } - return &id, nil + return nil } // ValidateTaskID checks that 'input' can be parsed as a Task ID diff --git a/resource-manager/datamigration/2021-06-30/customoperation/id_service.go b/resource-manager/datamigration/2021-06-30/customoperation/id_service.go index 5afce043799..8cdd4c14526 100644 --- a/resource-manager/datamigration/2021-06-30/customoperation/id_service.go +++ b/resource-manager/datamigration/2021-06-30/customoperation/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/datamigration/2021-06-30/customoperation/id_servicetask.go b/resource-manager/datamigration/2021-06-30/customoperation/id_servicetask.go index 61967cda121..08eaea5895f 100644 --- a/resource-manager/datamigration/2021-06-30/customoperation/id_servicetask.go +++ b/resource-manager/datamigration/2021-06-30/customoperation/id_servicetask.go @@ -38,23 +38,9 @@ func ParseServiceTaskID(input string) (*ServiceTaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceTaskId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ServiceTaskName, ok = parsed.Parsed["serviceTaskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceTaskName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseServiceTaskIDInsensitively(input string) (*ServiceTaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceTaskId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ServiceTaskId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ServiceTaskName, ok = parsed.Parsed["serviceTaskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceTaskName", *parsed) + if id.ServiceTaskName, ok = input.Parsed["serviceTaskName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceTaskName", input) } - return &id, nil + return nil } // ValidateServiceTaskID checks that 'input' can be parsed as a Service Task ID diff --git a/resource-manager/datamigration/2021-06-30/customoperation/id_task.go b/resource-manager/datamigration/2021-06-30/customoperation/id_task.go index d2bbbf2625b..4a3ca523215 100644 --- a/resource-manager/datamigration/2021-06-30/customoperation/id_task.go +++ b/resource-manager/datamigration/2021-06-30/customoperation/id_task.go @@ -40,27 +40,9 @@ func ParseTaskID(input string) (*TaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TaskId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) - } - - if id.TaskName, ok = parsed.Parsed["taskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "taskName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseTaskIDInsensitively(input string) (*TaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TaskId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TaskId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - if id.TaskName, ok = parsed.Parsed["taskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "taskName", *parsed) + if id.TaskName, ok = input.Parsed["taskName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "taskName", input) } - return &id, nil + return nil } // ValidateTaskID checks that 'input' can be parsed as a Task ID diff --git a/resource-manager/datamigration/2021-06-30/delete/id_file.go b/resource-manager/datamigration/2021-06-30/delete/id_file.go index abdbc22dda8..5b0f919022f 100644 --- a/resource-manager/datamigration/2021-06-30/delete/id_file.go +++ b/resource-manager/datamigration/2021-06-30/delete/id_file.go @@ -40,27 +40,9 @@ func ParseFileID(input string) (*FileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FileId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) - } - - if id.FileName, ok = parsed.Parsed["fileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fileName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseFileIDInsensitively(input string) (*FileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *FileId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - if id.FileName, ok = parsed.Parsed["fileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fileName", *parsed) + if id.FileName, ok = input.Parsed["fileName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fileName", input) } - return &id, nil + return nil } // ValidateFileID checks that 'input' can be parsed as a File ID diff --git a/resource-manager/datamigration/2021-06-30/delete/id_project.go b/resource-manager/datamigration/2021-06-30/delete/id_project.go index b2309ca1567..f5f8184e59f 100644 --- a/resource-manager/datamigration/2021-06-30/delete/id_project.go +++ b/resource-manager/datamigration/2021-06-30/delete/id_project.go @@ -38,23 +38,9 @@ func ParseProjectID(input string) (*ProjectId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProjectId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProjectIDInsensitively(input string) (*ProjectId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProjectId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProjectId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - return &id, nil + return nil } // ValidateProjectID checks that 'input' can be parsed as a Project ID diff --git a/resource-manager/datamigration/2021-06-30/delete/id_service.go b/resource-manager/datamigration/2021-06-30/delete/id_service.go index efd83fde691..630cc94475a 100644 --- a/resource-manager/datamigration/2021-06-30/delete/id_service.go +++ b/resource-manager/datamigration/2021-06-30/delete/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/datamigration/2021-06-30/delete/id_servicetask.go b/resource-manager/datamigration/2021-06-30/delete/id_servicetask.go index cda8d7e0ea0..51b6e509854 100644 --- a/resource-manager/datamigration/2021-06-30/delete/id_servicetask.go +++ b/resource-manager/datamigration/2021-06-30/delete/id_servicetask.go @@ -38,23 +38,9 @@ func ParseServiceTaskID(input string) (*ServiceTaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceTaskId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ServiceTaskName, ok = parsed.Parsed["serviceTaskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceTaskName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseServiceTaskIDInsensitively(input string) (*ServiceTaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceTaskId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ServiceTaskId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ServiceTaskName, ok = parsed.Parsed["serviceTaskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceTaskName", *parsed) + if id.ServiceTaskName, ok = input.Parsed["serviceTaskName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceTaskName", input) } - return &id, nil + return nil } // ValidateServiceTaskID checks that 'input' can be parsed as a Service Task ID diff --git a/resource-manager/datamigration/2021-06-30/delete/id_task.go b/resource-manager/datamigration/2021-06-30/delete/id_task.go index 84ed6d419ed..04f33e58cc6 100644 --- a/resource-manager/datamigration/2021-06-30/delete/id_task.go +++ b/resource-manager/datamigration/2021-06-30/delete/id_task.go @@ -40,27 +40,9 @@ func ParseTaskID(input string) (*TaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TaskId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) - } - - if id.TaskName, ok = parsed.Parsed["taskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "taskName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseTaskIDInsensitively(input string) (*TaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TaskId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TaskId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - if id.TaskName, ok = parsed.Parsed["taskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "taskName", *parsed) + if id.TaskName, ok = input.Parsed["taskName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "taskName", input) } - return &id, nil + return nil } // ValidateTaskID checks that 'input' can be parsed as a Task ID diff --git a/resource-manager/datamigration/2021-06-30/fieresource/id_file.go b/resource-manager/datamigration/2021-06-30/fieresource/id_file.go index b1af760febd..26d964b7ca5 100644 --- a/resource-manager/datamigration/2021-06-30/fieresource/id_file.go +++ b/resource-manager/datamigration/2021-06-30/fieresource/id_file.go @@ -40,27 +40,9 @@ func ParseFileID(input string) (*FileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FileId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) - } - - if id.FileName, ok = parsed.Parsed["fileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fileName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseFileIDInsensitively(input string) (*FileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *FileId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - if id.FileName, ok = parsed.Parsed["fileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fileName", *parsed) + if id.FileName, ok = input.Parsed["fileName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fileName", input) } - return &id, nil + return nil } // ValidateFileID checks that 'input' can be parsed as a File ID diff --git a/resource-manager/datamigration/2021-06-30/fileresource/id_file.go b/resource-manager/datamigration/2021-06-30/fileresource/id_file.go index 465fcc8535e..85bee290699 100644 --- a/resource-manager/datamigration/2021-06-30/fileresource/id_file.go +++ b/resource-manager/datamigration/2021-06-30/fileresource/id_file.go @@ -40,27 +40,9 @@ func ParseFileID(input string) (*FileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FileId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) - } - - if id.FileName, ok = parsed.Parsed["fileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fileName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseFileIDInsensitively(input string) (*FileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *FileId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - if id.FileName, ok = parsed.Parsed["fileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fileName", *parsed) + if id.FileName, ok = input.Parsed["fileName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fileName", input) } - return &id, nil + return nil } // ValidateFileID checks that 'input' can be parsed as a File ID diff --git a/resource-manager/datamigration/2021-06-30/fileresource/id_project.go b/resource-manager/datamigration/2021-06-30/fileresource/id_project.go index 858d11260cd..f1b41302b8f 100644 --- a/resource-manager/datamigration/2021-06-30/fileresource/id_project.go +++ b/resource-manager/datamigration/2021-06-30/fileresource/id_project.go @@ -38,23 +38,9 @@ func ParseProjectID(input string) (*ProjectId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProjectId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProjectIDInsensitively(input string) (*ProjectId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProjectId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProjectId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - return &id, nil + return nil } // ValidateProjectID checks that 'input' can be parsed as a Project ID diff --git a/resource-manager/datamigration/2021-06-30/get/id_file.go b/resource-manager/datamigration/2021-06-30/get/id_file.go index 74a8483b002..60651690e55 100644 --- a/resource-manager/datamigration/2021-06-30/get/id_file.go +++ b/resource-manager/datamigration/2021-06-30/get/id_file.go @@ -40,27 +40,9 @@ func ParseFileID(input string) (*FileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FileId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) - } - - if id.FileName, ok = parsed.Parsed["fileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fileName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseFileIDInsensitively(input string) (*FileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *FileId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - if id.FileName, ok = parsed.Parsed["fileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fileName", *parsed) + if id.FileName, ok = input.Parsed["fileName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fileName", input) } - return &id, nil + return nil } // ValidateFileID checks that 'input' can be parsed as a File ID diff --git a/resource-manager/datamigration/2021-06-30/get/id_location.go b/resource-manager/datamigration/2021-06-30/get/id_location.go index ee581e3a074..92dc30088dc 100644 --- a/resource-manager/datamigration/2021-06-30/get/id_location.go +++ b/resource-manager/datamigration/2021-06-30/get/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/datamigration/2021-06-30/get/id_project.go b/resource-manager/datamigration/2021-06-30/get/id_project.go index b510c5b6b6b..2f4a31b14b3 100644 --- a/resource-manager/datamigration/2021-06-30/get/id_project.go +++ b/resource-manager/datamigration/2021-06-30/get/id_project.go @@ -38,23 +38,9 @@ func ParseProjectID(input string) (*ProjectId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProjectId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProjectIDInsensitively(input string) (*ProjectId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProjectId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProjectId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - return &id, nil + return nil } // ValidateProjectID checks that 'input' can be parsed as a Project ID diff --git a/resource-manager/datamigration/2021-06-30/get/id_resourcegroup.go b/resource-manager/datamigration/2021-06-30/get/id_resourcegroup.go index d4a515a4fcd..3c40dfc87c4 100644 --- a/resource-manager/datamigration/2021-06-30/get/id_resourcegroup.go +++ b/resource-manager/datamigration/2021-06-30/get/id_resourcegroup.go @@ -34,15 +34,9 @@ func ParseResourceGroupID(input string) (*ResourceGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResourceGroupId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseResourceGroupIDInsensitively(input string) (*ResourceGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResourceGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ResourceGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - return &id, nil + return nil } // ValidateResourceGroupID checks that 'input' can be parsed as a Resource Group ID diff --git a/resource-manager/datamigration/2021-06-30/get/id_service.go b/resource-manager/datamigration/2021-06-30/get/id_service.go index 30e212e2f2d..15686270103 100644 --- a/resource-manager/datamigration/2021-06-30/get/id_service.go +++ b/resource-manager/datamigration/2021-06-30/get/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/datamigration/2021-06-30/get/id_servicetask.go b/resource-manager/datamigration/2021-06-30/get/id_servicetask.go index 10fcf2a8f71..2908c68b885 100644 --- a/resource-manager/datamigration/2021-06-30/get/id_servicetask.go +++ b/resource-manager/datamigration/2021-06-30/get/id_servicetask.go @@ -38,23 +38,9 @@ func ParseServiceTaskID(input string) (*ServiceTaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceTaskId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ServiceTaskName, ok = parsed.Parsed["serviceTaskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceTaskName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseServiceTaskIDInsensitively(input string) (*ServiceTaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceTaskId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ServiceTaskId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ServiceTaskName, ok = parsed.Parsed["serviceTaskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceTaskName", *parsed) + if id.ServiceTaskName, ok = input.Parsed["serviceTaskName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceTaskName", input) } - return &id, nil + return nil } // ValidateServiceTaskID checks that 'input' can be parsed as a Service Task ID diff --git a/resource-manager/datamigration/2021-06-30/get/id_task.go b/resource-manager/datamigration/2021-06-30/get/id_task.go index 51019167ba8..ba2417d247c 100644 --- a/resource-manager/datamigration/2021-06-30/get/id_task.go +++ b/resource-manager/datamigration/2021-06-30/get/id_task.go @@ -40,27 +40,9 @@ func ParseTaskID(input string) (*TaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TaskId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) - } - - if id.TaskName, ok = parsed.Parsed["taskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "taskName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseTaskIDInsensitively(input string) (*TaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TaskId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TaskId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - if id.TaskName, ok = parsed.Parsed["taskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "taskName", *parsed) + if id.TaskName, ok = input.Parsed["taskName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "taskName", input) } - return &id, nil + return nil } // ValidateTaskID checks that 'input' can be parsed as a Task ID diff --git a/resource-manager/datamigration/2021-06-30/patch/id_file.go b/resource-manager/datamigration/2021-06-30/patch/id_file.go index 7c7c101fc77..8621602e3ae 100644 --- a/resource-manager/datamigration/2021-06-30/patch/id_file.go +++ b/resource-manager/datamigration/2021-06-30/patch/id_file.go @@ -40,27 +40,9 @@ func ParseFileID(input string) (*FileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FileId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) - } - - if id.FileName, ok = parsed.Parsed["fileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fileName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseFileIDInsensitively(input string) (*FileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *FileId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - if id.FileName, ok = parsed.Parsed["fileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fileName", *parsed) + if id.FileName, ok = input.Parsed["fileName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fileName", input) } - return &id, nil + return nil } // ValidateFileID checks that 'input' can be parsed as a File ID diff --git a/resource-manager/datamigration/2021-06-30/patch/id_project.go b/resource-manager/datamigration/2021-06-30/patch/id_project.go index c77c07c60f6..5306285b9ab 100644 --- a/resource-manager/datamigration/2021-06-30/patch/id_project.go +++ b/resource-manager/datamigration/2021-06-30/patch/id_project.go @@ -38,23 +38,9 @@ func ParseProjectID(input string) (*ProjectId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProjectId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProjectIDInsensitively(input string) (*ProjectId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProjectId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProjectId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - return &id, nil + return nil } // ValidateProjectID checks that 'input' can be parsed as a Project ID diff --git a/resource-manager/datamigration/2021-06-30/patch/id_service.go b/resource-manager/datamigration/2021-06-30/patch/id_service.go index 72799a5a7e2..c6c32012211 100644 --- a/resource-manager/datamigration/2021-06-30/patch/id_service.go +++ b/resource-manager/datamigration/2021-06-30/patch/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/datamigration/2021-06-30/patch/id_servicetask.go b/resource-manager/datamigration/2021-06-30/patch/id_servicetask.go index 23ec32ace8e..11ef4c516fa 100644 --- a/resource-manager/datamigration/2021-06-30/patch/id_servicetask.go +++ b/resource-manager/datamigration/2021-06-30/patch/id_servicetask.go @@ -38,23 +38,9 @@ func ParseServiceTaskID(input string) (*ServiceTaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceTaskId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ServiceTaskName, ok = parsed.Parsed["serviceTaskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceTaskName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseServiceTaskIDInsensitively(input string) (*ServiceTaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceTaskId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ServiceTaskId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ServiceTaskName, ok = parsed.Parsed["serviceTaskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceTaskName", *parsed) + if id.ServiceTaskName, ok = input.Parsed["serviceTaskName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceTaskName", input) } - return &id, nil + return nil } // ValidateServiceTaskID checks that 'input' can be parsed as a Service Task ID diff --git a/resource-manager/datamigration/2021-06-30/patch/id_task.go b/resource-manager/datamigration/2021-06-30/patch/id_task.go index b1bb39c752b..7e7c63a723a 100644 --- a/resource-manager/datamigration/2021-06-30/patch/id_task.go +++ b/resource-manager/datamigration/2021-06-30/patch/id_task.go @@ -40,27 +40,9 @@ func ParseTaskID(input string) (*TaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TaskId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) - } - - if id.TaskName, ok = parsed.Parsed["taskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "taskName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseTaskIDInsensitively(input string) (*TaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TaskId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TaskId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - if id.TaskName, ok = parsed.Parsed["taskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "taskName", *parsed) + if id.TaskName, ok = input.Parsed["taskName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "taskName", input) } - return &id, nil + return nil } // ValidateTaskID checks that 'input' can be parsed as a Task ID diff --git a/resource-manager/datamigration/2021-06-30/post/id_file.go b/resource-manager/datamigration/2021-06-30/post/id_file.go index 04f75290203..b7afd7e0e30 100644 --- a/resource-manager/datamigration/2021-06-30/post/id_file.go +++ b/resource-manager/datamigration/2021-06-30/post/id_file.go @@ -40,27 +40,9 @@ func ParseFileID(input string) (*FileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FileId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) - } - - if id.FileName, ok = parsed.Parsed["fileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fileName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseFileIDInsensitively(input string) (*FileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *FileId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - if id.FileName, ok = parsed.Parsed["fileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fileName", *parsed) + if id.FileName, ok = input.Parsed["fileName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fileName", input) } - return &id, nil + return nil } // ValidateFileID checks that 'input' can be parsed as a File ID diff --git a/resource-manager/datamigration/2021-06-30/post/id_location.go b/resource-manager/datamigration/2021-06-30/post/id_location.go index 0361eeaa7ef..3eb20e21715 100644 --- a/resource-manager/datamigration/2021-06-30/post/id_location.go +++ b/resource-manager/datamigration/2021-06-30/post/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/datamigration/2021-06-30/post/id_service.go b/resource-manager/datamigration/2021-06-30/post/id_service.go index f299246447d..bddec686097 100644 --- a/resource-manager/datamigration/2021-06-30/post/id_service.go +++ b/resource-manager/datamigration/2021-06-30/post/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/datamigration/2021-06-30/post/id_servicetask.go b/resource-manager/datamigration/2021-06-30/post/id_servicetask.go index 4ece1f3b84c..11e7e4988e1 100644 --- a/resource-manager/datamigration/2021-06-30/post/id_servicetask.go +++ b/resource-manager/datamigration/2021-06-30/post/id_servicetask.go @@ -38,23 +38,9 @@ func ParseServiceTaskID(input string) (*ServiceTaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceTaskId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ServiceTaskName, ok = parsed.Parsed["serviceTaskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceTaskName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseServiceTaskIDInsensitively(input string) (*ServiceTaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceTaskId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ServiceTaskId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ServiceTaskName, ok = parsed.Parsed["serviceTaskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceTaskName", *parsed) + if id.ServiceTaskName, ok = input.Parsed["serviceTaskName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceTaskName", input) } - return &id, nil + return nil } // ValidateServiceTaskID checks that 'input' can be parsed as a Service Task ID diff --git a/resource-manager/datamigration/2021-06-30/post/id_task.go b/resource-manager/datamigration/2021-06-30/post/id_task.go index a3432d1c135..046bd760bce 100644 --- a/resource-manager/datamigration/2021-06-30/post/id_task.go +++ b/resource-manager/datamigration/2021-06-30/post/id_task.go @@ -40,27 +40,9 @@ func ParseTaskID(input string) (*TaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TaskId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) - } - - if id.TaskName, ok = parsed.Parsed["taskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "taskName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseTaskIDInsensitively(input string) (*TaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TaskId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TaskId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - if id.TaskName, ok = parsed.Parsed["taskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "taskName", *parsed) + if id.TaskName, ok = input.Parsed["taskName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "taskName", input) } - return &id, nil + return nil } // ValidateTaskID checks that 'input' can be parsed as a Task ID diff --git a/resource-manager/datamigration/2021-06-30/projectresource/id_project.go b/resource-manager/datamigration/2021-06-30/projectresource/id_project.go index 4c2e34433e9..58a495e7c53 100644 --- a/resource-manager/datamigration/2021-06-30/projectresource/id_project.go +++ b/resource-manager/datamigration/2021-06-30/projectresource/id_project.go @@ -38,23 +38,9 @@ func ParseProjectID(input string) (*ProjectId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProjectId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProjectIDInsensitively(input string) (*ProjectId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProjectId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProjectId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - return &id, nil + return nil } // ValidateProjectID checks that 'input' can be parsed as a Project ID diff --git a/resource-manager/datamigration/2021-06-30/projectresource/id_service.go b/resource-manager/datamigration/2021-06-30/projectresource/id_service.go index 73311ba8625..a8ea11d90ff 100644 --- a/resource-manager/datamigration/2021-06-30/projectresource/id_service.go +++ b/resource-manager/datamigration/2021-06-30/projectresource/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/datamigration/2021-06-30/put/id_file.go b/resource-manager/datamigration/2021-06-30/put/id_file.go index 35b5accb6b9..43e6e0f1964 100644 --- a/resource-manager/datamigration/2021-06-30/put/id_file.go +++ b/resource-manager/datamigration/2021-06-30/put/id_file.go @@ -40,27 +40,9 @@ func ParseFileID(input string) (*FileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FileId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) - } - - if id.FileName, ok = parsed.Parsed["fileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fileName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseFileIDInsensitively(input string) (*FileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *FileId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - if id.FileName, ok = parsed.Parsed["fileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fileName", *parsed) + if id.FileName, ok = input.Parsed["fileName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fileName", input) } - return &id, nil + return nil } // ValidateFileID checks that 'input' can be parsed as a File ID diff --git a/resource-manager/datamigration/2021-06-30/put/id_project.go b/resource-manager/datamigration/2021-06-30/put/id_project.go index 61e42499e57..04347edf4d1 100644 --- a/resource-manager/datamigration/2021-06-30/put/id_project.go +++ b/resource-manager/datamigration/2021-06-30/put/id_project.go @@ -38,23 +38,9 @@ func ParseProjectID(input string) (*ProjectId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProjectId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProjectIDInsensitively(input string) (*ProjectId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProjectId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProjectId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - return &id, nil + return nil } // ValidateProjectID checks that 'input' can be parsed as a Project ID diff --git a/resource-manager/datamigration/2021-06-30/put/id_service.go b/resource-manager/datamigration/2021-06-30/put/id_service.go index ab06a5ab223..1608d8faaf1 100644 --- a/resource-manager/datamigration/2021-06-30/put/id_service.go +++ b/resource-manager/datamigration/2021-06-30/put/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/datamigration/2021-06-30/put/id_servicetask.go b/resource-manager/datamigration/2021-06-30/put/id_servicetask.go index 333a0414ee3..1ed2c9c875c 100644 --- a/resource-manager/datamigration/2021-06-30/put/id_servicetask.go +++ b/resource-manager/datamigration/2021-06-30/put/id_servicetask.go @@ -38,23 +38,9 @@ func ParseServiceTaskID(input string) (*ServiceTaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceTaskId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ServiceTaskName, ok = parsed.Parsed["serviceTaskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceTaskName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseServiceTaskIDInsensitively(input string) (*ServiceTaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceTaskId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ServiceTaskId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ServiceTaskName, ok = parsed.Parsed["serviceTaskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceTaskName", *parsed) + if id.ServiceTaskName, ok = input.Parsed["serviceTaskName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceTaskName", input) } - return &id, nil + return nil } // ValidateServiceTaskID checks that 'input' can be parsed as a Service Task ID diff --git a/resource-manager/datamigration/2021-06-30/put/id_task.go b/resource-manager/datamigration/2021-06-30/put/id_task.go index 787e86c965d..8683a286883 100644 --- a/resource-manager/datamigration/2021-06-30/put/id_task.go +++ b/resource-manager/datamigration/2021-06-30/put/id_task.go @@ -40,27 +40,9 @@ func ParseTaskID(input string) (*TaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TaskId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) - } - - if id.TaskName, ok = parsed.Parsed["taskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "taskName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseTaskIDInsensitively(input string) (*TaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TaskId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TaskId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - if id.TaskName, ok = parsed.Parsed["taskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "taskName", *parsed) + if id.TaskName, ok = input.Parsed["taskName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "taskName", input) } - return &id, nil + return nil } // ValidateTaskID checks that 'input' can be parsed as a Task ID diff --git a/resource-manager/datamigration/2021-06-30/serviceresource/id_project.go b/resource-manager/datamigration/2021-06-30/serviceresource/id_project.go index 8bb57a1432d..b8b736c65ad 100644 --- a/resource-manager/datamigration/2021-06-30/serviceresource/id_project.go +++ b/resource-manager/datamigration/2021-06-30/serviceresource/id_project.go @@ -38,23 +38,9 @@ func ParseProjectID(input string) (*ProjectId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProjectId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProjectIDInsensitively(input string) (*ProjectId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProjectId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProjectId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - return &id, nil + return nil } // ValidateProjectID checks that 'input' can be parsed as a Project ID diff --git a/resource-manager/datamigration/2021-06-30/serviceresource/id_resourcegroup.go b/resource-manager/datamigration/2021-06-30/serviceresource/id_resourcegroup.go index edee5aba35c..6ffd61eefce 100644 --- a/resource-manager/datamigration/2021-06-30/serviceresource/id_resourcegroup.go +++ b/resource-manager/datamigration/2021-06-30/serviceresource/id_resourcegroup.go @@ -34,15 +34,9 @@ func ParseResourceGroupID(input string) (*ResourceGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResourceGroupId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseResourceGroupIDInsensitively(input string) (*ResourceGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResourceGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ResourceGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - return &id, nil + return nil } // ValidateResourceGroupID checks that 'input' can be parsed as a Resource Group ID diff --git a/resource-manager/datamigration/2021-06-30/serviceresource/id_service.go b/resource-manager/datamigration/2021-06-30/serviceresource/id_service.go index dd3a2f5f341..53645707db4 100644 --- a/resource-manager/datamigration/2021-06-30/serviceresource/id_service.go +++ b/resource-manager/datamigration/2021-06-30/serviceresource/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/datamigration/2021-06-30/servicetaskresource/id_servicetask.go b/resource-manager/datamigration/2021-06-30/servicetaskresource/id_servicetask.go index 34cd4820083..817d5bbca39 100644 --- a/resource-manager/datamigration/2021-06-30/servicetaskresource/id_servicetask.go +++ b/resource-manager/datamigration/2021-06-30/servicetaskresource/id_servicetask.go @@ -38,23 +38,9 @@ func ParseServiceTaskID(input string) (*ServiceTaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceTaskId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ServiceTaskName, ok = parsed.Parsed["serviceTaskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceTaskName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseServiceTaskIDInsensitively(input string) (*ServiceTaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceTaskId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ServiceTaskId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ServiceTaskName, ok = parsed.Parsed["serviceTaskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceTaskName", *parsed) + if id.ServiceTaskName, ok = input.Parsed["serviceTaskName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceTaskName", input) } - return &id, nil + return nil } // ValidateServiceTaskID checks that 'input' can be parsed as a Service Task ID diff --git a/resource-manager/datamigration/2021-06-30/standardoperation/id_file.go b/resource-manager/datamigration/2021-06-30/standardoperation/id_file.go index 7d48d0d4ca6..5db163ce976 100644 --- a/resource-manager/datamigration/2021-06-30/standardoperation/id_file.go +++ b/resource-manager/datamigration/2021-06-30/standardoperation/id_file.go @@ -40,27 +40,9 @@ func ParseFileID(input string) (*FileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FileId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) - } - - if id.FileName, ok = parsed.Parsed["fileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fileName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseFileIDInsensitively(input string) (*FileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *FileId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - if id.FileName, ok = parsed.Parsed["fileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fileName", *parsed) + if id.FileName, ok = input.Parsed["fileName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fileName", input) } - return &id, nil + return nil } // ValidateFileID checks that 'input' can be parsed as a File ID diff --git a/resource-manager/datamigration/2021-06-30/standardoperation/id_location.go b/resource-manager/datamigration/2021-06-30/standardoperation/id_location.go index d04d9d090d9..7474210c14c 100644 --- a/resource-manager/datamigration/2021-06-30/standardoperation/id_location.go +++ b/resource-manager/datamigration/2021-06-30/standardoperation/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/datamigration/2021-06-30/standardoperation/id_project.go b/resource-manager/datamigration/2021-06-30/standardoperation/id_project.go index d3423a317d7..df53d7841ea 100644 --- a/resource-manager/datamigration/2021-06-30/standardoperation/id_project.go +++ b/resource-manager/datamigration/2021-06-30/standardoperation/id_project.go @@ -38,23 +38,9 @@ func ParseProjectID(input string) (*ProjectId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProjectId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProjectIDInsensitively(input string) (*ProjectId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProjectId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProjectId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - return &id, nil + return nil } // ValidateProjectID checks that 'input' can be parsed as a Project ID diff --git a/resource-manager/datamigration/2021-06-30/standardoperation/id_resourcegroup.go b/resource-manager/datamigration/2021-06-30/standardoperation/id_resourcegroup.go index 7c9a1115ba1..a27d85e4fe0 100644 --- a/resource-manager/datamigration/2021-06-30/standardoperation/id_resourcegroup.go +++ b/resource-manager/datamigration/2021-06-30/standardoperation/id_resourcegroup.go @@ -34,15 +34,9 @@ func ParseResourceGroupID(input string) (*ResourceGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResourceGroupId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseResourceGroupIDInsensitively(input string) (*ResourceGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResourceGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ResourceGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - return &id, nil + return nil } // ValidateResourceGroupID checks that 'input' can be parsed as a Resource Group ID diff --git a/resource-manager/datamigration/2021-06-30/standardoperation/id_service.go b/resource-manager/datamigration/2021-06-30/standardoperation/id_service.go index 3264aa01295..68ed7d6ad57 100644 --- a/resource-manager/datamigration/2021-06-30/standardoperation/id_service.go +++ b/resource-manager/datamigration/2021-06-30/standardoperation/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/datamigration/2021-06-30/standardoperation/id_servicetask.go b/resource-manager/datamigration/2021-06-30/standardoperation/id_servicetask.go index 968b2578b49..1e7e0de46e3 100644 --- a/resource-manager/datamigration/2021-06-30/standardoperation/id_servicetask.go +++ b/resource-manager/datamigration/2021-06-30/standardoperation/id_servicetask.go @@ -38,23 +38,9 @@ func ParseServiceTaskID(input string) (*ServiceTaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceTaskId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ServiceTaskName, ok = parsed.Parsed["serviceTaskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceTaskName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseServiceTaskIDInsensitively(input string) (*ServiceTaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceTaskId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ServiceTaskId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ServiceTaskName, ok = parsed.Parsed["serviceTaskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceTaskName", *parsed) + if id.ServiceTaskName, ok = input.Parsed["serviceTaskName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceTaskName", input) } - return &id, nil + return nil } // ValidateServiceTaskID checks that 'input' can be parsed as a Service Task ID diff --git a/resource-manager/datamigration/2021-06-30/standardoperation/id_task.go b/resource-manager/datamigration/2021-06-30/standardoperation/id_task.go index 98ae55b71f3..f561e2b648e 100644 --- a/resource-manager/datamigration/2021-06-30/standardoperation/id_task.go +++ b/resource-manager/datamigration/2021-06-30/standardoperation/id_task.go @@ -40,27 +40,9 @@ func ParseTaskID(input string) (*TaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TaskId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) - } - - if id.TaskName, ok = parsed.Parsed["taskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "taskName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseTaskIDInsensitively(input string) (*TaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TaskId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TaskId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - if id.TaskName, ok = parsed.Parsed["taskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "taskName", *parsed) + if id.TaskName, ok = input.Parsed["taskName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "taskName", input) } - return &id, nil + return nil } // ValidateTaskID checks that 'input' can be parsed as a Task ID diff --git a/resource-manager/datamigration/2021-06-30/taskresource/id_task.go b/resource-manager/datamigration/2021-06-30/taskresource/id_task.go index 3fde3cf4360..1351d2259d2 100644 --- a/resource-manager/datamigration/2021-06-30/taskresource/id_task.go +++ b/resource-manager/datamigration/2021-06-30/taskresource/id_task.go @@ -40,27 +40,9 @@ func ParseTaskID(input string) (*TaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TaskId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) - } - - if id.TaskName, ok = parsed.Parsed["taskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "taskName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseTaskIDInsensitively(input string) (*TaskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TaskId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TaskId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - if id.TaskName, ok = parsed.Parsed["taskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "taskName", *parsed) + if id.TaskName, ok = input.Parsed["taskName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "taskName", input) } - return &id, nil + return nil } // ValidateTaskID checks that 'input' can be parsed as a Task ID diff --git a/resource-manager/dataprotection/2022-04-01/azurebackupjob/id_backupjob.go b/resource-manager/dataprotection/2022-04-01/azurebackupjob/id_backupjob.go index a769a90c13d..8b7ca0eeb92 100644 --- a/resource-manager/dataprotection/2022-04-01/azurebackupjob/id_backupjob.go +++ b/resource-manager/dataprotection/2022-04-01/azurebackupjob/id_backupjob.go @@ -38,23 +38,9 @@ func ParseBackupJobID(input string) (*BackupJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupJobId{} - - 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.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) - } - - if id.JobId, ok = parsed.Parsed["jobId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupJobIDInsensitively(input string) (*BackupJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupJobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupJobId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) } - if id.JobId, ok = parsed.Parsed["jobId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobId", *parsed) + if id.JobId, ok = input.Parsed["jobId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobId", input) } - return &id, nil + return nil } // ValidateBackupJobID checks that 'input' can be parsed as a Backup Job ID diff --git a/resource-manager/dataprotection/2022-04-01/azurebackupjob/id_backupvault.go b/resource-manager/dataprotection/2022-04-01/azurebackupjob/id_backupvault.go index 01ffa4d4b32..963509b4166 100644 --- a/resource-manager/dataprotection/2022-04-01/azurebackupjob/id_backupvault.go +++ b/resource-manager/dataprotection/2022-04-01/azurebackupjob/id_backupvault.go @@ -36,19 +36,9 @@ func ParseBackupVaultID(input string) (*BackupVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupVaultId{} - - 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.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseBackupVaultIDInsensitively(input string) (*BackupVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupVaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *BackupVaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) } - return &id, nil + return nil } // ValidateBackupVaultID checks that 'input' can be parsed as a Backup Vault ID diff --git a/resource-manager/dataprotection/2022-04-01/azurebackupjob/id_operationid.go b/resource-manager/dataprotection/2022-04-01/azurebackupjob/id_operationid.go index 7eb3dd07d59..72e196b0385 100644 --- a/resource-manager/dataprotection/2022-04-01/azurebackupjob/id_operationid.go +++ b/resource-manager/dataprotection/2022-04-01/azurebackupjob/id_operationid.go @@ -38,23 +38,9 @@ func ParseOperationIdID(input string) (*OperationIdId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationIdId{} - - 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.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) - } - - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseOperationIdIDInsensitively(input string) (*OperationIdId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationIdId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OperationIdId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) } - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if id.OperationId, ok = input.Parsed["operationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "operationId", input) } - return &id, nil + return nil } // ValidateOperationIdID checks that 'input' can be parsed as a Operation Id ID diff --git a/resource-manager/dataprotection/2022-04-01/azurebackupjobs/id_backupvault.go b/resource-manager/dataprotection/2022-04-01/azurebackupjobs/id_backupvault.go index 848e8c492b4..1e8b4932b4c 100644 --- a/resource-manager/dataprotection/2022-04-01/azurebackupjobs/id_backupvault.go +++ b/resource-manager/dataprotection/2022-04-01/azurebackupjobs/id_backupvault.go @@ -36,19 +36,9 @@ func ParseBackupVaultID(input string) (*BackupVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupVaultId{} - - 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.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseBackupVaultIDInsensitively(input string) (*BackupVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupVaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *BackupVaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) } - return &id, nil + return nil } // ValidateBackupVaultID checks that 'input' can be parsed as a Backup Vault ID diff --git a/resource-manager/dataprotection/2022-04-01/backupinstances/id_backupinstance.go b/resource-manager/dataprotection/2022-04-01/backupinstances/id_backupinstance.go index c4cac4c1166..2ed30ac3214 100644 --- a/resource-manager/dataprotection/2022-04-01/backupinstances/id_backupinstance.go +++ b/resource-manager/dataprotection/2022-04-01/backupinstances/id_backupinstance.go @@ -38,23 +38,9 @@ func ParseBackupInstanceID(input string) (*BackupInstanceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupInstanceId{} - - 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.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) - } - - if id.BackupInstanceName, ok = parsed.Parsed["backupInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupInstanceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupInstanceIDInsensitively(input string) (*BackupInstanceId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupInstanceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) } - if id.BackupInstanceName, ok = parsed.Parsed["backupInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupInstanceName", *parsed) + if id.BackupInstanceName, ok = input.Parsed["backupInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupInstanceName", input) } - return &id, nil + return nil } // ValidateBackupInstanceID checks that 'input' can be parsed as a Backup Instance ID diff --git a/resource-manager/dataprotection/2022-04-01/backupinstances/id_backupvault.go b/resource-manager/dataprotection/2022-04-01/backupinstances/id_backupvault.go index 8c5066717df..51e9b47f9af 100644 --- a/resource-manager/dataprotection/2022-04-01/backupinstances/id_backupvault.go +++ b/resource-manager/dataprotection/2022-04-01/backupinstances/id_backupvault.go @@ -36,19 +36,9 @@ func ParseBackupVaultID(input string) (*BackupVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupVaultId{} - - 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.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseBackupVaultIDInsensitively(input string) (*BackupVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupVaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *BackupVaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) } - return &id, nil + return nil } // ValidateBackupVaultID checks that 'input' can be parsed as a Backup Vault ID diff --git a/resource-manager/dataprotection/2022-04-01/backuppolicies/id_backuppolicy.go b/resource-manager/dataprotection/2022-04-01/backuppolicies/id_backuppolicy.go index ffa3a9a836f..8403e90a879 100644 --- a/resource-manager/dataprotection/2022-04-01/backuppolicies/id_backuppolicy.go +++ b/resource-manager/dataprotection/2022-04-01/backuppolicies/id_backuppolicy.go @@ -38,23 +38,9 @@ func ParseBackupPolicyID(input string) (*BackupPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupPolicyId{} - - 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.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) - } - - if id.BackupPolicyName, ok = parsed.Parsed["backupPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupPolicyIDInsensitively(input string) (*BackupPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) } - if id.BackupPolicyName, ok = parsed.Parsed["backupPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupPolicyName", *parsed) + if id.BackupPolicyName, ok = input.Parsed["backupPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupPolicyName", input) } - return &id, nil + return nil } // ValidateBackupPolicyID checks that 'input' can be parsed as a Backup Policy ID diff --git a/resource-manager/dataprotection/2022-04-01/backuppolicies/id_backupvault.go b/resource-manager/dataprotection/2022-04-01/backuppolicies/id_backupvault.go index 34bc1350ce4..de03baab418 100644 --- a/resource-manager/dataprotection/2022-04-01/backuppolicies/id_backupvault.go +++ b/resource-manager/dataprotection/2022-04-01/backuppolicies/id_backupvault.go @@ -36,19 +36,9 @@ func ParseBackupVaultID(input string) (*BackupVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupVaultId{} - - 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.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseBackupVaultIDInsensitively(input string) (*BackupVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupVaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *BackupVaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) } - return &id, nil + return nil } // ValidateBackupVaultID checks that 'input' can be parsed as a Backup Vault ID diff --git a/resource-manager/dataprotection/2022-04-01/backupvaults/id_backupvault.go b/resource-manager/dataprotection/2022-04-01/backupvaults/id_backupvault.go index 9f16ee084a4..b2cb37557bf 100644 --- a/resource-manager/dataprotection/2022-04-01/backupvaults/id_backupvault.go +++ b/resource-manager/dataprotection/2022-04-01/backupvaults/id_backupvault.go @@ -36,19 +36,9 @@ func ParseBackupVaultID(input string) (*BackupVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupVaultId{} - - 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.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseBackupVaultIDInsensitively(input string) (*BackupVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupVaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *BackupVaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) } - return &id, nil + return nil } // ValidateBackupVaultID checks that 'input' can be parsed as a Backup Vault ID diff --git a/resource-manager/dataprotection/2022-04-01/backupvaults/id_providerlocation.go b/resource-manager/dataprotection/2022-04-01/backupvaults/id_providerlocation.go index a14a842db5e..ade2d54f0fc 100644 --- a/resource-manager/dataprotection/2022-04-01/backupvaults/id_providerlocation.go +++ b/resource-manager/dataprotection/2022-04-01/backupvaults/id_providerlocation.go @@ -36,19 +36,9 @@ func ParseProviderLocationID(input string) (*ProviderLocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderLocationIDInsensitively(input string) (*ProviderLocationId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderLocationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateProviderLocationID checks that 'input' can be parsed as a Provider Location ID diff --git a/resource-manager/dataprotection/2022-04-01/dppfeaturesupport/id_location.go b/resource-manager/dataprotection/2022-04-01/dppfeaturesupport/id_location.go index 0cb6ef0f695..aa04649a21d 100644 --- a/resource-manager/dataprotection/2022-04-01/dppfeaturesupport/id_location.go +++ b/resource-manager/dataprotection/2022-04-01/dppfeaturesupport/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/dataprotection/2022-04-01/findrestorabletimeranges/id_backupinstance.go b/resource-manager/dataprotection/2022-04-01/findrestorabletimeranges/id_backupinstance.go index 62067b9d558..53677a4cb15 100644 --- a/resource-manager/dataprotection/2022-04-01/findrestorabletimeranges/id_backupinstance.go +++ b/resource-manager/dataprotection/2022-04-01/findrestorabletimeranges/id_backupinstance.go @@ -38,23 +38,9 @@ func ParseBackupInstanceID(input string) (*BackupInstanceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupInstanceId{} - - 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.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) - } - - if id.BackupInstanceName, ok = parsed.Parsed["backupInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupInstanceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupInstanceIDInsensitively(input string) (*BackupInstanceId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupInstanceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) } - if id.BackupInstanceName, ok = parsed.Parsed["backupInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupInstanceName", *parsed) + if id.BackupInstanceName, ok = input.Parsed["backupInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupInstanceName", input) } - return &id, nil + return nil } // ValidateBackupInstanceID checks that 'input' can be parsed as a Backup Instance ID diff --git a/resource-manager/dataprotection/2022-04-01/recoverypoint/id_backupinstance.go b/resource-manager/dataprotection/2022-04-01/recoverypoint/id_backupinstance.go index 60c6dc61050..a80e687857a 100644 --- a/resource-manager/dataprotection/2022-04-01/recoverypoint/id_backupinstance.go +++ b/resource-manager/dataprotection/2022-04-01/recoverypoint/id_backupinstance.go @@ -38,23 +38,9 @@ func ParseBackupInstanceID(input string) (*BackupInstanceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupInstanceId{} - - 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.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) - } - - if id.BackupInstanceName, ok = parsed.Parsed["backupInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupInstanceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupInstanceIDInsensitively(input string) (*BackupInstanceId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupInstanceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) } - if id.BackupInstanceName, ok = parsed.Parsed["backupInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupInstanceName", *parsed) + if id.BackupInstanceName, ok = input.Parsed["backupInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupInstanceName", input) } - return &id, nil + return nil } // ValidateBackupInstanceID checks that 'input' can be parsed as a Backup Instance ID diff --git a/resource-manager/dataprotection/2022-04-01/recoverypoint/id_recoverypoint.go b/resource-manager/dataprotection/2022-04-01/recoverypoint/id_recoverypoint.go index 73aca8cbb07..7eb4b2133bb 100644 --- a/resource-manager/dataprotection/2022-04-01/recoverypoint/id_recoverypoint.go +++ b/resource-manager/dataprotection/2022-04-01/recoverypoint/id_recoverypoint.go @@ -40,27 +40,9 @@ func ParseRecoveryPointID(input string) (*RecoveryPointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecoveryPointId{} - - 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.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) - } - - if id.BackupInstanceName, ok = parsed.Parsed["backupInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupInstanceName", *parsed) - } - - if id.RecoveryPointId, ok = parsed.Parsed["recoveryPointId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseRecoveryPointIDInsensitively(input string) (*RecoveryPointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecoveryPointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RecoveryPointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) } - if id.BackupInstanceName, ok = parsed.Parsed["backupInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupInstanceName", *parsed) + if id.BackupInstanceName, ok = input.Parsed["backupInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupInstanceName", input) } - if id.RecoveryPointId, ok = parsed.Parsed["recoveryPointId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", *parsed) + if id.RecoveryPointId, ok = input.Parsed["recoveryPointId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", input) } - return &id, nil + return nil } // ValidateRecoveryPointID checks that 'input' can be parsed as a Recovery Point ID diff --git a/resource-manager/dataprotection/2022-04-01/resourceguards/id_deleteprotecteditemrequest.go b/resource-manager/dataprotection/2022-04-01/resourceguards/id_deleteprotecteditemrequest.go index 03c016a126d..077bf5a8c05 100644 --- a/resource-manager/dataprotection/2022-04-01/resourceguards/id_deleteprotecteditemrequest.go +++ b/resource-manager/dataprotection/2022-04-01/resourceguards/id_deleteprotecteditemrequest.go @@ -38,23 +38,9 @@ func ParseDeleteProtectedItemRequestID(input string) (*DeleteProtectedItemReques return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeleteProtectedItemRequestId{} - - 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.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", *parsed) - } - - if id.DeleteProtectedItemRequestName, ok = parsed.Parsed["deleteProtectedItemRequestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deleteProtectedItemRequestName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDeleteProtectedItemRequestIDInsensitively(input string) (*DeleteProtec return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeleteProtectedItemRequestId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DeleteProtectedItemRequestId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", *parsed) + if id.ResourceGuardName, ok = input.Parsed["resourceGuardName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", input) } - if id.DeleteProtectedItemRequestName, ok = parsed.Parsed["deleteProtectedItemRequestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deleteProtectedItemRequestName", *parsed) + if id.DeleteProtectedItemRequestName, ok = input.Parsed["deleteProtectedItemRequestName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deleteProtectedItemRequestName", input) } - return &id, nil + return nil } // ValidateDeleteProtectedItemRequestID checks that 'input' can be parsed as a Delete Protected Item Request ID diff --git a/resource-manager/dataprotection/2022-04-01/resourceguards/id_deleteresourceguardproxyrequest.go b/resource-manager/dataprotection/2022-04-01/resourceguards/id_deleteresourceguardproxyrequest.go index e622080b39e..3bdca535a6f 100644 --- a/resource-manager/dataprotection/2022-04-01/resourceguards/id_deleteresourceguardproxyrequest.go +++ b/resource-manager/dataprotection/2022-04-01/resourceguards/id_deleteresourceguardproxyrequest.go @@ -38,23 +38,9 @@ func ParseDeleteResourceGuardProxyRequestID(input string) (*DeleteResourceGuardP return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeleteResourceGuardProxyRequestId{} - - 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.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", *parsed) - } - - if id.DeleteResourceGuardProxyRequestName, ok = parsed.Parsed["deleteResourceGuardProxyRequestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deleteResourceGuardProxyRequestName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDeleteResourceGuardProxyRequestIDInsensitively(input string) (*DeleteR return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeleteResourceGuardProxyRequestId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DeleteResourceGuardProxyRequestId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", *parsed) + if id.ResourceGuardName, ok = input.Parsed["resourceGuardName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", input) } - if id.DeleteResourceGuardProxyRequestName, ok = parsed.Parsed["deleteResourceGuardProxyRequestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deleteResourceGuardProxyRequestName", *parsed) + if id.DeleteResourceGuardProxyRequestName, ok = input.Parsed["deleteResourceGuardProxyRequestName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deleteResourceGuardProxyRequestName", input) } - return &id, nil + return nil } // ValidateDeleteResourceGuardProxyRequestID checks that 'input' can be parsed as a Delete Resource Guard Proxy Request ID diff --git a/resource-manager/dataprotection/2022-04-01/resourceguards/id_disablesoftdeleterequest.go b/resource-manager/dataprotection/2022-04-01/resourceguards/id_disablesoftdeleterequest.go index cbd2f1974af..51e4b8a6126 100644 --- a/resource-manager/dataprotection/2022-04-01/resourceguards/id_disablesoftdeleterequest.go +++ b/resource-manager/dataprotection/2022-04-01/resourceguards/id_disablesoftdeleterequest.go @@ -38,23 +38,9 @@ func ParseDisableSoftDeleteRequestID(input string) (*DisableSoftDeleteRequestId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DisableSoftDeleteRequestId{} - - 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.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", *parsed) - } - - if id.DisableSoftDeleteRequestName, ok = parsed.Parsed["disableSoftDeleteRequestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "disableSoftDeleteRequestName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDisableSoftDeleteRequestIDInsensitively(input string) (*DisableSoftDel return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DisableSoftDeleteRequestId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DisableSoftDeleteRequestId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", *parsed) + if id.ResourceGuardName, ok = input.Parsed["resourceGuardName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", input) } - if id.DisableSoftDeleteRequestName, ok = parsed.Parsed["disableSoftDeleteRequestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "disableSoftDeleteRequestName", *parsed) + if id.DisableSoftDeleteRequestName, ok = input.Parsed["disableSoftDeleteRequestName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "disableSoftDeleteRequestName", input) } - return &id, nil + return nil } // ValidateDisableSoftDeleteRequestID checks that 'input' can be parsed as a Disable Soft Delete Request ID diff --git a/resource-manager/dataprotection/2022-04-01/resourceguards/id_getbackupsecuritypinrequest.go b/resource-manager/dataprotection/2022-04-01/resourceguards/id_getbackupsecuritypinrequest.go index 8af3cb7a2a0..5c057ffdbc9 100644 --- a/resource-manager/dataprotection/2022-04-01/resourceguards/id_getbackupsecuritypinrequest.go +++ b/resource-manager/dataprotection/2022-04-01/resourceguards/id_getbackupsecuritypinrequest.go @@ -38,23 +38,9 @@ func ParseGetBackupSecurityPINRequestID(input string) (*GetBackupSecurityPINRequ return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GetBackupSecurityPINRequestId{} - - 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.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", *parsed) - } - - if id.GetBackupSecurityPINRequestName, ok = parsed.Parsed["getBackupSecurityPINRequestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "getBackupSecurityPINRequestName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGetBackupSecurityPINRequestIDInsensitively(input string) (*GetBackupSe return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GetBackupSecurityPINRequestId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GetBackupSecurityPINRequestId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", *parsed) + if id.ResourceGuardName, ok = input.Parsed["resourceGuardName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", input) } - if id.GetBackupSecurityPINRequestName, ok = parsed.Parsed["getBackupSecurityPINRequestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "getBackupSecurityPINRequestName", *parsed) + if id.GetBackupSecurityPINRequestName, ok = input.Parsed["getBackupSecurityPINRequestName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "getBackupSecurityPINRequestName", input) } - return &id, nil + return nil } // ValidateGetBackupSecurityPINRequestID checks that 'input' can be parsed as a Get Backup Security P I N Request ID diff --git a/resource-manager/dataprotection/2022-04-01/resourceguards/id_resourceguard.go b/resource-manager/dataprotection/2022-04-01/resourceguards/id_resourceguard.go index c8fab0d7a99..e6e61f5477f 100644 --- a/resource-manager/dataprotection/2022-04-01/resourceguards/id_resourceguard.go +++ b/resource-manager/dataprotection/2022-04-01/resourceguards/id_resourceguard.go @@ -36,19 +36,9 @@ func ParseResourceGuardID(input string) (*ResourceGuardId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResourceGuardId{} - - 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.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseResourceGuardIDInsensitively(input string) (*ResourceGuardId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResourceGuardId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ResourceGuardId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", *parsed) + if id.ResourceGuardName, ok = input.Parsed["resourceGuardName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", input) } - return &id, nil + return nil } // ValidateResourceGuardID checks that 'input' can be parsed as a Resource Guard ID diff --git a/resource-manager/dataprotection/2022-04-01/resourceguards/id_updateprotecteditemrequest.go b/resource-manager/dataprotection/2022-04-01/resourceguards/id_updateprotecteditemrequest.go index 27b184462b6..0010cc6cb2f 100644 --- a/resource-manager/dataprotection/2022-04-01/resourceguards/id_updateprotecteditemrequest.go +++ b/resource-manager/dataprotection/2022-04-01/resourceguards/id_updateprotecteditemrequest.go @@ -38,23 +38,9 @@ func ParseUpdateProtectedItemRequestID(input string) (*UpdateProtectedItemReques return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UpdateProtectedItemRequestId{} - - 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.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", *parsed) - } - - if id.UpdateProtectedItemRequestName, ok = parsed.Parsed["updateProtectedItemRequestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "updateProtectedItemRequestName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseUpdateProtectedItemRequestIDInsensitively(input string) (*UpdateProtec return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UpdateProtectedItemRequestId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UpdateProtectedItemRequestId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", *parsed) + if id.ResourceGuardName, ok = input.Parsed["resourceGuardName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", input) } - if id.UpdateProtectedItemRequestName, ok = parsed.Parsed["updateProtectedItemRequestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "updateProtectedItemRequestName", *parsed) + if id.UpdateProtectedItemRequestName, ok = input.Parsed["updateProtectedItemRequestName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "updateProtectedItemRequestName", input) } - return &id, nil + return nil } // ValidateUpdateProtectedItemRequestID checks that 'input' can be parsed as a Update Protected Item Request ID diff --git a/resource-manager/dataprotection/2022-04-01/resourceguards/id_updateprotectionpolicyrequest.go b/resource-manager/dataprotection/2022-04-01/resourceguards/id_updateprotectionpolicyrequest.go index e6be01e67c3..3dd15fab913 100644 --- a/resource-manager/dataprotection/2022-04-01/resourceguards/id_updateprotectionpolicyrequest.go +++ b/resource-manager/dataprotection/2022-04-01/resourceguards/id_updateprotectionpolicyrequest.go @@ -38,23 +38,9 @@ func ParseUpdateProtectionPolicyRequestID(input string) (*UpdateProtectionPolicy return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UpdateProtectionPolicyRequestId{} - - 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.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", *parsed) - } - - if id.UpdateProtectionPolicyRequestName, ok = parsed.Parsed["updateProtectionPolicyRequestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "updateProtectionPolicyRequestName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseUpdateProtectionPolicyRequestIDInsensitively(input string) (*UpdatePro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UpdateProtectionPolicyRequestId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UpdateProtectionPolicyRequestId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", *parsed) + if id.ResourceGuardName, ok = input.Parsed["resourceGuardName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", input) } - if id.UpdateProtectionPolicyRequestName, ok = parsed.Parsed["updateProtectionPolicyRequestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "updateProtectionPolicyRequestName", *parsed) + if id.UpdateProtectionPolicyRequestName, ok = input.Parsed["updateProtectionPolicyRequestName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "updateProtectionPolicyRequestName", input) } - return &id, nil + return nil } // ValidateUpdateProtectionPolicyRequestID checks that 'input' can be parsed as a Update Protection Policy Request ID diff --git a/resource-manager/dataprotection/2023-05-01/azurebackupjob/id_backupjob.go b/resource-manager/dataprotection/2023-05-01/azurebackupjob/id_backupjob.go index a769a90c13d..8b7ca0eeb92 100644 --- a/resource-manager/dataprotection/2023-05-01/azurebackupjob/id_backupjob.go +++ b/resource-manager/dataprotection/2023-05-01/azurebackupjob/id_backupjob.go @@ -38,23 +38,9 @@ func ParseBackupJobID(input string) (*BackupJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupJobId{} - - 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.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) - } - - if id.JobId, ok = parsed.Parsed["jobId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupJobIDInsensitively(input string) (*BackupJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupJobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupJobId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) } - if id.JobId, ok = parsed.Parsed["jobId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobId", *parsed) + if id.JobId, ok = input.Parsed["jobId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobId", input) } - return &id, nil + return nil } // ValidateBackupJobID checks that 'input' can be parsed as a Backup Job ID diff --git a/resource-manager/dataprotection/2023-05-01/azurebackupjob/id_backupvault.go b/resource-manager/dataprotection/2023-05-01/azurebackupjob/id_backupvault.go index 01ffa4d4b32..963509b4166 100644 --- a/resource-manager/dataprotection/2023-05-01/azurebackupjob/id_backupvault.go +++ b/resource-manager/dataprotection/2023-05-01/azurebackupjob/id_backupvault.go @@ -36,19 +36,9 @@ func ParseBackupVaultID(input string) (*BackupVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupVaultId{} - - 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.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseBackupVaultIDInsensitively(input string) (*BackupVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupVaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *BackupVaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) } - return &id, nil + return nil } // ValidateBackupVaultID checks that 'input' can be parsed as a Backup Vault ID diff --git a/resource-manager/dataprotection/2023-05-01/azurebackupjob/id_operationid.go b/resource-manager/dataprotection/2023-05-01/azurebackupjob/id_operationid.go index 7eb3dd07d59..72e196b0385 100644 --- a/resource-manager/dataprotection/2023-05-01/azurebackupjob/id_operationid.go +++ b/resource-manager/dataprotection/2023-05-01/azurebackupjob/id_operationid.go @@ -38,23 +38,9 @@ func ParseOperationIdID(input string) (*OperationIdId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationIdId{} - - 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.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) - } - - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseOperationIdIDInsensitively(input string) (*OperationIdId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationIdId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OperationIdId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) } - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if id.OperationId, ok = input.Parsed["operationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "operationId", input) } - return &id, nil + return nil } // ValidateOperationIdID checks that 'input' can be parsed as a Operation Id ID diff --git a/resource-manager/dataprotection/2023-05-01/azurebackupjobs/id_backupvault.go b/resource-manager/dataprotection/2023-05-01/azurebackupjobs/id_backupvault.go index 848e8c492b4..1e8b4932b4c 100644 --- a/resource-manager/dataprotection/2023-05-01/azurebackupjobs/id_backupvault.go +++ b/resource-manager/dataprotection/2023-05-01/azurebackupjobs/id_backupvault.go @@ -36,19 +36,9 @@ func ParseBackupVaultID(input string) (*BackupVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupVaultId{} - - 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.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseBackupVaultIDInsensitively(input string) (*BackupVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupVaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *BackupVaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) } - return &id, nil + return nil } // ValidateBackupVaultID checks that 'input' can be parsed as a Backup Vault ID diff --git a/resource-manager/dataprotection/2023-05-01/backupinstances/id_backupinstance.go b/resource-manager/dataprotection/2023-05-01/backupinstances/id_backupinstance.go index c4cac4c1166..2ed30ac3214 100644 --- a/resource-manager/dataprotection/2023-05-01/backupinstances/id_backupinstance.go +++ b/resource-manager/dataprotection/2023-05-01/backupinstances/id_backupinstance.go @@ -38,23 +38,9 @@ func ParseBackupInstanceID(input string) (*BackupInstanceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupInstanceId{} - - 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.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) - } - - if id.BackupInstanceName, ok = parsed.Parsed["backupInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupInstanceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupInstanceIDInsensitively(input string) (*BackupInstanceId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupInstanceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) } - if id.BackupInstanceName, ok = parsed.Parsed["backupInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupInstanceName", *parsed) + if id.BackupInstanceName, ok = input.Parsed["backupInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupInstanceName", input) } - return &id, nil + return nil } // ValidateBackupInstanceID checks that 'input' can be parsed as a Backup Instance ID diff --git a/resource-manager/dataprotection/2023-05-01/backupinstances/id_backupvault.go b/resource-manager/dataprotection/2023-05-01/backupinstances/id_backupvault.go index 8c5066717df..51e9b47f9af 100644 --- a/resource-manager/dataprotection/2023-05-01/backupinstances/id_backupvault.go +++ b/resource-manager/dataprotection/2023-05-01/backupinstances/id_backupvault.go @@ -36,19 +36,9 @@ func ParseBackupVaultID(input string) (*BackupVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupVaultId{} - - 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.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseBackupVaultIDInsensitively(input string) (*BackupVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupVaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *BackupVaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) } - return &id, nil + return nil } // ValidateBackupVaultID checks that 'input' can be parsed as a Backup Vault ID diff --git a/resource-manager/dataprotection/2023-05-01/backuppolicies/id_backuppolicy.go b/resource-manager/dataprotection/2023-05-01/backuppolicies/id_backuppolicy.go index ffa3a9a836f..8403e90a879 100644 --- a/resource-manager/dataprotection/2023-05-01/backuppolicies/id_backuppolicy.go +++ b/resource-manager/dataprotection/2023-05-01/backuppolicies/id_backuppolicy.go @@ -38,23 +38,9 @@ func ParseBackupPolicyID(input string) (*BackupPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupPolicyId{} - - 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.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) - } - - if id.BackupPolicyName, ok = parsed.Parsed["backupPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupPolicyIDInsensitively(input string) (*BackupPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) } - if id.BackupPolicyName, ok = parsed.Parsed["backupPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupPolicyName", *parsed) + if id.BackupPolicyName, ok = input.Parsed["backupPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupPolicyName", input) } - return &id, nil + return nil } // ValidateBackupPolicyID checks that 'input' can be parsed as a Backup Policy ID diff --git a/resource-manager/dataprotection/2023-05-01/backuppolicies/id_backupvault.go b/resource-manager/dataprotection/2023-05-01/backuppolicies/id_backupvault.go index 34bc1350ce4..de03baab418 100644 --- a/resource-manager/dataprotection/2023-05-01/backuppolicies/id_backupvault.go +++ b/resource-manager/dataprotection/2023-05-01/backuppolicies/id_backupvault.go @@ -36,19 +36,9 @@ func ParseBackupVaultID(input string) (*BackupVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupVaultId{} - - 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.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseBackupVaultIDInsensitively(input string) (*BackupVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupVaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *BackupVaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) } - return &id, nil + return nil } // ValidateBackupVaultID checks that 'input' can be parsed as a Backup Vault ID diff --git a/resource-manager/dataprotection/2023-05-01/backupvaults/id_backupvault.go b/resource-manager/dataprotection/2023-05-01/backupvaults/id_backupvault.go index 9f16ee084a4..b2cb37557bf 100644 --- a/resource-manager/dataprotection/2023-05-01/backupvaults/id_backupvault.go +++ b/resource-manager/dataprotection/2023-05-01/backupvaults/id_backupvault.go @@ -36,19 +36,9 @@ func ParseBackupVaultID(input string) (*BackupVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupVaultId{} - - 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.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseBackupVaultIDInsensitively(input string) (*BackupVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupVaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *BackupVaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) } - return &id, nil + return nil } // ValidateBackupVaultID checks that 'input' can be parsed as a Backup Vault ID diff --git a/resource-manager/dataprotection/2023-05-01/backupvaults/id_providerlocation.go b/resource-manager/dataprotection/2023-05-01/backupvaults/id_providerlocation.go index a14a842db5e..ade2d54f0fc 100644 --- a/resource-manager/dataprotection/2023-05-01/backupvaults/id_providerlocation.go +++ b/resource-manager/dataprotection/2023-05-01/backupvaults/id_providerlocation.go @@ -36,19 +36,9 @@ func ParseProviderLocationID(input string) (*ProviderLocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderLocationIDInsensitively(input string) (*ProviderLocationId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderLocationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateProviderLocationID checks that 'input' can be parsed as a Provider Location ID diff --git a/resource-manager/dataprotection/2023-05-01/deletedbackupinstances/id_backupvault.go b/resource-manager/dataprotection/2023-05-01/deletedbackupinstances/id_backupvault.go index 36398402e43..950f77c00b8 100644 --- a/resource-manager/dataprotection/2023-05-01/deletedbackupinstances/id_backupvault.go +++ b/resource-manager/dataprotection/2023-05-01/deletedbackupinstances/id_backupvault.go @@ -36,19 +36,9 @@ func ParseBackupVaultID(input string) (*BackupVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupVaultId{} - - 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.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseBackupVaultIDInsensitively(input string) (*BackupVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupVaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *BackupVaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) } - return &id, nil + return nil } // ValidateBackupVaultID checks that 'input' can be parsed as a Backup Vault ID diff --git a/resource-manager/dataprotection/2023-05-01/deletedbackupinstances/id_deletedbackupinstance.go b/resource-manager/dataprotection/2023-05-01/deletedbackupinstances/id_deletedbackupinstance.go index 4e813ded437..2effdb1d047 100644 --- a/resource-manager/dataprotection/2023-05-01/deletedbackupinstances/id_deletedbackupinstance.go +++ b/resource-manager/dataprotection/2023-05-01/deletedbackupinstances/id_deletedbackupinstance.go @@ -38,23 +38,9 @@ func ParseDeletedBackupInstanceID(input string) (*DeletedBackupInstanceId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeletedBackupInstanceId{} - - 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.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) - } - - if id.DeletedBackupInstanceName, ok = parsed.Parsed["deletedBackupInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedBackupInstanceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDeletedBackupInstanceIDInsensitively(input string) (*DeletedBackupInst return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeletedBackupInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DeletedBackupInstanceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) } - if id.DeletedBackupInstanceName, ok = parsed.Parsed["deletedBackupInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedBackupInstanceName", *parsed) + if id.DeletedBackupInstanceName, ok = input.Parsed["deletedBackupInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deletedBackupInstanceName", input) } - return &id, nil + return nil } // ValidateDeletedBackupInstanceID checks that 'input' can be parsed as a Deleted Backup Instance ID diff --git a/resource-manager/dataprotection/2023-05-01/dppfeaturesupport/id_location.go b/resource-manager/dataprotection/2023-05-01/dppfeaturesupport/id_location.go index 0cb6ef0f695..aa04649a21d 100644 --- a/resource-manager/dataprotection/2023-05-01/dppfeaturesupport/id_location.go +++ b/resource-manager/dataprotection/2023-05-01/dppfeaturesupport/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/dataprotection/2023-05-01/dppresourceguardproxies/id_backupresourceguardproxy.go b/resource-manager/dataprotection/2023-05-01/dppresourceguardproxies/id_backupresourceguardproxy.go index bcca6c3f1e7..731225b9808 100644 --- a/resource-manager/dataprotection/2023-05-01/dppresourceguardproxies/id_backupresourceguardproxy.go +++ b/resource-manager/dataprotection/2023-05-01/dppresourceguardproxies/id_backupresourceguardproxy.go @@ -38,23 +38,9 @@ func ParseBackupResourceGuardProxyID(input string) (*BackupResourceGuardProxyId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupResourceGuardProxyId{} - - 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.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) - } - - if id.BackupResourceGuardProxyName, ok = parsed.Parsed["backupResourceGuardProxyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupResourceGuardProxyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupResourceGuardProxyIDInsensitively(input string) (*BackupResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupResourceGuardProxyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupResourceGuardProxyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) } - if id.BackupResourceGuardProxyName, ok = parsed.Parsed["backupResourceGuardProxyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupResourceGuardProxyName", *parsed) + if id.BackupResourceGuardProxyName, ok = input.Parsed["backupResourceGuardProxyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupResourceGuardProxyName", input) } - return &id, nil + return nil } // ValidateBackupResourceGuardProxyID checks that 'input' can be parsed as a Backup Resource Guard Proxy ID diff --git a/resource-manager/dataprotection/2023-05-01/dppresourceguardproxies/id_backupvault.go b/resource-manager/dataprotection/2023-05-01/dppresourceguardproxies/id_backupvault.go index b48a97bf839..fa090742191 100644 --- a/resource-manager/dataprotection/2023-05-01/dppresourceguardproxies/id_backupvault.go +++ b/resource-manager/dataprotection/2023-05-01/dppresourceguardproxies/id_backupvault.go @@ -36,19 +36,9 @@ func ParseBackupVaultID(input string) (*BackupVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupVaultId{} - - 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.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseBackupVaultIDInsensitively(input string) (*BackupVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupVaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *BackupVaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) } - return &id, nil + return nil } // ValidateBackupVaultID checks that 'input' can be parsed as a Backup Vault ID diff --git a/resource-manager/dataprotection/2023-05-01/findrestorabletimeranges/id_backupinstance.go b/resource-manager/dataprotection/2023-05-01/findrestorabletimeranges/id_backupinstance.go index 62067b9d558..53677a4cb15 100644 --- a/resource-manager/dataprotection/2023-05-01/findrestorabletimeranges/id_backupinstance.go +++ b/resource-manager/dataprotection/2023-05-01/findrestorabletimeranges/id_backupinstance.go @@ -38,23 +38,9 @@ func ParseBackupInstanceID(input string) (*BackupInstanceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupInstanceId{} - - 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.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) - } - - if id.BackupInstanceName, ok = parsed.Parsed["backupInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupInstanceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupInstanceIDInsensitively(input string) (*BackupInstanceId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupInstanceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) } - if id.BackupInstanceName, ok = parsed.Parsed["backupInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupInstanceName", *parsed) + if id.BackupInstanceName, ok = input.Parsed["backupInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupInstanceName", input) } - return &id, nil + return nil } // ValidateBackupInstanceID checks that 'input' can be parsed as a Backup Instance ID diff --git a/resource-manager/dataprotection/2023-05-01/recoverypoint/id_backupinstance.go b/resource-manager/dataprotection/2023-05-01/recoverypoint/id_backupinstance.go index 60c6dc61050..a80e687857a 100644 --- a/resource-manager/dataprotection/2023-05-01/recoverypoint/id_backupinstance.go +++ b/resource-manager/dataprotection/2023-05-01/recoverypoint/id_backupinstance.go @@ -38,23 +38,9 @@ func ParseBackupInstanceID(input string) (*BackupInstanceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupInstanceId{} - - 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.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) - } - - if id.BackupInstanceName, ok = parsed.Parsed["backupInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupInstanceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupInstanceIDInsensitively(input string) (*BackupInstanceId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupInstanceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) } - if id.BackupInstanceName, ok = parsed.Parsed["backupInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupInstanceName", *parsed) + if id.BackupInstanceName, ok = input.Parsed["backupInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupInstanceName", input) } - return &id, nil + return nil } // ValidateBackupInstanceID checks that 'input' can be parsed as a Backup Instance ID diff --git a/resource-manager/dataprotection/2023-05-01/recoverypoint/id_recoverypoint.go b/resource-manager/dataprotection/2023-05-01/recoverypoint/id_recoverypoint.go index 73aca8cbb07..7eb4b2133bb 100644 --- a/resource-manager/dataprotection/2023-05-01/recoverypoint/id_recoverypoint.go +++ b/resource-manager/dataprotection/2023-05-01/recoverypoint/id_recoverypoint.go @@ -40,27 +40,9 @@ func ParseRecoveryPointID(input string) (*RecoveryPointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecoveryPointId{} - - 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.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) - } - - if id.BackupInstanceName, ok = parsed.Parsed["backupInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupInstanceName", *parsed) - } - - if id.RecoveryPointId, ok = parsed.Parsed["recoveryPointId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseRecoveryPointIDInsensitively(input string) (*RecoveryPointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecoveryPointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RecoveryPointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) } - if id.BackupInstanceName, ok = parsed.Parsed["backupInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupInstanceName", *parsed) + if id.BackupInstanceName, ok = input.Parsed["backupInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupInstanceName", input) } - if id.RecoveryPointId, ok = parsed.Parsed["recoveryPointId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", *parsed) + if id.RecoveryPointId, ok = input.Parsed["recoveryPointId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", input) } - return &id, nil + return nil } // ValidateRecoveryPointID checks that 'input' can be parsed as a Recovery Point ID diff --git a/resource-manager/dataprotection/2023-05-01/resourceguards/id_deleteprotecteditemrequest.go b/resource-manager/dataprotection/2023-05-01/resourceguards/id_deleteprotecteditemrequest.go index 03c016a126d..077bf5a8c05 100644 --- a/resource-manager/dataprotection/2023-05-01/resourceguards/id_deleteprotecteditemrequest.go +++ b/resource-manager/dataprotection/2023-05-01/resourceguards/id_deleteprotecteditemrequest.go @@ -38,23 +38,9 @@ func ParseDeleteProtectedItemRequestID(input string) (*DeleteProtectedItemReques return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeleteProtectedItemRequestId{} - - 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.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", *parsed) - } - - if id.DeleteProtectedItemRequestName, ok = parsed.Parsed["deleteProtectedItemRequestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deleteProtectedItemRequestName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDeleteProtectedItemRequestIDInsensitively(input string) (*DeleteProtec return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeleteProtectedItemRequestId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DeleteProtectedItemRequestId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", *parsed) + if id.ResourceGuardName, ok = input.Parsed["resourceGuardName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", input) } - if id.DeleteProtectedItemRequestName, ok = parsed.Parsed["deleteProtectedItemRequestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deleteProtectedItemRequestName", *parsed) + if id.DeleteProtectedItemRequestName, ok = input.Parsed["deleteProtectedItemRequestName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deleteProtectedItemRequestName", input) } - return &id, nil + return nil } // ValidateDeleteProtectedItemRequestID checks that 'input' can be parsed as a Delete Protected Item Request ID diff --git a/resource-manager/dataprotection/2023-05-01/resourceguards/id_deleteresourceguardproxyrequest.go b/resource-manager/dataprotection/2023-05-01/resourceguards/id_deleteresourceguardproxyrequest.go index e622080b39e..3bdca535a6f 100644 --- a/resource-manager/dataprotection/2023-05-01/resourceguards/id_deleteresourceguardproxyrequest.go +++ b/resource-manager/dataprotection/2023-05-01/resourceguards/id_deleteresourceguardproxyrequest.go @@ -38,23 +38,9 @@ func ParseDeleteResourceGuardProxyRequestID(input string) (*DeleteResourceGuardP return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeleteResourceGuardProxyRequestId{} - - 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.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", *parsed) - } - - if id.DeleteResourceGuardProxyRequestName, ok = parsed.Parsed["deleteResourceGuardProxyRequestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deleteResourceGuardProxyRequestName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDeleteResourceGuardProxyRequestIDInsensitively(input string) (*DeleteR return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeleteResourceGuardProxyRequestId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DeleteResourceGuardProxyRequestId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", *parsed) + if id.ResourceGuardName, ok = input.Parsed["resourceGuardName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", input) } - if id.DeleteResourceGuardProxyRequestName, ok = parsed.Parsed["deleteResourceGuardProxyRequestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deleteResourceGuardProxyRequestName", *parsed) + if id.DeleteResourceGuardProxyRequestName, ok = input.Parsed["deleteResourceGuardProxyRequestName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deleteResourceGuardProxyRequestName", input) } - return &id, nil + return nil } // ValidateDeleteResourceGuardProxyRequestID checks that 'input' can be parsed as a Delete Resource Guard Proxy Request ID diff --git a/resource-manager/dataprotection/2023-05-01/resourceguards/id_disablesoftdeleterequest.go b/resource-manager/dataprotection/2023-05-01/resourceguards/id_disablesoftdeleterequest.go index cbd2f1974af..51e4b8a6126 100644 --- a/resource-manager/dataprotection/2023-05-01/resourceguards/id_disablesoftdeleterequest.go +++ b/resource-manager/dataprotection/2023-05-01/resourceguards/id_disablesoftdeleterequest.go @@ -38,23 +38,9 @@ func ParseDisableSoftDeleteRequestID(input string) (*DisableSoftDeleteRequestId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DisableSoftDeleteRequestId{} - - 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.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", *parsed) - } - - if id.DisableSoftDeleteRequestName, ok = parsed.Parsed["disableSoftDeleteRequestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "disableSoftDeleteRequestName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDisableSoftDeleteRequestIDInsensitively(input string) (*DisableSoftDel return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DisableSoftDeleteRequestId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DisableSoftDeleteRequestId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", *parsed) + if id.ResourceGuardName, ok = input.Parsed["resourceGuardName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", input) } - if id.DisableSoftDeleteRequestName, ok = parsed.Parsed["disableSoftDeleteRequestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "disableSoftDeleteRequestName", *parsed) + if id.DisableSoftDeleteRequestName, ok = input.Parsed["disableSoftDeleteRequestName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "disableSoftDeleteRequestName", input) } - return &id, nil + return nil } // ValidateDisableSoftDeleteRequestID checks that 'input' can be parsed as a Disable Soft Delete Request ID diff --git a/resource-manager/dataprotection/2023-05-01/resourceguards/id_getbackupsecuritypinrequest.go b/resource-manager/dataprotection/2023-05-01/resourceguards/id_getbackupsecuritypinrequest.go index 8af3cb7a2a0..5c057ffdbc9 100644 --- a/resource-manager/dataprotection/2023-05-01/resourceguards/id_getbackupsecuritypinrequest.go +++ b/resource-manager/dataprotection/2023-05-01/resourceguards/id_getbackupsecuritypinrequest.go @@ -38,23 +38,9 @@ func ParseGetBackupSecurityPINRequestID(input string) (*GetBackupSecurityPINRequ return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GetBackupSecurityPINRequestId{} - - 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.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", *parsed) - } - - if id.GetBackupSecurityPINRequestName, ok = parsed.Parsed["getBackupSecurityPINRequestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "getBackupSecurityPINRequestName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGetBackupSecurityPINRequestIDInsensitively(input string) (*GetBackupSe return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GetBackupSecurityPINRequestId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GetBackupSecurityPINRequestId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", *parsed) + if id.ResourceGuardName, ok = input.Parsed["resourceGuardName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", input) } - if id.GetBackupSecurityPINRequestName, ok = parsed.Parsed["getBackupSecurityPINRequestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "getBackupSecurityPINRequestName", *parsed) + if id.GetBackupSecurityPINRequestName, ok = input.Parsed["getBackupSecurityPINRequestName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "getBackupSecurityPINRequestName", input) } - return &id, nil + return nil } // ValidateGetBackupSecurityPINRequestID checks that 'input' can be parsed as a Get Backup Security P I N Request ID diff --git a/resource-manager/dataprotection/2023-05-01/resourceguards/id_resourceguard.go b/resource-manager/dataprotection/2023-05-01/resourceguards/id_resourceguard.go index c8fab0d7a99..e6e61f5477f 100644 --- a/resource-manager/dataprotection/2023-05-01/resourceguards/id_resourceguard.go +++ b/resource-manager/dataprotection/2023-05-01/resourceguards/id_resourceguard.go @@ -36,19 +36,9 @@ func ParseResourceGuardID(input string) (*ResourceGuardId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResourceGuardId{} - - 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.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseResourceGuardIDInsensitively(input string) (*ResourceGuardId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResourceGuardId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ResourceGuardId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", *parsed) + if id.ResourceGuardName, ok = input.Parsed["resourceGuardName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", input) } - return &id, nil + return nil } // ValidateResourceGuardID checks that 'input' can be parsed as a Resource Guard ID diff --git a/resource-manager/dataprotection/2023-05-01/resourceguards/id_updateprotecteditemrequest.go b/resource-manager/dataprotection/2023-05-01/resourceguards/id_updateprotecteditemrequest.go index 27b184462b6..0010cc6cb2f 100644 --- a/resource-manager/dataprotection/2023-05-01/resourceguards/id_updateprotecteditemrequest.go +++ b/resource-manager/dataprotection/2023-05-01/resourceguards/id_updateprotecteditemrequest.go @@ -38,23 +38,9 @@ func ParseUpdateProtectedItemRequestID(input string) (*UpdateProtectedItemReques return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UpdateProtectedItemRequestId{} - - 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.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", *parsed) - } - - if id.UpdateProtectedItemRequestName, ok = parsed.Parsed["updateProtectedItemRequestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "updateProtectedItemRequestName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseUpdateProtectedItemRequestIDInsensitively(input string) (*UpdateProtec return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UpdateProtectedItemRequestId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UpdateProtectedItemRequestId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", *parsed) + if id.ResourceGuardName, ok = input.Parsed["resourceGuardName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", input) } - if id.UpdateProtectedItemRequestName, ok = parsed.Parsed["updateProtectedItemRequestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "updateProtectedItemRequestName", *parsed) + if id.UpdateProtectedItemRequestName, ok = input.Parsed["updateProtectedItemRequestName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "updateProtectedItemRequestName", input) } - return &id, nil + return nil } // ValidateUpdateProtectedItemRequestID checks that 'input' can be parsed as a Update Protected Item Request ID diff --git a/resource-manager/dataprotection/2023-05-01/resourceguards/id_updateprotectionpolicyrequest.go b/resource-manager/dataprotection/2023-05-01/resourceguards/id_updateprotectionpolicyrequest.go index e6be01e67c3..3dd15fab913 100644 --- a/resource-manager/dataprotection/2023-05-01/resourceguards/id_updateprotectionpolicyrequest.go +++ b/resource-manager/dataprotection/2023-05-01/resourceguards/id_updateprotectionpolicyrequest.go @@ -38,23 +38,9 @@ func ParseUpdateProtectionPolicyRequestID(input string) (*UpdateProtectionPolicy return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UpdateProtectionPolicyRequestId{} - - 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.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", *parsed) - } - - if id.UpdateProtectionPolicyRequestName, ok = parsed.Parsed["updateProtectionPolicyRequestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "updateProtectionPolicyRequestName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseUpdateProtectionPolicyRequestIDInsensitively(input string) (*UpdatePro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UpdateProtectionPolicyRequestId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UpdateProtectionPolicyRequestId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", *parsed) + if id.ResourceGuardName, ok = input.Parsed["resourceGuardName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", input) } - if id.UpdateProtectionPolicyRequestName, ok = parsed.Parsed["updateProtectionPolicyRequestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "updateProtectionPolicyRequestName", *parsed) + if id.UpdateProtectionPolicyRequestName, ok = input.Parsed["updateProtectionPolicyRequestName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "updateProtectionPolicyRequestName", input) } - return &id, nil + return nil } // ValidateUpdateProtectionPolicyRequestID checks that 'input' can be parsed as a Update Protection Policy Request ID diff --git a/resource-manager/dataprotection/2023-08-01/azurebackupjob/id_backupjob.go b/resource-manager/dataprotection/2023-08-01/azurebackupjob/id_backupjob.go index a769a90c13d..8b7ca0eeb92 100644 --- a/resource-manager/dataprotection/2023-08-01/azurebackupjob/id_backupjob.go +++ b/resource-manager/dataprotection/2023-08-01/azurebackupjob/id_backupjob.go @@ -38,23 +38,9 @@ func ParseBackupJobID(input string) (*BackupJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupJobId{} - - 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.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) - } - - if id.JobId, ok = parsed.Parsed["jobId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupJobIDInsensitively(input string) (*BackupJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupJobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupJobId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) } - if id.JobId, ok = parsed.Parsed["jobId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobId", *parsed) + if id.JobId, ok = input.Parsed["jobId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobId", input) } - return &id, nil + return nil } // ValidateBackupJobID checks that 'input' can be parsed as a Backup Job ID diff --git a/resource-manager/dataprotection/2023-08-01/azurebackupjob/id_backupvault.go b/resource-manager/dataprotection/2023-08-01/azurebackupjob/id_backupvault.go index 01ffa4d4b32..963509b4166 100644 --- a/resource-manager/dataprotection/2023-08-01/azurebackupjob/id_backupvault.go +++ b/resource-manager/dataprotection/2023-08-01/azurebackupjob/id_backupvault.go @@ -36,19 +36,9 @@ func ParseBackupVaultID(input string) (*BackupVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupVaultId{} - - 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.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseBackupVaultIDInsensitively(input string) (*BackupVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupVaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *BackupVaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) } - return &id, nil + return nil } // ValidateBackupVaultID checks that 'input' can be parsed as a Backup Vault ID diff --git a/resource-manager/dataprotection/2023-08-01/azurebackupjob/id_operationid.go b/resource-manager/dataprotection/2023-08-01/azurebackupjob/id_operationid.go index 7eb3dd07d59..72e196b0385 100644 --- a/resource-manager/dataprotection/2023-08-01/azurebackupjob/id_operationid.go +++ b/resource-manager/dataprotection/2023-08-01/azurebackupjob/id_operationid.go @@ -38,23 +38,9 @@ func ParseOperationIdID(input string) (*OperationIdId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationIdId{} - - 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.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) - } - - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseOperationIdIDInsensitively(input string) (*OperationIdId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationIdId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OperationIdId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) } - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if id.OperationId, ok = input.Parsed["operationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "operationId", input) } - return &id, nil + return nil } // ValidateOperationIdID checks that 'input' can be parsed as a Operation Id ID diff --git a/resource-manager/dataprotection/2023-08-01/azurebackupjobs/id_backupvault.go b/resource-manager/dataprotection/2023-08-01/azurebackupjobs/id_backupvault.go index 848e8c492b4..1e8b4932b4c 100644 --- a/resource-manager/dataprotection/2023-08-01/azurebackupjobs/id_backupvault.go +++ b/resource-manager/dataprotection/2023-08-01/azurebackupjobs/id_backupvault.go @@ -36,19 +36,9 @@ func ParseBackupVaultID(input string) (*BackupVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupVaultId{} - - 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.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseBackupVaultIDInsensitively(input string) (*BackupVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupVaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *BackupVaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) } - return &id, nil + return nil } // ValidateBackupVaultID checks that 'input' can be parsed as a Backup Vault ID diff --git a/resource-manager/dataprotection/2023-08-01/backupinstances/id_backupinstance.go b/resource-manager/dataprotection/2023-08-01/backupinstances/id_backupinstance.go index c4cac4c1166..2ed30ac3214 100644 --- a/resource-manager/dataprotection/2023-08-01/backupinstances/id_backupinstance.go +++ b/resource-manager/dataprotection/2023-08-01/backupinstances/id_backupinstance.go @@ -38,23 +38,9 @@ func ParseBackupInstanceID(input string) (*BackupInstanceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupInstanceId{} - - 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.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) - } - - if id.BackupInstanceName, ok = parsed.Parsed["backupInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupInstanceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupInstanceIDInsensitively(input string) (*BackupInstanceId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupInstanceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) } - if id.BackupInstanceName, ok = parsed.Parsed["backupInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupInstanceName", *parsed) + if id.BackupInstanceName, ok = input.Parsed["backupInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupInstanceName", input) } - return &id, nil + return nil } // ValidateBackupInstanceID checks that 'input' can be parsed as a Backup Instance ID diff --git a/resource-manager/dataprotection/2023-08-01/backupinstances/id_backupvault.go b/resource-manager/dataprotection/2023-08-01/backupinstances/id_backupvault.go index 8c5066717df..51e9b47f9af 100644 --- a/resource-manager/dataprotection/2023-08-01/backupinstances/id_backupvault.go +++ b/resource-manager/dataprotection/2023-08-01/backupinstances/id_backupvault.go @@ -36,19 +36,9 @@ func ParseBackupVaultID(input string) (*BackupVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupVaultId{} - - 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.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseBackupVaultIDInsensitively(input string) (*BackupVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupVaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *BackupVaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) } - return &id, nil + return nil } // ValidateBackupVaultID checks that 'input' can be parsed as a Backup Vault ID diff --git a/resource-manager/dataprotection/2023-08-01/backuppolicies/id_backuppolicy.go b/resource-manager/dataprotection/2023-08-01/backuppolicies/id_backuppolicy.go index ffa3a9a836f..8403e90a879 100644 --- a/resource-manager/dataprotection/2023-08-01/backuppolicies/id_backuppolicy.go +++ b/resource-manager/dataprotection/2023-08-01/backuppolicies/id_backuppolicy.go @@ -38,23 +38,9 @@ func ParseBackupPolicyID(input string) (*BackupPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupPolicyId{} - - 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.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) - } - - if id.BackupPolicyName, ok = parsed.Parsed["backupPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupPolicyIDInsensitively(input string) (*BackupPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) } - if id.BackupPolicyName, ok = parsed.Parsed["backupPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupPolicyName", *parsed) + if id.BackupPolicyName, ok = input.Parsed["backupPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupPolicyName", input) } - return &id, nil + return nil } // ValidateBackupPolicyID checks that 'input' can be parsed as a Backup Policy ID diff --git a/resource-manager/dataprotection/2023-08-01/backuppolicies/id_backupvault.go b/resource-manager/dataprotection/2023-08-01/backuppolicies/id_backupvault.go index 34bc1350ce4..de03baab418 100644 --- a/resource-manager/dataprotection/2023-08-01/backuppolicies/id_backupvault.go +++ b/resource-manager/dataprotection/2023-08-01/backuppolicies/id_backupvault.go @@ -36,19 +36,9 @@ func ParseBackupVaultID(input string) (*BackupVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupVaultId{} - - 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.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseBackupVaultIDInsensitively(input string) (*BackupVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupVaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *BackupVaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) } - return &id, nil + return nil } // ValidateBackupVaultID checks that 'input' can be parsed as a Backup Vault ID diff --git a/resource-manager/dataprotection/2023-08-01/backupvaults/id_backupvault.go b/resource-manager/dataprotection/2023-08-01/backupvaults/id_backupvault.go index 9f16ee084a4..b2cb37557bf 100644 --- a/resource-manager/dataprotection/2023-08-01/backupvaults/id_backupvault.go +++ b/resource-manager/dataprotection/2023-08-01/backupvaults/id_backupvault.go @@ -36,19 +36,9 @@ func ParseBackupVaultID(input string) (*BackupVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupVaultId{} - - 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.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseBackupVaultIDInsensitively(input string) (*BackupVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupVaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *BackupVaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) } - return &id, nil + return nil } // ValidateBackupVaultID checks that 'input' can be parsed as a Backup Vault ID diff --git a/resource-manager/dataprotection/2023-08-01/backupvaults/id_providerlocation.go b/resource-manager/dataprotection/2023-08-01/backupvaults/id_providerlocation.go index a14a842db5e..ade2d54f0fc 100644 --- a/resource-manager/dataprotection/2023-08-01/backupvaults/id_providerlocation.go +++ b/resource-manager/dataprotection/2023-08-01/backupvaults/id_providerlocation.go @@ -36,19 +36,9 @@ func ParseProviderLocationID(input string) (*ProviderLocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderLocationIDInsensitively(input string) (*ProviderLocationId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderLocationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateProviderLocationID checks that 'input' can be parsed as a Provider Location ID diff --git a/resource-manager/dataprotection/2023-08-01/deletedbackupinstances/id_backupvault.go b/resource-manager/dataprotection/2023-08-01/deletedbackupinstances/id_backupvault.go index 36398402e43..950f77c00b8 100644 --- a/resource-manager/dataprotection/2023-08-01/deletedbackupinstances/id_backupvault.go +++ b/resource-manager/dataprotection/2023-08-01/deletedbackupinstances/id_backupvault.go @@ -36,19 +36,9 @@ func ParseBackupVaultID(input string) (*BackupVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupVaultId{} - - 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.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseBackupVaultIDInsensitively(input string) (*BackupVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupVaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *BackupVaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) } - return &id, nil + return nil } // ValidateBackupVaultID checks that 'input' can be parsed as a Backup Vault ID diff --git a/resource-manager/dataprotection/2023-08-01/deletedbackupinstances/id_deletedbackupinstance.go b/resource-manager/dataprotection/2023-08-01/deletedbackupinstances/id_deletedbackupinstance.go index 4e813ded437..2effdb1d047 100644 --- a/resource-manager/dataprotection/2023-08-01/deletedbackupinstances/id_deletedbackupinstance.go +++ b/resource-manager/dataprotection/2023-08-01/deletedbackupinstances/id_deletedbackupinstance.go @@ -38,23 +38,9 @@ func ParseDeletedBackupInstanceID(input string) (*DeletedBackupInstanceId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeletedBackupInstanceId{} - - 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.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) - } - - if id.DeletedBackupInstanceName, ok = parsed.Parsed["deletedBackupInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedBackupInstanceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDeletedBackupInstanceIDInsensitively(input string) (*DeletedBackupInst return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeletedBackupInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DeletedBackupInstanceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) } - if id.DeletedBackupInstanceName, ok = parsed.Parsed["deletedBackupInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedBackupInstanceName", *parsed) + if id.DeletedBackupInstanceName, ok = input.Parsed["deletedBackupInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deletedBackupInstanceName", input) } - return &id, nil + return nil } // ValidateDeletedBackupInstanceID checks that 'input' can be parsed as a Deleted Backup Instance ID diff --git a/resource-manager/dataprotection/2023-08-01/dppfeaturesupport/id_location.go b/resource-manager/dataprotection/2023-08-01/dppfeaturesupport/id_location.go index 0cb6ef0f695..aa04649a21d 100644 --- a/resource-manager/dataprotection/2023-08-01/dppfeaturesupport/id_location.go +++ b/resource-manager/dataprotection/2023-08-01/dppfeaturesupport/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/dataprotection/2023-08-01/dppresourceguardproxies/id_backupresourceguardproxy.go b/resource-manager/dataprotection/2023-08-01/dppresourceguardproxies/id_backupresourceguardproxy.go index bcca6c3f1e7..731225b9808 100644 --- a/resource-manager/dataprotection/2023-08-01/dppresourceguardproxies/id_backupresourceguardproxy.go +++ b/resource-manager/dataprotection/2023-08-01/dppresourceguardproxies/id_backupresourceguardproxy.go @@ -38,23 +38,9 @@ func ParseBackupResourceGuardProxyID(input string) (*BackupResourceGuardProxyId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupResourceGuardProxyId{} - - 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.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) - } - - if id.BackupResourceGuardProxyName, ok = parsed.Parsed["backupResourceGuardProxyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupResourceGuardProxyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupResourceGuardProxyIDInsensitively(input string) (*BackupResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupResourceGuardProxyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupResourceGuardProxyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) } - if id.BackupResourceGuardProxyName, ok = parsed.Parsed["backupResourceGuardProxyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupResourceGuardProxyName", *parsed) + if id.BackupResourceGuardProxyName, ok = input.Parsed["backupResourceGuardProxyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupResourceGuardProxyName", input) } - return &id, nil + return nil } // ValidateBackupResourceGuardProxyID checks that 'input' can be parsed as a Backup Resource Guard Proxy ID diff --git a/resource-manager/dataprotection/2023-08-01/dppresourceguardproxies/id_backupvault.go b/resource-manager/dataprotection/2023-08-01/dppresourceguardproxies/id_backupvault.go index b48a97bf839..fa090742191 100644 --- a/resource-manager/dataprotection/2023-08-01/dppresourceguardproxies/id_backupvault.go +++ b/resource-manager/dataprotection/2023-08-01/dppresourceguardproxies/id_backupvault.go @@ -36,19 +36,9 @@ func ParseBackupVaultID(input string) (*BackupVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupVaultId{} - - 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.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseBackupVaultIDInsensitively(input string) (*BackupVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupVaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *BackupVaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) } - return &id, nil + return nil } // ValidateBackupVaultID checks that 'input' can be parsed as a Backup Vault ID diff --git a/resource-manager/dataprotection/2023-08-01/findrestorabletimeranges/id_backupinstance.go b/resource-manager/dataprotection/2023-08-01/findrestorabletimeranges/id_backupinstance.go index 62067b9d558..53677a4cb15 100644 --- a/resource-manager/dataprotection/2023-08-01/findrestorabletimeranges/id_backupinstance.go +++ b/resource-manager/dataprotection/2023-08-01/findrestorabletimeranges/id_backupinstance.go @@ -38,23 +38,9 @@ func ParseBackupInstanceID(input string) (*BackupInstanceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupInstanceId{} - - 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.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) - } - - if id.BackupInstanceName, ok = parsed.Parsed["backupInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupInstanceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupInstanceIDInsensitively(input string) (*BackupInstanceId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupInstanceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) } - if id.BackupInstanceName, ok = parsed.Parsed["backupInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupInstanceName", *parsed) + if id.BackupInstanceName, ok = input.Parsed["backupInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupInstanceName", input) } - return &id, nil + return nil } // ValidateBackupInstanceID checks that 'input' can be parsed as a Backup Instance ID diff --git a/resource-manager/dataprotection/2023-08-01/recoverypoint/id_backupinstance.go b/resource-manager/dataprotection/2023-08-01/recoverypoint/id_backupinstance.go index 60c6dc61050..a80e687857a 100644 --- a/resource-manager/dataprotection/2023-08-01/recoverypoint/id_backupinstance.go +++ b/resource-manager/dataprotection/2023-08-01/recoverypoint/id_backupinstance.go @@ -38,23 +38,9 @@ func ParseBackupInstanceID(input string) (*BackupInstanceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupInstanceId{} - - 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.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) - } - - if id.BackupInstanceName, ok = parsed.Parsed["backupInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupInstanceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupInstanceIDInsensitively(input string) (*BackupInstanceId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupInstanceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) } - if id.BackupInstanceName, ok = parsed.Parsed["backupInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupInstanceName", *parsed) + if id.BackupInstanceName, ok = input.Parsed["backupInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupInstanceName", input) } - return &id, nil + return nil } // ValidateBackupInstanceID checks that 'input' can be parsed as a Backup Instance ID diff --git a/resource-manager/dataprotection/2023-08-01/recoverypoint/id_recoverypoint.go b/resource-manager/dataprotection/2023-08-01/recoverypoint/id_recoverypoint.go index 73aca8cbb07..7eb4b2133bb 100644 --- a/resource-manager/dataprotection/2023-08-01/recoverypoint/id_recoverypoint.go +++ b/resource-manager/dataprotection/2023-08-01/recoverypoint/id_recoverypoint.go @@ -40,27 +40,9 @@ func ParseRecoveryPointID(input string) (*RecoveryPointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecoveryPointId{} - - 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.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) - } - - if id.BackupInstanceName, ok = parsed.Parsed["backupInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupInstanceName", *parsed) - } - - if id.RecoveryPointId, ok = parsed.Parsed["recoveryPointId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseRecoveryPointIDInsensitively(input string) (*RecoveryPointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecoveryPointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RecoveryPointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) } - if id.BackupInstanceName, ok = parsed.Parsed["backupInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupInstanceName", *parsed) + if id.BackupInstanceName, ok = input.Parsed["backupInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupInstanceName", input) } - if id.RecoveryPointId, ok = parsed.Parsed["recoveryPointId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", *parsed) + if id.RecoveryPointId, ok = input.Parsed["recoveryPointId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", input) } - return &id, nil + return nil } // ValidateRecoveryPointID checks that 'input' can be parsed as a Recovery Point ID diff --git a/resource-manager/dataprotection/2023-08-01/resourceguards/id_deleteprotecteditemrequest.go b/resource-manager/dataprotection/2023-08-01/resourceguards/id_deleteprotecteditemrequest.go index 03c016a126d..077bf5a8c05 100644 --- a/resource-manager/dataprotection/2023-08-01/resourceguards/id_deleteprotecteditemrequest.go +++ b/resource-manager/dataprotection/2023-08-01/resourceguards/id_deleteprotecteditemrequest.go @@ -38,23 +38,9 @@ func ParseDeleteProtectedItemRequestID(input string) (*DeleteProtectedItemReques return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeleteProtectedItemRequestId{} - - 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.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", *parsed) - } - - if id.DeleteProtectedItemRequestName, ok = parsed.Parsed["deleteProtectedItemRequestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deleteProtectedItemRequestName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDeleteProtectedItemRequestIDInsensitively(input string) (*DeleteProtec return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeleteProtectedItemRequestId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DeleteProtectedItemRequestId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", *parsed) + if id.ResourceGuardName, ok = input.Parsed["resourceGuardName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", input) } - if id.DeleteProtectedItemRequestName, ok = parsed.Parsed["deleteProtectedItemRequestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deleteProtectedItemRequestName", *parsed) + if id.DeleteProtectedItemRequestName, ok = input.Parsed["deleteProtectedItemRequestName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deleteProtectedItemRequestName", input) } - return &id, nil + return nil } // ValidateDeleteProtectedItemRequestID checks that 'input' can be parsed as a Delete Protected Item Request ID diff --git a/resource-manager/dataprotection/2023-08-01/resourceguards/id_deleteresourceguardproxyrequest.go b/resource-manager/dataprotection/2023-08-01/resourceguards/id_deleteresourceguardproxyrequest.go index e622080b39e..3bdca535a6f 100644 --- a/resource-manager/dataprotection/2023-08-01/resourceguards/id_deleteresourceguardproxyrequest.go +++ b/resource-manager/dataprotection/2023-08-01/resourceguards/id_deleteresourceguardproxyrequest.go @@ -38,23 +38,9 @@ func ParseDeleteResourceGuardProxyRequestID(input string) (*DeleteResourceGuardP return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeleteResourceGuardProxyRequestId{} - - 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.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", *parsed) - } - - if id.DeleteResourceGuardProxyRequestName, ok = parsed.Parsed["deleteResourceGuardProxyRequestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deleteResourceGuardProxyRequestName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDeleteResourceGuardProxyRequestIDInsensitively(input string) (*DeleteR return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeleteResourceGuardProxyRequestId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DeleteResourceGuardProxyRequestId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", *parsed) + if id.ResourceGuardName, ok = input.Parsed["resourceGuardName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", input) } - if id.DeleteResourceGuardProxyRequestName, ok = parsed.Parsed["deleteResourceGuardProxyRequestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deleteResourceGuardProxyRequestName", *parsed) + if id.DeleteResourceGuardProxyRequestName, ok = input.Parsed["deleteResourceGuardProxyRequestName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deleteResourceGuardProxyRequestName", input) } - return &id, nil + return nil } // ValidateDeleteResourceGuardProxyRequestID checks that 'input' can be parsed as a Delete Resource Guard Proxy Request ID diff --git a/resource-manager/dataprotection/2023-08-01/resourceguards/id_disablesoftdeleterequest.go b/resource-manager/dataprotection/2023-08-01/resourceguards/id_disablesoftdeleterequest.go index cbd2f1974af..51e4b8a6126 100644 --- a/resource-manager/dataprotection/2023-08-01/resourceguards/id_disablesoftdeleterequest.go +++ b/resource-manager/dataprotection/2023-08-01/resourceguards/id_disablesoftdeleterequest.go @@ -38,23 +38,9 @@ func ParseDisableSoftDeleteRequestID(input string) (*DisableSoftDeleteRequestId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DisableSoftDeleteRequestId{} - - 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.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", *parsed) - } - - if id.DisableSoftDeleteRequestName, ok = parsed.Parsed["disableSoftDeleteRequestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "disableSoftDeleteRequestName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDisableSoftDeleteRequestIDInsensitively(input string) (*DisableSoftDel return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DisableSoftDeleteRequestId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DisableSoftDeleteRequestId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", *parsed) + if id.ResourceGuardName, ok = input.Parsed["resourceGuardName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", input) } - if id.DisableSoftDeleteRequestName, ok = parsed.Parsed["disableSoftDeleteRequestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "disableSoftDeleteRequestName", *parsed) + if id.DisableSoftDeleteRequestName, ok = input.Parsed["disableSoftDeleteRequestName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "disableSoftDeleteRequestName", input) } - return &id, nil + return nil } // ValidateDisableSoftDeleteRequestID checks that 'input' can be parsed as a Disable Soft Delete Request ID diff --git a/resource-manager/dataprotection/2023-08-01/resourceguards/id_getbackupsecuritypinrequest.go b/resource-manager/dataprotection/2023-08-01/resourceguards/id_getbackupsecuritypinrequest.go index 8af3cb7a2a0..5c057ffdbc9 100644 --- a/resource-manager/dataprotection/2023-08-01/resourceguards/id_getbackupsecuritypinrequest.go +++ b/resource-manager/dataprotection/2023-08-01/resourceguards/id_getbackupsecuritypinrequest.go @@ -38,23 +38,9 @@ func ParseGetBackupSecurityPINRequestID(input string) (*GetBackupSecurityPINRequ return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GetBackupSecurityPINRequestId{} - - 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.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", *parsed) - } - - if id.GetBackupSecurityPINRequestName, ok = parsed.Parsed["getBackupSecurityPINRequestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "getBackupSecurityPINRequestName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGetBackupSecurityPINRequestIDInsensitively(input string) (*GetBackupSe return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GetBackupSecurityPINRequestId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GetBackupSecurityPINRequestId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", *parsed) + if id.ResourceGuardName, ok = input.Parsed["resourceGuardName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", input) } - if id.GetBackupSecurityPINRequestName, ok = parsed.Parsed["getBackupSecurityPINRequestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "getBackupSecurityPINRequestName", *parsed) + if id.GetBackupSecurityPINRequestName, ok = input.Parsed["getBackupSecurityPINRequestName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "getBackupSecurityPINRequestName", input) } - return &id, nil + return nil } // ValidateGetBackupSecurityPINRequestID checks that 'input' can be parsed as a Get Backup Security P I N Request ID diff --git a/resource-manager/dataprotection/2023-08-01/resourceguards/id_resourceguard.go b/resource-manager/dataprotection/2023-08-01/resourceguards/id_resourceguard.go index c8fab0d7a99..e6e61f5477f 100644 --- a/resource-manager/dataprotection/2023-08-01/resourceguards/id_resourceguard.go +++ b/resource-manager/dataprotection/2023-08-01/resourceguards/id_resourceguard.go @@ -36,19 +36,9 @@ func ParseResourceGuardID(input string) (*ResourceGuardId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResourceGuardId{} - - 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.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseResourceGuardIDInsensitively(input string) (*ResourceGuardId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResourceGuardId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ResourceGuardId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", *parsed) + if id.ResourceGuardName, ok = input.Parsed["resourceGuardName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", input) } - return &id, nil + return nil } // ValidateResourceGuardID checks that 'input' can be parsed as a Resource Guard ID diff --git a/resource-manager/dataprotection/2023-08-01/resourceguards/id_updateprotecteditemrequest.go b/resource-manager/dataprotection/2023-08-01/resourceguards/id_updateprotecteditemrequest.go index 27b184462b6..0010cc6cb2f 100644 --- a/resource-manager/dataprotection/2023-08-01/resourceguards/id_updateprotecteditemrequest.go +++ b/resource-manager/dataprotection/2023-08-01/resourceguards/id_updateprotecteditemrequest.go @@ -38,23 +38,9 @@ func ParseUpdateProtectedItemRequestID(input string) (*UpdateProtectedItemReques return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UpdateProtectedItemRequestId{} - - 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.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", *parsed) - } - - if id.UpdateProtectedItemRequestName, ok = parsed.Parsed["updateProtectedItemRequestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "updateProtectedItemRequestName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseUpdateProtectedItemRequestIDInsensitively(input string) (*UpdateProtec return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UpdateProtectedItemRequestId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UpdateProtectedItemRequestId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", *parsed) + if id.ResourceGuardName, ok = input.Parsed["resourceGuardName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", input) } - if id.UpdateProtectedItemRequestName, ok = parsed.Parsed["updateProtectedItemRequestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "updateProtectedItemRequestName", *parsed) + if id.UpdateProtectedItemRequestName, ok = input.Parsed["updateProtectedItemRequestName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "updateProtectedItemRequestName", input) } - return &id, nil + return nil } // ValidateUpdateProtectedItemRequestID checks that 'input' can be parsed as a Update Protected Item Request ID diff --git a/resource-manager/dataprotection/2023-08-01/resourceguards/id_updateprotectionpolicyrequest.go b/resource-manager/dataprotection/2023-08-01/resourceguards/id_updateprotectionpolicyrequest.go index e6be01e67c3..3dd15fab913 100644 --- a/resource-manager/dataprotection/2023-08-01/resourceguards/id_updateprotectionpolicyrequest.go +++ b/resource-manager/dataprotection/2023-08-01/resourceguards/id_updateprotectionpolicyrequest.go @@ -38,23 +38,9 @@ func ParseUpdateProtectionPolicyRequestID(input string) (*UpdateProtectionPolicy return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UpdateProtectionPolicyRequestId{} - - 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.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", *parsed) - } - - if id.UpdateProtectionPolicyRequestName, ok = parsed.Parsed["updateProtectionPolicyRequestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "updateProtectionPolicyRequestName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseUpdateProtectionPolicyRequestIDInsensitively(input string) (*UpdatePro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UpdateProtectionPolicyRequestId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UpdateProtectionPolicyRequestId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ResourceGuardName, ok = parsed.Parsed["resourceGuardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", *parsed) + if id.ResourceGuardName, ok = input.Parsed["resourceGuardName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGuardName", input) } - if id.UpdateProtectionPolicyRequestName, ok = parsed.Parsed["updateProtectionPolicyRequestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "updateProtectionPolicyRequestName", *parsed) + if id.UpdateProtectionPolicyRequestName, ok = input.Parsed["updateProtectionPolicyRequestName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "updateProtectionPolicyRequestName", input) } - return &id, nil + return nil } // ValidateUpdateProtectionPolicyRequestID checks that 'input' can be parsed as a Update Protection Policy Request ID diff --git a/resource-manager/datashare/2019-11-01/account/id_account.go b/resource-manager/datashare/2019-11-01/account/id_account.go index 4298bb5d1ac..177ad85a490 100644 --- a/resource-manager/datashare/2019-11-01/account/id_account.go +++ b/resource-manager/datashare/2019-11-01/account/id_account.go @@ -36,19 +36,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/datashare/2019-11-01/consumerinvitation/id_consumerinvitation.go b/resource-manager/datashare/2019-11-01/consumerinvitation/id_consumerinvitation.go index d3e18561571..ff1dec3c5a2 100644 --- a/resource-manager/datashare/2019-11-01/consumerinvitation/id_consumerinvitation.go +++ b/resource-manager/datashare/2019-11-01/consumerinvitation/id_consumerinvitation.go @@ -34,15 +34,9 @@ func ParseConsumerInvitationID(input string) (*ConsumerInvitationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConsumerInvitationId{} - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.InvitationId, ok = parsed.Parsed["invitationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "invitationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseConsumerInvitationIDInsensitively(input string) (*ConsumerInvitationId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConsumerInvitationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + return &id, nil +} + +func (id *ConsumerInvitationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.InvitationId, ok = parsed.Parsed["invitationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "invitationId", *parsed) + if id.InvitationId, ok = input.Parsed["invitationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "invitationId", input) } - return &id, nil + return nil } // ValidateConsumerInvitationID checks that 'input' can be parsed as a Consumer Invitation ID diff --git a/resource-manager/datashare/2019-11-01/consumerinvitation/id_location.go b/resource-manager/datashare/2019-11-01/consumerinvitation/id_location.go index 00e8fb406c7..891fef3070c 100644 --- a/resource-manager/datashare/2019-11-01/consumerinvitation/id_location.go +++ b/resource-manager/datashare/2019-11-01/consumerinvitation/id_location.go @@ -32,11 +32,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + return nil +} + // ValidateLocationID checks that 'input' can be parsed as a Location ID func ValidateLocationID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/datashare/2019-11-01/dataset/id_dataset.go b/resource-manager/datashare/2019-11-01/dataset/id_dataset.go index 4b460fd7b15..e4038261eb1 100644 --- a/resource-manager/datashare/2019-11-01/dataset/id_dataset.go +++ b/resource-manager/datashare/2019-11-01/dataset/id_dataset.go @@ -40,27 +40,9 @@ func ParseDataSetID(input string) (*DataSetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataSetId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareName", *parsed) - } - - if id.DataSetName, ok = parsed.Parsed["dataSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataSetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseDataSetIDInsensitively(input string) (*DataSetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataSetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DataSetId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareName", *parsed) + if id.ShareName, ok = input.Parsed["shareName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "shareName", input) } - if id.DataSetName, ok = parsed.Parsed["dataSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataSetName", *parsed) + if id.DataSetName, ok = input.Parsed["dataSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataSetName", input) } - return &id, nil + return nil } // ValidateDataSetID checks that 'input' can be parsed as a Data Set ID diff --git a/resource-manager/datashare/2019-11-01/dataset/id_share.go b/resource-manager/datashare/2019-11-01/dataset/id_share.go index 0d6f24f29be..dfcd82c0e07 100644 --- a/resource-manager/datashare/2019-11-01/dataset/id_share.go +++ b/resource-manager/datashare/2019-11-01/dataset/id_share.go @@ -38,23 +38,9 @@ func ParseShareID(input string) (*ShareId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ShareId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseShareIDInsensitively(input string) (*ShareId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ShareId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ShareId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareName", *parsed) + if id.ShareName, ok = input.Parsed["shareName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "shareName", input) } - return &id, nil + return nil } // ValidateShareID checks that 'input' can be parsed as a Share ID diff --git a/resource-manager/datashare/2019-11-01/datasetmapping/id_datasetmapping.go b/resource-manager/datashare/2019-11-01/datasetmapping/id_datasetmapping.go index 0a3ceb71839..34f5d0fa780 100644 --- a/resource-manager/datashare/2019-11-01/datasetmapping/id_datasetmapping.go +++ b/resource-manager/datashare/2019-11-01/datasetmapping/id_datasetmapping.go @@ -40,27 +40,9 @@ func ParseDataSetMappingID(input string) (*DataSetMappingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataSetMappingId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.ShareSubscriptionName, ok = parsed.Parsed["shareSubscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareSubscriptionName", *parsed) - } - - if id.DataSetMappingName, ok = parsed.Parsed["dataSetMappingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataSetMappingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseDataSetMappingIDInsensitively(input string) (*DataSetMappingId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataSetMappingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DataSetMappingId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.ShareSubscriptionName, ok = parsed.Parsed["shareSubscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareSubscriptionName", *parsed) + if id.ShareSubscriptionName, ok = input.Parsed["shareSubscriptionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "shareSubscriptionName", input) } - if id.DataSetMappingName, ok = parsed.Parsed["dataSetMappingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataSetMappingName", *parsed) + if id.DataSetMappingName, ok = input.Parsed["dataSetMappingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataSetMappingName", input) } - return &id, nil + return nil } // ValidateDataSetMappingID checks that 'input' can be parsed as a Data Set Mapping ID diff --git a/resource-manager/datashare/2019-11-01/datasetmapping/id_sharesubscription.go b/resource-manager/datashare/2019-11-01/datasetmapping/id_sharesubscription.go index cedf4cc752e..9cbc8b84d52 100644 --- a/resource-manager/datashare/2019-11-01/datasetmapping/id_sharesubscription.go +++ b/resource-manager/datashare/2019-11-01/datasetmapping/id_sharesubscription.go @@ -38,23 +38,9 @@ func ParseShareSubscriptionID(input string) (*ShareSubscriptionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ShareSubscriptionId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.ShareSubscriptionName, ok = parsed.Parsed["shareSubscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareSubscriptionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseShareSubscriptionIDInsensitively(input string) (*ShareSubscriptionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ShareSubscriptionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ShareSubscriptionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.ShareSubscriptionName, ok = parsed.Parsed["shareSubscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareSubscriptionName", *parsed) + if id.ShareSubscriptionName, ok = input.Parsed["shareSubscriptionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "shareSubscriptionName", input) } - return &id, nil + return nil } // ValidateShareSubscriptionID checks that 'input' can be parsed as a Share Subscription ID diff --git a/resource-manager/datashare/2019-11-01/emailregistration/id_location.go b/resource-manager/datashare/2019-11-01/emailregistration/id_location.go index 46fbf76c763..39763068035 100644 --- a/resource-manager/datashare/2019-11-01/emailregistration/id_location.go +++ b/resource-manager/datashare/2019-11-01/emailregistration/id_location.go @@ -32,11 +32,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + return nil +} + // ValidateLocationID checks that 'input' can be parsed as a Location ID func ValidateLocationID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/datashare/2019-11-01/invitation/id_invitation.go b/resource-manager/datashare/2019-11-01/invitation/id_invitation.go index bcafd483a33..e4b529fa9df 100644 --- a/resource-manager/datashare/2019-11-01/invitation/id_invitation.go +++ b/resource-manager/datashare/2019-11-01/invitation/id_invitation.go @@ -40,27 +40,9 @@ func ParseInvitationID(input string) (*InvitationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InvitationId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareName", *parsed) - } - - if id.InvitationName, ok = parsed.Parsed["invitationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "invitationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseInvitationIDInsensitively(input string) (*InvitationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InvitationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *InvitationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareName", *parsed) + if id.ShareName, ok = input.Parsed["shareName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "shareName", input) } - if id.InvitationName, ok = parsed.Parsed["invitationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "invitationName", *parsed) + if id.InvitationName, ok = input.Parsed["invitationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "invitationName", input) } - return &id, nil + return nil } // ValidateInvitationID checks that 'input' can be parsed as a Invitation ID diff --git a/resource-manager/datashare/2019-11-01/invitation/id_share.go b/resource-manager/datashare/2019-11-01/invitation/id_share.go index 994961220c6..f41facfd832 100644 --- a/resource-manager/datashare/2019-11-01/invitation/id_share.go +++ b/resource-manager/datashare/2019-11-01/invitation/id_share.go @@ -38,23 +38,9 @@ func ParseShareID(input string) (*ShareId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ShareId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseShareIDInsensitively(input string) (*ShareId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ShareId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ShareId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareName", *parsed) + if id.ShareName, ok = input.Parsed["shareName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "shareName", input) } - return &id, nil + return nil } // ValidateShareID checks that 'input' can be parsed as a Share ID diff --git a/resource-manager/datashare/2019-11-01/share/id_account.go b/resource-manager/datashare/2019-11-01/share/id_account.go index 6b7ca31b423..09697cc9dbe 100644 --- a/resource-manager/datashare/2019-11-01/share/id_account.go +++ b/resource-manager/datashare/2019-11-01/share/id_account.go @@ -36,19 +36,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/datashare/2019-11-01/share/id_providersharesubscription.go b/resource-manager/datashare/2019-11-01/share/id_providersharesubscription.go index 0ea3bfdd032..af44deabf5f 100644 --- a/resource-manager/datashare/2019-11-01/share/id_providersharesubscription.go +++ b/resource-manager/datashare/2019-11-01/share/id_providersharesubscription.go @@ -40,27 +40,9 @@ func ParseProviderShareSubscriptionID(input string) (*ProviderShareSubscriptionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderShareSubscriptionId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareName", *parsed) - } - - if id.ProviderShareSubscriptionId, ok = parsed.Parsed["providerShareSubscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "providerShareSubscriptionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseProviderShareSubscriptionIDInsensitively(input string) (*ProviderShare return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderShareSubscriptionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ProviderShareSubscriptionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareName", *parsed) + if id.ShareName, ok = input.Parsed["shareName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "shareName", input) } - if id.ProviderShareSubscriptionId, ok = parsed.Parsed["providerShareSubscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "providerShareSubscriptionId", *parsed) + if id.ProviderShareSubscriptionId, ok = input.Parsed["providerShareSubscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "providerShareSubscriptionId", input) } - return &id, nil + return nil } // ValidateProviderShareSubscriptionID checks that 'input' can be parsed as a Provider Share Subscription ID diff --git a/resource-manager/datashare/2019-11-01/share/id_share.go b/resource-manager/datashare/2019-11-01/share/id_share.go index e7fc90ee7fd..4f23535a344 100644 --- a/resource-manager/datashare/2019-11-01/share/id_share.go +++ b/resource-manager/datashare/2019-11-01/share/id_share.go @@ -38,23 +38,9 @@ func ParseShareID(input string) (*ShareId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ShareId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseShareIDInsensitively(input string) (*ShareId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ShareId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ShareId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareName", *parsed) + if id.ShareName, ok = input.Parsed["shareName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "shareName", input) } - return &id, nil + return nil } // ValidateShareID checks that 'input' can be parsed as a Share ID diff --git a/resource-manager/datashare/2019-11-01/sharesubscription/id_account.go b/resource-manager/datashare/2019-11-01/sharesubscription/id_account.go index 512cf59af31..1aa51faa0db 100644 --- a/resource-manager/datashare/2019-11-01/sharesubscription/id_account.go +++ b/resource-manager/datashare/2019-11-01/sharesubscription/id_account.go @@ -36,19 +36,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/datashare/2019-11-01/sharesubscription/id_sharesubscription.go b/resource-manager/datashare/2019-11-01/sharesubscription/id_sharesubscription.go index 7df14fd7508..8f61608f58b 100644 --- a/resource-manager/datashare/2019-11-01/sharesubscription/id_sharesubscription.go +++ b/resource-manager/datashare/2019-11-01/sharesubscription/id_sharesubscription.go @@ -38,23 +38,9 @@ func ParseShareSubscriptionID(input string) (*ShareSubscriptionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ShareSubscriptionId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.ShareSubscriptionName, ok = parsed.Parsed["shareSubscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareSubscriptionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseShareSubscriptionIDInsensitively(input string) (*ShareSubscriptionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ShareSubscriptionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ShareSubscriptionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.ShareSubscriptionName, ok = parsed.Parsed["shareSubscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareSubscriptionName", *parsed) + if id.ShareSubscriptionName, ok = input.Parsed["shareSubscriptionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "shareSubscriptionName", input) } - return &id, nil + return nil } // ValidateShareSubscriptionID checks that 'input' can be parsed as a Share Subscription ID diff --git a/resource-manager/datashare/2019-11-01/synchronizationsetting/id_share.go b/resource-manager/datashare/2019-11-01/synchronizationsetting/id_share.go index 6355fef5046..5231ed81336 100644 --- a/resource-manager/datashare/2019-11-01/synchronizationsetting/id_share.go +++ b/resource-manager/datashare/2019-11-01/synchronizationsetting/id_share.go @@ -38,23 +38,9 @@ func ParseShareID(input string) (*ShareId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ShareId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseShareIDInsensitively(input string) (*ShareId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ShareId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ShareId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareName", *parsed) + if id.ShareName, ok = input.Parsed["shareName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "shareName", input) } - return &id, nil + return nil } // ValidateShareID checks that 'input' can be parsed as a Share ID diff --git a/resource-manager/datashare/2019-11-01/synchronizationsetting/id_synchronizationsetting.go b/resource-manager/datashare/2019-11-01/synchronizationsetting/id_synchronizationsetting.go index fbf9a57d492..4c8deb139e0 100644 --- a/resource-manager/datashare/2019-11-01/synchronizationsetting/id_synchronizationsetting.go +++ b/resource-manager/datashare/2019-11-01/synchronizationsetting/id_synchronizationsetting.go @@ -40,27 +40,9 @@ func ParseSynchronizationSettingID(input string) (*SynchronizationSettingId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SynchronizationSettingId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareName", *parsed) - } - - if id.SynchronizationSettingName, ok = parsed.Parsed["synchronizationSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "synchronizationSettingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSynchronizationSettingIDInsensitively(input string) (*SynchronizationS return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SynchronizationSettingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SynchronizationSettingId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareName", *parsed) + if id.ShareName, ok = input.Parsed["shareName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "shareName", input) } - if id.SynchronizationSettingName, ok = parsed.Parsed["synchronizationSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "synchronizationSettingName", *parsed) + if id.SynchronizationSettingName, ok = input.Parsed["synchronizationSettingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "synchronizationSettingName", input) } - return &id, nil + return nil } // ValidateSynchronizationSettingID checks that 'input' can be parsed as a Synchronization Setting ID diff --git a/resource-manager/datashare/2019-11-01/trigger/id_sharesubscription.go b/resource-manager/datashare/2019-11-01/trigger/id_sharesubscription.go index f0f82efdf07..b41e6f6bce9 100644 --- a/resource-manager/datashare/2019-11-01/trigger/id_sharesubscription.go +++ b/resource-manager/datashare/2019-11-01/trigger/id_sharesubscription.go @@ -38,23 +38,9 @@ func ParseShareSubscriptionID(input string) (*ShareSubscriptionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ShareSubscriptionId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.ShareSubscriptionName, ok = parsed.Parsed["shareSubscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareSubscriptionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseShareSubscriptionIDInsensitively(input string) (*ShareSubscriptionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ShareSubscriptionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ShareSubscriptionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.ShareSubscriptionName, ok = parsed.Parsed["shareSubscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareSubscriptionName", *parsed) + if id.ShareSubscriptionName, ok = input.Parsed["shareSubscriptionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "shareSubscriptionName", input) } - return &id, nil + return nil } // ValidateShareSubscriptionID checks that 'input' can be parsed as a Share Subscription ID diff --git a/resource-manager/datashare/2019-11-01/trigger/id_trigger.go b/resource-manager/datashare/2019-11-01/trigger/id_trigger.go index a6789af48e8..dfaac0f0f6f 100644 --- a/resource-manager/datashare/2019-11-01/trigger/id_trigger.go +++ b/resource-manager/datashare/2019-11-01/trigger/id_trigger.go @@ -40,27 +40,9 @@ func ParseTriggerID(input string) (*TriggerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TriggerId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.ShareSubscriptionName, ok = parsed.Parsed["shareSubscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareSubscriptionName", *parsed) - } - - if id.TriggerName, ok = parsed.Parsed["triggerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseTriggerIDInsensitively(input string) (*TriggerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TriggerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TriggerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.ShareSubscriptionName, ok = parsed.Parsed["shareSubscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareSubscriptionName", *parsed) + if id.ShareSubscriptionName, ok = input.Parsed["shareSubscriptionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "shareSubscriptionName", input) } - if id.TriggerName, ok = parsed.Parsed["triggerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggerName", *parsed) + if id.TriggerName, ok = input.Parsed["triggerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "triggerName", input) } - return &id, nil + return nil } // ValidateTriggerID checks that 'input' can be parsed as a Trigger ID diff --git a/resource-manager/datashare/2021-08-01/account/id_account.go b/resource-manager/datashare/2021-08-01/account/id_account.go index 4298bb5d1ac..177ad85a490 100644 --- a/resource-manager/datashare/2021-08-01/account/id_account.go +++ b/resource-manager/datashare/2021-08-01/account/id_account.go @@ -36,19 +36,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/datashare/2021-08-01/consumerinvitation/id_consumerinvitation.go b/resource-manager/datashare/2021-08-01/consumerinvitation/id_consumerinvitation.go index d3e18561571..ff1dec3c5a2 100644 --- a/resource-manager/datashare/2021-08-01/consumerinvitation/id_consumerinvitation.go +++ b/resource-manager/datashare/2021-08-01/consumerinvitation/id_consumerinvitation.go @@ -34,15 +34,9 @@ func ParseConsumerInvitationID(input string) (*ConsumerInvitationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConsumerInvitationId{} - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.InvitationId, ok = parsed.Parsed["invitationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "invitationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseConsumerInvitationIDInsensitively(input string) (*ConsumerInvitationId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConsumerInvitationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + return &id, nil +} + +func (id *ConsumerInvitationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.InvitationId, ok = parsed.Parsed["invitationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "invitationId", *parsed) + if id.InvitationId, ok = input.Parsed["invitationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "invitationId", input) } - return &id, nil + return nil } // ValidateConsumerInvitationID checks that 'input' can be parsed as a Consumer Invitation ID diff --git a/resource-manager/datashare/2021-08-01/consumerinvitation/id_location.go b/resource-manager/datashare/2021-08-01/consumerinvitation/id_location.go index 00e8fb406c7..891fef3070c 100644 --- a/resource-manager/datashare/2021-08-01/consumerinvitation/id_location.go +++ b/resource-manager/datashare/2021-08-01/consumerinvitation/id_location.go @@ -32,11 +32,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + return nil +} + // ValidateLocationID checks that 'input' can be parsed as a Location ID func ValidateLocationID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/datashare/2021-08-01/dataset/id_dataset.go b/resource-manager/datashare/2021-08-01/dataset/id_dataset.go index 4b460fd7b15..e4038261eb1 100644 --- a/resource-manager/datashare/2021-08-01/dataset/id_dataset.go +++ b/resource-manager/datashare/2021-08-01/dataset/id_dataset.go @@ -40,27 +40,9 @@ func ParseDataSetID(input string) (*DataSetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataSetId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareName", *parsed) - } - - if id.DataSetName, ok = parsed.Parsed["dataSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataSetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseDataSetIDInsensitively(input string) (*DataSetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataSetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DataSetId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareName", *parsed) + if id.ShareName, ok = input.Parsed["shareName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "shareName", input) } - if id.DataSetName, ok = parsed.Parsed["dataSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataSetName", *parsed) + if id.DataSetName, ok = input.Parsed["dataSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataSetName", input) } - return &id, nil + return nil } // ValidateDataSetID checks that 'input' can be parsed as a Data Set ID diff --git a/resource-manager/datashare/2021-08-01/dataset/id_share.go b/resource-manager/datashare/2021-08-01/dataset/id_share.go index 0d6f24f29be..dfcd82c0e07 100644 --- a/resource-manager/datashare/2021-08-01/dataset/id_share.go +++ b/resource-manager/datashare/2021-08-01/dataset/id_share.go @@ -38,23 +38,9 @@ func ParseShareID(input string) (*ShareId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ShareId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseShareIDInsensitively(input string) (*ShareId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ShareId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ShareId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareName", *parsed) + if id.ShareName, ok = input.Parsed["shareName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "shareName", input) } - return &id, nil + return nil } // ValidateShareID checks that 'input' can be parsed as a Share ID diff --git a/resource-manager/datashare/2021-08-01/datasetmapping/id_datasetmapping.go b/resource-manager/datashare/2021-08-01/datasetmapping/id_datasetmapping.go index 0a3ceb71839..34f5d0fa780 100644 --- a/resource-manager/datashare/2021-08-01/datasetmapping/id_datasetmapping.go +++ b/resource-manager/datashare/2021-08-01/datasetmapping/id_datasetmapping.go @@ -40,27 +40,9 @@ func ParseDataSetMappingID(input string) (*DataSetMappingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataSetMappingId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.ShareSubscriptionName, ok = parsed.Parsed["shareSubscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareSubscriptionName", *parsed) - } - - if id.DataSetMappingName, ok = parsed.Parsed["dataSetMappingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataSetMappingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseDataSetMappingIDInsensitively(input string) (*DataSetMappingId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataSetMappingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DataSetMappingId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.ShareSubscriptionName, ok = parsed.Parsed["shareSubscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareSubscriptionName", *parsed) + if id.ShareSubscriptionName, ok = input.Parsed["shareSubscriptionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "shareSubscriptionName", input) } - if id.DataSetMappingName, ok = parsed.Parsed["dataSetMappingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataSetMappingName", *parsed) + if id.DataSetMappingName, ok = input.Parsed["dataSetMappingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataSetMappingName", input) } - return &id, nil + return nil } // ValidateDataSetMappingID checks that 'input' can be parsed as a Data Set Mapping ID diff --git a/resource-manager/datashare/2021-08-01/datasetmapping/id_sharesubscription.go b/resource-manager/datashare/2021-08-01/datasetmapping/id_sharesubscription.go index cedf4cc752e..9cbc8b84d52 100644 --- a/resource-manager/datashare/2021-08-01/datasetmapping/id_sharesubscription.go +++ b/resource-manager/datashare/2021-08-01/datasetmapping/id_sharesubscription.go @@ -38,23 +38,9 @@ func ParseShareSubscriptionID(input string) (*ShareSubscriptionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ShareSubscriptionId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.ShareSubscriptionName, ok = parsed.Parsed["shareSubscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareSubscriptionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseShareSubscriptionIDInsensitively(input string) (*ShareSubscriptionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ShareSubscriptionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ShareSubscriptionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.ShareSubscriptionName, ok = parsed.Parsed["shareSubscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareSubscriptionName", *parsed) + if id.ShareSubscriptionName, ok = input.Parsed["shareSubscriptionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "shareSubscriptionName", input) } - return &id, nil + return nil } // ValidateShareSubscriptionID checks that 'input' can be parsed as a Share Subscription ID diff --git a/resource-manager/datashare/2021-08-01/emailregistration/id_location.go b/resource-manager/datashare/2021-08-01/emailregistration/id_location.go index 46fbf76c763..39763068035 100644 --- a/resource-manager/datashare/2021-08-01/emailregistration/id_location.go +++ b/resource-manager/datashare/2021-08-01/emailregistration/id_location.go @@ -32,11 +32,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + return nil +} + // ValidateLocationID checks that 'input' can be parsed as a Location ID func ValidateLocationID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/datashare/2021-08-01/invitation/id_invitation.go b/resource-manager/datashare/2021-08-01/invitation/id_invitation.go index bcafd483a33..e4b529fa9df 100644 --- a/resource-manager/datashare/2021-08-01/invitation/id_invitation.go +++ b/resource-manager/datashare/2021-08-01/invitation/id_invitation.go @@ -40,27 +40,9 @@ func ParseInvitationID(input string) (*InvitationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InvitationId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareName", *parsed) - } - - if id.InvitationName, ok = parsed.Parsed["invitationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "invitationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseInvitationIDInsensitively(input string) (*InvitationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InvitationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *InvitationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareName", *parsed) + if id.ShareName, ok = input.Parsed["shareName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "shareName", input) } - if id.InvitationName, ok = parsed.Parsed["invitationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "invitationName", *parsed) + if id.InvitationName, ok = input.Parsed["invitationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "invitationName", input) } - return &id, nil + return nil } // ValidateInvitationID checks that 'input' can be parsed as a Invitation ID diff --git a/resource-manager/datashare/2021-08-01/invitation/id_share.go b/resource-manager/datashare/2021-08-01/invitation/id_share.go index 994961220c6..f41facfd832 100644 --- a/resource-manager/datashare/2021-08-01/invitation/id_share.go +++ b/resource-manager/datashare/2021-08-01/invitation/id_share.go @@ -38,23 +38,9 @@ func ParseShareID(input string) (*ShareId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ShareId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseShareIDInsensitively(input string) (*ShareId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ShareId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ShareId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareName", *parsed) + if id.ShareName, ok = input.Parsed["shareName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "shareName", input) } - return &id, nil + return nil } // ValidateShareID checks that 'input' can be parsed as a Share ID diff --git a/resource-manager/datashare/2021-08-01/share/id_account.go b/resource-manager/datashare/2021-08-01/share/id_account.go index 6b7ca31b423..09697cc9dbe 100644 --- a/resource-manager/datashare/2021-08-01/share/id_account.go +++ b/resource-manager/datashare/2021-08-01/share/id_account.go @@ -36,19 +36,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/datashare/2021-08-01/share/id_providersharesubscription.go b/resource-manager/datashare/2021-08-01/share/id_providersharesubscription.go index 0ea3bfdd032..af44deabf5f 100644 --- a/resource-manager/datashare/2021-08-01/share/id_providersharesubscription.go +++ b/resource-manager/datashare/2021-08-01/share/id_providersharesubscription.go @@ -40,27 +40,9 @@ func ParseProviderShareSubscriptionID(input string) (*ProviderShareSubscriptionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderShareSubscriptionId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareName", *parsed) - } - - if id.ProviderShareSubscriptionId, ok = parsed.Parsed["providerShareSubscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "providerShareSubscriptionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseProviderShareSubscriptionIDInsensitively(input string) (*ProviderShare return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderShareSubscriptionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ProviderShareSubscriptionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareName", *parsed) + if id.ShareName, ok = input.Parsed["shareName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "shareName", input) } - if id.ProviderShareSubscriptionId, ok = parsed.Parsed["providerShareSubscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "providerShareSubscriptionId", *parsed) + if id.ProviderShareSubscriptionId, ok = input.Parsed["providerShareSubscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "providerShareSubscriptionId", input) } - return &id, nil + return nil } // ValidateProviderShareSubscriptionID checks that 'input' can be parsed as a Provider Share Subscription ID diff --git a/resource-manager/datashare/2021-08-01/share/id_share.go b/resource-manager/datashare/2021-08-01/share/id_share.go index e7fc90ee7fd..4f23535a344 100644 --- a/resource-manager/datashare/2021-08-01/share/id_share.go +++ b/resource-manager/datashare/2021-08-01/share/id_share.go @@ -38,23 +38,9 @@ func ParseShareID(input string) (*ShareId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ShareId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseShareIDInsensitively(input string) (*ShareId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ShareId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ShareId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareName", *parsed) + if id.ShareName, ok = input.Parsed["shareName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "shareName", input) } - return &id, nil + return nil } // ValidateShareID checks that 'input' can be parsed as a Share ID diff --git a/resource-manager/datashare/2021-08-01/sharesubscription/id_account.go b/resource-manager/datashare/2021-08-01/sharesubscription/id_account.go index 512cf59af31..1aa51faa0db 100644 --- a/resource-manager/datashare/2021-08-01/sharesubscription/id_account.go +++ b/resource-manager/datashare/2021-08-01/sharesubscription/id_account.go @@ -36,19 +36,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/datashare/2021-08-01/sharesubscription/id_sharesubscription.go b/resource-manager/datashare/2021-08-01/sharesubscription/id_sharesubscription.go index 7df14fd7508..8f61608f58b 100644 --- a/resource-manager/datashare/2021-08-01/sharesubscription/id_sharesubscription.go +++ b/resource-manager/datashare/2021-08-01/sharesubscription/id_sharesubscription.go @@ -38,23 +38,9 @@ func ParseShareSubscriptionID(input string) (*ShareSubscriptionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ShareSubscriptionId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.ShareSubscriptionName, ok = parsed.Parsed["shareSubscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareSubscriptionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseShareSubscriptionIDInsensitively(input string) (*ShareSubscriptionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ShareSubscriptionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ShareSubscriptionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.ShareSubscriptionName, ok = parsed.Parsed["shareSubscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareSubscriptionName", *parsed) + if id.ShareSubscriptionName, ok = input.Parsed["shareSubscriptionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "shareSubscriptionName", input) } - return &id, nil + return nil } // ValidateShareSubscriptionID checks that 'input' can be parsed as a Share Subscription ID diff --git a/resource-manager/datashare/2021-08-01/synchronizationsetting/id_share.go b/resource-manager/datashare/2021-08-01/synchronizationsetting/id_share.go index 6355fef5046..5231ed81336 100644 --- a/resource-manager/datashare/2021-08-01/synchronizationsetting/id_share.go +++ b/resource-manager/datashare/2021-08-01/synchronizationsetting/id_share.go @@ -38,23 +38,9 @@ func ParseShareID(input string) (*ShareId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ShareId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseShareIDInsensitively(input string) (*ShareId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ShareId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ShareId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareName", *parsed) + if id.ShareName, ok = input.Parsed["shareName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "shareName", input) } - return &id, nil + return nil } // ValidateShareID checks that 'input' can be parsed as a Share ID diff --git a/resource-manager/datashare/2021-08-01/synchronizationsetting/id_synchronizationsetting.go b/resource-manager/datashare/2021-08-01/synchronizationsetting/id_synchronizationsetting.go index fbf9a57d492..4c8deb139e0 100644 --- a/resource-manager/datashare/2021-08-01/synchronizationsetting/id_synchronizationsetting.go +++ b/resource-manager/datashare/2021-08-01/synchronizationsetting/id_synchronizationsetting.go @@ -40,27 +40,9 @@ func ParseSynchronizationSettingID(input string) (*SynchronizationSettingId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SynchronizationSettingId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareName", *parsed) - } - - if id.SynchronizationSettingName, ok = parsed.Parsed["synchronizationSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "synchronizationSettingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSynchronizationSettingIDInsensitively(input string) (*SynchronizationS return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SynchronizationSettingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SynchronizationSettingId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareName", *parsed) + if id.ShareName, ok = input.Parsed["shareName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "shareName", input) } - if id.SynchronizationSettingName, ok = parsed.Parsed["synchronizationSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "synchronizationSettingName", *parsed) + if id.SynchronizationSettingName, ok = input.Parsed["synchronizationSettingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "synchronizationSettingName", input) } - return &id, nil + return nil } // ValidateSynchronizationSettingID checks that 'input' can be parsed as a Synchronization Setting ID diff --git a/resource-manager/datashare/2021-08-01/trigger/id_sharesubscription.go b/resource-manager/datashare/2021-08-01/trigger/id_sharesubscription.go index f0f82efdf07..b41e6f6bce9 100644 --- a/resource-manager/datashare/2021-08-01/trigger/id_sharesubscription.go +++ b/resource-manager/datashare/2021-08-01/trigger/id_sharesubscription.go @@ -38,23 +38,9 @@ func ParseShareSubscriptionID(input string) (*ShareSubscriptionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ShareSubscriptionId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.ShareSubscriptionName, ok = parsed.Parsed["shareSubscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareSubscriptionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseShareSubscriptionIDInsensitively(input string) (*ShareSubscriptionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ShareSubscriptionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ShareSubscriptionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.ShareSubscriptionName, ok = parsed.Parsed["shareSubscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareSubscriptionName", *parsed) + if id.ShareSubscriptionName, ok = input.Parsed["shareSubscriptionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "shareSubscriptionName", input) } - return &id, nil + return nil } // ValidateShareSubscriptionID checks that 'input' can be parsed as a Share Subscription ID diff --git a/resource-manager/datashare/2021-08-01/trigger/id_trigger.go b/resource-manager/datashare/2021-08-01/trigger/id_trigger.go index a6789af48e8..dfaac0f0f6f 100644 --- a/resource-manager/datashare/2021-08-01/trigger/id_trigger.go +++ b/resource-manager/datashare/2021-08-01/trigger/id_trigger.go @@ -40,27 +40,9 @@ func ParseTriggerID(input string) (*TriggerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TriggerId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.ShareSubscriptionName, ok = parsed.Parsed["shareSubscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareSubscriptionName", *parsed) - } - - if id.TriggerName, ok = parsed.Parsed["triggerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseTriggerIDInsensitively(input string) (*TriggerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TriggerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TriggerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.ShareSubscriptionName, ok = parsed.Parsed["shareSubscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareSubscriptionName", *parsed) + if id.ShareSubscriptionName, ok = input.Parsed["shareSubscriptionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "shareSubscriptionName", input) } - if id.TriggerName, ok = parsed.Parsed["triggerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggerName", *parsed) + if id.TriggerName, ok = input.Parsed["triggerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "triggerName", input) } - return &id, nil + return nil } // ValidateTriggerID checks that 'input' can be parsed as a Trigger ID diff --git a/resource-manager/desktopvirtualization/2021-09-03-preview/application/id_application.go b/resource-manager/desktopvirtualization/2021-09-03-preview/application/id_application.go index 17c0d9e28f3..3b7ffbaa107 100644 --- a/resource-manager/desktopvirtualization/2021-09-03-preview/application/id_application.go +++ b/resource-manager/desktopvirtualization/2021-09-03-preview/application/id_application.go @@ -38,23 +38,9 @@ func ParseApplicationID(input string) (*ApplicationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationId{} - - 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.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", *parsed) - } - - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApplicationIDInsensitively(input string) (*ApplicationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApplicationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", *parsed) + if id.ApplicationGroupName, ok = input.Parsed["applicationGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", input) } - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) + if id.ApplicationName, ok = input.Parsed["applicationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationName", input) } - return &id, nil + return nil } // ValidateApplicationID checks that 'input' can be parsed as a Application ID diff --git a/resource-manager/desktopvirtualization/2021-09-03-preview/application/id_applicationgroup.go b/resource-manager/desktopvirtualization/2021-09-03-preview/application/id_applicationgroup.go index c08ebfa9f68..914b1c118c7 100644 --- a/resource-manager/desktopvirtualization/2021-09-03-preview/application/id_applicationgroup.go +++ b/resource-manager/desktopvirtualization/2021-09-03-preview/application/id_applicationgroup.go @@ -36,19 +36,9 @@ func ParseApplicationGroupID(input string) (*ApplicationGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGroupId{} - - 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.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseApplicationGroupIDInsensitively(input string) (*ApplicationGroupId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ApplicationGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", *parsed) + if id.ApplicationGroupName, ok = input.Parsed["applicationGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", input) } - return &id, nil + return nil } // ValidateApplicationGroupID checks that 'input' can be parsed as a Application Group ID diff --git a/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/id_applicationgroup.go b/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/id_applicationgroup.go index 763845e0e9b..6637983e581 100644 --- a/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/id_applicationgroup.go +++ b/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup/id_applicationgroup.go @@ -36,19 +36,9 @@ func ParseApplicationGroupID(input string) (*ApplicationGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGroupId{} - - 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.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseApplicationGroupIDInsensitively(input string) (*ApplicationGroupId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ApplicationGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", *parsed) + if id.ApplicationGroupName, ok = input.Parsed["applicationGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", input) } - return &id, nil + return nil } // ValidateApplicationGroupID checks that 'input' can be parsed as a Application Group ID diff --git a/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/id_applicationgroup.go b/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/id_applicationgroup.go index e9e2160d2dd..d7f3e3db720 100644 --- a/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/id_applicationgroup.go +++ b/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/id_applicationgroup.go @@ -36,19 +36,9 @@ func ParseApplicationGroupID(input string) (*ApplicationGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGroupId{} - - 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.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseApplicationGroupIDInsensitively(input string) (*ApplicationGroupId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ApplicationGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", *parsed) + if id.ApplicationGroupName, ok = input.Parsed["applicationGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", input) } - return &id, nil + return nil } // ValidateApplicationGroupID checks that 'input' can be parsed as a Application Group ID diff --git a/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/id_desktop.go b/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/id_desktop.go index ddd70187bca..4d5c78a8b53 100644 --- a/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/id_desktop.go +++ b/resource-manager/desktopvirtualization/2021-09-03-preview/desktop/id_desktop.go @@ -38,23 +38,9 @@ func ParseDesktopID(input string) (*DesktopId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DesktopId{} - - 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.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", *parsed) - } - - if id.DesktopName, ok = parsed.Parsed["desktopName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "desktopName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDesktopIDInsensitively(input string) (*DesktopId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DesktopId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DesktopId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", *parsed) + if id.ApplicationGroupName, ok = input.Parsed["applicationGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", input) } - if id.DesktopName, ok = parsed.Parsed["desktopName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "desktopName", *parsed) + if id.DesktopName, ok = input.Parsed["desktopName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "desktopName", input) } - return &id, nil + return nil } // ValidateDesktopID checks that 'input' can be parsed as a Desktop ID diff --git a/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/id_hostpool.go b/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/id_hostpool.go index 152224130b1..aa2786ca0cc 100644 --- a/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/id_hostpool.go +++ b/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool/id_hostpool.go @@ -36,19 +36,9 @@ func ParseHostPoolID(input string) (*HostPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostPoolId{} - - 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.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseHostPoolIDInsensitively(input string) (*HostPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *HostPoolId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if id.HostPoolName, ok = input.Parsed["hostPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", input) } - return &id, nil + return nil } // ValidateHostPoolID checks that 'input' can be parsed as a Host Pool ID diff --git a/resource-manager/desktopvirtualization/2021-09-03-preview/msiximage/id_hostpool.go b/resource-manager/desktopvirtualization/2021-09-03-preview/msiximage/id_hostpool.go index a10a816daa0..079252be8e9 100644 --- a/resource-manager/desktopvirtualization/2021-09-03-preview/msiximage/id_hostpool.go +++ b/resource-manager/desktopvirtualization/2021-09-03-preview/msiximage/id_hostpool.go @@ -36,19 +36,9 @@ func ParseHostPoolID(input string) (*HostPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostPoolId{} - - 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.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseHostPoolIDInsensitively(input string) (*HostPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *HostPoolId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if id.HostPoolName, ok = input.Parsed["hostPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", input) } - return &id, nil + return nil } // ValidateHostPoolID checks that 'input' can be parsed as a Host Pool ID diff --git a/resource-manager/desktopvirtualization/2021-09-03-preview/msixpackage/id_hostpool.go b/resource-manager/desktopvirtualization/2021-09-03-preview/msixpackage/id_hostpool.go index 191f62d2cae..d209a21abca 100644 --- a/resource-manager/desktopvirtualization/2021-09-03-preview/msixpackage/id_hostpool.go +++ b/resource-manager/desktopvirtualization/2021-09-03-preview/msixpackage/id_hostpool.go @@ -36,19 +36,9 @@ func ParseHostPoolID(input string) (*HostPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostPoolId{} - - 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.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseHostPoolIDInsensitively(input string) (*HostPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *HostPoolId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if id.HostPoolName, ok = input.Parsed["hostPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", input) } - return &id, nil + return nil } // ValidateHostPoolID checks that 'input' can be parsed as a Host Pool ID diff --git a/resource-manager/desktopvirtualization/2021-09-03-preview/msixpackage/id_msixpackage.go b/resource-manager/desktopvirtualization/2021-09-03-preview/msixpackage/id_msixpackage.go index 15e2821f6c1..0a5253b9f09 100644 --- a/resource-manager/desktopvirtualization/2021-09-03-preview/msixpackage/id_msixpackage.go +++ b/resource-manager/desktopvirtualization/2021-09-03-preview/msixpackage/id_msixpackage.go @@ -38,23 +38,9 @@ func ParseMsixPackageID(input string) (*MsixPackageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MsixPackageId{} - - 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.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) - } - - if id.MsixPackageName, ok = parsed.Parsed["msixPackageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "msixPackageName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseMsixPackageIDInsensitively(input string) (*MsixPackageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MsixPackageId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *MsixPackageId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if id.HostPoolName, ok = input.Parsed["hostPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", input) } - if id.MsixPackageName, ok = parsed.Parsed["msixPackageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "msixPackageName", *parsed) + if id.MsixPackageName, ok = input.Parsed["msixPackageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "msixPackageName", input) } - return &id, nil + return nil } // ValidateMsixPackageID checks that 'input' can be parsed as a Msix Package ID diff --git a/resource-manager/desktopvirtualization/2021-09-03-preview/privatelink/id_hostpool.go b/resource-manager/desktopvirtualization/2021-09-03-preview/privatelink/id_hostpool.go index 1abd90c4072..83924e96b2a 100644 --- a/resource-manager/desktopvirtualization/2021-09-03-preview/privatelink/id_hostpool.go +++ b/resource-manager/desktopvirtualization/2021-09-03-preview/privatelink/id_hostpool.go @@ -36,19 +36,9 @@ func ParseHostPoolID(input string) (*HostPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostPoolId{} - - 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.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseHostPoolIDInsensitively(input string) (*HostPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *HostPoolId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if id.HostPoolName, ok = input.Parsed["hostPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", input) } - return &id, nil + return nil } // ValidateHostPoolID checks that 'input' can be parsed as a Host Pool ID diff --git a/resource-manager/desktopvirtualization/2021-09-03-preview/privatelink/id_privateendpointconnection.go b/resource-manager/desktopvirtualization/2021-09-03-preview/privatelink/id_privateendpointconnection.go index b0debf67e24..0288db42535 100644 --- a/resource-manager/desktopvirtualization/2021-09-03-preview/privatelink/id_privateendpointconnection.go +++ b/resource-manager/desktopvirtualization/2021-09-03-preview/privatelink/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if id.HostPoolName, ok = input.Parsed["hostPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/desktopvirtualization/2021-09-03-preview/privatelink/id_workspace.go b/resource-manager/desktopvirtualization/2021-09-03-preview/privatelink/id_workspace.go index 762545cce50..91b38f841d1 100644 --- a/resource-manager/desktopvirtualization/2021-09-03-preview/privatelink/id_workspace.go +++ b/resource-manager/desktopvirtualization/2021-09-03-preview/privatelink/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/desktopvirtualization/2021-09-03-preview/privatelink/id_workspaceprivateendpointconnection.go b/resource-manager/desktopvirtualization/2021-09-03-preview/privatelink/id_workspaceprivateendpointconnection.go index ae7385d1c05..afc4bce928e 100644 --- a/resource-manager/desktopvirtualization/2021-09-03-preview/privatelink/id_workspaceprivateendpointconnection.go +++ b/resource-manager/desktopvirtualization/2021-09-03-preview/privatelink/id_workspaceprivateendpointconnection.go @@ -38,23 +38,9 @@ func ParseWorkspacePrivateEndpointConnectionID(input string) (*WorkspacePrivateE return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspacePrivateEndpointConnectionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWorkspacePrivateEndpointConnectionIDInsensitively(input string) (*Work return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspacePrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WorkspacePrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidateWorkspacePrivateEndpointConnectionID checks that 'input' can be parsed as a Workspace Private Endpoint Connection ID diff --git a/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/id_hostpool.go b/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/id_hostpool.go index 2644a463e37..cc5a710488c 100644 --- a/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/id_hostpool.go +++ b/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/id_hostpool.go @@ -36,19 +36,9 @@ func ParseHostPoolID(input string) (*HostPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostPoolId{} - - 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.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseHostPoolIDInsensitively(input string) (*HostPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *HostPoolId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if id.HostPoolName, ok = input.Parsed["hostPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", input) } - return &id, nil + return nil } // ValidateHostPoolID checks that 'input' can be parsed as a Host Pool ID diff --git a/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/id_scalingplan.go b/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/id_scalingplan.go index b887400c4bf..dc5a9ff5468 100644 --- a/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/id_scalingplan.go +++ b/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan/id_scalingplan.go @@ -36,19 +36,9 @@ func ParseScalingPlanID(input string) (*ScalingPlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScalingPlanId{} - - 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.ScalingPlanName, ok = parsed.Parsed["scalingPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scalingPlanName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseScalingPlanIDInsensitively(input string) (*ScalingPlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScalingPlanId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ScalingPlanId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ScalingPlanName, ok = parsed.Parsed["scalingPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scalingPlanName", *parsed) + if id.ScalingPlanName, ok = input.Parsed["scalingPlanName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scalingPlanName", input) } - return &id, nil + return nil } // ValidateScalingPlanID checks that 'input' can be parsed as a Scaling Plan ID diff --git a/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/id_hostpool.go b/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/id_hostpool.go index 368c87025ad..f03ed7ff217 100644 --- a/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/id_hostpool.go +++ b/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/id_hostpool.go @@ -36,19 +36,9 @@ func ParseHostPoolID(input string) (*HostPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostPoolId{} - - 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.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseHostPoolIDInsensitively(input string) (*HostPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *HostPoolId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if id.HostPoolName, ok = input.Parsed["hostPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", input) } - return &id, nil + return nil } // ValidateHostPoolID checks that 'input' can be parsed as a Host Pool ID diff --git a/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/id_sessionhost.go b/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/id_sessionhost.go index ef439b473cc..b35ccefa84c 100644 --- a/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/id_sessionhost.go +++ b/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost/id_sessionhost.go @@ -38,23 +38,9 @@ func ParseSessionHostID(input string) (*SessionHostId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SessionHostId{} - - 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.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) - } - - if id.SessionHostName, ok = parsed.Parsed["sessionHostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sessionHostName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSessionHostIDInsensitively(input string) (*SessionHostId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SessionHostId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SessionHostId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if id.HostPoolName, ok = input.Parsed["hostPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", input) } - if id.SessionHostName, ok = parsed.Parsed["sessionHostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sessionHostName", *parsed) + if id.SessionHostName, ok = input.Parsed["sessionHostName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sessionHostName", input) } - return &id, nil + return nil } // ValidateSessionHostID checks that 'input' can be parsed as a Session Host ID diff --git a/resource-manager/desktopvirtualization/2021-09-03-preview/startmenuitem/id_applicationgroup.go b/resource-manager/desktopvirtualization/2021-09-03-preview/startmenuitem/id_applicationgroup.go index ab80fc966b1..0a06e5cea09 100644 --- a/resource-manager/desktopvirtualization/2021-09-03-preview/startmenuitem/id_applicationgroup.go +++ b/resource-manager/desktopvirtualization/2021-09-03-preview/startmenuitem/id_applicationgroup.go @@ -36,19 +36,9 @@ func ParseApplicationGroupID(input string) (*ApplicationGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGroupId{} - - 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.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseApplicationGroupIDInsensitively(input string) (*ApplicationGroupId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ApplicationGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", *parsed) + if id.ApplicationGroupName, ok = input.Parsed["applicationGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", input) } - return &id, nil + return nil } // ValidateApplicationGroupID checks that 'input' can be parsed as a Application Group ID diff --git a/resource-manager/desktopvirtualization/2021-09-03-preview/usersession/id_hostpool.go b/resource-manager/desktopvirtualization/2021-09-03-preview/usersession/id_hostpool.go index c63729cc9c0..3a6226c2261 100644 --- a/resource-manager/desktopvirtualization/2021-09-03-preview/usersession/id_hostpool.go +++ b/resource-manager/desktopvirtualization/2021-09-03-preview/usersession/id_hostpool.go @@ -36,19 +36,9 @@ func ParseHostPoolID(input string) (*HostPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostPoolId{} - - 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.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseHostPoolIDInsensitively(input string) (*HostPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *HostPoolId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if id.HostPoolName, ok = input.Parsed["hostPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", input) } - return &id, nil + return nil } // ValidateHostPoolID checks that 'input' can be parsed as a Host Pool ID diff --git a/resource-manager/desktopvirtualization/2021-09-03-preview/usersession/id_sessionhost.go b/resource-manager/desktopvirtualization/2021-09-03-preview/usersession/id_sessionhost.go index 6944bc3c66b..afc2e448543 100644 --- a/resource-manager/desktopvirtualization/2021-09-03-preview/usersession/id_sessionhost.go +++ b/resource-manager/desktopvirtualization/2021-09-03-preview/usersession/id_sessionhost.go @@ -38,23 +38,9 @@ func ParseSessionHostID(input string) (*SessionHostId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SessionHostId{} - - 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.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) - } - - if id.SessionHostName, ok = parsed.Parsed["sessionHostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sessionHostName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSessionHostIDInsensitively(input string) (*SessionHostId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SessionHostId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SessionHostId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if id.HostPoolName, ok = input.Parsed["hostPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", input) } - if id.SessionHostName, ok = parsed.Parsed["sessionHostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sessionHostName", *parsed) + if id.SessionHostName, ok = input.Parsed["sessionHostName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sessionHostName", input) } - return &id, nil + return nil } // ValidateSessionHostID checks that 'input' can be parsed as a Session Host ID diff --git a/resource-manager/desktopvirtualization/2021-09-03-preview/usersession/id_usersession.go b/resource-manager/desktopvirtualization/2021-09-03-preview/usersession/id_usersession.go index df6a3f8b0d0..3dae51b064e 100644 --- a/resource-manager/desktopvirtualization/2021-09-03-preview/usersession/id_usersession.go +++ b/resource-manager/desktopvirtualization/2021-09-03-preview/usersession/id_usersession.go @@ -40,27 +40,9 @@ func ParseUserSessionID(input string) (*UserSessionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserSessionId{} - - 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.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) - } - - if id.SessionHostName, ok = parsed.Parsed["sessionHostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sessionHostName", *parsed) - } - - if id.UserSessionId, ok = parsed.Parsed["userSessionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userSessionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseUserSessionIDInsensitively(input string) (*UserSessionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserSessionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *UserSessionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if id.HostPoolName, ok = input.Parsed["hostPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", input) } - if id.SessionHostName, ok = parsed.Parsed["sessionHostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sessionHostName", *parsed) + if id.SessionHostName, ok = input.Parsed["sessionHostName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sessionHostName", input) } - if id.UserSessionId, ok = parsed.Parsed["userSessionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userSessionId", *parsed) + if id.UserSessionId, ok = input.Parsed["userSessionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userSessionId", input) } - return &id, nil + return nil } // ValidateUserSessionID checks that 'input' can be parsed as a User Session ID diff --git a/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/id_workspace.go b/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/id_workspace.go index 2512237f2a5..f9627529933 100644 --- a/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/id_workspace.go +++ b/resource-manager/desktopvirtualization/2021-09-03-preview/workspace/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/desktopvirtualization/2022-02-10-preview/application/id_application.go b/resource-manager/desktopvirtualization/2022-02-10-preview/application/id_application.go index 17c0d9e28f3..3b7ffbaa107 100644 --- a/resource-manager/desktopvirtualization/2022-02-10-preview/application/id_application.go +++ b/resource-manager/desktopvirtualization/2022-02-10-preview/application/id_application.go @@ -38,23 +38,9 @@ func ParseApplicationID(input string) (*ApplicationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationId{} - - 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.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", *parsed) - } - - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApplicationIDInsensitively(input string) (*ApplicationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApplicationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", *parsed) + if id.ApplicationGroupName, ok = input.Parsed["applicationGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", input) } - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) + if id.ApplicationName, ok = input.Parsed["applicationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationName", input) } - return &id, nil + return nil } // ValidateApplicationID checks that 'input' can be parsed as a Application ID diff --git a/resource-manager/desktopvirtualization/2022-02-10-preview/application/id_applicationgroup.go b/resource-manager/desktopvirtualization/2022-02-10-preview/application/id_applicationgroup.go index c08ebfa9f68..914b1c118c7 100644 --- a/resource-manager/desktopvirtualization/2022-02-10-preview/application/id_applicationgroup.go +++ b/resource-manager/desktopvirtualization/2022-02-10-preview/application/id_applicationgroup.go @@ -36,19 +36,9 @@ func ParseApplicationGroupID(input string) (*ApplicationGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGroupId{} - - 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.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseApplicationGroupIDInsensitively(input string) (*ApplicationGroupId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ApplicationGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", *parsed) + if id.ApplicationGroupName, ok = input.Parsed["applicationGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", input) } - return &id, nil + return nil } // ValidateApplicationGroupID checks that 'input' can be parsed as a Application Group ID diff --git a/resource-manager/desktopvirtualization/2022-02-10-preview/applicationgroup/id_applicationgroup.go b/resource-manager/desktopvirtualization/2022-02-10-preview/applicationgroup/id_applicationgroup.go index 763845e0e9b..6637983e581 100644 --- a/resource-manager/desktopvirtualization/2022-02-10-preview/applicationgroup/id_applicationgroup.go +++ b/resource-manager/desktopvirtualization/2022-02-10-preview/applicationgroup/id_applicationgroup.go @@ -36,19 +36,9 @@ func ParseApplicationGroupID(input string) (*ApplicationGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGroupId{} - - 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.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseApplicationGroupIDInsensitively(input string) (*ApplicationGroupId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ApplicationGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", *parsed) + if id.ApplicationGroupName, ok = input.Parsed["applicationGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", input) } - return &id, nil + return nil } // ValidateApplicationGroupID checks that 'input' can be parsed as a Application Group ID diff --git a/resource-manager/desktopvirtualization/2022-02-10-preview/desktop/id_applicationgroup.go b/resource-manager/desktopvirtualization/2022-02-10-preview/desktop/id_applicationgroup.go index e9e2160d2dd..d7f3e3db720 100644 --- a/resource-manager/desktopvirtualization/2022-02-10-preview/desktop/id_applicationgroup.go +++ b/resource-manager/desktopvirtualization/2022-02-10-preview/desktop/id_applicationgroup.go @@ -36,19 +36,9 @@ func ParseApplicationGroupID(input string) (*ApplicationGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGroupId{} - - 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.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseApplicationGroupIDInsensitively(input string) (*ApplicationGroupId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ApplicationGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", *parsed) + if id.ApplicationGroupName, ok = input.Parsed["applicationGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", input) } - return &id, nil + return nil } // ValidateApplicationGroupID checks that 'input' can be parsed as a Application Group ID diff --git a/resource-manager/desktopvirtualization/2022-02-10-preview/desktop/id_desktop.go b/resource-manager/desktopvirtualization/2022-02-10-preview/desktop/id_desktop.go index ddd70187bca..4d5c78a8b53 100644 --- a/resource-manager/desktopvirtualization/2022-02-10-preview/desktop/id_desktop.go +++ b/resource-manager/desktopvirtualization/2022-02-10-preview/desktop/id_desktop.go @@ -38,23 +38,9 @@ func ParseDesktopID(input string) (*DesktopId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DesktopId{} - - 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.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", *parsed) - } - - if id.DesktopName, ok = parsed.Parsed["desktopName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "desktopName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDesktopIDInsensitively(input string) (*DesktopId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DesktopId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DesktopId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", *parsed) + if id.ApplicationGroupName, ok = input.Parsed["applicationGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", input) } - if id.DesktopName, ok = parsed.Parsed["desktopName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "desktopName", *parsed) + if id.DesktopName, ok = input.Parsed["desktopName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "desktopName", input) } - return &id, nil + return nil } // ValidateDesktopID checks that 'input' can be parsed as a Desktop ID diff --git a/resource-manager/desktopvirtualization/2022-02-10-preview/hostpool/id_hostpool.go b/resource-manager/desktopvirtualization/2022-02-10-preview/hostpool/id_hostpool.go index 152224130b1..aa2786ca0cc 100644 --- a/resource-manager/desktopvirtualization/2022-02-10-preview/hostpool/id_hostpool.go +++ b/resource-manager/desktopvirtualization/2022-02-10-preview/hostpool/id_hostpool.go @@ -36,19 +36,9 @@ func ParseHostPoolID(input string) (*HostPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostPoolId{} - - 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.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseHostPoolIDInsensitively(input string) (*HostPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *HostPoolId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if id.HostPoolName, ok = input.Parsed["hostPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", input) } - return &id, nil + return nil } // ValidateHostPoolID checks that 'input' can be parsed as a Host Pool ID diff --git a/resource-manager/desktopvirtualization/2022-02-10-preview/msiximage/id_hostpool.go b/resource-manager/desktopvirtualization/2022-02-10-preview/msiximage/id_hostpool.go index a10a816daa0..079252be8e9 100644 --- a/resource-manager/desktopvirtualization/2022-02-10-preview/msiximage/id_hostpool.go +++ b/resource-manager/desktopvirtualization/2022-02-10-preview/msiximage/id_hostpool.go @@ -36,19 +36,9 @@ func ParseHostPoolID(input string) (*HostPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostPoolId{} - - 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.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseHostPoolIDInsensitively(input string) (*HostPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *HostPoolId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if id.HostPoolName, ok = input.Parsed["hostPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", input) } - return &id, nil + return nil } // ValidateHostPoolID checks that 'input' can be parsed as a Host Pool ID diff --git a/resource-manager/desktopvirtualization/2022-02-10-preview/msixpackage/id_hostpool.go b/resource-manager/desktopvirtualization/2022-02-10-preview/msixpackage/id_hostpool.go index 191f62d2cae..d209a21abca 100644 --- a/resource-manager/desktopvirtualization/2022-02-10-preview/msixpackage/id_hostpool.go +++ b/resource-manager/desktopvirtualization/2022-02-10-preview/msixpackage/id_hostpool.go @@ -36,19 +36,9 @@ func ParseHostPoolID(input string) (*HostPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostPoolId{} - - 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.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseHostPoolIDInsensitively(input string) (*HostPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *HostPoolId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if id.HostPoolName, ok = input.Parsed["hostPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", input) } - return &id, nil + return nil } // ValidateHostPoolID checks that 'input' can be parsed as a Host Pool ID diff --git a/resource-manager/desktopvirtualization/2022-02-10-preview/msixpackage/id_msixpackage.go b/resource-manager/desktopvirtualization/2022-02-10-preview/msixpackage/id_msixpackage.go index 15e2821f6c1..0a5253b9f09 100644 --- a/resource-manager/desktopvirtualization/2022-02-10-preview/msixpackage/id_msixpackage.go +++ b/resource-manager/desktopvirtualization/2022-02-10-preview/msixpackage/id_msixpackage.go @@ -38,23 +38,9 @@ func ParseMsixPackageID(input string) (*MsixPackageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MsixPackageId{} - - 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.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) - } - - if id.MsixPackageName, ok = parsed.Parsed["msixPackageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "msixPackageName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseMsixPackageIDInsensitively(input string) (*MsixPackageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MsixPackageId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *MsixPackageId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if id.HostPoolName, ok = input.Parsed["hostPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", input) } - if id.MsixPackageName, ok = parsed.Parsed["msixPackageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "msixPackageName", *parsed) + if id.MsixPackageName, ok = input.Parsed["msixPackageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "msixPackageName", input) } - return &id, nil + return nil } // ValidateMsixPackageID checks that 'input' can be parsed as a Msix Package ID diff --git a/resource-manager/desktopvirtualization/2022-02-10-preview/privatelink/id_hostpool.go b/resource-manager/desktopvirtualization/2022-02-10-preview/privatelink/id_hostpool.go index 1abd90c4072..83924e96b2a 100644 --- a/resource-manager/desktopvirtualization/2022-02-10-preview/privatelink/id_hostpool.go +++ b/resource-manager/desktopvirtualization/2022-02-10-preview/privatelink/id_hostpool.go @@ -36,19 +36,9 @@ func ParseHostPoolID(input string) (*HostPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostPoolId{} - - 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.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseHostPoolIDInsensitively(input string) (*HostPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *HostPoolId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if id.HostPoolName, ok = input.Parsed["hostPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", input) } - return &id, nil + return nil } // ValidateHostPoolID checks that 'input' can be parsed as a Host Pool ID diff --git a/resource-manager/desktopvirtualization/2022-02-10-preview/privatelink/id_privateendpointconnection.go b/resource-manager/desktopvirtualization/2022-02-10-preview/privatelink/id_privateendpointconnection.go index b0debf67e24..0288db42535 100644 --- a/resource-manager/desktopvirtualization/2022-02-10-preview/privatelink/id_privateendpointconnection.go +++ b/resource-manager/desktopvirtualization/2022-02-10-preview/privatelink/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if id.HostPoolName, ok = input.Parsed["hostPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/desktopvirtualization/2022-02-10-preview/privatelink/id_workspace.go b/resource-manager/desktopvirtualization/2022-02-10-preview/privatelink/id_workspace.go index 762545cce50..91b38f841d1 100644 --- a/resource-manager/desktopvirtualization/2022-02-10-preview/privatelink/id_workspace.go +++ b/resource-manager/desktopvirtualization/2022-02-10-preview/privatelink/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/desktopvirtualization/2022-02-10-preview/privatelink/id_workspaceprivateendpointconnection.go b/resource-manager/desktopvirtualization/2022-02-10-preview/privatelink/id_workspaceprivateendpointconnection.go index ae7385d1c05..afc4bce928e 100644 --- a/resource-manager/desktopvirtualization/2022-02-10-preview/privatelink/id_workspaceprivateendpointconnection.go +++ b/resource-manager/desktopvirtualization/2022-02-10-preview/privatelink/id_workspaceprivateendpointconnection.go @@ -38,23 +38,9 @@ func ParseWorkspacePrivateEndpointConnectionID(input string) (*WorkspacePrivateE return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspacePrivateEndpointConnectionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWorkspacePrivateEndpointConnectionIDInsensitively(input string) (*Work return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspacePrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WorkspacePrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidateWorkspacePrivateEndpointConnectionID checks that 'input' can be parsed as a Workspace Private Endpoint Connection ID diff --git a/resource-manager/desktopvirtualization/2022-02-10-preview/scalingplan/id_hostpool.go b/resource-manager/desktopvirtualization/2022-02-10-preview/scalingplan/id_hostpool.go index 2644a463e37..cc5a710488c 100644 --- a/resource-manager/desktopvirtualization/2022-02-10-preview/scalingplan/id_hostpool.go +++ b/resource-manager/desktopvirtualization/2022-02-10-preview/scalingplan/id_hostpool.go @@ -36,19 +36,9 @@ func ParseHostPoolID(input string) (*HostPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostPoolId{} - - 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.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseHostPoolIDInsensitively(input string) (*HostPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *HostPoolId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if id.HostPoolName, ok = input.Parsed["hostPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", input) } - return &id, nil + return nil } // ValidateHostPoolID checks that 'input' can be parsed as a Host Pool ID diff --git a/resource-manager/desktopvirtualization/2022-02-10-preview/scalingplan/id_scalingplan.go b/resource-manager/desktopvirtualization/2022-02-10-preview/scalingplan/id_scalingplan.go index b887400c4bf..dc5a9ff5468 100644 --- a/resource-manager/desktopvirtualization/2022-02-10-preview/scalingplan/id_scalingplan.go +++ b/resource-manager/desktopvirtualization/2022-02-10-preview/scalingplan/id_scalingplan.go @@ -36,19 +36,9 @@ func ParseScalingPlanID(input string) (*ScalingPlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScalingPlanId{} - - 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.ScalingPlanName, ok = parsed.Parsed["scalingPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scalingPlanName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseScalingPlanIDInsensitively(input string) (*ScalingPlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScalingPlanId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ScalingPlanId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ScalingPlanName, ok = parsed.Parsed["scalingPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scalingPlanName", *parsed) + if id.ScalingPlanName, ok = input.Parsed["scalingPlanName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scalingPlanName", input) } - return &id, nil + return nil } // ValidateScalingPlanID checks that 'input' can be parsed as a Scaling Plan ID diff --git a/resource-manager/desktopvirtualization/2022-02-10-preview/sessionhost/id_hostpool.go b/resource-manager/desktopvirtualization/2022-02-10-preview/sessionhost/id_hostpool.go index 368c87025ad..f03ed7ff217 100644 --- a/resource-manager/desktopvirtualization/2022-02-10-preview/sessionhost/id_hostpool.go +++ b/resource-manager/desktopvirtualization/2022-02-10-preview/sessionhost/id_hostpool.go @@ -36,19 +36,9 @@ func ParseHostPoolID(input string) (*HostPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostPoolId{} - - 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.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseHostPoolIDInsensitively(input string) (*HostPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *HostPoolId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if id.HostPoolName, ok = input.Parsed["hostPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", input) } - return &id, nil + return nil } // ValidateHostPoolID checks that 'input' can be parsed as a Host Pool ID diff --git a/resource-manager/desktopvirtualization/2022-02-10-preview/sessionhost/id_sessionhost.go b/resource-manager/desktopvirtualization/2022-02-10-preview/sessionhost/id_sessionhost.go index ef439b473cc..b35ccefa84c 100644 --- a/resource-manager/desktopvirtualization/2022-02-10-preview/sessionhost/id_sessionhost.go +++ b/resource-manager/desktopvirtualization/2022-02-10-preview/sessionhost/id_sessionhost.go @@ -38,23 +38,9 @@ func ParseSessionHostID(input string) (*SessionHostId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SessionHostId{} - - 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.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) - } - - if id.SessionHostName, ok = parsed.Parsed["sessionHostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sessionHostName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSessionHostIDInsensitively(input string) (*SessionHostId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SessionHostId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SessionHostId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if id.HostPoolName, ok = input.Parsed["hostPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", input) } - if id.SessionHostName, ok = parsed.Parsed["sessionHostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sessionHostName", *parsed) + if id.SessionHostName, ok = input.Parsed["sessionHostName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sessionHostName", input) } - return &id, nil + return nil } // ValidateSessionHostID checks that 'input' can be parsed as a Session Host ID diff --git a/resource-manager/desktopvirtualization/2022-02-10-preview/startmenuitem/id_applicationgroup.go b/resource-manager/desktopvirtualization/2022-02-10-preview/startmenuitem/id_applicationgroup.go index ab80fc966b1..0a06e5cea09 100644 --- a/resource-manager/desktopvirtualization/2022-02-10-preview/startmenuitem/id_applicationgroup.go +++ b/resource-manager/desktopvirtualization/2022-02-10-preview/startmenuitem/id_applicationgroup.go @@ -36,19 +36,9 @@ func ParseApplicationGroupID(input string) (*ApplicationGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGroupId{} - - 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.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseApplicationGroupIDInsensitively(input string) (*ApplicationGroupId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ApplicationGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", *parsed) + if id.ApplicationGroupName, ok = input.Parsed["applicationGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", input) } - return &id, nil + return nil } // ValidateApplicationGroupID checks that 'input' can be parsed as a Application Group ID diff --git a/resource-manager/desktopvirtualization/2022-02-10-preview/usersession/id_hostpool.go b/resource-manager/desktopvirtualization/2022-02-10-preview/usersession/id_hostpool.go index c63729cc9c0..3a6226c2261 100644 --- a/resource-manager/desktopvirtualization/2022-02-10-preview/usersession/id_hostpool.go +++ b/resource-manager/desktopvirtualization/2022-02-10-preview/usersession/id_hostpool.go @@ -36,19 +36,9 @@ func ParseHostPoolID(input string) (*HostPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostPoolId{} - - 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.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseHostPoolIDInsensitively(input string) (*HostPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *HostPoolId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if id.HostPoolName, ok = input.Parsed["hostPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", input) } - return &id, nil + return nil } // ValidateHostPoolID checks that 'input' can be parsed as a Host Pool ID diff --git a/resource-manager/desktopvirtualization/2022-02-10-preview/usersession/id_sessionhost.go b/resource-manager/desktopvirtualization/2022-02-10-preview/usersession/id_sessionhost.go index 6944bc3c66b..afc2e448543 100644 --- a/resource-manager/desktopvirtualization/2022-02-10-preview/usersession/id_sessionhost.go +++ b/resource-manager/desktopvirtualization/2022-02-10-preview/usersession/id_sessionhost.go @@ -38,23 +38,9 @@ func ParseSessionHostID(input string) (*SessionHostId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SessionHostId{} - - 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.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) - } - - if id.SessionHostName, ok = parsed.Parsed["sessionHostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sessionHostName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSessionHostIDInsensitively(input string) (*SessionHostId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SessionHostId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SessionHostId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if id.HostPoolName, ok = input.Parsed["hostPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", input) } - if id.SessionHostName, ok = parsed.Parsed["sessionHostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sessionHostName", *parsed) + if id.SessionHostName, ok = input.Parsed["sessionHostName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sessionHostName", input) } - return &id, nil + return nil } // ValidateSessionHostID checks that 'input' can be parsed as a Session Host ID diff --git a/resource-manager/desktopvirtualization/2022-02-10-preview/usersession/id_usersession.go b/resource-manager/desktopvirtualization/2022-02-10-preview/usersession/id_usersession.go index df6a3f8b0d0..3dae51b064e 100644 --- a/resource-manager/desktopvirtualization/2022-02-10-preview/usersession/id_usersession.go +++ b/resource-manager/desktopvirtualization/2022-02-10-preview/usersession/id_usersession.go @@ -40,27 +40,9 @@ func ParseUserSessionID(input string) (*UserSessionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserSessionId{} - - 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.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) - } - - if id.SessionHostName, ok = parsed.Parsed["sessionHostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sessionHostName", *parsed) - } - - if id.UserSessionId, ok = parsed.Parsed["userSessionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userSessionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseUserSessionIDInsensitively(input string) (*UserSessionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserSessionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *UserSessionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if id.HostPoolName, ok = input.Parsed["hostPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", input) } - if id.SessionHostName, ok = parsed.Parsed["sessionHostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sessionHostName", *parsed) + if id.SessionHostName, ok = input.Parsed["sessionHostName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sessionHostName", input) } - if id.UserSessionId, ok = parsed.Parsed["userSessionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userSessionId", *parsed) + if id.UserSessionId, ok = input.Parsed["userSessionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userSessionId", input) } - return &id, nil + return nil } // ValidateUserSessionID checks that 'input' can be parsed as a User Session ID diff --git a/resource-manager/desktopvirtualization/2022-02-10-preview/workspace/id_workspace.go b/resource-manager/desktopvirtualization/2022-02-10-preview/workspace/id_workspace.go index 2512237f2a5..f9627529933 100644 --- a/resource-manager/desktopvirtualization/2022-02-10-preview/workspace/id_workspace.go +++ b/resource-manager/desktopvirtualization/2022-02-10-preview/workspace/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/desktopvirtualization/2022-09-09/application/id_application.go b/resource-manager/desktopvirtualization/2022-09-09/application/id_application.go index 17c0d9e28f3..3b7ffbaa107 100644 --- a/resource-manager/desktopvirtualization/2022-09-09/application/id_application.go +++ b/resource-manager/desktopvirtualization/2022-09-09/application/id_application.go @@ -38,23 +38,9 @@ func ParseApplicationID(input string) (*ApplicationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationId{} - - 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.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", *parsed) - } - - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApplicationIDInsensitively(input string) (*ApplicationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApplicationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", *parsed) + if id.ApplicationGroupName, ok = input.Parsed["applicationGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", input) } - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) + if id.ApplicationName, ok = input.Parsed["applicationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationName", input) } - return &id, nil + return nil } // ValidateApplicationID checks that 'input' can be parsed as a Application ID diff --git a/resource-manager/desktopvirtualization/2022-09-09/application/id_applicationgroup.go b/resource-manager/desktopvirtualization/2022-09-09/application/id_applicationgroup.go index c08ebfa9f68..914b1c118c7 100644 --- a/resource-manager/desktopvirtualization/2022-09-09/application/id_applicationgroup.go +++ b/resource-manager/desktopvirtualization/2022-09-09/application/id_applicationgroup.go @@ -36,19 +36,9 @@ func ParseApplicationGroupID(input string) (*ApplicationGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGroupId{} - - 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.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseApplicationGroupIDInsensitively(input string) (*ApplicationGroupId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ApplicationGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", *parsed) + if id.ApplicationGroupName, ok = input.Parsed["applicationGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", input) } - return &id, nil + return nil } // ValidateApplicationGroupID checks that 'input' can be parsed as a Application Group ID diff --git a/resource-manager/desktopvirtualization/2022-09-09/applicationgroup/id_applicationgroup.go b/resource-manager/desktopvirtualization/2022-09-09/applicationgroup/id_applicationgroup.go index 763845e0e9b..6637983e581 100644 --- a/resource-manager/desktopvirtualization/2022-09-09/applicationgroup/id_applicationgroup.go +++ b/resource-manager/desktopvirtualization/2022-09-09/applicationgroup/id_applicationgroup.go @@ -36,19 +36,9 @@ func ParseApplicationGroupID(input string) (*ApplicationGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGroupId{} - - 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.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseApplicationGroupIDInsensitively(input string) (*ApplicationGroupId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ApplicationGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", *parsed) + if id.ApplicationGroupName, ok = input.Parsed["applicationGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", input) } - return &id, nil + return nil } // ValidateApplicationGroupID checks that 'input' can be parsed as a Application Group ID diff --git a/resource-manager/desktopvirtualization/2022-09-09/desktop/id_applicationgroup.go b/resource-manager/desktopvirtualization/2022-09-09/desktop/id_applicationgroup.go index e9e2160d2dd..d7f3e3db720 100644 --- a/resource-manager/desktopvirtualization/2022-09-09/desktop/id_applicationgroup.go +++ b/resource-manager/desktopvirtualization/2022-09-09/desktop/id_applicationgroup.go @@ -36,19 +36,9 @@ func ParseApplicationGroupID(input string) (*ApplicationGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGroupId{} - - 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.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseApplicationGroupIDInsensitively(input string) (*ApplicationGroupId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ApplicationGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", *parsed) + if id.ApplicationGroupName, ok = input.Parsed["applicationGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", input) } - return &id, nil + return nil } // ValidateApplicationGroupID checks that 'input' can be parsed as a Application Group ID diff --git a/resource-manager/desktopvirtualization/2022-09-09/desktop/id_desktop.go b/resource-manager/desktopvirtualization/2022-09-09/desktop/id_desktop.go index ddd70187bca..4d5c78a8b53 100644 --- a/resource-manager/desktopvirtualization/2022-09-09/desktop/id_desktop.go +++ b/resource-manager/desktopvirtualization/2022-09-09/desktop/id_desktop.go @@ -38,23 +38,9 @@ func ParseDesktopID(input string) (*DesktopId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DesktopId{} - - 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.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", *parsed) - } - - if id.DesktopName, ok = parsed.Parsed["desktopName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "desktopName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDesktopIDInsensitively(input string) (*DesktopId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DesktopId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DesktopId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", *parsed) + if id.ApplicationGroupName, ok = input.Parsed["applicationGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", input) } - if id.DesktopName, ok = parsed.Parsed["desktopName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "desktopName", *parsed) + if id.DesktopName, ok = input.Parsed["desktopName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "desktopName", input) } - return &id, nil + return nil } // ValidateDesktopID checks that 'input' can be parsed as a Desktop ID diff --git a/resource-manager/desktopvirtualization/2022-09-09/hostpool/id_hostpool.go b/resource-manager/desktopvirtualization/2022-09-09/hostpool/id_hostpool.go index 152224130b1..aa2786ca0cc 100644 --- a/resource-manager/desktopvirtualization/2022-09-09/hostpool/id_hostpool.go +++ b/resource-manager/desktopvirtualization/2022-09-09/hostpool/id_hostpool.go @@ -36,19 +36,9 @@ func ParseHostPoolID(input string) (*HostPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostPoolId{} - - 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.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseHostPoolIDInsensitively(input string) (*HostPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *HostPoolId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if id.HostPoolName, ok = input.Parsed["hostPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", input) } - return &id, nil + return nil } // ValidateHostPoolID checks that 'input' can be parsed as a Host Pool ID diff --git a/resource-manager/desktopvirtualization/2022-09-09/msiximage/id_hostpool.go b/resource-manager/desktopvirtualization/2022-09-09/msiximage/id_hostpool.go index a10a816daa0..079252be8e9 100644 --- a/resource-manager/desktopvirtualization/2022-09-09/msiximage/id_hostpool.go +++ b/resource-manager/desktopvirtualization/2022-09-09/msiximage/id_hostpool.go @@ -36,19 +36,9 @@ func ParseHostPoolID(input string) (*HostPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostPoolId{} - - 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.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseHostPoolIDInsensitively(input string) (*HostPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *HostPoolId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if id.HostPoolName, ok = input.Parsed["hostPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", input) } - return &id, nil + return nil } // ValidateHostPoolID checks that 'input' can be parsed as a Host Pool ID diff --git a/resource-manager/desktopvirtualization/2022-09-09/msixpackage/id_hostpool.go b/resource-manager/desktopvirtualization/2022-09-09/msixpackage/id_hostpool.go index 191f62d2cae..d209a21abca 100644 --- a/resource-manager/desktopvirtualization/2022-09-09/msixpackage/id_hostpool.go +++ b/resource-manager/desktopvirtualization/2022-09-09/msixpackage/id_hostpool.go @@ -36,19 +36,9 @@ func ParseHostPoolID(input string) (*HostPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostPoolId{} - - 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.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseHostPoolIDInsensitively(input string) (*HostPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *HostPoolId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if id.HostPoolName, ok = input.Parsed["hostPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", input) } - return &id, nil + return nil } // ValidateHostPoolID checks that 'input' can be parsed as a Host Pool ID diff --git a/resource-manager/desktopvirtualization/2022-09-09/msixpackage/id_msixpackage.go b/resource-manager/desktopvirtualization/2022-09-09/msixpackage/id_msixpackage.go index 15e2821f6c1..0a5253b9f09 100644 --- a/resource-manager/desktopvirtualization/2022-09-09/msixpackage/id_msixpackage.go +++ b/resource-manager/desktopvirtualization/2022-09-09/msixpackage/id_msixpackage.go @@ -38,23 +38,9 @@ func ParseMsixPackageID(input string) (*MsixPackageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MsixPackageId{} - - 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.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) - } - - if id.MsixPackageName, ok = parsed.Parsed["msixPackageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "msixPackageName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseMsixPackageIDInsensitively(input string) (*MsixPackageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MsixPackageId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *MsixPackageId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if id.HostPoolName, ok = input.Parsed["hostPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", input) } - if id.MsixPackageName, ok = parsed.Parsed["msixPackageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "msixPackageName", *parsed) + if id.MsixPackageName, ok = input.Parsed["msixPackageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "msixPackageName", input) } - return &id, nil + return nil } // ValidateMsixPackageID checks that 'input' can be parsed as a Msix Package ID diff --git a/resource-manager/desktopvirtualization/2022-09-09/scalingplan/id_hostpool.go b/resource-manager/desktopvirtualization/2022-09-09/scalingplan/id_hostpool.go index 2644a463e37..cc5a710488c 100644 --- a/resource-manager/desktopvirtualization/2022-09-09/scalingplan/id_hostpool.go +++ b/resource-manager/desktopvirtualization/2022-09-09/scalingplan/id_hostpool.go @@ -36,19 +36,9 @@ func ParseHostPoolID(input string) (*HostPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostPoolId{} - - 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.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseHostPoolIDInsensitively(input string) (*HostPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *HostPoolId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if id.HostPoolName, ok = input.Parsed["hostPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", input) } - return &id, nil + return nil } // ValidateHostPoolID checks that 'input' can be parsed as a Host Pool ID diff --git a/resource-manager/desktopvirtualization/2022-09-09/scalingplan/id_scalingplan.go b/resource-manager/desktopvirtualization/2022-09-09/scalingplan/id_scalingplan.go index b887400c4bf..dc5a9ff5468 100644 --- a/resource-manager/desktopvirtualization/2022-09-09/scalingplan/id_scalingplan.go +++ b/resource-manager/desktopvirtualization/2022-09-09/scalingplan/id_scalingplan.go @@ -36,19 +36,9 @@ func ParseScalingPlanID(input string) (*ScalingPlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScalingPlanId{} - - 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.ScalingPlanName, ok = parsed.Parsed["scalingPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scalingPlanName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseScalingPlanIDInsensitively(input string) (*ScalingPlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScalingPlanId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ScalingPlanId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ScalingPlanName, ok = parsed.Parsed["scalingPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scalingPlanName", *parsed) + if id.ScalingPlanName, ok = input.Parsed["scalingPlanName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scalingPlanName", input) } - return &id, nil + return nil } // ValidateScalingPlanID checks that 'input' can be parsed as a Scaling Plan ID diff --git a/resource-manager/desktopvirtualization/2022-09-09/scalingplanpooledschedule/id_pooledschedule.go b/resource-manager/desktopvirtualization/2022-09-09/scalingplanpooledschedule/id_pooledschedule.go index f7c47a028b3..cac21c67943 100644 --- a/resource-manager/desktopvirtualization/2022-09-09/scalingplanpooledschedule/id_pooledschedule.go +++ b/resource-manager/desktopvirtualization/2022-09-09/scalingplanpooledschedule/id_pooledschedule.go @@ -38,23 +38,9 @@ func ParsePooledScheduleID(input string) (*PooledScheduleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PooledScheduleId{} - - 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.ScalingPlanName, ok = parsed.Parsed["scalingPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scalingPlanName", *parsed) - } - - if id.PooledScheduleName, ok = parsed.Parsed["pooledScheduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "pooledScheduleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePooledScheduleIDInsensitively(input string) (*PooledScheduleId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PooledScheduleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PooledScheduleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ScalingPlanName, ok = parsed.Parsed["scalingPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scalingPlanName", *parsed) + if id.ScalingPlanName, ok = input.Parsed["scalingPlanName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scalingPlanName", input) } - if id.PooledScheduleName, ok = parsed.Parsed["pooledScheduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "pooledScheduleName", *parsed) + if id.PooledScheduleName, ok = input.Parsed["pooledScheduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "pooledScheduleName", input) } - return &id, nil + return nil } // ValidatePooledScheduleID checks that 'input' can be parsed as a Pooled Schedule ID diff --git a/resource-manager/desktopvirtualization/2022-09-09/scalingplanpooledschedule/id_scalingplan.go b/resource-manager/desktopvirtualization/2022-09-09/scalingplanpooledschedule/id_scalingplan.go index 2e5ecf8b2e5..3bb40b2715f 100644 --- a/resource-manager/desktopvirtualization/2022-09-09/scalingplanpooledschedule/id_scalingplan.go +++ b/resource-manager/desktopvirtualization/2022-09-09/scalingplanpooledschedule/id_scalingplan.go @@ -36,19 +36,9 @@ func ParseScalingPlanID(input string) (*ScalingPlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScalingPlanId{} - - 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.ScalingPlanName, ok = parsed.Parsed["scalingPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scalingPlanName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseScalingPlanIDInsensitively(input string) (*ScalingPlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScalingPlanId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ScalingPlanId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ScalingPlanName, ok = parsed.Parsed["scalingPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scalingPlanName", *parsed) + if id.ScalingPlanName, ok = input.Parsed["scalingPlanName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scalingPlanName", input) } - return &id, nil + return nil } // ValidateScalingPlanID checks that 'input' can be parsed as a Scaling Plan ID diff --git a/resource-manager/desktopvirtualization/2022-09-09/sessionhost/id_hostpool.go b/resource-manager/desktopvirtualization/2022-09-09/sessionhost/id_hostpool.go index 368c87025ad..f03ed7ff217 100644 --- a/resource-manager/desktopvirtualization/2022-09-09/sessionhost/id_hostpool.go +++ b/resource-manager/desktopvirtualization/2022-09-09/sessionhost/id_hostpool.go @@ -36,19 +36,9 @@ func ParseHostPoolID(input string) (*HostPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostPoolId{} - - 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.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseHostPoolIDInsensitively(input string) (*HostPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *HostPoolId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if id.HostPoolName, ok = input.Parsed["hostPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", input) } - return &id, nil + return nil } // ValidateHostPoolID checks that 'input' can be parsed as a Host Pool ID diff --git a/resource-manager/desktopvirtualization/2022-09-09/sessionhost/id_sessionhost.go b/resource-manager/desktopvirtualization/2022-09-09/sessionhost/id_sessionhost.go index ef439b473cc..b35ccefa84c 100644 --- a/resource-manager/desktopvirtualization/2022-09-09/sessionhost/id_sessionhost.go +++ b/resource-manager/desktopvirtualization/2022-09-09/sessionhost/id_sessionhost.go @@ -38,23 +38,9 @@ func ParseSessionHostID(input string) (*SessionHostId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SessionHostId{} - - 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.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) - } - - if id.SessionHostName, ok = parsed.Parsed["sessionHostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sessionHostName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSessionHostIDInsensitively(input string) (*SessionHostId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SessionHostId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SessionHostId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if id.HostPoolName, ok = input.Parsed["hostPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", input) } - if id.SessionHostName, ok = parsed.Parsed["sessionHostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sessionHostName", *parsed) + if id.SessionHostName, ok = input.Parsed["sessionHostName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sessionHostName", input) } - return &id, nil + return nil } // ValidateSessionHostID checks that 'input' can be parsed as a Session Host ID diff --git a/resource-manager/desktopvirtualization/2022-09-09/startmenuitem/id_applicationgroup.go b/resource-manager/desktopvirtualization/2022-09-09/startmenuitem/id_applicationgroup.go index ab80fc966b1..0a06e5cea09 100644 --- a/resource-manager/desktopvirtualization/2022-09-09/startmenuitem/id_applicationgroup.go +++ b/resource-manager/desktopvirtualization/2022-09-09/startmenuitem/id_applicationgroup.go @@ -36,19 +36,9 @@ func ParseApplicationGroupID(input string) (*ApplicationGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGroupId{} - - 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.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseApplicationGroupIDInsensitively(input string) (*ApplicationGroupId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ApplicationGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", *parsed) + if id.ApplicationGroupName, ok = input.Parsed["applicationGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", input) } - return &id, nil + return nil } // ValidateApplicationGroupID checks that 'input' can be parsed as a Application Group ID diff --git a/resource-manager/desktopvirtualization/2022-09-09/usersession/id_hostpool.go b/resource-manager/desktopvirtualization/2022-09-09/usersession/id_hostpool.go index c63729cc9c0..3a6226c2261 100644 --- a/resource-manager/desktopvirtualization/2022-09-09/usersession/id_hostpool.go +++ b/resource-manager/desktopvirtualization/2022-09-09/usersession/id_hostpool.go @@ -36,19 +36,9 @@ func ParseHostPoolID(input string) (*HostPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostPoolId{} - - 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.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseHostPoolIDInsensitively(input string) (*HostPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *HostPoolId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if id.HostPoolName, ok = input.Parsed["hostPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", input) } - return &id, nil + return nil } // ValidateHostPoolID checks that 'input' can be parsed as a Host Pool ID diff --git a/resource-manager/desktopvirtualization/2022-09-09/usersession/id_sessionhost.go b/resource-manager/desktopvirtualization/2022-09-09/usersession/id_sessionhost.go index 6944bc3c66b..afc2e448543 100644 --- a/resource-manager/desktopvirtualization/2022-09-09/usersession/id_sessionhost.go +++ b/resource-manager/desktopvirtualization/2022-09-09/usersession/id_sessionhost.go @@ -38,23 +38,9 @@ func ParseSessionHostID(input string) (*SessionHostId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SessionHostId{} - - 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.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) - } - - if id.SessionHostName, ok = parsed.Parsed["sessionHostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sessionHostName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSessionHostIDInsensitively(input string) (*SessionHostId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SessionHostId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SessionHostId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if id.HostPoolName, ok = input.Parsed["hostPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", input) } - if id.SessionHostName, ok = parsed.Parsed["sessionHostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sessionHostName", *parsed) + if id.SessionHostName, ok = input.Parsed["sessionHostName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sessionHostName", input) } - return &id, nil + return nil } // ValidateSessionHostID checks that 'input' can be parsed as a Session Host ID diff --git a/resource-manager/desktopvirtualization/2022-09-09/usersession/id_usersession.go b/resource-manager/desktopvirtualization/2022-09-09/usersession/id_usersession.go index df6a3f8b0d0..3dae51b064e 100644 --- a/resource-manager/desktopvirtualization/2022-09-09/usersession/id_usersession.go +++ b/resource-manager/desktopvirtualization/2022-09-09/usersession/id_usersession.go @@ -40,27 +40,9 @@ func ParseUserSessionID(input string) (*UserSessionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserSessionId{} - - 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.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) - } - - if id.SessionHostName, ok = parsed.Parsed["sessionHostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sessionHostName", *parsed) - } - - if id.UserSessionId, ok = parsed.Parsed["userSessionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userSessionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseUserSessionIDInsensitively(input string) (*UserSessionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserSessionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *UserSessionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostPoolName, ok = parsed.Parsed["hostPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", *parsed) + if id.HostPoolName, ok = input.Parsed["hostPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostPoolName", input) } - if id.SessionHostName, ok = parsed.Parsed["sessionHostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sessionHostName", *parsed) + if id.SessionHostName, ok = input.Parsed["sessionHostName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sessionHostName", input) } - if id.UserSessionId, ok = parsed.Parsed["userSessionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userSessionId", *parsed) + if id.UserSessionId, ok = input.Parsed["userSessionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userSessionId", input) } - return &id, nil + return nil } // ValidateUserSessionID checks that 'input' can be parsed as a User Session ID diff --git a/resource-manager/desktopvirtualization/2022-09-09/workspace/id_workspace.go b/resource-manager/desktopvirtualization/2022-09-09/workspace/id_workspace.go index 2512237f2a5..f9627529933 100644 --- a/resource-manager/desktopvirtualization/2022-09-09/workspace/id_workspace.go +++ b/resource-manager/desktopvirtualization/2022-09-09/workspace/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/devcenter/2023-04-01/attachednetworkconnections/id_devcenter.go b/resource-manager/devcenter/2023-04-01/attachednetworkconnections/id_devcenter.go index d10f3198359..384cc44955e 100644 --- a/resource-manager/devcenter/2023-04-01/attachednetworkconnections/id_devcenter.go +++ b/resource-manager/devcenter/2023-04-01/attachednetworkconnections/id_devcenter.go @@ -36,19 +36,9 @@ func ParseDevCenterID(input string) (*DevCenterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DevCenterId{} - - 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.DevCenterName, ok = parsed.Parsed["devCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "devCenterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDevCenterIDInsensitively(input string) (*DevCenterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DevCenterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DevCenterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DevCenterName, ok = parsed.Parsed["devCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "devCenterName", *parsed) + if id.DevCenterName, ok = input.Parsed["devCenterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "devCenterName", input) } - return &id, nil + return nil } // ValidateDevCenterID checks that 'input' can be parsed as a Dev Center ID diff --git a/resource-manager/devcenter/2023-04-01/attachednetworkconnections/id_project.go b/resource-manager/devcenter/2023-04-01/attachednetworkconnections/id_project.go index 6077761c94d..c8d64d345c9 100644 --- a/resource-manager/devcenter/2023-04-01/attachednetworkconnections/id_project.go +++ b/resource-manager/devcenter/2023-04-01/attachednetworkconnections/id_project.go @@ -36,19 +36,9 @@ func ParseProjectID(input string) (*ProjectId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProjectId{} - - 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.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProjectIDInsensitively(input string) (*ProjectId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProjectId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProjectId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - return &id, nil + return nil } // ValidateProjectID checks that 'input' can be parsed as a Project ID diff --git a/resource-manager/devcenter/2023-04-01/catalogs/id_catalog.go b/resource-manager/devcenter/2023-04-01/catalogs/id_catalog.go index 62b73a20d67..748920bbaf2 100644 --- a/resource-manager/devcenter/2023-04-01/catalogs/id_catalog.go +++ b/resource-manager/devcenter/2023-04-01/catalogs/id_catalog.go @@ -38,23 +38,9 @@ func ParseCatalogID(input string) (*CatalogId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CatalogId{} - - 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.DevCenterName, ok = parsed.Parsed["devCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "devCenterName", *parsed) - } - - if id.CatalogName, ok = parsed.Parsed["catalogName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "catalogName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCatalogIDInsensitively(input string) (*CatalogId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CatalogId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CatalogId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DevCenterName, ok = parsed.Parsed["devCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "devCenterName", *parsed) + if id.DevCenterName, ok = input.Parsed["devCenterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "devCenterName", input) } - if id.CatalogName, ok = parsed.Parsed["catalogName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "catalogName", *parsed) + if id.CatalogName, ok = input.Parsed["catalogName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "catalogName", input) } - return &id, nil + return nil } // ValidateCatalogID checks that 'input' can be parsed as a Catalog ID diff --git a/resource-manager/devcenter/2023-04-01/catalogs/id_devcenter.go b/resource-manager/devcenter/2023-04-01/catalogs/id_devcenter.go index 54ac9062aa9..299da2f856a 100644 --- a/resource-manager/devcenter/2023-04-01/catalogs/id_devcenter.go +++ b/resource-manager/devcenter/2023-04-01/catalogs/id_devcenter.go @@ -36,19 +36,9 @@ func ParseDevCenterID(input string) (*DevCenterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DevCenterId{} - - 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.DevCenterName, ok = parsed.Parsed["devCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "devCenterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDevCenterIDInsensitively(input string) (*DevCenterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DevCenterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DevCenterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DevCenterName, ok = parsed.Parsed["devCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "devCenterName", *parsed) + if id.DevCenterName, ok = input.Parsed["devCenterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "devCenterName", input) } - return &id, nil + return nil } // ValidateDevCenterID checks that 'input' can be parsed as a Dev Center ID diff --git a/resource-manager/devcenter/2023-04-01/devboxdefinitions/id_devboxdefinition.go b/resource-manager/devcenter/2023-04-01/devboxdefinitions/id_devboxdefinition.go index 91321892365..9c3cf898d68 100644 --- a/resource-manager/devcenter/2023-04-01/devboxdefinitions/id_devboxdefinition.go +++ b/resource-manager/devcenter/2023-04-01/devboxdefinitions/id_devboxdefinition.go @@ -38,23 +38,9 @@ func ParseDevBoxDefinitionID(input string) (*DevBoxDefinitionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DevBoxDefinitionId{} - - 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.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) - } - - if id.DevBoxDefinitionName, ok = parsed.Parsed["devBoxDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "devBoxDefinitionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDevBoxDefinitionIDInsensitively(input string) (*DevBoxDefinitionId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DevBoxDefinitionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DevBoxDefinitionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - if id.DevBoxDefinitionName, ok = parsed.Parsed["devBoxDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "devBoxDefinitionName", *parsed) + if id.DevBoxDefinitionName, ok = input.Parsed["devBoxDefinitionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "devBoxDefinitionName", input) } - return &id, nil + return nil } // ValidateDevBoxDefinitionID checks that 'input' can be parsed as a Dev Box Definition ID diff --git a/resource-manager/devcenter/2023-04-01/devboxdefinitions/id_devcenter.go b/resource-manager/devcenter/2023-04-01/devboxdefinitions/id_devcenter.go index c571bfdc3dc..3dd2f9b9271 100644 --- a/resource-manager/devcenter/2023-04-01/devboxdefinitions/id_devcenter.go +++ b/resource-manager/devcenter/2023-04-01/devboxdefinitions/id_devcenter.go @@ -36,19 +36,9 @@ func ParseDevCenterID(input string) (*DevCenterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DevCenterId{} - - 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.DevCenterName, ok = parsed.Parsed["devCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "devCenterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDevCenterIDInsensitively(input string) (*DevCenterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DevCenterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DevCenterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DevCenterName, ok = parsed.Parsed["devCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "devCenterName", *parsed) + if id.DevCenterName, ok = input.Parsed["devCenterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "devCenterName", input) } - return &id, nil + return nil } // ValidateDevCenterID checks that 'input' can be parsed as a Dev Center ID diff --git a/resource-manager/devcenter/2023-04-01/devboxdefinitions/id_devcenterdevboxdefinition.go b/resource-manager/devcenter/2023-04-01/devboxdefinitions/id_devcenterdevboxdefinition.go index 917703ae842..7249a567810 100644 --- a/resource-manager/devcenter/2023-04-01/devboxdefinitions/id_devcenterdevboxdefinition.go +++ b/resource-manager/devcenter/2023-04-01/devboxdefinitions/id_devcenterdevboxdefinition.go @@ -38,23 +38,9 @@ func ParseDevCenterDevBoxDefinitionID(input string) (*DevCenterDevBoxDefinitionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DevCenterDevBoxDefinitionId{} - - 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.DevCenterName, ok = parsed.Parsed["devCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "devCenterName", *parsed) - } - - if id.DevBoxDefinitionName, ok = parsed.Parsed["devBoxDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "devBoxDefinitionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDevCenterDevBoxDefinitionIDInsensitively(input string) (*DevCenterDevB return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DevCenterDevBoxDefinitionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DevCenterDevBoxDefinitionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DevCenterName, ok = parsed.Parsed["devCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "devCenterName", *parsed) + if id.DevCenterName, ok = input.Parsed["devCenterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "devCenterName", input) } - if id.DevBoxDefinitionName, ok = parsed.Parsed["devBoxDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "devBoxDefinitionName", *parsed) + if id.DevBoxDefinitionName, ok = input.Parsed["devBoxDefinitionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "devBoxDefinitionName", input) } - return &id, nil + return nil } // ValidateDevCenterDevBoxDefinitionID checks that 'input' can be parsed as a Dev Center Dev Box Definition ID diff --git a/resource-manager/devcenter/2023-04-01/devboxdefinitions/id_project.go b/resource-manager/devcenter/2023-04-01/devboxdefinitions/id_project.go index 5d536974588..0f2dec6c8ff 100644 --- a/resource-manager/devcenter/2023-04-01/devboxdefinitions/id_project.go +++ b/resource-manager/devcenter/2023-04-01/devboxdefinitions/id_project.go @@ -36,19 +36,9 @@ func ParseProjectID(input string) (*ProjectId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProjectId{} - - 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.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProjectIDInsensitively(input string) (*ProjectId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProjectId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProjectId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - return &id, nil + return nil } // ValidateProjectID checks that 'input' can be parsed as a Project ID diff --git a/resource-manager/devcenter/2023-04-01/devcenters/id_devcenter.go b/resource-manager/devcenter/2023-04-01/devcenters/id_devcenter.go index 1eb7247b57e..90ac4f924e7 100644 --- a/resource-manager/devcenter/2023-04-01/devcenters/id_devcenter.go +++ b/resource-manager/devcenter/2023-04-01/devcenters/id_devcenter.go @@ -36,19 +36,9 @@ func ParseDevCenterID(input string) (*DevCenterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DevCenterId{} - - 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.DevCenterName, ok = parsed.Parsed["devCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "devCenterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDevCenterIDInsensitively(input string) (*DevCenterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DevCenterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DevCenterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DevCenterName, ok = parsed.Parsed["devCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "devCenterName", *parsed) + if id.DevCenterName, ok = input.Parsed["devCenterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "devCenterName", input) } - return &id, nil + return nil } // ValidateDevCenterID checks that 'input' can be parsed as a Dev Center ID diff --git a/resource-manager/devcenter/2023-04-01/environmenttypes/id_allowedenvironmenttype.go b/resource-manager/devcenter/2023-04-01/environmenttypes/id_allowedenvironmenttype.go index 75209a71179..9f2897f9297 100644 --- a/resource-manager/devcenter/2023-04-01/environmenttypes/id_allowedenvironmenttype.go +++ b/resource-manager/devcenter/2023-04-01/environmenttypes/id_allowedenvironmenttype.go @@ -38,23 +38,9 @@ func ParseAllowedEnvironmentTypeID(input string) (*AllowedEnvironmentTypeId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AllowedEnvironmentTypeId{} - - 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.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) - } - - if id.AllowedEnvironmentTypeName, ok = parsed.Parsed["allowedEnvironmentTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "allowedEnvironmentTypeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAllowedEnvironmentTypeIDInsensitively(input string) (*AllowedEnvironme return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AllowedEnvironmentTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AllowedEnvironmentTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - if id.AllowedEnvironmentTypeName, ok = parsed.Parsed["allowedEnvironmentTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "allowedEnvironmentTypeName", *parsed) + if id.AllowedEnvironmentTypeName, ok = input.Parsed["allowedEnvironmentTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "allowedEnvironmentTypeName", input) } - return &id, nil + return nil } // ValidateAllowedEnvironmentTypeID checks that 'input' can be parsed as a Allowed Environment Type ID diff --git a/resource-manager/devcenter/2023-04-01/environmenttypes/id_devcenter.go b/resource-manager/devcenter/2023-04-01/environmenttypes/id_devcenter.go index 999d24e1139..fd8b312fef8 100644 --- a/resource-manager/devcenter/2023-04-01/environmenttypes/id_devcenter.go +++ b/resource-manager/devcenter/2023-04-01/environmenttypes/id_devcenter.go @@ -36,19 +36,9 @@ func ParseDevCenterID(input string) (*DevCenterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DevCenterId{} - - 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.DevCenterName, ok = parsed.Parsed["devCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "devCenterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDevCenterIDInsensitively(input string) (*DevCenterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DevCenterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DevCenterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DevCenterName, ok = parsed.Parsed["devCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "devCenterName", *parsed) + if id.DevCenterName, ok = input.Parsed["devCenterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "devCenterName", input) } - return &id, nil + return nil } // ValidateDevCenterID checks that 'input' can be parsed as a Dev Center ID diff --git a/resource-manager/devcenter/2023-04-01/environmenttypes/id_devcenterenvironmenttype.go b/resource-manager/devcenter/2023-04-01/environmenttypes/id_devcenterenvironmenttype.go index 47d83c11e81..c3a479242cc 100644 --- a/resource-manager/devcenter/2023-04-01/environmenttypes/id_devcenterenvironmenttype.go +++ b/resource-manager/devcenter/2023-04-01/environmenttypes/id_devcenterenvironmenttype.go @@ -38,23 +38,9 @@ func ParseDevCenterEnvironmentTypeID(input string) (*DevCenterEnvironmentTypeId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DevCenterEnvironmentTypeId{} - - 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.DevCenterName, ok = parsed.Parsed["devCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "devCenterName", *parsed) - } - - if id.EnvironmentTypeName, ok = parsed.Parsed["environmentTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentTypeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDevCenterEnvironmentTypeIDInsensitively(input string) (*DevCenterEnvir return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DevCenterEnvironmentTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DevCenterEnvironmentTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DevCenterName, ok = parsed.Parsed["devCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "devCenterName", *parsed) + if id.DevCenterName, ok = input.Parsed["devCenterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "devCenterName", input) } - if id.EnvironmentTypeName, ok = parsed.Parsed["environmentTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentTypeName", *parsed) + if id.EnvironmentTypeName, ok = input.Parsed["environmentTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "environmentTypeName", input) } - return &id, nil + return nil } // ValidateDevCenterEnvironmentTypeID checks that 'input' can be parsed as a Dev Center Environment Type ID diff --git a/resource-manager/devcenter/2023-04-01/environmenttypes/id_environmenttype.go b/resource-manager/devcenter/2023-04-01/environmenttypes/id_environmenttype.go index 6c54f398082..4e4d4e1be5f 100644 --- a/resource-manager/devcenter/2023-04-01/environmenttypes/id_environmenttype.go +++ b/resource-manager/devcenter/2023-04-01/environmenttypes/id_environmenttype.go @@ -38,23 +38,9 @@ func ParseEnvironmentTypeID(input string) (*EnvironmentTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentTypeId{} - - 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.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) - } - - if id.EnvironmentTypeName, ok = parsed.Parsed["environmentTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentTypeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseEnvironmentTypeIDInsensitively(input string) (*EnvironmentTypeId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EnvironmentTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - if id.EnvironmentTypeName, ok = parsed.Parsed["environmentTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentTypeName", *parsed) + if id.EnvironmentTypeName, ok = input.Parsed["environmentTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "environmentTypeName", input) } - return &id, nil + return nil } // ValidateEnvironmentTypeID checks that 'input' can be parsed as a Environment Type ID diff --git a/resource-manager/devcenter/2023-04-01/environmenttypes/id_project.go b/resource-manager/devcenter/2023-04-01/environmenttypes/id_project.go index 43521e3430f..20f5d24e5a8 100644 --- a/resource-manager/devcenter/2023-04-01/environmenttypes/id_project.go +++ b/resource-manager/devcenter/2023-04-01/environmenttypes/id_project.go @@ -36,19 +36,9 @@ func ParseProjectID(input string) (*ProjectId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProjectId{} - - 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.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProjectIDInsensitively(input string) (*ProjectId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProjectId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProjectId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - return &id, nil + return nil } // ValidateProjectID checks that 'input' can be parsed as a Project ID diff --git a/resource-manager/devcenter/2023-04-01/galleries/id_devcenter.go b/resource-manager/devcenter/2023-04-01/galleries/id_devcenter.go index 03b7882c490..02da15d02a4 100644 --- a/resource-manager/devcenter/2023-04-01/galleries/id_devcenter.go +++ b/resource-manager/devcenter/2023-04-01/galleries/id_devcenter.go @@ -36,19 +36,9 @@ func ParseDevCenterID(input string) (*DevCenterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DevCenterId{} - - 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.DevCenterName, ok = parsed.Parsed["devCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "devCenterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDevCenterIDInsensitively(input string) (*DevCenterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DevCenterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DevCenterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DevCenterName, ok = parsed.Parsed["devCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "devCenterName", *parsed) + if id.DevCenterName, ok = input.Parsed["devCenterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "devCenterName", input) } - return &id, nil + return nil } // ValidateDevCenterID checks that 'input' can be parsed as a Dev Center ID diff --git a/resource-manager/devcenter/2023-04-01/galleries/id_gallery.go b/resource-manager/devcenter/2023-04-01/galleries/id_gallery.go index 10248bcc2b6..e1068fdd6ae 100644 --- a/resource-manager/devcenter/2023-04-01/galleries/id_gallery.go +++ b/resource-manager/devcenter/2023-04-01/galleries/id_gallery.go @@ -38,23 +38,9 @@ func ParseGalleryID(input string) (*GalleryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GalleryId{} - - 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.DevCenterName, ok = parsed.Parsed["devCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "devCenterName", *parsed) - } - - if id.GalleryName, ok = parsed.Parsed["galleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "galleryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGalleryIDInsensitively(input string) (*GalleryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GalleryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GalleryId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DevCenterName, ok = parsed.Parsed["devCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "devCenterName", *parsed) + if id.DevCenterName, ok = input.Parsed["devCenterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "devCenterName", input) } - if id.GalleryName, ok = parsed.Parsed["galleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "galleryName", *parsed) + if id.GalleryName, ok = input.Parsed["galleryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "galleryName", input) } - return &id, nil + return nil } // ValidateGalleryID checks that 'input' can be parsed as a Gallery ID diff --git a/resource-manager/devcenter/2023-04-01/images/id_devcenter.go b/resource-manager/devcenter/2023-04-01/images/id_devcenter.go index ae656ee6b8c..95d75862b60 100644 --- a/resource-manager/devcenter/2023-04-01/images/id_devcenter.go +++ b/resource-manager/devcenter/2023-04-01/images/id_devcenter.go @@ -36,19 +36,9 @@ func ParseDevCenterID(input string) (*DevCenterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DevCenterId{} - - 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.DevCenterName, ok = parsed.Parsed["devCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "devCenterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDevCenterIDInsensitively(input string) (*DevCenterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DevCenterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DevCenterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DevCenterName, ok = parsed.Parsed["devCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "devCenterName", *parsed) + if id.DevCenterName, ok = input.Parsed["devCenterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "devCenterName", input) } - return &id, nil + return nil } // ValidateDevCenterID checks that 'input' can be parsed as a Dev Center ID diff --git a/resource-manager/devcenter/2023-04-01/images/id_gallery.go b/resource-manager/devcenter/2023-04-01/images/id_gallery.go index 87dac792f9e..b1e324077c1 100644 --- a/resource-manager/devcenter/2023-04-01/images/id_gallery.go +++ b/resource-manager/devcenter/2023-04-01/images/id_gallery.go @@ -38,23 +38,9 @@ func ParseGalleryID(input string) (*GalleryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GalleryId{} - - 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.DevCenterName, ok = parsed.Parsed["devCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "devCenterName", *parsed) - } - - if id.GalleryName, ok = parsed.Parsed["galleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "galleryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGalleryIDInsensitively(input string) (*GalleryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GalleryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GalleryId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DevCenterName, ok = parsed.Parsed["devCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "devCenterName", *parsed) + if id.DevCenterName, ok = input.Parsed["devCenterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "devCenterName", input) } - if id.GalleryName, ok = parsed.Parsed["galleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "galleryName", *parsed) + if id.GalleryName, ok = input.Parsed["galleryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "galleryName", input) } - return &id, nil + return nil } // ValidateGalleryID checks that 'input' can be parsed as a Gallery ID diff --git a/resource-manager/devcenter/2023-04-01/images/id_image.go b/resource-manager/devcenter/2023-04-01/images/id_image.go index de29160d74e..4d1a46e1238 100644 --- a/resource-manager/devcenter/2023-04-01/images/id_image.go +++ b/resource-manager/devcenter/2023-04-01/images/id_image.go @@ -40,27 +40,9 @@ func ParseImageID(input string) (*ImageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ImageId{} - - 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.DevCenterName, ok = parsed.Parsed["devCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "devCenterName", *parsed) - } - - if id.GalleryName, ok = parsed.Parsed["galleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "galleryName", *parsed) - } - - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseImageIDInsensitively(input string) (*ImageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ImageId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ImageId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DevCenterName, ok = parsed.Parsed["devCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "devCenterName", *parsed) + if id.DevCenterName, ok = input.Parsed["devCenterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "devCenterName", input) } - if id.GalleryName, ok = parsed.Parsed["galleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "galleryName", *parsed) + if id.GalleryName, ok = input.Parsed["galleryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "galleryName", input) } - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) + if id.ImageName, ok = input.Parsed["imageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "imageName", input) } - return &id, nil + return nil } // ValidateImageID checks that 'input' can be parsed as a Image ID diff --git a/resource-manager/devcenter/2023-04-01/imageversions/id_image.go b/resource-manager/devcenter/2023-04-01/imageversions/id_image.go index fdb553f931c..c5810d02b1b 100644 --- a/resource-manager/devcenter/2023-04-01/imageversions/id_image.go +++ b/resource-manager/devcenter/2023-04-01/imageversions/id_image.go @@ -40,27 +40,9 @@ func ParseImageID(input string) (*ImageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ImageId{} - - 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.DevCenterName, ok = parsed.Parsed["devCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "devCenterName", *parsed) - } - - if id.GalleryName, ok = parsed.Parsed["galleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "galleryName", *parsed) - } - - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseImageIDInsensitively(input string) (*ImageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ImageId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ImageId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DevCenterName, ok = parsed.Parsed["devCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "devCenterName", *parsed) + if id.DevCenterName, ok = input.Parsed["devCenterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "devCenterName", input) } - if id.GalleryName, ok = parsed.Parsed["galleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "galleryName", *parsed) + if id.GalleryName, ok = input.Parsed["galleryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "galleryName", input) } - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) + if id.ImageName, ok = input.Parsed["imageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "imageName", input) } - return &id, nil + return nil } // ValidateImageID checks that 'input' can be parsed as a Image ID diff --git a/resource-manager/devcenter/2023-04-01/imageversions/id_version.go b/resource-manager/devcenter/2023-04-01/imageversions/id_version.go index 534c86d9c16..745c1a4a0d1 100644 --- a/resource-manager/devcenter/2023-04-01/imageversions/id_version.go +++ b/resource-manager/devcenter/2023-04-01/imageversions/id_version.go @@ -42,31 +42,9 @@ func ParseVersionID(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} - - 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.DevCenterName, ok = parsed.Parsed["devCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "devCenterName", *parsed) - } - - if id.GalleryName, ok = parsed.Parsed["galleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "galleryName", *parsed) - } - - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseVersionIDInsensitively(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DevCenterName, ok = parsed.Parsed["devCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "devCenterName", *parsed) + if id.DevCenterName, ok = input.Parsed["devCenterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "devCenterName", input) } - if id.GalleryName, ok = parsed.Parsed["galleryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "galleryName", *parsed) + if id.GalleryName, ok = input.Parsed["galleryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "galleryName", input) } - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) + if id.ImageName, ok = input.Parsed["imageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "imageName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateVersionID checks that 'input' can be parsed as a Version ID diff --git a/resource-manager/devcenter/2023-04-01/networkconnection/id_networkconnection.go b/resource-manager/devcenter/2023-04-01/networkconnection/id_networkconnection.go index 93a5d77141a..14613880827 100644 --- a/resource-manager/devcenter/2023-04-01/networkconnection/id_networkconnection.go +++ b/resource-manager/devcenter/2023-04-01/networkconnection/id_networkconnection.go @@ -36,19 +36,9 @@ func ParseNetworkConnectionID(input string) (*NetworkConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkConnectionId{} - - 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.NetworkConnectionName, ok = parsed.Parsed["networkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkConnectionIDInsensitively(input string) (*NetworkConnectionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkConnectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkConnectionName, ok = parsed.Parsed["networkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkConnectionName", *parsed) + if id.NetworkConnectionName, ok = input.Parsed["networkConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkConnectionName", input) } - return &id, nil + return nil } // ValidateNetworkConnectionID checks that 'input' can be parsed as a Network Connection ID diff --git a/resource-manager/devcenter/2023-04-01/networkconnections/id_networkconnection.go b/resource-manager/devcenter/2023-04-01/networkconnections/id_networkconnection.go index 435f2eeccbb..8730bbb9c6a 100644 --- a/resource-manager/devcenter/2023-04-01/networkconnections/id_networkconnection.go +++ b/resource-manager/devcenter/2023-04-01/networkconnections/id_networkconnection.go @@ -36,19 +36,9 @@ func ParseNetworkConnectionID(input string) (*NetworkConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkConnectionId{} - - 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.NetworkConnectionName, ok = parsed.Parsed["networkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkConnectionIDInsensitively(input string) (*NetworkConnectionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkConnectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkConnectionName, ok = parsed.Parsed["networkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkConnectionName", *parsed) + if id.NetworkConnectionName, ok = input.Parsed["networkConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkConnectionName", input) } - return &id, nil + return nil } // ValidateNetworkConnectionID checks that 'input' can be parsed as a Network Connection ID diff --git a/resource-manager/devcenter/2023-04-01/pools/id_pool.go b/resource-manager/devcenter/2023-04-01/pools/id_pool.go index b20ae1e3519..383968aa902 100644 --- a/resource-manager/devcenter/2023-04-01/pools/id_pool.go +++ b/resource-manager/devcenter/2023-04-01/pools/id_pool.go @@ -38,23 +38,9 @@ func ParsePoolID(input string) (*PoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PoolId{} - - 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.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) - } - - if id.PoolName, ok = parsed.Parsed["poolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "poolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePoolIDInsensitively(input string) (*PoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PoolId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - if id.PoolName, ok = parsed.Parsed["poolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "poolName", *parsed) + if id.PoolName, ok = input.Parsed["poolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "poolName", input) } - return &id, nil + return nil } // ValidatePoolID checks that 'input' can be parsed as a Pool ID diff --git a/resource-manager/devcenter/2023-04-01/pools/id_project.go b/resource-manager/devcenter/2023-04-01/pools/id_project.go index 2743f7304c1..5d850ddf812 100644 --- a/resource-manager/devcenter/2023-04-01/pools/id_project.go +++ b/resource-manager/devcenter/2023-04-01/pools/id_project.go @@ -36,19 +36,9 @@ func ParseProjectID(input string) (*ProjectId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProjectId{} - - 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.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProjectIDInsensitively(input string) (*ProjectId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProjectId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProjectId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - return &id, nil + return nil } // ValidateProjectID checks that 'input' can be parsed as a Project ID diff --git a/resource-manager/devcenter/2023-04-01/projects/id_project.go b/resource-manager/devcenter/2023-04-01/projects/id_project.go index cb3d588b599..196652951df 100644 --- a/resource-manager/devcenter/2023-04-01/projects/id_project.go +++ b/resource-manager/devcenter/2023-04-01/projects/id_project.go @@ -36,19 +36,9 @@ func ParseProjectID(input string) (*ProjectId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProjectId{} - - 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.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProjectIDInsensitively(input string) (*ProjectId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProjectId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProjectId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - return &id, nil + return nil } // ValidateProjectID checks that 'input' can be parsed as a Project ID diff --git a/resource-manager/devcenter/2023-04-01/schedules/id_pool.go b/resource-manager/devcenter/2023-04-01/schedules/id_pool.go index dd060649a21..9db8c01e57a 100644 --- a/resource-manager/devcenter/2023-04-01/schedules/id_pool.go +++ b/resource-manager/devcenter/2023-04-01/schedules/id_pool.go @@ -38,23 +38,9 @@ func ParsePoolID(input string) (*PoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PoolId{} - - 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.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) - } - - if id.PoolName, ok = parsed.Parsed["poolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "poolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePoolIDInsensitively(input string) (*PoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PoolId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - if id.PoolName, ok = parsed.Parsed["poolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "poolName", *parsed) + if id.PoolName, ok = input.Parsed["poolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "poolName", input) } - return &id, nil + return nil } // ValidatePoolID checks that 'input' can be parsed as a Pool ID diff --git a/resource-manager/devcenter/2023-04-01/schedules/id_schedule.go b/resource-manager/devcenter/2023-04-01/schedules/id_schedule.go index ba6137f557c..7b5649ee4f6 100644 --- a/resource-manager/devcenter/2023-04-01/schedules/id_schedule.go +++ b/resource-manager/devcenter/2023-04-01/schedules/id_schedule.go @@ -40,27 +40,9 @@ func ParseScheduleID(input string) (*ScheduleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScheduleId{} - - 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.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) - } - - if id.PoolName, ok = parsed.Parsed["poolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "poolName", *parsed) - } - - if id.ScheduleName, ok = parsed.Parsed["scheduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseScheduleIDInsensitively(input string) (*ScheduleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScheduleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ScheduleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - if id.PoolName, ok = parsed.Parsed["poolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "poolName", *parsed) + if id.PoolName, ok = input.Parsed["poolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "poolName", input) } - if id.ScheduleName, ok = parsed.Parsed["scheduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", *parsed) + if id.ScheduleName, ok = input.Parsed["scheduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", input) } - return &id, nil + return nil } // ValidateScheduleID checks that 'input' can be parsed as a Schedule ID diff --git a/resource-manager/devcenter/2023-04-01/usages/id_location.go b/resource-manager/devcenter/2023-04-01/usages/id_location.go index 8dc59d59501..f012f63156e 100644 --- a/resource-manager/devcenter/2023-04-01/usages/id_location.go +++ b/resource-manager/devcenter/2023-04-01/usages/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/deviceprovisioningservices/2022-02-05/dpscertificate/id_certificate.go b/resource-manager/deviceprovisioningservices/2022-02-05/dpscertificate/id_certificate.go index eecb3831c49..13a77c09e66 100644 --- a/resource-manager/deviceprovisioningservices/2022-02-05/dpscertificate/id_certificate.go +++ b/resource-manager/deviceprovisioningservices/2022-02-05/dpscertificate/id_certificate.go @@ -38,23 +38,9 @@ func ParseCertificateID(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} - - 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.ProvisioningServiceName, ok = parsed.Parsed["provisioningServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "provisioningServiceName", *parsed) - } - - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCertificateIDInsensitively(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ProvisioningServiceName, ok = parsed.Parsed["provisioningServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "provisioningServiceName", *parsed) + if id.ProvisioningServiceName, ok = input.Parsed["provisioningServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "provisioningServiceName", input) } - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if id.CertificateName, ok = input.Parsed["certificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateName", input) } - return &id, nil + return nil } // ValidateCertificateID checks that 'input' can be parsed as a Certificate ID diff --git a/resource-manager/deviceprovisioningservices/2022-02-05/iotdpsresource/id_key.go b/resource-manager/deviceprovisioningservices/2022-02-05/iotdpsresource/id_key.go index 6a03e2b99b1..968fce9f20e 100644 --- a/resource-manager/deviceprovisioningservices/2022-02-05/iotdpsresource/id_key.go +++ b/resource-manager/deviceprovisioningservices/2022-02-05/iotdpsresource/id_key.go @@ -38,23 +38,9 @@ func ParseKeyID(input string) (*KeyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := KeyId{} - - 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.ProvisioningServiceName, ok = parsed.Parsed["provisioningServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "provisioningServiceName", *parsed) - } - - if id.KeyName, ok = parsed.Parsed["keyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseKeyIDInsensitively(input string) (*KeyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := KeyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *KeyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ProvisioningServiceName, ok = parsed.Parsed["provisioningServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "provisioningServiceName", *parsed) + if id.ProvisioningServiceName, ok = input.Parsed["provisioningServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "provisioningServiceName", input) } - if id.KeyName, ok = parsed.Parsed["keyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyName", *parsed) + if id.KeyName, ok = input.Parsed["keyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "keyName", input) } - return &id, nil + return nil } // ValidateKeyID checks that 'input' can be parsed as a Key ID diff --git a/resource-manager/deviceprovisioningservices/2022-02-05/iotdpsresource/id_privateendpointconnection.go b/resource-manager/deviceprovisioningservices/2022-02-05/iotdpsresource/id_privateendpointconnection.go index a485c59f97f..38dfef06abf 100644 --- a/resource-manager/deviceprovisioningservices/2022-02-05/iotdpsresource/id_privateendpointconnection.go +++ b/resource-manager/deviceprovisioningservices/2022-02-05/iotdpsresource/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.ProvisioningServiceName, ok = parsed.Parsed["provisioningServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "provisioningServiceName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ProvisioningServiceName, ok = parsed.Parsed["provisioningServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "provisioningServiceName", *parsed) + if id.ProvisioningServiceName, ok = input.Parsed["provisioningServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "provisioningServiceName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/deviceprovisioningservices/2022-02-05/iotdpsresource/id_privatelinkresource.go b/resource-manager/deviceprovisioningservices/2022-02-05/iotdpsresource/id_privatelinkresource.go index d79ead17d34..d06c05b69b2 100644 --- a/resource-manager/deviceprovisioningservices/2022-02-05/iotdpsresource/id_privatelinkresource.go +++ b/resource-manager/deviceprovisioningservices/2022-02-05/iotdpsresource/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.ProvisioningServiceName, ok = parsed.Parsed["provisioningServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "provisioningServiceName", *parsed) - } - - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ProvisioningServiceName, ok = parsed.Parsed["provisioningServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "provisioningServiceName", *parsed) + if id.ProvisioningServiceName, ok = input.Parsed["provisioningServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "provisioningServiceName", input) } - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + if id.GroupId, ok = input.Parsed["groupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "groupId", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/deviceprovisioningservices/2022-12-12/dpscertificate/id_certificate.go b/resource-manager/deviceprovisioningservices/2022-12-12/dpscertificate/id_certificate.go index eecb3831c49..13a77c09e66 100644 --- a/resource-manager/deviceprovisioningservices/2022-12-12/dpscertificate/id_certificate.go +++ b/resource-manager/deviceprovisioningservices/2022-12-12/dpscertificate/id_certificate.go @@ -38,23 +38,9 @@ func ParseCertificateID(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} - - 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.ProvisioningServiceName, ok = parsed.Parsed["provisioningServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "provisioningServiceName", *parsed) - } - - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCertificateIDInsensitively(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ProvisioningServiceName, ok = parsed.Parsed["provisioningServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "provisioningServiceName", *parsed) + if id.ProvisioningServiceName, ok = input.Parsed["provisioningServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "provisioningServiceName", input) } - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if id.CertificateName, ok = input.Parsed["certificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateName", input) } - return &id, nil + return nil } // ValidateCertificateID checks that 'input' can be parsed as a Certificate ID diff --git a/resource-manager/deviceprovisioningservices/2022-12-12/iotdpsresource/id_key.go b/resource-manager/deviceprovisioningservices/2022-12-12/iotdpsresource/id_key.go index 6a03e2b99b1..968fce9f20e 100644 --- a/resource-manager/deviceprovisioningservices/2022-12-12/iotdpsresource/id_key.go +++ b/resource-manager/deviceprovisioningservices/2022-12-12/iotdpsresource/id_key.go @@ -38,23 +38,9 @@ func ParseKeyID(input string) (*KeyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := KeyId{} - - 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.ProvisioningServiceName, ok = parsed.Parsed["provisioningServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "provisioningServiceName", *parsed) - } - - if id.KeyName, ok = parsed.Parsed["keyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseKeyIDInsensitively(input string) (*KeyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := KeyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *KeyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ProvisioningServiceName, ok = parsed.Parsed["provisioningServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "provisioningServiceName", *parsed) + if id.ProvisioningServiceName, ok = input.Parsed["provisioningServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "provisioningServiceName", input) } - if id.KeyName, ok = parsed.Parsed["keyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyName", *parsed) + if id.KeyName, ok = input.Parsed["keyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "keyName", input) } - return &id, nil + return nil } // ValidateKeyID checks that 'input' can be parsed as a Key ID diff --git a/resource-manager/deviceprovisioningservices/2022-12-12/iotdpsresource/id_privateendpointconnection.go b/resource-manager/deviceprovisioningservices/2022-12-12/iotdpsresource/id_privateendpointconnection.go index a485c59f97f..38dfef06abf 100644 --- a/resource-manager/deviceprovisioningservices/2022-12-12/iotdpsresource/id_privateendpointconnection.go +++ b/resource-manager/deviceprovisioningservices/2022-12-12/iotdpsresource/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.ProvisioningServiceName, ok = parsed.Parsed["provisioningServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "provisioningServiceName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ProvisioningServiceName, ok = parsed.Parsed["provisioningServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "provisioningServiceName", *parsed) + if id.ProvisioningServiceName, ok = input.Parsed["provisioningServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "provisioningServiceName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/deviceprovisioningservices/2022-12-12/iotdpsresource/id_privatelinkresource.go b/resource-manager/deviceprovisioningservices/2022-12-12/iotdpsresource/id_privatelinkresource.go index d79ead17d34..d06c05b69b2 100644 --- a/resource-manager/deviceprovisioningservices/2022-12-12/iotdpsresource/id_privatelinkresource.go +++ b/resource-manager/deviceprovisioningservices/2022-12-12/iotdpsresource/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.ProvisioningServiceName, ok = parsed.Parsed["provisioningServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "provisioningServiceName", *parsed) - } - - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ProvisioningServiceName, ok = parsed.Parsed["provisioningServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "provisioningServiceName", *parsed) + if id.ProvisioningServiceName, ok = input.Parsed["provisioningServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "provisioningServiceName", input) } - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + if id.GroupId, ok = input.Parsed["groupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "groupId", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/deviceupdate/2022-10-01/deviceupdates/id_account.go b/resource-manager/deviceupdate/2022-10-01/deviceupdates/id_account.go index 8645fd52b9a..c4bd0b2f7b5 100644 --- a/resource-manager/deviceupdate/2022-10-01/deviceupdates/id_account.go +++ b/resource-manager/deviceupdate/2022-10-01/deviceupdates/id_account.go @@ -36,19 +36,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/deviceupdate/2022-10-01/deviceupdates/id_instance.go b/resource-manager/deviceupdate/2022-10-01/deviceupdates/id_instance.go index c19f0242c1d..1cf80c08ff8 100644 --- a/resource-manager/deviceupdate/2022-10-01/deviceupdates/id_instance.go +++ b/resource-manager/deviceupdate/2022-10-01/deviceupdates/id_instance.go @@ -38,23 +38,9 @@ func ParseInstanceID(input string) (*InstanceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InstanceId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.InstanceName, ok = parsed.Parsed["instanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseInstanceIDInsensitively(input string) (*InstanceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *InstanceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.InstanceName, ok = parsed.Parsed["instanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceName", *parsed) + if id.InstanceName, ok = input.Parsed["instanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceName", input) } - return &id, nil + return nil } // ValidateInstanceID checks that 'input' can be parsed as a Instance ID diff --git a/resource-manager/deviceupdate/2022-10-01/deviceupdates/id_privateendpointconnectionproxy.go b/resource-manager/deviceupdate/2022-10-01/deviceupdates/id_privateendpointconnectionproxy.go index 7baef5b28d1..b5e1cb6659f 100644 --- a/resource-manager/deviceupdate/2022-10-01/deviceupdates/id_privateendpointconnectionproxy.go +++ b/resource-manager/deviceupdate/2022-10-01/deviceupdates/id_privateendpointconnectionproxy.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionProxyID(input string) (*PrivateEndpointConnec return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionProxyId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.PrivateEndpointConnectionProxyId, ok = parsed.Parsed["privateEndpointConnectionProxyId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionProxyId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionProxyIDInsensitively(input string) (*PrivateE return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionProxyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionProxyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.PrivateEndpointConnectionProxyId, ok = parsed.Parsed["privateEndpointConnectionProxyId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionProxyId", *parsed) + if id.PrivateEndpointConnectionProxyId, ok = input.Parsed["privateEndpointConnectionProxyId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionProxyId", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionProxyID checks that 'input' can be parsed as a Private Endpoint Connection Proxy ID diff --git a/resource-manager/deviceupdate/2022-10-01/privateendpointconnectionproxies/id_account.go b/resource-manager/deviceupdate/2022-10-01/privateendpointconnectionproxies/id_account.go index 328bf4d56e6..b6cbf9cca6f 100644 --- a/resource-manager/deviceupdate/2022-10-01/privateendpointconnectionproxies/id_account.go +++ b/resource-manager/deviceupdate/2022-10-01/privateendpointconnectionproxies/id_account.go @@ -36,19 +36,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/deviceupdate/2022-10-01/privateendpointconnectionproxies/id_privateendpointconnectionproxy.go b/resource-manager/deviceupdate/2022-10-01/privateendpointconnectionproxies/id_privateendpointconnectionproxy.go index 37966a75c11..1429dec7b9e 100644 --- a/resource-manager/deviceupdate/2022-10-01/privateendpointconnectionproxies/id_privateendpointconnectionproxy.go +++ b/resource-manager/deviceupdate/2022-10-01/privateendpointconnectionproxies/id_privateendpointconnectionproxy.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionProxyID(input string) (*PrivateEndpointConnec return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionProxyId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.PrivateEndpointConnectionProxyId, ok = parsed.Parsed["privateEndpointConnectionProxyId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionProxyId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionProxyIDInsensitively(input string) (*PrivateE return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionProxyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionProxyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.PrivateEndpointConnectionProxyId, ok = parsed.Parsed["privateEndpointConnectionProxyId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionProxyId", *parsed) + if id.PrivateEndpointConnectionProxyId, ok = input.Parsed["privateEndpointConnectionProxyId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionProxyId", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionProxyID checks that 'input' can be parsed as a Private Endpoint Connection Proxy ID diff --git a/resource-manager/deviceupdate/2022-10-01/privateendpointconnections/id_account.go b/resource-manager/deviceupdate/2022-10-01/privateendpointconnections/id_account.go index 745e1763b8c..db82868f346 100644 --- a/resource-manager/deviceupdate/2022-10-01/privateendpointconnections/id_account.go +++ b/resource-manager/deviceupdate/2022-10-01/privateendpointconnections/id_account.go @@ -36,19 +36,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/deviceupdate/2022-10-01/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/deviceupdate/2022-10-01/privateendpointconnections/id_privateendpointconnection.go index 68ba3e6ed07..3561e45b9e0 100644 --- a/resource-manager/deviceupdate/2022-10-01/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/deviceupdate/2022-10-01/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/deviceupdate/2022-10-01/privateendpointconnections/id_privateendpointconnectionproxy.go b/resource-manager/deviceupdate/2022-10-01/privateendpointconnections/id_privateendpointconnectionproxy.go index 1715803ec50..d7559f2441a 100644 --- a/resource-manager/deviceupdate/2022-10-01/privateendpointconnections/id_privateendpointconnectionproxy.go +++ b/resource-manager/deviceupdate/2022-10-01/privateendpointconnections/id_privateendpointconnectionproxy.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionProxyID(input string) (*PrivateEndpointConnec return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionProxyId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.PrivateEndpointConnectionProxyId, ok = parsed.Parsed["privateEndpointConnectionProxyId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionProxyId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionProxyIDInsensitively(input string) (*PrivateE return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionProxyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionProxyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.PrivateEndpointConnectionProxyId, ok = parsed.Parsed["privateEndpointConnectionProxyId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionProxyId", *parsed) + if id.PrivateEndpointConnectionProxyId, ok = input.Parsed["privateEndpointConnectionProxyId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionProxyId", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionProxyID checks that 'input' can be parsed as a Private Endpoint Connection Proxy ID diff --git a/resource-manager/deviceupdate/2022-10-01/privatelinkresources/id_account.go b/resource-manager/deviceupdate/2022-10-01/privatelinkresources/id_account.go index 3c45ccca2f5..b2ceed2f052 100644 --- a/resource-manager/deviceupdate/2022-10-01/privatelinkresources/id_account.go +++ b/resource-manager/deviceupdate/2022-10-01/privatelinkresources/id_account.go @@ -36,19 +36,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/deviceupdate/2022-10-01/privatelinkresources/id_privatelinkresource.go b/resource-manager/deviceupdate/2022-10-01/privatelinkresources/id_privatelinkresource.go index a94a7a1124d..834a7339c5f 100644 --- a/resource-manager/deviceupdate/2022-10-01/privatelinkresources/id_privatelinkresource.go +++ b/resource-manager/deviceupdate/2022-10-01/privatelinkresources/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + if id.GroupId, ok = input.Parsed["groupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "groupId", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/deviceupdate/2023-07-01/deviceupdates/id_account.go b/resource-manager/deviceupdate/2023-07-01/deviceupdates/id_account.go index 8645fd52b9a..c4bd0b2f7b5 100644 --- a/resource-manager/deviceupdate/2023-07-01/deviceupdates/id_account.go +++ b/resource-manager/deviceupdate/2023-07-01/deviceupdates/id_account.go @@ -36,19 +36,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/deviceupdate/2023-07-01/deviceupdates/id_instance.go b/resource-manager/deviceupdate/2023-07-01/deviceupdates/id_instance.go index c19f0242c1d..1cf80c08ff8 100644 --- a/resource-manager/deviceupdate/2023-07-01/deviceupdates/id_instance.go +++ b/resource-manager/deviceupdate/2023-07-01/deviceupdates/id_instance.go @@ -38,23 +38,9 @@ func ParseInstanceID(input string) (*InstanceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InstanceId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.InstanceName, ok = parsed.Parsed["instanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseInstanceIDInsensitively(input string) (*InstanceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *InstanceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.InstanceName, ok = parsed.Parsed["instanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceName", *parsed) + if id.InstanceName, ok = input.Parsed["instanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceName", input) } - return &id, nil + return nil } // ValidateInstanceID checks that 'input' can be parsed as a Instance ID diff --git a/resource-manager/deviceupdate/2023-07-01/deviceupdates/id_privateendpointconnectionproxy.go b/resource-manager/deviceupdate/2023-07-01/deviceupdates/id_privateendpointconnectionproxy.go index 7baef5b28d1..b5e1cb6659f 100644 --- a/resource-manager/deviceupdate/2023-07-01/deviceupdates/id_privateendpointconnectionproxy.go +++ b/resource-manager/deviceupdate/2023-07-01/deviceupdates/id_privateendpointconnectionproxy.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionProxyID(input string) (*PrivateEndpointConnec return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionProxyId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.PrivateEndpointConnectionProxyId, ok = parsed.Parsed["privateEndpointConnectionProxyId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionProxyId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionProxyIDInsensitively(input string) (*PrivateE return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionProxyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionProxyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.PrivateEndpointConnectionProxyId, ok = parsed.Parsed["privateEndpointConnectionProxyId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionProxyId", *parsed) + if id.PrivateEndpointConnectionProxyId, ok = input.Parsed["privateEndpointConnectionProxyId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionProxyId", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionProxyID checks that 'input' can be parsed as a Private Endpoint Connection Proxy ID diff --git a/resource-manager/deviceupdate/2023-07-01/privateendpointconnectionproxies/id_account.go b/resource-manager/deviceupdate/2023-07-01/privateendpointconnectionproxies/id_account.go index 328bf4d56e6..b6cbf9cca6f 100644 --- a/resource-manager/deviceupdate/2023-07-01/privateendpointconnectionproxies/id_account.go +++ b/resource-manager/deviceupdate/2023-07-01/privateendpointconnectionproxies/id_account.go @@ -36,19 +36,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/deviceupdate/2023-07-01/privateendpointconnectionproxies/id_privateendpointconnectionproxy.go b/resource-manager/deviceupdate/2023-07-01/privateendpointconnectionproxies/id_privateendpointconnectionproxy.go index 37966a75c11..1429dec7b9e 100644 --- a/resource-manager/deviceupdate/2023-07-01/privateendpointconnectionproxies/id_privateendpointconnectionproxy.go +++ b/resource-manager/deviceupdate/2023-07-01/privateendpointconnectionproxies/id_privateendpointconnectionproxy.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionProxyID(input string) (*PrivateEndpointConnec return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionProxyId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.PrivateEndpointConnectionProxyId, ok = parsed.Parsed["privateEndpointConnectionProxyId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionProxyId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionProxyIDInsensitively(input string) (*PrivateE return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionProxyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionProxyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.PrivateEndpointConnectionProxyId, ok = parsed.Parsed["privateEndpointConnectionProxyId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionProxyId", *parsed) + if id.PrivateEndpointConnectionProxyId, ok = input.Parsed["privateEndpointConnectionProxyId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionProxyId", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionProxyID checks that 'input' can be parsed as a Private Endpoint Connection Proxy ID diff --git a/resource-manager/deviceupdate/2023-07-01/privateendpointconnections/id_account.go b/resource-manager/deviceupdate/2023-07-01/privateendpointconnections/id_account.go index 745e1763b8c..db82868f346 100644 --- a/resource-manager/deviceupdate/2023-07-01/privateendpointconnections/id_account.go +++ b/resource-manager/deviceupdate/2023-07-01/privateendpointconnections/id_account.go @@ -36,19 +36,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/deviceupdate/2023-07-01/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/deviceupdate/2023-07-01/privateendpointconnections/id_privateendpointconnection.go index 68ba3e6ed07..3561e45b9e0 100644 --- a/resource-manager/deviceupdate/2023-07-01/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/deviceupdate/2023-07-01/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/deviceupdate/2023-07-01/privateendpointconnections/id_privateendpointconnectionproxy.go b/resource-manager/deviceupdate/2023-07-01/privateendpointconnections/id_privateendpointconnectionproxy.go index 1715803ec50..d7559f2441a 100644 --- a/resource-manager/deviceupdate/2023-07-01/privateendpointconnections/id_privateendpointconnectionproxy.go +++ b/resource-manager/deviceupdate/2023-07-01/privateendpointconnections/id_privateendpointconnectionproxy.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionProxyID(input string) (*PrivateEndpointConnec return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionProxyId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.PrivateEndpointConnectionProxyId, ok = parsed.Parsed["privateEndpointConnectionProxyId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionProxyId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionProxyIDInsensitively(input string) (*PrivateE return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionProxyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionProxyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.PrivateEndpointConnectionProxyId, ok = parsed.Parsed["privateEndpointConnectionProxyId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionProxyId", *parsed) + if id.PrivateEndpointConnectionProxyId, ok = input.Parsed["privateEndpointConnectionProxyId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionProxyId", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionProxyID checks that 'input' can be parsed as a Private Endpoint Connection Proxy ID diff --git a/resource-manager/deviceupdate/2023-07-01/privatelinkresources/id_account.go b/resource-manager/deviceupdate/2023-07-01/privatelinkresources/id_account.go index 3c45ccca2f5..b2ceed2f052 100644 --- a/resource-manager/deviceupdate/2023-07-01/privatelinkresources/id_account.go +++ b/resource-manager/deviceupdate/2023-07-01/privatelinkresources/id_account.go @@ -36,19 +36,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/deviceupdate/2023-07-01/privatelinkresources/id_privatelinkresource.go b/resource-manager/deviceupdate/2023-07-01/privatelinkresources/id_privatelinkresource.go index a94a7a1124d..834a7339c5f 100644 --- a/resource-manager/deviceupdate/2023-07-01/privatelinkresources/id_privatelinkresource.go +++ b/resource-manager/deviceupdate/2023-07-01/privatelinkresources/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + if id.GroupId, ok = input.Parsed["groupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "groupId", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/devtestlab/2018-09-15/armtemplates/id_armtemplate.go b/resource-manager/devtestlab/2018-09-15/armtemplates/id_armtemplate.go index 7eda05b74d5..d91f5a99284 100644 --- a/resource-manager/devtestlab/2018-09-15/armtemplates/id_armtemplate.go +++ b/resource-manager/devtestlab/2018-09-15/armtemplates/id_armtemplate.go @@ -40,27 +40,9 @@ func ParseArmTemplateID(input string) (*ArmTemplateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ArmTemplateId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) - } - - if id.ArtifactSourceName, ok = parsed.Parsed["artifactSourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "artifactSourceName", *parsed) - } - - if id.ArmTemplateName, ok = parsed.Parsed["armTemplateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "armTemplateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseArmTemplateIDInsensitively(input string) (*ArmTemplateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ArmTemplateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ArmTemplateId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - if id.ArtifactSourceName, ok = parsed.Parsed["artifactSourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "artifactSourceName", *parsed) + if id.ArtifactSourceName, ok = input.Parsed["artifactSourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "artifactSourceName", input) } - if id.ArmTemplateName, ok = parsed.Parsed["armTemplateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "armTemplateName", *parsed) + if id.ArmTemplateName, ok = input.Parsed["armTemplateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "armTemplateName", input) } - return &id, nil + return nil } // ValidateArmTemplateID checks that 'input' can be parsed as a Arm Template ID diff --git a/resource-manager/devtestlab/2018-09-15/armtemplates/id_artifactsource.go b/resource-manager/devtestlab/2018-09-15/armtemplates/id_artifactsource.go index a733f8084b7..1ff0c1f68b9 100644 --- a/resource-manager/devtestlab/2018-09-15/armtemplates/id_artifactsource.go +++ b/resource-manager/devtestlab/2018-09-15/armtemplates/id_artifactsource.go @@ -38,23 +38,9 @@ func ParseArtifactSourceID(input string) (*ArtifactSourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ArtifactSourceId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) - } - - if id.ArtifactSourceName, ok = parsed.Parsed["artifactSourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "artifactSourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseArtifactSourceIDInsensitively(input string) (*ArtifactSourceId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ArtifactSourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ArtifactSourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - if id.ArtifactSourceName, ok = parsed.Parsed["artifactSourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "artifactSourceName", *parsed) + if id.ArtifactSourceName, ok = input.Parsed["artifactSourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "artifactSourceName", input) } - return &id, nil + return nil } // ValidateArtifactSourceID checks that 'input' can be parsed as a Artifact Source ID diff --git a/resource-manager/devtestlab/2018-09-15/artifacts/id_artifact.go b/resource-manager/devtestlab/2018-09-15/artifacts/id_artifact.go index 6b4efd99f8e..3b80bdb8122 100644 --- a/resource-manager/devtestlab/2018-09-15/artifacts/id_artifact.go +++ b/resource-manager/devtestlab/2018-09-15/artifacts/id_artifact.go @@ -40,27 +40,9 @@ func ParseArtifactID(input string) (*ArtifactId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ArtifactId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) - } - - if id.ArtifactSourceName, ok = parsed.Parsed["artifactSourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "artifactSourceName", *parsed) - } - - if id.ArtifactName, ok = parsed.Parsed["artifactName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "artifactName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseArtifactIDInsensitively(input string) (*ArtifactId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ArtifactId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ArtifactId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - if id.ArtifactSourceName, ok = parsed.Parsed["artifactSourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "artifactSourceName", *parsed) + if id.ArtifactSourceName, ok = input.Parsed["artifactSourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "artifactSourceName", input) } - if id.ArtifactName, ok = parsed.Parsed["artifactName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "artifactName", *parsed) + if id.ArtifactName, ok = input.Parsed["artifactName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "artifactName", input) } - return &id, nil + return nil } // ValidateArtifactID checks that 'input' can be parsed as a Artifact ID diff --git a/resource-manager/devtestlab/2018-09-15/artifacts/id_artifactsource.go b/resource-manager/devtestlab/2018-09-15/artifacts/id_artifactsource.go index d6daf6b77ee..edf7b5fc8fa 100644 --- a/resource-manager/devtestlab/2018-09-15/artifacts/id_artifactsource.go +++ b/resource-manager/devtestlab/2018-09-15/artifacts/id_artifactsource.go @@ -38,23 +38,9 @@ func ParseArtifactSourceID(input string) (*ArtifactSourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ArtifactSourceId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) - } - - if id.ArtifactSourceName, ok = parsed.Parsed["artifactSourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "artifactSourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseArtifactSourceIDInsensitively(input string) (*ArtifactSourceId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ArtifactSourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ArtifactSourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - if id.ArtifactSourceName, ok = parsed.Parsed["artifactSourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "artifactSourceName", *parsed) + if id.ArtifactSourceName, ok = input.Parsed["artifactSourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "artifactSourceName", input) } - return &id, nil + return nil } // ValidateArtifactSourceID checks that 'input' can be parsed as a Artifact Source ID diff --git a/resource-manager/devtestlab/2018-09-15/artifactsources/id_artifactsource.go b/resource-manager/devtestlab/2018-09-15/artifactsources/id_artifactsource.go index f0844a0062a..8d026bb8691 100644 --- a/resource-manager/devtestlab/2018-09-15/artifactsources/id_artifactsource.go +++ b/resource-manager/devtestlab/2018-09-15/artifactsources/id_artifactsource.go @@ -38,23 +38,9 @@ func ParseArtifactSourceID(input string) (*ArtifactSourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ArtifactSourceId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) - } - - if id.ArtifactSourceName, ok = parsed.Parsed["artifactSourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "artifactSourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseArtifactSourceIDInsensitively(input string) (*ArtifactSourceId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ArtifactSourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ArtifactSourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - if id.ArtifactSourceName, ok = parsed.Parsed["artifactSourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "artifactSourceName", *parsed) + if id.ArtifactSourceName, ok = input.Parsed["artifactSourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "artifactSourceName", input) } - return &id, nil + return nil } // ValidateArtifactSourceID checks that 'input' can be parsed as a Artifact Source ID diff --git a/resource-manager/devtestlab/2018-09-15/artifactsources/id_lab.go b/resource-manager/devtestlab/2018-09-15/artifactsources/id_lab.go index afb8924eab8..e78534d4f01 100644 --- a/resource-manager/devtestlab/2018-09-15/artifactsources/id_lab.go +++ b/resource-manager/devtestlab/2018-09-15/artifactsources/id_lab.go @@ -36,19 +36,9 @@ func ParseLabID(input string) (*LabId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLabIDInsensitively(input string) (*LabId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LabId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - return &id, nil + return nil } // ValidateLabID checks that 'input' can be parsed as a Lab ID diff --git a/resource-manager/devtestlab/2018-09-15/costs/id_cost.go b/resource-manager/devtestlab/2018-09-15/costs/id_cost.go index 5f30e6968f7..bb1a248ee87 100644 --- a/resource-manager/devtestlab/2018-09-15/costs/id_cost.go +++ b/resource-manager/devtestlab/2018-09-15/costs/id_cost.go @@ -38,23 +38,9 @@ func ParseCostID(input string) (*CostId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CostId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) - } - - if id.CostName, ok = parsed.Parsed["costName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "costName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCostIDInsensitively(input string) (*CostId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CostId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CostId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - if id.CostName, ok = parsed.Parsed["costName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "costName", *parsed) + if id.CostName, ok = input.Parsed["costName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "costName", input) } - return &id, nil + return nil } // ValidateCostID checks that 'input' can be parsed as a Cost ID diff --git a/resource-manager/devtestlab/2018-09-15/customimages/id_customimage.go b/resource-manager/devtestlab/2018-09-15/customimages/id_customimage.go index 58ae7a36bd8..b07561bad4e 100644 --- a/resource-manager/devtestlab/2018-09-15/customimages/id_customimage.go +++ b/resource-manager/devtestlab/2018-09-15/customimages/id_customimage.go @@ -38,23 +38,9 @@ func ParseCustomImageID(input string) (*CustomImageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CustomImageId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) - } - - if id.CustomImageName, ok = parsed.Parsed["customImageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "customImageName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCustomImageIDInsensitively(input string) (*CustomImageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CustomImageId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CustomImageId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - if id.CustomImageName, ok = parsed.Parsed["customImageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "customImageName", *parsed) + if id.CustomImageName, ok = input.Parsed["customImageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "customImageName", input) } - return &id, nil + return nil } // ValidateCustomImageID checks that 'input' can be parsed as a Custom Image ID diff --git a/resource-manager/devtestlab/2018-09-15/customimages/id_lab.go b/resource-manager/devtestlab/2018-09-15/customimages/id_lab.go index 5f1f7f7e05f..dda15b2d82c 100644 --- a/resource-manager/devtestlab/2018-09-15/customimages/id_lab.go +++ b/resource-manager/devtestlab/2018-09-15/customimages/id_lab.go @@ -36,19 +36,9 @@ func ParseLabID(input string) (*LabId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLabIDInsensitively(input string) (*LabId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LabId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - return &id, nil + return nil } // ValidateLabID checks that 'input' can be parsed as a Lab ID diff --git a/resource-manager/devtestlab/2018-09-15/disks/id_disk.go b/resource-manager/devtestlab/2018-09-15/disks/id_disk.go index 2611f56f46e..a42444abdb8 100644 --- a/resource-manager/devtestlab/2018-09-15/disks/id_disk.go +++ b/resource-manager/devtestlab/2018-09-15/disks/id_disk.go @@ -40,27 +40,9 @@ func ParseDiskID(input string) (*DiskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiskId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) - } - - if id.UserName, ok = parsed.Parsed["userName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userName", *parsed) - } - - if id.DiskName, ok = parsed.Parsed["diskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diskName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseDiskIDInsensitively(input string) (*DiskId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiskId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DiskId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - if id.UserName, ok = parsed.Parsed["userName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userName", *parsed) + if id.UserName, ok = input.Parsed["userName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userName", input) } - if id.DiskName, ok = parsed.Parsed["diskName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diskName", *parsed) + if id.DiskName, ok = input.Parsed["diskName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "diskName", input) } - return &id, nil + return nil } // ValidateDiskID checks that 'input' can be parsed as a Disk ID diff --git a/resource-manager/devtestlab/2018-09-15/disks/id_user.go b/resource-manager/devtestlab/2018-09-15/disks/id_user.go index 34d5dc63fd8..da5158ec052 100644 --- a/resource-manager/devtestlab/2018-09-15/disks/id_user.go +++ b/resource-manager/devtestlab/2018-09-15/disks/id_user.go @@ -38,23 +38,9 @@ func ParseUserID(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) - } - - if id.UserName, ok = parsed.Parsed["userName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseUserIDInsensitively(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UserId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - if id.UserName, ok = parsed.Parsed["userName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userName", *parsed) + if id.UserName, ok = input.Parsed["userName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userName", input) } - return &id, nil + return nil } // ValidateUserID checks that 'input' can be parsed as a User ID diff --git a/resource-manager/devtestlab/2018-09-15/environments/id_environment.go b/resource-manager/devtestlab/2018-09-15/environments/id_environment.go index a08e46b95d6..a271b53fe3c 100644 --- a/resource-manager/devtestlab/2018-09-15/environments/id_environment.go +++ b/resource-manager/devtestlab/2018-09-15/environments/id_environment.go @@ -40,27 +40,9 @@ func ParseEnvironmentID(input string) (*EnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) - } - - if id.UserName, ok = parsed.Parsed["userName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userName", *parsed) - } - - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseEnvironmentIDInsensitively(input string) (*EnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *EnvironmentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - if id.UserName, ok = parsed.Parsed["userName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userName", *parsed) + if id.UserName, ok = input.Parsed["userName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userName", input) } - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if id.EnvironmentName, ok = input.Parsed["environmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "environmentName", input) } - return &id, nil + return nil } // ValidateEnvironmentID checks that 'input' can be parsed as a Environment ID diff --git a/resource-manager/devtestlab/2018-09-15/environments/id_user.go b/resource-manager/devtestlab/2018-09-15/environments/id_user.go index d4d298ccaa8..cc28cbccba1 100644 --- a/resource-manager/devtestlab/2018-09-15/environments/id_user.go +++ b/resource-manager/devtestlab/2018-09-15/environments/id_user.go @@ -38,23 +38,9 @@ func ParseUserID(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) - } - - if id.UserName, ok = parsed.Parsed["userName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseUserIDInsensitively(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UserId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - if id.UserName, ok = parsed.Parsed["userName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userName", *parsed) + if id.UserName, ok = input.Parsed["userName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userName", input) } - return &id, nil + return nil } // ValidateUserID checks that 'input' can be parsed as a User ID diff --git a/resource-manager/devtestlab/2018-09-15/formulas/id_formula.go b/resource-manager/devtestlab/2018-09-15/formulas/id_formula.go index 5fa9fe51d51..f1913bca22e 100644 --- a/resource-manager/devtestlab/2018-09-15/formulas/id_formula.go +++ b/resource-manager/devtestlab/2018-09-15/formulas/id_formula.go @@ -38,23 +38,9 @@ func ParseFormulaID(input string) (*FormulaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FormulaId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) - } - - if id.FormulaName, ok = parsed.Parsed["formulaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "formulaName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFormulaIDInsensitively(input string) (*FormulaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FormulaId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FormulaId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - if id.FormulaName, ok = parsed.Parsed["formulaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "formulaName", *parsed) + if id.FormulaName, ok = input.Parsed["formulaName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "formulaName", input) } - return &id, nil + return nil } // ValidateFormulaID checks that 'input' can be parsed as a Formula ID diff --git a/resource-manager/devtestlab/2018-09-15/formulas/id_lab.go b/resource-manager/devtestlab/2018-09-15/formulas/id_lab.go index 45749eeab87..a97d4bd022d 100644 --- a/resource-manager/devtestlab/2018-09-15/formulas/id_lab.go +++ b/resource-manager/devtestlab/2018-09-15/formulas/id_lab.go @@ -36,19 +36,9 @@ func ParseLabID(input string) (*LabId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLabIDInsensitively(input string) (*LabId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LabId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - return &id, nil + return nil } // ValidateLabID checks that 'input' can be parsed as a Lab ID diff --git a/resource-manager/devtestlab/2018-09-15/galleryimages/id_lab.go b/resource-manager/devtestlab/2018-09-15/galleryimages/id_lab.go index 85e92639b9b..4d69f96a7bd 100644 --- a/resource-manager/devtestlab/2018-09-15/galleryimages/id_lab.go +++ b/resource-manager/devtestlab/2018-09-15/galleryimages/id_lab.go @@ -36,19 +36,9 @@ func ParseLabID(input string) (*LabId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLabIDInsensitively(input string) (*LabId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LabId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - return &id, nil + return nil } // ValidateLabID checks that 'input' can be parsed as a Lab ID diff --git a/resource-manager/devtestlab/2018-09-15/globalschedules/id_schedule.go b/resource-manager/devtestlab/2018-09-15/globalschedules/id_schedule.go index 71a507fad8d..eb0db1e6062 100644 --- a/resource-manager/devtestlab/2018-09-15/globalschedules/id_schedule.go +++ b/resource-manager/devtestlab/2018-09-15/globalschedules/id_schedule.go @@ -36,19 +36,9 @@ func ParseScheduleID(input string) (*ScheduleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScheduleId{} - - 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.ScheduleName, ok = parsed.Parsed["scheduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseScheduleIDInsensitively(input string) (*ScheduleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScheduleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ScheduleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ScheduleName, ok = parsed.Parsed["scheduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", *parsed) + if id.ScheduleName, ok = input.Parsed["scheduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", input) } - return &id, nil + return nil } // ValidateScheduleID checks that 'input' can be parsed as a Schedule ID diff --git a/resource-manager/devtestlab/2018-09-15/labs/id_lab.go b/resource-manager/devtestlab/2018-09-15/labs/id_lab.go index 942d12834e9..76d466c56b2 100644 --- a/resource-manager/devtestlab/2018-09-15/labs/id_lab.go +++ b/resource-manager/devtestlab/2018-09-15/labs/id_lab.go @@ -36,19 +36,9 @@ func ParseLabID(input string) (*LabId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLabIDInsensitively(input string) (*LabId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LabId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - return &id, nil + return nil } // ValidateLabID checks that 'input' can be parsed as a Lab ID diff --git a/resource-manager/devtestlab/2018-09-15/notificationchannels/id_lab.go b/resource-manager/devtestlab/2018-09-15/notificationchannels/id_lab.go index 839321d2bc7..5f473da448f 100644 --- a/resource-manager/devtestlab/2018-09-15/notificationchannels/id_lab.go +++ b/resource-manager/devtestlab/2018-09-15/notificationchannels/id_lab.go @@ -36,19 +36,9 @@ func ParseLabID(input string) (*LabId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLabIDInsensitively(input string) (*LabId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LabId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - return &id, nil + return nil } // ValidateLabID checks that 'input' can be parsed as a Lab ID diff --git a/resource-manager/devtestlab/2018-09-15/notificationchannels/id_notificationchannel.go b/resource-manager/devtestlab/2018-09-15/notificationchannels/id_notificationchannel.go index 1fa846bc596..49ccd79396c 100644 --- a/resource-manager/devtestlab/2018-09-15/notificationchannels/id_notificationchannel.go +++ b/resource-manager/devtestlab/2018-09-15/notificationchannels/id_notificationchannel.go @@ -38,23 +38,9 @@ func ParseNotificationChannelID(input string) (*NotificationChannelId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NotificationChannelId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) - } - - if id.NotificationChannelName, ok = parsed.Parsed["notificationChannelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationChannelName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseNotificationChannelIDInsensitively(input string) (*NotificationChannel return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NotificationChannelId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *NotificationChannelId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - if id.NotificationChannelName, ok = parsed.Parsed["notificationChannelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationChannelName", *parsed) + if id.NotificationChannelName, ok = input.Parsed["notificationChannelName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "notificationChannelName", input) } - return &id, nil + return nil } // ValidateNotificationChannelID checks that 'input' can be parsed as a Notification Channel ID diff --git a/resource-manager/devtestlab/2018-09-15/operations/id_operation.go b/resource-manager/devtestlab/2018-09-15/operations/id_operation.go index 9d309f0e785..a2656635c3c 100644 --- a/resource-manager/devtestlab/2018-09-15/operations/id_operation.go +++ b/resource-manager/devtestlab/2018-09-15/operations/id_operation.go @@ -36,19 +36,9 @@ func ParseOperationID(input string) (*OperationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.OperationName, ok = parsed.Parsed["operationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseOperationIDInsensitively(input string) (*OperationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *OperationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.OperationName, ok = parsed.Parsed["operationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationName", *parsed) + if id.OperationName, ok = input.Parsed["operationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "operationName", input) } - return &id, nil + return nil } // ValidateOperationID checks that 'input' can be parsed as a Operation ID diff --git a/resource-manager/devtestlab/2018-09-15/policies/id_policy.go b/resource-manager/devtestlab/2018-09-15/policies/id_policy.go index 2d548b94aa4..9c202d116b2 100644 --- a/resource-manager/devtestlab/2018-09-15/policies/id_policy.go +++ b/resource-manager/devtestlab/2018-09-15/policies/id_policy.go @@ -40,27 +40,9 @@ func ParsePolicyID(input string) (*PolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PolicyId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) - } - - if id.PolicySetName, ok = parsed.Parsed["policySetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policySetName", *parsed) - } - - if id.PolicyName, ok = parsed.Parsed["policyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParsePolicyIDInsensitively(input string) (*PolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *PolicyId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - if id.PolicySetName, ok = parsed.Parsed["policySetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policySetName", *parsed) + if id.PolicySetName, ok = input.Parsed["policySetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "policySetName", input) } - if id.PolicyName, ok = parsed.Parsed["policyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policyName", *parsed) + if id.PolicyName, ok = input.Parsed["policyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "policyName", input) } - return &id, nil + return nil } // ValidatePolicyID checks that 'input' can be parsed as a Policy ID diff --git a/resource-manager/devtestlab/2018-09-15/policies/id_policyset.go b/resource-manager/devtestlab/2018-09-15/policies/id_policyset.go index da2e94d399b..da11e80e171 100644 --- a/resource-manager/devtestlab/2018-09-15/policies/id_policyset.go +++ b/resource-manager/devtestlab/2018-09-15/policies/id_policyset.go @@ -38,23 +38,9 @@ func ParsePolicySetID(input string) (*PolicySetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PolicySetId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) - } - - if id.PolicySetName, ok = parsed.Parsed["policySetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policySetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePolicySetIDInsensitively(input string) (*PolicySetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PolicySetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PolicySetId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - if id.PolicySetName, ok = parsed.Parsed["policySetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policySetName", *parsed) + if id.PolicySetName, ok = input.Parsed["policySetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "policySetName", input) } - return &id, nil + return nil } // ValidatePolicySetID checks that 'input' can be parsed as a Policy Set ID diff --git a/resource-manager/devtestlab/2018-09-15/policysets/id_policyset.go b/resource-manager/devtestlab/2018-09-15/policysets/id_policyset.go index b8b4ad47cfd..9dcffc5137e 100644 --- a/resource-manager/devtestlab/2018-09-15/policysets/id_policyset.go +++ b/resource-manager/devtestlab/2018-09-15/policysets/id_policyset.go @@ -38,23 +38,9 @@ func ParsePolicySetID(input string) (*PolicySetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PolicySetId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) - } - - if id.PolicySetName, ok = parsed.Parsed["policySetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policySetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePolicySetIDInsensitively(input string) (*PolicySetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PolicySetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PolicySetId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - if id.PolicySetName, ok = parsed.Parsed["policySetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policySetName", *parsed) + if id.PolicySetName, ok = input.Parsed["policySetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "policySetName", input) } - return &id, nil + return nil } // ValidatePolicySetID checks that 'input' can be parsed as a Policy Set ID diff --git a/resource-manager/devtestlab/2018-09-15/schedules/id_lab.go b/resource-manager/devtestlab/2018-09-15/schedules/id_lab.go index e923df4e935..94255f896b6 100644 --- a/resource-manager/devtestlab/2018-09-15/schedules/id_lab.go +++ b/resource-manager/devtestlab/2018-09-15/schedules/id_lab.go @@ -36,19 +36,9 @@ func ParseLabID(input string) (*LabId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLabIDInsensitively(input string) (*LabId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LabId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - return &id, nil + return nil } // ValidateLabID checks that 'input' can be parsed as a Lab ID diff --git a/resource-manager/devtestlab/2018-09-15/schedules/id_labschedule.go b/resource-manager/devtestlab/2018-09-15/schedules/id_labschedule.go index b5742f0e4bc..453d9bd2c59 100644 --- a/resource-manager/devtestlab/2018-09-15/schedules/id_labschedule.go +++ b/resource-manager/devtestlab/2018-09-15/schedules/id_labschedule.go @@ -38,23 +38,9 @@ func ParseLabScheduleID(input string) (*LabScheduleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabScheduleId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) - } - - if id.ScheduleName, ok = parsed.Parsed["scheduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLabScheduleIDInsensitively(input string) (*LabScheduleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabScheduleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LabScheduleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - if id.ScheduleName, ok = parsed.Parsed["scheduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", *parsed) + if id.ScheduleName, ok = input.Parsed["scheduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", input) } - return &id, nil + return nil } // ValidateLabScheduleID checks that 'input' can be parsed as a Lab Schedule ID diff --git a/resource-manager/devtestlab/2018-09-15/secrets/id_secret.go b/resource-manager/devtestlab/2018-09-15/secrets/id_secret.go index 55d54af7b1e..fa3ef950590 100644 --- a/resource-manager/devtestlab/2018-09-15/secrets/id_secret.go +++ b/resource-manager/devtestlab/2018-09-15/secrets/id_secret.go @@ -40,27 +40,9 @@ func ParseSecretID(input string) (*SecretId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecretId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) - } - - if id.UserName, ok = parsed.Parsed["userName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userName", *parsed) - } - - if id.SecretName, ok = parsed.Parsed["secretName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "secretName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSecretIDInsensitively(input string) (*SecretId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecretId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SecretId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - if id.UserName, ok = parsed.Parsed["userName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userName", *parsed) + if id.UserName, ok = input.Parsed["userName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userName", input) } - if id.SecretName, ok = parsed.Parsed["secretName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "secretName", *parsed) + if id.SecretName, ok = input.Parsed["secretName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "secretName", input) } - return &id, nil + return nil } // ValidateSecretID checks that 'input' can be parsed as a Secret ID diff --git a/resource-manager/devtestlab/2018-09-15/secrets/id_user.go b/resource-manager/devtestlab/2018-09-15/secrets/id_user.go index 751eef57ade..3befee74009 100644 --- a/resource-manager/devtestlab/2018-09-15/secrets/id_user.go +++ b/resource-manager/devtestlab/2018-09-15/secrets/id_user.go @@ -38,23 +38,9 @@ func ParseUserID(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) - } - - if id.UserName, ok = parsed.Parsed["userName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseUserIDInsensitively(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UserId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - if id.UserName, ok = parsed.Parsed["userName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userName", *parsed) + if id.UserName, ok = input.Parsed["userName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userName", input) } - return &id, nil + return nil } // ValidateUserID checks that 'input' can be parsed as a User ID diff --git a/resource-manager/devtestlab/2018-09-15/servicefabrics/id_servicefabric.go b/resource-manager/devtestlab/2018-09-15/servicefabrics/id_servicefabric.go index 409ae4c5d1d..352783b5d1c 100644 --- a/resource-manager/devtestlab/2018-09-15/servicefabrics/id_servicefabric.go +++ b/resource-manager/devtestlab/2018-09-15/servicefabrics/id_servicefabric.go @@ -40,27 +40,9 @@ func ParseServiceFabricID(input string) (*ServiceFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceFabricId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) - } - - if id.UserName, ok = parsed.Parsed["userName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userName", *parsed) - } - - if id.ServiceFabricName, ok = parsed.Parsed["serviceFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceFabricName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseServiceFabricIDInsensitively(input string) (*ServiceFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceFabricId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ServiceFabricId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - if id.UserName, ok = parsed.Parsed["userName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userName", *parsed) + if id.UserName, ok = input.Parsed["userName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userName", input) } - if id.ServiceFabricName, ok = parsed.Parsed["serviceFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceFabricName", *parsed) + if id.ServiceFabricName, ok = input.Parsed["serviceFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceFabricName", input) } - return &id, nil + return nil } // ValidateServiceFabricID checks that 'input' can be parsed as a Service Fabric ID diff --git a/resource-manager/devtestlab/2018-09-15/servicefabrics/id_user.go b/resource-manager/devtestlab/2018-09-15/servicefabrics/id_user.go index 6d8f2b8acac..fdfcf9731e4 100644 --- a/resource-manager/devtestlab/2018-09-15/servicefabrics/id_user.go +++ b/resource-manager/devtestlab/2018-09-15/servicefabrics/id_user.go @@ -38,23 +38,9 @@ func ParseUserID(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) - } - - if id.UserName, ok = parsed.Parsed["userName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseUserIDInsensitively(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UserId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - if id.UserName, ok = parsed.Parsed["userName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userName", *parsed) + if id.UserName, ok = input.Parsed["userName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userName", input) } - return &id, nil + return nil } // ValidateUserID checks that 'input' can be parsed as a User ID diff --git a/resource-manager/devtestlab/2018-09-15/servicefabricschedules/id_servicefabric.go b/resource-manager/devtestlab/2018-09-15/servicefabricschedules/id_servicefabric.go index 8cf68719a91..d0118805ea8 100644 --- a/resource-manager/devtestlab/2018-09-15/servicefabricschedules/id_servicefabric.go +++ b/resource-manager/devtestlab/2018-09-15/servicefabricschedules/id_servicefabric.go @@ -40,27 +40,9 @@ func ParseServiceFabricID(input string) (*ServiceFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceFabricId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) - } - - if id.UserName, ok = parsed.Parsed["userName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userName", *parsed) - } - - if id.ServiceFabricName, ok = parsed.Parsed["serviceFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceFabricName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseServiceFabricIDInsensitively(input string) (*ServiceFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceFabricId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ServiceFabricId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - if id.UserName, ok = parsed.Parsed["userName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userName", *parsed) + if id.UserName, ok = input.Parsed["userName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userName", input) } - if id.ServiceFabricName, ok = parsed.Parsed["serviceFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceFabricName", *parsed) + if id.ServiceFabricName, ok = input.Parsed["serviceFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceFabricName", input) } - return &id, nil + return nil } // ValidateServiceFabricID checks that 'input' can be parsed as a Service Fabric ID diff --git a/resource-manager/devtestlab/2018-09-15/servicefabricschedules/id_servicefabricschedule.go b/resource-manager/devtestlab/2018-09-15/servicefabricschedules/id_servicefabricschedule.go index 2a769825def..75c679410a7 100644 --- a/resource-manager/devtestlab/2018-09-15/servicefabricschedules/id_servicefabricschedule.go +++ b/resource-manager/devtestlab/2018-09-15/servicefabricschedules/id_servicefabricschedule.go @@ -42,31 +42,9 @@ func ParseServiceFabricScheduleID(input string) (*ServiceFabricScheduleId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceFabricScheduleId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) - } - - if id.UserName, ok = parsed.Parsed["userName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userName", *parsed) - } - - if id.ServiceFabricName, ok = parsed.Parsed["serviceFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceFabricName", *parsed) - } - - if id.ScheduleName, ok = parsed.Parsed["scheduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseServiceFabricScheduleIDInsensitively(input string) (*ServiceFabricSche return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceFabricScheduleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceFabricScheduleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - if id.UserName, ok = parsed.Parsed["userName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userName", *parsed) + if id.UserName, ok = input.Parsed["userName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userName", input) } - if id.ServiceFabricName, ok = parsed.Parsed["serviceFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceFabricName", *parsed) + if id.ServiceFabricName, ok = input.Parsed["serviceFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceFabricName", input) } - if id.ScheduleName, ok = parsed.Parsed["scheduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", *parsed) + if id.ScheduleName, ok = input.Parsed["scheduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", input) } - return &id, nil + return nil } // ValidateServiceFabricScheduleID checks that 'input' can be parsed as a Service Fabric Schedule ID diff --git a/resource-manager/devtestlab/2018-09-15/servicerunners/id_servicerunner.go b/resource-manager/devtestlab/2018-09-15/servicerunners/id_servicerunner.go index 8f5500534df..2997e1fd603 100644 --- a/resource-manager/devtestlab/2018-09-15/servicerunners/id_servicerunner.go +++ b/resource-manager/devtestlab/2018-09-15/servicerunners/id_servicerunner.go @@ -38,23 +38,9 @@ func ParseServiceRunnerID(input string) (*ServiceRunnerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceRunnerId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) - } - - if id.ServiceRunnerName, ok = parsed.Parsed["serviceRunnerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceRunnerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseServiceRunnerIDInsensitively(input string) (*ServiceRunnerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceRunnerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ServiceRunnerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - if id.ServiceRunnerName, ok = parsed.Parsed["serviceRunnerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceRunnerName", *parsed) + if id.ServiceRunnerName, ok = input.Parsed["serviceRunnerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceRunnerName", input) } - return &id, nil + return nil } // ValidateServiceRunnerID checks that 'input' can be parsed as a Service Runner ID diff --git a/resource-manager/devtestlab/2018-09-15/users/id_lab.go b/resource-manager/devtestlab/2018-09-15/users/id_lab.go index 9bcc4126289..8bb1ce4f2b5 100644 --- a/resource-manager/devtestlab/2018-09-15/users/id_lab.go +++ b/resource-manager/devtestlab/2018-09-15/users/id_lab.go @@ -36,19 +36,9 @@ func ParseLabID(input string) (*LabId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLabIDInsensitively(input string) (*LabId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LabId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - return &id, nil + return nil } // ValidateLabID checks that 'input' can be parsed as a Lab ID diff --git a/resource-manager/devtestlab/2018-09-15/users/id_user.go b/resource-manager/devtestlab/2018-09-15/users/id_user.go index 5000a64931b..b8e091dfaa8 100644 --- a/resource-manager/devtestlab/2018-09-15/users/id_user.go +++ b/resource-manager/devtestlab/2018-09-15/users/id_user.go @@ -38,23 +38,9 @@ func ParseUserID(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) - } - - if id.UserName, ok = parsed.Parsed["userName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseUserIDInsensitively(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UserId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - if id.UserName, ok = parsed.Parsed["userName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userName", *parsed) + if id.UserName, ok = input.Parsed["userName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userName", input) } - return &id, nil + return nil } // ValidateUserID checks that 'input' can be parsed as a User ID diff --git a/resource-manager/devtestlab/2018-09-15/virtualmachines/id_lab.go b/resource-manager/devtestlab/2018-09-15/virtualmachines/id_lab.go index e3fa6aeafa8..56c60ad05cd 100644 --- a/resource-manager/devtestlab/2018-09-15/virtualmachines/id_lab.go +++ b/resource-manager/devtestlab/2018-09-15/virtualmachines/id_lab.go @@ -36,19 +36,9 @@ func ParseLabID(input string) (*LabId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLabIDInsensitively(input string) (*LabId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LabId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - return &id, nil + return nil } // ValidateLabID checks that 'input' can be parsed as a Lab ID diff --git a/resource-manager/devtestlab/2018-09-15/virtualmachines/id_virtualmachine.go b/resource-manager/devtestlab/2018-09-15/virtualmachines/id_virtualmachine.go index e7bdcaf025d..bc78618a129 100644 --- a/resource-manager/devtestlab/2018-09-15/virtualmachines/id_virtualmachine.go +++ b/resource-manager/devtestlab/2018-09-15/virtualmachines/id_virtualmachine.go @@ -38,23 +38,9 @@ func ParseVirtualMachineID(input string) (*VirtualMachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) - } - - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualMachineIDInsensitively(input string) (*VirtualMachineId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - return &id, nil + return nil } // ValidateVirtualMachineID checks that 'input' can be parsed as a Virtual Machine ID diff --git a/resource-manager/devtestlab/2018-09-15/virtualmachineschedules/id_virtualmachine.go b/resource-manager/devtestlab/2018-09-15/virtualmachineschedules/id_virtualmachine.go index 98f4035cf41..553ce599eb2 100644 --- a/resource-manager/devtestlab/2018-09-15/virtualmachineschedules/id_virtualmachine.go +++ b/resource-manager/devtestlab/2018-09-15/virtualmachineschedules/id_virtualmachine.go @@ -38,23 +38,9 @@ func ParseVirtualMachineID(input string) (*VirtualMachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) - } - - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualMachineIDInsensitively(input string) (*VirtualMachineId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - return &id, nil + return nil } // ValidateVirtualMachineID checks that 'input' can be parsed as a Virtual Machine ID diff --git a/resource-manager/devtestlab/2018-09-15/virtualmachineschedules/id_virtualmachineschedule.go b/resource-manager/devtestlab/2018-09-15/virtualmachineschedules/id_virtualmachineschedule.go index 05986677849..767c284e31a 100644 --- a/resource-manager/devtestlab/2018-09-15/virtualmachineschedules/id_virtualmachineschedule.go +++ b/resource-manager/devtestlab/2018-09-15/virtualmachineschedules/id_virtualmachineschedule.go @@ -40,27 +40,9 @@ func ParseVirtualMachineScheduleID(input string) (*VirtualMachineScheduleId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScheduleId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) - } - - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) - } - - if id.ScheduleName, ok = parsed.Parsed["scheduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVirtualMachineScheduleIDInsensitively(input string) (*VirtualMachineSc return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScheduleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VirtualMachineScheduleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - if id.ScheduleName, ok = parsed.Parsed["scheduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", *parsed) + if id.ScheduleName, ok = input.Parsed["scheduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", input) } - return &id, nil + return nil } // ValidateVirtualMachineScheduleID checks that 'input' can be parsed as a Virtual Machine Schedule ID diff --git a/resource-manager/devtestlab/2018-09-15/virtualnetworks/id_lab.go b/resource-manager/devtestlab/2018-09-15/virtualnetworks/id_lab.go index a88c8097bb7..64bcf79c4f1 100644 --- a/resource-manager/devtestlab/2018-09-15/virtualnetworks/id_lab.go +++ b/resource-manager/devtestlab/2018-09-15/virtualnetworks/id_lab.go @@ -36,19 +36,9 @@ func ParseLabID(input string) (*LabId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLabIDInsensitively(input string) (*LabId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LabId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - return &id, nil + return nil } // ValidateLabID checks that 'input' can be parsed as a Lab ID diff --git a/resource-manager/devtestlab/2018-09-15/virtualnetworks/id_virtualnetwork.go b/resource-manager/devtestlab/2018-09-15/virtualnetworks/id_virtualnetwork.go index 614c6f171b1..977d2e57807 100644 --- a/resource-manager/devtestlab/2018-09-15/virtualnetworks/id_virtualnetwork.go +++ b/resource-manager/devtestlab/2018-09-15/virtualnetworks/id_virtualnetwork.go @@ -38,23 +38,9 @@ func ParseVirtualNetworkID(input string) (*VirtualNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) - } - - if id.VirtualNetworkName, ok = parsed.Parsed["virtualNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualNetworkIDInsensitively(input string) (*VirtualNetworkId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualNetworkId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - if id.VirtualNetworkName, ok = parsed.Parsed["virtualNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkName", *parsed) + if id.VirtualNetworkName, ok = input.Parsed["virtualNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkName", input) } - return &id, nil + return nil } // ValidateVirtualNetworkID checks that 'input' can be parsed as a Virtual Network ID diff --git a/resource-manager/digitaltwins/2023-01-31/checknameavailability/id_location.go b/resource-manager/digitaltwins/2023-01-31/checknameavailability/id_location.go index b60d04ecd34..231b98dfefa 100644 --- a/resource-manager/digitaltwins/2023-01-31/checknameavailability/id_location.go +++ b/resource-manager/digitaltwins/2023-01-31/checknameavailability/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/digitaltwins/2023-01-31/digitaltwinsinstance/id_digitaltwinsinstance.go b/resource-manager/digitaltwins/2023-01-31/digitaltwinsinstance/id_digitaltwinsinstance.go index c31c9503ed7..8d26366babc 100644 --- a/resource-manager/digitaltwins/2023-01-31/digitaltwinsinstance/id_digitaltwinsinstance.go +++ b/resource-manager/digitaltwins/2023-01-31/digitaltwinsinstance/id_digitaltwinsinstance.go @@ -36,19 +36,9 @@ func ParseDigitalTwinsInstanceID(input string) (*DigitalTwinsInstanceId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DigitalTwinsInstanceId{} - - 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.DigitalTwinsInstanceName, ok = parsed.Parsed["digitalTwinsInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "digitalTwinsInstanceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDigitalTwinsInstanceIDInsensitively(input string) (*DigitalTwinsInstan return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DigitalTwinsInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DigitalTwinsInstanceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DigitalTwinsInstanceName, ok = parsed.Parsed["digitalTwinsInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "digitalTwinsInstanceName", *parsed) + if id.DigitalTwinsInstanceName, ok = input.Parsed["digitalTwinsInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "digitalTwinsInstanceName", input) } - return &id, nil + return nil } // ValidateDigitalTwinsInstanceID checks that 'input' can be parsed as a Digital Twins Instance ID diff --git a/resource-manager/digitaltwins/2023-01-31/endpoints/id_digitaltwinsinstance.go b/resource-manager/digitaltwins/2023-01-31/endpoints/id_digitaltwinsinstance.go index ebd06264c6c..335e119d774 100644 --- a/resource-manager/digitaltwins/2023-01-31/endpoints/id_digitaltwinsinstance.go +++ b/resource-manager/digitaltwins/2023-01-31/endpoints/id_digitaltwinsinstance.go @@ -36,19 +36,9 @@ func ParseDigitalTwinsInstanceID(input string) (*DigitalTwinsInstanceId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DigitalTwinsInstanceId{} - - 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.DigitalTwinsInstanceName, ok = parsed.Parsed["digitalTwinsInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "digitalTwinsInstanceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDigitalTwinsInstanceIDInsensitively(input string) (*DigitalTwinsInstan return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DigitalTwinsInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DigitalTwinsInstanceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DigitalTwinsInstanceName, ok = parsed.Parsed["digitalTwinsInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "digitalTwinsInstanceName", *parsed) + if id.DigitalTwinsInstanceName, ok = input.Parsed["digitalTwinsInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "digitalTwinsInstanceName", input) } - return &id, nil + return nil } // ValidateDigitalTwinsInstanceID checks that 'input' can be parsed as a Digital Twins Instance ID diff --git a/resource-manager/digitaltwins/2023-01-31/endpoints/id_endpoint.go b/resource-manager/digitaltwins/2023-01-31/endpoints/id_endpoint.go index e400d6363c1..164a98c7ec0 100644 --- a/resource-manager/digitaltwins/2023-01-31/endpoints/id_endpoint.go +++ b/resource-manager/digitaltwins/2023-01-31/endpoints/id_endpoint.go @@ -38,23 +38,9 @@ func ParseEndpointID(input string) (*EndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EndpointId{} - - 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.DigitalTwinsInstanceName, ok = parsed.Parsed["digitalTwinsInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "digitalTwinsInstanceName", *parsed) - } - - if id.EndpointName, ok = parsed.Parsed["endpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "endpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseEndpointIDInsensitively(input string) (*EndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EndpointId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DigitalTwinsInstanceName, ok = parsed.Parsed["digitalTwinsInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "digitalTwinsInstanceName", *parsed) + if id.DigitalTwinsInstanceName, ok = input.Parsed["digitalTwinsInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "digitalTwinsInstanceName", input) } - if id.EndpointName, ok = parsed.Parsed["endpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "endpointName", *parsed) + if id.EndpointName, ok = input.Parsed["endpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "endpointName", input) } - return &id, nil + return nil } // ValidateEndpointID checks that 'input' can be parsed as a Endpoint ID diff --git a/resource-manager/digitaltwins/2023-01-31/privateendpoints/id_digitaltwinsinstance.go b/resource-manager/digitaltwins/2023-01-31/privateendpoints/id_digitaltwinsinstance.go index 56de5fb6868..836d1390d42 100644 --- a/resource-manager/digitaltwins/2023-01-31/privateendpoints/id_digitaltwinsinstance.go +++ b/resource-manager/digitaltwins/2023-01-31/privateendpoints/id_digitaltwinsinstance.go @@ -36,19 +36,9 @@ func ParseDigitalTwinsInstanceID(input string) (*DigitalTwinsInstanceId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DigitalTwinsInstanceId{} - - 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.DigitalTwinsInstanceName, ok = parsed.Parsed["digitalTwinsInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "digitalTwinsInstanceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDigitalTwinsInstanceIDInsensitively(input string) (*DigitalTwinsInstan return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DigitalTwinsInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DigitalTwinsInstanceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DigitalTwinsInstanceName, ok = parsed.Parsed["digitalTwinsInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "digitalTwinsInstanceName", *parsed) + if id.DigitalTwinsInstanceName, ok = input.Parsed["digitalTwinsInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "digitalTwinsInstanceName", input) } - return &id, nil + return nil } // ValidateDigitalTwinsInstanceID checks that 'input' can be parsed as a Digital Twins Instance ID diff --git a/resource-manager/digitaltwins/2023-01-31/privateendpoints/id_privateendpointconnection.go b/resource-manager/digitaltwins/2023-01-31/privateendpoints/id_privateendpointconnection.go index 4779d40f87f..623da089e76 100644 --- a/resource-manager/digitaltwins/2023-01-31/privateendpoints/id_privateendpointconnection.go +++ b/resource-manager/digitaltwins/2023-01-31/privateendpoints/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.DigitalTwinsInstanceName, ok = parsed.Parsed["digitalTwinsInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "digitalTwinsInstanceName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DigitalTwinsInstanceName, ok = parsed.Parsed["digitalTwinsInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "digitalTwinsInstanceName", *parsed) + if id.DigitalTwinsInstanceName, ok = input.Parsed["digitalTwinsInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "digitalTwinsInstanceName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/digitaltwins/2023-01-31/privateendpoints/id_resource.go b/resource-manager/digitaltwins/2023-01-31/privateendpoints/id_resource.go index 081cd0821d0..b6a982c3a7a 100644 --- a/resource-manager/digitaltwins/2023-01-31/privateendpoints/id_resource.go +++ b/resource-manager/digitaltwins/2023-01-31/privateendpoints/id_resource.go @@ -38,23 +38,9 @@ func ParseResourceID(input string) (*ResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResourceId{} - - 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.DigitalTwinsInstanceName, ok = parsed.Parsed["digitalTwinsInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "digitalTwinsInstanceName", *parsed) - } - - if id.ResourceId, ok = parsed.Parsed["resourceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseResourceIDInsensitively(input string) (*ResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DigitalTwinsInstanceName, ok = parsed.Parsed["digitalTwinsInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "digitalTwinsInstanceName", *parsed) + if id.DigitalTwinsInstanceName, ok = input.Parsed["digitalTwinsInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "digitalTwinsInstanceName", input) } - if id.ResourceId, ok = parsed.Parsed["resourceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceId", *parsed) + if id.ResourceId, ok = input.Parsed["resourceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceId", input) } - return &id, nil + return nil } // ValidateResourceID checks that 'input' can be parsed as a Resource ID diff --git a/resource-manager/digitaltwins/2023-01-31/timeseriesdatabaseconnections/id_digitaltwinsinstance.go b/resource-manager/digitaltwins/2023-01-31/timeseriesdatabaseconnections/id_digitaltwinsinstance.go index 54ce9ef2f07..4cbe50bec06 100644 --- a/resource-manager/digitaltwins/2023-01-31/timeseriesdatabaseconnections/id_digitaltwinsinstance.go +++ b/resource-manager/digitaltwins/2023-01-31/timeseriesdatabaseconnections/id_digitaltwinsinstance.go @@ -36,19 +36,9 @@ func ParseDigitalTwinsInstanceID(input string) (*DigitalTwinsInstanceId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DigitalTwinsInstanceId{} - - 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.DigitalTwinsInstanceName, ok = parsed.Parsed["digitalTwinsInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "digitalTwinsInstanceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDigitalTwinsInstanceIDInsensitively(input string) (*DigitalTwinsInstan return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DigitalTwinsInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DigitalTwinsInstanceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DigitalTwinsInstanceName, ok = parsed.Parsed["digitalTwinsInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "digitalTwinsInstanceName", *parsed) + if id.DigitalTwinsInstanceName, ok = input.Parsed["digitalTwinsInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "digitalTwinsInstanceName", input) } - return &id, nil + return nil } // ValidateDigitalTwinsInstanceID checks that 'input' can be parsed as a Digital Twins Instance ID diff --git a/resource-manager/digitaltwins/2023-01-31/timeseriesdatabaseconnections/id_timeseriesdatabaseconnection.go b/resource-manager/digitaltwins/2023-01-31/timeseriesdatabaseconnections/id_timeseriesdatabaseconnection.go index 44d963c66fe..b9481352626 100644 --- a/resource-manager/digitaltwins/2023-01-31/timeseriesdatabaseconnections/id_timeseriesdatabaseconnection.go +++ b/resource-manager/digitaltwins/2023-01-31/timeseriesdatabaseconnections/id_timeseriesdatabaseconnection.go @@ -38,23 +38,9 @@ func ParseTimeSeriesDatabaseConnectionID(input string) (*TimeSeriesDatabaseConne return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TimeSeriesDatabaseConnectionId{} - - 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.DigitalTwinsInstanceName, ok = parsed.Parsed["digitalTwinsInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "digitalTwinsInstanceName", *parsed) - } - - if id.TimeSeriesDatabaseConnectionName, ok = parsed.Parsed["timeSeriesDatabaseConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "timeSeriesDatabaseConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTimeSeriesDatabaseConnectionIDInsensitively(input string) (*TimeSeries return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TimeSeriesDatabaseConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TimeSeriesDatabaseConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DigitalTwinsInstanceName, ok = parsed.Parsed["digitalTwinsInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "digitalTwinsInstanceName", *parsed) + if id.DigitalTwinsInstanceName, ok = input.Parsed["digitalTwinsInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "digitalTwinsInstanceName", input) } - if id.TimeSeriesDatabaseConnectionName, ok = parsed.Parsed["timeSeriesDatabaseConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "timeSeriesDatabaseConnectionName", *parsed) + if id.TimeSeriesDatabaseConnectionName, ok = input.Parsed["timeSeriesDatabaseConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "timeSeriesDatabaseConnectionName", input) } - return &id, nil + return nil } // ValidateTimeSeriesDatabaseConnectionID checks that 'input' can be parsed as a Time Series Database Connection ID diff --git a/resource-manager/dns/2018-05-01/recordsets/id_dnszone.go b/resource-manager/dns/2018-05-01/recordsets/id_dnszone.go index cc718e896e3..cc897d63892 100644 --- a/resource-manager/dns/2018-05-01/recordsets/id_dnszone.go +++ b/resource-manager/dns/2018-05-01/recordsets/id_dnszone.go @@ -36,19 +36,9 @@ func ParseDnsZoneID(input string) (*DnsZoneId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DnsZoneId{} - - 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.DnsZoneName, ok = parsed.Parsed["dnsZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dnsZoneName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDnsZoneIDInsensitively(input string) (*DnsZoneId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DnsZoneId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DnsZoneName, ok = parsed.Parsed["dnsZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dnsZoneName", *parsed) + if id.DnsZoneName, ok = input.Parsed["dnsZoneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dnsZoneName", input) } - return &id, nil + return nil } // ValidateDnsZoneID checks that 'input' can be parsed as a Dns Zone ID diff --git a/resource-manager/dns/2018-05-01/recordsets/id_recordtype.go b/resource-manager/dns/2018-05-01/recordsets/id_recordtype.go index df4c2505ff8..402f6227b61 100644 --- a/resource-manager/dns/2018-05-01/recordsets/id_recordtype.go +++ b/resource-manager/dns/2018-05-01/recordsets/id_recordtype.go @@ -40,35 +40,9 @@ func ParseRecordTypeID(input string) (*RecordTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecordTypeId{} - - 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.DnsZoneName, ok = parsed.Parsed["dnsZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dnsZoneName", *parsed) - } - - if v, ok := parsed.Parsed["recordType"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recordType", *parsed) - } - - recordType, err := parseRecordType(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.RecordType = *recordType - } - - if id.RelativeRecordSetName, ok = parsed.Parsed["relativeRecordSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "relativeRecordSetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -83,38 +57,46 @@ func ParseRecordTypeIDInsensitively(input string) (*RecordTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecordTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RecordTypeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DnsZoneName, ok = parsed.Parsed["dnsZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dnsZoneName", *parsed) + if id.DnsZoneName, ok = input.Parsed["dnsZoneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dnsZoneName", input) } - if v, ok := parsed.Parsed["recordType"]; true { + if v, ok := input.Parsed["recordType"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recordType", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "recordType", input) } recordType, err := parseRecordType(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.RecordType = *recordType } - if id.RelativeRecordSetName, ok = parsed.Parsed["relativeRecordSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "relativeRecordSetName", *parsed) + if id.RelativeRecordSetName, ok = input.Parsed["relativeRecordSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "relativeRecordSetName", input) } - return &id, nil + return nil } // ValidateRecordTypeID checks that 'input' can be parsed as a Record Type ID diff --git a/resource-manager/dns/2018-05-01/recordsets/id_zone.go b/resource-manager/dns/2018-05-01/recordsets/id_zone.go index 1bae4d3bcd7..cc8cd58e42b 100644 --- a/resource-manager/dns/2018-05-01/recordsets/id_zone.go +++ b/resource-manager/dns/2018-05-01/recordsets/id_zone.go @@ -38,31 +38,9 @@ func ParseZoneID(input string) (*ZoneId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ZoneId{} - - 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.DnsZoneName, ok = parsed.Parsed["dnsZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dnsZoneName", *parsed) - } - - if v, ok := parsed.Parsed["recordType"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recordType", *parsed) - } - - recordType, err := parseRecordType(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.RecordType = *recordType + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -77,34 +55,42 @@ func ParseZoneIDInsensitively(input string) (*ZoneId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ZoneId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ZoneId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DnsZoneName, ok = parsed.Parsed["dnsZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dnsZoneName", *parsed) + if id.DnsZoneName, ok = input.Parsed["dnsZoneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dnsZoneName", input) } - if v, ok := parsed.Parsed["recordType"]; true { + if v, ok := input.Parsed["recordType"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recordType", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "recordType", input) } recordType, err := parseRecordType(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.RecordType = *recordType } - return &id, nil + return nil } // ValidateZoneID checks that 'input' can be parsed as a Zone ID diff --git a/resource-manager/dns/2018-05-01/zones/id_dnszone.go b/resource-manager/dns/2018-05-01/zones/id_dnszone.go index a77b87a0da6..08066365b61 100644 --- a/resource-manager/dns/2018-05-01/zones/id_dnszone.go +++ b/resource-manager/dns/2018-05-01/zones/id_dnszone.go @@ -36,19 +36,9 @@ func ParseDnsZoneID(input string) (*DnsZoneId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DnsZoneId{} - - 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.DnsZoneName, ok = parsed.Parsed["dnsZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dnsZoneName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDnsZoneIDInsensitively(input string) (*DnsZoneId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DnsZoneId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DnsZoneName, ok = parsed.Parsed["dnsZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dnsZoneName", *parsed) + if id.DnsZoneName, ok = input.Parsed["dnsZoneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dnsZoneName", input) } - return &id, nil + return nil } // ValidateDnsZoneID checks that 'input' can be parsed as a Dns Zone ID diff --git a/resource-manager/dnsresolver/2022-07-01/dnsforwardingrulesets/id_dnsforwardingruleset.go b/resource-manager/dnsresolver/2022-07-01/dnsforwardingrulesets/id_dnsforwardingruleset.go index b1ccd9cb966..c4d9e81a8ed 100644 --- a/resource-manager/dnsresolver/2022-07-01/dnsforwardingrulesets/id_dnsforwardingruleset.go +++ b/resource-manager/dnsresolver/2022-07-01/dnsforwardingrulesets/id_dnsforwardingruleset.go @@ -36,19 +36,9 @@ func ParseDnsForwardingRulesetID(input string) (*DnsForwardingRulesetId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DnsForwardingRulesetId{} - - 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.DnsForwardingRulesetName, ok = parsed.Parsed["dnsForwardingRulesetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dnsForwardingRulesetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDnsForwardingRulesetIDInsensitively(input string) (*DnsForwardingRules return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DnsForwardingRulesetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DnsForwardingRulesetId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DnsForwardingRulesetName, ok = parsed.Parsed["dnsForwardingRulesetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dnsForwardingRulesetName", *parsed) + if id.DnsForwardingRulesetName, ok = input.Parsed["dnsForwardingRulesetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dnsForwardingRulesetName", input) } - return &id, nil + return nil } // ValidateDnsForwardingRulesetID checks that 'input' can be parsed as a Dns Forwarding Ruleset ID diff --git a/resource-manager/dnsresolver/2022-07-01/dnsresolvers/id_dnsresolver.go b/resource-manager/dnsresolver/2022-07-01/dnsresolvers/id_dnsresolver.go index 3391ba327ba..3ecc06ccb97 100644 --- a/resource-manager/dnsresolver/2022-07-01/dnsresolvers/id_dnsresolver.go +++ b/resource-manager/dnsresolver/2022-07-01/dnsresolvers/id_dnsresolver.go @@ -36,19 +36,9 @@ func ParseDnsResolverID(input string) (*DnsResolverId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DnsResolverId{} - - 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.DnsResolverName, ok = parsed.Parsed["dnsResolverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dnsResolverName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDnsResolverIDInsensitively(input string) (*DnsResolverId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DnsResolverId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DnsResolverId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DnsResolverName, ok = parsed.Parsed["dnsResolverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dnsResolverName", *parsed) + if id.DnsResolverName, ok = input.Parsed["dnsResolverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dnsResolverName", input) } - return &id, nil + return nil } // ValidateDnsResolverID checks that 'input' can be parsed as a Dns Resolver ID diff --git a/resource-manager/dnsresolver/2022-07-01/forwardingrules/id_dnsforwardingruleset.go b/resource-manager/dnsresolver/2022-07-01/forwardingrules/id_dnsforwardingruleset.go index 90d16dd07fe..e477672bcf5 100644 --- a/resource-manager/dnsresolver/2022-07-01/forwardingrules/id_dnsforwardingruleset.go +++ b/resource-manager/dnsresolver/2022-07-01/forwardingrules/id_dnsforwardingruleset.go @@ -36,19 +36,9 @@ func ParseDnsForwardingRulesetID(input string) (*DnsForwardingRulesetId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DnsForwardingRulesetId{} - - 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.DnsForwardingRulesetName, ok = parsed.Parsed["dnsForwardingRulesetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dnsForwardingRulesetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDnsForwardingRulesetIDInsensitively(input string) (*DnsForwardingRules return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DnsForwardingRulesetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DnsForwardingRulesetId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DnsForwardingRulesetName, ok = parsed.Parsed["dnsForwardingRulesetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dnsForwardingRulesetName", *parsed) + if id.DnsForwardingRulesetName, ok = input.Parsed["dnsForwardingRulesetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dnsForwardingRulesetName", input) } - return &id, nil + return nil } // ValidateDnsForwardingRulesetID checks that 'input' can be parsed as a Dns Forwarding Ruleset ID diff --git a/resource-manager/dnsresolver/2022-07-01/forwardingrules/id_forwardingrule.go b/resource-manager/dnsresolver/2022-07-01/forwardingrules/id_forwardingrule.go index 27544725a52..ef6fecc29bd 100644 --- a/resource-manager/dnsresolver/2022-07-01/forwardingrules/id_forwardingrule.go +++ b/resource-manager/dnsresolver/2022-07-01/forwardingrules/id_forwardingrule.go @@ -38,23 +38,9 @@ func ParseForwardingRuleID(input string) (*ForwardingRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ForwardingRuleId{} - - 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.DnsForwardingRulesetName, ok = parsed.Parsed["dnsForwardingRulesetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dnsForwardingRulesetName", *parsed) - } - - if id.ForwardingRuleName, ok = parsed.Parsed["forwardingRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "forwardingRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseForwardingRuleIDInsensitively(input string) (*ForwardingRuleId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ForwardingRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ForwardingRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DnsForwardingRulesetName, ok = parsed.Parsed["dnsForwardingRulesetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dnsForwardingRulesetName", *parsed) + if id.DnsForwardingRulesetName, ok = input.Parsed["dnsForwardingRulesetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dnsForwardingRulesetName", input) } - if id.ForwardingRuleName, ok = parsed.Parsed["forwardingRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "forwardingRuleName", *parsed) + if id.ForwardingRuleName, ok = input.Parsed["forwardingRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "forwardingRuleName", input) } - return &id, nil + return nil } // ValidateForwardingRuleID checks that 'input' can be parsed as a Forwarding Rule ID diff --git a/resource-manager/dnsresolver/2022-07-01/inboundendpoints/id_dnsresolver.go b/resource-manager/dnsresolver/2022-07-01/inboundendpoints/id_dnsresolver.go index 039bd670103..dd1926ef573 100644 --- a/resource-manager/dnsresolver/2022-07-01/inboundendpoints/id_dnsresolver.go +++ b/resource-manager/dnsresolver/2022-07-01/inboundendpoints/id_dnsresolver.go @@ -36,19 +36,9 @@ func ParseDnsResolverID(input string) (*DnsResolverId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DnsResolverId{} - - 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.DnsResolverName, ok = parsed.Parsed["dnsResolverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dnsResolverName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDnsResolverIDInsensitively(input string) (*DnsResolverId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DnsResolverId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DnsResolverId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DnsResolverName, ok = parsed.Parsed["dnsResolverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dnsResolverName", *parsed) + if id.DnsResolverName, ok = input.Parsed["dnsResolverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dnsResolverName", input) } - return &id, nil + return nil } // ValidateDnsResolverID checks that 'input' can be parsed as a Dns Resolver ID diff --git a/resource-manager/dnsresolver/2022-07-01/inboundendpoints/id_inboundendpoint.go b/resource-manager/dnsresolver/2022-07-01/inboundendpoints/id_inboundendpoint.go index 27009d9b9ab..4c8c604cd00 100644 --- a/resource-manager/dnsresolver/2022-07-01/inboundendpoints/id_inboundendpoint.go +++ b/resource-manager/dnsresolver/2022-07-01/inboundendpoints/id_inboundendpoint.go @@ -38,23 +38,9 @@ func ParseInboundEndpointID(input string) (*InboundEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InboundEndpointId{} - - 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.DnsResolverName, ok = parsed.Parsed["dnsResolverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dnsResolverName", *parsed) - } - - if id.InboundEndpointName, ok = parsed.Parsed["inboundEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "inboundEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseInboundEndpointIDInsensitively(input string) (*InboundEndpointId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InboundEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *InboundEndpointId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DnsResolverName, ok = parsed.Parsed["dnsResolverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dnsResolverName", *parsed) + if id.DnsResolverName, ok = input.Parsed["dnsResolverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dnsResolverName", input) } - if id.InboundEndpointName, ok = parsed.Parsed["inboundEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "inboundEndpointName", *parsed) + if id.InboundEndpointName, ok = input.Parsed["inboundEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "inboundEndpointName", input) } - return &id, nil + return nil } // ValidateInboundEndpointID checks that 'input' can be parsed as a Inbound Endpoint ID diff --git a/resource-manager/dnsresolver/2022-07-01/outboundendpoints/id_dnsresolver.go b/resource-manager/dnsresolver/2022-07-01/outboundendpoints/id_dnsresolver.go index fe96231aeba..f0dc40cb09a 100644 --- a/resource-manager/dnsresolver/2022-07-01/outboundendpoints/id_dnsresolver.go +++ b/resource-manager/dnsresolver/2022-07-01/outboundendpoints/id_dnsresolver.go @@ -36,19 +36,9 @@ func ParseDnsResolverID(input string) (*DnsResolverId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DnsResolverId{} - - 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.DnsResolverName, ok = parsed.Parsed["dnsResolverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dnsResolverName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDnsResolverIDInsensitively(input string) (*DnsResolverId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DnsResolverId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DnsResolverId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DnsResolverName, ok = parsed.Parsed["dnsResolverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dnsResolverName", *parsed) + if id.DnsResolverName, ok = input.Parsed["dnsResolverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dnsResolverName", input) } - return &id, nil + return nil } // ValidateDnsResolverID checks that 'input' can be parsed as a Dns Resolver ID diff --git a/resource-manager/dnsresolver/2022-07-01/outboundendpoints/id_outboundendpoint.go b/resource-manager/dnsresolver/2022-07-01/outboundendpoints/id_outboundendpoint.go index 77cbcf27529..c26d61b1ca2 100644 --- a/resource-manager/dnsresolver/2022-07-01/outboundendpoints/id_outboundendpoint.go +++ b/resource-manager/dnsresolver/2022-07-01/outboundendpoints/id_outboundendpoint.go @@ -38,23 +38,9 @@ func ParseOutboundEndpointID(input string) (*OutboundEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OutboundEndpointId{} - - 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.DnsResolverName, ok = parsed.Parsed["dnsResolverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dnsResolverName", *parsed) - } - - if id.OutboundEndpointName, ok = parsed.Parsed["outboundEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "outboundEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseOutboundEndpointIDInsensitively(input string) (*OutboundEndpointId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OutboundEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OutboundEndpointId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DnsResolverName, ok = parsed.Parsed["dnsResolverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dnsResolverName", *parsed) + if id.DnsResolverName, ok = input.Parsed["dnsResolverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dnsResolverName", input) } - if id.OutboundEndpointName, ok = parsed.Parsed["outboundEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "outboundEndpointName", *parsed) + if id.OutboundEndpointName, ok = input.Parsed["outboundEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "outboundEndpointName", input) } - return &id, nil + return nil } // ValidateOutboundEndpointID checks that 'input' can be parsed as a Outbound Endpoint ID diff --git a/resource-manager/dnsresolver/2022-07-01/virtualnetworklinks/id_dnsforwardingruleset.go b/resource-manager/dnsresolver/2022-07-01/virtualnetworklinks/id_dnsforwardingruleset.go index 45587ad8d27..da9e7d9b720 100644 --- a/resource-manager/dnsresolver/2022-07-01/virtualnetworklinks/id_dnsforwardingruleset.go +++ b/resource-manager/dnsresolver/2022-07-01/virtualnetworklinks/id_dnsforwardingruleset.go @@ -36,19 +36,9 @@ func ParseDnsForwardingRulesetID(input string) (*DnsForwardingRulesetId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DnsForwardingRulesetId{} - - 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.DnsForwardingRulesetName, ok = parsed.Parsed["dnsForwardingRulesetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dnsForwardingRulesetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDnsForwardingRulesetIDInsensitively(input string) (*DnsForwardingRules return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DnsForwardingRulesetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DnsForwardingRulesetId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DnsForwardingRulesetName, ok = parsed.Parsed["dnsForwardingRulesetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dnsForwardingRulesetName", *parsed) + if id.DnsForwardingRulesetName, ok = input.Parsed["dnsForwardingRulesetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dnsForwardingRulesetName", input) } - return &id, nil + return nil } // ValidateDnsForwardingRulesetID checks that 'input' can be parsed as a Dns Forwarding Ruleset ID diff --git a/resource-manager/dnsresolver/2022-07-01/virtualnetworklinks/id_virtualnetworklink.go b/resource-manager/dnsresolver/2022-07-01/virtualnetworklinks/id_virtualnetworklink.go index 09819b7f7b6..bf1a390b5b8 100644 --- a/resource-manager/dnsresolver/2022-07-01/virtualnetworklinks/id_virtualnetworklink.go +++ b/resource-manager/dnsresolver/2022-07-01/virtualnetworklinks/id_virtualnetworklink.go @@ -38,23 +38,9 @@ func ParseVirtualNetworkLinkID(input string) (*VirtualNetworkLinkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkLinkId{} - - 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.DnsForwardingRulesetName, ok = parsed.Parsed["dnsForwardingRulesetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dnsForwardingRulesetName", *parsed) - } - - if id.VirtualNetworkLinkName, ok = parsed.Parsed["virtualNetworkLinkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkLinkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualNetworkLinkIDInsensitively(input string) (*VirtualNetworkLinkId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkLinkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualNetworkLinkId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DnsForwardingRulesetName, ok = parsed.Parsed["dnsForwardingRulesetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dnsForwardingRulesetName", *parsed) + if id.DnsForwardingRulesetName, ok = input.Parsed["dnsForwardingRulesetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dnsForwardingRulesetName", input) } - if id.VirtualNetworkLinkName, ok = parsed.Parsed["virtualNetworkLinkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkLinkName", *parsed) + if id.VirtualNetworkLinkName, ok = input.Parsed["virtualNetworkLinkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkLinkName", input) } - return &id, nil + return nil } // ValidateVirtualNetworkLinkID checks that 'input' can be parsed as a Virtual Network Link ID diff --git a/resource-manager/dynatrace/2021-09-01/monitors/id_monitor.go b/resource-manager/dynatrace/2021-09-01/monitors/id_monitor.go index 717b06c04fe..136bf0c79e4 100644 --- a/resource-manager/dynatrace/2021-09-01/monitors/id_monitor.go +++ b/resource-manager/dynatrace/2021-09-01/monitors/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/dynatrace/2021-09-01/singlesignon/id_monitor.go b/resource-manager/dynatrace/2021-09-01/singlesignon/id_monitor.go index c69bc6112c4..26ec9d3d001 100644 --- a/resource-manager/dynatrace/2021-09-01/singlesignon/id_monitor.go +++ b/resource-manager/dynatrace/2021-09-01/singlesignon/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/dynatrace/2021-09-01/singlesignon/id_singlesignonconfiguration.go b/resource-manager/dynatrace/2021-09-01/singlesignon/id_singlesignonconfiguration.go index 518426bfa82..504dcb0c135 100644 --- a/resource-manager/dynatrace/2021-09-01/singlesignon/id_singlesignonconfiguration.go +++ b/resource-manager/dynatrace/2021-09-01/singlesignon/id_singlesignonconfiguration.go @@ -38,23 +38,9 @@ func ParseSingleSignOnConfigurationID(input string) (*SingleSignOnConfigurationI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SingleSignOnConfigurationId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) - } - - if id.SingleSignOnConfigurationName, ok = parsed.Parsed["singleSignOnConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "singleSignOnConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSingleSignOnConfigurationIDInsensitively(input string) (*SingleSignOnC return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SingleSignOnConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SingleSignOnConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - if id.SingleSignOnConfigurationName, ok = parsed.Parsed["singleSignOnConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "singleSignOnConfigurationName", *parsed) + if id.SingleSignOnConfigurationName, ok = input.Parsed["singleSignOnConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "singleSignOnConfigurationName", input) } - return &id, nil + return nil } // ValidateSingleSignOnConfigurationID checks that 'input' can be parsed as a Single Sign On Configuration ID diff --git a/resource-manager/dynatrace/2021-09-01/tagrules/id_monitor.go b/resource-manager/dynatrace/2021-09-01/tagrules/id_monitor.go index fcbea279bf7..071e11b170b 100644 --- a/resource-manager/dynatrace/2021-09-01/tagrules/id_monitor.go +++ b/resource-manager/dynatrace/2021-09-01/tagrules/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/dynatrace/2021-09-01/tagrules/id_tagrule.go b/resource-manager/dynatrace/2021-09-01/tagrules/id_tagrule.go index d0e965d46a4..ff33ac26ba5 100644 --- a/resource-manager/dynatrace/2021-09-01/tagrules/id_tagrule.go +++ b/resource-manager/dynatrace/2021-09-01/tagrules/id_tagrule.go @@ -38,23 +38,9 @@ func ParseTagRuleID(input string) (*TagRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TagRuleId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) - } - - if id.TagRuleName, ok = parsed.Parsed["tagRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTagRuleIDInsensitively(input string) (*TagRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TagRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TagRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - if id.TagRuleName, ok = parsed.Parsed["tagRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagRuleName", *parsed) + if id.TagRuleName, ok = input.Parsed["tagRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tagRuleName", input) } - return &id, nil + return nil } // ValidateTagRuleID checks that 'input' can be parsed as a Tag Rule ID diff --git a/resource-manager/dynatrace/2023-04-27/monitors/id_monitor.go b/resource-manager/dynatrace/2023-04-27/monitors/id_monitor.go index 717b06c04fe..136bf0c79e4 100644 --- a/resource-manager/dynatrace/2023-04-27/monitors/id_monitor.go +++ b/resource-manager/dynatrace/2023-04-27/monitors/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/dynatrace/2023-04-27/singlesignon/id_monitor.go b/resource-manager/dynatrace/2023-04-27/singlesignon/id_monitor.go index c69bc6112c4..26ec9d3d001 100644 --- a/resource-manager/dynatrace/2023-04-27/singlesignon/id_monitor.go +++ b/resource-manager/dynatrace/2023-04-27/singlesignon/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/dynatrace/2023-04-27/singlesignon/id_singlesignonconfiguration.go b/resource-manager/dynatrace/2023-04-27/singlesignon/id_singlesignonconfiguration.go index 518426bfa82..504dcb0c135 100644 --- a/resource-manager/dynatrace/2023-04-27/singlesignon/id_singlesignonconfiguration.go +++ b/resource-manager/dynatrace/2023-04-27/singlesignon/id_singlesignonconfiguration.go @@ -38,23 +38,9 @@ func ParseSingleSignOnConfigurationID(input string) (*SingleSignOnConfigurationI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SingleSignOnConfigurationId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) - } - - if id.SingleSignOnConfigurationName, ok = parsed.Parsed["singleSignOnConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "singleSignOnConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSingleSignOnConfigurationIDInsensitively(input string) (*SingleSignOnC return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SingleSignOnConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SingleSignOnConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - if id.SingleSignOnConfigurationName, ok = parsed.Parsed["singleSignOnConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "singleSignOnConfigurationName", *parsed) + if id.SingleSignOnConfigurationName, ok = input.Parsed["singleSignOnConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "singleSignOnConfigurationName", input) } - return &id, nil + return nil } // ValidateSingleSignOnConfigurationID checks that 'input' can be parsed as a Single Sign On Configuration ID diff --git a/resource-manager/dynatrace/2023-04-27/tagrules/id_monitor.go b/resource-manager/dynatrace/2023-04-27/tagrules/id_monitor.go index fcbea279bf7..071e11b170b 100644 --- a/resource-manager/dynatrace/2023-04-27/tagrules/id_monitor.go +++ b/resource-manager/dynatrace/2023-04-27/tagrules/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/dynatrace/2023-04-27/tagrules/id_tagrule.go b/resource-manager/dynatrace/2023-04-27/tagrules/id_tagrule.go index d0e965d46a4..ff33ac26ba5 100644 --- a/resource-manager/dynatrace/2023-04-27/tagrules/id_tagrule.go +++ b/resource-manager/dynatrace/2023-04-27/tagrules/id_tagrule.go @@ -38,23 +38,9 @@ func ParseTagRuleID(input string) (*TagRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TagRuleId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) - } - - if id.TagRuleName, ok = parsed.Parsed["tagRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTagRuleIDInsensitively(input string) (*TagRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TagRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TagRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - if id.TagRuleName, ok = parsed.Parsed["tagRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagRuleName", *parsed) + if id.TagRuleName, ok = input.Parsed["tagRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tagRuleName", input) } - return &id, nil + return nil } // ValidateTagRuleID checks that 'input' can be parsed as a Tag Rule ID diff --git a/resource-manager/elastic/2023-06-01/deploymentinfo/id_monitor.go b/resource-manager/elastic/2023-06-01/deploymentinfo/id_monitor.go index 6b513a3ed24..c5c64216470 100644 --- a/resource-manager/elastic/2023-06-01/deploymentinfo/id_monitor.go +++ b/resource-manager/elastic/2023-06-01/deploymentinfo/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/elastic/2023-06-01/deploymentupdate/id_monitor.go b/resource-manager/elastic/2023-06-01/deploymentupdate/id_monitor.go index c76ae2a99f3..bee90893109 100644 --- a/resource-manager/elastic/2023-06-01/deploymentupdate/id_monitor.go +++ b/resource-manager/elastic/2023-06-01/deploymentupdate/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/elastic/2023-06-01/monitoredresources/id_monitor.go b/resource-manager/elastic/2023-06-01/monitoredresources/id_monitor.go index 759e4127014..164f5f998eb 100644 --- a/resource-manager/elastic/2023-06-01/monitoredresources/id_monitor.go +++ b/resource-manager/elastic/2023-06-01/monitoredresources/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/elastic/2023-06-01/monitorsresource/id_monitor.go b/resource-manager/elastic/2023-06-01/monitorsresource/id_monitor.go index 58326bc320f..f67b26f9847 100644 --- a/resource-manager/elastic/2023-06-01/monitorsresource/id_monitor.go +++ b/resource-manager/elastic/2023-06-01/monitorsresource/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/elastic/2023-06-01/monitorupgradableversions/id_monitor.go b/resource-manager/elastic/2023-06-01/monitorupgradableversions/id_monitor.go index 93e414f042b..f5ee8bd4968 100644 --- a/resource-manager/elastic/2023-06-01/monitorupgradableversions/id_monitor.go +++ b/resource-manager/elastic/2023-06-01/monitorupgradableversions/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/elastic/2023-06-01/rules/id_monitor.go b/resource-manager/elastic/2023-06-01/rules/id_monitor.go index 208708f17e8..b67ae298da5 100644 --- a/resource-manager/elastic/2023-06-01/rules/id_monitor.go +++ b/resource-manager/elastic/2023-06-01/rules/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/elastic/2023-06-01/rules/id_tagrule.go b/resource-manager/elastic/2023-06-01/rules/id_tagrule.go index 9ab8251afc6..57e670f4251 100644 --- a/resource-manager/elastic/2023-06-01/rules/id_tagrule.go +++ b/resource-manager/elastic/2023-06-01/rules/id_tagrule.go @@ -38,23 +38,9 @@ func ParseTagRuleID(input string) (*TagRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TagRuleId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) - } - - if id.TagRuleName, ok = parsed.Parsed["tagRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTagRuleIDInsensitively(input string) (*TagRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TagRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TagRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - if id.TagRuleName, ok = parsed.Parsed["tagRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagRuleName", *parsed) + if id.TagRuleName, ok = input.Parsed["tagRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tagRuleName", input) } - return &id, nil + return nil } // ValidateTagRuleID checks that 'input' can be parsed as a Tag Rule ID diff --git a/resource-manager/elastic/2023-06-01/trafficfilter/id_monitor.go b/resource-manager/elastic/2023-06-01/trafficfilter/id_monitor.go index 37237ec9d99..dd8d531df1c 100644 --- a/resource-manager/elastic/2023-06-01/trafficfilter/id_monitor.go +++ b/resource-manager/elastic/2023-06-01/trafficfilter/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/elastic/2023-06-01/vmcollectionupdate/id_monitor.go b/resource-manager/elastic/2023-06-01/vmcollectionupdate/id_monitor.go index 7b0c3bbcd85..19a6edb7331 100644 --- a/resource-manager/elastic/2023-06-01/vmcollectionupdate/id_monitor.go +++ b/resource-manager/elastic/2023-06-01/vmcollectionupdate/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/elastic/2023-06-01/vmhhostlist/id_monitor.go b/resource-manager/elastic/2023-06-01/vmhhostlist/id_monitor.go index 5ab2e460357..36214b36415 100644 --- a/resource-manager/elastic/2023-06-01/vmhhostlist/id_monitor.go +++ b/resource-manager/elastic/2023-06-01/vmhhostlist/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/elastic/2023-06-01/vmingestiondetails/id_monitor.go b/resource-manager/elastic/2023-06-01/vmingestiondetails/id_monitor.go index d25490046a9..22278425fa8 100644 --- a/resource-manager/elastic/2023-06-01/vmingestiondetails/id_monitor.go +++ b/resource-manager/elastic/2023-06-01/vmingestiondetails/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/elasticsan/2021-11-20-preview/elasticsans/id_elasticsan.go b/resource-manager/elasticsan/2021-11-20-preview/elasticsans/id_elasticsan.go index 9f2a55ce57b..967671e878e 100644 --- a/resource-manager/elasticsan/2021-11-20-preview/elasticsans/id_elasticsan.go +++ b/resource-manager/elasticsan/2021-11-20-preview/elasticsans/id_elasticsan.go @@ -36,19 +36,9 @@ func ParseElasticSanID(input string) (*ElasticSanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ElasticSanId{} - - 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.ElasticSanName, ok = parsed.Parsed["elasticSanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "elasticSanName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseElasticSanIDInsensitively(input string) (*ElasticSanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ElasticSanId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ElasticSanId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ElasticSanName, ok = parsed.Parsed["elasticSanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "elasticSanName", *parsed) + if id.ElasticSanName, ok = input.Parsed["elasticSanName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "elasticSanName", input) } - return &id, nil + return nil } // ValidateElasticSanID checks that 'input' can be parsed as a Elastic San ID diff --git a/resource-manager/elasticsan/2021-11-20-preview/volumegroups/id_elasticsan.go b/resource-manager/elasticsan/2021-11-20-preview/volumegroups/id_elasticsan.go index 9589feae5f2..4b2cb31b7f6 100644 --- a/resource-manager/elasticsan/2021-11-20-preview/volumegroups/id_elasticsan.go +++ b/resource-manager/elasticsan/2021-11-20-preview/volumegroups/id_elasticsan.go @@ -36,19 +36,9 @@ func ParseElasticSanID(input string) (*ElasticSanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ElasticSanId{} - - 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.ElasticSanName, ok = parsed.Parsed["elasticSanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "elasticSanName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseElasticSanIDInsensitively(input string) (*ElasticSanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ElasticSanId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ElasticSanId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ElasticSanName, ok = parsed.Parsed["elasticSanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "elasticSanName", *parsed) + if id.ElasticSanName, ok = input.Parsed["elasticSanName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "elasticSanName", input) } - return &id, nil + return nil } // ValidateElasticSanID checks that 'input' can be parsed as a Elastic San ID diff --git a/resource-manager/elasticsan/2021-11-20-preview/volumegroups/id_volumegroup.go b/resource-manager/elasticsan/2021-11-20-preview/volumegroups/id_volumegroup.go index 32844829f15..c152f9b32b2 100644 --- a/resource-manager/elasticsan/2021-11-20-preview/volumegroups/id_volumegroup.go +++ b/resource-manager/elasticsan/2021-11-20-preview/volumegroups/id_volumegroup.go @@ -38,23 +38,9 @@ func ParseVolumeGroupID(input string) (*VolumeGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeGroupId{} - - 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.ElasticSanName, ok = parsed.Parsed["elasticSanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "elasticSanName", *parsed) - } - - if id.VolumeGroupName, ok = parsed.Parsed["volumeGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVolumeGroupIDInsensitively(input string) (*VolumeGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VolumeGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ElasticSanName, ok = parsed.Parsed["elasticSanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "elasticSanName", *parsed) + if id.ElasticSanName, ok = input.Parsed["elasticSanName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "elasticSanName", input) } - if id.VolumeGroupName, ok = parsed.Parsed["volumeGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeGroupName", *parsed) + if id.VolumeGroupName, ok = input.Parsed["volumeGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeGroupName", input) } - return &id, nil + return nil } // ValidateVolumeGroupID checks that 'input' can be parsed as a Volume Group ID diff --git a/resource-manager/elasticsan/2021-11-20-preview/volumes/id_volume.go b/resource-manager/elasticsan/2021-11-20-preview/volumes/id_volume.go index 96488682d24..ed6078fa472 100644 --- a/resource-manager/elasticsan/2021-11-20-preview/volumes/id_volume.go +++ b/resource-manager/elasticsan/2021-11-20-preview/volumes/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.ElasticSanName, ok = parsed.Parsed["elasticSanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "elasticSanName", *parsed) - } - - if id.VolumeGroupName, ok = parsed.Parsed["volumeGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeGroupName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ElasticSanName, ok = parsed.Parsed["elasticSanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "elasticSanName", *parsed) + if id.ElasticSanName, ok = input.Parsed["elasticSanName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "elasticSanName", input) } - if id.VolumeGroupName, ok = parsed.Parsed["volumeGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeGroupName", *parsed) + if id.VolumeGroupName, ok = input.Parsed["volumeGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeGroupName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/elasticsan/2021-11-20-preview/volumes/id_volumegroup.go b/resource-manager/elasticsan/2021-11-20-preview/volumes/id_volumegroup.go index 11e9bdda431..c8c0d3ac788 100644 --- a/resource-manager/elasticsan/2021-11-20-preview/volumes/id_volumegroup.go +++ b/resource-manager/elasticsan/2021-11-20-preview/volumes/id_volumegroup.go @@ -38,23 +38,9 @@ func ParseVolumeGroupID(input string) (*VolumeGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeGroupId{} - - 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.ElasticSanName, ok = parsed.Parsed["elasticSanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "elasticSanName", *parsed) - } - - if id.VolumeGroupName, ok = parsed.Parsed["volumeGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVolumeGroupIDInsensitively(input string) (*VolumeGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VolumeGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ElasticSanName, ok = parsed.Parsed["elasticSanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "elasticSanName", *parsed) + if id.ElasticSanName, ok = input.Parsed["elasticSanName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "elasticSanName", input) } - if id.VolumeGroupName, ok = parsed.Parsed["volumeGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeGroupName", *parsed) + if id.VolumeGroupName, ok = input.Parsed["volumeGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeGroupName", input) } - return &id, nil + return nil } // ValidateVolumeGroupID checks that 'input' can be parsed as a Volume Group ID diff --git a/resource-manager/elasticsan/2023-01-01/elasticsans/id_elasticsan.go b/resource-manager/elasticsan/2023-01-01/elasticsans/id_elasticsan.go index 9f2a55ce57b..967671e878e 100644 --- a/resource-manager/elasticsan/2023-01-01/elasticsans/id_elasticsan.go +++ b/resource-manager/elasticsan/2023-01-01/elasticsans/id_elasticsan.go @@ -36,19 +36,9 @@ func ParseElasticSanID(input string) (*ElasticSanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ElasticSanId{} - - 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.ElasticSanName, ok = parsed.Parsed["elasticSanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "elasticSanName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseElasticSanIDInsensitively(input string) (*ElasticSanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ElasticSanId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ElasticSanId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ElasticSanName, ok = parsed.Parsed["elasticSanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "elasticSanName", *parsed) + if id.ElasticSanName, ok = input.Parsed["elasticSanName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "elasticSanName", input) } - return &id, nil + return nil } // ValidateElasticSanID checks that 'input' can be parsed as a Elastic San ID diff --git a/resource-manager/elasticsan/2023-01-01/privateendpointconnections/id_elasticsan.go b/resource-manager/elasticsan/2023-01-01/privateendpointconnections/id_elasticsan.go index b6ea7485c9a..4c86ecf9e5e 100644 --- a/resource-manager/elasticsan/2023-01-01/privateendpointconnections/id_elasticsan.go +++ b/resource-manager/elasticsan/2023-01-01/privateendpointconnections/id_elasticsan.go @@ -36,19 +36,9 @@ func ParseElasticSanID(input string) (*ElasticSanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ElasticSanId{} - - 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.ElasticSanName, ok = parsed.Parsed["elasticSanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "elasticSanName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseElasticSanIDInsensitively(input string) (*ElasticSanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ElasticSanId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ElasticSanId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ElasticSanName, ok = parsed.Parsed["elasticSanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "elasticSanName", *parsed) + if id.ElasticSanName, ok = input.Parsed["elasticSanName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "elasticSanName", input) } - return &id, nil + return nil } // ValidateElasticSanID checks that 'input' can be parsed as a Elastic San ID diff --git a/resource-manager/elasticsan/2023-01-01/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/elasticsan/2023-01-01/privateendpointconnections/id_privateendpointconnection.go index 8a120ad0c46..fb232fbdd65 100644 --- a/resource-manager/elasticsan/2023-01-01/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/elasticsan/2023-01-01/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.ElasticSanName, ok = parsed.Parsed["elasticSanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "elasticSanName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ElasticSanName, ok = parsed.Parsed["elasticSanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "elasticSanName", *parsed) + if id.ElasticSanName, ok = input.Parsed["elasticSanName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "elasticSanName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/elasticsan/2023-01-01/privatelinkresources/id_elasticsan.go b/resource-manager/elasticsan/2023-01-01/privatelinkresources/id_elasticsan.go index 80bd0981642..6873959b431 100644 --- a/resource-manager/elasticsan/2023-01-01/privatelinkresources/id_elasticsan.go +++ b/resource-manager/elasticsan/2023-01-01/privatelinkresources/id_elasticsan.go @@ -36,19 +36,9 @@ func ParseElasticSanID(input string) (*ElasticSanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ElasticSanId{} - - 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.ElasticSanName, ok = parsed.Parsed["elasticSanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "elasticSanName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseElasticSanIDInsensitively(input string) (*ElasticSanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ElasticSanId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ElasticSanId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ElasticSanName, ok = parsed.Parsed["elasticSanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "elasticSanName", *parsed) + if id.ElasticSanName, ok = input.Parsed["elasticSanName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "elasticSanName", input) } - return &id, nil + return nil } // ValidateElasticSanID checks that 'input' can be parsed as a Elastic San ID diff --git a/resource-manager/elasticsan/2023-01-01/snapshots/id_snapshot.go b/resource-manager/elasticsan/2023-01-01/snapshots/id_snapshot.go index f75aae076b1..1377b208d6c 100644 --- a/resource-manager/elasticsan/2023-01-01/snapshots/id_snapshot.go +++ b/resource-manager/elasticsan/2023-01-01/snapshots/id_snapshot.go @@ -40,27 +40,9 @@ func ParseSnapshotID(input string) (*SnapshotId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SnapshotId{} - - 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.ElasticSanName, ok = parsed.Parsed["elasticSanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "elasticSanName", *parsed) - } - - if id.VolumeGroupName, ok = parsed.Parsed["volumeGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeGroupName", *parsed) - } - - if id.SnapshotName, ok = parsed.Parsed["snapshotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSnapshotIDInsensitively(input string) (*SnapshotId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SnapshotId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SnapshotId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ElasticSanName, ok = parsed.Parsed["elasticSanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "elasticSanName", *parsed) + if id.ElasticSanName, ok = input.Parsed["elasticSanName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "elasticSanName", input) } - if id.VolumeGroupName, ok = parsed.Parsed["volumeGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeGroupName", *parsed) + if id.VolumeGroupName, ok = input.Parsed["volumeGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeGroupName", input) } - if id.SnapshotName, ok = parsed.Parsed["snapshotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotName", *parsed) + if id.SnapshotName, ok = input.Parsed["snapshotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "snapshotName", input) } - return &id, nil + return nil } // ValidateSnapshotID checks that 'input' can be parsed as a Snapshot ID diff --git a/resource-manager/elasticsan/2023-01-01/snapshots/id_volumegroup.go b/resource-manager/elasticsan/2023-01-01/snapshots/id_volumegroup.go index 4714353510a..9b59a86ebd7 100644 --- a/resource-manager/elasticsan/2023-01-01/snapshots/id_volumegroup.go +++ b/resource-manager/elasticsan/2023-01-01/snapshots/id_volumegroup.go @@ -38,23 +38,9 @@ func ParseVolumeGroupID(input string) (*VolumeGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeGroupId{} - - 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.ElasticSanName, ok = parsed.Parsed["elasticSanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "elasticSanName", *parsed) - } - - if id.VolumeGroupName, ok = parsed.Parsed["volumeGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVolumeGroupIDInsensitively(input string) (*VolumeGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VolumeGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ElasticSanName, ok = parsed.Parsed["elasticSanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "elasticSanName", *parsed) + if id.ElasticSanName, ok = input.Parsed["elasticSanName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "elasticSanName", input) } - if id.VolumeGroupName, ok = parsed.Parsed["volumeGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeGroupName", *parsed) + if id.VolumeGroupName, ok = input.Parsed["volumeGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeGroupName", input) } - return &id, nil + return nil } // ValidateVolumeGroupID checks that 'input' can be parsed as a Volume Group ID diff --git a/resource-manager/elasticsan/2023-01-01/volumegroups/id_elasticsan.go b/resource-manager/elasticsan/2023-01-01/volumegroups/id_elasticsan.go index 9589feae5f2..4b2cb31b7f6 100644 --- a/resource-manager/elasticsan/2023-01-01/volumegroups/id_elasticsan.go +++ b/resource-manager/elasticsan/2023-01-01/volumegroups/id_elasticsan.go @@ -36,19 +36,9 @@ func ParseElasticSanID(input string) (*ElasticSanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ElasticSanId{} - - 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.ElasticSanName, ok = parsed.Parsed["elasticSanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "elasticSanName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseElasticSanIDInsensitively(input string) (*ElasticSanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ElasticSanId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ElasticSanId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ElasticSanName, ok = parsed.Parsed["elasticSanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "elasticSanName", *parsed) + if id.ElasticSanName, ok = input.Parsed["elasticSanName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "elasticSanName", input) } - return &id, nil + return nil } // ValidateElasticSanID checks that 'input' can be parsed as a Elastic San ID diff --git a/resource-manager/elasticsan/2023-01-01/volumegroups/id_volumegroup.go b/resource-manager/elasticsan/2023-01-01/volumegroups/id_volumegroup.go index 32844829f15..c152f9b32b2 100644 --- a/resource-manager/elasticsan/2023-01-01/volumegroups/id_volumegroup.go +++ b/resource-manager/elasticsan/2023-01-01/volumegroups/id_volumegroup.go @@ -38,23 +38,9 @@ func ParseVolumeGroupID(input string) (*VolumeGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeGroupId{} - - 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.ElasticSanName, ok = parsed.Parsed["elasticSanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "elasticSanName", *parsed) - } - - if id.VolumeGroupName, ok = parsed.Parsed["volumeGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVolumeGroupIDInsensitively(input string) (*VolumeGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VolumeGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ElasticSanName, ok = parsed.Parsed["elasticSanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "elasticSanName", *parsed) + if id.ElasticSanName, ok = input.Parsed["elasticSanName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "elasticSanName", input) } - if id.VolumeGroupName, ok = parsed.Parsed["volumeGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeGroupName", *parsed) + if id.VolumeGroupName, ok = input.Parsed["volumeGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeGroupName", input) } - return &id, nil + return nil } // ValidateVolumeGroupID checks that 'input' can be parsed as a Volume Group ID diff --git a/resource-manager/elasticsan/2023-01-01/volumes/id_volume.go b/resource-manager/elasticsan/2023-01-01/volumes/id_volume.go index 96488682d24..ed6078fa472 100644 --- a/resource-manager/elasticsan/2023-01-01/volumes/id_volume.go +++ b/resource-manager/elasticsan/2023-01-01/volumes/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.ElasticSanName, ok = parsed.Parsed["elasticSanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "elasticSanName", *parsed) - } - - if id.VolumeGroupName, ok = parsed.Parsed["volumeGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeGroupName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ElasticSanName, ok = parsed.Parsed["elasticSanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "elasticSanName", *parsed) + if id.ElasticSanName, ok = input.Parsed["elasticSanName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "elasticSanName", input) } - if id.VolumeGroupName, ok = parsed.Parsed["volumeGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeGroupName", *parsed) + if id.VolumeGroupName, ok = input.Parsed["volumeGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeGroupName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/elasticsan/2023-01-01/volumes/id_volumegroup.go b/resource-manager/elasticsan/2023-01-01/volumes/id_volumegroup.go index 11e9bdda431..c8c0d3ac788 100644 --- a/resource-manager/elasticsan/2023-01-01/volumes/id_volumegroup.go +++ b/resource-manager/elasticsan/2023-01-01/volumes/id_volumegroup.go @@ -38,23 +38,9 @@ func ParseVolumeGroupID(input string) (*VolumeGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeGroupId{} - - 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.ElasticSanName, ok = parsed.Parsed["elasticSanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "elasticSanName", *parsed) - } - - if id.VolumeGroupName, ok = parsed.Parsed["volumeGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVolumeGroupIDInsensitively(input string) (*VolumeGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VolumeGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ElasticSanName, ok = parsed.Parsed["elasticSanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "elasticSanName", *parsed) + if id.ElasticSanName, ok = input.Parsed["elasticSanName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "elasticSanName", input) } - if id.VolumeGroupName, ok = parsed.Parsed["volumeGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeGroupName", *parsed) + if id.VolumeGroupName, ok = input.Parsed["volumeGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeGroupName", input) } - return &id, nil + return nil } // ValidateVolumeGroupID checks that 'input' can be parsed as a Volume Group ID diff --git a/resource-manager/eventgrid/2022-06-15/channels/id_channel.go b/resource-manager/eventgrid/2022-06-15/channels/id_channel.go index 00257b5be5a..b8b9316013b 100644 --- a/resource-manager/eventgrid/2022-06-15/channels/id_channel.go +++ b/resource-manager/eventgrid/2022-06-15/channels/id_channel.go @@ -38,23 +38,9 @@ func ParseChannelID(input string) (*ChannelId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ChannelId{} - - 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.PartnerNamespaceName, ok = parsed.Parsed["partnerNamespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "partnerNamespaceName", *parsed) - } - - if id.ChannelName, ok = parsed.Parsed["channelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "channelName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseChannelIDInsensitively(input string) (*ChannelId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ChannelId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ChannelId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PartnerNamespaceName, ok = parsed.Parsed["partnerNamespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "partnerNamespaceName", *parsed) + if id.PartnerNamespaceName, ok = input.Parsed["partnerNamespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "partnerNamespaceName", input) } - if id.ChannelName, ok = parsed.Parsed["channelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "channelName", *parsed) + if id.ChannelName, ok = input.Parsed["channelName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "channelName", input) } - return &id, nil + return nil } // ValidateChannelID checks that 'input' can be parsed as a Channel ID diff --git a/resource-manager/eventgrid/2022-06-15/channels/id_partnernamespace.go b/resource-manager/eventgrid/2022-06-15/channels/id_partnernamespace.go index 734df4dc595..d5d9be59ad3 100644 --- a/resource-manager/eventgrid/2022-06-15/channels/id_partnernamespace.go +++ b/resource-manager/eventgrid/2022-06-15/channels/id_partnernamespace.go @@ -36,19 +36,9 @@ func ParsePartnerNamespaceID(input string) (*PartnerNamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PartnerNamespaceId{} - - 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.PartnerNamespaceName, ok = parsed.Parsed["partnerNamespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "partnerNamespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePartnerNamespaceIDInsensitively(input string) (*PartnerNamespaceId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PartnerNamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PartnerNamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PartnerNamespaceName, ok = parsed.Parsed["partnerNamespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "partnerNamespaceName", *parsed) + if id.PartnerNamespaceName, ok = input.Parsed["partnerNamespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "partnerNamespaceName", input) } - return &id, nil + return nil } // ValidatePartnerNamespaceID checks that 'input' can be parsed as a Partner Namespace ID diff --git a/resource-manager/eventgrid/2022-06-15/domains/id_domain.go b/resource-manager/eventgrid/2022-06-15/domains/id_domain.go index 479442c4263..8e13e818e0a 100644 --- a/resource-manager/eventgrid/2022-06-15/domains/id_domain.go +++ b/resource-manager/eventgrid/2022-06-15/domains/id_domain.go @@ -36,19 +36,9 @@ func ParseDomainID(input string) (*DomainId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DomainId{} - - 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.DomainName, ok = parsed.Parsed["domainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDomainIDInsensitively(input string) (*DomainId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DomainId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DomainId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DomainName, ok = parsed.Parsed["domainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainName", *parsed) + if id.DomainName, ok = input.Parsed["domainName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "domainName", input) } - return &id, nil + return nil } // ValidateDomainID checks that 'input' can be parsed as a Domain ID diff --git a/resource-manager/eventgrid/2022-06-15/domaintopics/id_domain.go b/resource-manager/eventgrid/2022-06-15/domaintopics/id_domain.go index 530d2821985..3330f808ff5 100644 --- a/resource-manager/eventgrid/2022-06-15/domaintopics/id_domain.go +++ b/resource-manager/eventgrid/2022-06-15/domaintopics/id_domain.go @@ -36,19 +36,9 @@ func ParseDomainID(input string) (*DomainId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DomainId{} - - 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.DomainName, ok = parsed.Parsed["domainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDomainIDInsensitively(input string) (*DomainId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DomainId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DomainId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DomainName, ok = parsed.Parsed["domainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainName", *parsed) + if id.DomainName, ok = input.Parsed["domainName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "domainName", input) } - return &id, nil + return nil } // ValidateDomainID checks that 'input' can be parsed as a Domain ID diff --git a/resource-manager/eventgrid/2022-06-15/domaintopics/id_domaintopic.go b/resource-manager/eventgrid/2022-06-15/domaintopics/id_domaintopic.go index 342275df800..24ba87635a5 100644 --- a/resource-manager/eventgrid/2022-06-15/domaintopics/id_domaintopic.go +++ b/resource-manager/eventgrid/2022-06-15/domaintopics/id_domaintopic.go @@ -38,23 +38,9 @@ func ParseDomainTopicID(input string) (*DomainTopicId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DomainTopicId{} - - 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.DomainName, ok = parsed.Parsed["domainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainName", *parsed) - } - - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDomainTopicIDInsensitively(input string) (*DomainTopicId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DomainTopicId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DomainTopicId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DomainName, ok = parsed.Parsed["domainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainName", *parsed) + if id.DomainName, ok = input.Parsed["domainName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "domainName", input) } - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) + if id.TopicName, ok = input.Parsed["topicName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "topicName", input) } - return &id, nil + return nil } // ValidateDomainTopicID checks that 'input' can be parsed as a Domain Topic ID diff --git a/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_domain.go b/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_domain.go index 9101afb0566..6e147c90b3f 100644 --- a/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_domain.go +++ b/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_domain.go @@ -36,19 +36,9 @@ func ParseDomainID(input string) (*DomainId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DomainId{} - - 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.DomainName, ok = parsed.Parsed["domainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDomainIDInsensitively(input string) (*DomainId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DomainId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DomainId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DomainName, ok = parsed.Parsed["domainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainName", *parsed) + if id.DomainName, ok = input.Parsed["domainName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "domainName", input) } - return &id, nil + return nil } // ValidateDomainID checks that 'input' can be parsed as a Domain ID diff --git a/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_domaineventsubscription.go b/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_domaineventsubscription.go index dbbd48022f0..86c10dc206c 100644 --- a/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_domaineventsubscription.go +++ b/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_domaineventsubscription.go @@ -38,23 +38,9 @@ func ParseDomainEventSubscriptionID(input string) (*DomainEventSubscriptionId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DomainEventSubscriptionId{} - - 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.DomainName, ok = parsed.Parsed["domainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainName", *parsed) - } - - if id.EventSubscriptionName, ok = parsed.Parsed["eventSubscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventSubscriptionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDomainEventSubscriptionIDInsensitively(input string) (*DomainEventSubs return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DomainEventSubscriptionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DomainEventSubscriptionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DomainName, ok = parsed.Parsed["domainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainName", *parsed) + if id.DomainName, ok = input.Parsed["domainName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "domainName", input) } - if id.EventSubscriptionName, ok = parsed.Parsed["eventSubscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventSubscriptionName", *parsed) + if id.EventSubscriptionName, ok = input.Parsed["eventSubscriptionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "eventSubscriptionName", input) } - return &id, nil + return nil } // ValidateDomainEventSubscriptionID checks that 'input' can be parsed as a Domain Event Subscription ID diff --git a/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_domaintopic.go b/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_domaintopic.go index 4a253237abd..c2e3ed873e8 100644 --- a/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_domaintopic.go +++ b/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_domaintopic.go @@ -38,23 +38,9 @@ func ParseDomainTopicID(input string) (*DomainTopicId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DomainTopicId{} - - 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.DomainName, ok = parsed.Parsed["domainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainName", *parsed) - } - - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDomainTopicIDInsensitively(input string) (*DomainTopicId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DomainTopicId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DomainTopicId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DomainName, ok = parsed.Parsed["domainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainName", *parsed) + if id.DomainName, ok = input.Parsed["domainName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "domainName", input) } - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) + if id.TopicName, ok = input.Parsed["topicName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "topicName", input) } - return &id, nil + return nil } // ValidateDomainTopicID checks that 'input' can be parsed as a Domain Topic ID diff --git a/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_eventsubscription.go b/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_eventsubscription.go index 6d20ee9587c..caa085bf59e 100644 --- a/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_eventsubscription.go +++ b/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_eventsubscription.go @@ -38,23 +38,9 @@ func ParseEventSubscriptionID(input string) (*EventSubscriptionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EventSubscriptionId{} - - 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.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) - } - - if id.EventSubscriptionName, ok = parsed.Parsed["eventSubscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventSubscriptionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseEventSubscriptionIDInsensitively(input string) (*EventSubscriptionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EventSubscriptionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EventSubscriptionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) + if id.TopicName, ok = input.Parsed["topicName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "topicName", input) } - if id.EventSubscriptionName, ok = parsed.Parsed["eventSubscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventSubscriptionName", *parsed) + if id.EventSubscriptionName, ok = input.Parsed["eventSubscriptionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "eventSubscriptionName", input) } - return &id, nil + return nil } // ValidateEventSubscriptionID checks that 'input' can be parsed as a Event Subscription ID diff --git a/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_location.go b/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_location.go index 1c1d775c870..1c3e5d7847a 100644 --- a/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_location.go +++ b/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_locationtopictype.go b/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_locationtopictype.go index 55e41e97870..c5071459863 100644 --- a/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_locationtopictype.go +++ b/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_locationtopictype.go @@ -36,19 +36,9 @@ func ParseLocationTopicTypeID(input string) (*LocationTopicTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationTopicTypeId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.TopicTypeName, ok = parsed.Parsed["topicTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicTypeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLocationTopicTypeIDInsensitively(input string) (*LocationTopicTypeId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationTopicTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LocationTopicTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.TopicTypeName, ok = parsed.Parsed["topicTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicTypeName", *parsed) + if id.TopicTypeName, ok = input.Parsed["topicTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "topicTypeName", input) } - return &id, nil + return nil } // ValidateLocationTopicTypeID checks that 'input' can be parsed as a Location Topic Type ID diff --git a/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_partnertopic.go b/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_partnertopic.go index 4f656d50fb7..2f5ae915a95 100644 --- a/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_partnertopic.go +++ b/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_partnertopic.go @@ -36,19 +36,9 @@ func ParsePartnerTopicID(input string) (*PartnerTopicId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PartnerTopicId{} - - 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.PartnerTopicName, ok = parsed.Parsed["partnerTopicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "partnerTopicName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePartnerTopicIDInsensitively(input string) (*PartnerTopicId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PartnerTopicId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PartnerTopicId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PartnerTopicName, ok = parsed.Parsed["partnerTopicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "partnerTopicName", *parsed) + if id.PartnerTopicName, ok = input.Parsed["partnerTopicName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "partnerTopicName", input) } - return &id, nil + return nil } // ValidatePartnerTopicID checks that 'input' can be parsed as a Partner Topic ID diff --git a/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_partnertopiceventsubscription.go b/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_partnertopiceventsubscription.go index 3b39a9bc4e9..d45e465c324 100644 --- a/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_partnertopiceventsubscription.go +++ b/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_partnertopiceventsubscription.go @@ -38,23 +38,9 @@ func ParsePartnerTopicEventSubscriptionID(input string) (*PartnerTopicEventSubsc return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PartnerTopicEventSubscriptionId{} - - 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.PartnerTopicName, ok = parsed.Parsed["partnerTopicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "partnerTopicName", *parsed) - } - - if id.EventSubscriptionName, ok = parsed.Parsed["eventSubscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventSubscriptionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePartnerTopicEventSubscriptionIDInsensitively(input string) (*PartnerTo return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PartnerTopicEventSubscriptionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PartnerTopicEventSubscriptionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PartnerTopicName, ok = parsed.Parsed["partnerTopicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "partnerTopicName", *parsed) + if id.PartnerTopicName, ok = input.Parsed["partnerTopicName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "partnerTopicName", input) } - if id.EventSubscriptionName, ok = parsed.Parsed["eventSubscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventSubscriptionName", *parsed) + if id.EventSubscriptionName, ok = input.Parsed["eventSubscriptionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "eventSubscriptionName", input) } - return &id, nil + return nil } // ValidatePartnerTopicEventSubscriptionID checks that 'input' can be parsed as a Partner Topic Event Subscription ID diff --git a/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_providerlocation.go b/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_providerlocation.go index 26162d081cb..94ad6876d40 100644 --- a/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_providerlocation.go +++ b/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_providerlocation.go @@ -36,19 +36,9 @@ func ParseProviderLocationID(input string) (*ProviderLocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderLocationIDInsensitively(input string) (*ProviderLocationId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderLocationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateProviderLocationID checks that 'input' can be parsed as a Provider Location ID diff --git a/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_providerlocationtopictype.go b/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_providerlocationtopictype.go index dc8bdee8b6d..0a9c1a06a7f 100644 --- a/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_providerlocationtopictype.go +++ b/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_providerlocationtopictype.go @@ -38,23 +38,9 @@ func ParseProviderLocationTopicTypeID(input string) (*ProviderLocationTopicTypeI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationTopicTypeId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.TopicTypeName, ok = parsed.Parsed["topicTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicTypeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProviderLocationTopicTypeIDInsensitively(input string) (*ProviderLocat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationTopicTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProviderLocationTopicTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.TopicTypeName, ok = parsed.Parsed["topicTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicTypeName", *parsed) + if id.TopicTypeName, ok = input.Parsed["topicTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "topicTypeName", input) } - return &id, nil + return nil } // ValidateProviderLocationTopicTypeID checks that 'input' can be parsed as a Provider Location Topic Type ID diff --git a/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_providertopictype.go b/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_providertopictype.go index eb55d88c108..5a1d8b2610e 100644 --- a/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_providertopictype.go +++ b/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_providertopictype.go @@ -34,15 +34,9 @@ func ParseProviderTopicTypeID(input string) (*ProviderTopicTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderTopicTypeId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.TopicTypeName, ok = parsed.Parsed["topicTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicTypeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviderTopicTypeIDInsensitively(input string) (*ProviderTopicTypeId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderTopicTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ProviderTopicTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.TopicTypeName, ok = parsed.Parsed["topicTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicTypeName", *parsed) + if id.TopicTypeName, ok = input.Parsed["topicTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "topicTypeName", input) } - return &id, nil + return nil } // ValidateProviderTopicTypeID checks that 'input' can be parsed as a Provider Topic Type ID diff --git a/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_resourcegroupprovidertopictype.go b/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_resourcegroupprovidertopictype.go index 038de7ab4be..c16ca0ed4c9 100644 --- a/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_resourcegroupprovidertopictype.go +++ b/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_resourcegroupprovidertopictype.go @@ -36,19 +36,9 @@ func ParseResourceGroupProviderTopicTypeID(input string) (*ResourceGroupProvider return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResourceGroupProviderTopicTypeId{} - - 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.TopicTypeName, ok = parsed.Parsed["topicTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicTypeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseResourceGroupProviderTopicTypeIDInsensitively(input string) (*Resource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResourceGroupProviderTopicTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ResourceGroupProviderTopicTypeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.TopicTypeName, ok = parsed.Parsed["topicTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicTypeName", *parsed) + if id.TopicTypeName, ok = input.Parsed["topicTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "topicTypeName", input) } - return &id, nil + return nil } // ValidateResourceGroupProviderTopicTypeID checks that 'input' can be parsed as a Resource Group Provider Topic Type ID diff --git a/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_scopedeventsubscription.go b/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_scopedeventsubscription.go index a0bb0783cb9..01d8902b7c2 100644 --- a/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_scopedeventsubscription.go +++ b/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_scopedeventsubscription.go @@ -34,15 +34,9 @@ func ParseScopedEventSubscriptionID(input string) (*ScopedEventSubscriptionId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedEventSubscriptionId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.EventSubscriptionName, ok = parsed.Parsed["eventSubscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventSubscriptionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedEventSubscriptionIDInsensitively(input string) (*ScopedEventSubs return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedEventSubscriptionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedEventSubscriptionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.EventSubscriptionName, ok = parsed.Parsed["eventSubscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventSubscriptionName", *parsed) + if id.EventSubscriptionName, ok = input.Parsed["eventSubscriptionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "eventSubscriptionName", input) } - return &id, nil + return nil } // ValidateScopedEventSubscriptionID checks that 'input' can be parsed as a Scoped Event Subscription ID diff --git a/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_systemtopic.go b/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_systemtopic.go index 3dfdf3b9f4c..6a4b7d2018e 100644 --- a/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_systemtopic.go +++ b/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_systemtopic.go @@ -36,19 +36,9 @@ func ParseSystemTopicID(input string) (*SystemTopicId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SystemTopicId{} - - 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.SystemTopicName, ok = parsed.Parsed["systemTopicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "systemTopicName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSystemTopicIDInsensitively(input string) (*SystemTopicId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SystemTopicId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SystemTopicId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SystemTopicName, ok = parsed.Parsed["systemTopicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "systemTopicName", *parsed) + if id.SystemTopicName, ok = input.Parsed["systemTopicName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "systemTopicName", input) } - return &id, nil + return nil } // ValidateSystemTopicID checks that 'input' can be parsed as a System Topic ID diff --git a/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_systemtopiceventsubscription.go b/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_systemtopiceventsubscription.go index 49dc5533639..0dfc5bec770 100644 --- a/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_systemtopiceventsubscription.go +++ b/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_systemtopiceventsubscription.go @@ -38,23 +38,9 @@ func ParseSystemTopicEventSubscriptionID(input string) (*SystemTopicEventSubscri return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SystemTopicEventSubscriptionId{} - - 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.SystemTopicName, ok = parsed.Parsed["systemTopicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "systemTopicName", *parsed) - } - - if id.EventSubscriptionName, ok = parsed.Parsed["eventSubscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventSubscriptionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSystemTopicEventSubscriptionIDInsensitively(input string) (*SystemTopi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SystemTopicEventSubscriptionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SystemTopicEventSubscriptionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SystemTopicName, ok = parsed.Parsed["systemTopicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "systemTopicName", *parsed) + if id.SystemTopicName, ok = input.Parsed["systemTopicName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "systemTopicName", input) } - if id.EventSubscriptionName, ok = parsed.Parsed["eventSubscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventSubscriptionName", *parsed) + if id.EventSubscriptionName, ok = input.Parsed["eventSubscriptionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "eventSubscriptionName", input) } - return &id, nil + return nil } // ValidateSystemTopicEventSubscriptionID checks that 'input' can be parsed as a System Topic Event Subscription ID diff --git a/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_topic.go b/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_topic.go index 538d5fbd3b7..7248d3725c9 100644 --- a/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_topic.go +++ b/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_topic.go @@ -36,19 +36,9 @@ func ParseTopicID(input string) (*TopicId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TopicId{} - - 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.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseTopicIDInsensitively(input string) (*TopicId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TopicId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *TopicId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) + if id.TopicName, ok = input.Parsed["topicName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "topicName", input) } - return &id, nil + return nil } // ValidateTopicID checks that 'input' can be parsed as a Topic ID diff --git a/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_topiceventsubscription.go b/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_topiceventsubscription.go index c359710990b..0c61117f600 100644 --- a/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_topiceventsubscription.go +++ b/resource-manager/eventgrid/2022-06-15/eventsubscriptions/id_topiceventsubscription.go @@ -40,27 +40,9 @@ func ParseTopicEventSubscriptionID(input string) (*TopicEventSubscriptionId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TopicEventSubscriptionId{} - - 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.DomainName, ok = parsed.Parsed["domainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainName", *parsed) - } - - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) - } - - if id.EventSubscriptionName, ok = parsed.Parsed["eventSubscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventSubscriptionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseTopicEventSubscriptionIDInsensitively(input string) (*TopicEventSubscr return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TopicEventSubscriptionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TopicEventSubscriptionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DomainName, ok = parsed.Parsed["domainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainName", *parsed) + if id.DomainName, ok = input.Parsed["domainName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "domainName", input) } - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) + if id.TopicName, ok = input.Parsed["topicName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "topicName", input) } - if id.EventSubscriptionName, ok = parsed.Parsed["eventSubscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventSubscriptionName", *parsed) + if id.EventSubscriptionName, ok = input.Parsed["eventSubscriptionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "eventSubscriptionName", input) } - return &id, nil + return nil } // ValidateTopicEventSubscriptionID checks that 'input' can be parsed as a Topic Event Subscription ID diff --git a/resource-manager/eventgrid/2022-06-15/partnernamespaces/id_partnernamespace.go b/resource-manager/eventgrid/2022-06-15/partnernamespaces/id_partnernamespace.go index 90e7e99bdb1..f18cc7021c9 100644 --- a/resource-manager/eventgrid/2022-06-15/partnernamespaces/id_partnernamespace.go +++ b/resource-manager/eventgrid/2022-06-15/partnernamespaces/id_partnernamespace.go @@ -36,19 +36,9 @@ func ParsePartnerNamespaceID(input string) (*PartnerNamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PartnerNamespaceId{} - - 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.PartnerNamespaceName, ok = parsed.Parsed["partnerNamespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "partnerNamespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePartnerNamespaceIDInsensitively(input string) (*PartnerNamespaceId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PartnerNamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PartnerNamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PartnerNamespaceName, ok = parsed.Parsed["partnerNamespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "partnerNamespaceName", *parsed) + if id.PartnerNamespaceName, ok = input.Parsed["partnerNamespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "partnerNamespaceName", input) } - return &id, nil + return nil } // ValidatePartnerNamespaceID checks that 'input' can be parsed as a Partner Namespace ID diff --git a/resource-manager/eventgrid/2022-06-15/partnerregistrations/id_partnerregistration.go b/resource-manager/eventgrid/2022-06-15/partnerregistrations/id_partnerregistration.go index 06679876057..5f992ef6d96 100644 --- a/resource-manager/eventgrid/2022-06-15/partnerregistrations/id_partnerregistration.go +++ b/resource-manager/eventgrid/2022-06-15/partnerregistrations/id_partnerregistration.go @@ -36,19 +36,9 @@ func ParsePartnerRegistrationID(input string) (*PartnerRegistrationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PartnerRegistrationId{} - - 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.PartnerRegistrationName, ok = parsed.Parsed["partnerRegistrationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "partnerRegistrationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePartnerRegistrationIDInsensitively(input string) (*PartnerRegistration return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PartnerRegistrationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PartnerRegistrationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PartnerRegistrationName, ok = parsed.Parsed["partnerRegistrationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "partnerRegistrationName", *parsed) + if id.PartnerRegistrationName, ok = input.Parsed["partnerRegistrationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "partnerRegistrationName", input) } - return &id, nil + return nil } // ValidatePartnerRegistrationID checks that 'input' can be parsed as a Partner Registration ID diff --git a/resource-manager/eventgrid/2022-06-15/partnertopics/id_partnertopic.go b/resource-manager/eventgrid/2022-06-15/partnertopics/id_partnertopic.go index 9d71aeb2365..d672383a008 100644 --- a/resource-manager/eventgrid/2022-06-15/partnertopics/id_partnertopic.go +++ b/resource-manager/eventgrid/2022-06-15/partnertopics/id_partnertopic.go @@ -36,19 +36,9 @@ func ParsePartnerTopicID(input string) (*PartnerTopicId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PartnerTopicId{} - - 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.PartnerTopicName, ok = parsed.Parsed["partnerTopicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "partnerTopicName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePartnerTopicIDInsensitively(input string) (*PartnerTopicId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PartnerTopicId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PartnerTopicId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PartnerTopicName, ok = parsed.Parsed["partnerTopicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "partnerTopicName", *parsed) + if id.PartnerTopicName, ok = input.Parsed["partnerTopicName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "partnerTopicName", input) } - return &id, nil + return nil } // ValidatePartnerTopicID checks that 'input' can be parsed as a Partner Topic ID diff --git a/resource-manager/eventgrid/2022-06-15/privateendpointconnections/id_scopedprivateendpointconnection.go b/resource-manager/eventgrid/2022-06-15/privateendpointconnections/id_scopedprivateendpointconnection.go index 6c16064c7b1..8036012d142 100644 --- a/resource-manager/eventgrid/2022-06-15/privateendpointconnections/id_scopedprivateendpointconnection.go +++ b/resource-manager/eventgrid/2022-06-15/privateendpointconnections/id_scopedprivateendpointconnection.go @@ -34,15 +34,9 @@ func ParseScopedPrivateEndpointConnectionID(input string) (*ScopedPrivateEndpoin return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedPrivateEndpointConnectionId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedPrivateEndpointConnectionIDInsensitively(input string) (*ScopedP return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedPrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedPrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidateScopedPrivateEndpointConnectionID checks that 'input' can be parsed as a Scoped Private Endpoint Connection ID diff --git a/resource-manager/eventgrid/2022-06-15/privatelinkresources/id_scopedprivatelinkresource.go b/resource-manager/eventgrid/2022-06-15/privatelinkresources/id_scopedprivatelinkresource.go index c809d2d6b3d..86529bb821f 100644 --- a/resource-manager/eventgrid/2022-06-15/privatelinkresources/id_scopedprivatelinkresource.go +++ b/resource-manager/eventgrid/2022-06-15/privatelinkresources/id_scopedprivatelinkresource.go @@ -34,15 +34,9 @@ func ParseScopedPrivateLinkResourceID(input string) (*ScopedPrivateLinkResourceI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedPrivateLinkResourceId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedPrivateLinkResourceIDInsensitively(input string) (*ScopedPrivate return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedPrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedPrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidateScopedPrivateLinkResourceID checks that 'input' can be parsed as a Scoped Private Link Resource ID diff --git a/resource-manager/eventgrid/2022-06-15/systemtopics/id_systemtopic.go b/resource-manager/eventgrid/2022-06-15/systemtopics/id_systemtopic.go index 3914a0dcc8f..1bc7c171153 100644 --- a/resource-manager/eventgrid/2022-06-15/systemtopics/id_systemtopic.go +++ b/resource-manager/eventgrid/2022-06-15/systemtopics/id_systemtopic.go @@ -36,19 +36,9 @@ func ParseSystemTopicID(input string) (*SystemTopicId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SystemTopicId{} - - 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.SystemTopicName, ok = parsed.Parsed["systemTopicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "systemTopicName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSystemTopicIDInsensitively(input string) (*SystemTopicId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SystemTopicId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SystemTopicId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SystemTopicName, ok = parsed.Parsed["systemTopicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "systemTopicName", *parsed) + if id.SystemTopicName, ok = input.Parsed["systemTopicName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "systemTopicName", input) } - return &id, nil + return nil } // ValidateSystemTopicID checks that 'input' can be parsed as a System Topic ID diff --git a/resource-manager/eventgrid/2022-06-15/topics/id_topic.go b/resource-manager/eventgrid/2022-06-15/topics/id_topic.go index c96a1709d14..ab42447c30d 100644 --- a/resource-manager/eventgrid/2022-06-15/topics/id_topic.go +++ b/resource-manager/eventgrid/2022-06-15/topics/id_topic.go @@ -36,19 +36,9 @@ func ParseTopicID(input string) (*TopicId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TopicId{} - - 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.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseTopicIDInsensitively(input string) (*TopicId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TopicId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *TopicId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) + if id.TopicName, ok = input.Parsed["topicName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "topicName", input) } - return &id, nil + return nil } // ValidateTopicID checks that 'input' can be parsed as a Topic ID diff --git a/resource-manager/eventgrid/2022-06-15/topictypes/id_topictype.go b/resource-manager/eventgrid/2022-06-15/topictypes/id_topictype.go index 9c918c265e5..012c87f33bb 100644 --- a/resource-manager/eventgrid/2022-06-15/topictypes/id_topictype.go +++ b/resource-manager/eventgrid/2022-06-15/topictypes/id_topictype.go @@ -32,11 +32,9 @@ func ParseTopicTypeID(input string) (*TopicTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TopicTypeId{} - - if id.TopicTypeName, ok = parsed.Parsed["topicTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicTypeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseTopicTypeIDInsensitively(input string) (*TopicTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TopicTypeId{} - - if id.TopicTypeName, ok = parsed.Parsed["topicTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicTypeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *TopicTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.TopicTypeName, ok = input.Parsed["topicTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "topicTypeName", input) + } + + return nil +} + // ValidateTopicTypeID checks that 'input' can be parsed as a Topic Type ID func ValidateTopicTypeID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/eventgrid/2022-06-15/verifiedpartners/id_verifiedpartner.go b/resource-manager/eventgrid/2022-06-15/verifiedpartners/id_verifiedpartner.go index 23d4ffb5d38..e5ef44ae43c 100644 --- a/resource-manager/eventgrid/2022-06-15/verifiedpartners/id_verifiedpartner.go +++ b/resource-manager/eventgrid/2022-06-15/verifiedpartners/id_verifiedpartner.go @@ -32,11 +32,9 @@ func ParseVerifiedPartnerID(input string) (*VerifiedPartnerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VerifiedPartnerId{} - - if id.VerifiedPartnerName, ok = parsed.Parsed["verifiedPartnerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "verifiedPartnerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseVerifiedPartnerIDInsensitively(input string) (*VerifiedPartnerId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VerifiedPartnerId{} - - if id.VerifiedPartnerName, ok = parsed.Parsed["verifiedPartnerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "verifiedPartnerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *VerifiedPartnerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.VerifiedPartnerName, ok = input.Parsed["verifiedPartnerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "verifiedPartnerName", input) + } + + return nil +} + // ValidateVerifiedPartnerID checks that 'input' can be parsed as a Verified Partner ID func ValidateVerifiedPartnerID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/eventhub/2021-11-01/authorizationrulesdisasterrecoveryconfigs/id_disasterrecoveryconfig.go b/resource-manager/eventhub/2021-11-01/authorizationrulesdisasterrecoveryconfigs/id_disasterrecoveryconfig.go index 51ca828e701..df23008d6c3 100644 --- a/resource-manager/eventhub/2021-11-01/authorizationrulesdisasterrecoveryconfigs/id_disasterrecoveryconfig.go +++ b/resource-manager/eventhub/2021-11-01/authorizationrulesdisasterrecoveryconfigs/id_disasterrecoveryconfig.go @@ -38,23 +38,9 @@ func ParseDisasterRecoveryConfigID(input string) (*DisasterRecoveryConfigId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DisasterRecoveryConfigId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.DisasterRecoveryConfigName, ok = parsed.Parsed["disasterRecoveryConfigName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "disasterRecoveryConfigName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDisasterRecoveryConfigIDInsensitively(input string) (*DisasterRecovery return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DisasterRecoveryConfigId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DisasterRecoveryConfigId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.DisasterRecoveryConfigName, ok = parsed.Parsed["disasterRecoveryConfigName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "disasterRecoveryConfigName", *parsed) + if id.DisasterRecoveryConfigName, ok = input.Parsed["disasterRecoveryConfigName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "disasterRecoveryConfigName", input) } - return &id, nil + return nil } // ValidateDisasterRecoveryConfigID checks that 'input' can be parsed as a Disaster Recovery Config ID diff --git a/resource-manager/eventhub/2021-11-01/authorizationrulesdisasterrecoveryconfigs/id_disasterrecoveryconfigauthorizationrule.go b/resource-manager/eventhub/2021-11-01/authorizationrulesdisasterrecoveryconfigs/id_disasterrecoveryconfigauthorizationrule.go index e56b2ed1e94..c948f623d51 100644 --- a/resource-manager/eventhub/2021-11-01/authorizationrulesdisasterrecoveryconfigs/id_disasterrecoveryconfigauthorizationrule.go +++ b/resource-manager/eventhub/2021-11-01/authorizationrulesdisasterrecoveryconfigs/id_disasterrecoveryconfigauthorizationrule.go @@ -40,27 +40,9 @@ func ParseDisasterRecoveryConfigAuthorizationRuleID(input string) (*DisasterReco return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DisasterRecoveryConfigAuthorizationRuleId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.DisasterRecoveryConfigName, ok = parsed.Parsed["disasterRecoveryConfigName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "disasterRecoveryConfigName", *parsed) - } - - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseDisasterRecoveryConfigAuthorizationRuleIDInsensitively(input string) ( return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DisasterRecoveryConfigAuthorizationRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DisasterRecoveryConfigAuthorizationRuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.DisasterRecoveryConfigName, ok = parsed.Parsed["disasterRecoveryConfigName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "disasterRecoveryConfigName", *parsed) + if id.DisasterRecoveryConfigName, ok = input.Parsed["disasterRecoveryConfigName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "disasterRecoveryConfigName", input) } - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if id.AuthorizationRuleName, ok = input.Parsed["authorizationRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", input) } - return &id, nil + return nil } // ValidateDisasterRecoveryConfigAuthorizationRuleID checks that 'input' can be parsed as a Disaster Recovery Config Authorization Rule ID diff --git a/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/id_eventhub.go b/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/id_eventhub.go index f072d713be1..47cedfc5a46 100644 --- a/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/id_eventhub.go +++ b/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/id_eventhub.go @@ -38,23 +38,9 @@ func ParseEventhubID(input string) (*EventhubId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EventhubId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.EventhubName, ok = parsed.Parsed["eventhubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseEventhubIDInsensitively(input string) (*EventhubId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EventhubId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EventhubId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.EventhubName, ok = parsed.Parsed["eventhubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", *parsed) + if id.EventhubName, ok = input.Parsed["eventhubName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", input) } - return &id, nil + return nil } // ValidateEventhubID checks that 'input' can be parsed as a Eventhub ID diff --git a/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/id_eventhubauthorizationrule.go b/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/id_eventhubauthorizationrule.go index d38788bea01..1f3be091de4 100644 --- a/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/id_eventhubauthorizationrule.go +++ b/resource-manager/eventhub/2021-11-01/authorizationruleseventhubs/id_eventhubauthorizationrule.go @@ -40,27 +40,9 @@ func ParseEventhubAuthorizationRuleID(input string) (*EventhubAuthorizationRuleI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EventhubAuthorizationRuleId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.EventhubName, ok = parsed.Parsed["eventhubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", *parsed) - } - - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseEventhubAuthorizationRuleIDInsensitively(input string) (*EventhubAutho return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EventhubAuthorizationRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *EventhubAuthorizationRuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.EventhubName, ok = parsed.Parsed["eventhubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", *parsed) + if id.EventhubName, ok = input.Parsed["eventhubName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", input) } - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if id.AuthorizationRuleName, ok = input.Parsed["authorizationRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", input) } - return &id, nil + return nil } // ValidateEventhubAuthorizationRuleID checks that 'input' can be parsed as a Eventhub Authorization Rule ID diff --git a/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/id_authorizationrule.go b/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/id_authorizationrule.go index 277084e54c5..96fd5e6fdb3 100644 --- a/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/id_authorizationrule.go +++ b/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/id_authorizationrule.go @@ -38,23 +38,9 @@ func ParseAuthorizationRuleID(input string) (*AuthorizationRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationRuleId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAuthorizationRuleIDInsensitively(input string) (*AuthorizationRuleId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AuthorizationRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if id.AuthorizationRuleName, ok = input.Parsed["authorizationRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", input) } - return &id, nil + return nil } // ValidateAuthorizationRuleID checks that 'input' can be parsed as a Authorization Rule ID diff --git a/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/id_namespace.go b/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/id_namespace.go index c25fab2c4c3..77265f81446 100644 --- a/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/id_namespace.go +++ b/resource-manager/eventhub/2021-11-01/authorizationrulesnamespaces/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/eventhub/2021-11-01/checknameavailabilitydisasterrecoveryconfigs/id_namespace.go b/resource-manager/eventhub/2021-11-01/checknameavailabilitydisasterrecoveryconfigs/id_namespace.go index c4342835ab6..b9e232fdd33 100644 --- a/resource-manager/eventhub/2021-11-01/checknameavailabilitydisasterrecoveryconfigs/id_namespace.go +++ b/resource-manager/eventhub/2021-11-01/checknameavailabilitydisasterrecoveryconfigs/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/eventhub/2021-11-01/consumergroups/id_consumergroup.go b/resource-manager/eventhub/2021-11-01/consumergroups/id_consumergroup.go index 80964528f8b..9547ccf1064 100644 --- a/resource-manager/eventhub/2021-11-01/consumergroups/id_consumergroup.go +++ b/resource-manager/eventhub/2021-11-01/consumergroups/id_consumergroup.go @@ -40,27 +40,9 @@ func ParseConsumerGroupID(input string) (*ConsumerGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConsumerGroupId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.EventhubName, ok = parsed.Parsed["eventhubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", *parsed) - } - - if id.ConsumerGroupName, ok = parsed.Parsed["consumerGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "consumerGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseConsumerGroupIDInsensitively(input string) (*ConsumerGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConsumerGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ConsumerGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.EventhubName, ok = parsed.Parsed["eventhubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", *parsed) + if id.EventhubName, ok = input.Parsed["eventhubName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", input) } - if id.ConsumerGroupName, ok = parsed.Parsed["consumerGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "consumerGroupName", *parsed) + if id.ConsumerGroupName, ok = input.Parsed["consumerGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "consumerGroupName", input) } - return &id, nil + return nil } // ValidateConsumerGroupID checks that 'input' can be parsed as a Consumer Group ID diff --git a/resource-manager/eventhub/2021-11-01/consumergroups/id_eventhub.go b/resource-manager/eventhub/2021-11-01/consumergroups/id_eventhub.go index 87c280e948f..1c825ae0d77 100644 --- a/resource-manager/eventhub/2021-11-01/consumergroups/id_eventhub.go +++ b/resource-manager/eventhub/2021-11-01/consumergroups/id_eventhub.go @@ -38,23 +38,9 @@ func ParseEventhubID(input string) (*EventhubId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EventhubId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.EventhubName, ok = parsed.Parsed["eventhubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseEventhubIDInsensitively(input string) (*EventhubId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EventhubId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EventhubId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.EventhubName, ok = parsed.Parsed["eventhubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", *parsed) + if id.EventhubName, ok = input.Parsed["eventhubName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", input) } - return &id, nil + return nil } // ValidateEventhubID checks that 'input' can be parsed as a Eventhub ID diff --git a/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/id_disasterrecoveryconfig.go b/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/id_disasterrecoveryconfig.go index 82f3690b191..50f9ca1cf55 100644 --- a/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/id_disasterrecoveryconfig.go +++ b/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/id_disasterrecoveryconfig.go @@ -38,23 +38,9 @@ func ParseDisasterRecoveryConfigID(input string) (*DisasterRecoveryConfigId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DisasterRecoveryConfigId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.DisasterRecoveryConfigName, ok = parsed.Parsed["disasterRecoveryConfigName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "disasterRecoveryConfigName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDisasterRecoveryConfigIDInsensitively(input string) (*DisasterRecovery return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DisasterRecoveryConfigId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DisasterRecoveryConfigId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.DisasterRecoveryConfigName, ok = parsed.Parsed["disasterRecoveryConfigName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "disasterRecoveryConfigName", *parsed) + if id.DisasterRecoveryConfigName, ok = input.Parsed["disasterRecoveryConfigName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "disasterRecoveryConfigName", input) } - return &id, nil + return nil } // ValidateDisasterRecoveryConfigID checks that 'input' can be parsed as a Disaster Recovery Config ID diff --git a/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/id_namespace.go b/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/id_namespace.go index 624229f8afd..c643d34bf48 100644 --- a/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/id_namespace.go +++ b/resource-manager/eventhub/2021-11-01/disasterrecoveryconfigs/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/eventhub/2021-11-01/eventhubs/id_eventhub.go b/resource-manager/eventhub/2021-11-01/eventhubs/id_eventhub.go index a425f74cb56..7aa190d29e6 100644 --- a/resource-manager/eventhub/2021-11-01/eventhubs/id_eventhub.go +++ b/resource-manager/eventhub/2021-11-01/eventhubs/id_eventhub.go @@ -38,23 +38,9 @@ func ParseEventhubID(input string) (*EventhubId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EventhubId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.EventhubName, ok = parsed.Parsed["eventhubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseEventhubIDInsensitively(input string) (*EventhubId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EventhubId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EventhubId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.EventhubName, ok = parsed.Parsed["eventhubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", *parsed) + if id.EventhubName, ok = input.Parsed["eventhubName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", input) } - return &id, nil + return nil } // ValidateEventhubID checks that 'input' can be parsed as a Eventhub ID diff --git a/resource-manager/eventhub/2021-11-01/eventhubs/id_eventhubauthorizationrule.go b/resource-manager/eventhub/2021-11-01/eventhubs/id_eventhubauthorizationrule.go index 84adb4e0232..5541bfcb0c1 100644 --- a/resource-manager/eventhub/2021-11-01/eventhubs/id_eventhubauthorizationrule.go +++ b/resource-manager/eventhub/2021-11-01/eventhubs/id_eventhubauthorizationrule.go @@ -40,27 +40,9 @@ func ParseEventhubAuthorizationRuleID(input string) (*EventhubAuthorizationRuleI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EventhubAuthorizationRuleId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.EventhubName, ok = parsed.Parsed["eventhubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", *parsed) - } - - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseEventhubAuthorizationRuleIDInsensitively(input string) (*EventhubAutho return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EventhubAuthorizationRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *EventhubAuthorizationRuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.EventhubName, ok = parsed.Parsed["eventhubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", *parsed) + if id.EventhubName, ok = input.Parsed["eventhubName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", input) } - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if id.AuthorizationRuleName, ok = input.Parsed["authorizationRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", input) } - return &id, nil + return nil } // ValidateEventhubAuthorizationRuleID checks that 'input' can be parsed as a Eventhub Authorization Rule ID diff --git a/resource-manager/eventhub/2021-11-01/eventhubs/id_namespace.go b/resource-manager/eventhub/2021-11-01/eventhubs/id_namespace.go index 9265501203e..280cec81163 100644 --- a/resource-manager/eventhub/2021-11-01/eventhubs/id_namespace.go +++ b/resource-manager/eventhub/2021-11-01/eventhubs/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/eventhub/2021-11-01/eventhubsclusters/id_cluster.go b/resource-manager/eventhub/2021-11-01/eventhubsclusters/id_cluster.go index a3c42a2827c..a363558836e 100644 --- a/resource-manager/eventhub/2021-11-01/eventhubsclusters/id_cluster.go +++ b/resource-manager/eventhub/2021-11-01/eventhubsclusters/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/eventhub/2021-11-01/eventhubsclustersconfiguration/id_cluster.go b/resource-manager/eventhub/2021-11-01/eventhubsclustersconfiguration/id_cluster.go index 8b8b7a946f8..cc5a3212b11 100644 --- a/resource-manager/eventhub/2021-11-01/eventhubsclustersconfiguration/id_cluster.go +++ b/resource-manager/eventhub/2021-11-01/eventhubsclustersconfiguration/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/eventhub/2021-11-01/eventhubsclustersnamespace/id_cluster.go b/resource-manager/eventhub/2021-11-01/eventhubsclustersnamespace/id_cluster.go index da3017a531b..0d27d503e5a 100644 --- a/resource-manager/eventhub/2021-11-01/eventhubsclustersnamespace/id_cluster.go +++ b/resource-manager/eventhub/2021-11-01/eventhubsclustersnamespace/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/eventhub/2021-11-01/namespaces/id_namespace.go b/resource-manager/eventhub/2021-11-01/namespaces/id_namespace.go index db2055c3c04..31a5246b392 100644 --- a/resource-manager/eventhub/2021-11-01/namespaces/id_namespace.go +++ b/resource-manager/eventhub/2021-11-01/namespaces/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/eventhub/2021-11-01/namespacesprivateendpointconnections/id_namespace.go b/resource-manager/eventhub/2021-11-01/namespacesprivateendpointconnections/id_namespace.go index 78d57621b0d..46557bd8e4f 100644 --- a/resource-manager/eventhub/2021-11-01/namespacesprivateendpointconnections/id_namespace.go +++ b/resource-manager/eventhub/2021-11-01/namespacesprivateendpointconnections/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/eventhub/2021-11-01/namespacesprivateendpointconnections/id_privateendpointconnection.go b/resource-manager/eventhub/2021-11-01/namespacesprivateendpointconnections/id_privateendpointconnection.go index 257910e2288..8d3d729a184 100644 --- a/resource-manager/eventhub/2021-11-01/namespacesprivateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/eventhub/2021-11-01/namespacesprivateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/eventhub/2021-11-01/namespacesprivatelinkresources/id_namespace.go b/resource-manager/eventhub/2021-11-01/namespacesprivatelinkresources/id_namespace.go index 4254d2bd518..84c2f61c427 100644 --- a/resource-manager/eventhub/2021-11-01/namespacesprivatelinkresources/id_namespace.go +++ b/resource-manager/eventhub/2021-11-01/namespacesprivatelinkresources/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/eventhub/2021-11-01/networkrulesets/id_namespace.go b/resource-manager/eventhub/2021-11-01/networkrulesets/id_namespace.go index 3026464070c..348ce69dc22 100644 --- a/resource-manager/eventhub/2021-11-01/networkrulesets/id_namespace.go +++ b/resource-manager/eventhub/2021-11-01/networkrulesets/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/eventhub/2021-11-01/schemaregistry/id_namespace.go b/resource-manager/eventhub/2021-11-01/schemaregistry/id_namespace.go index eeeb927afd9..0b22ea3ba72 100644 --- a/resource-manager/eventhub/2021-11-01/schemaregistry/id_namespace.go +++ b/resource-manager/eventhub/2021-11-01/schemaregistry/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/eventhub/2021-11-01/schemaregistry/id_schemagroup.go b/resource-manager/eventhub/2021-11-01/schemaregistry/id_schemagroup.go index 28a768fa935..da5ac169296 100644 --- a/resource-manager/eventhub/2021-11-01/schemaregistry/id_schemagroup.go +++ b/resource-manager/eventhub/2021-11-01/schemaregistry/id_schemagroup.go @@ -38,23 +38,9 @@ func ParseSchemaGroupID(input string) (*SchemaGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SchemaGroupId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.SchemaGroupName, ok = parsed.Parsed["schemaGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSchemaGroupIDInsensitively(input string) (*SchemaGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SchemaGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SchemaGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.SchemaGroupName, ok = parsed.Parsed["schemaGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaGroupName", *parsed) + if id.SchemaGroupName, ok = input.Parsed["schemaGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "schemaGroupName", input) } - return &id, nil + return nil } // ValidateSchemaGroupID checks that 'input' can be parsed as a Schema Group ID diff --git a/resource-manager/eventhub/2022-01-01-preview/applicationgroup/id_applicationgroup.go b/resource-manager/eventhub/2022-01-01-preview/applicationgroup/id_applicationgroup.go index 65d4cf683d9..cc5e3803e4f 100644 --- a/resource-manager/eventhub/2022-01-01-preview/applicationgroup/id_applicationgroup.go +++ b/resource-manager/eventhub/2022-01-01-preview/applicationgroup/id_applicationgroup.go @@ -38,23 +38,9 @@ func ParseApplicationGroupID(input string) (*ApplicationGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGroupId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApplicationGroupIDInsensitively(input string) (*ApplicationGroupId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApplicationGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", *parsed) + if id.ApplicationGroupName, ok = input.Parsed["applicationGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", input) } - return &id, nil + return nil } // ValidateApplicationGroupID checks that 'input' can be parsed as a Application Group ID diff --git a/resource-manager/eventhub/2022-01-01-preview/applicationgroup/id_namespace.go b/resource-manager/eventhub/2022-01-01-preview/applicationgroup/id_namespace.go index 677a8d33806..b616f1ba11d 100644 --- a/resource-manager/eventhub/2022-01-01-preview/applicationgroup/id_namespace.go +++ b/resource-manager/eventhub/2022-01-01-preview/applicationgroup/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/eventhub/2022-01-01-preview/authorizationrulesdisasterrecoveryconfigs/id_disasterrecoveryconfig.go b/resource-manager/eventhub/2022-01-01-preview/authorizationrulesdisasterrecoveryconfigs/id_disasterrecoveryconfig.go index 51ca828e701..df23008d6c3 100644 --- a/resource-manager/eventhub/2022-01-01-preview/authorizationrulesdisasterrecoveryconfigs/id_disasterrecoveryconfig.go +++ b/resource-manager/eventhub/2022-01-01-preview/authorizationrulesdisasterrecoveryconfigs/id_disasterrecoveryconfig.go @@ -38,23 +38,9 @@ func ParseDisasterRecoveryConfigID(input string) (*DisasterRecoveryConfigId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DisasterRecoveryConfigId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.DisasterRecoveryConfigName, ok = parsed.Parsed["disasterRecoveryConfigName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "disasterRecoveryConfigName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDisasterRecoveryConfigIDInsensitively(input string) (*DisasterRecovery return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DisasterRecoveryConfigId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DisasterRecoveryConfigId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.DisasterRecoveryConfigName, ok = parsed.Parsed["disasterRecoveryConfigName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "disasterRecoveryConfigName", *parsed) + if id.DisasterRecoveryConfigName, ok = input.Parsed["disasterRecoveryConfigName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "disasterRecoveryConfigName", input) } - return &id, nil + return nil } // ValidateDisasterRecoveryConfigID checks that 'input' can be parsed as a Disaster Recovery Config ID diff --git a/resource-manager/eventhub/2022-01-01-preview/authorizationrulesdisasterrecoveryconfigs/id_disasterrecoveryconfigauthorizationrule.go b/resource-manager/eventhub/2022-01-01-preview/authorizationrulesdisasterrecoveryconfigs/id_disasterrecoveryconfigauthorizationrule.go index e56b2ed1e94..c948f623d51 100644 --- a/resource-manager/eventhub/2022-01-01-preview/authorizationrulesdisasterrecoveryconfigs/id_disasterrecoveryconfigauthorizationrule.go +++ b/resource-manager/eventhub/2022-01-01-preview/authorizationrulesdisasterrecoveryconfigs/id_disasterrecoveryconfigauthorizationrule.go @@ -40,27 +40,9 @@ func ParseDisasterRecoveryConfigAuthorizationRuleID(input string) (*DisasterReco return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DisasterRecoveryConfigAuthorizationRuleId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.DisasterRecoveryConfigName, ok = parsed.Parsed["disasterRecoveryConfigName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "disasterRecoveryConfigName", *parsed) - } - - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseDisasterRecoveryConfigAuthorizationRuleIDInsensitively(input string) ( return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DisasterRecoveryConfigAuthorizationRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DisasterRecoveryConfigAuthorizationRuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.DisasterRecoveryConfigName, ok = parsed.Parsed["disasterRecoveryConfigName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "disasterRecoveryConfigName", *parsed) + if id.DisasterRecoveryConfigName, ok = input.Parsed["disasterRecoveryConfigName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "disasterRecoveryConfigName", input) } - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if id.AuthorizationRuleName, ok = input.Parsed["authorizationRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", input) } - return &id, nil + return nil } // ValidateDisasterRecoveryConfigAuthorizationRuleID checks that 'input' can be parsed as a Disaster Recovery Config Authorization Rule ID diff --git a/resource-manager/eventhub/2022-01-01-preview/authorizationruleseventhubs/id_eventhub.go b/resource-manager/eventhub/2022-01-01-preview/authorizationruleseventhubs/id_eventhub.go index f072d713be1..47cedfc5a46 100644 --- a/resource-manager/eventhub/2022-01-01-preview/authorizationruleseventhubs/id_eventhub.go +++ b/resource-manager/eventhub/2022-01-01-preview/authorizationruleseventhubs/id_eventhub.go @@ -38,23 +38,9 @@ func ParseEventhubID(input string) (*EventhubId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EventhubId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.EventhubName, ok = parsed.Parsed["eventhubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseEventhubIDInsensitively(input string) (*EventhubId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EventhubId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EventhubId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.EventhubName, ok = parsed.Parsed["eventhubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", *parsed) + if id.EventhubName, ok = input.Parsed["eventhubName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", input) } - return &id, nil + return nil } // ValidateEventhubID checks that 'input' can be parsed as a Eventhub ID diff --git a/resource-manager/eventhub/2022-01-01-preview/authorizationruleseventhubs/id_eventhubauthorizationrule.go b/resource-manager/eventhub/2022-01-01-preview/authorizationruleseventhubs/id_eventhubauthorizationrule.go index d38788bea01..1f3be091de4 100644 --- a/resource-manager/eventhub/2022-01-01-preview/authorizationruleseventhubs/id_eventhubauthorizationrule.go +++ b/resource-manager/eventhub/2022-01-01-preview/authorizationruleseventhubs/id_eventhubauthorizationrule.go @@ -40,27 +40,9 @@ func ParseEventhubAuthorizationRuleID(input string) (*EventhubAuthorizationRuleI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EventhubAuthorizationRuleId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.EventhubName, ok = parsed.Parsed["eventhubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", *parsed) - } - - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseEventhubAuthorizationRuleIDInsensitively(input string) (*EventhubAutho return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EventhubAuthorizationRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *EventhubAuthorizationRuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.EventhubName, ok = parsed.Parsed["eventhubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", *parsed) + if id.EventhubName, ok = input.Parsed["eventhubName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", input) } - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if id.AuthorizationRuleName, ok = input.Parsed["authorizationRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", input) } - return &id, nil + return nil } // ValidateEventhubAuthorizationRuleID checks that 'input' can be parsed as a Eventhub Authorization Rule ID diff --git a/resource-manager/eventhub/2022-01-01-preview/authorizationrulesnamespaces/id_authorizationrule.go b/resource-manager/eventhub/2022-01-01-preview/authorizationrulesnamespaces/id_authorizationrule.go index 277084e54c5..96fd5e6fdb3 100644 --- a/resource-manager/eventhub/2022-01-01-preview/authorizationrulesnamespaces/id_authorizationrule.go +++ b/resource-manager/eventhub/2022-01-01-preview/authorizationrulesnamespaces/id_authorizationrule.go @@ -38,23 +38,9 @@ func ParseAuthorizationRuleID(input string) (*AuthorizationRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationRuleId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAuthorizationRuleIDInsensitively(input string) (*AuthorizationRuleId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AuthorizationRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if id.AuthorizationRuleName, ok = input.Parsed["authorizationRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", input) } - return &id, nil + return nil } // ValidateAuthorizationRuleID checks that 'input' can be parsed as a Authorization Rule ID diff --git a/resource-manager/eventhub/2022-01-01-preview/authorizationrulesnamespaces/id_namespace.go b/resource-manager/eventhub/2022-01-01-preview/authorizationrulesnamespaces/id_namespace.go index c25fab2c4c3..77265f81446 100644 --- a/resource-manager/eventhub/2022-01-01-preview/authorizationrulesnamespaces/id_namespace.go +++ b/resource-manager/eventhub/2022-01-01-preview/authorizationrulesnamespaces/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/eventhub/2022-01-01-preview/checknameavailabilitydisasterrecoveryconfigs/id_namespace.go b/resource-manager/eventhub/2022-01-01-preview/checknameavailabilitydisasterrecoveryconfigs/id_namespace.go index c4342835ab6..b9e232fdd33 100644 --- a/resource-manager/eventhub/2022-01-01-preview/checknameavailabilitydisasterrecoveryconfigs/id_namespace.go +++ b/resource-manager/eventhub/2022-01-01-preview/checknameavailabilitydisasterrecoveryconfigs/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/eventhub/2022-01-01-preview/consumergroups/id_consumergroup.go b/resource-manager/eventhub/2022-01-01-preview/consumergroups/id_consumergroup.go index 80964528f8b..9547ccf1064 100644 --- a/resource-manager/eventhub/2022-01-01-preview/consumergroups/id_consumergroup.go +++ b/resource-manager/eventhub/2022-01-01-preview/consumergroups/id_consumergroup.go @@ -40,27 +40,9 @@ func ParseConsumerGroupID(input string) (*ConsumerGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConsumerGroupId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.EventhubName, ok = parsed.Parsed["eventhubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", *parsed) - } - - if id.ConsumerGroupName, ok = parsed.Parsed["consumerGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "consumerGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseConsumerGroupIDInsensitively(input string) (*ConsumerGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConsumerGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ConsumerGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.EventhubName, ok = parsed.Parsed["eventhubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", *parsed) + if id.EventhubName, ok = input.Parsed["eventhubName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", input) } - if id.ConsumerGroupName, ok = parsed.Parsed["consumerGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "consumerGroupName", *parsed) + if id.ConsumerGroupName, ok = input.Parsed["consumerGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "consumerGroupName", input) } - return &id, nil + return nil } // ValidateConsumerGroupID checks that 'input' can be parsed as a Consumer Group ID diff --git a/resource-manager/eventhub/2022-01-01-preview/consumergroups/id_eventhub.go b/resource-manager/eventhub/2022-01-01-preview/consumergroups/id_eventhub.go index 87c280e948f..1c825ae0d77 100644 --- a/resource-manager/eventhub/2022-01-01-preview/consumergroups/id_eventhub.go +++ b/resource-manager/eventhub/2022-01-01-preview/consumergroups/id_eventhub.go @@ -38,23 +38,9 @@ func ParseEventhubID(input string) (*EventhubId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EventhubId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.EventhubName, ok = parsed.Parsed["eventhubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseEventhubIDInsensitively(input string) (*EventhubId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EventhubId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EventhubId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.EventhubName, ok = parsed.Parsed["eventhubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", *parsed) + if id.EventhubName, ok = input.Parsed["eventhubName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", input) } - return &id, nil + return nil } // ValidateEventhubID checks that 'input' can be parsed as a Eventhub ID diff --git a/resource-manager/eventhub/2022-01-01-preview/disasterrecoveryconfigs/id_disasterrecoveryconfig.go b/resource-manager/eventhub/2022-01-01-preview/disasterrecoveryconfigs/id_disasterrecoveryconfig.go index 82f3690b191..50f9ca1cf55 100644 --- a/resource-manager/eventhub/2022-01-01-preview/disasterrecoveryconfigs/id_disasterrecoveryconfig.go +++ b/resource-manager/eventhub/2022-01-01-preview/disasterrecoveryconfigs/id_disasterrecoveryconfig.go @@ -38,23 +38,9 @@ func ParseDisasterRecoveryConfigID(input string) (*DisasterRecoveryConfigId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DisasterRecoveryConfigId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.DisasterRecoveryConfigName, ok = parsed.Parsed["disasterRecoveryConfigName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "disasterRecoveryConfigName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDisasterRecoveryConfigIDInsensitively(input string) (*DisasterRecovery return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DisasterRecoveryConfigId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DisasterRecoveryConfigId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.DisasterRecoveryConfigName, ok = parsed.Parsed["disasterRecoveryConfigName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "disasterRecoveryConfigName", *parsed) + if id.DisasterRecoveryConfigName, ok = input.Parsed["disasterRecoveryConfigName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "disasterRecoveryConfigName", input) } - return &id, nil + return nil } // ValidateDisasterRecoveryConfigID checks that 'input' can be parsed as a Disaster Recovery Config ID diff --git a/resource-manager/eventhub/2022-01-01-preview/disasterrecoveryconfigs/id_namespace.go b/resource-manager/eventhub/2022-01-01-preview/disasterrecoveryconfigs/id_namespace.go index 624229f8afd..c643d34bf48 100644 --- a/resource-manager/eventhub/2022-01-01-preview/disasterrecoveryconfigs/id_namespace.go +++ b/resource-manager/eventhub/2022-01-01-preview/disasterrecoveryconfigs/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/eventhub/2022-01-01-preview/eventhubs/id_eventhub.go b/resource-manager/eventhub/2022-01-01-preview/eventhubs/id_eventhub.go index a425f74cb56..7aa190d29e6 100644 --- a/resource-manager/eventhub/2022-01-01-preview/eventhubs/id_eventhub.go +++ b/resource-manager/eventhub/2022-01-01-preview/eventhubs/id_eventhub.go @@ -38,23 +38,9 @@ func ParseEventhubID(input string) (*EventhubId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EventhubId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.EventhubName, ok = parsed.Parsed["eventhubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseEventhubIDInsensitively(input string) (*EventhubId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EventhubId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EventhubId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.EventhubName, ok = parsed.Parsed["eventhubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", *parsed) + if id.EventhubName, ok = input.Parsed["eventhubName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", input) } - return &id, nil + return nil } // ValidateEventhubID checks that 'input' can be parsed as a Eventhub ID diff --git a/resource-manager/eventhub/2022-01-01-preview/eventhubs/id_eventhubauthorizationrule.go b/resource-manager/eventhub/2022-01-01-preview/eventhubs/id_eventhubauthorizationrule.go index 84adb4e0232..5541bfcb0c1 100644 --- a/resource-manager/eventhub/2022-01-01-preview/eventhubs/id_eventhubauthorizationrule.go +++ b/resource-manager/eventhub/2022-01-01-preview/eventhubs/id_eventhubauthorizationrule.go @@ -40,27 +40,9 @@ func ParseEventhubAuthorizationRuleID(input string) (*EventhubAuthorizationRuleI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EventhubAuthorizationRuleId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.EventhubName, ok = parsed.Parsed["eventhubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", *parsed) - } - - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseEventhubAuthorizationRuleIDInsensitively(input string) (*EventhubAutho return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EventhubAuthorizationRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *EventhubAuthorizationRuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.EventhubName, ok = parsed.Parsed["eventhubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", *parsed) + if id.EventhubName, ok = input.Parsed["eventhubName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", input) } - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if id.AuthorizationRuleName, ok = input.Parsed["authorizationRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", input) } - return &id, nil + return nil } // ValidateEventhubAuthorizationRuleID checks that 'input' can be parsed as a Eventhub Authorization Rule ID diff --git a/resource-manager/eventhub/2022-01-01-preview/eventhubs/id_namespace.go b/resource-manager/eventhub/2022-01-01-preview/eventhubs/id_namespace.go index 9265501203e..280cec81163 100644 --- a/resource-manager/eventhub/2022-01-01-preview/eventhubs/id_namespace.go +++ b/resource-manager/eventhub/2022-01-01-preview/eventhubs/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/eventhub/2022-01-01-preview/eventhubsclusters/id_cluster.go b/resource-manager/eventhub/2022-01-01-preview/eventhubsclusters/id_cluster.go index a3c42a2827c..a363558836e 100644 --- a/resource-manager/eventhub/2022-01-01-preview/eventhubsclusters/id_cluster.go +++ b/resource-manager/eventhub/2022-01-01-preview/eventhubsclusters/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/eventhub/2022-01-01-preview/eventhubsclustersconfiguration/id_cluster.go b/resource-manager/eventhub/2022-01-01-preview/eventhubsclustersconfiguration/id_cluster.go index 8b8b7a946f8..cc5a3212b11 100644 --- a/resource-manager/eventhub/2022-01-01-preview/eventhubsclustersconfiguration/id_cluster.go +++ b/resource-manager/eventhub/2022-01-01-preview/eventhubsclustersconfiguration/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/eventhub/2022-01-01-preview/eventhubsclustersnamespace/id_cluster.go b/resource-manager/eventhub/2022-01-01-preview/eventhubsclustersnamespace/id_cluster.go index da3017a531b..0d27d503e5a 100644 --- a/resource-manager/eventhub/2022-01-01-preview/eventhubsclustersnamespace/id_cluster.go +++ b/resource-manager/eventhub/2022-01-01-preview/eventhubsclustersnamespace/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/eventhub/2022-01-01-preview/namespaces/id_namespace.go b/resource-manager/eventhub/2022-01-01-preview/namespaces/id_namespace.go index db2055c3c04..31a5246b392 100644 --- a/resource-manager/eventhub/2022-01-01-preview/namespaces/id_namespace.go +++ b/resource-manager/eventhub/2022-01-01-preview/namespaces/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/eventhub/2022-01-01-preview/namespacesnetworksecurityperimeterconfigurations/id_namespace.go b/resource-manager/eventhub/2022-01-01-preview/namespacesnetworksecurityperimeterconfigurations/id_namespace.go index f852dba4a05..321a8f1c48a 100644 --- a/resource-manager/eventhub/2022-01-01-preview/namespacesnetworksecurityperimeterconfigurations/id_namespace.go +++ b/resource-manager/eventhub/2022-01-01-preview/namespacesnetworksecurityperimeterconfigurations/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/eventhub/2022-01-01-preview/namespacesnetworksecurityperimeterconfigurations/id_networksecurityperimeterconfiguration.go b/resource-manager/eventhub/2022-01-01-preview/namespacesnetworksecurityperimeterconfigurations/id_networksecurityperimeterconfiguration.go index 734ba2f96cf..2e99892af07 100644 --- a/resource-manager/eventhub/2022-01-01-preview/namespacesnetworksecurityperimeterconfigurations/id_networksecurityperimeterconfiguration.go +++ b/resource-manager/eventhub/2022-01-01-preview/namespacesnetworksecurityperimeterconfigurations/id_networksecurityperimeterconfiguration.go @@ -38,23 +38,9 @@ func ParseNetworkSecurityPerimeterConfigurationID(input string) (*NetworkSecurit return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkSecurityPerimeterConfigurationId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.NetworkSecurityPerimeterConfigurationName, ok = parsed.Parsed["networkSecurityPerimeterConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkSecurityPerimeterConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseNetworkSecurityPerimeterConfigurationIDInsensitively(input string) (*N return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkSecurityPerimeterConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *NetworkSecurityPerimeterConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.NetworkSecurityPerimeterConfigurationName, ok = parsed.Parsed["networkSecurityPerimeterConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkSecurityPerimeterConfigurationName", *parsed) + if id.NetworkSecurityPerimeterConfigurationName, ok = input.Parsed["networkSecurityPerimeterConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkSecurityPerimeterConfigurationName", input) } - return &id, nil + return nil } // ValidateNetworkSecurityPerimeterConfigurationID checks that 'input' can be parsed as a Network Security Perimeter Configuration ID diff --git a/resource-manager/eventhub/2022-01-01-preview/namespacesprivateendpointconnections/id_namespace.go b/resource-manager/eventhub/2022-01-01-preview/namespacesprivateendpointconnections/id_namespace.go index 78d57621b0d..46557bd8e4f 100644 --- a/resource-manager/eventhub/2022-01-01-preview/namespacesprivateendpointconnections/id_namespace.go +++ b/resource-manager/eventhub/2022-01-01-preview/namespacesprivateendpointconnections/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/eventhub/2022-01-01-preview/namespacesprivateendpointconnections/id_privateendpointconnection.go b/resource-manager/eventhub/2022-01-01-preview/namespacesprivateendpointconnections/id_privateendpointconnection.go index 257910e2288..8d3d729a184 100644 --- a/resource-manager/eventhub/2022-01-01-preview/namespacesprivateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/eventhub/2022-01-01-preview/namespacesprivateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/eventhub/2022-01-01-preview/namespacesprivatelinkresources/id_namespace.go b/resource-manager/eventhub/2022-01-01-preview/namespacesprivatelinkresources/id_namespace.go index 4254d2bd518..84c2f61c427 100644 --- a/resource-manager/eventhub/2022-01-01-preview/namespacesprivatelinkresources/id_namespace.go +++ b/resource-manager/eventhub/2022-01-01-preview/namespacesprivatelinkresources/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/eventhub/2022-01-01-preview/networkrulesets/id_namespace.go b/resource-manager/eventhub/2022-01-01-preview/networkrulesets/id_namespace.go index 3026464070c..348ce69dc22 100644 --- a/resource-manager/eventhub/2022-01-01-preview/networkrulesets/id_namespace.go +++ b/resource-manager/eventhub/2022-01-01-preview/networkrulesets/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/eventhub/2022-01-01-preview/schemaregistry/id_namespace.go b/resource-manager/eventhub/2022-01-01-preview/schemaregistry/id_namespace.go index eeeb927afd9..0b22ea3ba72 100644 --- a/resource-manager/eventhub/2022-01-01-preview/schemaregistry/id_namespace.go +++ b/resource-manager/eventhub/2022-01-01-preview/schemaregistry/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/eventhub/2022-01-01-preview/schemaregistry/id_schemagroup.go b/resource-manager/eventhub/2022-01-01-preview/schemaregistry/id_schemagroup.go index 28a768fa935..da5ac169296 100644 --- a/resource-manager/eventhub/2022-01-01-preview/schemaregistry/id_schemagroup.go +++ b/resource-manager/eventhub/2022-01-01-preview/schemaregistry/id_schemagroup.go @@ -38,23 +38,9 @@ func ParseSchemaGroupID(input string) (*SchemaGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SchemaGroupId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.SchemaGroupName, ok = parsed.Parsed["schemaGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSchemaGroupIDInsensitively(input string) (*SchemaGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SchemaGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SchemaGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.SchemaGroupName, ok = parsed.Parsed["schemaGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaGroupName", *parsed) + if id.SchemaGroupName, ok = input.Parsed["schemaGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "schemaGroupName", input) } - return &id, nil + return nil } // ValidateSchemaGroupID checks that 'input' can be parsed as a Schema Group ID diff --git a/resource-manager/eventhub/2024-01-01/applicationgroup/id_applicationgroup.go b/resource-manager/eventhub/2024-01-01/applicationgroup/id_applicationgroup.go index 65d4cf683d9..cc5e3803e4f 100644 --- a/resource-manager/eventhub/2024-01-01/applicationgroup/id_applicationgroup.go +++ b/resource-manager/eventhub/2024-01-01/applicationgroup/id_applicationgroup.go @@ -38,23 +38,9 @@ func ParseApplicationGroupID(input string) (*ApplicationGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGroupId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApplicationGroupIDInsensitively(input string) (*ApplicationGroupId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApplicationGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.ApplicationGroupName, ok = parsed.Parsed["applicationGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", *parsed) + if id.ApplicationGroupName, ok = input.Parsed["applicationGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationGroupName", input) } - return &id, nil + return nil } // ValidateApplicationGroupID checks that 'input' can be parsed as a Application Group ID diff --git a/resource-manager/eventhub/2024-01-01/applicationgroup/id_namespace.go b/resource-manager/eventhub/2024-01-01/applicationgroup/id_namespace.go index 677a8d33806..b616f1ba11d 100644 --- a/resource-manager/eventhub/2024-01-01/applicationgroup/id_namespace.go +++ b/resource-manager/eventhub/2024-01-01/applicationgroup/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/eventhub/2024-01-01/authorizationrulesdisasterrecoveryconfigs/id_disasterrecoveryconfig.go b/resource-manager/eventhub/2024-01-01/authorizationrulesdisasterrecoveryconfigs/id_disasterrecoveryconfig.go index 51ca828e701..df23008d6c3 100644 --- a/resource-manager/eventhub/2024-01-01/authorizationrulesdisasterrecoveryconfigs/id_disasterrecoveryconfig.go +++ b/resource-manager/eventhub/2024-01-01/authorizationrulesdisasterrecoveryconfigs/id_disasterrecoveryconfig.go @@ -38,23 +38,9 @@ func ParseDisasterRecoveryConfigID(input string) (*DisasterRecoveryConfigId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DisasterRecoveryConfigId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.DisasterRecoveryConfigName, ok = parsed.Parsed["disasterRecoveryConfigName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "disasterRecoveryConfigName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDisasterRecoveryConfigIDInsensitively(input string) (*DisasterRecovery return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DisasterRecoveryConfigId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DisasterRecoveryConfigId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.DisasterRecoveryConfigName, ok = parsed.Parsed["disasterRecoveryConfigName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "disasterRecoveryConfigName", *parsed) + if id.DisasterRecoveryConfigName, ok = input.Parsed["disasterRecoveryConfigName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "disasterRecoveryConfigName", input) } - return &id, nil + return nil } // ValidateDisasterRecoveryConfigID checks that 'input' can be parsed as a Disaster Recovery Config ID diff --git a/resource-manager/eventhub/2024-01-01/authorizationrulesdisasterrecoveryconfigs/id_disasterrecoveryconfigauthorizationrule.go b/resource-manager/eventhub/2024-01-01/authorizationrulesdisasterrecoveryconfigs/id_disasterrecoveryconfigauthorizationrule.go index e56b2ed1e94..c948f623d51 100644 --- a/resource-manager/eventhub/2024-01-01/authorizationrulesdisasterrecoveryconfigs/id_disasterrecoveryconfigauthorizationrule.go +++ b/resource-manager/eventhub/2024-01-01/authorizationrulesdisasterrecoveryconfigs/id_disasterrecoveryconfigauthorizationrule.go @@ -40,27 +40,9 @@ func ParseDisasterRecoveryConfigAuthorizationRuleID(input string) (*DisasterReco return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DisasterRecoveryConfigAuthorizationRuleId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.DisasterRecoveryConfigName, ok = parsed.Parsed["disasterRecoveryConfigName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "disasterRecoveryConfigName", *parsed) - } - - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseDisasterRecoveryConfigAuthorizationRuleIDInsensitively(input string) ( return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DisasterRecoveryConfigAuthorizationRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DisasterRecoveryConfigAuthorizationRuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.DisasterRecoveryConfigName, ok = parsed.Parsed["disasterRecoveryConfigName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "disasterRecoveryConfigName", *parsed) + if id.DisasterRecoveryConfigName, ok = input.Parsed["disasterRecoveryConfigName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "disasterRecoveryConfigName", input) } - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if id.AuthorizationRuleName, ok = input.Parsed["authorizationRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", input) } - return &id, nil + return nil } // ValidateDisasterRecoveryConfigAuthorizationRuleID checks that 'input' can be parsed as a Disaster Recovery Config Authorization Rule ID diff --git a/resource-manager/eventhub/2024-01-01/authorizationruleseventhubs/id_eventhub.go b/resource-manager/eventhub/2024-01-01/authorizationruleseventhubs/id_eventhub.go index f072d713be1..47cedfc5a46 100644 --- a/resource-manager/eventhub/2024-01-01/authorizationruleseventhubs/id_eventhub.go +++ b/resource-manager/eventhub/2024-01-01/authorizationruleseventhubs/id_eventhub.go @@ -38,23 +38,9 @@ func ParseEventhubID(input string) (*EventhubId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EventhubId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.EventhubName, ok = parsed.Parsed["eventhubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseEventhubIDInsensitively(input string) (*EventhubId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EventhubId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EventhubId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.EventhubName, ok = parsed.Parsed["eventhubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", *parsed) + if id.EventhubName, ok = input.Parsed["eventhubName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", input) } - return &id, nil + return nil } // ValidateEventhubID checks that 'input' can be parsed as a Eventhub ID diff --git a/resource-manager/eventhub/2024-01-01/authorizationruleseventhubs/id_eventhubauthorizationrule.go b/resource-manager/eventhub/2024-01-01/authorizationruleseventhubs/id_eventhubauthorizationrule.go index d38788bea01..1f3be091de4 100644 --- a/resource-manager/eventhub/2024-01-01/authorizationruleseventhubs/id_eventhubauthorizationrule.go +++ b/resource-manager/eventhub/2024-01-01/authorizationruleseventhubs/id_eventhubauthorizationrule.go @@ -40,27 +40,9 @@ func ParseEventhubAuthorizationRuleID(input string) (*EventhubAuthorizationRuleI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EventhubAuthorizationRuleId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.EventhubName, ok = parsed.Parsed["eventhubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", *parsed) - } - - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseEventhubAuthorizationRuleIDInsensitively(input string) (*EventhubAutho return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EventhubAuthorizationRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *EventhubAuthorizationRuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.EventhubName, ok = parsed.Parsed["eventhubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", *parsed) + if id.EventhubName, ok = input.Parsed["eventhubName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", input) } - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if id.AuthorizationRuleName, ok = input.Parsed["authorizationRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", input) } - return &id, nil + return nil } // ValidateEventhubAuthorizationRuleID checks that 'input' can be parsed as a Eventhub Authorization Rule ID diff --git a/resource-manager/eventhub/2024-01-01/authorizationrulesnamespaces/id_authorizationrule.go b/resource-manager/eventhub/2024-01-01/authorizationrulesnamespaces/id_authorizationrule.go index 277084e54c5..96fd5e6fdb3 100644 --- a/resource-manager/eventhub/2024-01-01/authorizationrulesnamespaces/id_authorizationrule.go +++ b/resource-manager/eventhub/2024-01-01/authorizationrulesnamespaces/id_authorizationrule.go @@ -38,23 +38,9 @@ func ParseAuthorizationRuleID(input string) (*AuthorizationRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationRuleId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAuthorizationRuleIDInsensitively(input string) (*AuthorizationRuleId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AuthorizationRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if id.AuthorizationRuleName, ok = input.Parsed["authorizationRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", input) } - return &id, nil + return nil } // ValidateAuthorizationRuleID checks that 'input' can be parsed as a Authorization Rule ID diff --git a/resource-manager/eventhub/2024-01-01/authorizationrulesnamespaces/id_namespace.go b/resource-manager/eventhub/2024-01-01/authorizationrulesnamespaces/id_namespace.go index c25fab2c4c3..77265f81446 100644 --- a/resource-manager/eventhub/2024-01-01/authorizationrulesnamespaces/id_namespace.go +++ b/resource-manager/eventhub/2024-01-01/authorizationrulesnamespaces/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/eventhub/2024-01-01/checknameavailabilitydisasterrecoveryconfigs/id_namespace.go b/resource-manager/eventhub/2024-01-01/checknameavailabilitydisasterrecoveryconfigs/id_namespace.go index c4342835ab6..b9e232fdd33 100644 --- a/resource-manager/eventhub/2024-01-01/checknameavailabilitydisasterrecoveryconfigs/id_namespace.go +++ b/resource-manager/eventhub/2024-01-01/checknameavailabilitydisasterrecoveryconfigs/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/eventhub/2024-01-01/consumergroups/id_consumergroup.go b/resource-manager/eventhub/2024-01-01/consumergroups/id_consumergroup.go index 80964528f8b..9547ccf1064 100644 --- a/resource-manager/eventhub/2024-01-01/consumergroups/id_consumergroup.go +++ b/resource-manager/eventhub/2024-01-01/consumergroups/id_consumergroup.go @@ -40,27 +40,9 @@ func ParseConsumerGroupID(input string) (*ConsumerGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConsumerGroupId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.EventhubName, ok = parsed.Parsed["eventhubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", *parsed) - } - - if id.ConsumerGroupName, ok = parsed.Parsed["consumerGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "consumerGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseConsumerGroupIDInsensitively(input string) (*ConsumerGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConsumerGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ConsumerGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.EventhubName, ok = parsed.Parsed["eventhubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", *parsed) + if id.EventhubName, ok = input.Parsed["eventhubName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", input) } - if id.ConsumerGroupName, ok = parsed.Parsed["consumerGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "consumerGroupName", *parsed) + if id.ConsumerGroupName, ok = input.Parsed["consumerGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "consumerGroupName", input) } - return &id, nil + return nil } // ValidateConsumerGroupID checks that 'input' can be parsed as a Consumer Group ID diff --git a/resource-manager/eventhub/2024-01-01/consumergroups/id_eventhub.go b/resource-manager/eventhub/2024-01-01/consumergroups/id_eventhub.go index 87c280e948f..1c825ae0d77 100644 --- a/resource-manager/eventhub/2024-01-01/consumergroups/id_eventhub.go +++ b/resource-manager/eventhub/2024-01-01/consumergroups/id_eventhub.go @@ -38,23 +38,9 @@ func ParseEventhubID(input string) (*EventhubId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EventhubId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.EventhubName, ok = parsed.Parsed["eventhubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseEventhubIDInsensitively(input string) (*EventhubId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EventhubId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EventhubId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.EventhubName, ok = parsed.Parsed["eventhubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", *parsed) + if id.EventhubName, ok = input.Parsed["eventhubName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", input) } - return &id, nil + return nil } // ValidateEventhubID checks that 'input' can be parsed as a Eventhub ID diff --git a/resource-manager/eventhub/2024-01-01/disasterrecoveryconfigs/id_disasterrecoveryconfig.go b/resource-manager/eventhub/2024-01-01/disasterrecoveryconfigs/id_disasterrecoveryconfig.go index 82f3690b191..50f9ca1cf55 100644 --- a/resource-manager/eventhub/2024-01-01/disasterrecoveryconfigs/id_disasterrecoveryconfig.go +++ b/resource-manager/eventhub/2024-01-01/disasterrecoveryconfigs/id_disasterrecoveryconfig.go @@ -38,23 +38,9 @@ func ParseDisasterRecoveryConfigID(input string) (*DisasterRecoveryConfigId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DisasterRecoveryConfigId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.DisasterRecoveryConfigName, ok = parsed.Parsed["disasterRecoveryConfigName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "disasterRecoveryConfigName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDisasterRecoveryConfigIDInsensitively(input string) (*DisasterRecovery return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DisasterRecoveryConfigId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DisasterRecoveryConfigId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.DisasterRecoveryConfigName, ok = parsed.Parsed["disasterRecoveryConfigName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "disasterRecoveryConfigName", *parsed) + if id.DisasterRecoveryConfigName, ok = input.Parsed["disasterRecoveryConfigName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "disasterRecoveryConfigName", input) } - return &id, nil + return nil } // ValidateDisasterRecoveryConfigID checks that 'input' can be parsed as a Disaster Recovery Config ID diff --git a/resource-manager/eventhub/2024-01-01/disasterrecoveryconfigs/id_namespace.go b/resource-manager/eventhub/2024-01-01/disasterrecoveryconfigs/id_namespace.go index 624229f8afd..c643d34bf48 100644 --- a/resource-manager/eventhub/2024-01-01/disasterrecoveryconfigs/id_namespace.go +++ b/resource-manager/eventhub/2024-01-01/disasterrecoveryconfigs/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/eventhub/2024-01-01/eventhubs/id_eventhub.go b/resource-manager/eventhub/2024-01-01/eventhubs/id_eventhub.go index a425f74cb56..7aa190d29e6 100644 --- a/resource-manager/eventhub/2024-01-01/eventhubs/id_eventhub.go +++ b/resource-manager/eventhub/2024-01-01/eventhubs/id_eventhub.go @@ -38,23 +38,9 @@ func ParseEventhubID(input string) (*EventhubId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EventhubId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.EventhubName, ok = parsed.Parsed["eventhubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseEventhubIDInsensitively(input string) (*EventhubId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EventhubId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EventhubId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.EventhubName, ok = parsed.Parsed["eventhubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", *parsed) + if id.EventhubName, ok = input.Parsed["eventhubName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", input) } - return &id, nil + return nil } // ValidateEventhubID checks that 'input' can be parsed as a Eventhub ID diff --git a/resource-manager/eventhub/2024-01-01/eventhubs/id_eventhubauthorizationrule.go b/resource-manager/eventhub/2024-01-01/eventhubs/id_eventhubauthorizationrule.go index 84adb4e0232..5541bfcb0c1 100644 --- a/resource-manager/eventhub/2024-01-01/eventhubs/id_eventhubauthorizationrule.go +++ b/resource-manager/eventhub/2024-01-01/eventhubs/id_eventhubauthorizationrule.go @@ -40,27 +40,9 @@ func ParseEventhubAuthorizationRuleID(input string) (*EventhubAuthorizationRuleI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EventhubAuthorizationRuleId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.EventhubName, ok = parsed.Parsed["eventhubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", *parsed) - } - - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseEventhubAuthorizationRuleIDInsensitively(input string) (*EventhubAutho return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EventhubAuthorizationRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *EventhubAuthorizationRuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.EventhubName, ok = parsed.Parsed["eventhubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", *parsed) + if id.EventhubName, ok = input.Parsed["eventhubName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "eventhubName", input) } - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if id.AuthorizationRuleName, ok = input.Parsed["authorizationRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", input) } - return &id, nil + return nil } // ValidateEventhubAuthorizationRuleID checks that 'input' can be parsed as a Eventhub Authorization Rule ID diff --git a/resource-manager/eventhub/2024-01-01/eventhubs/id_namespace.go b/resource-manager/eventhub/2024-01-01/eventhubs/id_namespace.go index 9265501203e..280cec81163 100644 --- a/resource-manager/eventhub/2024-01-01/eventhubs/id_namespace.go +++ b/resource-manager/eventhub/2024-01-01/eventhubs/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/eventhub/2024-01-01/eventhubsclusters/id_cluster.go b/resource-manager/eventhub/2024-01-01/eventhubsclusters/id_cluster.go index a3c42a2827c..a363558836e 100644 --- a/resource-manager/eventhub/2024-01-01/eventhubsclusters/id_cluster.go +++ b/resource-manager/eventhub/2024-01-01/eventhubsclusters/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/eventhub/2024-01-01/eventhubsclustersconfiguration/id_cluster.go b/resource-manager/eventhub/2024-01-01/eventhubsclustersconfiguration/id_cluster.go index 8b8b7a946f8..cc5a3212b11 100644 --- a/resource-manager/eventhub/2024-01-01/eventhubsclustersconfiguration/id_cluster.go +++ b/resource-manager/eventhub/2024-01-01/eventhubsclustersconfiguration/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/eventhub/2024-01-01/eventhubsclustersnamespace/id_cluster.go b/resource-manager/eventhub/2024-01-01/eventhubsclustersnamespace/id_cluster.go index da3017a531b..0d27d503e5a 100644 --- a/resource-manager/eventhub/2024-01-01/eventhubsclustersnamespace/id_cluster.go +++ b/resource-manager/eventhub/2024-01-01/eventhubsclustersnamespace/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/eventhub/2024-01-01/eventhubsclustersupgrade/id_cluster.go b/resource-manager/eventhub/2024-01-01/eventhubsclustersupgrade/id_cluster.go index 84bd9cb7bda..91efc309cdd 100644 --- a/resource-manager/eventhub/2024-01-01/eventhubsclustersupgrade/id_cluster.go +++ b/resource-manager/eventhub/2024-01-01/eventhubsclustersupgrade/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/eventhub/2024-01-01/namespaces/id_namespace.go b/resource-manager/eventhub/2024-01-01/namespaces/id_namespace.go index db2055c3c04..31a5246b392 100644 --- a/resource-manager/eventhub/2024-01-01/namespaces/id_namespace.go +++ b/resource-manager/eventhub/2024-01-01/namespaces/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/eventhub/2024-01-01/namespacesnetworksecurityperimeterconfigurations/id_namespace.go b/resource-manager/eventhub/2024-01-01/namespacesnetworksecurityperimeterconfigurations/id_namespace.go index f852dba4a05..321a8f1c48a 100644 --- a/resource-manager/eventhub/2024-01-01/namespacesnetworksecurityperimeterconfigurations/id_namespace.go +++ b/resource-manager/eventhub/2024-01-01/namespacesnetworksecurityperimeterconfigurations/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/eventhub/2024-01-01/namespacesnetworksecurityperimeterconfigurations/id_networksecurityperimeterconfiguration.go b/resource-manager/eventhub/2024-01-01/namespacesnetworksecurityperimeterconfigurations/id_networksecurityperimeterconfiguration.go index 734ba2f96cf..2e99892af07 100644 --- a/resource-manager/eventhub/2024-01-01/namespacesnetworksecurityperimeterconfigurations/id_networksecurityperimeterconfiguration.go +++ b/resource-manager/eventhub/2024-01-01/namespacesnetworksecurityperimeterconfigurations/id_networksecurityperimeterconfiguration.go @@ -38,23 +38,9 @@ func ParseNetworkSecurityPerimeterConfigurationID(input string) (*NetworkSecurit return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkSecurityPerimeterConfigurationId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.NetworkSecurityPerimeterConfigurationName, ok = parsed.Parsed["networkSecurityPerimeterConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkSecurityPerimeterConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseNetworkSecurityPerimeterConfigurationIDInsensitively(input string) (*N return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkSecurityPerimeterConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *NetworkSecurityPerimeterConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.NetworkSecurityPerimeterConfigurationName, ok = parsed.Parsed["networkSecurityPerimeterConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkSecurityPerimeterConfigurationName", *parsed) + if id.NetworkSecurityPerimeterConfigurationName, ok = input.Parsed["networkSecurityPerimeterConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkSecurityPerimeterConfigurationName", input) } - return &id, nil + return nil } // ValidateNetworkSecurityPerimeterConfigurationID checks that 'input' can be parsed as a Network Security Perimeter Configuration ID diff --git a/resource-manager/eventhub/2024-01-01/namespacesprivateendpointconnections/id_namespace.go b/resource-manager/eventhub/2024-01-01/namespacesprivateendpointconnections/id_namespace.go index 78d57621b0d..46557bd8e4f 100644 --- a/resource-manager/eventhub/2024-01-01/namespacesprivateendpointconnections/id_namespace.go +++ b/resource-manager/eventhub/2024-01-01/namespacesprivateendpointconnections/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/eventhub/2024-01-01/namespacesprivateendpointconnections/id_privateendpointconnection.go b/resource-manager/eventhub/2024-01-01/namespacesprivateendpointconnections/id_privateendpointconnection.go index 257910e2288..8d3d729a184 100644 --- a/resource-manager/eventhub/2024-01-01/namespacesprivateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/eventhub/2024-01-01/namespacesprivateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/eventhub/2024-01-01/namespacesprivatelinkresources/id_namespace.go b/resource-manager/eventhub/2024-01-01/namespacesprivatelinkresources/id_namespace.go index 4254d2bd518..84c2f61c427 100644 --- a/resource-manager/eventhub/2024-01-01/namespacesprivatelinkresources/id_namespace.go +++ b/resource-manager/eventhub/2024-01-01/namespacesprivatelinkresources/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/eventhub/2024-01-01/networkrulesets/id_namespace.go b/resource-manager/eventhub/2024-01-01/networkrulesets/id_namespace.go index 3026464070c..348ce69dc22 100644 --- a/resource-manager/eventhub/2024-01-01/networkrulesets/id_namespace.go +++ b/resource-manager/eventhub/2024-01-01/networkrulesets/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/eventhub/2024-01-01/schemaregistry/id_namespace.go b/resource-manager/eventhub/2024-01-01/schemaregistry/id_namespace.go index eeeb927afd9..0b22ea3ba72 100644 --- a/resource-manager/eventhub/2024-01-01/schemaregistry/id_namespace.go +++ b/resource-manager/eventhub/2024-01-01/schemaregistry/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/eventhub/2024-01-01/schemaregistry/id_schemagroup.go b/resource-manager/eventhub/2024-01-01/schemaregistry/id_schemagroup.go index 28a768fa935..da5ac169296 100644 --- a/resource-manager/eventhub/2024-01-01/schemaregistry/id_schemagroup.go +++ b/resource-manager/eventhub/2024-01-01/schemaregistry/id_schemagroup.go @@ -38,23 +38,9 @@ func ParseSchemaGroupID(input string) (*SchemaGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SchemaGroupId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.SchemaGroupName, ok = parsed.Parsed["schemaGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSchemaGroupIDInsensitively(input string) (*SchemaGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SchemaGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SchemaGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.SchemaGroupName, ok = parsed.Parsed["schemaGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaGroupName", *parsed) + if id.SchemaGroupName, ok = input.Parsed["schemaGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "schemaGroupName", input) } - return &id, nil + return nil } // ValidateSchemaGroupID checks that 'input' can be parsed as a Schema Group ID diff --git a/resource-manager/extendedlocation/2021-08-15/customlocations/id_customlocation.go b/resource-manager/extendedlocation/2021-08-15/customlocations/id_customlocation.go index e7aafd52c76..2dcae63d1c9 100644 --- a/resource-manager/extendedlocation/2021-08-15/customlocations/id_customlocation.go +++ b/resource-manager/extendedlocation/2021-08-15/customlocations/id_customlocation.go @@ -36,19 +36,9 @@ func ParseCustomLocationID(input string) (*CustomLocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CustomLocationId{} - - 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.CustomLocationName, ok = parsed.Parsed["customLocationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "customLocationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseCustomLocationIDInsensitively(input string) (*CustomLocationId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CustomLocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CustomLocationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CustomLocationName, ok = parsed.Parsed["customLocationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "customLocationName", *parsed) + if id.CustomLocationName, ok = input.Parsed["customLocationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "customLocationName", input) } - return &id, nil + return nil } // ValidateCustomLocationID checks that 'input' can be parsed as a Custom Location ID diff --git a/resource-manager/fluidrelay/2022-05-26/fluidrelaycontainers/id_fluidrelaycontainer.go b/resource-manager/fluidrelay/2022-05-26/fluidrelaycontainers/id_fluidrelaycontainer.go index 731eb3beeb1..f8aa591c8b1 100644 --- a/resource-manager/fluidrelay/2022-05-26/fluidrelaycontainers/id_fluidrelaycontainer.go +++ b/resource-manager/fluidrelay/2022-05-26/fluidrelaycontainers/id_fluidrelaycontainer.go @@ -38,23 +38,9 @@ func ParseFluidRelayContainerID(input string) (*FluidRelayContainerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FluidRelayContainerId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroup", *parsed) - } - - if id.FluidRelayServerName, ok = parsed.Parsed["fluidRelayServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fluidRelayServerName", *parsed) - } - - if id.FluidRelayContainerName, ok = parsed.Parsed["fluidRelayContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fluidRelayContainerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFluidRelayContainerIDInsensitively(input string) (*FluidRelayContainer return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FluidRelayContainerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FluidRelayContainerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroup", *parsed) + if id.ResourceGroup, ok = input.Parsed["resourceGroup"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroup", input) } - if id.FluidRelayServerName, ok = parsed.Parsed["fluidRelayServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fluidRelayServerName", *parsed) + if id.FluidRelayServerName, ok = input.Parsed["fluidRelayServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fluidRelayServerName", input) } - if id.FluidRelayContainerName, ok = parsed.Parsed["fluidRelayContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fluidRelayContainerName", *parsed) + if id.FluidRelayContainerName, ok = input.Parsed["fluidRelayContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fluidRelayContainerName", input) } - return &id, nil + return nil } // ValidateFluidRelayContainerID checks that 'input' can be parsed as a Fluid Relay Container ID diff --git a/resource-manager/fluidrelay/2022-05-26/fluidrelaycontainers/id_fluidrelayserver.go b/resource-manager/fluidrelay/2022-05-26/fluidrelaycontainers/id_fluidrelayserver.go index f2209c1c014..8d4d5d97b8b 100644 --- a/resource-manager/fluidrelay/2022-05-26/fluidrelaycontainers/id_fluidrelayserver.go +++ b/resource-manager/fluidrelay/2022-05-26/fluidrelaycontainers/id_fluidrelayserver.go @@ -36,19 +36,9 @@ func ParseFluidRelayServerID(input string) (*FluidRelayServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FluidRelayServerId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroup", *parsed) - } - - if id.FluidRelayServerName, ok = parsed.Parsed["fluidRelayServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fluidRelayServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFluidRelayServerIDInsensitively(input string) (*FluidRelayServerId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FluidRelayServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FluidRelayServerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroup", *parsed) + if id.ResourceGroup, ok = input.Parsed["resourceGroup"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroup", input) } - if id.FluidRelayServerName, ok = parsed.Parsed["fluidRelayServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fluidRelayServerName", *parsed) + if id.FluidRelayServerName, ok = input.Parsed["fluidRelayServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fluidRelayServerName", input) } - return &id, nil + return nil } // ValidateFluidRelayServerID checks that 'input' can be parsed as a Fluid Relay Server ID diff --git a/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/id_fluidrelayserver.go b/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/id_fluidrelayserver.go index f1aebf1c1c6..b509c486cd4 100644 --- a/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/id_fluidrelayserver.go +++ b/resource-manager/fluidrelay/2022-05-26/fluidrelayservers/id_fluidrelayserver.go @@ -36,19 +36,9 @@ func ParseFluidRelayServerID(input string) (*FluidRelayServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FluidRelayServerId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroup", *parsed) - } - - if id.FluidRelayServerName, ok = parsed.Parsed["fluidRelayServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fluidRelayServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFluidRelayServerIDInsensitively(input string) (*FluidRelayServerId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FluidRelayServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FluidRelayServerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroup", *parsed) + if id.ResourceGroup, ok = input.Parsed["resourceGroup"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroup", input) } - if id.FluidRelayServerName, ok = parsed.Parsed["fluidRelayServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fluidRelayServerName", *parsed) + if id.FluidRelayServerName, ok = input.Parsed["fluidRelayServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fluidRelayServerName", input) } - return &id, nil + return nil } // ValidateFluidRelayServerID checks that 'input' can be parsed as a Fluid Relay Server ID diff --git a/resource-manager/fluidrelay/2022-06-01/fluidrelaycontainers/id_fluidrelaycontainer.go b/resource-manager/fluidrelay/2022-06-01/fluidrelaycontainers/id_fluidrelaycontainer.go index 731eb3beeb1..f8aa591c8b1 100644 --- a/resource-manager/fluidrelay/2022-06-01/fluidrelaycontainers/id_fluidrelaycontainer.go +++ b/resource-manager/fluidrelay/2022-06-01/fluidrelaycontainers/id_fluidrelaycontainer.go @@ -38,23 +38,9 @@ func ParseFluidRelayContainerID(input string) (*FluidRelayContainerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FluidRelayContainerId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroup", *parsed) - } - - if id.FluidRelayServerName, ok = parsed.Parsed["fluidRelayServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fluidRelayServerName", *parsed) - } - - if id.FluidRelayContainerName, ok = parsed.Parsed["fluidRelayContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fluidRelayContainerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFluidRelayContainerIDInsensitively(input string) (*FluidRelayContainer return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FluidRelayContainerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FluidRelayContainerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroup", *parsed) + if id.ResourceGroup, ok = input.Parsed["resourceGroup"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroup", input) } - if id.FluidRelayServerName, ok = parsed.Parsed["fluidRelayServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fluidRelayServerName", *parsed) + if id.FluidRelayServerName, ok = input.Parsed["fluidRelayServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fluidRelayServerName", input) } - if id.FluidRelayContainerName, ok = parsed.Parsed["fluidRelayContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fluidRelayContainerName", *parsed) + if id.FluidRelayContainerName, ok = input.Parsed["fluidRelayContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fluidRelayContainerName", input) } - return &id, nil + return nil } // ValidateFluidRelayContainerID checks that 'input' can be parsed as a Fluid Relay Container ID diff --git a/resource-manager/fluidrelay/2022-06-01/fluidrelaycontainers/id_fluidrelayserver.go b/resource-manager/fluidrelay/2022-06-01/fluidrelaycontainers/id_fluidrelayserver.go index f2209c1c014..8d4d5d97b8b 100644 --- a/resource-manager/fluidrelay/2022-06-01/fluidrelaycontainers/id_fluidrelayserver.go +++ b/resource-manager/fluidrelay/2022-06-01/fluidrelaycontainers/id_fluidrelayserver.go @@ -36,19 +36,9 @@ func ParseFluidRelayServerID(input string) (*FluidRelayServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FluidRelayServerId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroup", *parsed) - } - - if id.FluidRelayServerName, ok = parsed.Parsed["fluidRelayServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fluidRelayServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFluidRelayServerIDInsensitively(input string) (*FluidRelayServerId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FluidRelayServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FluidRelayServerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroup", *parsed) + if id.ResourceGroup, ok = input.Parsed["resourceGroup"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroup", input) } - if id.FluidRelayServerName, ok = parsed.Parsed["fluidRelayServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fluidRelayServerName", *parsed) + if id.FluidRelayServerName, ok = input.Parsed["fluidRelayServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fluidRelayServerName", input) } - return &id, nil + return nil } // ValidateFluidRelayServerID checks that 'input' can be parsed as a Fluid Relay Server ID diff --git a/resource-manager/fluidrelay/2022-06-01/fluidrelayservers/id_fluidrelayserver.go b/resource-manager/fluidrelay/2022-06-01/fluidrelayservers/id_fluidrelayserver.go index f1aebf1c1c6..b509c486cd4 100644 --- a/resource-manager/fluidrelay/2022-06-01/fluidrelayservers/id_fluidrelayserver.go +++ b/resource-manager/fluidrelay/2022-06-01/fluidrelayservers/id_fluidrelayserver.go @@ -36,19 +36,9 @@ func ParseFluidRelayServerID(input string) (*FluidRelayServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FluidRelayServerId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroup", *parsed) - } - - if id.FluidRelayServerName, ok = parsed.Parsed["fluidRelayServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fluidRelayServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFluidRelayServerIDInsensitively(input string) (*FluidRelayServerId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FluidRelayServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FluidRelayServerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroup", *parsed) + if id.ResourceGroup, ok = input.Parsed["resourceGroup"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroup", input) } - if id.FluidRelayServerName, ok = parsed.Parsed["fluidRelayServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fluidRelayServerName", *parsed) + if id.FluidRelayServerName, ok = input.Parsed["fluidRelayServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fluidRelayServerName", input) } - return &id, nil + return nil } // ValidateFluidRelayServerID checks that 'input' can be parsed as a Fluid Relay Server ID diff --git a/resource-manager/frontdoor/2020-04-01/frontdoors/id_frontdoor.go b/resource-manager/frontdoor/2020-04-01/frontdoors/id_frontdoor.go index f00b1b8baba..fc20354bcc7 100644 --- a/resource-manager/frontdoor/2020-04-01/frontdoors/id_frontdoor.go +++ b/resource-manager/frontdoor/2020-04-01/frontdoors/id_frontdoor.go @@ -36,19 +36,9 @@ func ParseFrontDoorID(input string) (*FrontDoorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FrontDoorId{} - - 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.FrontDoorName, ok = parsed.Parsed["frontDoorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "frontDoorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFrontDoorIDInsensitively(input string) (*FrontDoorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FrontDoorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FrontDoorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FrontDoorName, ok = parsed.Parsed["frontDoorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "frontDoorName", *parsed) + if id.FrontDoorName, ok = input.Parsed["frontDoorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "frontDoorName", input) } - return &id, nil + return nil } // ValidateFrontDoorID checks that 'input' can be parsed as a Front Door ID diff --git a/resource-manager/frontdoor/2020-04-01/frontdoors/id_frontendendpoint.go b/resource-manager/frontdoor/2020-04-01/frontdoors/id_frontendendpoint.go index 20992365b76..2bb3c01732d 100644 --- a/resource-manager/frontdoor/2020-04-01/frontdoors/id_frontendendpoint.go +++ b/resource-manager/frontdoor/2020-04-01/frontdoors/id_frontendendpoint.go @@ -38,23 +38,9 @@ func ParseFrontendEndpointID(input string) (*FrontendEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FrontendEndpointId{} - - 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.FrontDoorName, ok = parsed.Parsed["frontDoorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "frontDoorName", *parsed) - } - - if id.FrontendEndpointName, ok = parsed.Parsed["frontendEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "frontendEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFrontendEndpointIDInsensitively(input string) (*FrontendEndpointId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FrontendEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FrontendEndpointId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FrontDoorName, ok = parsed.Parsed["frontDoorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "frontDoorName", *parsed) + if id.FrontDoorName, ok = input.Parsed["frontDoorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "frontDoorName", input) } - if id.FrontendEndpointName, ok = parsed.Parsed["frontendEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "frontendEndpointName", *parsed) + if id.FrontendEndpointName, ok = input.Parsed["frontendEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "frontendEndpointName", input) } - return &id, nil + return nil } // ValidateFrontendEndpointID checks that 'input' can be parsed as a Frontend Endpoint ID diff --git a/resource-manager/frontdoor/2020-04-01/frontdoors/id_rulesengine.go b/resource-manager/frontdoor/2020-04-01/frontdoors/id_rulesengine.go index dfcbab4a75c..d0c437e01ef 100644 --- a/resource-manager/frontdoor/2020-04-01/frontdoors/id_rulesengine.go +++ b/resource-manager/frontdoor/2020-04-01/frontdoors/id_rulesengine.go @@ -38,23 +38,9 @@ func ParseRulesEngineID(input string) (*RulesEngineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RulesEngineId{} - - 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.FrontDoorName, ok = parsed.Parsed["frontDoorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "frontDoorName", *parsed) - } - - if id.RulesEngineName, ok = parsed.Parsed["rulesEngineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "rulesEngineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRulesEngineIDInsensitively(input string) (*RulesEngineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RulesEngineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RulesEngineId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FrontDoorName, ok = parsed.Parsed["frontDoorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "frontDoorName", *parsed) + if id.FrontDoorName, ok = input.Parsed["frontDoorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "frontDoorName", input) } - if id.RulesEngineName, ok = parsed.Parsed["rulesEngineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "rulesEngineName", *parsed) + if id.RulesEngineName, ok = input.Parsed["rulesEngineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "rulesEngineName", input) } - return &id, nil + return nil } // ValidateRulesEngineID checks that 'input' can be parsed as a Rules Engine ID diff --git a/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/id_frontdoorwebapplicationfirewallpolicy.go b/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/id_frontdoorwebapplicationfirewallpolicy.go index c414dd18c28..648278de38b 100644 --- a/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/id_frontdoorwebapplicationfirewallpolicy.go +++ b/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies/id_frontdoorwebapplicationfirewallpolicy.go @@ -36,19 +36,9 @@ func ParseFrontDoorWebApplicationFirewallPolicyID(input string) (*FrontDoorWebAp return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FrontDoorWebApplicationFirewallPolicyId{} - - 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.FrontDoorWebApplicationFirewallPolicyName, ok = parsed.Parsed["frontDoorWebApplicationFirewallPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "frontDoorWebApplicationFirewallPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFrontDoorWebApplicationFirewallPolicyIDInsensitively(input string) (*F return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FrontDoorWebApplicationFirewallPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FrontDoorWebApplicationFirewallPolicyId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FrontDoorWebApplicationFirewallPolicyName, ok = parsed.Parsed["frontDoorWebApplicationFirewallPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "frontDoorWebApplicationFirewallPolicyName", *parsed) + if id.FrontDoorWebApplicationFirewallPolicyName, ok = input.Parsed["frontDoorWebApplicationFirewallPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "frontDoorWebApplicationFirewallPolicyName", input) } - return &id, nil + return nil } // ValidateFrontDoorWebApplicationFirewallPolicyID checks that 'input' can be parsed as a Front Door Web Application Firewall Policy ID diff --git a/resource-manager/frontdoor/2020-05-01/frontdoors/id_frontdoor.go b/resource-manager/frontdoor/2020-05-01/frontdoors/id_frontdoor.go index f00b1b8baba..fc20354bcc7 100644 --- a/resource-manager/frontdoor/2020-05-01/frontdoors/id_frontdoor.go +++ b/resource-manager/frontdoor/2020-05-01/frontdoors/id_frontdoor.go @@ -36,19 +36,9 @@ func ParseFrontDoorID(input string) (*FrontDoorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FrontDoorId{} - - 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.FrontDoorName, ok = parsed.Parsed["frontDoorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "frontDoorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFrontDoorIDInsensitively(input string) (*FrontDoorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FrontDoorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FrontDoorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FrontDoorName, ok = parsed.Parsed["frontDoorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "frontDoorName", *parsed) + if id.FrontDoorName, ok = input.Parsed["frontDoorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "frontDoorName", input) } - return &id, nil + return nil } // ValidateFrontDoorID checks that 'input' can be parsed as a Front Door ID diff --git a/resource-manager/frontdoor/2020-05-01/frontdoors/id_frontendendpoint.go b/resource-manager/frontdoor/2020-05-01/frontdoors/id_frontendendpoint.go index 20992365b76..2bb3c01732d 100644 --- a/resource-manager/frontdoor/2020-05-01/frontdoors/id_frontendendpoint.go +++ b/resource-manager/frontdoor/2020-05-01/frontdoors/id_frontendendpoint.go @@ -38,23 +38,9 @@ func ParseFrontendEndpointID(input string) (*FrontendEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FrontendEndpointId{} - - 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.FrontDoorName, ok = parsed.Parsed["frontDoorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "frontDoorName", *parsed) - } - - if id.FrontendEndpointName, ok = parsed.Parsed["frontendEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "frontendEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFrontendEndpointIDInsensitively(input string) (*FrontendEndpointId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FrontendEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FrontendEndpointId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FrontDoorName, ok = parsed.Parsed["frontDoorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "frontDoorName", *parsed) + if id.FrontDoorName, ok = input.Parsed["frontDoorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "frontDoorName", input) } - if id.FrontendEndpointName, ok = parsed.Parsed["frontendEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "frontendEndpointName", *parsed) + if id.FrontendEndpointName, ok = input.Parsed["frontendEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "frontendEndpointName", input) } - return &id, nil + return nil } // ValidateFrontendEndpointID checks that 'input' can be parsed as a Frontend Endpoint ID diff --git a/resource-manager/frontdoor/2020-05-01/frontdoors/id_rulesengine.go b/resource-manager/frontdoor/2020-05-01/frontdoors/id_rulesengine.go index dfcbab4a75c..d0c437e01ef 100644 --- a/resource-manager/frontdoor/2020-05-01/frontdoors/id_rulesengine.go +++ b/resource-manager/frontdoor/2020-05-01/frontdoors/id_rulesengine.go @@ -38,23 +38,9 @@ func ParseRulesEngineID(input string) (*RulesEngineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RulesEngineId{} - - 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.FrontDoorName, ok = parsed.Parsed["frontDoorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "frontDoorName", *parsed) - } - - if id.RulesEngineName, ok = parsed.Parsed["rulesEngineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "rulesEngineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRulesEngineIDInsensitively(input string) (*RulesEngineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RulesEngineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RulesEngineId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FrontDoorName, ok = parsed.Parsed["frontDoorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "frontDoorName", *parsed) + if id.FrontDoorName, ok = input.Parsed["frontDoorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "frontDoorName", input) } - if id.RulesEngineName, ok = parsed.Parsed["rulesEngineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "rulesEngineName", *parsed) + if id.RulesEngineName, ok = input.Parsed["rulesEngineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "rulesEngineName", input) } - return &id, nil + return nil } // ValidateRulesEngineID checks that 'input' can be parsed as a Rules Engine ID diff --git a/resource-manager/frontdoor/2022-05-01/webapplicationfirewallpolicies/id_frontdoorwebapplicationfirewallpolicy.go b/resource-manager/frontdoor/2022-05-01/webapplicationfirewallpolicies/id_frontdoorwebapplicationfirewallpolicy.go index c414dd18c28..648278de38b 100644 --- a/resource-manager/frontdoor/2022-05-01/webapplicationfirewallpolicies/id_frontdoorwebapplicationfirewallpolicy.go +++ b/resource-manager/frontdoor/2022-05-01/webapplicationfirewallpolicies/id_frontdoorwebapplicationfirewallpolicy.go @@ -36,19 +36,9 @@ func ParseFrontDoorWebApplicationFirewallPolicyID(input string) (*FrontDoorWebAp return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FrontDoorWebApplicationFirewallPolicyId{} - - 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.FrontDoorWebApplicationFirewallPolicyName, ok = parsed.Parsed["frontDoorWebApplicationFirewallPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "frontDoorWebApplicationFirewallPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFrontDoorWebApplicationFirewallPolicyIDInsensitively(input string) (*F return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FrontDoorWebApplicationFirewallPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FrontDoorWebApplicationFirewallPolicyId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FrontDoorWebApplicationFirewallPolicyName, ok = parsed.Parsed["frontDoorWebApplicationFirewallPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "frontDoorWebApplicationFirewallPolicyName", *parsed) + if id.FrontDoorWebApplicationFirewallPolicyName, ok = input.Parsed["frontDoorWebApplicationFirewallPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "frontDoorWebApplicationFirewallPolicyName", input) } - return &id, nil + return nil } // ValidateFrontDoorWebApplicationFirewallPolicyID checks that 'input' can be parsed as a Front Door Web Application Firewall Policy ID diff --git a/resource-manager/graphservices/2023-04-13/graphservicesprods/id_account.go b/resource-manager/graphservices/2023-04-13/graphservicesprods/id_account.go index 0987727c2d1..22a570623f2 100644 --- a/resource-manager/graphservices/2023-04-13/graphservicesprods/id_account.go +++ b/resource-manager/graphservices/2023-04-13/graphservicesprods/id_account.go @@ -36,19 +36,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignmenthcrpreports/id_guestconfigurationassignment.go b/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignmenthcrpreports/id_guestconfigurationassignment.go index 19e65a94eea..c8859512261 100644 --- a/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignmenthcrpreports/id_guestconfigurationassignment.go +++ b/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignmenthcrpreports/id_guestconfigurationassignment.go @@ -38,23 +38,9 @@ func ParseGuestConfigurationAssignmentID(input string) (*GuestConfigurationAssig return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GuestConfigurationAssignmentId{} - - 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.MachineName, ok = parsed.Parsed["machineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machineName", *parsed) - } - - if id.GuestConfigurationAssignmentName, ok = parsed.Parsed["guestConfigurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGuestConfigurationAssignmentIDInsensitively(input string) (*GuestConfi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GuestConfigurationAssignmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GuestConfigurationAssignmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MachineName, ok = parsed.Parsed["machineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machineName", *parsed) + if id.MachineName, ok = input.Parsed["machineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "machineName", input) } - if id.GuestConfigurationAssignmentName, ok = parsed.Parsed["guestConfigurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", *parsed) + if id.GuestConfigurationAssignmentName, ok = input.Parsed["guestConfigurationAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", input) } - return &id, nil + return nil } // ValidateGuestConfigurationAssignmentID checks that 'input' can be parsed as a Guest Configuration Assignment ID diff --git a/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignmenthcrpreports/id_report.go b/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignmenthcrpreports/id_report.go index 9eee0813f0c..70ac3ea2421 100644 --- a/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignmenthcrpreports/id_report.go +++ b/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignmenthcrpreports/id_report.go @@ -40,27 +40,9 @@ func ParseReportID(input string) (*ReportId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReportId{} - - 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.MachineName, ok = parsed.Parsed["machineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machineName", *parsed) - } - - if id.GuestConfigurationAssignmentName, ok = parsed.Parsed["guestConfigurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", *parsed) - } - - if id.ReportId, ok = parsed.Parsed["reportId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reportId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReportIDInsensitively(input string) (*ReportId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReportId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReportId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MachineName, ok = parsed.Parsed["machineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machineName", *parsed) + if id.MachineName, ok = input.Parsed["machineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "machineName", input) } - if id.GuestConfigurationAssignmentName, ok = parsed.Parsed["guestConfigurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", *parsed) + if id.GuestConfigurationAssignmentName, ok = input.Parsed["guestConfigurationAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", input) } - if id.ReportId, ok = parsed.Parsed["reportId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reportId", *parsed) + if id.ReportId, ok = input.Parsed["reportId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reportId", input) } - return &id, nil + return nil } // ValidateReportID checks that 'input' can be parsed as a Report ID diff --git a/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignmentreports/id_guestconfigurationassignmentreport.go b/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignmentreports/id_guestconfigurationassignmentreport.go index a58196cd0c3..aa1ad08340a 100644 --- a/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignmentreports/id_guestconfigurationassignmentreport.go +++ b/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignmentreports/id_guestconfigurationassignmentreport.go @@ -40,27 +40,9 @@ func ParseGuestConfigurationAssignmentReportID(input string) (*GuestConfiguratio return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GuestConfigurationAssignmentReportId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) - } - - if id.GuestConfigurationAssignmentName, ok = parsed.Parsed["guestConfigurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", *parsed) - } - - if id.ReportId, ok = parsed.Parsed["reportId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reportId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseGuestConfigurationAssignmentReportIDInsensitively(input string) (*Gues return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GuestConfigurationAssignmentReportId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *GuestConfigurationAssignmentReportId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - if id.GuestConfigurationAssignmentName, ok = parsed.Parsed["guestConfigurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", *parsed) + if id.GuestConfigurationAssignmentName, ok = input.Parsed["guestConfigurationAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", input) } - if id.ReportId, ok = parsed.Parsed["reportId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reportId", *parsed) + if id.ReportId, ok = input.Parsed["reportId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reportId", input) } - return &id, nil + return nil } // ValidateGuestConfigurationAssignmentReportID checks that 'input' can be parsed as a Guest Configuration Assignment Report ID diff --git a/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignmentreports/id_providers2guestconfigurationassignment.go b/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignmentreports/id_providers2guestconfigurationassignment.go index 18a2a18ee14..a61ce48b49d 100644 --- a/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignmentreports/id_providers2guestconfigurationassignment.go +++ b/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignmentreports/id_providers2guestconfigurationassignment.go @@ -38,23 +38,9 @@ func ParseProviders2GuestConfigurationAssignmentID(input string) (*Providers2Gue return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2GuestConfigurationAssignmentId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) - } - - if id.GuestConfigurationAssignmentName, ok = parsed.Parsed["guestConfigurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProviders2GuestConfigurationAssignmentIDInsensitively(input string) (* return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2GuestConfigurationAssignmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *Providers2GuestConfigurationAssignmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - if id.GuestConfigurationAssignmentName, ok = parsed.Parsed["guestConfigurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", *parsed) + if id.GuestConfigurationAssignmentName, ok = input.Parsed["guestConfigurationAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", input) } - return &id, nil + return nil } // ValidateProviders2GuestConfigurationAssignmentID checks that 'input' can be parsed as a Providers 2 Guest Configuration Assignment ID diff --git a/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/id_providers2guestconfigurationassignment.go b/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/id_providers2guestconfigurationassignment.go index a7c5aeee355..ef073b7f85e 100644 --- a/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/id_providers2guestconfigurationassignment.go +++ b/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/id_providers2guestconfigurationassignment.go @@ -38,23 +38,9 @@ func ParseProviders2GuestConfigurationAssignmentID(input string) (*Providers2Gue return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2GuestConfigurationAssignmentId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) - } - - if id.GuestConfigurationAssignmentName, ok = parsed.Parsed["guestConfigurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProviders2GuestConfigurationAssignmentIDInsensitively(input string) (* return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2GuestConfigurationAssignmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *Providers2GuestConfigurationAssignmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - if id.GuestConfigurationAssignmentName, ok = parsed.Parsed["guestConfigurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", *parsed) + if id.GuestConfigurationAssignmentName, ok = input.Parsed["guestConfigurationAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", input) } - return &id, nil + return nil } // ValidateProviders2GuestConfigurationAssignmentID checks that 'input' can be parsed as a Providers 2 Guest Configuration Assignment ID diff --git a/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/id_virtualmachine.go b/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/id_virtualmachine.go index 22608a73d06..cc55c092b18 100644 --- a/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/id_virtualmachine.go +++ b/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/id_virtualmachine.go @@ -36,19 +36,9 @@ func ParseVirtualMachineID(input string) (*VirtualMachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineIDInsensitively(input string) (*VirtualMachineId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - return &id, nil + return nil } // ValidateVirtualMachineID checks that 'input' can be parsed as a Virtual Machine ID diff --git a/resource-manager/guestconfiguration/2020-06-25/guestconfigurationconnectedvmwarevsphereassignments/id_providervirtualmachine.go b/resource-manager/guestconfiguration/2020-06-25/guestconfigurationconnectedvmwarevsphereassignments/id_providervirtualmachine.go index 5d327ec15b3..b5354d2e8fb 100644 --- a/resource-manager/guestconfiguration/2020-06-25/guestconfigurationconnectedvmwarevsphereassignments/id_providervirtualmachine.go +++ b/resource-manager/guestconfiguration/2020-06-25/guestconfigurationconnectedvmwarevsphereassignments/id_providervirtualmachine.go @@ -36,19 +36,9 @@ func ParseProviderVirtualMachineID(input string) (*ProviderVirtualMachineId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderVirtualMachineId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderVirtualMachineIDInsensitively(input string) (*ProviderVirtualM return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderVirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderVirtualMachineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - return &id, nil + return nil } // ValidateProviderVirtualMachineID checks that 'input' can be parsed as a Provider Virtual Machine ID diff --git a/resource-manager/guestconfiguration/2020-06-25/guestconfigurationconnectedvmwarevsphereassignments/id_virtualmachineproviders2guestconfigurationassignment.go b/resource-manager/guestconfiguration/2020-06-25/guestconfigurationconnectedvmwarevsphereassignments/id_virtualmachineproviders2guestconfigurationassignment.go index 5fb49201657..3a6f660912a 100644 --- a/resource-manager/guestconfiguration/2020-06-25/guestconfigurationconnectedvmwarevsphereassignments/id_virtualmachineproviders2guestconfigurationassignment.go +++ b/resource-manager/guestconfiguration/2020-06-25/guestconfigurationconnectedvmwarevsphereassignments/id_virtualmachineproviders2guestconfigurationassignment.go @@ -38,23 +38,9 @@ func ParseVirtualMachineProviders2GuestConfigurationAssignmentID(input string) ( return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineProviders2GuestConfigurationAssignmentId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) - } - - if id.GuestConfigurationAssignmentName, ok = parsed.Parsed["guestConfigurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualMachineProviders2GuestConfigurationAssignmentIDInsensitively(in return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineProviders2GuestConfigurationAssignmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineProviders2GuestConfigurationAssignmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - if id.GuestConfigurationAssignmentName, ok = parsed.Parsed["guestConfigurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", *parsed) + if id.GuestConfigurationAssignmentName, ok = input.Parsed["guestConfigurationAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", input) } - return &id, nil + return nil } // ValidateVirtualMachineProviders2GuestConfigurationAssignmentID checks that 'input' can be parsed as a Virtual Machine Providers 2 Guest Configuration Assignment ID diff --git a/resource-manager/guestconfiguration/2020-06-25/guestconfigurationconnectedvmwarevsphereassignmentsreports/id_providers2guestconfigurationassignmentreport.go b/resource-manager/guestconfiguration/2020-06-25/guestconfigurationconnectedvmwarevsphereassignmentsreports/id_providers2guestconfigurationassignmentreport.go index 65c6acc36f1..f6bbc21b642 100644 --- a/resource-manager/guestconfiguration/2020-06-25/guestconfigurationconnectedvmwarevsphereassignmentsreports/id_providers2guestconfigurationassignmentreport.go +++ b/resource-manager/guestconfiguration/2020-06-25/guestconfigurationconnectedvmwarevsphereassignmentsreports/id_providers2guestconfigurationassignmentreport.go @@ -40,27 +40,9 @@ func ParseProviders2GuestConfigurationAssignmentReportID(input string) (*Provide return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2GuestConfigurationAssignmentReportId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) - } - - if id.GuestConfigurationAssignmentName, ok = parsed.Parsed["guestConfigurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", *parsed) - } - - if id.ReportId, ok = parsed.Parsed["reportId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reportId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseProviders2GuestConfigurationAssignmentReportIDInsensitively(input stri return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2GuestConfigurationAssignmentReportId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *Providers2GuestConfigurationAssignmentReportId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - if id.GuestConfigurationAssignmentName, ok = parsed.Parsed["guestConfigurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", *parsed) + if id.GuestConfigurationAssignmentName, ok = input.Parsed["guestConfigurationAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", input) } - if id.ReportId, ok = parsed.Parsed["reportId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reportId", *parsed) + if id.ReportId, ok = input.Parsed["reportId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reportId", input) } - return &id, nil + return nil } // ValidateProviders2GuestConfigurationAssignmentReportID checks that 'input' can be parsed as a Providers 2 Guest Configuration Assignment Report ID diff --git a/resource-manager/guestconfiguration/2020-06-25/guestconfigurationconnectedvmwarevsphereassignmentsreports/id_virtualmachineproviders2guestconfigurationassignment.go b/resource-manager/guestconfiguration/2020-06-25/guestconfigurationconnectedvmwarevsphereassignmentsreports/id_virtualmachineproviders2guestconfigurationassignment.go index 6284d271264..0e03f1ed2b4 100644 --- a/resource-manager/guestconfiguration/2020-06-25/guestconfigurationconnectedvmwarevsphereassignmentsreports/id_virtualmachineproviders2guestconfigurationassignment.go +++ b/resource-manager/guestconfiguration/2020-06-25/guestconfigurationconnectedvmwarevsphereassignmentsreports/id_virtualmachineproviders2guestconfigurationassignment.go @@ -38,23 +38,9 @@ func ParseVirtualMachineProviders2GuestConfigurationAssignmentID(input string) ( return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineProviders2GuestConfigurationAssignmentId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) - } - - if id.GuestConfigurationAssignmentName, ok = parsed.Parsed["guestConfigurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualMachineProviders2GuestConfigurationAssignmentIDInsensitively(in return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineProviders2GuestConfigurationAssignmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineProviders2GuestConfigurationAssignmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - if id.GuestConfigurationAssignmentName, ok = parsed.Parsed["guestConfigurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", *parsed) + if id.GuestConfigurationAssignmentName, ok = input.Parsed["guestConfigurationAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", input) } - return &id, nil + return nil } // ValidateVirtualMachineProviders2GuestConfigurationAssignmentID checks that 'input' can be parsed as a Virtual Machine Providers 2 Guest Configuration Assignment ID diff --git a/resource-manager/guestconfiguration/2020-06-25/guestconfigurationhcrpassignments/id_guestconfigurationassignment.go b/resource-manager/guestconfiguration/2020-06-25/guestconfigurationhcrpassignments/id_guestconfigurationassignment.go index 7e45b4cc1db..3e33981f1f1 100644 --- a/resource-manager/guestconfiguration/2020-06-25/guestconfigurationhcrpassignments/id_guestconfigurationassignment.go +++ b/resource-manager/guestconfiguration/2020-06-25/guestconfigurationhcrpassignments/id_guestconfigurationassignment.go @@ -38,23 +38,9 @@ func ParseGuestConfigurationAssignmentID(input string) (*GuestConfigurationAssig return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GuestConfigurationAssignmentId{} - - 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.MachineName, ok = parsed.Parsed["machineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machineName", *parsed) - } - - if id.GuestConfigurationAssignmentName, ok = parsed.Parsed["guestConfigurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGuestConfigurationAssignmentIDInsensitively(input string) (*GuestConfi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GuestConfigurationAssignmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GuestConfigurationAssignmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MachineName, ok = parsed.Parsed["machineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machineName", *parsed) + if id.MachineName, ok = input.Parsed["machineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "machineName", input) } - if id.GuestConfigurationAssignmentName, ok = parsed.Parsed["guestConfigurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", *parsed) + if id.GuestConfigurationAssignmentName, ok = input.Parsed["guestConfigurationAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", input) } - return &id, nil + return nil } // ValidateGuestConfigurationAssignmentID checks that 'input' can be parsed as a Guest Configuration Assignment ID diff --git a/resource-manager/guestconfiguration/2020-06-25/guestconfigurationhcrpassignments/id_machine.go b/resource-manager/guestconfiguration/2020-06-25/guestconfigurationhcrpassignments/id_machine.go index 89333da5762..3a69f517f74 100644 --- a/resource-manager/guestconfiguration/2020-06-25/guestconfigurationhcrpassignments/id_machine.go +++ b/resource-manager/guestconfiguration/2020-06-25/guestconfigurationhcrpassignments/id_machine.go @@ -36,19 +36,9 @@ func ParseMachineID(input string) (*MachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MachineId{} - - 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.MachineName, ok = parsed.Parsed["machineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMachineIDInsensitively(input string) (*MachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MachineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MachineName, ok = parsed.Parsed["machineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machineName", *parsed) + if id.MachineName, ok = input.Parsed["machineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "machineName", input) } - return &id, nil + return nil } // ValidateMachineID checks that 'input' can be parsed as a Machine ID diff --git a/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignmenthcrpreports/id_guestconfigurationassignmentreport.go b/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignmenthcrpreports/id_guestconfigurationassignmentreport.go index 59190938d44..4ac419d7cd9 100644 --- a/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignmenthcrpreports/id_guestconfigurationassignmentreport.go +++ b/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignmenthcrpreports/id_guestconfigurationassignmentreport.go @@ -40,27 +40,9 @@ func ParseGuestConfigurationAssignmentReportID(input string) (*GuestConfiguratio return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GuestConfigurationAssignmentReportId{} - - 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.MachineName, ok = parsed.Parsed["machineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machineName", *parsed) - } - - if id.GuestConfigurationAssignmentName, ok = parsed.Parsed["guestConfigurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", *parsed) - } - - if id.ReportId, ok = parsed.Parsed["reportId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reportId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseGuestConfigurationAssignmentReportIDInsensitively(input string) (*Gues return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GuestConfigurationAssignmentReportId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *GuestConfigurationAssignmentReportId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MachineName, ok = parsed.Parsed["machineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machineName", *parsed) + if id.MachineName, ok = input.Parsed["machineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "machineName", input) } - if id.GuestConfigurationAssignmentName, ok = parsed.Parsed["guestConfigurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", *parsed) + if id.GuestConfigurationAssignmentName, ok = input.Parsed["guestConfigurationAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", input) } - if id.ReportId, ok = parsed.Parsed["reportId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reportId", *parsed) + if id.ReportId, ok = input.Parsed["reportId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reportId", input) } - return &id, nil + return nil } // ValidateGuestConfigurationAssignmentReportID checks that 'input' can be parsed as a Guest Configuration Assignment Report ID diff --git a/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignmenthcrpreports/id_providers2guestconfigurationassignment.go b/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignmenthcrpreports/id_providers2guestconfigurationassignment.go index a1b3e93c652..8cc36be0a15 100644 --- a/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignmenthcrpreports/id_providers2guestconfigurationassignment.go +++ b/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignmenthcrpreports/id_providers2guestconfigurationassignment.go @@ -38,23 +38,9 @@ func ParseProviders2GuestConfigurationAssignmentID(input string) (*Providers2Gue return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2GuestConfigurationAssignmentId{} - - 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.MachineName, ok = parsed.Parsed["machineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machineName", *parsed) - } - - if id.GuestConfigurationAssignmentName, ok = parsed.Parsed["guestConfigurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProviders2GuestConfigurationAssignmentIDInsensitively(input string) (* return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2GuestConfigurationAssignmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *Providers2GuestConfigurationAssignmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MachineName, ok = parsed.Parsed["machineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machineName", *parsed) + if id.MachineName, ok = input.Parsed["machineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "machineName", input) } - if id.GuestConfigurationAssignmentName, ok = parsed.Parsed["guestConfigurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", *parsed) + if id.GuestConfigurationAssignmentName, ok = input.Parsed["guestConfigurationAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", input) } - return &id, nil + return nil } // ValidateProviders2GuestConfigurationAssignmentID checks that 'input' can be parsed as a Providers 2 Guest Configuration Assignment ID diff --git a/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignmentreports/id_guestconfigurationassignment.go b/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignmentreports/id_guestconfigurationassignment.go index 0b95cd51fcc..b890493d174 100644 --- a/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignmentreports/id_guestconfigurationassignment.go +++ b/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignmentreports/id_guestconfigurationassignment.go @@ -38,23 +38,9 @@ func ParseGuestConfigurationAssignmentID(input string) (*GuestConfigurationAssig return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GuestConfigurationAssignmentId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) - } - - if id.GuestConfigurationAssignmentName, ok = parsed.Parsed["guestConfigurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGuestConfigurationAssignmentIDInsensitively(input string) (*GuestConfi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GuestConfigurationAssignmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GuestConfigurationAssignmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - if id.GuestConfigurationAssignmentName, ok = parsed.Parsed["guestConfigurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", *parsed) + if id.GuestConfigurationAssignmentName, ok = input.Parsed["guestConfigurationAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", input) } - return &id, nil + return nil } // ValidateGuestConfigurationAssignmentID checks that 'input' can be parsed as a Guest Configuration Assignment ID diff --git a/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignmentreports/id_providers2guestconfigurationassignmentreport.go b/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignmentreports/id_providers2guestconfigurationassignmentreport.go index 10bf809f38b..c3c1d15dfb6 100644 --- a/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignmentreports/id_providers2guestconfigurationassignmentreport.go +++ b/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignmentreports/id_providers2guestconfigurationassignmentreport.go @@ -40,27 +40,9 @@ func ParseProviders2GuestConfigurationAssignmentReportID(input string) (*Provide return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2GuestConfigurationAssignmentReportId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) - } - - if id.GuestConfigurationAssignmentName, ok = parsed.Parsed["guestConfigurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", *parsed) - } - - if id.ReportId, ok = parsed.Parsed["reportId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reportId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseProviders2GuestConfigurationAssignmentReportIDInsensitively(input stri return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2GuestConfigurationAssignmentReportId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *Providers2GuestConfigurationAssignmentReportId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - if id.GuestConfigurationAssignmentName, ok = parsed.Parsed["guestConfigurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", *parsed) + if id.GuestConfigurationAssignmentName, ok = input.Parsed["guestConfigurationAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", input) } - if id.ReportId, ok = parsed.Parsed["reportId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reportId", *parsed) + if id.ReportId, ok = input.Parsed["reportId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reportId", input) } - return &id, nil + return nil } // ValidateProviders2GuestConfigurationAssignmentReportID checks that 'input' can be parsed as a Providers 2 Guest Configuration Assignment Report ID diff --git a/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignmentreports/id_report.go b/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignmentreports/id_report.go index 3260918d064..03e6321b96c 100644 --- a/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignmentreports/id_report.go +++ b/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignmentreports/id_report.go @@ -40,27 +40,9 @@ func ParseReportID(input string) (*ReportId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReportId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) - } - - if id.GuestConfigurationAssignmentName, ok = parsed.Parsed["guestConfigurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", *parsed) - } - - if id.ReportName, ok = parsed.Parsed["reportName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reportName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReportIDInsensitively(input string) (*ReportId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReportId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReportId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - if id.GuestConfigurationAssignmentName, ok = parsed.Parsed["guestConfigurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", *parsed) + if id.GuestConfigurationAssignmentName, ok = input.Parsed["guestConfigurationAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", input) } - if id.ReportName, ok = parsed.Parsed["reportName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reportName", *parsed) + if id.ReportName, ok = input.Parsed["reportName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reportName", input) } - return &id, nil + return nil } // ValidateReportID checks that 'input' can be parsed as a Report ID diff --git a/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignmentreports/id_virtualmachineproviders2guestconfigurationassignment.go b/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignmentreports/id_virtualmachineproviders2guestconfigurationassignment.go index 304689bff7e..523e9c4d7c3 100644 --- a/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignmentreports/id_virtualmachineproviders2guestconfigurationassignment.go +++ b/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignmentreports/id_virtualmachineproviders2guestconfigurationassignment.go @@ -38,23 +38,9 @@ func ParseVirtualMachineProviders2GuestConfigurationAssignmentID(input string) ( return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineProviders2GuestConfigurationAssignmentId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) - } - - if id.GuestConfigurationAssignmentName, ok = parsed.Parsed["guestConfigurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualMachineProviders2GuestConfigurationAssignmentIDInsensitively(in return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineProviders2GuestConfigurationAssignmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineProviders2GuestConfigurationAssignmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - if id.GuestConfigurationAssignmentName, ok = parsed.Parsed["guestConfigurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", *parsed) + if id.GuestConfigurationAssignmentName, ok = input.Parsed["guestConfigurationAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", input) } - return &id, nil + return nil } // ValidateVirtualMachineProviders2GuestConfigurationAssignmentID checks that 'input' can be parsed as a Virtual Machine Providers 2 Guest Configuration Assignment ID diff --git a/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignments/id_guestconfigurationassignment.go b/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignments/id_guestconfigurationassignment.go index 8f4da176d3b..fa3a3535563 100644 --- a/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignments/id_guestconfigurationassignment.go +++ b/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignments/id_guestconfigurationassignment.go @@ -38,23 +38,9 @@ func ParseGuestConfigurationAssignmentID(input string) (*GuestConfigurationAssig return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GuestConfigurationAssignmentId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) - } - - if id.GuestConfigurationAssignmentName, ok = parsed.Parsed["guestConfigurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGuestConfigurationAssignmentIDInsensitively(input string) (*GuestConfi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GuestConfigurationAssignmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GuestConfigurationAssignmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - if id.GuestConfigurationAssignmentName, ok = parsed.Parsed["guestConfigurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", *parsed) + if id.GuestConfigurationAssignmentName, ok = input.Parsed["guestConfigurationAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", input) } - return &id, nil + return nil } // ValidateGuestConfigurationAssignmentID checks that 'input' can be parsed as a Guest Configuration Assignment ID diff --git a/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignments/id_virtualmachine.go b/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignments/id_virtualmachine.go index 22608a73d06..cc55c092b18 100644 --- a/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignments/id_virtualmachine.go +++ b/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignments/id_virtualmachine.go @@ -36,19 +36,9 @@ func ParseVirtualMachineID(input string) (*VirtualMachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineIDInsensitively(input string) (*VirtualMachineId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - return &id, nil + return nil } // ValidateVirtualMachineID checks that 'input' can be parsed as a Virtual Machine ID diff --git a/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignments/id_virtualmachineproviders2guestconfigurationassignment.go b/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignments/id_virtualmachineproviders2guestconfigurationassignment.go index 9d4c0645030..541a426b8dd 100644 --- a/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignments/id_virtualmachineproviders2guestconfigurationassignment.go +++ b/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignments/id_virtualmachineproviders2guestconfigurationassignment.go @@ -38,23 +38,9 @@ func ParseVirtualMachineProviders2GuestConfigurationAssignmentID(input string) ( return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineProviders2GuestConfigurationAssignmentId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) - } - - if id.GuestConfigurationAssignmentName, ok = parsed.Parsed["guestConfigurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualMachineProviders2GuestConfigurationAssignmentIDInsensitively(in return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineProviders2GuestConfigurationAssignmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineProviders2GuestConfigurationAssignmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - if id.GuestConfigurationAssignmentName, ok = parsed.Parsed["guestConfigurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", *parsed) + if id.GuestConfigurationAssignmentName, ok = input.Parsed["guestConfigurationAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", input) } - return &id, nil + return nil } // ValidateVirtualMachineProviders2GuestConfigurationAssignmentID checks that 'input' can be parsed as a Virtual Machine Providers 2 Guest Configuration Assignment ID diff --git a/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignments/id_virtualmachinescaleset.go b/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignments/id_virtualmachinescaleset.go index 2cd89d2992f..b0db37879b1 100644 --- a/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignments/id_virtualmachinescaleset.go +++ b/resource-manager/guestconfiguration/2022-01-25/guestconfigurationassignments/id_virtualmachinescaleset.go @@ -36,19 +36,9 @@ func ParseVirtualMachineScaleSetID(input string) (*VirtualMachineScaleSetId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineScaleSetIDInsensitively(input string) (*VirtualMachineSc return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineScaleSetId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - return &id, nil + return nil } // ValidateVirtualMachineScaleSetID checks that 'input' can be parsed as a Virtual Machine Scale Set ID diff --git a/resource-manager/guestconfiguration/2022-01-25/guestconfigurationconnectedvmwarevsphereassignments/id_providervirtualmachine.go b/resource-manager/guestconfiguration/2022-01-25/guestconfigurationconnectedvmwarevsphereassignments/id_providervirtualmachine.go index 5d327ec15b3..b5354d2e8fb 100644 --- a/resource-manager/guestconfiguration/2022-01-25/guestconfigurationconnectedvmwarevsphereassignments/id_providervirtualmachine.go +++ b/resource-manager/guestconfiguration/2022-01-25/guestconfigurationconnectedvmwarevsphereassignments/id_providervirtualmachine.go @@ -36,19 +36,9 @@ func ParseProviderVirtualMachineID(input string) (*ProviderVirtualMachineId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderVirtualMachineId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderVirtualMachineIDInsensitively(input string) (*ProviderVirtualM return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderVirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderVirtualMachineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - return &id, nil + return nil } // ValidateProviderVirtualMachineID checks that 'input' can be parsed as a Provider Virtual Machine ID diff --git a/resource-manager/guestconfiguration/2022-01-25/guestconfigurationconnectedvmwarevsphereassignments/id_providervirtualmachineproviders2guestconfigurationassignment.go b/resource-manager/guestconfiguration/2022-01-25/guestconfigurationconnectedvmwarevsphereassignments/id_providervirtualmachineproviders2guestconfigurationassignment.go index d2f3de43b0c..c6931cc05ea 100644 --- a/resource-manager/guestconfiguration/2022-01-25/guestconfigurationconnectedvmwarevsphereassignments/id_providervirtualmachineproviders2guestconfigurationassignment.go +++ b/resource-manager/guestconfiguration/2022-01-25/guestconfigurationconnectedvmwarevsphereassignments/id_providervirtualmachineproviders2guestconfigurationassignment.go @@ -38,23 +38,9 @@ func ParseProviderVirtualMachineProviders2GuestConfigurationAssignmentID(input s return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderVirtualMachineProviders2GuestConfigurationAssignmentId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) - } - - if id.GuestConfigurationAssignmentName, ok = parsed.Parsed["guestConfigurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProviderVirtualMachineProviders2GuestConfigurationAssignmentIDInsensit return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderVirtualMachineProviders2GuestConfigurationAssignmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProviderVirtualMachineProviders2GuestConfigurationAssignmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - if id.GuestConfigurationAssignmentName, ok = parsed.Parsed["guestConfigurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", *parsed) + if id.GuestConfigurationAssignmentName, ok = input.Parsed["guestConfigurationAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", input) } - return &id, nil + return nil } // ValidateProviderVirtualMachineProviders2GuestConfigurationAssignmentID checks that 'input' can be parsed as a Provider Virtual Machine Providers 2 Guest Configuration Assignment ID diff --git a/resource-manager/guestconfiguration/2022-01-25/guestconfigurationconnectedvmwarevsphereassignmentsreports/id_providervirtualmachineproviders2guestconfigurationassignment.go b/resource-manager/guestconfiguration/2022-01-25/guestconfigurationconnectedvmwarevsphereassignmentsreports/id_providervirtualmachineproviders2guestconfigurationassignment.go index 15992c7a253..fef2671ab49 100644 --- a/resource-manager/guestconfiguration/2022-01-25/guestconfigurationconnectedvmwarevsphereassignmentsreports/id_providervirtualmachineproviders2guestconfigurationassignment.go +++ b/resource-manager/guestconfiguration/2022-01-25/guestconfigurationconnectedvmwarevsphereassignmentsreports/id_providervirtualmachineproviders2guestconfigurationassignment.go @@ -38,23 +38,9 @@ func ParseProviderVirtualMachineProviders2GuestConfigurationAssignmentID(input s return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderVirtualMachineProviders2GuestConfigurationAssignmentId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) - } - - if id.GuestConfigurationAssignmentName, ok = parsed.Parsed["guestConfigurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProviderVirtualMachineProviders2GuestConfigurationAssignmentIDInsensit return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderVirtualMachineProviders2GuestConfigurationAssignmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProviderVirtualMachineProviders2GuestConfigurationAssignmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - if id.GuestConfigurationAssignmentName, ok = parsed.Parsed["guestConfigurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", *parsed) + if id.GuestConfigurationAssignmentName, ok = input.Parsed["guestConfigurationAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", input) } - return &id, nil + return nil } // ValidateProviderVirtualMachineProviders2GuestConfigurationAssignmentID checks that 'input' can be parsed as a Provider Virtual Machine Providers 2 Guest Configuration Assignment ID diff --git a/resource-manager/guestconfiguration/2022-01-25/guestconfigurationconnectedvmwarevsphereassignmentsreports/id_virtualmachineproviders2guestconfigurationassignmentreport.go b/resource-manager/guestconfiguration/2022-01-25/guestconfigurationconnectedvmwarevsphereassignmentsreports/id_virtualmachineproviders2guestconfigurationassignmentreport.go index 36fd4d7d853..26b113a8799 100644 --- a/resource-manager/guestconfiguration/2022-01-25/guestconfigurationconnectedvmwarevsphereassignmentsreports/id_virtualmachineproviders2guestconfigurationassignmentreport.go +++ b/resource-manager/guestconfiguration/2022-01-25/guestconfigurationconnectedvmwarevsphereassignmentsreports/id_virtualmachineproviders2guestconfigurationassignmentreport.go @@ -40,27 +40,9 @@ func ParseVirtualMachineProviders2GuestConfigurationAssignmentReportID(input str return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineProviders2GuestConfigurationAssignmentReportId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) - } - - if id.GuestConfigurationAssignmentName, ok = parsed.Parsed["guestConfigurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", *parsed) - } - - if id.ReportId, ok = parsed.Parsed["reportId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reportId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVirtualMachineProviders2GuestConfigurationAssignmentReportIDInsensitiv return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineProviders2GuestConfigurationAssignmentReportId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VirtualMachineProviders2GuestConfigurationAssignmentReportId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - if id.GuestConfigurationAssignmentName, ok = parsed.Parsed["guestConfigurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", *parsed) + if id.GuestConfigurationAssignmentName, ok = input.Parsed["guestConfigurationAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", input) } - if id.ReportId, ok = parsed.Parsed["reportId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "reportId", *parsed) + if id.ReportId, ok = input.Parsed["reportId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "reportId", input) } - return &id, nil + return nil } // ValidateVirtualMachineProviders2GuestConfigurationAssignmentReportID checks that 'input' can be parsed as a Virtual Machine Providers 2 Guest Configuration Assignment Report ID diff --git a/resource-manager/guestconfiguration/2022-01-25/guestconfigurationhcrpassignments/id_machine.go b/resource-manager/guestconfiguration/2022-01-25/guestconfigurationhcrpassignments/id_machine.go index 89333da5762..3a69f517f74 100644 --- a/resource-manager/guestconfiguration/2022-01-25/guestconfigurationhcrpassignments/id_machine.go +++ b/resource-manager/guestconfiguration/2022-01-25/guestconfigurationhcrpassignments/id_machine.go @@ -36,19 +36,9 @@ func ParseMachineID(input string) (*MachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MachineId{} - - 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.MachineName, ok = parsed.Parsed["machineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMachineIDInsensitively(input string) (*MachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MachineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MachineName, ok = parsed.Parsed["machineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machineName", *parsed) + if id.MachineName, ok = input.Parsed["machineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "machineName", input) } - return &id, nil + return nil } // ValidateMachineID checks that 'input' can be parsed as a Machine ID diff --git a/resource-manager/guestconfiguration/2022-01-25/guestconfigurationhcrpassignments/id_providers2guestconfigurationassignment.go b/resource-manager/guestconfiguration/2022-01-25/guestconfigurationhcrpassignments/id_providers2guestconfigurationassignment.go index aa4c2ca99b2..e4f3509f285 100644 --- a/resource-manager/guestconfiguration/2022-01-25/guestconfigurationhcrpassignments/id_providers2guestconfigurationassignment.go +++ b/resource-manager/guestconfiguration/2022-01-25/guestconfigurationhcrpassignments/id_providers2guestconfigurationassignment.go @@ -38,23 +38,9 @@ func ParseProviders2GuestConfigurationAssignmentID(input string) (*Providers2Gue return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2GuestConfigurationAssignmentId{} - - 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.MachineName, ok = parsed.Parsed["machineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machineName", *parsed) - } - - if id.GuestConfigurationAssignmentName, ok = parsed.Parsed["guestConfigurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProviders2GuestConfigurationAssignmentIDInsensitively(input string) (* return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2GuestConfigurationAssignmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *Providers2GuestConfigurationAssignmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MachineName, ok = parsed.Parsed["machineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machineName", *parsed) + if id.MachineName, ok = input.Parsed["machineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "machineName", input) } - if id.GuestConfigurationAssignmentName, ok = parsed.Parsed["guestConfigurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", *parsed) + if id.GuestConfigurationAssignmentName, ok = input.Parsed["guestConfigurationAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", input) } - return &id, nil + return nil } // ValidateProviders2GuestConfigurationAssignmentID checks that 'input' can be parsed as a Providers 2 Guest Configuration Assignment ID diff --git a/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/id_dedicatedhsm.go b/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/id_dedicatedhsm.go index ef15c9327fc..dc1f1a9f072 100644 --- a/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/id_dedicatedhsm.go +++ b/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms/id_dedicatedhsm.go @@ -36,19 +36,9 @@ func ParseDedicatedHSMID(input string) (*DedicatedHSMId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DedicatedHSMId{} - - 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.DedicatedHSMName, ok = parsed.Parsed["dedicatedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dedicatedHSMName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDedicatedHSMIDInsensitively(input string) (*DedicatedHSMId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DedicatedHSMId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DedicatedHSMId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DedicatedHSMName, ok = parsed.Parsed["dedicatedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dedicatedHSMName", *parsed) + if id.DedicatedHSMName, ok = input.Parsed["dedicatedHSMName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dedicatedHSMName", input) } - return &id, nil + return nil } // ValidateDedicatedHSMID checks that 'input' can be parsed as a Dedicated H S M ID diff --git a/resource-manager/hdinsight/2018-06-01-preview/applications/id_application.go b/resource-manager/hdinsight/2018-06-01-preview/applications/id_application.go index 02d02f0e0b4..772ed0d0715 100644 --- a/resource-manager/hdinsight/2018-06-01-preview/applications/id_application.go +++ b/resource-manager/hdinsight/2018-06-01-preview/applications/id_application.go @@ -38,23 +38,9 @@ func ParseApplicationID(input string) (*ApplicationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApplicationIDInsensitively(input string) (*ApplicationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApplicationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) + if id.ApplicationName, ok = input.Parsed["applicationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationName", input) } - return &id, nil + return nil } // ValidateApplicationID checks that 'input' can be parsed as a Application ID diff --git a/resource-manager/hdinsight/2018-06-01-preview/applications/id_cluster.go b/resource-manager/hdinsight/2018-06-01-preview/applications/id_cluster.go index 37d96e7d995..3764270d9c4 100644 --- a/resource-manager/hdinsight/2018-06-01-preview/applications/id_cluster.go +++ b/resource-manager/hdinsight/2018-06-01-preview/applications/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/hdinsight/2018-06-01-preview/clusters/id_cluster.go b/resource-manager/hdinsight/2018-06-01-preview/clusters/id_cluster.go index 5bc8b0175be..53e8fc150bf 100644 --- a/resource-manager/hdinsight/2018-06-01-preview/clusters/id_cluster.go +++ b/resource-manager/hdinsight/2018-06-01-preview/clusters/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/hdinsight/2018-06-01-preview/configurations/id_cluster.go b/resource-manager/hdinsight/2018-06-01-preview/configurations/id_cluster.go index e120e387d65..03a85463540 100644 --- a/resource-manager/hdinsight/2018-06-01-preview/configurations/id_cluster.go +++ b/resource-manager/hdinsight/2018-06-01-preview/configurations/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/hdinsight/2018-06-01-preview/configurations/id_configuration.go b/resource-manager/hdinsight/2018-06-01-preview/configurations/id_configuration.go index ed96c808066..a24c4e5b823 100644 --- a/resource-manager/hdinsight/2018-06-01-preview/configurations/id_configuration.go +++ b/resource-manager/hdinsight/2018-06-01-preview/configurations/id_configuration.go @@ -38,23 +38,9 @@ func ParseConfigurationID(input string) (*ConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConfigurationIDInsensitively(input string) (*ConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationName", *parsed) + if id.ConfigurationName, ok = input.Parsed["configurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationName", input) } - return &id, nil + return nil } // ValidateConfigurationID checks that 'input' can be parsed as a Configuration ID diff --git a/resource-manager/hdinsight/2018-06-01-preview/extensions/id_cluster.go b/resource-manager/hdinsight/2018-06-01-preview/extensions/id_cluster.go index fad40d55fca..4dbafe84744 100644 --- a/resource-manager/hdinsight/2018-06-01-preview/extensions/id_cluster.go +++ b/resource-manager/hdinsight/2018-06-01-preview/extensions/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/hdinsight/2018-06-01-preview/extensions/id_extension.go b/resource-manager/hdinsight/2018-06-01-preview/extensions/id_extension.go index 8ea6ecf5023..53835a0e565 100644 --- a/resource-manager/hdinsight/2018-06-01-preview/extensions/id_extension.go +++ b/resource-manager/hdinsight/2018-06-01-preview/extensions/id_extension.go @@ -38,23 +38,9 @@ func ParseExtensionID(input string) (*ExtensionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExtensionId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseExtensionIDInsensitively(input string) (*ExtensionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExtensionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ExtensionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if id.ExtensionName, ok = input.Parsed["extensionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "extensionName", input) } - return &id, nil + return nil } // ValidateExtensionID checks that 'input' can be parsed as a Extension ID diff --git a/resource-manager/hdinsight/2018-06-01-preview/promote/id_scriptexecutionhistory.go b/resource-manager/hdinsight/2018-06-01-preview/promote/id_scriptexecutionhistory.go index d5135b53e34..e18e2031fbe 100644 --- a/resource-manager/hdinsight/2018-06-01-preview/promote/id_scriptexecutionhistory.go +++ b/resource-manager/hdinsight/2018-06-01-preview/promote/id_scriptexecutionhistory.go @@ -38,23 +38,9 @@ func ParseScriptExecutionHistoryID(input string) (*ScriptExecutionHistoryId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScriptExecutionHistoryId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.ScriptExecutionId, ok = parsed.Parsed["scriptExecutionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scriptExecutionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseScriptExecutionHistoryIDInsensitively(input string) (*ScriptExecutionH return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScriptExecutionHistoryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ScriptExecutionHistoryId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.ScriptExecutionId, ok = parsed.Parsed["scriptExecutionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scriptExecutionId", *parsed) + if id.ScriptExecutionId, ok = input.Parsed["scriptExecutionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scriptExecutionId", input) } - return &id, nil + return nil } // ValidateScriptExecutionHistoryID checks that 'input' can be parsed as a Script Execution History ID diff --git a/resource-manager/hdinsight/2018-06-01-preview/regions/id_location.go b/resource-manager/hdinsight/2018-06-01-preview/regions/id_location.go index 4787a4b6fc7..860a8d5fbd3 100644 --- a/resource-manager/hdinsight/2018-06-01-preview/regions/id_location.go +++ b/resource-manager/hdinsight/2018-06-01-preview/regions/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/hdinsight/2018-06-01-preview/scriptactions/id_cluster.go b/resource-manager/hdinsight/2018-06-01-preview/scriptactions/id_cluster.go index 4f249ae429a..e19c3afa1fd 100644 --- a/resource-manager/hdinsight/2018-06-01-preview/scriptactions/id_cluster.go +++ b/resource-manager/hdinsight/2018-06-01-preview/scriptactions/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/hdinsight/2018-06-01-preview/scriptactions/id_scriptaction.go b/resource-manager/hdinsight/2018-06-01-preview/scriptactions/id_scriptaction.go index d633c0f7926..c6417e7b984 100644 --- a/resource-manager/hdinsight/2018-06-01-preview/scriptactions/id_scriptaction.go +++ b/resource-manager/hdinsight/2018-06-01-preview/scriptactions/id_scriptaction.go @@ -38,23 +38,9 @@ func ParseScriptActionID(input string) (*ScriptActionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScriptActionId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.ScriptActionName, ok = parsed.Parsed["scriptActionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scriptActionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseScriptActionIDInsensitively(input string) (*ScriptActionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScriptActionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ScriptActionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.ScriptActionName, ok = parsed.Parsed["scriptActionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scriptActionName", *parsed) + if id.ScriptActionName, ok = input.Parsed["scriptActionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scriptActionName", input) } - return &id, nil + return nil } // ValidateScriptActionID checks that 'input' can be parsed as a Script Action ID diff --git a/resource-manager/hdinsight/2018-06-01-preview/scriptexecutionhistory/id_cluster.go b/resource-manager/hdinsight/2018-06-01-preview/scriptexecutionhistory/id_cluster.go index a7c2738348c..8177299109a 100644 --- a/resource-manager/hdinsight/2018-06-01-preview/scriptexecutionhistory/id_cluster.go +++ b/resource-manager/hdinsight/2018-06-01-preview/scriptexecutionhistory/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/hdinsight/2018-06-01-preview/scriptexecutionhistory/id_scriptexecutionhistory.go b/resource-manager/hdinsight/2018-06-01-preview/scriptexecutionhistory/id_scriptexecutionhistory.go index 70cfc02dc7e..db77211db5b 100644 --- a/resource-manager/hdinsight/2018-06-01-preview/scriptexecutionhistory/id_scriptexecutionhistory.go +++ b/resource-manager/hdinsight/2018-06-01-preview/scriptexecutionhistory/id_scriptexecutionhistory.go @@ -38,23 +38,9 @@ func ParseScriptExecutionHistoryID(input string) (*ScriptExecutionHistoryId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScriptExecutionHistoryId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.ScriptExecutionId, ok = parsed.Parsed["scriptExecutionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scriptExecutionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseScriptExecutionHistoryIDInsensitively(input string) (*ScriptExecutionH return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScriptExecutionHistoryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ScriptExecutionHistoryId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.ScriptExecutionId, ok = parsed.Parsed["scriptExecutionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scriptExecutionId", *parsed) + if id.ScriptExecutionId, ok = input.Parsed["scriptExecutionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scriptExecutionId", input) } - return &id, nil + return nil } // ValidateScriptExecutionHistoryID checks that 'input' can be parsed as a Script Execution History ID diff --git a/resource-manager/hdinsight/2018-06-01-preview/virtualmachines/id_cluster.go b/resource-manager/hdinsight/2018-06-01-preview/virtualmachines/id_cluster.go index 2a893f66e9b..948795b6ee5 100644 --- a/resource-manager/hdinsight/2018-06-01-preview/virtualmachines/id_cluster.go +++ b/resource-manager/hdinsight/2018-06-01-preview/virtualmachines/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/hdinsight/2021-06-01/applications/id_application.go b/resource-manager/hdinsight/2021-06-01/applications/id_application.go index 02d02f0e0b4..772ed0d0715 100644 --- a/resource-manager/hdinsight/2021-06-01/applications/id_application.go +++ b/resource-manager/hdinsight/2021-06-01/applications/id_application.go @@ -38,23 +38,9 @@ func ParseApplicationID(input string) (*ApplicationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApplicationIDInsensitively(input string) (*ApplicationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApplicationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) + if id.ApplicationName, ok = input.Parsed["applicationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationName", input) } - return &id, nil + return nil } // ValidateApplicationID checks that 'input' can be parsed as a Application ID diff --git a/resource-manager/hdinsight/2021-06-01/applications/id_cluster.go b/resource-manager/hdinsight/2021-06-01/applications/id_cluster.go index 37d96e7d995..3764270d9c4 100644 --- a/resource-manager/hdinsight/2021-06-01/applications/id_cluster.go +++ b/resource-manager/hdinsight/2021-06-01/applications/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/hdinsight/2021-06-01/clusters/id_cluster.go b/resource-manager/hdinsight/2021-06-01/clusters/id_cluster.go index 5bc8b0175be..53e8fc150bf 100644 --- a/resource-manager/hdinsight/2021-06-01/clusters/id_cluster.go +++ b/resource-manager/hdinsight/2021-06-01/clusters/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/hdinsight/2021-06-01/configurations/id_cluster.go b/resource-manager/hdinsight/2021-06-01/configurations/id_cluster.go index e120e387d65..03a85463540 100644 --- a/resource-manager/hdinsight/2021-06-01/configurations/id_cluster.go +++ b/resource-manager/hdinsight/2021-06-01/configurations/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/hdinsight/2021-06-01/configurations/id_configuration.go b/resource-manager/hdinsight/2021-06-01/configurations/id_configuration.go index ed96c808066..a24c4e5b823 100644 --- a/resource-manager/hdinsight/2021-06-01/configurations/id_configuration.go +++ b/resource-manager/hdinsight/2021-06-01/configurations/id_configuration.go @@ -38,23 +38,9 @@ func ParseConfigurationID(input string) (*ConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConfigurationIDInsensitively(input string) (*ConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationName", *parsed) + if id.ConfigurationName, ok = input.Parsed["configurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationName", input) } - return &id, nil + return nil } // ValidateConfigurationID checks that 'input' can be parsed as a Configuration ID diff --git a/resource-manager/hdinsight/2021-06-01/extensions/id_cluster.go b/resource-manager/hdinsight/2021-06-01/extensions/id_cluster.go index fad40d55fca..4dbafe84744 100644 --- a/resource-manager/hdinsight/2021-06-01/extensions/id_cluster.go +++ b/resource-manager/hdinsight/2021-06-01/extensions/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/hdinsight/2021-06-01/extensions/id_extension.go b/resource-manager/hdinsight/2021-06-01/extensions/id_extension.go index 8ea6ecf5023..53835a0e565 100644 --- a/resource-manager/hdinsight/2021-06-01/extensions/id_extension.go +++ b/resource-manager/hdinsight/2021-06-01/extensions/id_extension.go @@ -38,23 +38,9 @@ func ParseExtensionID(input string) (*ExtensionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExtensionId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseExtensionIDInsensitively(input string) (*ExtensionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExtensionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ExtensionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if id.ExtensionName, ok = input.Parsed["extensionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "extensionName", input) } - return &id, nil + return nil } // ValidateExtensionID checks that 'input' can be parsed as a Extension ID diff --git a/resource-manager/hdinsight/2021-06-01/privateendpointconnections/id_cluster.go b/resource-manager/hdinsight/2021-06-01/privateendpointconnections/id_cluster.go index 9e98796075d..3ff52bfa5fd 100644 --- a/resource-manager/hdinsight/2021-06-01/privateendpointconnections/id_cluster.go +++ b/resource-manager/hdinsight/2021-06-01/privateendpointconnections/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/hdinsight/2021-06-01/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/hdinsight/2021-06-01/privateendpointconnections/id_privateendpointconnection.go index 533288c6e47..f6852b6cf4c 100644 --- a/resource-manager/hdinsight/2021-06-01/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/hdinsight/2021-06-01/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/hdinsight/2021-06-01/privatelinkresources/id_cluster.go b/resource-manager/hdinsight/2021-06-01/privatelinkresources/id_cluster.go index a0d85888b6c..69cf09c49f2 100644 --- a/resource-manager/hdinsight/2021-06-01/privatelinkresources/id_cluster.go +++ b/resource-manager/hdinsight/2021-06-01/privatelinkresources/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/hdinsight/2021-06-01/privatelinkresources/id_privatelinkresource.go b/resource-manager/hdinsight/2021-06-01/privatelinkresources/id_privatelinkresource.go index fbb43ad04b0..b7a2bdaf8cf 100644 --- a/resource-manager/hdinsight/2021-06-01/privatelinkresources/id_privatelinkresource.go +++ b/resource-manager/hdinsight/2021-06-01/privatelinkresources/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/hdinsight/2021-06-01/promote/id_scriptexecutionhistory.go b/resource-manager/hdinsight/2021-06-01/promote/id_scriptexecutionhistory.go index d5135b53e34..e18e2031fbe 100644 --- a/resource-manager/hdinsight/2021-06-01/promote/id_scriptexecutionhistory.go +++ b/resource-manager/hdinsight/2021-06-01/promote/id_scriptexecutionhistory.go @@ -38,23 +38,9 @@ func ParseScriptExecutionHistoryID(input string) (*ScriptExecutionHistoryId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScriptExecutionHistoryId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.ScriptExecutionId, ok = parsed.Parsed["scriptExecutionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scriptExecutionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseScriptExecutionHistoryIDInsensitively(input string) (*ScriptExecutionH return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScriptExecutionHistoryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ScriptExecutionHistoryId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.ScriptExecutionId, ok = parsed.Parsed["scriptExecutionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scriptExecutionId", *parsed) + if id.ScriptExecutionId, ok = input.Parsed["scriptExecutionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scriptExecutionId", input) } - return &id, nil + return nil } // ValidateScriptExecutionHistoryID checks that 'input' can be parsed as a Script Execution History ID diff --git a/resource-manager/hdinsight/2021-06-01/regions/id_location.go b/resource-manager/hdinsight/2021-06-01/regions/id_location.go index 4787a4b6fc7..860a8d5fbd3 100644 --- a/resource-manager/hdinsight/2021-06-01/regions/id_location.go +++ b/resource-manager/hdinsight/2021-06-01/regions/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/hdinsight/2021-06-01/scriptactions/id_cluster.go b/resource-manager/hdinsight/2021-06-01/scriptactions/id_cluster.go index 4f249ae429a..e19c3afa1fd 100644 --- a/resource-manager/hdinsight/2021-06-01/scriptactions/id_cluster.go +++ b/resource-manager/hdinsight/2021-06-01/scriptactions/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/hdinsight/2021-06-01/scriptactions/id_scriptaction.go b/resource-manager/hdinsight/2021-06-01/scriptactions/id_scriptaction.go index d633c0f7926..c6417e7b984 100644 --- a/resource-manager/hdinsight/2021-06-01/scriptactions/id_scriptaction.go +++ b/resource-manager/hdinsight/2021-06-01/scriptactions/id_scriptaction.go @@ -38,23 +38,9 @@ func ParseScriptActionID(input string) (*ScriptActionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScriptActionId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.ScriptActionName, ok = parsed.Parsed["scriptActionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scriptActionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseScriptActionIDInsensitively(input string) (*ScriptActionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScriptActionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ScriptActionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.ScriptActionName, ok = parsed.Parsed["scriptActionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scriptActionName", *parsed) + if id.ScriptActionName, ok = input.Parsed["scriptActionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scriptActionName", input) } - return &id, nil + return nil } // ValidateScriptActionID checks that 'input' can be parsed as a Script Action ID diff --git a/resource-manager/hdinsight/2021-06-01/scriptexecutionhistory/id_cluster.go b/resource-manager/hdinsight/2021-06-01/scriptexecutionhistory/id_cluster.go index a7c2738348c..8177299109a 100644 --- a/resource-manager/hdinsight/2021-06-01/scriptexecutionhistory/id_cluster.go +++ b/resource-manager/hdinsight/2021-06-01/scriptexecutionhistory/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/hdinsight/2021-06-01/scriptexecutionhistory/id_scriptexecutionhistory.go b/resource-manager/hdinsight/2021-06-01/scriptexecutionhistory/id_scriptexecutionhistory.go index 70cfc02dc7e..db77211db5b 100644 --- a/resource-manager/hdinsight/2021-06-01/scriptexecutionhistory/id_scriptexecutionhistory.go +++ b/resource-manager/hdinsight/2021-06-01/scriptexecutionhistory/id_scriptexecutionhistory.go @@ -38,23 +38,9 @@ func ParseScriptExecutionHistoryID(input string) (*ScriptExecutionHistoryId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScriptExecutionHistoryId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.ScriptExecutionId, ok = parsed.Parsed["scriptExecutionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scriptExecutionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseScriptExecutionHistoryIDInsensitively(input string) (*ScriptExecutionH return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScriptExecutionHistoryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ScriptExecutionHistoryId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.ScriptExecutionId, ok = parsed.Parsed["scriptExecutionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scriptExecutionId", *parsed) + if id.ScriptExecutionId, ok = input.Parsed["scriptExecutionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scriptExecutionId", input) } - return &id, nil + return nil } // ValidateScriptExecutionHistoryID checks that 'input' can be parsed as a Script Execution History ID diff --git a/resource-manager/hdinsight/2021-06-01/virtualmachines/id_cluster.go b/resource-manager/hdinsight/2021-06-01/virtualmachines/id_cluster.go index 2a893f66e9b..948795b6ee5 100644 --- a/resource-manager/hdinsight/2021-06-01/virtualmachines/id_cluster.go +++ b/resource-manager/hdinsight/2021-06-01/virtualmachines/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/healthbot/2022-08-08/healthbots/id_healthbot.go b/resource-manager/healthbot/2022-08-08/healthbots/id_healthbot.go index 4360367f2a2..ee10c921868 100644 --- a/resource-manager/healthbot/2022-08-08/healthbots/id_healthbot.go +++ b/resource-manager/healthbot/2022-08-08/healthbots/id_healthbot.go @@ -36,19 +36,9 @@ func ParseHealthBotID(input string) (*HealthBotId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HealthBotId{} - - 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.HealthBotName, ok = parsed.Parsed["healthBotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "healthBotName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseHealthBotIDInsensitively(input string) (*HealthBotId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HealthBotId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *HealthBotId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HealthBotName, ok = parsed.Parsed["healthBotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "healthBotName", *parsed) + if id.HealthBotName, ok = input.Parsed["healthBotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "healthBotName", input) } - return &id, nil + return nil } // ValidateHealthBotID checks that 'input' can be parsed as a Health Bot ID diff --git a/resource-manager/healthbot/2023-05-01/healthbots/id_healthbot.go b/resource-manager/healthbot/2023-05-01/healthbots/id_healthbot.go index 4360367f2a2..ee10c921868 100644 --- a/resource-manager/healthbot/2023-05-01/healthbots/id_healthbot.go +++ b/resource-manager/healthbot/2023-05-01/healthbots/id_healthbot.go @@ -36,19 +36,9 @@ func ParseHealthBotID(input string) (*HealthBotId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HealthBotId{} - - 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.HealthBotName, ok = parsed.Parsed["healthBotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "healthBotName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseHealthBotIDInsensitively(input string) (*HealthBotId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HealthBotId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *HealthBotId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HealthBotName, ok = parsed.Parsed["healthBotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "healthBotName", *parsed) + if id.HealthBotName, ok = input.Parsed["healthBotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "healthBotName", input) } - return &id, nil + return nil } // ValidateHealthBotID checks that 'input' can be parsed as a Health Bot ID diff --git a/resource-manager/healthcareapis/2022-12-01/dicomservices/id_dicomservice.go b/resource-manager/healthcareapis/2022-12-01/dicomservices/id_dicomservice.go index 3f7ddb9b049..4e8cc3aef4f 100644 --- a/resource-manager/healthcareapis/2022-12-01/dicomservices/id_dicomservice.go +++ b/resource-manager/healthcareapis/2022-12-01/dicomservices/id_dicomservice.go @@ -38,23 +38,9 @@ func ParseDicomServiceID(input string) (*DicomServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DicomServiceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.DicomServiceName, ok = parsed.Parsed["dicomServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dicomServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDicomServiceIDInsensitively(input string) (*DicomServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DicomServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DicomServiceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.DicomServiceName, ok = parsed.Parsed["dicomServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dicomServiceName", *parsed) + if id.DicomServiceName, ok = input.Parsed["dicomServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dicomServiceName", input) } - return &id, nil + return nil } // ValidateDicomServiceID checks that 'input' can be parsed as a Dicom Service ID diff --git a/resource-manager/healthcareapis/2022-12-01/dicomservices/id_workspace.go b/resource-manager/healthcareapis/2022-12-01/dicomservices/id_workspace.go index 82bd996d34f..818b0450e92 100644 --- a/resource-manager/healthcareapis/2022-12-01/dicomservices/id_workspace.go +++ b/resource-manager/healthcareapis/2022-12-01/dicomservices/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/healthcareapis/2022-12-01/fhirservices/id_fhirservice.go b/resource-manager/healthcareapis/2022-12-01/fhirservices/id_fhirservice.go index 113cb4a507a..7641b0cecfb 100644 --- a/resource-manager/healthcareapis/2022-12-01/fhirservices/id_fhirservice.go +++ b/resource-manager/healthcareapis/2022-12-01/fhirservices/id_fhirservice.go @@ -38,23 +38,9 @@ func ParseFhirServiceID(input string) (*FhirServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FhirServiceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.FhirServiceName, ok = parsed.Parsed["fhirServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fhirServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFhirServiceIDInsensitively(input string) (*FhirServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FhirServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FhirServiceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.FhirServiceName, ok = parsed.Parsed["fhirServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fhirServiceName", *parsed) + if id.FhirServiceName, ok = input.Parsed["fhirServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fhirServiceName", input) } - return &id, nil + return nil } // ValidateFhirServiceID checks that 'input' can be parsed as a Fhir Service ID diff --git a/resource-manager/healthcareapis/2022-12-01/fhirservices/id_workspace.go b/resource-manager/healthcareapis/2022-12-01/fhirservices/id_workspace.go index 6ba414db3ef..cf5fed722cd 100644 --- a/resource-manager/healthcareapis/2022-12-01/fhirservices/id_workspace.go +++ b/resource-manager/healthcareapis/2022-12-01/fhirservices/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/healthcareapis/2022-12-01/iotconnectors/id_fhirdestination.go b/resource-manager/healthcareapis/2022-12-01/iotconnectors/id_fhirdestination.go index 7d3204a110d..f685bf2d3e2 100644 --- a/resource-manager/healthcareapis/2022-12-01/iotconnectors/id_fhirdestination.go +++ b/resource-manager/healthcareapis/2022-12-01/iotconnectors/id_fhirdestination.go @@ -40,27 +40,9 @@ func ParseFhirDestinationID(input string) (*FhirDestinationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FhirDestinationId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IotConnectorName, ok = parsed.Parsed["iotConnectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "iotConnectorName", *parsed) - } - - if id.FhirDestinationName, ok = parsed.Parsed["fhirDestinationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fhirDestinationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseFhirDestinationIDInsensitively(input string) (*FhirDestinationId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FhirDestinationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *FhirDestinationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IotConnectorName, ok = parsed.Parsed["iotConnectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "iotConnectorName", *parsed) + if id.IotConnectorName, ok = input.Parsed["iotConnectorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "iotConnectorName", input) } - if id.FhirDestinationName, ok = parsed.Parsed["fhirDestinationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fhirDestinationName", *parsed) + if id.FhirDestinationName, ok = input.Parsed["fhirDestinationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fhirDestinationName", input) } - return &id, nil + return nil } // ValidateFhirDestinationID checks that 'input' can be parsed as a Fhir Destination ID diff --git a/resource-manager/healthcareapis/2022-12-01/iotconnectors/id_iotconnector.go b/resource-manager/healthcareapis/2022-12-01/iotconnectors/id_iotconnector.go index dc2006cba87..dcaefdf53a6 100644 --- a/resource-manager/healthcareapis/2022-12-01/iotconnectors/id_iotconnector.go +++ b/resource-manager/healthcareapis/2022-12-01/iotconnectors/id_iotconnector.go @@ -38,23 +38,9 @@ func ParseIotConnectorID(input string) (*IotConnectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IotConnectorId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IotConnectorName, ok = parsed.Parsed["iotConnectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "iotConnectorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIotConnectorIDInsensitively(input string) (*IotConnectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IotConnectorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IotConnectorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IotConnectorName, ok = parsed.Parsed["iotConnectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "iotConnectorName", *parsed) + if id.IotConnectorName, ok = input.Parsed["iotConnectorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "iotConnectorName", input) } - return &id, nil + return nil } // ValidateIotConnectorID checks that 'input' can be parsed as a Iot Connector ID diff --git a/resource-manager/healthcareapis/2022-12-01/iotconnectors/id_workspace.go b/resource-manager/healthcareapis/2022-12-01/iotconnectors/id_workspace.go index 0e1f9192b0f..185e4c5162b 100644 --- a/resource-manager/healthcareapis/2022-12-01/iotconnectors/id_workspace.go +++ b/resource-manager/healthcareapis/2022-12-01/iotconnectors/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/healthcareapis/2022-12-01/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/healthcareapis/2022-12-01/privateendpointconnections/id_privateendpointconnection.go index 7f16f00db83..7bc44aab5ef 100644 --- a/resource-manager/healthcareapis/2022-12-01/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/healthcareapis/2022-12-01/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/healthcareapis/2022-12-01/privateendpointconnections/id_service.go b/resource-manager/healthcareapis/2022-12-01/privateendpointconnections/id_service.go index b4d099e18c5..fe4fdd6dafe 100644 --- a/resource-manager/healthcareapis/2022-12-01/privateendpointconnections/id_service.go +++ b/resource-manager/healthcareapis/2022-12-01/privateendpointconnections/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/healthcareapis/2022-12-01/privatelinkresources/id_privatelinkresource.go b/resource-manager/healthcareapis/2022-12-01/privatelinkresources/id_privatelinkresource.go index 4704d86a413..7065d292833 100644 --- a/resource-manager/healthcareapis/2022-12-01/privatelinkresources/id_privatelinkresource.go +++ b/resource-manager/healthcareapis/2022-12-01/privatelinkresources/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/healthcareapis/2022-12-01/privatelinkresources/id_service.go b/resource-manager/healthcareapis/2022-12-01/privatelinkresources/id_service.go index 2ba8bbef218..16ffed30355 100644 --- a/resource-manager/healthcareapis/2022-12-01/privatelinkresources/id_service.go +++ b/resource-manager/healthcareapis/2022-12-01/privatelinkresources/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/healthcareapis/2022-12-01/resource/id_service.go b/resource-manager/healthcareapis/2022-12-01/resource/id_service.go index c7919775349..22127333d8d 100644 --- a/resource-manager/healthcareapis/2022-12-01/resource/id_service.go +++ b/resource-manager/healthcareapis/2022-12-01/resource/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/healthcareapis/2022-12-01/workspaceprivateendpointconnections/id_workspace.go b/resource-manager/healthcareapis/2022-12-01/workspaceprivateendpointconnections/id_workspace.go index bb68859e579..3cab49c7016 100644 --- a/resource-manager/healthcareapis/2022-12-01/workspaceprivateendpointconnections/id_workspace.go +++ b/resource-manager/healthcareapis/2022-12-01/workspaceprivateendpointconnections/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/healthcareapis/2022-12-01/workspaceprivateendpointconnections/id_workspaceprivateendpointconnection.go b/resource-manager/healthcareapis/2022-12-01/workspaceprivateendpointconnections/id_workspaceprivateendpointconnection.go index d25e4da7215..3d9fe156bda 100644 --- a/resource-manager/healthcareapis/2022-12-01/workspaceprivateendpointconnections/id_workspaceprivateendpointconnection.go +++ b/resource-manager/healthcareapis/2022-12-01/workspaceprivateendpointconnections/id_workspaceprivateendpointconnection.go @@ -38,23 +38,9 @@ func ParseWorkspacePrivateEndpointConnectionID(input string) (*WorkspacePrivateE return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspacePrivateEndpointConnectionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWorkspacePrivateEndpointConnectionIDInsensitively(input string) (*Work return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspacePrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WorkspacePrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidateWorkspacePrivateEndpointConnectionID checks that 'input' can be parsed as a Workspace Private Endpoint Connection ID diff --git a/resource-manager/healthcareapis/2022-12-01/workspaceprivatelinkresources/id_workspace.go b/resource-manager/healthcareapis/2022-12-01/workspaceprivatelinkresources/id_workspace.go index 14db128567f..04a58f0556f 100644 --- a/resource-manager/healthcareapis/2022-12-01/workspaceprivatelinkresources/id_workspace.go +++ b/resource-manager/healthcareapis/2022-12-01/workspaceprivatelinkresources/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/healthcareapis/2022-12-01/workspaceprivatelinkresources/id_workspaceprivatelinkresource.go b/resource-manager/healthcareapis/2022-12-01/workspaceprivatelinkresources/id_workspaceprivatelinkresource.go index de4e4025416..53f4d9794d6 100644 --- a/resource-manager/healthcareapis/2022-12-01/workspaceprivatelinkresources/id_workspaceprivatelinkresource.go +++ b/resource-manager/healthcareapis/2022-12-01/workspaceprivatelinkresources/id_workspaceprivatelinkresource.go @@ -38,23 +38,9 @@ func ParseWorkspacePrivateLinkResourceID(input string) (*WorkspacePrivateLinkRes return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspacePrivateLinkResourceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWorkspacePrivateLinkResourceIDInsensitively(input string) (*WorkspaceP return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspacePrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WorkspacePrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidateWorkspacePrivateLinkResourceID checks that 'input' can be parsed as a Workspace Private Link Resource ID diff --git a/resource-manager/healthcareapis/2022-12-01/workspaces/id_workspace.go b/resource-manager/healthcareapis/2022-12-01/workspaces/id_workspace.go index cf847244f20..66d08917530 100644 --- a/resource-manager/healthcareapis/2022-12-01/workspaces/id_workspace.go +++ b/resource-manager/healthcareapis/2022-12-01/workspaces/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/healthcareapis/2023-02-28/dicomservices/id_dicomservice.go b/resource-manager/healthcareapis/2023-02-28/dicomservices/id_dicomservice.go index 3f7ddb9b049..4e8cc3aef4f 100644 --- a/resource-manager/healthcareapis/2023-02-28/dicomservices/id_dicomservice.go +++ b/resource-manager/healthcareapis/2023-02-28/dicomservices/id_dicomservice.go @@ -38,23 +38,9 @@ func ParseDicomServiceID(input string) (*DicomServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DicomServiceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.DicomServiceName, ok = parsed.Parsed["dicomServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dicomServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDicomServiceIDInsensitively(input string) (*DicomServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DicomServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DicomServiceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.DicomServiceName, ok = parsed.Parsed["dicomServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dicomServiceName", *parsed) + if id.DicomServiceName, ok = input.Parsed["dicomServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dicomServiceName", input) } - return &id, nil + return nil } // ValidateDicomServiceID checks that 'input' can be parsed as a Dicom Service ID diff --git a/resource-manager/healthcareapis/2023-02-28/dicomservices/id_workspace.go b/resource-manager/healthcareapis/2023-02-28/dicomservices/id_workspace.go index 82bd996d34f..818b0450e92 100644 --- a/resource-manager/healthcareapis/2023-02-28/dicomservices/id_workspace.go +++ b/resource-manager/healthcareapis/2023-02-28/dicomservices/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/healthcareapis/2023-02-28/fhirservices/id_fhirservice.go b/resource-manager/healthcareapis/2023-02-28/fhirservices/id_fhirservice.go index 113cb4a507a..7641b0cecfb 100644 --- a/resource-manager/healthcareapis/2023-02-28/fhirservices/id_fhirservice.go +++ b/resource-manager/healthcareapis/2023-02-28/fhirservices/id_fhirservice.go @@ -38,23 +38,9 @@ func ParseFhirServiceID(input string) (*FhirServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FhirServiceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.FhirServiceName, ok = parsed.Parsed["fhirServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fhirServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFhirServiceIDInsensitively(input string) (*FhirServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FhirServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FhirServiceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.FhirServiceName, ok = parsed.Parsed["fhirServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fhirServiceName", *parsed) + if id.FhirServiceName, ok = input.Parsed["fhirServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fhirServiceName", input) } - return &id, nil + return nil } // ValidateFhirServiceID checks that 'input' can be parsed as a Fhir Service ID diff --git a/resource-manager/healthcareapis/2023-02-28/fhirservices/id_workspace.go b/resource-manager/healthcareapis/2023-02-28/fhirservices/id_workspace.go index 6ba414db3ef..cf5fed722cd 100644 --- a/resource-manager/healthcareapis/2023-02-28/fhirservices/id_workspace.go +++ b/resource-manager/healthcareapis/2023-02-28/fhirservices/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/healthcareapis/2023-02-28/iotconnectors/id_fhirdestination.go b/resource-manager/healthcareapis/2023-02-28/iotconnectors/id_fhirdestination.go index 7d3204a110d..f685bf2d3e2 100644 --- a/resource-manager/healthcareapis/2023-02-28/iotconnectors/id_fhirdestination.go +++ b/resource-manager/healthcareapis/2023-02-28/iotconnectors/id_fhirdestination.go @@ -40,27 +40,9 @@ func ParseFhirDestinationID(input string) (*FhirDestinationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FhirDestinationId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IotConnectorName, ok = parsed.Parsed["iotConnectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "iotConnectorName", *parsed) - } - - if id.FhirDestinationName, ok = parsed.Parsed["fhirDestinationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fhirDestinationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseFhirDestinationIDInsensitively(input string) (*FhirDestinationId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FhirDestinationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *FhirDestinationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IotConnectorName, ok = parsed.Parsed["iotConnectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "iotConnectorName", *parsed) + if id.IotConnectorName, ok = input.Parsed["iotConnectorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "iotConnectorName", input) } - if id.FhirDestinationName, ok = parsed.Parsed["fhirDestinationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fhirDestinationName", *parsed) + if id.FhirDestinationName, ok = input.Parsed["fhirDestinationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fhirDestinationName", input) } - return &id, nil + return nil } // ValidateFhirDestinationID checks that 'input' can be parsed as a Fhir Destination ID diff --git a/resource-manager/healthcareapis/2023-02-28/iotconnectors/id_iotconnector.go b/resource-manager/healthcareapis/2023-02-28/iotconnectors/id_iotconnector.go index dc2006cba87..dcaefdf53a6 100644 --- a/resource-manager/healthcareapis/2023-02-28/iotconnectors/id_iotconnector.go +++ b/resource-manager/healthcareapis/2023-02-28/iotconnectors/id_iotconnector.go @@ -38,23 +38,9 @@ func ParseIotConnectorID(input string) (*IotConnectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IotConnectorId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IotConnectorName, ok = parsed.Parsed["iotConnectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "iotConnectorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIotConnectorIDInsensitively(input string) (*IotConnectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IotConnectorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IotConnectorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IotConnectorName, ok = parsed.Parsed["iotConnectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "iotConnectorName", *parsed) + if id.IotConnectorName, ok = input.Parsed["iotConnectorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "iotConnectorName", input) } - return &id, nil + return nil } // ValidateIotConnectorID checks that 'input' can be parsed as a Iot Connector ID diff --git a/resource-manager/healthcareapis/2023-02-28/iotconnectors/id_workspace.go b/resource-manager/healthcareapis/2023-02-28/iotconnectors/id_workspace.go index 0e1f9192b0f..185e4c5162b 100644 --- a/resource-manager/healthcareapis/2023-02-28/iotconnectors/id_workspace.go +++ b/resource-manager/healthcareapis/2023-02-28/iotconnectors/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/healthcareapis/2023-02-28/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/healthcareapis/2023-02-28/privateendpointconnections/id_privateendpointconnection.go index 7f16f00db83..7bc44aab5ef 100644 --- a/resource-manager/healthcareapis/2023-02-28/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/healthcareapis/2023-02-28/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/healthcareapis/2023-02-28/privateendpointconnections/id_service.go b/resource-manager/healthcareapis/2023-02-28/privateendpointconnections/id_service.go index b4d099e18c5..fe4fdd6dafe 100644 --- a/resource-manager/healthcareapis/2023-02-28/privateendpointconnections/id_service.go +++ b/resource-manager/healthcareapis/2023-02-28/privateendpointconnections/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/healthcareapis/2023-02-28/privatelinkresources/id_privatelinkresource.go b/resource-manager/healthcareapis/2023-02-28/privatelinkresources/id_privatelinkresource.go index 4704d86a413..7065d292833 100644 --- a/resource-manager/healthcareapis/2023-02-28/privatelinkresources/id_privatelinkresource.go +++ b/resource-manager/healthcareapis/2023-02-28/privatelinkresources/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/healthcareapis/2023-02-28/privatelinkresources/id_service.go b/resource-manager/healthcareapis/2023-02-28/privatelinkresources/id_service.go index 2ba8bbef218..16ffed30355 100644 --- a/resource-manager/healthcareapis/2023-02-28/privatelinkresources/id_service.go +++ b/resource-manager/healthcareapis/2023-02-28/privatelinkresources/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/healthcareapis/2023-02-28/resource/id_service.go b/resource-manager/healthcareapis/2023-02-28/resource/id_service.go index c7919775349..22127333d8d 100644 --- a/resource-manager/healthcareapis/2023-02-28/resource/id_service.go +++ b/resource-manager/healthcareapis/2023-02-28/resource/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/healthcareapis/2023-02-28/workspaceprivateendpointconnections/id_workspace.go b/resource-manager/healthcareapis/2023-02-28/workspaceprivateendpointconnections/id_workspace.go index bb68859e579..3cab49c7016 100644 --- a/resource-manager/healthcareapis/2023-02-28/workspaceprivateendpointconnections/id_workspace.go +++ b/resource-manager/healthcareapis/2023-02-28/workspaceprivateendpointconnections/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/healthcareapis/2023-02-28/workspaceprivateendpointconnections/id_workspaceprivateendpointconnection.go b/resource-manager/healthcareapis/2023-02-28/workspaceprivateendpointconnections/id_workspaceprivateendpointconnection.go index d25e4da7215..3d9fe156bda 100644 --- a/resource-manager/healthcareapis/2023-02-28/workspaceprivateendpointconnections/id_workspaceprivateendpointconnection.go +++ b/resource-manager/healthcareapis/2023-02-28/workspaceprivateendpointconnections/id_workspaceprivateendpointconnection.go @@ -38,23 +38,9 @@ func ParseWorkspacePrivateEndpointConnectionID(input string) (*WorkspacePrivateE return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspacePrivateEndpointConnectionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWorkspacePrivateEndpointConnectionIDInsensitively(input string) (*Work return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspacePrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WorkspacePrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidateWorkspacePrivateEndpointConnectionID checks that 'input' can be parsed as a Workspace Private Endpoint Connection ID diff --git a/resource-manager/healthcareapis/2023-02-28/workspaceprivatelinkresources/id_workspace.go b/resource-manager/healthcareapis/2023-02-28/workspaceprivatelinkresources/id_workspace.go index 14db128567f..04a58f0556f 100644 --- a/resource-manager/healthcareapis/2023-02-28/workspaceprivatelinkresources/id_workspace.go +++ b/resource-manager/healthcareapis/2023-02-28/workspaceprivatelinkresources/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/healthcareapis/2023-02-28/workspaceprivatelinkresources/id_workspaceprivatelinkresource.go b/resource-manager/healthcareapis/2023-02-28/workspaceprivatelinkresources/id_workspaceprivatelinkresource.go index de4e4025416..53f4d9794d6 100644 --- a/resource-manager/healthcareapis/2023-02-28/workspaceprivatelinkresources/id_workspaceprivatelinkresource.go +++ b/resource-manager/healthcareapis/2023-02-28/workspaceprivatelinkresources/id_workspaceprivatelinkresource.go @@ -38,23 +38,9 @@ func ParseWorkspacePrivateLinkResourceID(input string) (*WorkspacePrivateLinkRes return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspacePrivateLinkResourceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWorkspacePrivateLinkResourceIDInsensitively(input string) (*WorkspaceP return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspacePrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WorkspacePrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidateWorkspacePrivateLinkResourceID checks that 'input' can be parsed as a Workspace Private Link Resource ID diff --git a/resource-manager/healthcareapis/2023-02-28/workspaces/id_workspace.go b/resource-manager/healthcareapis/2023-02-28/workspaces/id_workspace.go index cf847244f20..66d08917530 100644 --- a/resource-manager/healthcareapis/2023-02-28/workspaces/id_workspace.go +++ b/resource-manager/healthcareapis/2023-02-28/workspaces/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/healthcareapis/2023-09-06/dicomservices/id_dicomservice.go b/resource-manager/healthcareapis/2023-09-06/dicomservices/id_dicomservice.go index 3f7ddb9b049..4e8cc3aef4f 100644 --- a/resource-manager/healthcareapis/2023-09-06/dicomservices/id_dicomservice.go +++ b/resource-manager/healthcareapis/2023-09-06/dicomservices/id_dicomservice.go @@ -38,23 +38,9 @@ func ParseDicomServiceID(input string) (*DicomServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DicomServiceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.DicomServiceName, ok = parsed.Parsed["dicomServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dicomServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDicomServiceIDInsensitively(input string) (*DicomServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DicomServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DicomServiceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.DicomServiceName, ok = parsed.Parsed["dicomServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dicomServiceName", *parsed) + if id.DicomServiceName, ok = input.Parsed["dicomServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dicomServiceName", input) } - return &id, nil + return nil } // ValidateDicomServiceID checks that 'input' can be parsed as a Dicom Service ID diff --git a/resource-manager/healthcareapis/2023-09-06/dicomservices/id_workspace.go b/resource-manager/healthcareapis/2023-09-06/dicomservices/id_workspace.go index 82bd996d34f..818b0450e92 100644 --- a/resource-manager/healthcareapis/2023-09-06/dicomservices/id_workspace.go +++ b/resource-manager/healthcareapis/2023-09-06/dicomservices/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/healthcareapis/2023-09-06/fhirservices/id_fhirservice.go b/resource-manager/healthcareapis/2023-09-06/fhirservices/id_fhirservice.go index 113cb4a507a..7641b0cecfb 100644 --- a/resource-manager/healthcareapis/2023-09-06/fhirservices/id_fhirservice.go +++ b/resource-manager/healthcareapis/2023-09-06/fhirservices/id_fhirservice.go @@ -38,23 +38,9 @@ func ParseFhirServiceID(input string) (*FhirServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FhirServiceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.FhirServiceName, ok = parsed.Parsed["fhirServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fhirServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFhirServiceIDInsensitively(input string) (*FhirServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FhirServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FhirServiceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.FhirServiceName, ok = parsed.Parsed["fhirServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fhirServiceName", *parsed) + if id.FhirServiceName, ok = input.Parsed["fhirServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fhirServiceName", input) } - return &id, nil + return nil } // ValidateFhirServiceID checks that 'input' can be parsed as a Fhir Service ID diff --git a/resource-manager/healthcareapis/2023-09-06/fhirservices/id_workspace.go b/resource-manager/healthcareapis/2023-09-06/fhirservices/id_workspace.go index 6ba414db3ef..cf5fed722cd 100644 --- a/resource-manager/healthcareapis/2023-09-06/fhirservices/id_workspace.go +++ b/resource-manager/healthcareapis/2023-09-06/fhirservices/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/healthcareapis/2023-09-06/iotconnectors/id_fhirdestination.go b/resource-manager/healthcareapis/2023-09-06/iotconnectors/id_fhirdestination.go index 7d3204a110d..f685bf2d3e2 100644 --- a/resource-manager/healthcareapis/2023-09-06/iotconnectors/id_fhirdestination.go +++ b/resource-manager/healthcareapis/2023-09-06/iotconnectors/id_fhirdestination.go @@ -40,27 +40,9 @@ func ParseFhirDestinationID(input string) (*FhirDestinationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FhirDestinationId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IotConnectorName, ok = parsed.Parsed["iotConnectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "iotConnectorName", *parsed) - } - - if id.FhirDestinationName, ok = parsed.Parsed["fhirDestinationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fhirDestinationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseFhirDestinationIDInsensitively(input string) (*FhirDestinationId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FhirDestinationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *FhirDestinationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IotConnectorName, ok = parsed.Parsed["iotConnectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "iotConnectorName", *parsed) + if id.IotConnectorName, ok = input.Parsed["iotConnectorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "iotConnectorName", input) } - if id.FhirDestinationName, ok = parsed.Parsed["fhirDestinationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fhirDestinationName", *parsed) + if id.FhirDestinationName, ok = input.Parsed["fhirDestinationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fhirDestinationName", input) } - return &id, nil + return nil } // ValidateFhirDestinationID checks that 'input' can be parsed as a Fhir Destination ID diff --git a/resource-manager/healthcareapis/2023-09-06/iotconnectors/id_iotconnector.go b/resource-manager/healthcareapis/2023-09-06/iotconnectors/id_iotconnector.go index dc2006cba87..dcaefdf53a6 100644 --- a/resource-manager/healthcareapis/2023-09-06/iotconnectors/id_iotconnector.go +++ b/resource-manager/healthcareapis/2023-09-06/iotconnectors/id_iotconnector.go @@ -38,23 +38,9 @@ func ParseIotConnectorID(input string) (*IotConnectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IotConnectorId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IotConnectorName, ok = parsed.Parsed["iotConnectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "iotConnectorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIotConnectorIDInsensitively(input string) (*IotConnectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IotConnectorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IotConnectorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IotConnectorName, ok = parsed.Parsed["iotConnectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "iotConnectorName", *parsed) + if id.IotConnectorName, ok = input.Parsed["iotConnectorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "iotConnectorName", input) } - return &id, nil + return nil } // ValidateIotConnectorID checks that 'input' can be parsed as a Iot Connector ID diff --git a/resource-manager/healthcareapis/2023-09-06/iotconnectors/id_workspace.go b/resource-manager/healthcareapis/2023-09-06/iotconnectors/id_workspace.go index 0e1f9192b0f..185e4c5162b 100644 --- a/resource-manager/healthcareapis/2023-09-06/iotconnectors/id_workspace.go +++ b/resource-manager/healthcareapis/2023-09-06/iotconnectors/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/healthcareapis/2023-09-06/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/healthcareapis/2023-09-06/privateendpointconnections/id_privateendpointconnection.go index 7f16f00db83..7bc44aab5ef 100644 --- a/resource-manager/healthcareapis/2023-09-06/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/healthcareapis/2023-09-06/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/healthcareapis/2023-09-06/privateendpointconnections/id_service.go b/resource-manager/healthcareapis/2023-09-06/privateendpointconnections/id_service.go index b4d099e18c5..fe4fdd6dafe 100644 --- a/resource-manager/healthcareapis/2023-09-06/privateendpointconnections/id_service.go +++ b/resource-manager/healthcareapis/2023-09-06/privateendpointconnections/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/healthcareapis/2023-09-06/privatelinkresources/id_privatelinkresource.go b/resource-manager/healthcareapis/2023-09-06/privatelinkresources/id_privatelinkresource.go index 4704d86a413..7065d292833 100644 --- a/resource-manager/healthcareapis/2023-09-06/privatelinkresources/id_privatelinkresource.go +++ b/resource-manager/healthcareapis/2023-09-06/privatelinkresources/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/healthcareapis/2023-09-06/privatelinkresources/id_service.go b/resource-manager/healthcareapis/2023-09-06/privatelinkresources/id_service.go index 2ba8bbef218..16ffed30355 100644 --- a/resource-manager/healthcareapis/2023-09-06/privatelinkresources/id_service.go +++ b/resource-manager/healthcareapis/2023-09-06/privatelinkresources/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/healthcareapis/2023-09-06/resource/id_service.go b/resource-manager/healthcareapis/2023-09-06/resource/id_service.go index c7919775349..22127333d8d 100644 --- a/resource-manager/healthcareapis/2023-09-06/resource/id_service.go +++ b/resource-manager/healthcareapis/2023-09-06/resource/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/healthcareapis/2023-09-06/workspaceprivateendpointconnections/id_workspace.go b/resource-manager/healthcareapis/2023-09-06/workspaceprivateendpointconnections/id_workspace.go index bb68859e579..3cab49c7016 100644 --- a/resource-manager/healthcareapis/2023-09-06/workspaceprivateendpointconnections/id_workspace.go +++ b/resource-manager/healthcareapis/2023-09-06/workspaceprivateendpointconnections/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/healthcareapis/2023-09-06/workspaceprivateendpointconnections/id_workspaceprivateendpointconnection.go b/resource-manager/healthcareapis/2023-09-06/workspaceprivateendpointconnections/id_workspaceprivateendpointconnection.go index d25e4da7215..3d9fe156bda 100644 --- a/resource-manager/healthcareapis/2023-09-06/workspaceprivateendpointconnections/id_workspaceprivateendpointconnection.go +++ b/resource-manager/healthcareapis/2023-09-06/workspaceprivateendpointconnections/id_workspaceprivateendpointconnection.go @@ -38,23 +38,9 @@ func ParseWorkspacePrivateEndpointConnectionID(input string) (*WorkspacePrivateE return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspacePrivateEndpointConnectionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWorkspacePrivateEndpointConnectionIDInsensitively(input string) (*Work return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspacePrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WorkspacePrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidateWorkspacePrivateEndpointConnectionID checks that 'input' can be parsed as a Workspace Private Endpoint Connection ID diff --git a/resource-manager/healthcareapis/2023-09-06/workspaceprivatelinkresources/id_workspace.go b/resource-manager/healthcareapis/2023-09-06/workspaceprivatelinkresources/id_workspace.go index 14db128567f..04a58f0556f 100644 --- a/resource-manager/healthcareapis/2023-09-06/workspaceprivatelinkresources/id_workspace.go +++ b/resource-manager/healthcareapis/2023-09-06/workspaceprivatelinkresources/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/healthcareapis/2023-09-06/workspaceprivatelinkresources/id_workspaceprivatelinkresource.go b/resource-manager/healthcareapis/2023-09-06/workspaceprivatelinkresources/id_workspaceprivatelinkresource.go index de4e4025416..53f4d9794d6 100644 --- a/resource-manager/healthcareapis/2023-09-06/workspaceprivatelinkresources/id_workspaceprivatelinkresource.go +++ b/resource-manager/healthcareapis/2023-09-06/workspaceprivatelinkresources/id_workspaceprivatelinkresource.go @@ -38,23 +38,9 @@ func ParseWorkspacePrivateLinkResourceID(input string) (*WorkspacePrivateLinkRes return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspacePrivateLinkResourceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWorkspacePrivateLinkResourceIDInsensitively(input string) (*WorkspaceP return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspacePrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WorkspacePrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidateWorkspacePrivateLinkResourceID checks that 'input' can be parsed as a Workspace Private Link Resource ID diff --git a/resource-manager/healthcareapis/2023-09-06/workspaces/id_workspace.go b/resource-manager/healthcareapis/2023-09-06/workspaces/id_workspace.go index cf847244f20..66d08917530 100644 --- a/resource-manager/healthcareapis/2023-09-06/workspaces/id_workspace.go +++ b/resource-manager/healthcareapis/2023-09-06/workspaces/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/healthcareapis/2023-11-01/dicomservices/id_dicomservice.go b/resource-manager/healthcareapis/2023-11-01/dicomservices/id_dicomservice.go index 3f7ddb9b049..4e8cc3aef4f 100644 --- a/resource-manager/healthcareapis/2023-11-01/dicomservices/id_dicomservice.go +++ b/resource-manager/healthcareapis/2023-11-01/dicomservices/id_dicomservice.go @@ -38,23 +38,9 @@ func ParseDicomServiceID(input string) (*DicomServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DicomServiceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.DicomServiceName, ok = parsed.Parsed["dicomServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dicomServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDicomServiceIDInsensitively(input string) (*DicomServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DicomServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DicomServiceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.DicomServiceName, ok = parsed.Parsed["dicomServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dicomServiceName", *parsed) + if id.DicomServiceName, ok = input.Parsed["dicomServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dicomServiceName", input) } - return &id, nil + return nil } // ValidateDicomServiceID checks that 'input' can be parsed as a Dicom Service ID diff --git a/resource-manager/healthcareapis/2023-11-01/dicomservices/id_workspace.go b/resource-manager/healthcareapis/2023-11-01/dicomservices/id_workspace.go index 82bd996d34f..818b0450e92 100644 --- a/resource-manager/healthcareapis/2023-11-01/dicomservices/id_workspace.go +++ b/resource-manager/healthcareapis/2023-11-01/dicomservices/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/healthcareapis/2023-11-01/fhirservices/id_fhirservice.go b/resource-manager/healthcareapis/2023-11-01/fhirservices/id_fhirservice.go index 113cb4a507a..7641b0cecfb 100644 --- a/resource-manager/healthcareapis/2023-11-01/fhirservices/id_fhirservice.go +++ b/resource-manager/healthcareapis/2023-11-01/fhirservices/id_fhirservice.go @@ -38,23 +38,9 @@ func ParseFhirServiceID(input string) (*FhirServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FhirServiceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.FhirServiceName, ok = parsed.Parsed["fhirServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fhirServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFhirServiceIDInsensitively(input string) (*FhirServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FhirServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FhirServiceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.FhirServiceName, ok = parsed.Parsed["fhirServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fhirServiceName", *parsed) + if id.FhirServiceName, ok = input.Parsed["fhirServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fhirServiceName", input) } - return &id, nil + return nil } // ValidateFhirServiceID checks that 'input' can be parsed as a Fhir Service ID diff --git a/resource-manager/healthcareapis/2023-11-01/fhirservices/id_workspace.go b/resource-manager/healthcareapis/2023-11-01/fhirservices/id_workspace.go index 6ba414db3ef..cf5fed722cd 100644 --- a/resource-manager/healthcareapis/2023-11-01/fhirservices/id_workspace.go +++ b/resource-manager/healthcareapis/2023-11-01/fhirservices/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/healthcareapis/2023-11-01/iotconnectors/id_fhirdestination.go b/resource-manager/healthcareapis/2023-11-01/iotconnectors/id_fhirdestination.go index 7d3204a110d..f685bf2d3e2 100644 --- a/resource-manager/healthcareapis/2023-11-01/iotconnectors/id_fhirdestination.go +++ b/resource-manager/healthcareapis/2023-11-01/iotconnectors/id_fhirdestination.go @@ -40,27 +40,9 @@ func ParseFhirDestinationID(input string) (*FhirDestinationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FhirDestinationId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IotConnectorName, ok = parsed.Parsed["iotConnectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "iotConnectorName", *parsed) - } - - if id.FhirDestinationName, ok = parsed.Parsed["fhirDestinationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fhirDestinationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseFhirDestinationIDInsensitively(input string) (*FhirDestinationId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FhirDestinationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *FhirDestinationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IotConnectorName, ok = parsed.Parsed["iotConnectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "iotConnectorName", *parsed) + if id.IotConnectorName, ok = input.Parsed["iotConnectorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "iotConnectorName", input) } - if id.FhirDestinationName, ok = parsed.Parsed["fhirDestinationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fhirDestinationName", *parsed) + if id.FhirDestinationName, ok = input.Parsed["fhirDestinationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fhirDestinationName", input) } - return &id, nil + return nil } // ValidateFhirDestinationID checks that 'input' can be parsed as a Fhir Destination ID diff --git a/resource-manager/healthcareapis/2023-11-01/iotconnectors/id_iotconnector.go b/resource-manager/healthcareapis/2023-11-01/iotconnectors/id_iotconnector.go index dc2006cba87..dcaefdf53a6 100644 --- a/resource-manager/healthcareapis/2023-11-01/iotconnectors/id_iotconnector.go +++ b/resource-manager/healthcareapis/2023-11-01/iotconnectors/id_iotconnector.go @@ -38,23 +38,9 @@ func ParseIotConnectorID(input string) (*IotConnectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IotConnectorId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IotConnectorName, ok = parsed.Parsed["iotConnectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "iotConnectorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIotConnectorIDInsensitively(input string) (*IotConnectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IotConnectorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IotConnectorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IotConnectorName, ok = parsed.Parsed["iotConnectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "iotConnectorName", *parsed) + if id.IotConnectorName, ok = input.Parsed["iotConnectorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "iotConnectorName", input) } - return &id, nil + return nil } // ValidateIotConnectorID checks that 'input' can be parsed as a Iot Connector ID diff --git a/resource-manager/healthcareapis/2023-11-01/iotconnectors/id_workspace.go b/resource-manager/healthcareapis/2023-11-01/iotconnectors/id_workspace.go index 0e1f9192b0f..185e4c5162b 100644 --- a/resource-manager/healthcareapis/2023-11-01/iotconnectors/id_workspace.go +++ b/resource-manager/healthcareapis/2023-11-01/iotconnectors/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/healthcareapis/2023-11-01/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/healthcareapis/2023-11-01/privateendpointconnections/id_privateendpointconnection.go index 7f16f00db83..7bc44aab5ef 100644 --- a/resource-manager/healthcareapis/2023-11-01/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/healthcareapis/2023-11-01/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/healthcareapis/2023-11-01/privateendpointconnections/id_service.go b/resource-manager/healthcareapis/2023-11-01/privateendpointconnections/id_service.go index b4d099e18c5..fe4fdd6dafe 100644 --- a/resource-manager/healthcareapis/2023-11-01/privateendpointconnections/id_service.go +++ b/resource-manager/healthcareapis/2023-11-01/privateendpointconnections/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/healthcareapis/2023-11-01/privatelinkresources/id_privatelinkresource.go b/resource-manager/healthcareapis/2023-11-01/privatelinkresources/id_privatelinkresource.go index 4704d86a413..7065d292833 100644 --- a/resource-manager/healthcareapis/2023-11-01/privatelinkresources/id_privatelinkresource.go +++ b/resource-manager/healthcareapis/2023-11-01/privatelinkresources/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/healthcareapis/2023-11-01/privatelinkresources/id_service.go b/resource-manager/healthcareapis/2023-11-01/privatelinkresources/id_service.go index 2ba8bbef218..16ffed30355 100644 --- a/resource-manager/healthcareapis/2023-11-01/privatelinkresources/id_service.go +++ b/resource-manager/healthcareapis/2023-11-01/privatelinkresources/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/healthcareapis/2023-11-01/resource/id_service.go b/resource-manager/healthcareapis/2023-11-01/resource/id_service.go index c7919775349..22127333d8d 100644 --- a/resource-manager/healthcareapis/2023-11-01/resource/id_service.go +++ b/resource-manager/healthcareapis/2023-11-01/resource/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/healthcareapis/2023-11-01/workspaceprivateendpointconnections/id_workspace.go b/resource-manager/healthcareapis/2023-11-01/workspaceprivateendpointconnections/id_workspace.go index bb68859e579..3cab49c7016 100644 --- a/resource-manager/healthcareapis/2023-11-01/workspaceprivateendpointconnections/id_workspace.go +++ b/resource-manager/healthcareapis/2023-11-01/workspaceprivateendpointconnections/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/healthcareapis/2023-11-01/workspaceprivateendpointconnections/id_workspaceprivateendpointconnection.go b/resource-manager/healthcareapis/2023-11-01/workspaceprivateendpointconnections/id_workspaceprivateendpointconnection.go index d25e4da7215..3d9fe156bda 100644 --- a/resource-manager/healthcareapis/2023-11-01/workspaceprivateendpointconnections/id_workspaceprivateendpointconnection.go +++ b/resource-manager/healthcareapis/2023-11-01/workspaceprivateendpointconnections/id_workspaceprivateendpointconnection.go @@ -38,23 +38,9 @@ func ParseWorkspacePrivateEndpointConnectionID(input string) (*WorkspacePrivateE return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspacePrivateEndpointConnectionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWorkspacePrivateEndpointConnectionIDInsensitively(input string) (*Work return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspacePrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WorkspacePrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidateWorkspacePrivateEndpointConnectionID checks that 'input' can be parsed as a Workspace Private Endpoint Connection ID diff --git a/resource-manager/healthcareapis/2023-11-01/workspaceprivatelinkresources/id_workspace.go b/resource-manager/healthcareapis/2023-11-01/workspaceprivatelinkresources/id_workspace.go index 14db128567f..04a58f0556f 100644 --- a/resource-manager/healthcareapis/2023-11-01/workspaceprivatelinkresources/id_workspace.go +++ b/resource-manager/healthcareapis/2023-11-01/workspaceprivatelinkresources/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/healthcareapis/2023-11-01/workspaceprivatelinkresources/id_workspaceprivatelinkresource.go b/resource-manager/healthcareapis/2023-11-01/workspaceprivatelinkresources/id_workspaceprivatelinkresource.go index de4e4025416..53f4d9794d6 100644 --- a/resource-manager/healthcareapis/2023-11-01/workspaceprivatelinkresources/id_workspaceprivatelinkresource.go +++ b/resource-manager/healthcareapis/2023-11-01/workspaceprivatelinkresources/id_workspaceprivatelinkresource.go @@ -38,23 +38,9 @@ func ParseWorkspacePrivateLinkResourceID(input string) (*WorkspacePrivateLinkRes return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspacePrivateLinkResourceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWorkspacePrivateLinkResourceIDInsensitively(input string) (*WorkspaceP return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspacePrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WorkspacePrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidateWorkspacePrivateLinkResourceID checks that 'input' can be parsed as a Workspace Private Link Resource ID diff --git a/resource-manager/healthcareapis/2023-11-01/workspaces/id_workspace.go b/resource-manager/healthcareapis/2023-11-01/workspaces/id_workspace.go index cf847244f20..66d08917530 100644 --- a/resource-manager/healthcareapis/2023-11-01/workspaces/id_workspace.go +++ b/resource-manager/healthcareapis/2023-11-01/workspaces/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/hybridcompute/2022-11-10/extensions/id_extensiontype.go b/resource-manager/hybridcompute/2022-11-10/extensions/id_extensiontype.go index 3c2354b87f6..c837b1eb3c2 100644 --- a/resource-manager/hybridcompute/2022-11-10/extensions/id_extensiontype.go +++ b/resource-manager/hybridcompute/2022-11-10/extensions/id_extensiontype.go @@ -38,23 +38,9 @@ func ParseExtensionTypeID(input string) (*ExtensionTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExtensionTypeId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) - } - - if id.ExtensionTypeName, ok = parsed.Parsed["extensionTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionTypeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseExtensionTypeIDInsensitively(input string) (*ExtensionTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExtensionTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ExtensionTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - if id.ExtensionTypeName, ok = parsed.Parsed["extensionTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionTypeName", *parsed) + if id.ExtensionTypeName, ok = input.Parsed["extensionTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "extensionTypeName", input) } - return &id, nil + return nil } // ValidateExtensionTypeID checks that 'input' can be parsed as a Extension Type ID diff --git a/resource-manager/hybridcompute/2022-11-10/extensions/id_version.go b/resource-manager/hybridcompute/2022-11-10/extensions/id_version.go index c6e9312c1e8..1fea712bf69 100644 --- a/resource-manager/hybridcompute/2022-11-10/extensions/id_version.go +++ b/resource-manager/hybridcompute/2022-11-10/extensions/id_version.go @@ -40,27 +40,9 @@ func ParseVersionID(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) - } - - if id.ExtensionTypeName, ok = parsed.Parsed["extensionTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionTypeName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVersionIDInsensitively(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - if id.ExtensionTypeName, ok = parsed.Parsed["extensionTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionTypeName", *parsed) + if id.ExtensionTypeName, ok = input.Parsed["extensionTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "extensionTypeName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateVersionID checks that 'input' can be parsed as a Version ID diff --git a/resource-manager/hybridcompute/2022-11-10/machineextensions/id_extension.go b/resource-manager/hybridcompute/2022-11-10/machineextensions/id_extension.go index bdcaaf011a1..a9921c71713 100644 --- a/resource-manager/hybridcompute/2022-11-10/machineextensions/id_extension.go +++ b/resource-manager/hybridcompute/2022-11-10/machineextensions/id_extension.go @@ -38,23 +38,9 @@ func ParseExtensionID(input string) (*ExtensionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExtensionId{} - - 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.MachineName, ok = parsed.Parsed["machineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machineName", *parsed) - } - - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseExtensionIDInsensitively(input string) (*ExtensionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExtensionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ExtensionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MachineName, ok = parsed.Parsed["machineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machineName", *parsed) + if id.MachineName, ok = input.Parsed["machineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "machineName", input) } - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if id.ExtensionName, ok = input.Parsed["extensionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "extensionName", input) } - return &id, nil + return nil } // ValidateExtensionID checks that 'input' can be parsed as a Extension ID diff --git a/resource-manager/hybridcompute/2022-11-10/machineextensions/id_machine.go b/resource-manager/hybridcompute/2022-11-10/machineextensions/id_machine.go index c0b9021b934..4799cd5e097 100644 --- a/resource-manager/hybridcompute/2022-11-10/machineextensions/id_machine.go +++ b/resource-manager/hybridcompute/2022-11-10/machineextensions/id_machine.go @@ -36,19 +36,9 @@ func ParseMachineID(input string) (*MachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MachineId{} - - 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.MachineName, ok = parsed.Parsed["machineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMachineIDInsensitively(input string) (*MachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MachineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MachineName, ok = parsed.Parsed["machineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machineName", *parsed) + if id.MachineName, ok = input.Parsed["machineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "machineName", input) } - return &id, nil + return nil } // ValidateMachineID checks that 'input' can be parsed as a Machine ID diff --git a/resource-manager/hybridcompute/2022-11-10/machineextensionsupgrade/id_machine.go b/resource-manager/hybridcompute/2022-11-10/machineextensionsupgrade/id_machine.go index 080feeded24..b4b26265ce7 100644 --- a/resource-manager/hybridcompute/2022-11-10/machineextensionsupgrade/id_machine.go +++ b/resource-manager/hybridcompute/2022-11-10/machineextensionsupgrade/id_machine.go @@ -36,19 +36,9 @@ func ParseMachineID(input string) (*MachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MachineId{} - - 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.MachineName, ok = parsed.Parsed["machineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMachineIDInsensitively(input string) (*MachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MachineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MachineName, ok = parsed.Parsed["machineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machineName", *parsed) + if id.MachineName, ok = input.Parsed["machineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "machineName", input) } - return &id, nil + return nil } // ValidateMachineID checks that 'input' can be parsed as a Machine ID diff --git a/resource-manager/hybridcompute/2022-11-10/machines/id_machine.go b/resource-manager/hybridcompute/2022-11-10/machines/id_machine.go index add72d0ad9a..49cabf0d05d 100644 --- a/resource-manager/hybridcompute/2022-11-10/machines/id_machine.go +++ b/resource-manager/hybridcompute/2022-11-10/machines/id_machine.go @@ -36,19 +36,9 @@ func ParseMachineID(input string) (*MachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MachineId{} - - 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.MachineName, ok = parsed.Parsed["machineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMachineIDInsensitively(input string) (*MachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MachineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MachineName, ok = parsed.Parsed["machineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machineName", *parsed) + if id.MachineName, ok = input.Parsed["machineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "machineName", input) } - return &id, nil + return nil } // ValidateMachineID checks that 'input' can be parsed as a Machine ID diff --git a/resource-manager/hybridcompute/2022-11-10/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/hybridcompute/2022-11-10/privateendpointconnections/id_privateendpointconnection.go index 11d1e8ee2a6..cc795c503ae 100644 --- a/resource-manager/hybridcompute/2022-11-10/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/hybridcompute/2022-11-10/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.PrivateLinkScopeName, ok = parsed.Parsed["privateLinkScopeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateLinkScopeName, ok = parsed.Parsed["privateLinkScopeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", *parsed) + if id.PrivateLinkScopeName, ok = input.Parsed["privateLinkScopeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/hybridcompute/2022-11-10/privateendpointconnections/id_providerprivatelinkscope.go b/resource-manager/hybridcompute/2022-11-10/privateendpointconnections/id_providerprivatelinkscope.go index 282da81e836..3f5a1d4213d 100644 --- a/resource-manager/hybridcompute/2022-11-10/privateendpointconnections/id_providerprivatelinkscope.go +++ b/resource-manager/hybridcompute/2022-11-10/privateendpointconnections/id_providerprivatelinkscope.go @@ -36,19 +36,9 @@ func ParseProviderPrivateLinkScopeID(input string) (*ProviderPrivateLinkScopeId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderPrivateLinkScopeId{} - - 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.PrivateLinkScopeName, ok = parsed.Parsed["privateLinkScopeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderPrivateLinkScopeIDInsensitively(input string) (*ProviderPrivat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderPrivateLinkScopeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderPrivateLinkScopeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateLinkScopeName, ok = parsed.Parsed["privateLinkScopeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", *parsed) + if id.PrivateLinkScopeName, ok = input.Parsed["privateLinkScopeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", input) } - return &id, nil + return nil } // ValidateProviderPrivateLinkScopeID checks that 'input' can be parsed as a Provider Private Link Scope ID diff --git a/resource-manager/hybridcompute/2022-11-10/privatelinkresources/id_privatelinkresource.go b/resource-manager/hybridcompute/2022-11-10/privatelinkresources/id_privatelinkresource.go index 2d7af25d900..c320eec774f 100644 --- a/resource-manager/hybridcompute/2022-11-10/privatelinkresources/id_privatelinkresource.go +++ b/resource-manager/hybridcompute/2022-11-10/privatelinkresources/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.PrivateLinkScopeName, ok = parsed.Parsed["privateLinkScopeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", *parsed) - } - - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateLinkScopeName, ok = parsed.Parsed["privateLinkScopeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", *parsed) + if id.PrivateLinkScopeName, ok = input.Parsed["privateLinkScopeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/hybridcompute/2022-11-10/privatelinkresources/id_providerprivatelinkscope.go b/resource-manager/hybridcompute/2022-11-10/privatelinkresources/id_providerprivatelinkscope.go index 6237d571e4d..4d2883ae988 100644 --- a/resource-manager/hybridcompute/2022-11-10/privatelinkresources/id_providerprivatelinkscope.go +++ b/resource-manager/hybridcompute/2022-11-10/privatelinkresources/id_providerprivatelinkscope.go @@ -36,19 +36,9 @@ func ParseProviderPrivateLinkScopeID(input string) (*ProviderPrivateLinkScopeId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderPrivateLinkScopeId{} - - 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.PrivateLinkScopeName, ok = parsed.Parsed["privateLinkScopeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderPrivateLinkScopeIDInsensitively(input string) (*ProviderPrivat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderPrivateLinkScopeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderPrivateLinkScopeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateLinkScopeName, ok = parsed.Parsed["privateLinkScopeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", *parsed) + if id.PrivateLinkScopeName, ok = input.Parsed["privateLinkScopeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", input) } - return &id, nil + return nil } // ValidateProviderPrivateLinkScopeID checks that 'input' can be parsed as a Provider Private Link Scope ID diff --git a/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/id_machine.go b/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/id_machine.go index 7951d8dac25..f3cba6e107a 100644 --- a/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/id_machine.go +++ b/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/id_machine.go @@ -36,19 +36,9 @@ func ParseMachineID(input string) (*MachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MachineId{} - - 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.MachineName, ok = parsed.Parsed["machineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMachineIDInsensitively(input string) (*MachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MachineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MachineName, ok = parsed.Parsed["machineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machineName", *parsed) + if id.MachineName, ok = input.Parsed["machineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "machineName", input) } - return &id, nil + return nil } // ValidateMachineID checks that 'input' can be parsed as a Machine ID diff --git a/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/id_privatelinkscope.go b/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/id_privatelinkscope.go index 3b203dc4b29..5f650bf2ddb 100644 --- a/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/id_privatelinkscope.go +++ b/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/id_privatelinkscope.go @@ -36,19 +36,9 @@ func ParsePrivateLinkScopeID(input string) (*PrivateLinkScopeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkScopeId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.PrivateLinkScopeId, ok = parsed.Parsed["privateLinkScopeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePrivateLinkScopeIDInsensitively(input string) (*PrivateLinkScopeId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkScopeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PrivateLinkScopeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.PrivateLinkScopeId, ok = parsed.Parsed["privateLinkScopeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeId", *parsed) + if id.PrivateLinkScopeId, ok = input.Parsed["privateLinkScopeId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeId", input) } - return &id, nil + return nil } // ValidatePrivateLinkScopeID checks that 'input' can be parsed as a Private Link Scope ID diff --git a/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/id_providerprivatelinkscope.go b/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/id_providerprivatelinkscope.go index 6e9d5c41743..ae6ffd8daf7 100644 --- a/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/id_providerprivatelinkscope.go +++ b/resource-manager/hybridcompute/2022-11-10/privatelinkscopes/id_providerprivatelinkscope.go @@ -36,19 +36,9 @@ func ParseProviderPrivateLinkScopeID(input string) (*ProviderPrivateLinkScopeId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderPrivateLinkScopeId{} - - 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.PrivateLinkScopeName, ok = parsed.Parsed["privateLinkScopeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderPrivateLinkScopeIDInsensitively(input string) (*ProviderPrivat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderPrivateLinkScopeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderPrivateLinkScopeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateLinkScopeName, ok = parsed.Parsed["privateLinkScopeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", *parsed) + if id.PrivateLinkScopeName, ok = input.Parsed["privateLinkScopeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", input) } - return &id, nil + return nil } // ValidateProviderPrivateLinkScopeID checks that 'input' can be parsed as a Provider Private Link Scope ID diff --git a/resource-manager/hybridcompute/2022-12-27/extensions/id_extensiontype.go b/resource-manager/hybridcompute/2022-12-27/extensions/id_extensiontype.go index 3c2354b87f6..c837b1eb3c2 100644 --- a/resource-manager/hybridcompute/2022-12-27/extensions/id_extensiontype.go +++ b/resource-manager/hybridcompute/2022-12-27/extensions/id_extensiontype.go @@ -38,23 +38,9 @@ func ParseExtensionTypeID(input string) (*ExtensionTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExtensionTypeId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) - } - - if id.ExtensionTypeName, ok = parsed.Parsed["extensionTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionTypeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseExtensionTypeIDInsensitively(input string) (*ExtensionTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExtensionTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ExtensionTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - if id.ExtensionTypeName, ok = parsed.Parsed["extensionTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionTypeName", *parsed) + if id.ExtensionTypeName, ok = input.Parsed["extensionTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "extensionTypeName", input) } - return &id, nil + return nil } // ValidateExtensionTypeID checks that 'input' can be parsed as a Extension Type ID diff --git a/resource-manager/hybridcompute/2022-12-27/extensions/id_version.go b/resource-manager/hybridcompute/2022-12-27/extensions/id_version.go index c6e9312c1e8..1fea712bf69 100644 --- a/resource-manager/hybridcompute/2022-12-27/extensions/id_version.go +++ b/resource-manager/hybridcompute/2022-12-27/extensions/id_version.go @@ -40,27 +40,9 @@ func ParseVersionID(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) - } - - if id.ExtensionTypeName, ok = parsed.Parsed["extensionTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionTypeName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVersionIDInsensitively(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.PublisherName, ok = parsed.Parsed["publisherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherName", *parsed) + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) } - if id.ExtensionTypeName, ok = parsed.Parsed["extensionTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionTypeName", *parsed) + if id.ExtensionTypeName, ok = input.Parsed["extensionTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "extensionTypeName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateVersionID checks that 'input' can be parsed as a Version ID diff --git a/resource-manager/hybridcompute/2022-12-27/machineextensions/id_extension.go b/resource-manager/hybridcompute/2022-12-27/machineextensions/id_extension.go index bdcaaf011a1..a9921c71713 100644 --- a/resource-manager/hybridcompute/2022-12-27/machineextensions/id_extension.go +++ b/resource-manager/hybridcompute/2022-12-27/machineextensions/id_extension.go @@ -38,23 +38,9 @@ func ParseExtensionID(input string) (*ExtensionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExtensionId{} - - 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.MachineName, ok = parsed.Parsed["machineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machineName", *parsed) - } - - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseExtensionIDInsensitively(input string) (*ExtensionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExtensionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ExtensionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MachineName, ok = parsed.Parsed["machineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machineName", *parsed) + if id.MachineName, ok = input.Parsed["machineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "machineName", input) } - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if id.ExtensionName, ok = input.Parsed["extensionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "extensionName", input) } - return &id, nil + return nil } // ValidateExtensionID checks that 'input' can be parsed as a Extension ID diff --git a/resource-manager/hybridcompute/2022-12-27/machineextensions/id_machine.go b/resource-manager/hybridcompute/2022-12-27/machineextensions/id_machine.go index c0b9021b934..4799cd5e097 100644 --- a/resource-manager/hybridcompute/2022-12-27/machineextensions/id_machine.go +++ b/resource-manager/hybridcompute/2022-12-27/machineextensions/id_machine.go @@ -36,19 +36,9 @@ func ParseMachineID(input string) (*MachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MachineId{} - - 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.MachineName, ok = parsed.Parsed["machineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMachineIDInsensitively(input string) (*MachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MachineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MachineName, ok = parsed.Parsed["machineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machineName", *parsed) + if id.MachineName, ok = input.Parsed["machineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "machineName", input) } - return &id, nil + return nil } // ValidateMachineID checks that 'input' can be parsed as a Machine ID diff --git a/resource-manager/hybridcompute/2022-12-27/machineextensionsupgrade/id_machine.go b/resource-manager/hybridcompute/2022-12-27/machineextensionsupgrade/id_machine.go index 080feeded24..b4b26265ce7 100644 --- a/resource-manager/hybridcompute/2022-12-27/machineextensionsupgrade/id_machine.go +++ b/resource-manager/hybridcompute/2022-12-27/machineextensionsupgrade/id_machine.go @@ -36,19 +36,9 @@ func ParseMachineID(input string) (*MachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MachineId{} - - 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.MachineName, ok = parsed.Parsed["machineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMachineIDInsensitively(input string) (*MachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MachineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MachineName, ok = parsed.Parsed["machineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machineName", *parsed) + if id.MachineName, ok = input.Parsed["machineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "machineName", input) } - return &id, nil + return nil } // ValidateMachineID checks that 'input' can be parsed as a Machine ID diff --git a/resource-manager/hybridcompute/2022-12-27/machinenetworkprofile/id_machine.go b/resource-manager/hybridcompute/2022-12-27/machinenetworkprofile/id_machine.go index 9f03c10998e..c626d028aba 100644 --- a/resource-manager/hybridcompute/2022-12-27/machinenetworkprofile/id_machine.go +++ b/resource-manager/hybridcompute/2022-12-27/machinenetworkprofile/id_machine.go @@ -36,19 +36,9 @@ func ParseMachineID(input string) (*MachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MachineId{} - - 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.MachineName, ok = parsed.Parsed["machineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMachineIDInsensitively(input string) (*MachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MachineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MachineName, ok = parsed.Parsed["machineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machineName", *parsed) + if id.MachineName, ok = input.Parsed["machineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "machineName", input) } - return &id, nil + return nil } // ValidateMachineID checks that 'input' can be parsed as a Machine ID diff --git a/resource-manager/hybridcompute/2022-12-27/machines/id_machine.go b/resource-manager/hybridcompute/2022-12-27/machines/id_machine.go index add72d0ad9a..49cabf0d05d 100644 --- a/resource-manager/hybridcompute/2022-12-27/machines/id_machine.go +++ b/resource-manager/hybridcompute/2022-12-27/machines/id_machine.go @@ -36,19 +36,9 @@ func ParseMachineID(input string) (*MachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MachineId{} - - 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.MachineName, ok = parsed.Parsed["machineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMachineIDInsensitively(input string) (*MachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MachineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MachineName, ok = parsed.Parsed["machineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machineName", *parsed) + if id.MachineName, ok = input.Parsed["machineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "machineName", input) } - return &id, nil + return nil } // ValidateMachineID checks that 'input' can be parsed as a Machine ID diff --git a/resource-manager/hybridcompute/2022-12-27/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/hybridcompute/2022-12-27/privateendpointconnections/id_privateendpointconnection.go index 11d1e8ee2a6..cc795c503ae 100644 --- a/resource-manager/hybridcompute/2022-12-27/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/hybridcompute/2022-12-27/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.PrivateLinkScopeName, ok = parsed.Parsed["privateLinkScopeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateLinkScopeName, ok = parsed.Parsed["privateLinkScopeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", *parsed) + if id.PrivateLinkScopeName, ok = input.Parsed["privateLinkScopeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/hybridcompute/2022-12-27/privateendpointconnections/id_providerprivatelinkscope.go b/resource-manager/hybridcompute/2022-12-27/privateendpointconnections/id_providerprivatelinkscope.go index 282da81e836..3f5a1d4213d 100644 --- a/resource-manager/hybridcompute/2022-12-27/privateendpointconnections/id_providerprivatelinkscope.go +++ b/resource-manager/hybridcompute/2022-12-27/privateendpointconnections/id_providerprivatelinkscope.go @@ -36,19 +36,9 @@ func ParseProviderPrivateLinkScopeID(input string) (*ProviderPrivateLinkScopeId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderPrivateLinkScopeId{} - - 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.PrivateLinkScopeName, ok = parsed.Parsed["privateLinkScopeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderPrivateLinkScopeIDInsensitively(input string) (*ProviderPrivat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderPrivateLinkScopeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderPrivateLinkScopeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateLinkScopeName, ok = parsed.Parsed["privateLinkScopeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", *parsed) + if id.PrivateLinkScopeName, ok = input.Parsed["privateLinkScopeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", input) } - return &id, nil + return nil } // ValidateProviderPrivateLinkScopeID checks that 'input' can be parsed as a Provider Private Link Scope ID diff --git a/resource-manager/hybridcompute/2022-12-27/privatelinkresources/id_privatelinkresource.go b/resource-manager/hybridcompute/2022-12-27/privatelinkresources/id_privatelinkresource.go index 2d7af25d900..c320eec774f 100644 --- a/resource-manager/hybridcompute/2022-12-27/privatelinkresources/id_privatelinkresource.go +++ b/resource-manager/hybridcompute/2022-12-27/privatelinkresources/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.PrivateLinkScopeName, ok = parsed.Parsed["privateLinkScopeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", *parsed) - } - - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateLinkScopeName, ok = parsed.Parsed["privateLinkScopeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", *parsed) + if id.PrivateLinkScopeName, ok = input.Parsed["privateLinkScopeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/hybridcompute/2022-12-27/privatelinkresources/id_providerprivatelinkscope.go b/resource-manager/hybridcompute/2022-12-27/privatelinkresources/id_providerprivatelinkscope.go index 6237d571e4d..4d2883ae988 100644 --- a/resource-manager/hybridcompute/2022-12-27/privatelinkresources/id_providerprivatelinkscope.go +++ b/resource-manager/hybridcompute/2022-12-27/privatelinkresources/id_providerprivatelinkscope.go @@ -36,19 +36,9 @@ func ParseProviderPrivateLinkScopeID(input string) (*ProviderPrivateLinkScopeId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderPrivateLinkScopeId{} - - 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.PrivateLinkScopeName, ok = parsed.Parsed["privateLinkScopeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderPrivateLinkScopeIDInsensitively(input string) (*ProviderPrivat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderPrivateLinkScopeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderPrivateLinkScopeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateLinkScopeName, ok = parsed.Parsed["privateLinkScopeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", *parsed) + if id.PrivateLinkScopeName, ok = input.Parsed["privateLinkScopeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", input) } - return &id, nil + return nil } // ValidateProviderPrivateLinkScopeID checks that 'input' can be parsed as a Provider Private Link Scope ID diff --git a/resource-manager/hybridcompute/2022-12-27/privatelinkscopes/id_machine.go b/resource-manager/hybridcompute/2022-12-27/privatelinkscopes/id_machine.go index 7951d8dac25..f3cba6e107a 100644 --- a/resource-manager/hybridcompute/2022-12-27/privatelinkscopes/id_machine.go +++ b/resource-manager/hybridcompute/2022-12-27/privatelinkscopes/id_machine.go @@ -36,19 +36,9 @@ func ParseMachineID(input string) (*MachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MachineId{} - - 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.MachineName, ok = parsed.Parsed["machineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMachineIDInsensitively(input string) (*MachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MachineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MachineName, ok = parsed.Parsed["machineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machineName", *parsed) + if id.MachineName, ok = input.Parsed["machineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "machineName", input) } - return &id, nil + return nil } // ValidateMachineID checks that 'input' can be parsed as a Machine ID diff --git a/resource-manager/hybridcompute/2022-12-27/privatelinkscopes/id_privatelinkscope.go b/resource-manager/hybridcompute/2022-12-27/privatelinkscopes/id_privatelinkscope.go index 3b203dc4b29..5f650bf2ddb 100644 --- a/resource-manager/hybridcompute/2022-12-27/privatelinkscopes/id_privatelinkscope.go +++ b/resource-manager/hybridcompute/2022-12-27/privatelinkscopes/id_privatelinkscope.go @@ -36,19 +36,9 @@ func ParsePrivateLinkScopeID(input string) (*PrivateLinkScopeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkScopeId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.PrivateLinkScopeId, ok = parsed.Parsed["privateLinkScopeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePrivateLinkScopeIDInsensitively(input string) (*PrivateLinkScopeId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkScopeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PrivateLinkScopeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.PrivateLinkScopeId, ok = parsed.Parsed["privateLinkScopeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeId", *parsed) + if id.PrivateLinkScopeId, ok = input.Parsed["privateLinkScopeId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeId", input) } - return &id, nil + return nil } // ValidatePrivateLinkScopeID checks that 'input' can be parsed as a Private Link Scope ID diff --git a/resource-manager/hybridcompute/2022-12-27/privatelinkscopes/id_providerprivatelinkscope.go b/resource-manager/hybridcompute/2022-12-27/privatelinkscopes/id_providerprivatelinkscope.go index 6e9d5c41743..ae6ffd8daf7 100644 --- a/resource-manager/hybridcompute/2022-12-27/privatelinkscopes/id_providerprivatelinkscope.go +++ b/resource-manager/hybridcompute/2022-12-27/privatelinkscopes/id_providerprivatelinkscope.go @@ -36,19 +36,9 @@ func ParseProviderPrivateLinkScopeID(input string) (*ProviderPrivateLinkScopeId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderPrivateLinkScopeId{} - - 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.PrivateLinkScopeName, ok = parsed.Parsed["privateLinkScopeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderPrivateLinkScopeIDInsensitively(input string) (*ProviderPrivat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderPrivateLinkScopeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderPrivateLinkScopeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateLinkScopeName, ok = parsed.Parsed["privateLinkScopeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", *parsed) + if id.PrivateLinkScopeName, ok = input.Parsed["privateLinkScopeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", input) } - return &id, nil + return nil } // ValidateProviderPrivateLinkScopeID checks that 'input' can be parsed as a Provider Private Link Scope ID diff --git a/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/id_connectedcluster.go b/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/id_connectedcluster.go index d12260a303b..5d31ea4b9ef 100644 --- a/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/id_connectedcluster.go +++ b/resource-manager/hybridkubernetes/2021-10-01/connectedclusters/id_connectedcluster.go @@ -36,19 +36,9 @@ func ParseConnectedClusterID(input string) (*ConnectedClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectedClusterId{} - - 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.ConnectedClusterName, ok = parsed.Parsed["connectedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectedClusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseConnectedClusterIDInsensitively(input string) (*ConnectedClusterId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectedClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ConnectedClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ConnectedClusterName, ok = parsed.Parsed["connectedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectedClusterName", *parsed) + if id.ConnectedClusterName, ok = input.Parsed["connectedClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectedClusterName", input) } - return &id, nil + return nil } // ValidateConnectedClusterID checks that 'input' can be parsed as a Connected Cluster ID diff --git a/resource-manager/insights/2015-04-01/autoscaleapis/id_autoscalesetting.go b/resource-manager/insights/2015-04-01/autoscaleapis/id_autoscalesetting.go index 69e49b74a3f..f83855511c7 100644 --- a/resource-manager/insights/2015-04-01/autoscaleapis/id_autoscalesetting.go +++ b/resource-manager/insights/2015-04-01/autoscaleapis/id_autoscalesetting.go @@ -36,19 +36,9 @@ func ParseAutoScaleSettingID(input string) (*AutoScaleSettingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutoScaleSettingId{} - - 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.AutoScaleSettingName, ok = parsed.Parsed["autoScaleSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "autoScaleSettingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutoScaleSettingIDInsensitively(input string) (*AutoScaleSettingId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutoScaleSettingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutoScaleSettingId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutoScaleSettingName, ok = parsed.Parsed["autoScaleSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "autoScaleSettingName", *parsed) + if id.AutoScaleSettingName, ok = input.Parsed["autoScaleSettingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "autoScaleSettingName", input) } - return &id, nil + return nil } // ValidateAutoScaleSettingID checks that 'input' can be parsed as a Auto Scale Setting ID diff --git a/resource-manager/insights/2015-04-01/autoscalesettings/id_autoscalesetting.go b/resource-manager/insights/2015-04-01/autoscalesettings/id_autoscalesetting.go index 644f83c6dda..77f59d611b1 100644 --- a/resource-manager/insights/2015-04-01/autoscalesettings/id_autoscalesetting.go +++ b/resource-manager/insights/2015-04-01/autoscalesettings/id_autoscalesetting.go @@ -36,19 +36,9 @@ func ParseAutoScaleSettingID(input string) (*AutoScaleSettingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutoScaleSettingId{} - - 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.AutoScaleSettingName, ok = parsed.Parsed["autoScaleSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "autoScaleSettingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutoScaleSettingIDInsensitively(input string) (*AutoScaleSettingId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutoScaleSettingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutoScaleSettingId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutoScaleSettingName, ok = parsed.Parsed["autoScaleSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "autoScaleSettingName", *parsed) + if id.AutoScaleSettingName, ok = input.Parsed["autoScaleSettingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "autoScaleSettingName", input) } - return &id, nil + return nil } // ValidateAutoScaleSettingID checks that 'input' can be parsed as a Auto Scale Setting ID diff --git a/resource-manager/insights/2016-03-01/alertruleincidents/id_alertrule.go b/resource-manager/insights/2016-03-01/alertruleincidents/id_alertrule.go index 22c155042c9..62a73e15b2a 100644 --- a/resource-manager/insights/2016-03-01/alertruleincidents/id_alertrule.go +++ b/resource-manager/insights/2016-03-01/alertruleincidents/id_alertrule.go @@ -36,19 +36,9 @@ func ParseAlertRuleID(input string) (*AlertRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertRuleId{} - - 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.AlertRuleName, ok = parsed.Parsed["alertRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "alertRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAlertRuleIDInsensitively(input string) (*AlertRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AlertRuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AlertRuleName, ok = parsed.Parsed["alertRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "alertRuleName", *parsed) + if id.AlertRuleName, ok = input.Parsed["alertRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "alertRuleName", input) } - return &id, nil + return nil } // ValidateAlertRuleID checks that 'input' can be parsed as a Alert Rule ID diff --git a/resource-manager/insights/2016-03-01/alertruleincidents/id_incident.go b/resource-manager/insights/2016-03-01/alertruleincidents/id_incident.go index 0a4956f1c12..559018871fb 100644 --- a/resource-manager/insights/2016-03-01/alertruleincidents/id_incident.go +++ b/resource-manager/insights/2016-03-01/alertruleincidents/id_incident.go @@ -38,23 +38,9 @@ func ParseIncidentID(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} - - 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.AlertRuleName, ok = parsed.Parsed["alertRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "alertRuleName", *parsed) - } - - if id.IncidentName, ok = parsed.Parsed["incidentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIncidentIDInsensitively(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IncidentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AlertRuleName, ok = parsed.Parsed["alertRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "alertRuleName", *parsed) + if id.AlertRuleName, ok = input.Parsed["alertRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "alertRuleName", input) } - if id.IncidentName, ok = parsed.Parsed["incidentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentName", *parsed) + if id.IncidentName, ok = input.Parsed["incidentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentName", input) } - return &id, nil + return nil } // ValidateIncidentID checks that 'input' can be parsed as a Incident ID diff --git a/resource-manager/insights/2016-03-01/alertrules/id_alertrule.go b/resource-manager/insights/2016-03-01/alertrules/id_alertrule.go index 445e1016bbb..23b771f4439 100644 --- a/resource-manager/insights/2016-03-01/alertrules/id_alertrule.go +++ b/resource-manager/insights/2016-03-01/alertrules/id_alertrule.go @@ -36,19 +36,9 @@ func ParseAlertRuleID(input string) (*AlertRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertRuleId{} - - 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.AlertRuleName, ok = parsed.Parsed["alertRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "alertRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAlertRuleIDInsensitively(input string) (*AlertRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AlertRuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AlertRuleName, ok = parsed.Parsed["alertRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "alertRuleName", *parsed) + if id.AlertRuleName, ok = input.Parsed["alertRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "alertRuleName", input) } - return &id, nil + return nil } // ValidateAlertRuleID checks that 'input' can be parsed as a Alert Rule ID diff --git a/resource-manager/insights/2016-03-01/alertrulesapis/id_alertrule.go b/resource-manager/insights/2016-03-01/alertrulesapis/id_alertrule.go index c00ecc54f13..2779794e29a 100644 --- a/resource-manager/insights/2016-03-01/alertrulesapis/id_alertrule.go +++ b/resource-manager/insights/2016-03-01/alertrulesapis/id_alertrule.go @@ -36,19 +36,9 @@ func ParseAlertRuleID(input string) (*AlertRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertRuleId{} - - 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.AlertRuleName, ok = parsed.Parsed["alertRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "alertRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAlertRuleIDInsensitively(input string) (*AlertRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AlertRuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AlertRuleName, ok = parsed.Parsed["alertRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "alertRuleName", *parsed) + if id.AlertRuleName, ok = input.Parsed["alertRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "alertRuleName", input) } - return &id, nil + return nil } // ValidateAlertRuleID checks that 'input' can be parsed as a Alert Rule ID diff --git a/resource-manager/insights/2016-03-01/logprofiles/id_logprofile.go b/resource-manager/insights/2016-03-01/logprofiles/id_logprofile.go index 03469edde3a..988f98418f4 100644 --- a/resource-manager/insights/2016-03-01/logprofiles/id_logprofile.go +++ b/resource-manager/insights/2016-03-01/logprofiles/id_logprofile.go @@ -34,15 +34,9 @@ func ParseLogProfileID(input string) (*LogProfileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LogProfileId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LogProfileName, ok = parsed.Parsed["logProfileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "logProfileName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLogProfileIDInsensitively(input string) (*LogProfileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LogProfileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LogProfileId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LogProfileName, ok = parsed.Parsed["logProfileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "logProfileName", *parsed) + if id.LogProfileName, ok = input.Parsed["logProfileName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "logProfileName", input) } - return &id, nil + return nil } // ValidateLogProfileID checks that 'input' can be parsed as a Log Profile ID diff --git a/resource-manager/insights/2016-03-01/logprofilesapis/id_logprofile.go b/resource-manager/insights/2016-03-01/logprofilesapis/id_logprofile.go index 7693f050aa4..319b8946799 100644 --- a/resource-manager/insights/2016-03-01/logprofilesapis/id_logprofile.go +++ b/resource-manager/insights/2016-03-01/logprofilesapis/id_logprofile.go @@ -34,15 +34,9 @@ func ParseLogProfileID(input string) (*LogProfileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LogProfileId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LogProfileName, ok = parsed.Parsed["logProfileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "logProfileName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLogProfileIDInsensitively(input string) (*LogProfileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LogProfileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LogProfileId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LogProfileName, ok = parsed.Parsed["logProfileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "logProfileName", *parsed) + if id.LogProfileName, ok = input.Parsed["logProfileName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "logProfileName", input) } - return &id, nil + return nil } // ValidateLogProfileID checks that 'input' can be parsed as a Log Profile ID diff --git a/resource-manager/insights/2018-03-01/actiongroupsapis/id_actiongroup.go b/resource-manager/insights/2018-03-01/actiongroupsapis/id_actiongroup.go index f2ba4317c8f..32ec4c27e3d 100644 --- a/resource-manager/insights/2018-03-01/actiongroupsapis/id_actiongroup.go +++ b/resource-manager/insights/2018-03-01/actiongroupsapis/id_actiongroup.go @@ -36,19 +36,9 @@ func ParseActionGroupID(input string) (*ActionGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ActionGroupId{} - - 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.ActionGroupName, ok = parsed.Parsed["actionGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseActionGroupIDInsensitively(input string) (*ActionGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ActionGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ActionGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ActionGroupName, ok = parsed.Parsed["actionGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionGroupName", *parsed) + if id.ActionGroupName, ok = input.Parsed["actionGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "actionGroupName", input) } - return &id, nil + return nil } // ValidateActionGroupID checks that 'input' can be parsed as a Action Group ID diff --git a/resource-manager/insights/2018-03-01/metricalerts/id_metricalert.go b/resource-manager/insights/2018-03-01/metricalerts/id_metricalert.go index f524bc1649e..41c8cad9632 100644 --- a/resource-manager/insights/2018-03-01/metricalerts/id_metricalert.go +++ b/resource-manager/insights/2018-03-01/metricalerts/id_metricalert.go @@ -36,19 +36,9 @@ func ParseMetricAlertID(input string) (*MetricAlertId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MetricAlertId{} - - 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.MetricAlertName, ok = parsed.Parsed["metricAlertName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "metricAlertName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMetricAlertIDInsensitively(input string) (*MetricAlertId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MetricAlertId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MetricAlertId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MetricAlertName, ok = parsed.Parsed["metricAlertName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "metricAlertName", *parsed) + if id.MetricAlertName, ok = input.Parsed["metricAlertName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "metricAlertName", input) } - return &id, nil + return nil } // ValidateMetricAlertID checks that 'input' can be parsed as a Metric Alert ID diff --git a/resource-manager/insights/2018-03-01/metricalertsstatus/id_metricalert.go b/resource-manager/insights/2018-03-01/metricalertsstatus/id_metricalert.go index 36b4de2a48e..c52585a672e 100644 --- a/resource-manager/insights/2018-03-01/metricalertsstatus/id_metricalert.go +++ b/resource-manager/insights/2018-03-01/metricalertsstatus/id_metricalert.go @@ -36,19 +36,9 @@ func ParseMetricAlertID(input string) (*MetricAlertId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MetricAlertId{} - - 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.MetricAlertName, ok = parsed.Parsed["metricAlertName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "metricAlertName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMetricAlertIDInsensitively(input string) (*MetricAlertId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MetricAlertId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MetricAlertId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MetricAlertName, ok = parsed.Parsed["metricAlertName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "metricAlertName", *parsed) + if id.MetricAlertName, ok = input.Parsed["metricAlertName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "metricAlertName", input) } - return &id, nil + return nil } // ValidateMetricAlertID checks that 'input' can be parsed as a Metric Alert ID diff --git a/resource-manager/insights/2018-03-01/metricalertsstatus/id_status.go b/resource-manager/insights/2018-03-01/metricalertsstatus/id_status.go index dc26b5a9f16..629c28273b3 100644 --- a/resource-manager/insights/2018-03-01/metricalertsstatus/id_status.go +++ b/resource-manager/insights/2018-03-01/metricalertsstatus/id_status.go @@ -38,23 +38,9 @@ func ParseStatusID(input string) (*StatusId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StatusId{} - - 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.MetricAlertName, ok = parsed.Parsed["metricAlertName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "metricAlertName", *parsed) - } - - if id.StatusName, ok = parsed.Parsed["statusName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "statusName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseStatusIDInsensitively(input string) (*StatusId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StatusId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *StatusId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MetricAlertName, ok = parsed.Parsed["metricAlertName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "metricAlertName", *parsed) + if id.MetricAlertName, ok = input.Parsed["metricAlertName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "metricAlertName", input) } - if id.StatusName, ok = parsed.Parsed["statusName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "statusName", *parsed) + if id.StatusName, ok = input.Parsed["statusName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "statusName", input) } - return &id, nil + return nil } // ValidateStatusID checks that 'input' can be parsed as a Status ID diff --git a/resource-manager/insights/2018-04-16/scheduledqueryrules/id_scheduledqueryrule.go b/resource-manager/insights/2018-04-16/scheduledqueryrules/id_scheduledqueryrule.go index 207457784c9..0ecc11dd152 100644 --- a/resource-manager/insights/2018-04-16/scheduledqueryrules/id_scheduledqueryrule.go +++ b/resource-manager/insights/2018-04-16/scheduledqueryrules/id_scheduledqueryrule.go @@ -36,19 +36,9 @@ func ParseScheduledQueryRuleID(input string) (*ScheduledQueryRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScheduledQueryRuleId{} - - 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.ScheduledQueryRuleName, ok = parsed.Parsed["scheduledQueryRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduledQueryRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseScheduledQueryRuleIDInsensitively(input string) (*ScheduledQueryRuleId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScheduledQueryRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ScheduledQueryRuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ScheduledQueryRuleName, ok = parsed.Parsed["scheduledQueryRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduledQueryRuleName", *parsed) + if id.ScheduledQueryRuleName, ok = input.Parsed["scheduledQueryRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scheduledQueryRuleName", input) } - return &id, nil + return nil } // ValidateScheduledQueryRuleID checks that 'input' can be parsed as a Scheduled Query Rule ID diff --git a/resource-manager/insights/2019-10-17-preview/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/insights/2019-10-17-preview/privateendpointconnections/id_privateendpointconnection.go index dbf93e55744..b3addc443ed 100644 --- a/resource-manager/insights/2019-10-17-preview/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/insights/2019-10-17-preview/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.PrivateLinkScopeName, ok = parsed.Parsed["privateLinkScopeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateLinkScopeName, ok = parsed.Parsed["privateLinkScopeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", *parsed) + if id.PrivateLinkScopeName, ok = input.Parsed["privateLinkScopeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/insights/2019-10-17-preview/privateendpointconnections/id_privatelinkscope.go b/resource-manager/insights/2019-10-17-preview/privateendpointconnections/id_privatelinkscope.go index 6a1dd248a46..b1dea305ca5 100644 --- a/resource-manager/insights/2019-10-17-preview/privateendpointconnections/id_privatelinkscope.go +++ b/resource-manager/insights/2019-10-17-preview/privateendpointconnections/id_privatelinkscope.go @@ -36,19 +36,9 @@ func ParsePrivateLinkScopeID(input string) (*PrivateLinkScopeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkScopeId{} - - 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.PrivateLinkScopeName, ok = parsed.Parsed["privateLinkScopeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePrivateLinkScopeIDInsensitively(input string) (*PrivateLinkScopeId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkScopeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PrivateLinkScopeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateLinkScopeName, ok = parsed.Parsed["privateLinkScopeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", *parsed) + if id.PrivateLinkScopeName, ok = input.Parsed["privateLinkScopeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", input) } - return &id, nil + return nil } // ValidatePrivateLinkScopeID checks that 'input' can be parsed as a Private Link Scope ID diff --git a/resource-manager/insights/2019-10-17-preview/privatelinkresources/id_privatelinkresource.go b/resource-manager/insights/2019-10-17-preview/privatelinkresources/id_privatelinkresource.go index 6cb94335eac..21946a344d2 100644 --- a/resource-manager/insights/2019-10-17-preview/privatelinkresources/id_privatelinkresource.go +++ b/resource-manager/insights/2019-10-17-preview/privatelinkresources/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.PrivateLinkScopeName, ok = parsed.Parsed["privateLinkScopeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", *parsed) - } - - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateLinkScopeName, ok = parsed.Parsed["privateLinkScopeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", *parsed) + if id.PrivateLinkScopeName, ok = input.Parsed["privateLinkScopeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/insights/2019-10-17-preview/privatelinkresources/id_privatelinkscope.go b/resource-manager/insights/2019-10-17-preview/privatelinkresources/id_privatelinkscope.go index 2eafe3146dc..a835dad5cb3 100644 --- a/resource-manager/insights/2019-10-17-preview/privatelinkresources/id_privatelinkscope.go +++ b/resource-manager/insights/2019-10-17-preview/privatelinkresources/id_privatelinkscope.go @@ -36,19 +36,9 @@ func ParsePrivateLinkScopeID(input string) (*PrivateLinkScopeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkScopeId{} - - 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.PrivateLinkScopeName, ok = parsed.Parsed["privateLinkScopeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePrivateLinkScopeIDInsensitively(input string) (*PrivateLinkScopeId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkScopeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PrivateLinkScopeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateLinkScopeName, ok = parsed.Parsed["privateLinkScopeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", *parsed) + if id.PrivateLinkScopeName, ok = input.Parsed["privateLinkScopeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", input) } - return &id, nil + return nil } // ValidatePrivateLinkScopeID checks that 'input' can be parsed as a Private Link Scope ID diff --git a/resource-manager/insights/2019-10-17-preview/privatelinkscopedresources/id_privatelinkscope.go b/resource-manager/insights/2019-10-17-preview/privatelinkscopedresources/id_privatelinkscope.go index 14c15134e8f..38ea52f134f 100644 --- a/resource-manager/insights/2019-10-17-preview/privatelinkscopedresources/id_privatelinkscope.go +++ b/resource-manager/insights/2019-10-17-preview/privatelinkscopedresources/id_privatelinkscope.go @@ -36,19 +36,9 @@ func ParsePrivateLinkScopeID(input string) (*PrivateLinkScopeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkScopeId{} - - 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.PrivateLinkScopeName, ok = parsed.Parsed["privateLinkScopeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePrivateLinkScopeIDInsensitively(input string) (*PrivateLinkScopeId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkScopeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PrivateLinkScopeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateLinkScopeName, ok = parsed.Parsed["privateLinkScopeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", *parsed) + if id.PrivateLinkScopeName, ok = input.Parsed["privateLinkScopeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", input) } - return &id, nil + return nil } // ValidatePrivateLinkScopeID checks that 'input' can be parsed as a Private Link Scope ID diff --git a/resource-manager/insights/2019-10-17-preview/privatelinkscopedresources/id_scopedresource.go b/resource-manager/insights/2019-10-17-preview/privatelinkscopedresources/id_scopedresource.go index 92aed9436da..488dfa3d4d4 100644 --- a/resource-manager/insights/2019-10-17-preview/privatelinkscopedresources/id_scopedresource.go +++ b/resource-manager/insights/2019-10-17-preview/privatelinkscopedresources/id_scopedresource.go @@ -38,23 +38,9 @@ func ParseScopedResourceID(input string) (*ScopedResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedResourceId{} - - 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.PrivateLinkScopeName, ok = parsed.Parsed["privateLinkScopeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", *parsed) - } - - if id.ScopedResourceName, ok = parsed.Parsed["scopedResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scopedResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseScopedResourceIDInsensitively(input string) (*ScopedResourceId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ScopedResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateLinkScopeName, ok = parsed.Parsed["privateLinkScopeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", *parsed) + if id.PrivateLinkScopeName, ok = input.Parsed["privateLinkScopeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", input) } - if id.ScopedResourceName, ok = parsed.Parsed["scopedResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scopedResourceName", *parsed) + if id.ScopedResourceName, ok = input.Parsed["scopedResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scopedResourceName", input) } - return &id, nil + return nil } // ValidateScopedResourceID checks that 'input' can be parsed as a Scoped Resource ID diff --git a/resource-manager/insights/2019-10-17-preview/privatelinkscopesapis/id_privatelinkscope.go b/resource-manager/insights/2019-10-17-preview/privatelinkscopesapis/id_privatelinkscope.go index 416ee1ca951..6b304bc4c13 100644 --- a/resource-manager/insights/2019-10-17-preview/privatelinkscopesapis/id_privatelinkscope.go +++ b/resource-manager/insights/2019-10-17-preview/privatelinkscopesapis/id_privatelinkscope.go @@ -36,19 +36,9 @@ func ParsePrivateLinkScopeID(input string) (*PrivateLinkScopeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkScopeId{} - - 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.PrivateLinkScopeName, ok = parsed.Parsed["privateLinkScopeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePrivateLinkScopeIDInsensitively(input string) (*PrivateLinkScopeId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkScopeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PrivateLinkScopeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateLinkScopeName, ok = parsed.Parsed["privateLinkScopeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", *parsed) + if id.PrivateLinkScopeName, ok = input.Parsed["privateLinkScopeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkScopeName", input) } - return &id, nil + return nil } // ValidatePrivateLinkScopeID checks that 'input' can be parsed as a Private Link Scope ID diff --git a/resource-manager/insights/2020-10-01/activitylogalertsapis/id_activitylogalert.go b/resource-manager/insights/2020-10-01/activitylogalertsapis/id_activitylogalert.go index 88860ef3b81..1e5094f9203 100644 --- a/resource-manager/insights/2020-10-01/activitylogalertsapis/id_activitylogalert.go +++ b/resource-manager/insights/2020-10-01/activitylogalertsapis/id_activitylogalert.go @@ -36,19 +36,9 @@ func ParseActivityLogAlertID(input string) (*ActivityLogAlertId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ActivityLogAlertId{} - - 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.ActivityLogAlertName, ok = parsed.Parsed["activityLogAlertName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "activityLogAlertName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseActivityLogAlertIDInsensitively(input string) (*ActivityLogAlertId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ActivityLogAlertId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ActivityLogAlertId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ActivityLogAlertName, ok = parsed.Parsed["activityLogAlertName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "activityLogAlertName", *parsed) + if id.ActivityLogAlertName, ok = input.Parsed["activityLogAlertName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "activityLogAlertName", input) } - return &id, nil + return nil } // ValidateActivityLogAlertID checks that 'input' can be parsed as a Activity Log Alert ID diff --git a/resource-manager/insights/2021-04-01/datacollectionendpoints/id_datacollectionendpoint.go b/resource-manager/insights/2021-04-01/datacollectionendpoints/id_datacollectionendpoint.go index e7424e56fc6..5d237fc686b 100644 --- a/resource-manager/insights/2021-04-01/datacollectionendpoints/id_datacollectionendpoint.go +++ b/resource-manager/insights/2021-04-01/datacollectionendpoints/id_datacollectionendpoint.go @@ -36,19 +36,9 @@ func ParseDataCollectionEndpointID(input string) (*DataCollectionEndpointId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataCollectionEndpointId{} - - 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.DataCollectionEndpointName, ok = parsed.Parsed["dataCollectionEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataCollectionEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDataCollectionEndpointIDInsensitively(input string) (*DataCollectionEn return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataCollectionEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DataCollectionEndpointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataCollectionEndpointName, ok = parsed.Parsed["dataCollectionEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataCollectionEndpointName", *parsed) + if id.DataCollectionEndpointName, ok = input.Parsed["dataCollectionEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataCollectionEndpointName", input) } - return &id, nil + return nil } // ValidateDataCollectionEndpointID checks that 'input' can be parsed as a Data Collection Endpoint ID diff --git a/resource-manager/insights/2021-04-01/datacollectionruleassociations/id_datacollectionrule.go b/resource-manager/insights/2021-04-01/datacollectionruleassociations/id_datacollectionrule.go index e2e0bc59334..f388ed1069a 100644 --- a/resource-manager/insights/2021-04-01/datacollectionruleassociations/id_datacollectionrule.go +++ b/resource-manager/insights/2021-04-01/datacollectionruleassociations/id_datacollectionrule.go @@ -36,19 +36,9 @@ func ParseDataCollectionRuleID(input string) (*DataCollectionRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataCollectionRuleId{} - - 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.DataCollectionRuleName, ok = parsed.Parsed["dataCollectionRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataCollectionRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDataCollectionRuleIDInsensitively(input string) (*DataCollectionRuleId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataCollectionRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DataCollectionRuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataCollectionRuleName, ok = parsed.Parsed["dataCollectionRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataCollectionRuleName", *parsed) + if id.DataCollectionRuleName, ok = input.Parsed["dataCollectionRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataCollectionRuleName", input) } - return &id, nil + return nil } // ValidateDataCollectionRuleID checks that 'input' can be parsed as a Data Collection Rule ID diff --git a/resource-manager/insights/2021-04-01/datacollectionruleassociations/id_scopeddatacollectionruleassociation.go b/resource-manager/insights/2021-04-01/datacollectionruleassociations/id_scopeddatacollectionruleassociation.go index 182e95d4d71..562d6b0fcc4 100644 --- a/resource-manager/insights/2021-04-01/datacollectionruleassociations/id_scopeddatacollectionruleassociation.go +++ b/resource-manager/insights/2021-04-01/datacollectionruleassociations/id_scopeddatacollectionruleassociation.go @@ -34,15 +34,9 @@ func ParseScopedDataCollectionRuleAssociationID(input string) (*ScopedDataCollec return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedDataCollectionRuleAssociationId{} - - if id.ResourceUri, ok = parsed.Parsed["resourceUri"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceUri", *parsed) - } - - if id.DataCollectionRuleAssociationName, ok = parsed.Parsed["dataCollectionRuleAssociationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataCollectionRuleAssociationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedDataCollectionRuleAssociationIDInsensitively(input string) (*Sco return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedDataCollectionRuleAssociationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ResourceUri, ok = parsed.Parsed["resourceUri"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceUri", *parsed) + return &id, nil +} + +func (id *ScopedDataCollectionRuleAssociationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ResourceUri, ok = input.Parsed["resourceUri"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceUri", input) } - if id.DataCollectionRuleAssociationName, ok = parsed.Parsed["dataCollectionRuleAssociationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataCollectionRuleAssociationName", *parsed) + if id.DataCollectionRuleAssociationName, ok = input.Parsed["dataCollectionRuleAssociationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataCollectionRuleAssociationName", input) } - return &id, nil + return nil } // ValidateScopedDataCollectionRuleAssociationID checks that 'input' can be parsed as a Scoped Data Collection Rule Association ID diff --git a/resource-manager/insights/2021-04-01/datacollectionrules/id_datacollectionrule.go b/resource-manager/insights/2021-04-01/datacollectionrules/id_datacollectionrule.go index e48332f7101..3205675d8c7 100644 --- a/resource-manager/insights/2021-04-01/datacollectionrules/id_datacollectionrule.go +++ b/resource-manager/insights/2021-04-01/datacollectionrules/id_datacollectionrule.go @@ -36,19 +36,9 @@ func ParseDataCollectionRuleID(input string) (*DataCollectionRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataCollectionRuleId{} - - 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.DataCollectionRuleName, ok = parsed.Parsed["dataCollectionRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataCollectionRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDataCollectionRuleIDInsensitively(input string) (*DataCollectionRuleId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataCollectionRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DataCollectionRuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataCollectionRuleName, ok = parsed.Parsed["dataCollectionRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataCollectionRuleName", *parsed) + if id.DataCollectionRuleName, ok = input.Parsed["dataCollectionRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataCollectionRuleName", input) } - return &id, nil + return nil } // ValidateDataCollectionRuleID checks that 'input' can be parsed as a Data Collection Rule ID diff --git a/resource-manager/insights/2021-05-01-preview/autoscaleapis/id_autoscalesetting.go b/resource-manager/insights/2021-05-01-preview/autoscaleapis/id_autoscalesetting.go index 69e49b74a3f..f83855511c7 100644 --- a/resource-manager/insights/2021-05-01-preview/autoscaleapis/id_autoscalesetting.go +++ b/resource-manager/insights/2021-05-01-preview/autoscaleapis/id_autoscalesetting.go @@ -36,19 +36,9 @@ func ParseAutoScaleSettingID(input string) (*AutoScaleSettingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutoScaleSettingId{} - - 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.AutoScaleSettingName, ok = parsed.Parsed["autoScaleSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "autoScaleSettingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutoScaleSettingIDInsensitively(input string) (*AutoScaleSettingId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutoScaleSettingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutoScaleSettingId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutoScaleSettingName, ok = parsed.Parsed["autoScaleSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "autoScaleSettingName", *parsed) + if id.AutoScaleSettingName, ok = input.Parsed["autoScaleSettingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "autoScaleSettingName", input) } - return &id, nil + return nil } // ValidateAutoScaleSettingID checks that 'input' can be parsed as a Auto Scale Setting ID diff --git a/resource-manager/insights/2021-05-01-preview/autoscalesettings/id_autoscalesetting.go b/resource-manager/insights/2021-05-01-preview/autoscalesettings/id_autoscalesetting.go index 644f83c6dda..77f59d611b1 100644 --- a/resource-manager/insights/2021-05-01-preview/autoscalesettings/id_autoscalesetting.go +++ b/resource-manager/insights/2021-05-01-preview/autoscalesettings/id_autoscalesetting.go @@ -36,19 +36,9 @@ func ParseAutoScaleSettingID(input string) (*AutoScaleSettingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutoScaleSettingId{} - - 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.AutoScaleSettingName, ok = parsed.Parsed["autoScaleSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "autoScaleSettingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutoScaleSettingIDInsensitively(input string) (*AutoScaleSettingId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutoScaleSettingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutoScaleSettingId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutoScaleSettingName, ok = parsed.Parsed["autoScaleSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "autoScaleSettingName", *parsed) + if id.AutoScaleSettingName, ok = input.Parsed["autoScaleSettingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "autoScaleSettingName", input) } - return &id, nil + return nil } // ValidateAutoScaleSettingID checks that 'input' can be parsed as a Auto Scale Setting ID diff --git a/resource-manager/insights/2021-05-01-preview/diagnosticsettings/id_scopeddiagnosticsetting.go b/resource-manager/insights/2021-05-01-preview/diagnosticsettings/id_scopeddiagnosticsetting.go index 05d06a04c15..64c775d76f2 100644 --- a/resource-manager/insights/2021-05-01-preview/diagnosticsettings/id_scopeddiagnosticsetting.go +++ b/resource-manager/insights/2021-05-01-preview/diagnosticsettings/id_scopeddiagnosticsetting.go @@ -34,15 +34,9 @@ func ParseScopedDiagnosticSettingID(input string) (*ScopedDiagnosticSettingId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedDiagnosticSettingId{} - - if id.ResourceUri, ok = parsed.Parsed["resourceUri"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceUri", *parsed) - } - - if id.DiagnosticSettingName, ok = parsed.Parsed["diagnosticSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticSettingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedDiagnosticSettingIDInsensitively(input string) (*ScopedDiagnosti return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedDiagnosticSettingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ResourceUri, ok = parsed.Parsed["resourceUri"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceUri", *parsed) + return &id, nil +} + +func (id *ScopedDiagnosticSettingId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ResourceUri, ok = input.Parsed["resourceUri"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceUri", input) } - if id.DiagnosticSettingName, ok = parsed.Parsed["diagnosticSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticSettingName", *parsed) + if id.DiagnosticSettingName, ok = input.Parsed["diagnosticSettingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "diagnosticSettingName", input) } - return &id, nil + return nil } // ValidateScopedDiagnosticSettingID checks that 'input' can be parsed as a Scoped Diagnostic Setting ID diff --git a/resource-manager/insights/2021-05-01-preview/diagnosticsettingscategories/id_scopeddiagnosticsettingscategory.go b/resource-manager/insights/2021-05-01-preview/diagnosticsettingscategories/id_scopeddiagnosticsettingscategory.go index 8abdefa4c00..9418bd0ded7 100644 --- a/resource-manager/insights/2021-05-01-preview/diagnosticsettingscategories/id_scopeddiagnosticsettingscategory.go +++ b/resource-manager/insights/2021-05-01-preview/diagnosticsettingscategories/id_scopeddiagnosticsettingscategory.go @@ -34,15 +34,9 @@ func ParseScopedDiagnosticSettingsCategoryID(input string) (*ScopedDiagnosticSet return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedDiagnosticSettingsCategoryId{} - - if id.ResourceUri, ok = parsed.Parsed["resourceUri"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceUri", *parsed) - } - - if id.DiagnosticSettingsCategoryName, ok = parsed.Parsed["diagnosticSettingsCategoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticSettingsCategoryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedDiagnosticSettingsCategoryIDInsensitively(input string) (*Scoped return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedDiagnosticSettingsCategoryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ResourceUri, ok = parsed.Parsed["resourceUri"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceUri", *parsed) + return &id, nil +} + +func (id *ScopedDiagnosticSettingsCategoryId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ResourceUri, ok = input.Parsed["resourceUri"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceUri", input) } - if id.DiagnosticSettingsCategoryName, ok = parsed.Parsed["diagnosticSettingsCategoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticSettingsCategoryName", *parsed) + if id.DiagnosticSettingsCategoryName, ok = input.Parsed["diagnosticSettingsCategoryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "diagnosticSettingsCategoryName", input) } - return &id, nil + return nil } // ValidateScopedDiagnosticSettingsCategoryID checks that 'input' can be parsed as a Scoped Diagnostic Settings Category ID diff --git a/resource-manager/insights/2021-05-01-preview/managementgroupdiagnosticsettings/id_providers2diagnosticsetting.go b/resource-manager/insights/2021-05-01-preview/managementgroupdiagnosticsettings/id_providers2diagnosticsetting.go index c8218bf3a60..bd2443b0332 100644 --- a/resource-manager/insights/2021-05-01-preview/managementgroupdiagnosticsettings/id_providers2diagnosticsetting.go +++ b/resource-manager/insights/2021-05-01-preview/managementgroupdiagnosticsettings/id_providers2diagnosticsetting.go @@ -34,15 +34,9 @@ func ParseProviders2DiagnosticSettingID(input string) (*Providers2DiagnosticSett return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2DiagnosticSettingId{} - - if id.ManagementGroupId, ok = parsed.Parsed["managementGroupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managementGroupId", *parsed) - } - - if id.DiagnosticSettingName, ok = parsed.Parsed["diagnosticSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticSettingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviders2DiagnosticSettingIDInsensitively(input string) (*Providers2D return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2DiagnosticSettingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ManagementGroupId, ok = parsed.Parsed["managementGroupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managementGroupId", *parsed) + return &id, nil +} + +func (id *Providers2DiagnosticSettingId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ManagementGroupId, ok = input.Parsed["managementGroupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managementGroupId", input) } - if id.DiagnosticSettingName, ok = parsed.Parsed["diagnosticSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticSettingName", *parsed) + if id.DiagnosticSettingName, ok = input.Parsed["diagnosticSettingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "diagnosticSettingName", input) } - return &id, nil + return nil } // ValidateProviders2DiagnosticSettingID checks that 'input' can be parsed as a Providers 2 Diagnostic Setting ID diff --git a/resource-manager/insights/2021-05-01-preview/metrics/id_autoscalesetting.go b/resource-manager/insights/2021-05-01-preview/metrics/id_autoscalesetting.go index d37144dec57..6ef46c45a02 100644 --- a/resource-manager/insights/2021-05-01-preview/metrics/id_autoscalesetting.go +++ b/resource-manager/insights/2021-05-01-preview/metrics/id_autoscalesetting.go @@ -36,19 +36,9 @@ func ParseAutoScaleSettingID(input string) (*AutoScaleSettingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutoScaleSettingId{} - - 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.AutoScaleSettingName, ok = parsed.Parsed["autoScaleSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "autoScaleSettingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutoScaleSettingIDInsensitively(input string) (*AutoScaleSettingId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutoScaleSettingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutoScaleSettingId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutoScaleSettingName, ok = parsed.Parsed["autoScaleSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "autoScaleSettingName", *parsed) + if id.AutoScaleSettingName, ok = input.Parsed["autoScaleSettingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "autoScaleSettingName", input) } - return &id, nil + return nil } // ValidateAutoScaleSettingID checks that 'input' can be parsed as a Auto Scale Setting ID diff --git a/resource-manager/insights/2021-05-01-preview/subscriptiondiagnosticsettings/id_diagnosticsetting.go b/resource-manager/insights/2021-05-01-preview/subscriptiondiagnosticsettings/id_diagnosticsetting.go index 106465a93b5..1d8493add8a 100644 --- a/resource-manager/insights/2021-05-01-preview/subscriptiondiagnosticsettings/id_diagnosticsetting.go +++ b/resource-manager/insights/2021-05-01-preview/subscriptiondiagnosticsettings/id_diagnosticsetting.go @@ -34,15 +34,9 @@ func ParseDiagnosticSettingID(input string) (*DiagnosticSettingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiagnosticSettingId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.DiagnosticSettingName, ok = parsed.Parsed["diagnosticSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticSettingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseDiagnosticSettingIDInsensitively(input string) (*DiagnosticSettingId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiagnosticSettingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DiagnosticSettingId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.DiagnosticSettingName, ok = parsed.Parsed["diagnosticSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticSettingName", *parsed) + if id.DiagnosticSettingName, ok = input.Parsed["diagnosticSettingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "diagnosticSettingName", input) } - return &id, nil + return nil } // ValidateDiagnosticSettingID checks that 'input' can be parsed as a Diagnostic Setting ID diff --git a/resource-manager/insights/2021-08-01/scheduledqueryrules/id_scheduledqueryrule.go b/resource-manager/insights/2021-08-01/scheduledqueryrules/id_scheduledqueryrule.go index 207457784c9..0ecc11dd152 100644 --- a/resource-manager/insights/2021-08-01/scheduledqueryrules/id_scheduledqueryrule.go +++ b/resource-manager/insights/2021-08-01/scheduledqueryrules/id_scheduledqueryrule.go @@ -36,19 +36,9 @@ func ParseScheduledQueryRuleID(input string) (*ScheduledQueryRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScheduledQueryRuleId{} - - 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.ScheduledQueryRuleName, ok = parsed.Parsed["scheduledQueryRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduledQueryRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseScheduledQueryRuleIDInsensitively(input string) (*ScheduledQueryRuleId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScheduledQueryRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ScheduledQueryRuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ScheduledQueryRuleName, ok = parsed.Parsed["scheduledQueryRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduledQueryRuleName", *parsed) + if id.ScheduledQueryRuleName, ok = input.Parsed["scheduledQueryRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scheduledQueryRuleName", input) } - return &id, nil + return nil } // ValidateScheduledQueryRuleID checks that 'input' can be parsed as a Scheduled Query Rule ID diff --git a/resource-manager/insights/2021-09-01/actiongroupsapis/id_actiongroup.go b/resource-manager/insights/2021-09-01/actiongroupsapis/id_actiongroup.go index f2ba4317c8f..32ec4c27e3d 100644 --- a/resource-manager/insights/2021-09-01/actiongroupsapis/id_actiongroup.go +++ b/resource-manager/insights/2021-09-01/actiongroupsapis/id_actiongroup.go @@ -36,19 +36,9 @@ func ParseActionGroupID(input string) (*ActionGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ActionGroupId{} - - 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.ActionGroupName, ok = parsed.Parsed["actionGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseActionGroupIDInsensitively(input string) (*ActionGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ActionGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ActionGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ActionGroupName, ok = parsed.Parsed["actionGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionGroupName", *parsed) + if id.ActionGroupName, ok = input.Parsed["actionGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "actionGroupName", input) } - return &id, nil + return nil } // ValidateActionGroupID checks that 'input' can be parsed as a Action Group ID diff --git a/resource-manager/insights/2021-09-01/actiongroupsapis/id_actiongroupnotificationstatus.go b/resource-manager/insights/2021-09-01/actiongroupsapis/id_actiongroupnotificationstatus.go index 9937e175491..3698ddae4e0 100644 --- a/resource-manager/insights/2021-09-01/actiongroupsapis/id_actiongroupnotificationstatus.go +++ b/resource-manager/insights/2021-09-01/actiongroupsapis/id_actiongroupnotificationstatus.go @@ -38,23 +38,9 @@ func ParseActionGroupNotificationStatusID(input string) (*ActionGroupNotificatio return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ActionGroupNotificationStatusId{} - - 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.ActionGroupName, ok = parsed.Parsed["actionGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionGroupName", *parsed) - } - - if id.NotificationId, ok = parsed.Parsed["notificationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseActionGroupNotificationStatusIDInsensitively(input string) (*ActionGro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ActionGroupNotificationStatusId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ActionGroupNotificationStatusId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ActionGroupName, ok = parsed.Parsed["actionGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionGroupName", *parsed) + if id.ActionGroupName, ok = input.Parsed["actionGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "actionGroupName", input) } - if id.NotificationId, ok = parsed.Parsed["notificationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationId", *parsed) + if id.NotificationId, ok = input.Parsed["notificationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "notificationId", input) } - return &id, nil + return nil } // ValidateActionGroupNotificationStatusID checks that 'input' can be parsed as a Action Group Notification Status ID diff --git a/resource-manager/insights/2021-09-01/actiongroupsapis/id_notificationstatus.go b/resource-manager/insights/2021-09-01/actiongroupsapis/id_notificationstatus.go index a5223d2ceba..c10eb9131b2 100644 --- a/resource-manager/insights/2021-09-01/actiongroupsapis/id_notificationstatus.go +++ b/resource-manager/insights/2021-09-01/actiongroupsapis/id_notificationstatus.go @@ -34,15 +34,9 @@ func ParseNotificationStatusID(input string) (*NotificationStatusId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NotificationStatusId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.NotificationId, ok = parsed.Parsed["notificationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseNotificationStatusIDInsensitively(input string) (*NotificationStatusId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NotificationStatusId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *NotificationStatusId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.NotificationId, ok = parsed.Parsed["notificationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationId", *parsed) + if id.NotificationId, ok = input.Parsed["notificationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "notificationId", input) } - return &id, nil + return nil } // ValidateNotificationStatusID checks that 'input' can be parsed as a Notification Status ID diff --git a/resource-manager/insights/2021-09-01/actiongroupsapis/id_providernotificationstatus.go b/resource-manager/insights/2021-09-01/actiongroupsapis/id_providernotificationstatus.go index 02a9b848ab6..8c45689374c 100644 --- a/resource-manager/insights/2021-09-01/actiongroupsapis/id_providernotificationstatus.go +++ b/resource-manager/insights/2021-09-01/actiongroupsapis/id_providernotificationstatus.go @@ -36,19 +36,9 @@ func ParseProviderNotificationStatusID(input string) (*ProviderNotificationStatu return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderNotificationStatusId{} - - 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.NotificationId, ok = parsed.Parsed["notificationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderNotificationStatusIDInsensitively(input string) (*ProviderNoti return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderNotificationStatusId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderNotificationStatusId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NotificationId, ok = parsed.Parsed["notificationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationId", *parsed) + if id.NotificationId, ok = input.Parsed["notificationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "notificationId", input) } - return &id, nil + return nil } // ValidateProviderNotificationStatusID checks that 'input' can be parsed as a Provider Notification Status ID diff --git a/resource-manager/insights/2022-06-01/actiongroupsapis/id_actiongroup.go b/resource-manager/insights/2022-06-01/actiongroupsapis/id_actiongroup.go index f2ba4317c8f..32ec4c27e3d 100644 --- a/resource-manager/insights/2022-06-01/actiongroupsapis/id_actiongroup.go +++ b/resource-manager/insights/2022-06-01/actiongroupsapis/id_actiongroup.go @@ -36,19 +36,9 @@ func ParseActionGroupID(input string) (*ActionGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ActionGroupId{} - - 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.ActionGroupName, ok = parsed.Parsed["actionGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseActionGroupIDInsensitively(input string) (*ActionGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ActionGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ActionGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ActionGroupName, ok = parsed.Parsed["actionGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionGroupName", *parsed) + if id.ActionGroupName, ok = input.Parsed["actionGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "actionGroupName", input) } - return &id, nil + return nil } // ValidateActionGroupID checks that 'input' can be parsed as a Action Group ID diff --git a/resource-manager/insights/2022-06-01/actiongroupsapis/id_actiongroupnotificationstatus.go b/resource-manager/insights/2022-06-01/actiongroupsapis/id_actiongroupnotificationstatus.go index 9937e175491..3698ddae4e0 100644 --- a/resource-manager/insights/2022-06-01/actiongroupsapis/id_actiongroupnotificationstatus.go +++ b/resource-manager/insights/2022-06-01/actiongroupsapis/id_actiongroupnotificationstatus.go @@ -38,23 +38,9 @@ func ParseActionGroupNotificationStatusID(input string) (*ActionGroupNotificatio return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ActionGroupNotificationStatusId{} - - 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.ActionGroupName, ok = parsed.Parsed["actionGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionGroupName", *parsed) - } - - if id.NotificationId, ok = parsed.Parsed["notificationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseActionGroupNotificationStatusIDInsensitively(input string) (*ActionGro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ActionGroupNotificationStatusId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ActionGroupNotificationStatusId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ActionGroupName, ok = parsed.Parsed["actionGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionGroupName", *parsed) + if id.ActionGroupName, ok = input.Parsed["actionGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "actionGroupName", input) } - if id.NotificationId, ok = parsed.Parsed["notificationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationId", *parsed) + if id.NotificationId, ok = input.Parsed["notificationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "notificationId", input) } - return &id, nil + return nil } // ValidateActionGroupNotificationStatusID checks that 'input' can be parsed as a Action Group Notification Status ID diff --git a/resource-manager/insights/2022-06-01/actiongroupsapis/id_notificationstatus.go b/resource-manager/insights/2022-06-01/actiongroupsapis/id_notificationstatus.go index a5223d2ceba..c10eb9131b2 100644 --- a/resource-manager/insights/2022-06-01/actiongroupsapis/id_notificationstatus.go +++ b/resource-manager/insights/2022-06-01/actiongroupsapis/id_notificationstatus.go @@ -34,15 +34,9 @@ func ParseNotificationStatusID(input string) (*NotificationStatusId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NotificationStatusId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.NotificationId, ok = parsed.Parsed["notificationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseNotificationStatusIDInsensitively(input string) (*NotificationStatusId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NotificationStatusId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *NotificationStatusId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.NotificationId, ok = parsed.Parsed["notificationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationId", *parsed) + if id.NotificationId, ok = input.Parsed["notificationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "notificationId", input) } - return &id, nil + return nil } // ValidateNotificationStatusID checks that 'input' can be parsed as a Notification Status ID diff --git a/resource-manager/insights/2022-06-01/actiongroupsapis/id_providernotificationstatus.go b/resource-manager/insights/2022-06-01/actiongroupsapis/id_providernotificationstatus.go index 02a9b848ab6..8c45689374c 100644 --- a/resource-manager/insights/2022-06-01/actiongroupsapis/id_providernotificationstatus.go +++ b/resource-manager/insights/2022-06-01/actiongroupsapis/id_providernotificationstatus.go @@ -36,19 +36,9 @@ func ParseProviderNotificationStatusID(input string) (*ProviderNotificationStatu return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderNotificationStatusId{} - - 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.NotificationId, ok = parsed.Parsed["notificationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderNotificationStatusIDInsensitively(input string) (*ProviderNoti return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderNotificationStatusId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderNotificationStatusId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NotificationId, ok = parsed.Parsed["notificationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationId", *parsed) + if id.NotificationId, ok = input.Parsed["notificationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "notificationId", input) } - return &id, nil + return nil } // ValidateProviderNotificationStatusID checks that 'input' can be parsed as a Provider Notification Status ID diff --git a/resource-manager/insights/2022-06-01/datacollectionendpoints/id_datacollectionendpoint.go b/resource-manager/insights/2022-06-01/datacollectionendpoints/id_datacollectionendpoint.go index e7424e56fc6..5d237fc686b 100644 --- a/resource-manager/insights/2022-06-01/datacollectionendpoints/id_datacollectionendpoint.go +++ b/resource-manager/insights/2022-06-01/datacollectionendpoints/id_datacollectionendpoint.go @@ -36,19 +36,9 @@ func ParseDataCollectionEndpointID(input string) (*DataCollectionEndpointId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataCollectionEndpointId{} - - 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.DataCollectionEndpointName, ok = parsed.Parsed["dataCollectionEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataCollectionEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDataCollectionEndpointIDInsensitively(input string) (*DataCollectionEn return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataCollectionEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DataCollectionEndpointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataCollectionEndpointName, ok = parsed.Parsed["dataCollectionEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataCollectionEndpointName", *parsed) + if id.DataCollectionEndpointName, ok = input.Parsed["dataCollectionEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataCollectionEndpointName", input) } - return &id, nil + return nil } // ValidateDataCollectionEndpointID checks that 'input' can be parsed as a Data Collection Endpoint ID diff --git a/resource-manager/insights/2022-06-01/datacollectionruleassociations/id_datacollectionendpoint.go b/resource-manager/insights/2022-06-01/datacollectionruleassociations/id_datacollectionendpoint.go index 783eb29bd5c..cc7f1cb165d 100644 --- a/resource-manager/insights/2022-06-01/datacollectionruleassociations/id_datacollectionendpoint.go +++ b/resource-manager/insights/2022-06-01/datacollectionruleassociations/id_datacollectionendpoint.go @@ -36,19 +36,9 @@ func ParseDataCollectionEndpointID(input string) (*DataCollectionEndpointId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataCollectionEndpointId{} - - 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.DataCollectionEndpointName, ok = parsed.Parsed["dataCollectionEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataCollectionEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDataCollectionEndpointIDInsensitively(input string) (*DataCollectionEn return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataCollectionEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DataCollectionEndpointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataCollectionEndpointName, ok = parsed.Parsed["dataCollectionEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataCollectionEndpointName", *parsed) + if id.DataCollectionEndpointName, ok = input.Parsed["dataCollectionEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataCollectionEndpointName", input) } - return &id, nil + return nil } // ValidateDataCollectionEndpointID checks that 'input' can be parsed as a Data Collection Endpoint ID diff --git a/resource-manager/insights/2022-06-01/datacollectionruleassociations/id_datacollectionrule.go b/resource-manager/insights/2022-06-01/datacollectionruleassociations/id_datacollectionrule.go index e2e0bc59334..f388ed1069a 100644 --- a/resource-manager/insights/2022-06-01/datacollectionruleassociations/id_datacollectionrule.go +++ b/resource-manager/insights/2022-06-01/datacollectionruleassociations/id_datacollectionrule.go @@ -36,19 +36,9 @@ func ParseDataCollectionRuleID(input string) (*DataCollectionRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataCollectionRuleId{} - - 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.DataCollectionRuleName, ok = parsed.Parsed["dataCollectionRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataCollectionRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDataCollectionRuleIDInsensitively(input string) (*DataCollectionRuleId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataCollectionRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DataCollectionRuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataCollectionRuleName, ok = parsed.Parsed["dataCollectionRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataCollectionRuleName", *parsed) + if id.DataCollectionRuleName, ok = input.Parsed["dataCollectionRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataCollectionRuleName", input) } - return &id, nil + return nil } // ValidateDataCollectionRuleID checks that 'input' can be parsed as a Data Collection Rule ID diff --git a/resource-manager/insights/2022-06-01/datacollectionruleassociations/id_scopeddatacollectionruleassociation.go b/resource-manager/insights/2022-06-01/datacollectionruleassociations/id_scopeddatacollectionruleassociation.go index 182e95d4d71..562d6b0fcc4 100644 --- a/resource-manager/insights/2022-06-01/datacollectionruleassociations/id_scopeddatacollectionruleassociation.go +++ b/resource-manager/insights/2022-06-01/datacollectionruleassociations/id_scopeddatacollectionruleassociation.go @@ -34,15 +34,9 @@ func ParseScopedDataCollectionRuleAssociationID(input string) (*ScopedDataCollec return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedDataCollectionRuleAssociationId{} - - if id.ResourceUri, ok = parsed.Parsed["resourceUri"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceUri", *parsed) - } - - if id.DataCollectionRuleAssociationName, ok = parsed.Parsed["dataCollectionRuleAssociationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataCollectionRuleAssociationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedDataCollectionRuleAssociationIDInsensitively(input string) (*Sco return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedDataCollectionRuleAssociationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ResourceUri, ok = parsed.Parsed["resourceUri"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceUri", *parsed) + return &id, nil +} + +func (id *ScopedDataCollectionRuleAssociationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ResourceUri, ok = input.Parsed["resourceUri"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceUri", input) } - if id.DataCollectionRuleAssociationName, ok = parsed.Parsed["dataCollectionRuleAssociationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataCollectionRuleAssociationName", *parsed) + if id.DataCollectionRuleAssociationName, ok = input.Parsed["dataCollectionRuleAssociationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataCollectionRuleAssociationName", input) } - return &id, nil + return nil } // ValidateScopedDataCollectionRuleAssociationID checks that 'input' can be parsed as a Scoped Data Collection Rule Association ID diff --git a/resource-manager/insights/2022-06-01/datacollectionrules/id_datacollectionrule.go b/resource-manager/insights/2022-06-01/datacollectionrules/id_datacollectionrule.go index e48332f7101..3205675d8c7 100644 --- a/resource-manager/insights/2022-06-01/datacollectionrules/id_datacollectionrule.go +++ b/resource-manager/insights/2022-06-01/datacollectionrules/id_datacollectionrule.go @@ -36,19 +36,9 @@ func ParseDataCollectionRuleID(input string) (*DataCollectionRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataCollectionRuleId{} - - 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.DataCollectionRuleName, ok = parsed.Parsed["dataCollectionRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataCollectionRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDataCollectionRuleIDInsensitively(input string) (*DataCollectionRuleId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataCollectionRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DataCollectionRuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DataCollectionRuleName, ok = parsed.Parsed["dataCollectionRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataCollectionRuleName", *parsed) + if id.DataCollectionRuleName, ok = input.Parsed["dataCollectionRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataCollectionRuleName", input) } - return &id, nil + return nil } // ValidateDataCollectionRuleID checks that 'input' can be parsed as a Data Collection Rule ID diff --git a/resource-manager/insights/2022-10-01/autoscaleapis/id_autoscalesetting.go b/resource-manager/insights/2022-10-01/autoscaleapis/id_autoscalesetting.go index 69e49b74a3f..f83855511c7 100644 --- a/resource-manager/insights/2022-10-01/autoscaleapis/id_autoscalesetting.go +++ b/resource-manager/insights/2022-10-01/autoscaleapis/id_autoscalesetting.go @@ -36,19 +36,9 @@ func ParseAutoScaleSettingID(input string) (*AutoScaleSettingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutoScaleSettingId{} - - 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.AutoScaleSettingName, ok = parsed.Parsed["autoScaleSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "autoScaleSettingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutoScaleSettingIDInsensitively(input string) (*AutoScaleSettingId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutoScaleSettingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutoScaleSettingId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutoScaleSettingName, ok = parsed.Parsed["autoScaleSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "autoScaleSettingName", *parsed) + if id.AutoScaleSettingName, ok = input.Parsed["autoScaleSettingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "autoScaleSettingName", input) } - return &id, nil + return nil } // ValidateAutoScaleSettingID checks that 'input' can be parsed as a Auto Scale Setting ID diff --git a/resource-manager/insights/2022-10-01/autoscalesettings/id_autoscalesetting.go b/resource-manager/insights/2022-10-01/autoscalesettings/id_autoscalesetting.go index 644f83c6dda..77f59d611b1 100644 --- a/resource-manager/insights/2022-10-01/autoscalesettings/id_autoscalesetting.go +++ b/resource-manager/insights/2022-10-01/autoscalesettings/id_autoscalesetting.go @@ -36,19 +36,9 @@ func ParseAutoScaleSettingID(input string) (*AutoScaleSettingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutoScaleSettingId{} - - 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.AutoScaleSettingName, ok = parsed.Parsed["autoScaleSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "autoScaleSettingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutoScaleSettingIDInsensitively(input string) (*AutoScaleSettingId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutoScaleSettingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutoScaleSettingId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutoScaleSettingName, ok = parsed.Parsed["autoScaleSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "autoScaleSettingName", *parsed) + if id.AutoScaleSettingName, ok = input.Parsed["autoScaleSettingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "autoScaleSettingName", input) } - return &id, nil + return nil } // ValidateAutoScaleSettingID checks that 'input' can be parsed as a Auto Scale Setting ID diff --git a/resource-manager/insights/2022-10-01/metrics/id_autoscalesetting.go b/resource-manager/insights/2022-10-01/metrics/id_autoscalesetting.go index d37144dec57..6ef46c45a02 100644 --- a/resource-manager/insights/2022-10-01/metrics/id_autoscalesetting.go +++ b/resource-manager/insights/2022-10-01/metrics/id_autoscalesetting.go @@ -36,19 +36,9 @@ func ParseAutoScaleSettingID(input string) (*AutoScaleSettingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutoScaleSettingId{} - - 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.AutoScaleSettingName, ok = parsed.Parsed["autoScaleSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "autoScaleSettingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutoScaleSettingIDInsensitively(input string) (*AutoScaleSettingId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutoScaleSettingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutoScaleSettingId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutoScaleSettingName, ok = parsed.Parsed["autoScaleSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "autoScaleSettingName", *parsed) + if id.AutoScaleSettingName, ok = input.Parsed["autoScaleSettingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "autoScaleSettingName", input) } - return &id, nil + return nil } // ValidateAutoScaleSettingID checks that 'input' can be parsed as a Auto Scale Setting ID diff --git a/resource-manager/insights/2023-01-01/actiongroupsapis/id_actiongroup.go b/resource-manager/insights/2023-01-01/actiongroupsapis/id_actiongroup.go index f2ba4317c8f..32ec4c27e3d 100644 --- a/resource-manager/insights/2023-01-01/actiongroupsapis/id_actiongroup.go +++ b/resource-manager/insights/2023-01-01/actiongroupsapis/id_actiongroup.go @@ -36,19 +36,9 @@ func ParseActionGroupID(input string) (*ActionGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ActionGroupId{} - - 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.ActionGroupName, ok = parsed.Parsed["actionGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseActionGroupIDInsensitively(input string) (*ActionGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ActionGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ActionGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ActionGroupName, ok = parsed.Parsed["actionGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionGroupName", *parsed) + if id.ActionGroupName, ok = input.Parsed["actionGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "actionGroupName", input) } - return &id, nil + return nil } // ValidateActionGroupID checks that 'input' can be parsed as a Action Group ID diff --git a/resource-manager/insights/2023-01-01/actiongroupsapis/id_notificationstatus.go b/resource-manager/insights/2023-01-01/actiongroupsapis/id_notificationstatus.go index b7820569c83..fd9789c549d 100644 --- a/resource-manager/insights/2023-01-01/actiongroupsapis/id_notificationstatus.go +++ b/resource-manager/insights/2023-01-01/actiongroupsapis/id_notificationstatus.go @@ -38,23 +38,9 @@ func ParseNotificationStatusID(input string) (*NotificationStatusId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NotificationStatusId{} - - 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.ActionGroupName, ok = parsed.Parsed["actionGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionGroupName", *parsed) - } - - if id.NotificationId, ok = parsed.Parsed["notificationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseNotificationStatusIDInsensitively(input string) (*NotificationStatusId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NotificationStatusId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *NotificationStatusId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ActionGroupName, ok = parsed.Parsed["actionGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionGroupName", *parsed) + if id.ActionGroupName, ok = input.Parsed["actionGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "actionGroupName", input) } - if id.NotificationId, ok = parsed.Parsed["notificationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationId", *parsed) + if id.NotificationId, ok = input.Parsed["notificationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "notificationId", input) } - return &id, nil + return nil } // ValidateNotificationStatusID checks that 'input' can be parsed as a Notification Status ID diff --git a/resource-manager/insights/2023-04-03/azuremonitorworkspaces/id_account.go b/resource-manager/insights/2023-04-03/azuremonitorworkspaces/id_account.go index d15a048c6ab..08874f052da 100644 --- a/resource-manager/insights/2023-04-03/azuremonitorworkspaces/id_account.go +++ b/resource-manager/insights/2023-04-03/azuremonitorworkspaces/id_account.go @@ -36,19 +36,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/iotcentral/2021-11-01-preview/apps/id_iotapp.go b/resource-manager/iotcentral/2021-11-01-preview/apps/id_iotapp.go index 2a379b76253..1ca6c34e124 100644 --- a/resource-manager/iotcentral/2021-11-01-preview/apps/id_iotapp.go +++ b/resource-manager/iotcentral/2021-11-01-preview/apps/id_iotapp.go @@ -36,19 +36,9 @@ func ParseIotAppID(input string) (*IotAppId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IotAppId{} - - 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.IotAppName, ok = parsed.Parsed["iotAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "iotAppName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseIotAppIDInsensitively(input string) (*IotAppId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IotAppId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *IotAppId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.IotAppName, ok = parsed.Parsed["iotAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "iotAppName", *parsed) + if id.IotAppName, ok = input.Parsed["iotAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "iotAppName", input) } - return &id, nil + return nil } // ValidateIotAppID checks that 'input' can be parsed as a Iot App ID diff --git a/resource-manager/iotcentral/2021-11-01-preview/networking/id_iotapp.go b/resource-manager/iotcentral/2021-11-01-preview/networking/id_iotapp.go index 98e13e48460..ab38b425dc9 100644 --- a/resource-manager/iotcentral/2021-11-01-preview/networking/id_iotapp.go +++ b/resource-manager/iotcentral/2021-11-01-preview/networking/id_iotapp.go @@ -36,19 +36,9 @@ func ParseIotAppID(input string) (*IotAppId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IotAppId{} - - 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.IotAppName, ok = parsed.Parsed["iotAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "iotAppName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseIotAppIDInsensitively(input string) (*IotAppId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IotAppId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *IotAppId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.IotAppName, ok = parsed.Parsed["iotAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "iotAppName", *parsed) + if id.IotAppName, ok = input.Parsed["iotAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "iotAppName", input) } - return &id, nil + return nil } // ValidateIotAppID checks that 'input' can be parsed as a Iot App ID diff --git a/resource-manager/iotcentral/2021-11-01-preview/networking/id_privateendpointconnection.go b/resource-manager/iotcentral/2021-11-01-preview/networking/id_privateendpointconnection.go index 4da36702a2b..6723f86df33 100644 --- a/resource-manager/iotcentral/2021-11-01-preview/networking/id_privateendpointconnection.go +++ b/resource-manager/iotcentral/2021-11-01-preview/networking/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.IotAppName, ok = parsed.Parsed["iotAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "iotAppName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.IotAppName, ok = parsed.Parsed["iotAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "iotAppName", *parsed) + if id.IotAppName, ok = input.Parsed["iotAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "iotAppName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/iotcentral/2021-11-01-preview/networking/id_privatelinkresource.go b/resource-manager/iotcentral/2021-11-01-preview/networking/id_privatelinkresource.go index 868c8b495a9..c3951e1dc11 100644 --- a/resource-manager/iotcentral/2021-11-01-preview/networking/id_privatelinkresource.go +++ b/resource-manager/iotcentral/2021-11-01-preview/networking/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.IotAppName, ok = parsed.Parsed["iotAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "iotAppName", *parsed) - } - - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.IotAppName, ok = parsed.Parsed["iotAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "iotAppName", *parsed) + if id.IotAppName, ok = input.Parsed["iotAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "iotAppName", input) } - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + if id.GroupId, ok = input.Parsed["groupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "groupId", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/keyvault/2021-10-01/managedhsms/id_deletedmanagedhsm.go b/resource-manager/keyvault/2021-10-01/managedhsms/id_deletedmanagedhsm.go index c3862fe0206..4b2ac8a24cc 100644 --- a/resource-manager/keyvault/2021-10-01/managedhsms/id_deletedmanagedhsm.go +++ b/resource-manager/keyvault/2021-10-01/managedhsms/id_deletedmanagedhsm.go @@ -36,19 +36,9 @@ func ParseDeletedManagedHSMID(input string) (*DeletedManagedHSMId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeletedManagedHSMId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.DeletedManagedHSMName, ok = parsed.Parsed["deletedManagedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedManagedHSMName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDeletedManagedHSMIDInsensitively(input string) (*DeletedManagedHSMId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeletedManagedHSMId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DeletedManagedHSMId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.DeletedManagedHSMName, ok = parsed.Parsed["deletedManagedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedManagedHSMName", *parsed) + if id.DeletedManagedHSMName, ok = input.Parsed["deletedManagedHSMName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deletedManagedHSMName", input) } - return &id, nil + return nil } // ValidateDeletedManagedHSMID checks that 'input' can be parsed as a Deleted Managed H S M ID diff --git a/resource-manager/keyvault/2021-10-01/managedhsms/id_managedhsm.go b/resource-manager/keyvault/2021-10-01/managedhsms/id_managedhsm.go index d77a6f896c8..f10f4c49899 100644 --- a/resource-manager/keyvault/2021-10-01/managedhsms/id_managedhsm.go +++ b/resource-manager/keyvault/2021-10-01/managedhsms/id_managedhsm.go @@ -36,19 +36,9 @@ func ParseManagedHSMID(input string) (*ManagedHSMId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedHSMId{} - - 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.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagedHSMIDInsensitively(input string) (*ManagedHSMId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedHSMId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagedHSMId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) + if id.ManagedHSMName, ok = input.Parsed["managedHSMName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", input) } - return &id, nil + return nil } // ValidateManagedHSMID checks that 'input' can be parsed as a Managed H S M ID diff --git a/resource-manager/keyvault/2021-10-01/mhsmlistprivateendpointconnections/id_managedhsm.go b/resource-manager/keyvault/2021-10-01/mhsmlistprivateendpointconnections/id_managedhsm.go index b968db4850a..67f1a3de761 100644 --- a/resource-manager/keyvault/2021-10-01/mhsmlistprivateendpointconnections/id_managedhsm.go +++ b/resource-manager/keyvault/2021-10-01/mhsmlistprivateendpointconnections/id_managedhsm.go @@ -36,19 +36,9 @@ func ParseManagedHSMID(input string) (*ManagedHSMId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedHSMId{} - - 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.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagedHSMIDInsensitively(input string) (*ManagedHSMId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedHSMId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagedHSMId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) + if id.ManagedHSMName, ok = input.Parsed["managedHSMName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", input) } - return &id, nil + return nil } // ValidateManagedHSMID checks that 'input' can be parsed as a Managed H S M ID diff --git a/resource-manager/keyvault/2021-10-01/mhsmprivateendpointconnections/id_privateendpointconnection.go b/resource-manager/keyvault/2021-10-01/mhsmprivateendpointconnections/id_privateendpointconnection.go index 47ac8a590a6..7bf46bf4ca9 100644 --- a/resource-manager/keyvault/2021-10-01/mhsmprivateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/keyvault/2021-10-01/mhsmprivateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) + if id.ManagedHSMName, ok = input.Parsed["managedHSMName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/keyvault/2021-10-01/mhsmprivatelinkresources/id_managedhsm.go b/resource-manager/keyvault/2021-10-01/mhsmprivatelinkresources/id_managedhsm.go index 3624ed9a298..823b479507d 100644 --- a/resource-manager/keyvault/2021-10-01/mhsmprivatelinkresources/id_managedhsm.go +++ b/resource-manager/keyvault/2021-10-01/mhsmprivatelinkresources/id_managedhsm.go @@ -36,19 +36,9 @@ func ParseManagedHSMID(input string) (*ManagedHSMId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedHSMId{} - - 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.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagedHSMIDInsensitively(input string) (*ManagedHSMId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedHSMId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagedHSMId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) + if id.ManagedHSMName, ok = input.Parsed["managedHSMName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", input) } - return &id, nil + return nil } // ValidateManagedHSMID checks that 'input' can be parsed as a Managed H S M ID diff --git a/resource-manager/keyvault/2021-10-01/secrets/id_secret.go b/resource-manager/keyvault/2021-10-01/secrets/id_secret.go index 8a49182de8a..f6d82f14bc9 100644 --- a/resource-manager/keyvault/2021-10-01/secrets/id_secret.go +++ b/resource-manager/keyvault/2021-10-01/secrets/id_secret.go @@ -38,23 +38,9 @@ func ParseSecretID(input string) (*SecretId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecretId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.SecretName, ok = parsed.Parsed["secretName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "secretName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSecretIDInsensitively(input string) (*SecretId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecretId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SecretId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.SecretName, ok = parsed.Parsed["secretName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "secretName", *parsed) + if id.SecretName, ok = input.Parsed["secretName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "secretName", input) } - return &id, nil + return nil } // ValidateSecretID checks that 'input' can be parsed as a Secret ID diff --git a/resource-manager/keyvault/2021-10-01/vaults/id_deletedvault.go b/resource-manager/keyvault/2021-10-01/vaults/id_deletedvault.go index 302dfecbaef..0c4d26d40d2 100644 --- a/resource-manager/keyvault/2021-10-01/vaults/id_deletedvault.go +++ b/resource-manager/keyvault/2021-10-01/vaults/id_deletedvault.go @@ -36,19 +36,9 @@ func ParseDeletedVaultID(input string) (*DeletedVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeletedVaultId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.DeletedVaultName, ok = parsed.Parsed["deletedVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedVaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDeletedVaultIDInsensitively(input string) (*DeletedVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeletedVaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DeletedVaultId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.DeletedVaultName, ok = parsed.Parsed["deletedVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedVaultName", *parsed) + if id.DeletedVaultName, ok = input.Parsed["deletedVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deletedVaultName", input) } - return &id, nil + return nil } // ValidateDeletedVaultID checks that 'input' can be parsed as a Deleted Vault ID diff --git a/resource-manager/keyvault/2021-10-01/vaults/id_operationkind.go b/resource-manager/keyvault/2021-10-01/vaults/id_operationkind.go index 0392b20df3a..043f7bcd239 100644 --- a/resource-manager/keyvault/2021-10-01/vaults/id_operationkind.go +++ b/resource-manager/keyvault/2021-10-01/vaults/id_operationkind.go @@ -38,31 +38,9 @@ func ParseOperationKindID(input string) (*OperationKindId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationKindId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if v, ok := parsed.Parsed["operationKind"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationKind", *parsed) - } - - operationKind, err := parseAccessPolicyUpdateKind(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.OperationKind = *operationKind + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -77,34 +55,42 @@ func ParseOperationKindIDInsensitively(input string) (*OperationKindId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationKindId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *OperationKindId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if v, ok := parsed.Parsed["operationKind"]; true { + if v, ok := input.Parsed["operationKind"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationKind", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "operationKind", input) } operationKind, err := parseAccessPolicyUpdateKind(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.OperationKind = *operationKind } - return &id, nil + return nil } // ValidateOperationKindID checks that 'input' can be parsed as a Operation Kind ID diff --git a/resource-manager/keyvault/2022-11-01/managedhsmkeys/id_key.go b/resource-manager/keyvault/2022-11-01/managedhsmkeys/id_key.go index 02d50309e48..48f1bbe5f12 100644 --- a/resource-manager/keyvault/2022-11-01/managedhsmkeys/id_key.go +++ b/resource-manager/keyvault/2022-11-01/managedhsmkeys/id_key.go @@ -38,23 +38,9 @@ func ParseKeyID(input string) (*KeyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := KeyId{} - - 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.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) - } - - if id.KeyName, ok = parsed.Parsed["keyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseKeyIDInsensitively(input string) (*KeyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := KeyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *KeyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) + if id.ManagedHSMName, ok = input.Parsed["managedHSMName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", input) } - if id.KeyName, ok = parsed.Parsed["keyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyName", *parsed) + if id.KeyName, ok = input.Parsed["keyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "keyName", input) } - return &id, nil + return nil } // ValidateKeyID checks that 'input' can be parsed as a Key ID diff --git a/resource-manager/keyvault/2022-11-01/managedhsmkeys/id_managedhsm.go b/resource-manager/keyvault/2022-11-01/managedhsmkeys/id_managedhsm.go index e6740fadc9c..5f5090575d4 100644 --- a/resource-manager/keyvault/2022-11-01/managedhsmkeys/id_managedhsm.go +++ b/resource-manager/keyvault/2022-11-01/managedhsmkeys/id_managedhsm.go @@ -36,19 +36,9 @@ func ParseManagedHSMID(input string) (*ManagedHSMId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedHSMId{} - - 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.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagedHSMIDInsensitively(input string) (*ManagedHSMId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedHSMId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagedHSMId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) + if id.ManagedHSMName, ok = input.Parsed["managedHSMName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", input) } - return &id, nil + return nil } // ValidateManagedHSMID checks that 'input' can be parsed as a Managed H S M ID diff --git a/resource-manager/keyvault/2022-11-01/managedhsmkeys/id_version.go b/resource-manager/keyvault/2022-11-01/managedhsmkeys/id_version.go index 641a3a632a3..5afafa1334a 100644 --- a/resource-manager/keyvault/2022-11-01/managedhsmkeys/id_version.go +++ b/resource-manager/keyvault/2022-11-01/managedhsmkeys/id_version.go @@ -40,27 +40,9 @@ func ParseVersionID(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} - - 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.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) - } - - if id.KeyName, ok = parsed.Parsed["keyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVersionIDInsensitively(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) + if id.ManagedHSMName, ok = input.Parsed["managedHSMName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", input) } - if id.KeyName, ok = parsed.Parsed["keyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyName", *parsed) + if id.KeyName, ok = input.Parsed["keyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "keyName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateVersionID checks that 'input' can be parsed as a Version ID diff --git a/resource-manager/keyvault/2022-11-01/managedhsms/id_deletedmanagedhsm.go b/resource-manager/keyvault/2022-11-01/managedhsms/id_deletedmanagedhsm.go index c3862fe0206..4b2ac8a24cc 100644 --- a/resource-manager/keyvault/2022-11-01/managedhsms/id_deletedmanagedhsm.go +++ b/resource-manager/keyvault/2022-11-01/managedhsms/id_deletedmanagedhsm.go @@ -36,19 +36,9 @@ func ParseDeletedManagedHSMID(input string) (*DeletedManagedHSMId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeletedManagedHSMId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.DeletedManagedHSMName, ok = parsed.Parsed["deletedManagedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedManagedHSMName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDeletedManagedHSMIDInsensitively(input string) (*DeletedManagedHSMId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeletedManagedHSMId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DeletedManagedHSMId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.DeletedManagedHSMName, ok = parsed.Parsed["deletedManagedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedManagedHSMName", *parsed) + if id.DeletedManagedHSMName, ok = input.Parsed["deletedManagedHSMName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deletedManagedHSMName", input) } - return &id, nil + return nil } // ValidateDeletedManagedHSMID checks that 'input' can be parsed as a Deleted Managed H S M ID diff --git a/resource-manager/keyvault/2022-11-01/managedhsms/id_managedhsm.go b/resource-manager/keyvault/2022-11-01/managedhsms/id_managedhsm.go index d77a6f896c8..f10f4c49899 100644 --- a/resource-manager/keyvault/2022-11-01/managedhsms/id_managedhsm.go +++ b/resource-manager/keyvault/2022-11-01/managedhsms/id_managedhsm.go @@ -36,19 +36,9 @@ func ParseManagedHSMID(input string) (*ManagedHSMId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedHSMId{} - - 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.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagedHSMIDInsensitively(input string) (*ManagedHSMId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedHSMId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagedHSMId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) + if id.ManagedHSMName, ok = input.Parsed["managedHSMName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", input) } - return &id, nil + return nil } // ValidateManagedHSMID checks that 'input' can be parsed as a Managed H S M ID diff --git a/resource-manager/keyvault/2022-11-01/mhsmlistprivateendpointconnections/id_managedhsm.go b/resource-manager/keyvault/2022-11-01/mhsmlistprivateendpointconnections/id_managedhsm.go index b968db4850a..67f1a3de761 100644 --- a/resource-manager/keyvault/2022-11-01/mhsmlistprivateendpointconnections/id_managedhsm.go +++ b/resource-manager/keyvault/2022-11-01/mhsmlistprivateendpointconnections/id_managedhsm.go @@ -36,19 +36,9 @@ func ParseManagedHSMID(input string) (*ManagedHSMId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedHSMId{} - - 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.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagedHSMIDInsensitively(input string) (*ManagedHSMId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedHSMId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagedHSMId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) + if id.ManagedHSMName, ok = input.Parsed["managedHSMName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", input) } - return &id, nil + return nil } // ValidateManagedHSMID checks that 'input' can be parsed as a Managed H S M ID diff --git a/resource-manager/keyvault/2022-11-01/mhsmprivateendpointconnections/id_privateendpointconnection.go b/resource-manager/keyvault/2022-11-01/mhsmprivateendpointconnections/id_privateendpointconnection.go index 47ac8a590a6..7bf46bf4ca9 100644 --- a/resource-manager/keyvault/2022-11-01/mhsmprivateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/keyvault/2022-11-01/mhsmprivateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) + if id.ManagedHSMName, ok = input.Parsed["managedHSMName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/keyvault/2022-11-01/mhsmprivatelinkresources/id_managedhsm.go b/resource-manager/keyvault/2022-11-01/mhsmprivatelinkresources/id_managedhsm.go index 3624ed9a298..823b479507d 100644 --- a/resource-manager/keyvault/2022-11-01/mhsmprivatelinkresources/id_managedhsm.go +++ b/resource-manager/keyvault/2022-11-01/mhsmprivatelinkresources/id_managedhsm.go @@ -36,19 +36,9 @@ func ParseManagedHSMID(input string) (*ManagedHSMId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedHSMId{} - - 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.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagedHSMIDInsensitively(input string) (*ManagedHSMId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedHSMId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagedHSMId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) + if id.ManagedHSMName, ok = input.Parsed["managedHSMName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", input) } - return &id, nil + return nil } // ValidateManagedHSMID checks that 'input' can be parsed as a Managed H S M ID diff --git a/resource-manager/keyvault/2022-11-01/secrets/id_secret.go b/resource-manager/keyvault/2022-11-01/secrets/id_secret.go index 8a49182de8a..f6d82f14bc9 100644 --- a/resource-manager/keyvault/2022-11-01/secrets/id_secret.go +++ b/resource-manager/keyvault/2022-11-01/secrets/id_secret.go @@ -38,23 +38,9 @@ func ParseSecretID(input string) (*SecretId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecretId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.SecretName, ok = parsed.Parsed["secretName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "secretName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSecretIDInsensitively(input string) (*SecretId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecretId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SecretId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.SecretName, ok = parsed.Parsed["secretName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "secretName", *parsed) + if id.SecretName, ok = input.Parsed["secretName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "secretName", input) } - return &id, nil + return nil } // ValidateSecretID checks that 'input' can be parsed as a Secret ID diff --git a/resource-manager/keyvault/2022-11-01/vaults/id_deletedvault.go b/resource-manager/keyvault/2022-11-01/vaults/id_deletedvault.go index 302dfecbaef..0c4d26d40d2 100644 --- a/resource-manager/keyvault/2022-11-01/vaults/id_deletedvault.go +++ b/resource-manager/keyvault/2022-11-01/vaults/id_deletedvault.go @@ -36,19 +36,9 @@ func ParseDeletedVaultID(input string) (*DeletedVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeletedVaultId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.DeletedVaultName, ok = parsed.Parsed["deletedVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedVaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDeletedVaultIDInsensitively(input string) (*DeletedVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeletedVaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DeletedVaultId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.DeletedVaultName, ok = parsed.Parsed["deletedVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedVaultName", *parsed) + if id.DeletedVaultName, ok = input.Parsed["deletedVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deletedVaultName", input) } - return &id, nil + return nil } // ValidateDeletedVaultID checks that 'input' can be parsed as a Deleted Vault ID diff --git a/resource-manager/keyvault/2022-11-01/vaults/id_operationkind.go b/resource-manager/keyvault/2022-11-01/vaults/id_operationkind.go index 0392b20df3a..043f7bcd239 100644 --- a/resource-manager/keyvault/2022-11-01/vaults/id_operationkind.go +++ b/resource-manager/keyvault/2022-11-01/vaults/id_operationkind.go @@ -38,31 +38,9 @@ func ParseOperationKindID(input string) (*OperationKindId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationKindId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if v, ok := parsed.Parsed["operationKind"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationKind", *parsed) - } - - operationKind, err := parseAccessPolicyUpdateKind(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.OperationKind = *operationKind + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -77,34 +55,42 @@ func ParseOperationKindIDInsensitively(input string) (*OperationKindId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationKindId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *OperationKindId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if v, ok := parsed.Parsed["operationKind"]; true { + if v, ok := input.Parsed["operationKind"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationKind", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "operationKind", input) } operationKind, err := parseAccessPolicyUpdateKind(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.OperationKind = *operationKind } - return &id, nil + return nil } // ValidateOperationKindID checks that 'input' can be parsed as a Operation Kind ID diff --git a/resource-manager/keyvault/2023-02-01/managedhsmkeys/id_key.go b/resource-manager/keyvault/2023-02-01/managedhsmkeys/id_key.go index 02d50309e48..48f1bbe5f12 100644 --- a/resource-manager/keyvault/2023-02-01/managedhsmkeys/id_key.go +++ b/resource-manager/keyvault/2023-02-01/managedhsmkeys/id_key.go @@ -38,23 +38,9 @@ func ParseKeyID(input string) (*KeyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := KeyId{} - - 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.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) - } - - if id.KeyName, ok = parsed.Parsed["keyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseKeyIDInsensitively(input string) (*KeyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := KeyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *KeyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) + if id.ManagedHSMName, ok = input.Parsed["managedHSMName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", input) } - if id.KeyName, ok = parsed.Parsed["keyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyName", *parsed) + if id.KeyName, ok = input.Parsed["keyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "keyName", input) } - return &id, nil + return nil } // ValidateKeyID checks that 'input' can be parsed as a Key ID diff --git a/resource-manager/keyvault/2023-02-01/managedhsmkeys/id_managedhsm.go b/resource-manager/keyvault/2023-02-01/managedhsmkeys/id_managedhsm.go index e6740fadc9c..5f5090575d4 100644 --- a/resource-manager/keyvault/2023-02-01/managedhsmkeys/id_managedhsm.go +++ b/resource-manager/keyvault/2023-02-01/managedhsmkeys/id_managedhsm.go @@ -36,19 +36,9 @@ func ParseManagedHSMID(input string) (*ManagedHSMId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedHSMId{} - - 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.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagedHSMIDInsensitively(input string) (*ManagedHSMId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedHSMId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagedHSMId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) + if id.ManagedHSMName, ok = input.Parsed["managedHSMName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", input) } - return &id, nil + return nil } // ValidateManagedHSMID checks that 'input' can be parsed as a Managed H S M ID diff --git a/resource-manager/keyvault/2023-02-01/managedhsmkeys/id_version.go b/resource-manager/keyvault/2023-02-01/managedhsmkeys/id_version.go index 641a3a632a3..5afafa1334a 100644 --- a/resource-manager/keyvault/2023-02-01/managedhsmkeys/id_version.go +++ b/resource-manager/keyvault/2023-02-01/managedhsmkeys/id_version.go @@ -40,27 +40,9 @@ func ParseVersionID(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} - - 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.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) - } - - if id.KeyName, ok = parsed.Parsed["keyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVersionIDInsensitively(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) + if id.ManagedHSMName, ok = input.Parsed["managedHSMName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", input) } - if id.KeyName, ok = parsed.Parsed["keyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyName", *parsed) + if id.KeyName, ok = input.Parsed["keyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "keyName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateVersionID checks that 'input' can be parsed as a Version ID diff --git a/resource-manager/keyvault/2023-02-01/managedhsms/id_deletedmanagedhsm.go b/resource-manager/keyvault/2023-02-01/managedhsms/id_deletedmanagedhsm.go index c3862fe0206..4b2ac8a24cc 100644 --- a/resource-manager/keyvault/2023-02-01/managedhsms/id_deletedmanagedhsm.go +++ b/resource-manager/keyvault/2023-02-01/managedhsms/id_deletedmanagedhsm.go @@ -36,19 +36,9 @@ func ParseDeletedManagedHSMID(input string) (*DeletedManagedHSMId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeletedManagedHSMId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.DeletedManagedHSMName, ok = parsed.Parsed["deletedManagedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedManagedHSMName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDeletedManagedHSMIDInsensitively(input string) (*DeletedManagedHSMId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeletedManagedHSMId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DeletedManagedHSMId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.DeletedManagedHSMName, ok = parsed.Parsed["deletedManagedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedManagedHSMName", *parsed) + if id.DeletedManagedHSMName, ok = input.Parsed["deletedManagedHSMName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deletedManagedHSMName", input) } - return &id, nil + return nil } // ValidateDeletedManagedHSMID checks that 'input' can be parsed as a Deleted Managed H S M ID diff --git a/resource-manager/keyvault/2023-02-01/managedhsms/id_managedhsm.go b/resource-manager/keyvault/2023-02-01/managedhsms/id_managedhsm.go index d77a6f896c8..f10f4c49899 100644 --- a/resource-manager/keyvault/2023-02-01/managedhsms/id_managedhsm.go +++ b/resource-manager/keyvault/2023-02-01/managedhsms/id_managedhsm.go @@ -36,19 +36,9 @@ func ParseManagedHSMID(input string) (*ManagedHSMId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedHSMId{} - - 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.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagedHSMIDInsensitively(input string) (*ManagedHSMId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedHSMId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagedHSMId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) + if id.ManagedHSMName, ok = input.Parsed["managedHSMName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", input) } - return &id, nil + return nil } // ValidateManagedHSMID checks that 'input' can be parsed as a Managed H S M ID diff --git a/resource-manager/keyvault/2023-02-01/mhsmlistprivateendpointconnections/id_managedhsm.go b/resource-manager/keyvault/2023-02-01/mhsmlistprivateendpointconnections/id_managedhsm.go index b968db4850a..67f1a3de761 100644 --- a/resource-manager/keyvault/2023-02-01/mhsmlistprivateendpointconnections/id_managedhsm.go +++ b/resource-manager/keyvault/2023-02-01/mhsmlistprivateendpointconnections/id_managedhsm.go @@ -36,19 +36,9 @@ func ParseManagedHSMID(input string) (*ManagedHSMId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedHSMId{} - - 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.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagedHSMIDInsensitively(input string) (*ManagedHSMId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedHSMId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagedHSMId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) + if id.ManagedHSMName, ok = input.Parsed["managedHSMName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", input) } - return &id, nil + return nil } // ValidateManagedHSMID checks that 'input' can be parsed as a Managed H S M ID diff --git a/resource-manager/keyvault/2023-02-01/mhsmlistregions/id_managedhsm.go b/resource-manager/keyvault/2023-02-01/mhsmlistregions/id_managedhsm.go index 01ee5c2ec83..c9b7eb24807 100644 --- a/resource-manager/keyvault/2023-02-01/mhsmlistregions/id_managedhsm.go +++ b/resource-manager/keyvault/2023-02-01/mhsmlistregions/id_managedhsm.go @@ -36,19 +36,9 @@ func ParseManagedHSMID(input string) (*ManagedHSMId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedHSMId{} - - 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.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagedHSMIDInsensitively(input string) (*ManagedHSMId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedHSMId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagedHSMId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) + if id.ManagedHSMName, ok = input.Parsed["managedHSMName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", input) } - return &id, nil + return nil } // ValidateManagedHSMID checks that 'input' can be parsed as a Managed H S M ID diff --git a/resource-manager/keyvault/2023-02-01/mhsmprivateendpointconnections/id_privateendpointconnection.go b/resource-manager/keyvault/2023-02-01/mhsmprivateendpointconnections/id_privateendpointconnection.go index 47ac8a590a6..7bf46bf4ca9 100644 --- a/resource-manager/keyvault/2023-02-01/mhsmprivateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/keyvault/2023-02-01/mhsmprivateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) + if id.ManagedHSMName, ok = input.Parsed["managedHSMName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/keyvault/2023-02-01/mhsmprivatelinkresources/id_managedhsm.go b/resource-manager/keyvault/2023-02-01/mhsmprivatelinkresources/id_managedhsm.go index 3624ed9a298..823b479507d 100644 --- a/resource-manager/keyvault/2023-02-01/mhsmprivatelinkresources/id_managedhsm.go +++ b/resource-manager/keyvault/2023-02-01/mhsmprivatelinkresources/id_managedhsm.go @@ -36,19 +36,9 @@ func ParseManagedHSMID(input string) (*ManagedHSMId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedHSMId{} - - 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.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagedHSMIDInsensitively(input string) (*ManagedHSMId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedHSMId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagedHSMId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) + if id.ManagedHSMName, ok = input.Parsed["managedHSMName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", input) } - return &id, nil + return nil } // ValidateManagedHSMID checks that 'input' can be parsed as a Managed H S M ID diff --git a/resource-manager/keyvault/2023-02-01/secrets/id_secret.go b/resource-manager/keyvault/2023-02-01/secrets/id_secret.go index 8a49182de8a..f6d82f14bc9 100644 --- a/resource-manager/keyvault/2023-02-01/secrets/id_secret.go +++ b/resource-manager/keyvault/2023-02-01/secrets/id_secret.go @@ -38,23 +38,9 @@ func ParseSecretID(input string) (*SecretId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecretId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.SecretName, ok = parsed.Parsed["secretName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "secretName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSecretIDInsensitively(input string) (*SecretId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecretId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SecretId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.SecretName, ok = parsed.Parsed["secretName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "secretName", *parsed) + if id.SecretName, ok = input.Parsed["secretName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "secretName", input) } - return &id, nil + return nil } // ValidateSecretID checks that 'input' can be parsed as a Secret ID diff --git a/resource-manager/keyvault/2023-02-01/vaults/id_deletedvault.go b/resource-manager/keyvault/2023-02-01/vaults/id_deletedvault.go index 302dfecbaef..0c4d26d40d2 100644 --- a/resource-manager/keyvault/2023-02-01/vaults/id_deletedvault.go +++ b/resource-manager/keyvault/2023-02-01/vaults/id_deletedvault.go @@ -36,19 +36,9 @@ func ParseDeletedVaultID(input string) (*DeletedVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeletedVaultId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.DeletedVaultName, ok = parsed.Parsed["deletedVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedVaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDeletedVaultIDInsensitively(input string) (*DeletedVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeletedVaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DeletedVaultId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.DeletedVaultName, ok = parsed.Parsed["deletedVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedVaultName", *parsed) + if id.DeletedVaultName, ok = input.Parsed["deletedVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deletedVaultName", input) } - return &id, nil + return nil } // ValidateDeletedVaultID checks that 'input' can be parsed as a Deleted Vault ID diff --git a/resource-manager/keyvault/2023-02-01/vaults/id_operationkind.go b/resource-manager/keyvault/2023-02-01/vaults/id_operationkind.go index 0392b20df3a..043f7bcd239 100644 --- a/resource-manager/keyvault/2023-02-01/vaults/id_operationkind.go +++ b/resource-manager/keyvault/2023-02-01/vaults/id_operationkind.go @@ -38,31 +38,9 @@ func ParseOperationKindID(input string) (*OperationKindId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationKindId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if v, ok := parsed.Parsed["operationKind"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationKind", *parsed) - } - - operationKind, err := parseAccessPolicyUpdateKind(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.OperationKind = *operationKind + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -77,34 +55,42 @@ func ParseOperationKindIDInsensitively(input string) (*OperationKindId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationKindId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *OperationKindId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if v, ok := parsed.Parsed["operationKind"]; true { + if v, ok := input.Parsed["operationKind"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationKind", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "operationKind", input) } operationKind, err := parseAccessPolicyUpdateKind(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.OperationKind = *operationKind } - return &id, nil + return nil } // ValidateOperationKindID checks that 'input' can be parsed as a Operation Kind ID diff --git a/resource-manager/keyvault/2023-07-01/managedhsmkeys/id_key.go b/resource-manager/keyvault/2023-07-01/managedhsmkeys/id_key.go index 02d50309e48..48f1bbe5f12 100644 --- a/resource-manager/keyvault/2023-07-01/managedhsmkeys/id_key.go +++ b/resource-manager/keyvault/2023-07-01/managedhsmkeys/id_key.go @@ -38,23 +38,9 @@ func ParseKeyID(input string) (*KeyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := KeyId{} - - 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.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) - } - - if id.KeyName, ok = parsed.Parsed["keyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseKeyIDInsensitively(input string) (*KeyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := KeyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *KeyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) + if id.ManagedHSMName, ok = input.Parsed["managedHSMName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", input) } - if id.KeyName, ok = parsed.Parsed["keyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyName", *parsed) + if id.KeyName, ok = input.Parsed["keyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "keyName", input) } - return &id, nil + return nil } // ValidateKeyID checks that 'input' can be parsed as a Key ID diff --git a/resource-manager/keyvault/2023-07-01/managedhsmkeys/id_managedhsm.go b/resource-manager/keyvault/2023-07-01/managedhsmkeys/id_managedhsm.go index e6740fadc9c..5f5090575d4 100644 --- a/resource-manager/keyvault/2023-07-01/managedhsmkeys/id_managedhsm.go +++ b/resource-manager/keyvault/2023-07-01/managedhsmkeys/id_managedhsm.go @@ -36,19 +36,9 @@ func ParseManagedHSMID(input string) (*ManagedHSMId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedHSMId{} - - 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.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagedHSMIDInsensitively(input string) (*ManagedHSMId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedHSMId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagedHSMId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) + if id.ManagedHSMName, ok = input.Parsed["managedHSMName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", input) } - return &id, nil + return nil } // ValidateManagedHSMID checks that 'input' can be parsed as a Managed H S M ID diff --git a/resource-manager/keyvault/2023-07-01/managedhsmkeys/id_version.go b/resource-manager/keyvault/2023-07-01/managedhsmkeys/id_version.go index 641a3a632a3..5afafa1334a 100644 --- a/resource-manager/keyvault/2023-07-01/managedhsmkeys/id_version.go +++ b/resource-manager/keyvault/2023-07-01/managedhsmkeys/id_version.go @@ -40,27 +40,9 @@ func ParseVersionID(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} - - 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.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) - } - - if id.KeyName, ok = parsed.Parsed["keyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVersionIDInsensitively(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) + if id.ManagedHSMName, ok = input.Parsed["managedHSMName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", input) } - if id.KeyName, ok = parsed.Parsed["keyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyName", *parsed) + if id.KeyName, ok = input.Parsed["keyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "keyName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateVersionID checks that 'input' can be parsed as a Version ID diff --git a/resource-manager/keyvault/2023-07-01/managedhsms/id_deletedmanagedhsm.go b/resource-manager/keyvault/2023-07-01/managedhsms/id_deletedmanagedhsm.go index c3862fe0206..4b2ac8a24cc 100644 --- a/resource-manager/keyvault/2023-07-01/managedhsms/id_deletedmanagedhsm.go +++ b/resource-manager/keyvault/2023-07-01/managedhsms/id_deletedmanagedhsm.go @@ -36,19 +36,9 @@ func ParseDeletedManagedHSMID(input string) (*DeletedManagedHSMId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeletedManagedHSMId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.DeletedManagedHSMName, ok = parsed.Parsed["deletedManagedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedManagedHSMName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDeletedManagedHSMIDInsensitively(input string) (*DeletedManagedHSMId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeletedManagedHSMId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DeletedManagedHSMId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.DeletedManagedHSMName, ok = parsed.Parsed["deletedManagedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedManagedHSMName", *parsed) + if id.DeletedManagedHSMName, ok = input.Parsed["deletedManagedHSMName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deletedManagedHSMName", input) } - return &id, nil + return nil } // ValidateDeletedManagedHSMID checks that 'input' can be parsed as a Deleted Managed H S M ID diff --git a/resource-manager/keyvault/2023-07-01/managedhsms/id_managedhsm.go b/resource-manager/keyvault/2023-07-01/managedhsms/id_managedhsm.go index d77a6f896c8..f10f4c49899 100644 --- a/resource-manager/keyvault/2023-07-01/managedhsms/id_managedhsm.go +++ b/resource-manager/keyvault/2023-07-01/managedhsms/id_managedhsm.go @@ -36,19 +36,9 @@ func ParseManagedHSMID(input string) (*ManagedHSMId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedHSMId{} - - 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.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagedHSMIDInsensitively(input string) (*ManagedHSMId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedHSMId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagedHSMId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) + if id.ManagedHSMName, ok = input.Parsed["managedHSMName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", input) } - return &id, nil + return nil } // ValidateManagedHSMID checks that 'input' can be parsed as a Managed H S M ID diff --git a/resource-manager/keyvault/2023-07-01/mhsmlistprivateendpointconnections/id_managedhsm.go b/resource-manager/keyvault/2023-07-01/mhsmlistprivateendpointconnections/id_managedhsm.go index b968db4850a..67f1a3de761 100644 --- a/resource-manager/keyvault/2023-07-01/mhsmlistprivateendpointconnections/id_managedhsm.go +++ b/resource-manager/keyvault/2023-07-01/mhsmlistprivateendpointconnections/id_managedhsm.go @@ -36,19 +36,9 @@ func ParseManagedHSMID(input string) (*ManagedHSMId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedHSMId{} - - 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.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagedHSMIDInsensitively(input string) (*ManagedHSMId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedHSMId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagedHSMId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) + if id.ManagedHSMName, ok = input.Parsed["managedHSMName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", input) } - return &id, nil + return nil } // ValidateManagedHSMID checks that 'input' can be parsed as a Managed H S M ID diff --git a/resource-manager/keyvault/2023-07-01/mhsmlistregions/id_managedhsm.go b/resource-manager/keyvault/2023-07-01/mhsmlistregions/id_managedhsm.go index 01ee5c2ec83..c9b7eb24807 100644 --- a/resource-manager/keyvault/2023-07-01/mhsmlistregions/id_managedhsm.go +++ b/resource-manager/keyvault/2023-07-01/mhsmlistregions/id_managedhsm.go @@ -36,19 +36,9 @@ func ParseManagedHSMID(input string) (*ManagedHSMId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedHSMId{} - - 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.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagedHSMIDInsensitively(input string) (*ManagedHSMId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedHSMId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagedHSMId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) + if id.ManagedHSMName, ok = input.Parsed["managedHSMName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", input) } - return &id, nil + return nil } // ValidateManagedHSMID checks that 'input' can be parsed as a Managed H S M ID diff --git a/resource-manager/keyvault/2023-07-01/mhsmprivateendpointconnections/id_privateendpointconnection.go b/resource-manager/keyvault/2023-07-01/mhsmprivateendpointconnections/id_privateendpointconnection.go index 47ac8a590a6..7bf46bf4ca9 100644 --- a/resource-manager/keyvault/2023-07-01/mhsmprivateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/keyvault/2023-07-01/mhsmprivateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) + if id.ManagedHSMName, ok = input.Parsed["managedHSMName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/keyvault/2023-07-01/mhsmprivatelinkresources/id_managedhsm.go b/resource-manager/keyvault/2023-07-01/mhsmprivatelinkresources/id_managedhsm.go index 3624ed9a298..823b479507d 100644 --- a/resource-manager/keyvault/2023-07-01/mhsmprivatelinkresources/id_managedhsm.go +++ b/resource-manager/keyvault/2023-07-01/mhsmprivatelinkresources/id_managedhsm.go @@ -36,19 +36,9 @@ func ParseManagedHSMID(input string) (*ManagedHSMId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedHSMId{} - - 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.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagedHSMIDInsensitively(input string) (*ManagedHSMId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedHSMId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagedHSMId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedHSMName, ok = parsed.Parsed["managedHSMName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", *parsed) + if id.ManagedHSMName, ok = input.Parsed["managedHSMName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedHSMName", input) } - return &id, nil + return nil } // ValidateManagedHSMID checks that 'input' can be parsed as a Managed H S M ID diff --git a/resource-manager/keyvault/2023-07-01/secrets/id_secret.go b/resource-manager/keyvault/2023-07-01/secrets/id_secret.go index 8a49182de8a..f6d82f14bc9 100644 --- a/resource-manager/keyvault/2023-07-01/secrets/id_secret.go +++ b/resource-manager/keyvault/2023-07-01/secrets/id_secret.go @@ -38,23 +38,9 @@ func ParseSecretID(input string) (*SecretId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecretId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.SecretName, ok = parsed.Parsed["secretName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "secretName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSecretIDInsensitively(input string) (*SecretId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecretId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SecretId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.SecretName, ok = parsed.Parsed["secretName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "secretName", *parsed) + if id.SecretName, ok = input.Parsed["secretName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "secretName", input) } - return &id, nil + return nil } // ValidateSecretID checks that 'input' can be parsed as a Secret ID diff --git a/resource-manager/keyvault/2023-07-01/vaults/id_deletedvault.go b/resource-manager/keyvault/2023-07-01/vaults/id_deletedvault.go index 302dfecbaef..0c4d26d40d2 100644 --- a/resource-manager/keyvault/2023-07-01/vaults/id_deletedvault.go +++ b/resource-manager/keyvault/2023-07-01/vaults/id_deletedvault.go @@ -36,19 +36,9 @@ func ParseDeletedVaultID(input string) (*DeletedVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeletedVaultId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.DeletedVaultName, ok = parsed.Parsed["deletedVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedVaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDeletedVaultIDInsensitively(input string) (*DeletedVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeletedVaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DeletedVaultId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.DeletedVaultName, ok = parsed.Parsed["deletedVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedVaultName", *parsed) + if id.DeletedVaultName, ok = input.Parsed["deletedVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deletedVaultName", input) } - return &id, nil + return nil } // ValidateDeletedVaultID checks that 'input' can be parsed as a Deleted Vault ID diff --git a/resource-manager/keyvault/2023-07-01/vaults/id_operationkind.go b/resource-manager/keyvault/2023-07-01/vaults/id_operationkind.go index 0392b20df3a..043f7bcd239 100644 --- a/resource-manager/keyvault/2023-07-01/vaults/id_operationkind.go +++ b/resource-manager/keyvault/2023-07-01/vaults/id_operationkind.go @@ -38,31 +38,9 @@ func ParseOperationKindID(input string) (*OperationKindId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationKindId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if v, ok := parsed.Parsed["operationKind"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationKind", *parsed) - } - - operationKind, err := parseAccessPolicyUpdateKind(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.OperationKind = *operationKind + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -77,34 +55,42 @@ func ParseOperationKindIDInsensitively(input string) (*OperationKindId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationKindId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *OperationKindId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if v, ok := parsed.Parsed["operationKind"]; true { + if v, ok := input.Parsed["operationKind"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationKind", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "operationKind", input) } operationKind, err := parseAccessPolicyUpdateKind(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.OperationKind = *operationKind } - return &id, nil + return nil } // ValidateOperationKindID checks that 'input' can be parsed as a Operation Kind ID diff --git a/resource-manager/kubernetesconfiguration/2022-03-01/clusterextensions/id_scopedextension.go b/resource-manager/kubernetesconfiguration/2022-03-01/clusterextensions/id_scopedextension.go index fa166057a3c..18193870476 100644 --- a/resource-manager/kubernetesconfiguration/2022-03-01/clusterextensions/id_scopedextension.go +++ b/resource-manager/kubernetesconfiguration/2022-03-01/clusterextensions/id_scopedextension.go @@ -34,15 +34,9 @@ func ParseScopedExtensionID(input string) (*ScopedExtensionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedExtensionId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedExtensionIDInsensitively(input string) (*ScopedExtensionId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedExtensionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedExtensionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if id.ExtensionName, ok = input.Parsed["extensionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "extensionName", input) } - return &id, nil + return nil } // ValidateScopedExtensionID checks that 'input' can be parsed as a Scoped Extension ID diff --git a/resource-manager/kubernetesconfiguration/2022-03-01/extensions/id_scopedextension.go b/resource-manager/kubernetesconfiguration/2022-03-01/extensions/id_scopedextension.go index 71e88f4cb0b..fc732323813 100644 --- a/resource-manager/kubernetesconfiguration/2022-03-01/extensions/id_scopedextension.go +++ b/resource-manager/kubernetesconfiguration/2022-03-01/extensions/id_scopedextension.go @@ -34,15 +34,9 @@ func ParseScopedExtensionID(input string) (*ScopedExtensionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedExtensionId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedExtensionIDInsensitively(input string) (*ScopedExtensionId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedExtensionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedExtensionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if id.ExtensionName, ok = input.Parsed["extensionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "extensionName", input) } - return &id, nil + return nil } // ValidateScopedExtensionID checks that 'input' can be parsed as a Scoped Extension ID diff --git a/resource-manager/kubernetesconfiguration/2022-03-01/flux/id_scopedfluxconfiguration.go b/resource-manager/kubernetesconfiguration/2022-03-01/flux/id_scopedfluxconfiguration.go index dbf20b93bc2..551276a423b 100644 --- a/resource-manager/kubernetesconfiguration/2022-03-01/flux/id_scopedfluxconfiguration.go +++ b/resource-manager/kubernetesconfiguration/2022-03-01/flux/id_scopedfluxconfiguration.go @@ -34,15 +34,9 @@ func ParseScopedFluxConfigurationID(input string) (*ScopedFluxConfigurationId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedFluxConfigurationId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.FluxConfigurationName, ok = parsed.Parsed["fluxConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fluxConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedFluxConfigurationIDInsensitively(input string) (*ScopedFluxConfi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedFluxConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedFluxConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.FluxConfigurationName, ok = parsed.Parsed["fluxConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fluxConfigurationName", *parsed) + if id.FluxConfigurationName, ok = input.Parsed["fluxConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fluxConfigurationName", input) } - return &id, nil + return nil } // ValidateScopedFluxConfigurationID checks that 'input' can be parsed as a Scoped Flux Configuration ID diff --git a/resource-manager/kubernetesconfiguration/2022-03-01/fluxconfiguration/id_scopedfluxconfiguration.go b/resource-manager/kubernetesconfiguration/2022-03-01/fluxconfiguration/id_scopedfluxconfiguration.go index c757272429c..8be37f512e6 100644 --- a/resource-manager/kubernetesconfiguration/2022-03-01/fluxconfiguration/id_scopedfluxconfiguration.go +++ b/resource-manager/kubernetesconfiguration/2022-03-01/fluxconfiguration/id_scopedfluxconfiguration.go @@ -34,15 +34,9 @@ func ParseScopedFluxConfigurationID(input string) (*ScopedFluxConfigurationId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedFluxConfigurationId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.FluxConfigurationName, ok = parsed.Parsed["fluxConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fluxConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedFluxConfigurationIDInsensitively(input string) (*ScopedFluxConfi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedFluxConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedFluxConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.FluxConfigurationName, ok = parsed.Parsed["fluxConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fluxConfigurationName", *parsed) + if id.FluxConfigurationName, ok = input.Parsed["fluxConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fluxConfigurationName", input) } - return &id, nil + return nil } // ValidateScopedFluxConfigurationID checks that 'input' can be parsed as a Scoped Flux Configuration ID diff --git a/resource-manager/kubernetesconfiguration/2022-03-01/sourcecontrolconfiguration/id_scopedsourcecontrolconfiguration.go b/resource-manager/kubernetesconfiguration/2022-03-01/sourcecontrolconfiguration/id_scopedsourcecontrolconfiguration.go index 1fd639a3aae..824cf48bac4 100644 --- a/resource-manager/kubernetesconfiguration/2022-03-01/sourcecontrolconfiguration/id_scopedsourcecontrolconfiguration.go +++ b/resource-manager/kubernetesconfiguration/2022-03-01/sourcecontrolconfiguration/id_scopedsourcecontrolconfiguration.go @@ -34,15 +34,9 @@ func ParseScopedSourceControlConfigurationID(input string) (*ScopedSourceControl return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedSourceControlConfigurationId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.SourceControlConfigurationName, ok = parsed.Parsed["sourceControlConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedSourceControlConfigurationIDInsensitively(input string) (*Scoped return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedSourceControlConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedSourceControlConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.SourceControlConfigurationName, ok = parsed.Parsed["sourceControlConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlConfigurationName", *parsed) + if id.SourceControlConfigurationName, ok = input.Parsed["sourceControlConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sourceControlConfigurationName", input) } - return &id, nil + return nil } // ValidateScopedSourceControlConfigurationID checks that 'input' can be parsed as a Scoped Source Control Configuration ID diff --git a/resource-manager/kubernetesconfiguration/2022-11-01/clusterextensions/id_scopedextension.go b/resource-manager/kubernetesconfiguration/2022-11-01/clusterextensions/id_scopedextension.go index fa166057a3c..18193870476 100644 --- a/resource-manager/kubernetesconfiguration/2022-11-01/clusterextensions/id_scopedextension.go +++ b/resource-manager/kubernetesconfiguration/2022-11-01/clusterextensions/id_scopedextension.go @@ -34,15 +34,9 @@ func ParseScopedExtensionID(input string) (*ScopedExtensionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedExtensionId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedExtensionIDInsensitively(input string) (*ScopedExtensionId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedExtensionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedExtensionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if id.ExtensionName, ok = input.Parsed["extensionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "extensionName", input) } - return &id, nil + return nil } // ValidateScopedExtensionID checks that 'input' can be parsed as a Scoped Extension ID diff --git a/resource-manager/kubernetesconfiguration/2022-11-01/extensions/id_scopedextension.go b/resource-manager/kubernetesconfiguration/2022-11-01/extensions/id_scopedextension.go index 71e88f4cb0b..fc732323813 100644 --- a/resource-manager/kubernetesconfiguration/2022-11-01/extensions/id_scopedextension.go +++ b/resource-manager/kubernetesconfiguration/2022-11-01/extensions/id_scopedextension.go @@ -34,15 +34,9 @@ func ParseScopedExtensionID(input string) (*ScopedExtensionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedExtensionId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedExtensionIDInsensitively(input string) (*ScopedExtensionId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedExtensionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedExtensionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if id.ExtensionName, ok = input.Parsed["extensionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "extensionName", input) } - return &id, nil + return nil } // ValidateScopedExtensionID checks that 'input' can be parsed as a Scoped Extension ID diff --git a/resource-manager/kubernetesconfiguration/2022-11-01/flux/id_scopedfluxconfiguration.go b/resource-manager/kubernetesconfiguration/2022-11-01/flux/id_scopedfluxconfiguration.go index dbf20b93bc2..551276a423b 100644 --- a/resource-manager/kubernetesconfiguration/2022-11-01/flux/id_scopedfluxconfiguration.go +++ b/resource-manager/kubernetesconfiguration/2022-11-01/flux/id_scopedfluxconfiguration.go @@ -34,15 +34,9 @@ func ParseScopedFluxConfigurationID(input string) (*ScopedFluxConfigurationId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedFluxConfigurationId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.FluxConfigurationName, ok = parsed.Parsed["fluxConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fluxConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedFluxConfigurationIDInsensitively(input string) (*ScopedFluxConfi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedFluxConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedFluxConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.FluxConfigurationName, ok = parsed.Parsed["fluxConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fluxConfigurationName", *parsed) + if id.FluxConfigurationName, ok = input.Parsed["fluxConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fluxConfigurationName", input) } - return &id, nil + return nil } // ValidateScopedFluxConfigurationID checks that 'input' can be parsed as a Scoped Flux Configuration ID diff --git a/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/id_scopedfluxconfiguration.go b/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/id_scopedfluxconfiguration.go index c757272429c..8be37f512e6 100644 --- a/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/id_scopedfluxconfiguration.go +++ b/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/id_scopedfluxconfiguration.go @@ -34,15 +34,9 @@ func ParseScopedFluxConfigurationID(input string) (*ScopedFluxConfigurationId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedFluxConfigurationId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.FluxConfigurationName, ok = parsed.Parsed["fluxConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fluxConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedFluxConfigurationIDInsensitively(input string) (*ScopedFluxConfi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedFluxConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedFluxConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.FluxConfigurationName, ok = parsed.Parsed["fluxConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fluxConfigurationName", *parsed) + if id.FluxConfigurationName, ok = input.Parsed["fluxConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fluxConfigurationName", input) } - return &id, nil + return nil } // ValidateScopedFluxConfigurationID checks that 'input' can be parsed as a Scoped Flux Configuration ID diff --git a/resource-manager/kubernetesconfiguration/2022-11-01/sourcecontrolconfiguration/id_scopedsourcecontrolconfiguration.go b/resource-manager/kubernetesconfiguration/2022-11-01/sourcecontrolconfiguration/id_scopedsourcecontrolconfiguration.go index 1fd639a3aae..824cf48bac4 100644 --- a/resource-manager/kubernetesconfiguration/2022-11-01/sourcecontrolconfiguration/id_scopedsourcecontrolconfiguration.go +++ b/resource-manager/kubernetesconfiguration/2022-11-01/sourcecontrolconfiguration/id_scopedsourcecontrolconfiguration.go @@ -34,15 +34,9 @@ func ParseScopedSourceControlConfigurationID(input string) (*ScopedSourceControl return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedSourceControlConfigurationId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.SourceControlConfigurationName, ok = parsed.Parsed["sourceControlConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedSourceControlConfigurationIDInsensitively(input string) (*Scoped return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedSourceControlConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedSourceControlConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.SourceControlConfigurationName, ok = parsed.Parsed["sourceControlConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlConfigurationName", *parsed) + if id.SourceControlConfigurationName, ok = input.Parsed["sourceControlConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sourceControlConfigurationName", input) } - return &id, nil + return nil } // ValidateScopedSourceControlConfigurationID checks that 'input' can be parsed as a Scoped Source Control Configuration ID diff --git a/resource-manager/kubernetesconfiguration/2023-05-01/clusterextensions/id_scopedextension.go b/resource-manager/kubernetesconfiguration/2023-05-01/clusterextensions/id_scopedextension.go index fa166057a3c..18193870476 100644 --- a/resource-manager/kubernetesconfiguration/2023-05-01/clusterextensions/id_scopedextension.go +++ b/resource-manager/kubernetesconfiguration/2023-05-01/clusterextensions/id_scopedextension.go @@ -34,15 +34,9 @@ func ParseScopedExtensionID(input string) (*ScopedExtensionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedExtensionId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedExtensionIDInsensitively(input string) (*ScopedExtensionId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedExtensionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedExtensionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if id.ExtensionName, ok = input.Parsed["extensionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "extensionName", input) } - return &id, nil + return nil } // ValidateScopedExtensionID checks that 'input' can be parsed as a Scoped Extension ID diff --git a/resource-manager/kubernetesconfiguration/2023-05-01/extensions/id_scopedextension.go b/resource-manager/kubernetesconfiguration/2023-05-01/extensions/id_scopedextension.go index 71e88f4cb0b..fc732323813 100644 --- a/resource-manager/kubernetesconfiguration/2023-05-01/extensions/id_scopedextension.go +++ b/resource-manager/kubernetesconfiguration/2023-05-01/extensions/id_scopedextension.go @@ -34,15 +34,9 @@ func ParseScopedExtensionID(input string) (*ScopedExtensionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedExtensionId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedExtensionIDInsensitively(input string) (*ScopedExtensionId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedExtensionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedExtensionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if id.ExtensionName, ok = input.Parsed["extensionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "extensionName", input) } - return &id, nil + return nil } // ValidateScopedExtensionID checks that 'input' can be parsed as a Scoped Extension ID diff --git a/resource-manager/kubernetesconfiguration/2023-05-01/flux/id_scopedfluxconfiguration.go b/resource-manager/kubernetesconfiguration/2023-05-01/flux/id_scopedfluxconfiguration.go index dbf20b93bc2..551276a423b 100644 --- a/resource-manager/kubernetesconfiguration/2023-05-01/flux/id_scopedfluxconfiguration.go +++ b/resource-manager/kubernetesconfiguration/2023-05-01/flux/id_scopedfluxconfiguration.go @@ -34,15 +34,9 @@ func ParseScopedFluxConfigurationID(input string) (*ScopedFluxConfigurationId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedFluxConfigurationId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.FluxConfigurationName, ok = parsed.Parsed["fluxConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fluxConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedFluxConfigurationIDInsensitively(input string) (*ScopedFluxConfi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedFluxConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedFluxConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.FluxConfigurationName, ok = parsed.Parsed["fluxConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fluxConfigurationName", *parsed) + if id.FluxConfigurationName, ok = input.Parsed["fluxConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fluxConfigurationName", input) } - return &id, nil + return nil } // ValidateScopedFluxConfigurationID checks that 'input' can be parsed as a Scoped Flux Configuration ID diff --git a/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/id_scopedfluxconfiguration.go b/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/id_scopedfluxconfiguration.go index c757272429c..8be37f512e6 100644 --- a/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/id_scopedfluxconfiguration.go +++ b/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/id_scopedfluxconfiguration.go @@ -34,15 +34,9 @@ func ParseScopedFluxConfigurationID(input string) (*ScopedFluxConfigurationId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedFluxConfigurationId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.FluxConfigurationName, ok = parsed.Parsed["fluxConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fluxConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedFluxConfigurationIDInsensitively(input string) (*ScopedFluxConfi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedFluxConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedFluxConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.FluxConfigurationName, ok = parsed.Parsed["fluxConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fluxConfigurationName", *parsed) + if id.FluxConfigurationName, ok = input.Parsed["fluxConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fluxConfigurationName", input) } - return &id, nil + return nil } // ValidateScopedFluxConfigurationID checks that 'input' can be parsed as a Scoped Flux Configuration ID diff --git a/resource-manager/kubernetesconfiguration/2023-05-01/sourcecontrolconfiguration/id_scopedsourcecontrolconfiguration.go b/resource-manager/kubernetesconfiguration/2023-05-01/sourcecontrolconfiguration/id_scopedsourcecontrolconfiguration.go index 1fd639a3aae..824cf48bac4 100644 --- a/resource-manager/kubernetesconfiguration/2023-05-01/sourcecontrolconfiguration/id_scopedsourcecontrolconfiguration.go +++ b/resource-manager/kubernetesconfiguration/2023-05-01/sourcecontrolconfiguration/id_scopedsourcecontrolconfiguration.go @@ -34,15 +34,9 @@ func ParseScopedSourceControlConfigurationID(input string) (*ScopedSourceControl return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedSourceControlConfigurationId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.SourceControlConfigurationName, ok = parsed.Parsed["sourceControlConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedSourceControlConfigurationIDInsensitively(input string) (*Scoped return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedSourceControlConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedSourceControlConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.SourceControlConfigurationName, ok = parsed.Parsed["sourceControlConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlConfigurationName", *parsed) + if id.SourceControlConfigurationName, ok = input.Parsed["sourceControlConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sourceControlConfigurationName", input) } - return &id, nil + return nil } // ValidateScopedSourceControlConfigurationID checks that 'input' can be parsed as a Scoped Source Control Configuration ID diff --git a/resource-manager/kusto/2023-05-02/attacheddatabaseconfigurations/id_attacheddatabaseconfiguration.go b/resource-manager/kusto/2023-05-02/attacheddatabaseconfigurations/id_attacheddatabaseconfiguration.go index 1ef55042b11..d9251b45b61 100644 --- a/resource-manager/kusto/2023-05-02/attacheddatabaseconfigurations/id_attacheddatabaseconfiguration.go +++ b/resource-manager/kusto/2023-05-02/attacheddatabaseconfigurations/id_attacheddatabaseconfiguration.go @@ -38,23 +38,9 @@ func ParseAttachedDatabaseConfigurationID(input string) (*AttachedDatabaseConfig return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AttachedDatabaseConfigurationId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.AttachedDatabaseConfigurationName, ok = parsed.Parsed["attachedDatabaseConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "attachedDatabaseConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAttachedDatabaseConfigurationIDInsensitively(input string) (*AttachedD return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AttachedDatabaseConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AttachedDatabaseConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.AttachedDatabaseConfigurationName, ok = parsed.Parsed["attachedDatabaseConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "attachedDatabaseConfigurationName", *parsed) + if id.AttachedDatabaseConfigurationName, ok = input.Parsed["attachedDatabaseConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "attachedDatabaseConfigurationName", input) } - return &id, nil + return nil } // ValidateAttachedDatabaseConfigurationID checks that 'input' can be parsed as a Attached Database Configuration ID diff --git a/resource-manager/kusto/2023-05-02/attacheddatabaseconfigurations/id_cluster.go b/resource-manager/kusto/2023-05-02/attacheddatabaseconfigurations/id_cluster.go index 6444a544abf..bc9f3f862b5 100644 --- a/resource-manager/kusto/2023-05-02/attacheddatabaseconfigurations/id_cluster.go +++ b/resource-manager/kusto/2023-05-02/attacheddatabaseconfigurations/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/kusto/2023-05-02/clusterprincipalassignments/id_cluster.go b/resource-manager/kusto/2023-05-02/clusterprincipalassignments/id_cluster.go index 0d922041279..d00fd75eab6 100644 --- a/resource-manager/kusto/2023-05-02/clusterprincipalassignments/id_cluster.go +++ b/resource-manager/kusto/2023-05-02/clusterprincipalassignments/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/kusto/2023-05-02/clusterprincipalassignments/id_principalassignment.go b/resource-manager/kusto/2023-05-02/clusterprincipalassignments/id_principalassignment.go index cef7c3121ef..87c47d4a408 100644 --- a/resource-manager/kusto/2023-05-02/clusterprincipalassignments/id_principalassignment.go +++ b/resource-manager/kusto/2023-05-02/clusterprincipalassignments/id_principalassignment.go @@ -38,23 +38,9 @@ func ParsePrincipalAssignmentID(input string) (*PrincipalAssignmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrincipalAssignmentId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.PrincipalAssignmentName, ok = parsed.Parsed["principalAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "principalAssignmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrincipalAssignmentIDInsensitively(input string) (*PrincipalAssignment return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrincipalAssignmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrincipalAssignmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.PrincipalAssignmentName, ok = parsed.Parsed["principalAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "principalAssignmentName", *parsed) + if id.PrincipalAssignmentName, ok = input.Parsed["principalAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "principalAssignmentName", input) } - return &id, nil + return nil } // ValidatePrincipalAssignmentID checks that 'input' can be parsed as a Principal Assignment ID diff --git a/resource-manager/kusto/2023-05-02/clusters/id_cluster.go b/resource-manager/kusto/2023-05-02/clusters/id_cluster.go index 9046ca67bcd..5acf72e1ab8 100644 --- a/resource-manager/kusto/2023-05-02/clusters/id_cluster.go +++ b/resource-manager/kusto/2023-05-02/clusters/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/kusto/2023-05-02/clusters/id_location.go b/resource-manager/kusto/2023-05-02/clusters/id_location.go index 2d6b8e58eb9..2a569e19785 100644 --- a/resource-manager/kusto/2023-05-02/clusters/id_location.go +++ b/resource-manager/kusto/2023-05-02/clusters/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/kusto/2023-05-02/databaseprincipalassignments/id_database.go b/resource-manager/kusto/2023-05-02/databaseprincipalassignments/id_database.go index 7ba0895461d..285829a20a3 100644 --- a/resource-manager/kusto/2023-05-02/databaseprincipalassignments/id_database.go +++ b/resource-manager/kusto/2023-05-02/databaseprincipalassignments/id_database.go @@ -38,23 +38,9 @@ func ParseDatabaseID(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDatabaseIDInsensitively(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - return &id, nil + return nil } // ValidateDatabaseID checks that 'input' can be parsed as a Database ID diff --git a/resource-manager/kusto/2023-05-02/databaseprincipalassignments/id_databaseprincipalassignment.go b/resource-manager/kusto/2023-05-02/databaseprincipalassignments/id_databaseprincipalassignment.go index 47802699b75..a35c71bbbe6 100644 --- a/resource-manager/kusto/2023-05-02/databaseprincipalassignments/id_databaseprincipalassignment.go +++ b/resource-manager/kusto/2023-05-02/databaseprincipalassignments/id_databaseprincipalassignment.go @@ -40,27 +40,9 @@ func ParseDatabasePrincipalAssignmentID(input string) (*DatabasePrincipalAssignm return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabasePrincipalAssignmentId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) - } - - if id.PrincipalAssignmentName, ok = parsed.Parsed["principalAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "principalAssignmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseDatabasePrincipalAssignmentIDInsensitively(input string) (*DatabasePri return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabasePrincipalAssignmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DatabasePrincipalAssignmentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.PrincipalAssignmentName, ok = parsed.Parsed["principalAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "principalAssignmentName", *parsed) + if id.PrincipalAssignmentName, ok = input.Parsed["principalAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "principalAssignmentName", input) } - return &id, nil + return nil } // ValidateDatabasePrincipalAssignmentID checks that 'input' can be parsed as a Database Principal Assignment ID diff --git a/resource-manager/kusto/2023-05-02/databases/id_cluster.go b/resource-manager/kusto/2023-05-02/databases/id_cluster.go index c001f3addd7..06e37de14e9 100644 --- a/resource-manager/kusto/2023-05-02/databases/id_cluster.go +++ b/resource-manager/kusto/2023-05-02/databases/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/kusto/2023-05-02/databases/id_database.go b/resource-manager/kusto/2023-05-02/databases/id_database.go index 5b3a47755ab..6bfdd684edc 100644 --- a/resource-manager/kusto/2023-05-02/databases/id_database.go +++ b/resource-manager/kusto/2023-05-02/databases/id_database.go @@ -38,23 +38,9 @@ func ParseDatabaseID(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDatabaseIDInsensitively(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - return &id, nil + return nil } // ValidateDatabaseID checks that 'input' can be parsed as a Database ID diff --git a/resource-manager/kusto/2023-05-02/dataconnections/id_database.go b/resource-manager/kusto/2023-05-02/dataconnections/id_database.go index 209be26d18a..4f95c1b1e44 100644 --- a/resource-manager/kusto/2023-05-02/dataconnections/id_database.go +++ b/resource-manager/kusto/2023-05-02/dataconnections/id_database.go @@ -38,23 +38,9 @@ func ParseDatabaseID(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDatabaseIDInsensitively(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - return &id, nil + return nil } // ValidateDatabaseID checks that 'input' can be parsed as a Database ID diff --git a/resource-manager/kusto/2023-05-02/dataconnections/id_dataconnection.go b/resource-manager/kusto/2023-05-02/dataconnections/id_dataconnection.go index dac1faf183d..ac2333340c6 100644 --- a/resource-manager/kusto/2023-05-02/dataconnections/id_dataconnection.go +++ b/resource-manager/kusto/2023-05-02/dataconnections/id_dataconnection.go @@ -40,27 +40,9 @@ func ParseDataConnectionID(input string) (*DataConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataConnectionId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) - } - - if id.DataConnectionName, ok = parsed.Parsed["dataConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseDataConnectionIDInsensitively(input string) (*DataConnectionId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DataConnectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.DataConnectionName, ok = parsed.Parsed["dataConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataConnectionName", *parsed) + if id.DataConnectionName, ok = input.Parsed["dataConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataConnectionName", input) } - return &id, nil + return nil } // ValidateDataConnectionID checks that 'input' can be parsed as a Data Connection ID diff --git a/resource-manager/kusto/2023-05-02/kusto/id_location.go b/resource-manager/kusto/2023-05-02/kusto/id_location.go index 1f3778f4382..9065d56b54a 100644 --- a/resource-manager/kusto/2023-05-02/kusto/id_location.go +++ b/resource-manager/kusto/2023-05-02/kusto/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/kusto/2023-05-02/managedprivateendpoints/id_cluster.go b/resource-manager/kusto/2023-05-02/managedprivateendpoints/id_cluster.go index 180a05beaf5..520080b7811 100644 --- a/resource-manager/kusto/2023-05-02/managedprivateendpoints/id_cluster.go +++ b/resource-manager/kusto/2023-05-02/managedprivateendpoints/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/kusto/2023-05-02/managedprivateendpoints/id_managedprivateendpoint.go b/resource-manager/kusto/2023-05-02/managedprivateendpoints/id_managedprivateendpoint.go index f1c3fcd8335..5f1262dda07 100644 --- a/resource-manager/kusto/2023-05-02/managedprivateendpoints/id_managedprivateendpoint.go +++ b/resource-manager/kusto/2023-05-02/managedprivateendpoints/id_managedprivateendpoint.go @@ -38,23 +38,9 @@ func ParseManagedPrivateEndpointID(input string) (*ManagedPrivateEndpointId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedPrivateEndpointId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.ManagedPrivateEndpointName, ok = parsed.Parsed["managedPrivateEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedPrivateEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseManagedPrivateEndpointIDInsensitively(input string) (*ManagedPrivateEn return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedPrivateEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ManagedPrivateEndpointId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.ManagedPrivateEndpointName, ok = parsed.Parsed["managedPrivateEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedPrivateEndpointName", *parsed) + if id.ManagedPrivateEndpointName, ok = input.Parsed["managedPrivateEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedPrivateEndpointName", input) } - return &id, nil + return nil } // ValidateManagedPrivateEndpointID checks that 'input' can be parsed as a Managed Private Endpoint ID diff --git a/resource-manager/kusto/2023-05-02/outboundnetworkdependenciesendpoints/id_cluster.go b/resource-manager/kusto/2023-05-02/outboundnetworkdependenciesendpoints/id_cluster.go index 75c2b7e5e44..4feb45eb5cc 100644 --- a/resource-manager/kusto/2023-05-02/outboundnetworkdependenciesendpoints/id_cluster.go +++ b/resource-manager/kusto/2023-05-02/outboundnetworkdependenciesendpoints/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/kusto/2023-05-02/privateendpointconnections/id_cluster.go b/resource-manager/kusto/2023-05-02/privateendpointconnections/id_cluster.go index 3b1bb2e0ef8..e9da093800f 100644 --- a/resource-manager/kusto/2023-05-02/privateendpointconnections/id_cluster.go +++ b/resource-manager/kusto/2023-05-02/privateendpointconnections/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/kusto/2023-05-02/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/kusto/2023-05-02/privateendpointconnections/id_privateendpointconnection.go index 887b2eaa26c..a2001496252 100644 --- a/resource-manager/kusto/2023-05-02/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/kusto/2023-05-02/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/kusto/2023-05-02/privatelinkresources/id_cluster.go b/resource-manager/kusto/2023-05-02/privatelinkresources/id_cluster.go index c09b8c61a6b..d1d23f91c7d 100644 --- a/resource-manager/kusto/2023-05-02/privatelinkresources/id_cluster.go +++ b/resource-manager/kusto/2023-05-02/privatelinkresources/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/kusto/2023-05-02/privatelinkresources/id_privatelinkresource.go b/resource-manager/kusto/2023-05-02/privatelinkresources/id_privatelinkresource.go index d0cbb41afd4..d49905d4672 100644 --- a/resource-manager/kusto/2023-05-02/privatelinkresources/id_privatelinkresource.go +++ b/resource-manager/kusto/2023-05-02/privatelinkresources/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/kusto/2023-05-02/scripts/id_database.go b/resource-manager/kusto/2023-05-02/scripts/id_database.go index e52f80843cb..8c3b1a57965 100644 --- a/resource-manager/kusto/2023-05-02/scripts/id_database.go +++ b/resource-manager/kusto/2023-05-02/scripts/id_database.go @@ -38,23 +38,9 @@ func ParseDatabaseID(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDatabaseIDInsensitively(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - return &id, nil + return nil } // ValidateDatabaseID checks that 'input' can be parsed as a Database ID diff --git a/resource-manager/kusto/2023-05-02/scripts/id_script.go b/resource-manager/kusto/2023-05-02/scripts/id_script.go index a23b42902ec..aa9cc3bbb57 100644 --- a/resource-manager/kusto/2023-05-02/scripts/id_script.go +++ b/resource-manager/kusto/2023-05-02/scripts/id_script.go @@ -40,27 +40,9 @@ func ParseScriptID(input string) (*ScriptId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScriptId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) - } - - if id.ScriptName, ok = parsed.Parsed["scriptName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scriptName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseScriptIDInsensitively(input string) (*ScriptId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScriptId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ScriptId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.ScriptName, ok = parsed.Parsed["scriptName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scriptName", *parsed) + if id.ScriptName, ok = input.Parsed["scriptName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scriptName", input) } - return &id, nil + return nil } // ValidateScriptID checks that 'input' can be parsed as a Script ID diff --git a/resource-manager/kusto/2023-08-15/attacheddatabaseconfigurations/id_attacheddatabaseconfiguration.go b/resource-manager/kusto/2023-08-15/attacheddatabaseconfigurations/id_attacheddatabaseconfiguration.go index 1ef55042b11..d9251b45b61 100644 --- a/resource-manager/kusto/2023-08-15/attacheddatabaseconfigurations/id_attacheddatabaseconfiguration.go +++ b/resource-manager/kusto/2023-08-15/attacheddatabaseconfigurations/id_attacheddatabaseconfiguration.go @@ -38,23 +38,9 @@ func ParseAttachedDatabaseConfigurationID(input string) (*AttachedDatabaseConfig return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AttachedDatabaseConfigurationId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.AttachedDatabaseConfigurationName, ok = parsed.Parsed["attachedDatabaseConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "attachedDatabaseConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAttachedDatabaseConfigurationIDInsensitively(input string) (*AttachedD return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AttachedDatabaseConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AttachedDatabaseConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.AttachedDatabaseConfigurationName, ok = parsed.Parsed["attachedDatabaseConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "attachedDatabaseConfigurationName", *parsed) + if id.AttachedDatabaseConfigurationName, ok = input.Parsed["attachedDatabaseConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "attachedDatabaseConfigurationName", input) } - return &id, nil + return nil } // ValidateAttachedDatabaseConfigurationID checks that 'input' can be parsed as a Attached Database Configuration ID diff --git a/resource-manager/kusto/2023-08-15/attacheddatabaseconfigurations/id_cluster.go b/resource-manager/kusto/2023-08-15/attacheddatabaseconfigurations/id_cluster.go index 6444a544abf..bc9f3f862b5 100644 --- a/resource-manager/kusto/2023-08-15/attacheddatabaseconfigurations/id_cluster.go +++ b/resource-manager/kusto/2023-08-15/attacheddatabaseconfigurations/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/kusto/2023-08-15/clusterprincipalassignments/id_cluster.go b/resource-manager/kusto/2023-08-15/clusterprincipalassignments/id_cluster.go index 0d922041279..d00fd75eab6 100644 --- a/resource-manager/kusto/2023-08-15/clusterprincipalassignments/id_cluster.go +++ b/resource-manager/kusto/2023-08-15/clusterprincipalassignments/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/kusto/2023-08-15/clusterprincipalassignments/id_principalassignment.go b/resource-manager/kusto/2023-08-15/clusterprincipalassignments/id_principalassignment.go index cef7c3121ef..87c47d4a408 100644 --- a/resource-manager/kusto/2023-08-15/clusterprincipalassignments/id_principalassignment.go +++ b/resource-manager/kusto/2023-08-15/clusterprincipalassignments/id_principalassignment.go @@ -38,23 +38,9 @@ func ParsePrincipalAssignmentID(input string) (*PrincipalAssignmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrincipalAssignmentId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.PrincipalAssignmentName, ok = parsed.Parsed["principalAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "principalAssignmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrincipalAssignmentIDInsensitively(input string) (*PrincipalAssignment return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrincipalAssignmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrincipalAssignmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.PrincipalAssignmentName, ok = parsed.Parsed["principalAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "principalAssignmentName", *parsed) + if id.PrincipalAssignmentName, ok = input.Parsed["principalAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "principalAssignmentName", input) } - return &id, nil + return nil } // ValidatePrincipalAssignmentID checks that 'input' can be parsed as a Principal Assignment ID diff --git a/resource-manager/kusto/2023-08-15/clusters/id_cluster.go b/resource-manager/kusto/2023-08-15/clusters/id_cluster.go index 9046ca67bcd..5acf72e1ab8 100644 --- a/resource-manager/kusto/2023-08-15/clusters/id_cluster.go +++ b/resource-manager/kusto/2023-08-15/clusters/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/kusto/2023-08-15/clusters/id_location.go b/resource-manager/kusto/2023-08-15/clusters/id_location.go index 2d6b8e58eb9..2a569e19785 100644 --- a/resource-manager/kusto/2023-08-15/clusters/id_location.go +++ b/resource-manager/kusto/2023-08-15/clusters/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/kusto/2023-08-15/databaseprincipalassignments/id_database.go b/resource-manager/kusto/2023-08-15/databaseprincipalassignments/id_database.go index 7ba0895461d..285829a20a3 100644 --- a/resource-manager/kusto/2023-08-15/databaseprincipalassignments/id_database.go +++ b/resource-manager/kusto/2023-08-15/databaseprincipalassignments/id_database.go @@ -38,23 +38,9 @@ func ParseDatabaseID(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDatabaseIDInsensitively(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - return &id, nil + return nil } // ValidateDatabaseID checks that 'input' can be parsed as a Database ID diff --git a/resource-manager/kusto/2023-08-15/databaseprincipalassignments/id_databaseprincipalassignment.go b/resource-manager/kusto/2023-08-15/databaseprincipalassignments/id_databaseprincipalassignment.go index 47802699b75..a35c71bbbe6 100644 --- a/resource-manager/kusto/2023-08-15/databaseprincipalassignments/id_databaseprincipalassignment.go +++ b/resource-manager/kusto/2023-08-15/databaseprincipalassignments/id_databaseprincipalassignment.go @@ -40,27 +40,9 @@ func ParseDatabasePrincipalAssignmentID(input string) (*DatabasePrincipalAssignm return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabasePrincipalAssignmentId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) - } - - if id.PrincipalAssignmentName, ok = parsed.Parsed["principalAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "principalAssignmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseDatabasePrincipalAssignmentIDInsensitively(input string) (*DatabasePri return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabasePrincipalAssignmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DatabasePrincipalAssignmentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.PrincipalAssignmentName, ok = parsed.Parsed["principalAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "principalAssignmentName", *parsed) + if id.PrincipalAssignmentName, ok = input.Parsed["principalAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "principalAssignmentName", input) } - return &id, nil + return nil } // ValidateDatabasePrincipalAssignmentID checks that 'input' can be parsed as a Database Principal Assignment ID diff --git a/resource-manager/kusto/2023-08-15/databases/id_cluster.go b/resource-manager/kusto/2023-08-15/databases/id_cluster.go index c001f3addd7..06e37de14e9 100644 --- a/resource-manager/kusto/2023-08-15/databases/id_cluster.go +++ b/resource-manager/kusto/2023-08-15/databases/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/kusto/2023-08-15/databases/id_database.go b/resource-manager/kusto/2023-08-15/databases/id_database.go index 5b3a47755ab..6bfdd684edc 100644 --- a/resource-manager/kusto/2023-08-15/databases/id_database.go +++ b/resource-manager/kusto/2023-08-15/databases/id_database.go @@ -38,23 +38,9 @@ func ParseDatabaseID(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDatabaseIDInsensitively(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - return &id, nil + return nil } // ValidateDatabaseID checks that 'input' can be parsed as a Database ID diff --git a/resource-manager/kusto/2023-08-15/dataconnections/id_database.go b/resource-manager/kusto/2023-08-15/dataconnections/id_database.go index 209be26d18a..4f95c1b1e44 100644 --- a/resource-manager/kusto/2023-08-15/dataconnections/id_database.go +++ b/resource-manager/kusto/2023-08-15/dataconnections/id_database.go @@ -38,23 +38,9 @@ func ParseDatabaseID(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDatabaseIDInsensitively(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - return &id, nil + return nil } // ValidateDatabaseID checks that 'input' can be parsed as a Database ID diff --git a/resource-manager/kusto/2023-08-15/dataconnections/id_dataconnection.go b/resource-manager/kusto/2023-08-15/dataconnections/id_dataconnection.go index dac1faf183d..ac2333340c6 100644 --- a/resource-manager/kusto/2023-08-15/dataconnections/id_dataconnection.go +++ b/resource-manager/kusto/2023-08-15/dataconnections/id_dataconnection.go @@ -40,27 +40,9 @@ func ParseDataConnectionID(input string) (*DataConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataConnectionId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) - } - - if id.DataConnectionName, ok = parsed.Parsed["dataConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseDataConnectionIDInsensitively(input string) (*DataConnectionId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DataConnectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.DataConnectionName, ok = parsed.Parsed["dataConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataConnectionName", *parsed) + if id.DataConnectionName, ok = input.Parsed["dataConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataConnectionName", input) } - return &id, nil + return nil } // ValidateDataConnectionID checks that 'input' can be parsed as a Data Connection ID diff --git a/resource-manager/kusto/2023-08-15/kusto/id_location.go b/resource-manager/kusto/2023-08-15/kusto/id_location.go index 1f3778f4382..9065d56b54a 100644 --- a/resource-manager/kusto/2023-08-15/kusto/id_location.go +++ b/resource-manager/kusto/2023-08-15/kusto/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/kusto/2023-08-15/managedprivateendpoints/id_cluster.go b/resource-manager/kusto/2023-08-15/managedprivateendpoints/id_cluster.go index 180a05beaf5..520080b7811 100644 --- a/resource-manager/kusto/2023-08-15/managedprivateendpoints/id_cluster.go +++ b/resource-manager/kusto/2023-08-15/managedprivateendpoints/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/kusto/2023-08-15/managedprivateendpoints/id_managedprivateendpoint.go b/resource-manager/kusto/2023-08-15/managedprivateendpoints/id_managedprivateendpoint.go index f1c3fcd8335..5f1262dda07 100644 --- a/resource-manager/kusto/2023-08-15/managedprivateendpoints/id_managedprivateendpoint.go +++ b/resource-manager/kusto/2023-08-15/managedprivateendpoints/id_managedprivateendpoint.go @@ -38,23 +38,9 @@ func ParseManagedPrivateEndpointID(input string) (*ManagedPrivateEndpointId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedPrivateEndpointId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.ManagedPrivateEndpointName, ok = parsed.Parsed["managedPrivateEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedPrivateEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseManagedPrivateEndpointIDInsensitively(input string) (*ManagedPrivateEn return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedPrivateEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ManagedPrivateEndpointId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.ManagedPrivateEndpointName, ok = parsed.Parsed["managedPrivateEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedPrivateEndpointName", *parsed) + if id.ManagedPrivateEndpointName, ok = input.Parsed["managedPrivateEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedPrivateEndpointName", input) } - return &id, nil + return nil } // ValidateManagedPrivateEndpointID checks that 'input' can be parsed as a Managed Private Endpoint ID diff --git a/resource-manager/kusto/2023-08-15/outboundnetworkdependenciesendpoints/id_cluster.go b/resource-manager/kusto/2023-08-15/outboundnetworkdependenciesendpoints/id_cluster.go index 75c2b7e5e44..4feb45eb5cc 100644 --- a/resource-manager/kusto/2023-08-15/outboundnetworkdependenciesendpoints/id_cluster.go +++ b/resource-manager/kusto/2023-08-15/outboundnetworkdependenciesendpoints/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/kusto/2023-08-15/privateendpointconnections/id_cluster.go b/resource-manager/kusto/2023-08-15/privateendpointconnections/id_cluster.go index 3b1bb2e0ef8..e9da093800f 100644 --- a/resource-manager/kusto/2023-08-15/privateendpointconnections/id_cluster.go +++ b/resource-manager/kusto/2023-08-15/privateendpointconnections/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/kusto/2023-08-15/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/kusto/2023-08-15/privateendpointconnections/id_privateendpointconnection.go index 887b2eaa26c..a2001496252 100644 --- a/resource-manager/kusto/2023-08-15/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/kusto/2023-08-15/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/kusto/2023-08-15/privatelinkresources/id_cluster.go b/resource-manager/kusto/2023-08-15/privatelinkresources/id_cluster.go index c09b8c61a6b..d1d23f91c7d 100644 --- a/resource-manager/kusto/2023-08-15/privatelinkresources/id_cluster.go +++ b/resource-manager/kusto/2023-08-15/privatelinkresources/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/kusto/2023-08-15/privatelinkresources/id_privatelinkresource.go b/resource-manager/kusto/2023-08-15/privatelinkresources/id_privatelinkresource.go index d0cbb41afd4..d49905d4672 100644 --- a/resource-manager/kusto/2023-08-15/privatelinkresources/id_privatelinkresource.go +++ b/resource-manager/kusto/2023-08-15/privatelinkresources/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/kusto/2023-08-15/sandboxcustomimages/id_cluster.go b/resource-manager/kusto/2023-08-15/sandboxcustomimages/id_cluster.go index e72771586cc..3686ac18149 100644 --- a/resource-manager/kusto/2023-08-15/sandboxcustomimages/id_cluster.go +++ b/resource-manager/kusto/2023-08-15/sandboxcustomimages/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/kusto/2023-08-15/sandboxcustomimages/id_sandboxcustomimage.go b/resource-manager/kusto/2023-08-15/sandboxcustomimages/id_sandboxcustomimage.go index 2382f87460c..fe60d2bf752 100644 --- a/resource-manager/kusto/2023-08-15/sandboxcustomimages/id_sandboxcustomimage.go +++ b/resource-manager/kusto/2023-08-15/sandboxcustomimages/id_sandboxcustomimage.go @@ -38,23 +38,9 @@ func ParseSandboxCustomImageID(input string) (*SandboxCustomImageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SandboxCustomImageId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.SandboxCustomImageName, ok = parsed.Parsed["sandboxCustomImageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sandboxCustomImageName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSandboxCustomImageIDInsensitively(input string) (*SandboxCustomImageId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SandboxCustomImageId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SandboxCustomImageId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.SandboxCustomImageName, ok = parsed.Parsed["sandboxCustomImageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sandboxCustomImageName", *parsed) + if id.SandboxCustomImageName, ok = input.Parsed["sandboxCustomImageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sandboxCustomImageName", input) } - return &id, nil + return nil } // ValidateSandboxCustomImageID checks that 'input' can be parsed as a Sandbox Custom Image ID diff --git a/resource-manager/kusto/2023-08-15/scripts/id_database.go b/resource-manager/kusto/2023-08-15/scripts/id_database.go index e52f80843cb..8c3b1a57965 100644 --- a/resource-manager/kusto/2023-08-15/scripts/id_database.go +++ b/resource-manager/kusto/2023-08-15/scripts/id_database.go @@ -38,23 +38,9 @@ func ParseDatabaseID(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDatabaseIDInsensitively(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - return &id, nil + return nil } // ValidateDatabaseID checks that 'input' can be parsed as a Database ID diff --git a/resource-manager/kusto/2023-08-15/scripts/id_script.go b/resource-manager/kusto/2023-08-15/scripts/id_script.go index a23b42902ec..aa9cc3bbb57 100644 --- a/resource-manager/kusto/2023-08-15/scripts/id_script.go +++ b/resource-manager/kusto/2023-08-15/scripts/id_script.go @@ -40,27 +40,9 @@ func ParseScriptID(input string) (*ScriptId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScriptId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) - } - - if id.ScriptName, ok = parsed.Parsed["scriptName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scriptName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseScriptIDInsensitively(input string) (*ScriptId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScriptId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ScriptId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.ScriptName, ok = parsed.Parsed["scriptName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scriptName", *parsed) + if id.ScriptName, ok = input.Parsed["scriptName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scriptName", input) } - return &id, nil + return nil } // ValidateScriptID checks that 'input' can be parsed as a Script ID diff --git a/resource-manager/labservices/2021-10-01-preview/image/id_image.go b/resource-manager/labservices/2021-10-01-preview/image/id_image.go index 50ba6c3e256..a94d13a3b27 100644 --- a/resource-manager/labservices/2021-10-01-preview/image/id_image.go +++ b/resource-manager/labservices/2021-10-01-preview/image/id_image.go @@ -38,23 +38,9 @@ func ParseImageID(input string) (*ImageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ImageId{} - - 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.LabPlanName, ok = parsed.Parsed["labPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labPlanName", *parsed) - } - - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseImageIDInsensitively(input string) (*ImageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ImageId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ImageId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabPlanName, ok = parsed.Parsed["labPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labPlanName", *parsed) + if id.LabPlanName, ok = input.Parsed["labPlanName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labPlanName", input) } - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) + if id.ImageName, ok = input.Parsed["imageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "imageName", input) } - return &id, nil + return nil } // ValidateImageID checks that 'input' can be parsed as a Image ID diff --git a/resource-manager/labservices/2021-10-01-preview/image/id_labplan.go b/resource-manager/labservices/2021-10-01-preview/image/id_labplan.go index 731701afd29..c41dc2c5136 100644 --- a/resource-manager/labservices/2021-10-01-preview/image/id_labplan.go +++ b/resource-manager/labservices/2021-10-01-preview/image/id_labplan.go @@ -36,19 +36,9 @@ func ParseLabPlanID(input string) (*LabPlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabPlanId{} - - 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.LabPlanName, ok = parsed.Parsed["labPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labPlanName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLabPlanIDInsensitively(input string) (*LabPlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabPlanId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LabPlanId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabPlanName, ok = parsed.Parsed["labPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labPlanName", *parsed) + if id.LabPlanName, ok = input.Parsed["labPlanName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labPlanName", input) } - return &id, nil + return nil } // ValidateLabPlanID checks that 'input' can be parsed as a Lab Plan ID diff --git a/resource-manager/labservices/2021-10-01-preview/lab/id_lab.go b/resource-manager/labservices/2021-10-01-preview/lab/id_lab.go index fb259e50022..95f989599af 100644 --- a/resource-manager/labservices/2021-10-01-preview/lab/id_lab.go +++ b/resource-manager/labservices/2021-10-01-preview/lab/id_lab.go @@ -36,19 +36,9 @@ func ParseLabID(input string) (*LabId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLabIDInsensitively(input string) (*LabId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LabId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - return &id, nil + return nil } // ValidateLabID checks that 'input' can be parsed as a Lab ID diff --git a/resource-manager/labservices/2021-10-01-preview/labplan/id_labplan.go b/resource-manager/labservices/2021-10-01-preview/labplan/id_labplan.go index 67b7282f677..5d9ef6f14fb 100644 --- a/resource-manager/labservices/2021-10-01-preview/labplan/id_labplan.go +++ b/resource-manager/labservices/2021-10-01-preview/labplan/id_labplan.go @@ -36,19 +36,9 @@ func ParseLabPlanID(input string) (*LabPlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabPlanId{} - - 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.LabPlanName, ok = parsed.Parsed["labPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labPlanName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLabPlanIDInsensitively(input string) (*LabPlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabPlanId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LabPlanId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabPlanName, ok = parsed.Parsed["labPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labPlanName", *parsed) + if id.LabPlanName, ok = input.Parsed["labPlanName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labPlanName", input) } - return &id, nil + return nil } // ValidateLabPlanID checks that 'input' can be parsed as a Lab Plan ID diff --git a/resource-manager/labservices/2021-10-01-preview/schedule/id_lab.go b/resource-manager/labservices/2021-10-01-preview/schedule/id_lab.go index d346be0c1ca..5a1446e3405 100644 --- a/resource-manager/labservices/2021-10-01-preview/schedule/id_lab.go +++ b/resource-manager/labservices/2021-10-01-preview/schedule/id_lab.go @@ -36,19 +36,9 @@ func ParseLabID(input string) (*LabId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLabIDInsensitively(input string) (*LabId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LabId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - return &id, nil + return nil } // ValidateLabID checks that 'input' can be parsed as a Lab ID diff --git a/resource-manager/labservices/2021-10-01-preview/schedule/id_schedule.go b/resource-manager/labservices/2021-10-01-preview/schedule/id_schedule.go index e13b87fab1a..7da1be7633a 100644 --- a/resource-manager/labservices/2021-10-01-preview/schedule/id_schedule.go +++ b/resource-manager/labservices/2021-10-01-preview/schedule/id_schedule.go @@ -38,23 +38,9 @@ func ParseScheduleID(input string) (*ScheduleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScheduleId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) - } - - if id.ScheduleName, ok = parsed.Parsed["scheduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseScheduleIDInsensitively(input string) (*ScheduleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScheduleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ScheduleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - if id.ScheduleName, ok = parsed.Parsed["scheduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", *parsed) + if id.ScheduleName, ok = input.Parsed["scheduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", input) } - return &id, nil + return nil } // ValidateScheduleID checks that 'input' can be parsed as a Schedule ID diff --git a/resource-manager/labservices/2021-10-01-preview/user/id_lab.go b/resource-manager/labservices/2021-10-01-preview/user/id_lab.go index 072edef3eaa..3a1117bd14a 100644 --- a/resource-manager/labservices/2021-10-01-preview/user/id_lab.go +++ b/resource-manager/labservices/2021-10-01-preview/user/id_lab.go @@ -36,19 +36,9 @@ func ParseLabID(input string) (*LabId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLabIDInsensitively(input string) (*LabId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LabId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - return &id, nil + return nil } // ValidateLabID checks that 'input' can be parsed as a Lab ID diff --git a/resource-manager/labservices/2021-10-01-preview/user/id_user.go b/resource-manager/labservices/2021-10-01-preview/user/id_user.go index 0997c551307..ce75d900d7a 100644 --- a/resource-manager/labservices/2021-10-01-preview/user/id_user.go +++ b/resource-manager/labservices/2021-10-01-preview/user/id_user.go @@ -38,23 +38,9 @@ func ParseUserID(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) - } - - if id.UserName, ok = parsed.Parsed["userName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseUserIDInsensitively(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UserId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - if id.UserName, ok = parsed.Parsed["userName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userName", *parsed) + if id.UserName, ok = input.Parsed["userName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userName", input) } - return &id, nil + return nil } // ValidateUserID checks that 'input' can be parsed as a User ID diff --git a/resource-manager/labservices/2021-10-01-preview/virtualmachine/id_lab.go b/resource-manager/labservices/2021-10-01-preview/virtualmachine/id_lab.go index 8ffcfb44cc3..c71b3f9b744 100644 --- a/resource-manager/labservices/2021-10-01-preview/virtualmachine/id_lab.go +++ b/resource-manager/labservices/2021-10-01-preview/virtualmachine/id_lab.go @@ -36,19 +36,9 @@ func ParseLabID(input string) (*LabId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLabIDInsensitively(input string) (*LabId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LabId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - return &id, nil + return nil } // ValidateLabID checks that 'input' can be parsed as a Lab ID diff --git a/resource-manager/labservices/2021-10-01-preview/virtualmachine/id_labplan.go b/resource-manager/labservices/2021-10-01-preview/virtualmachine/id_labplan.go index a75a955c674..590599b6a8d 100644 --- a/resource-manager/labservices/2021-10-01-preview/virtualmachine/id_labplan.go +++ b/resource-manager/labservices/2021-10-01-preview/virtualmachine/id_labplan.go @@ -36,19 +36,9 @@ func ParseLabPlanID(input string) (*LabPlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabPlanId{} - - 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.LabPlanName, ok = parsed.Parsed["labPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labPlanName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLabPlanIDInsensitively(input string) (*LabPlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabPlanId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LabPlanId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabPlanName, ok = parsed.Parsed["labPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labPlanName", *parsed) + if id.LabPlanName, ok = input.Parsed["labPlanName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labPlanName", input) } - return &id, nil + return nil } // ValidateLabPlanID checks that 'input' can be parsed as a Lab Plan ID diff --git a/resource-manager/labservices/2021-10-01-preview/virtualmachine/id_virtualmachine.go b/resource-manager/labservices/2021-10-01-preview/virtualmachine/id_virtualmachine.go index 474e1353754..2a86cffb1d9 100644 --- a/resource-manager/labservices/2021-10-01-preview/virtualmachine/id_virtualmachine.go +++ b/resource-manager/labservices/2021-10-01-preview/virtualmachine/id_virtualmachine.go @@ -38,23 +38,9 @@ func ParseVirtualMachineID(input string) (*VirtualMachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) - } - - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualMachineIDInsensitively(input string) (*VirtualMachineId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - return &id, nil + return nil } // ValidateVirtualMachineID checks that 'input' can be parsed as a Virtual Machine ID diff --git a/resource-manager/labservices/2022-08-01/image/id_image.go b/resource-manager/labservices/2022-08-01/image/id_image.go index 50ba6c3e256..a94d13a3b27 100644 --- a/resource-manager/labservices/2022-08-01/image/id_image.go +++ b/resource-manager/labservices/2022-08-01/image/id_image.go @@ -38,23 +38,9 @@ func ParseImageID(input string) (*ImageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ImageId{} - - 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.LabPlanName, ok = parsed.Parsed["labPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labPlanName", *parsed) - } - - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseImageIDInsensitively(input string) (*ImageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ImageId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ImageId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabPlanName, ok = parsed.Parsed["labPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labPlanName", *parsed) + if id.LabPlanName, ok = input.Parsed["labPlanName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labPlanName", input) } - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) + if id.ImageName, ok = input.Parsed["imageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "imageName", input) } - return &id, nil + return nil } // ValidateImageID checks that 'input' can be parsed as a Image ID diff --git a/resource-manager/labservices/2022-08-01/image/id_labplan.go b/resource-manager/labservices/2022-08-01/image/id_labplan.go index 731701afd29..c41dc2c5136 100644 --- a/resource-manager/labservices/2022-08-01/image/id_labplan.go +++ b/resource-manager/labservices/2022-08-01/image/id_labplan.go @@ -36,19 +36,9 @@ func ParseLabPlanID(input string) (*LabPlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabPlanId{} - - 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.LabPlanName, ok = parsed.Parsed["labPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labPlanName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLabPlanIDInsensitively(input string) (*LabPlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabPlanId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LabPlanId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabPlanName, ok = parsed.Parsed["labPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labPlanName", *parsed) + if id.LabPlanName, ok = input.Parsed["labPlanName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labPlanName", input) } - return &id, nil + return nil } // ValidateLabPlanID checks that 'input' can be parsed as a Lab Plan ID diff --git a/resource-manager/labservices/2022-08-01/lab/id_lab.go b/resource-manager/labservices/2022-08-01/lab/id_lab.go index fb259e50022..95f989599af 100644 --- a/resource-manager/labservices/2022-08-01/lab/id_lab.go +++ b/resource-manager/labservices/2022-08-01/lab/id_lab.go @@ -36,19 +36,9 @@ func ParseLabID(input string) (*LabId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLabIDInsensitively(input string) (*LabId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LabId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - return &id, nil + return nil } // ValidateLabID checks that 'input' can be parsed as a Lab ID diff --git a/resource-manager/labservices/2022-08-01/labplan/id_labplan.go b/resource-manager/labservices/2022-08-01/labplan/id_labplan.go index 67b7282f677..5d9ef6f14fb 100644 --- a/resource-manager/labservices/2022-08-01/labplan/id_labplan.go +++ b/resource-manager/labservices/2022-08-01/labplan/id_labplan.go @@ -36,19 +36,9 @@ func ParseLabPlanID(input string) (*LabPlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabPlanId{} - - 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.LabPlanName, ok = parsed.Parsed["labPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labPlanName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLabPlanIDInsensitively(input string) (*LabPlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabPlanId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LabPlanId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabPlanName, ok = parsed.Parsed["labPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labPlanName", *parsed) + if id.LabPlanName, ok = input.Parsed["labPlanName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labPlanName", input) } - return &id, nil + return nil } // ValidateLabPlanID checks that 'input' can be parsed as a Lab Plan ID diff --git a/resource-manager/labservices/2022-08-01/schedule/id_lab.go b/resource-manager/labservices/2022-08-01/schedule/id_lab.go index d346be0c1ca..5a1446e3405 100644 --- a/resource-manager/labservices/2022-08-01/schedule/id_lab.go +++ b/resource-manager/labservices/2022-08-01/schedule/id_lab.go @@ -36,19 +36,9 @@ func ParseLabID(input string) (*LabId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLabIDInsensitively(input string) (*LabId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LabId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - return &id, nil + return nil } // ValidateLabID checks that 'input' can be parsed as a Lab ID diff --git a/resource-manager/labservices/2022-08-01/schedule/id_schedule.go b/resource-manager/labservices/2022-08-01/schedule/id_schedule.go index e13b87fab1a..7da1be7633a 100644 --- a/resource-manager/labservices/2022-08-01/schedule/id_schedule.go +++ b/resource-manager/labservices/2022-08-01/schedule/id_schedule.go @@ -38,23 +38,9 @@ func ParseScheduleID(input string) (*ScheduleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScheduleId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) - } - - if id.ScheduleName, ok = parsed.Parsed["scheduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseScheduleIDInsensitively(input string) (*ScheduleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScheduleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ScheduleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - if id.ScheduleName, ok = parsed.Parsed["scheduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", *parsed) + if id.ScheduleName, ok = input.Parsed["scheduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", input) } - return &id, nil + return nil } // ValidateScheduleID checks that 'input' can be parsed as a Schedule ID diff --git a/resource-manager/labservices/2022-08-01/usages/id_location.go b/resource-manager/labservices/2022-08-01/usages/id_location.go index 6e867dc6d90..507dfe954ad 100644 --- a/resource-manager/labservices/2022-08-01/usages/id_location.go +++ b/resource-manager/labservices/2022-08-01/usages/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/labservices/2022-08-01/user/id_lab.go b/resource-manager/labservices/2022-08-01/user/id_lab.go index 072edef3eaa..3a1117bd14a 100644 --- a/resource-manager/labservices/2022-08-01/user/id_lab.go +++ b/resource-manager/labservices/2022-08-01/user/id_lab.go @@ -36,19 +36,9 @@ func ParseLabID(input string) (*LabId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLabIDInsensitively(input string) (*LabId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LabId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - return &id, nil + return nil } // ValidateLabID checks that 'input' can be parsed as a Lab ID diff --git a/resource-manager/labservices/2022-08-01/user/id_user.go b/resource-manager/labservices/2022-08-01/user/id_user.go index 0997c551307..ce75d900d7a 100644 --- a/resource-manager/labservices/2022-08-01/user/id_user.go +++ b/resource-manager/labservices/2022-08-01/user/id_user.go @@ -38,23 +38,9 @@ func ParseUserID(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) - } - - if id.UserName, ok = parsed.Parsed["userName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseUserIDInsensitively(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UserId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - if id.UserName, ok = parsed.Parsed["userName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userName", *parsed) + if id.UserName, ok = input.Parsed["userName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userName", input) } - return &id, nil + return nil } // ValidateUserID checks that 'input' can be parsed as a User ID diff --git a/resource-manager/labservices/2022-08-01/virtualmachine/id_lab.go b/resource-manager/labservices/2022-08-01/virtualmachine/id_lab.go index 8ffcfb44cc3..c71b3f9b744 100644 --- a/resource-manager/labservices/2022-08-01/virtualmachine/id_lab.go +++ b/resource-manager/labservices/2022-08-01/virtualmachine/id_lab.go @@ -36,19 +36,9 @@ func ParseLabID(input string) (*LabId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLabIDInsensitively(input string) (*LabId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LabId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - return &id, nil + return nil } // ValidateLabID checks that 'input' can be parsed as a Lab ID diff --git a/resource-manager/labservices/2022-08-01/virtualmachine/id_labplan.go b/resource-manager/labservices/2022-08-01/virtualmachine/id_labplan.go index a75a955c674..590599b6a8d 100644 --- a/resource-manager/labservices/2022-08-01/virtualmachine/id_labplan.go +++ b/resource-manager/labservices/2022-08-01/virtualmachine/id_labplan.go @@ -36,19 +36,9 @@ func ParseLabPlanID(input string) (*LabPlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabPlanId{} - - 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.LabPlanName, ok = parsed.Parsed["labPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labPlanName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLabPlanIDInsensitively(input string) (*LabPlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabPlanId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LabPlanId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabPlanName, ok = parsed.Parsed["labPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labPlanName", *parsed) + if id.LabPlanName, ok = input.Parsed["labPlanName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labPlanName", input) } - return &id, nil + return nil } // ValidateLabPlanID checks that 'input' can be parsed as a Lab Plan ID diff --git a/resource-manager/labservices/2022-08-01/virtualmachine/id_virtualmachine.go b/resource-manager/labservices/2022-08-01/virtualmachine/id_virtualmachine.go index 474e1353754..2a86cffb1d9 100644 --- a/resource-manager/labservices/2022-08-01/virtualmachine/id_virtualmachine.go +++ b/resource-manager/labservices/2022-08-01/virtualmachine/id_virtualmachine.go @@ -38,23 +38,9 @@ func ParseVirtualMachineID(input string) (*VirtualMachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) - } - - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualMachineIDInsensitively(input string) (*VirtualMachineId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - return &id, nil + return nil } // ValidateVirtualMachineID checks that 'input' can be parsed as a Virtual Machine ID diff --git a/resource-manager/labservices/2023-06-07/image/id_image.go b/resource-manager/labservices/2023-06-07/image/id_image.go index 50ba6c3e256..a94d13a3b27 100644 --- a/resource-manager/labservices/2023-06-07/image/id_image.go +++ b/resource-manager/labservices/2023-06-07/image/id_image.go @@ -38,23 +38,9 @@ func ParseImageID(input string) (*ImageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ImageId{} - - 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.LabPlanName, ok = parsed.Parsed["labPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labPlanName", *parsed) - } - - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseImageIDInsensitively(input string) (*ImageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ImageId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ImageId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabPlanName, ok = parsed.Parsed["labPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labPlanName", *parsed) + if id.LabPlanName, ok = input.Parsed["labPlanName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labPlanName", input) } - if id.ImageName, ok = parsed.Parsed["imageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "imageName", *parsed) + if id.ImageName, ok = input.Parsed["imageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "imageName", input) } - return &id, nil + return nil } // ValidateImageID checks that 'input' can be parsed as a Image ID diff --git a/resource-manager/labservices/2023-06-07/image/id_labplan.go b/resource-manager/labservices/2023-06-07/image/id_labplan.go index 731701afd29..c41dc2c5136 100644 --- a/resource-manager/labservices/2023-06-07/image/id_labplan.go +++ b/resource-manager/labservices/2023-06-07/image/id_labplan.go @@ -36,19 +36,9 @@ func ParseLabPlanID(input string) (*LabPlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabPlanId{} - - 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.LabPlanName, ok = parsed.Parsed["labPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labPlanName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLabPlanIDInsensitively(input string) (*LabPlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabPlanId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LabPlanId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabPlanName, ok = parsed.Parsed["labPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labPlanName", *parsed) + if id.LabPlanName, ok = input.Parsed["labPlanName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labPlanName", input) } - return &id, nil + return nil } // ValidateLabPlanID checks that 'input' can be parsed as a Lab Plan ID diff --git a/resource-manager/labservices/2023-06-07/lab/id_lab.go b/resource-manager/labservices/2023-06-07/lab/id_lab.go index fb259e50022..95f989599af 100644 --- a/resource-manager/labservices/2023-06-07/lab/id_lab.go +++ b/resource-manager/labservices/2023-06-07/lab/id_lab.go @@ -36,19 +36,9 @@ func ParseLabID(input string) (*LabId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLabIDInsensitively(input string) (*LabId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LabId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - return &id, nil + return nil } // ValidateLabID checks that 'input' can be parsed as a Lab ID diff --git a/resource-manager/labservices/2023-06-07/labplan/id_labplan.go b/resource-manager/labservices/2023-06-07/labplan/id_labplan.go index 67b7282f677..5d9ef6f14fb 100644 --- a/resource-manager/labservices/2023-06-07/labplan/id_labplan.go +++ b/resource-manager/labservices/2023-06-07/labplan/id_labplan.go @@ -36,19 +36,9 @@ func ParseLabPlanID(input string) (*LabPlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabPlanId{} - - 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.LabPlanName, ok = parsed.Parsed["labPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labPlanName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLabPlanIDInsensitively(input string) (*LabPlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabPlanId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LabPlanId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabPlanName, ok = parsed.Parsed["labPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labPlanName", *parsed) + if id.LabPlanName, ok = input.Parsed["labPlanName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labPlanName", input) } - return &id, nil + return nil } // ValidateLabPlanID checks that 'input' can be parsed as a Lab Plan ID diff --git a/resource-manager/labservices/2023-06-07/schedule/id_lab.go b/resource-manager/labservices/2023-06-07/schedule/id_lab.go index d346be0c1ca..5a1446e3405 100644 --- a/resource-manager/labservices/2023-06-07/schedule/id_lab.go +++ b/resource-manager/labservices/2023-06-07/schedule/id_lab.go @@ -36,19 +36,9 @@ func ParseLabID(input string) (*LabId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLabIDInsensitively(input string) (*LabId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LabId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - return &id, nil + return nil } // ValidateLabID checks that 'input' can be parsed as a Lab ID diff --git a/resource-manager/labservices/2023-06-07/schedule/id_schedule.go b/resource-manager/labservices/2023-06-07/schedule/id_schedule.go index e13b87fab1a..7da1be7633a 100644 --- a/resource-manager/labservices/2023-06-07/schedule/id_schedule.go +++ b/resource-manager/labservices/2023-06-07/schedule/id_schedule.go @@ -38,23 +38,9 @@ func ParseScheduleID(input string) (*ScheduleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScheduleId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) - } - - if id.ScheduleName, ok = parsed.Parsed["scheduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseScheduleIDInsensitively(input string) (*ScheduleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScheduleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ScheduleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - if id.ScheduleName, ok = parsed.Parsed["scheduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", *parsed) + if id.ScheduleName, ok = input.Parsed["scheduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", input) } - return &id, nil + return nil } // ValidateScheduleID checks that 'input' can be parsed as a Schedule ID diff --git a/resource-manager/labservices/2023-06-07/usages/id_location.go b/resource-manager/labservices/2023-06-07/usages/id_location.go index 6e867dc6d90..507dfe954ad 100644 --- a/resource-manager/labservices/2023-06-07/usages/id_location.go +++ b/resource-manager/labservices/2023-06-07/usages/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/labservices/2023-06-07/user/id_lab.go b/resource-manager/labservices/2023-06-07/user/id_lab.go index 072edef3eaa..3a1117bd14a 100644 --- a/resource-manager/labservices/2023-06-07/user/id_lab.go +++ b/resource-manager/labservices/2023-06-07/user/id_lab.go @@ -36,19 +36,9 @@ func ParseLabID(input string) (*LabId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLabIDInsensitively(input string) (*LabId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LabId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - return &id, nil + return nil } // ValidateLabID checks that 'input' can be parsed as a Lab ID diff --git a/resource-manager/labservices/2023-06-07/user/id_user.go b/resource-manager/labservices/2023-06-07/user/id_user.go index 0997c551307..ce75d900d7a 100644 --- a/resource-manager/labservices/2023-06-07/user/id_user.go +++ b/resource-manager/labservices/2023-06-07/user/id_user.go @@ -38,23 +38,9 @@ func ParseUserID(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) - } - - if id.UserName, ok = parsed.Parsed["userName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseUserIDInsensitively(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UserId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - if id.UserName, ok = parsed.Parsed["userName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userName", *parsed) + if id.UserName, ok = input.Parsed["userName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userName", input) } - return &id, nil + return nil } // ValidateUserID checks that 'input' can be parsed as a User ID diff --git a/resource-manager/labservices/2023-06-07/virtualmachine/id_lab.go b/resource-manager/labservices/2023-06-07/virtualmachine/id_lab.go index 8ffcfb44cc3..c71b3f9b744 100644 --- a/resource-manager/labservices/2023-06-07/virtualmachine/id_lab.go +++ b/resource-manager/labservices/2023-06-07/virtualmachine/id_lab.go @@ -36,19 +36,9 @@ func ParseLabID(input string) (*LabId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLabIDInsensitively(input string) (*LabId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LabId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - return &id, nil + return nil } // ValidateLabID checks that 'input' can be parsed as a Lab ID diff --git a/resource-manager/labservices/2023-06-07/virtualmachine/id_labplan.go b/resource-manager/labservices/2023-06-07/virtualmachine/id_labplan.go index a75a955c674..590599b6a8d 100644 --- a/resource-manager/labservices/2023-06-07/virtualmachine/id_labplan.go +++ b/resource-manager/labservices/2023-06-07/virtualmachine/id_labplan.go @@ -36,19 +36,9 @@ func ParseLabPlanID(input string) (*LabPlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabPlanId{} - - 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.LabPlanName, ok = parsed.Parsed["labPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labPlanName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLabPlanIDInsensitively(input string) (*LabPlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabPlanId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LabPlanId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabPlanName, ok = parsed.Parsed["labPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labPlanName", *parsed) + if id.LabPlanName, ok = input.Parsed["labPlanName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labPlanName", input) } - return &id, nil + return nil } // ValidateLabPlanID checks that 'input' can be parsed as a Lab Plan ID diff --git a/resource-manager/labservices/2023-06-07/virtualmachine/id_virtualmachine.go b/resource-manager/labservices/2023-06-07/virtualmachine/id_virtualmachine.go index 474e1353754..2a86cffb1d9 100644 --- a/resource-manager/labservices/2023-06-07/virtualmachine/id_virtualmachine.go +++ b/resource-manager/labservices/2023-06-07/virtualmachine/id_virtualmachine.go @@ -38,23 +38,9 @@ func ParseVirtualMachineID(input string) (*VirtualMachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} - - 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.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) - } - - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualMachineIDInsensitively(input string) (*VirtualMachineId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LabName, ok = parsed.Parsed["labName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labName", *parsed) + if id.LabName, ok = input.Parsed["labName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - return &id, nil + return nil } // ValidateVirtualMachineID checks that 'input' can be parsed as a Virtual Machine ID diff --git a/resource-manager/loadtestservice/2022-12-01/loadtest/id_loadtest.go b/resource-manager/loadtestservice/2022-12-01/loadtest/id_loadtest.go index 43ec8cda588..b520506ff1d 100644 --- a/resource-manager/loadtestservice/2022-12-01/loadtest/id_loadtest.go +++ b/resource-manager/loadtestservice/2022-12-01/loadtest/id_loadtest.go @@ -36,19 +36,9 @@ func ParseLoadTestID(input string) (*LoadTestId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LoadTestId{} - - 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.LoadTestName, ok = parsed.Parsed["loadTestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadTestName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLoadTestIDInsensitively(input string) (*LoadTestId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LoadTestId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LoadTestId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LoadTestName, ok = parsed.Parsed["loadTestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadTestName", *parsed) + if id.LoadTestName, ok = input.Parsed["loadTestName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "loadTestName", input) } - return &id, nil + return nil } // ValidateLoadTestID checks that 'input' can be parsed as a Load Test ID diff --git a/resource-manager/loadtestservice/2022-12-01/loadtests/id_loadtest.go b/resource-manager/loadtestservice/2022-12-01/loadtests/id_loadtest.go index daf867852d9..84d7a455fb6 100644 --- a/resource-manager/loadtestservice/2022-12-01/loadtests/id_loadtest.go +++ b/resource-manager/loadtestservice/2022-12-01/loadtests/id_loadtest.go @@ -36,19 +36,9 @@ func ParseLoadTestID(input string) (*LoadTestId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LoadTestId{} - - 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.LoadTestName, ok = parsed.Parsed["loadTestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadTestName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLoadTestIDInsensitively(input string) (*LoadTestId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LoadTestId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LoadTestId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LoadTestName, ok = parsed.Parsed["loadTestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadTestName", *parsed) + if id.LoadTestName, ok = input.Parsed["loadTestName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "loadTestName", input) } - return &id, nil + return nil } // ValidateLoadTestID checks that 'input' can be parsed as a Load Test ID diff --git a/resource-manager/loadtestservice/2022-12-01/quotas/id_location.go b/resource-manager/loadtestservice/2022-12-01/quotas/id_location.go index 946cb3ef120..654279e6c66 100644 --- a/resource-manager/loadtestservice/2022-12-01/quotas/id_location.go +++ b/resource-manager/loadtestservice/2022-12-01/quotas/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/loadtestservice/2022-12-01/quotas/id_quota.go b/resource-manager/loadtestservice/2022-12-01/quotas/id_quota.go index 41cfdcb2ae8..09436927fbc 100644 --- a/resource-manager/loadtestservice/2022-12-01/quotas/id_quota.go +++ b/resource-manager/loadtestservice/2022-12-01/quotas/id_quota.go @@ -36,19 +36,9 @@ func ParseQuotaID(input string) (*QuotaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QuotaId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.QuotaName, ok = parsed.Parsed["quotaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "quotaName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseQuotaIDInsensitively(input string) (*QuotaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QuotaId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *QuotaId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.QuotaName, ok = parsed.Parsed["quotaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "quotaName", *parsed) + if id.QuotaName, ok = input.Parsed["quotaName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "quotaName", input) } - return &id, nil + return nil } // ValidateQuotaID checks that 'input' can be parsed as a Quota ID diff --git a/resource-manager/logic/2019-05-01/integrationaccountagreements/id_agreement.go b/resource-manager/logic/2019-05-01/integrationaccountagreements/id_agreement.go index d8befd068ce..41c330b7e15 100644 --- a/resource-manager/logic/2019-05-01/integrationaccountagreements/id_agreement.go +++ b/resource-manager/logic/2019-05-01/integrationaccountagreements/id_agreement.go @@ -38,23 +38,9 @@ func ParseAgreementID(input string) (*AgreementId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AgreementId{} - - 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.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", *parsed) - } - - if id.AgreementName, ok = parsed.Parsed["agreementName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "agreementName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAgreementIDInsensitively(input string) (*AgreementId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AgreementId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AgreementId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", *parsed) + if id.IntegrationAccountName, ok = input.Parsed["integrationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", input) } - if id.AgreementName, ok = parsed.Parsed["agreementName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "agreementName", *parsed) + if id.AgreementName, ok = input.Parsed["agreementName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "agreementName", input) } - return &id, nil + return nil } // ValidateAgreementID checks that 'input' can be parsed as a Agreement ID diff --git a/resource-manager/logic/2019-05-01/integrationaccountagreements/id_integrationaccount.go b/resource-manager/logic/2019-05-01/integrationaccountagreements/id_integrationaccount.go index 2623fcb677d..c6262f85d57 100644 --- a/resource-manager/logic/2019-05-01/integrationaccountagreements/id_integrationaccount.go +++ b/resource-manager/logic/2019-05-01/integrationaccountagreements/id_integrationaccount.go @@ -36,19 +36,9 @@ func ParseIntegrationAccountID(input string) (*IntegrationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IntegrationAccountId{} - - 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.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseIntegrationAccountIDInsensitively(input string) (*IntegrationAccountId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IntegrationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *IntegrationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", *parsed) + if id.IntegrationAccountName, ok = input.Parsed["integrationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", input) } - return &id, nil + return nil } // ValidateIntegrationAccountID checks that 'input' can be parsed as a Integration Account ID diff --git a/resource-manager/logic/2019-05-01/integrationaccountassemblies/id_assembly.go b/resource-manager/logic/2019-05-01/integrationaccountassemblies/id_assembly.go index 248934cfc0a..3dc051a67fd 100644 --- a/resource-manager/logic/2019-05-01/integrationaccountassemblies/id_assembly.go +++ b/resource-manager/logic/2019-05-01/integrationaccountassemblies/id_assembly.go @@ -38,23 +38,9 @@ func ParseAssemblyID(input string) (*AssemblyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AssemblyId{} - - 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.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", *parsed) - } - - if id.AssemblyName, ok = parsed.Parsed["assemblyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "assemblyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAssemblyIDInsensitively(input string) (*AssemblyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AssemblyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AssemblyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", *parsed) + if id.IntegrationAccountName, ok = input.Parsed["integrationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", input) } - if id.AssemblyName, ok = parsed.Parsed["assemblyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "assemblyName", *parsed) + if id.AssemblyName, ok = input.Parsed["assemblyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "assemblyName", input) } - return &id, nil + return nil } // ValidateAssemblyID checks that 'input' can be parsed as a Assembly ID diff --git a/resource-manager/logic/2019-05-01/integrationaccountassemblies/id_integrationaccount.go b/resource-manager/logic/2019-05-01/integrationaccountassemblies/id_integrationaccount.go index eeca8950240..33d9eb27d2e 100644 --- a/resource-manager/logic/2019-05-01/integrationaccountassemblies/id_integrationaccount.go +++ b/resource-manager/logic/2019-05-01/integrationaccountassemblies/id_integrationaccount.go @@ -36,19 +36,9 @@ func ParseIntegrationAccountID(input string) (*IntegrationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IntegrationAccountId{} - - 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.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseIntegrationAccountIDInsensitively(input string) (*IntegrationAccountId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IntegrationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *IntegrationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", *parsed) + if id.IntegrationAccountName, ok = input.Parsed["integrationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", input) } - return &id, nil + return nil } // ValidateIntegrationAccountID checks that 'input' can be parsed as a Integration Account ID diff --git a/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/id_batchconfiguration.go b/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/id_batchconfiguration.go index 6a1ebdef7db..5c61ab2f12d 100644 --- a/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/id_batchconfiguration.go +++ b/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/id_batchconfiguration.go @@ -38,23 +38,9 @@ func ParseBatchConfigurationID(input string) (*BatchConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BatchConfigurationId{} - - 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.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", *parsed) - } - - if id.BatchConfigurationName, ok = parsed.Parsed["batchConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBatchConfigurationIDInsensitively(input string) (*BatchConfigurationId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BatchConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BatchConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", *parsed) + if id.IntegrationAccountName, ok = input.Parsed["integrationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", input) } - if id.BatchConfigurationName, ok = parsed.Parsed["batchConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchConfigurationName", *parsed) + if id.BatchConfigurationName, ok = input.Parsed["batchConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "batchConfigurationName", input) } - return &id, nil + return nil } // ValidateBatchConfigurationID checks that 'input' can be parsed as a Batch Configuration ID diff --git a/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/id_integrationaccount.go b/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/id_integrationaccount.go index e0402e01b06..6864e0df85a 100644 --- a/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/id_integrationaccount.go +++ b/resource-manager/logic/2019-05-01/integrationaccountbatchconfigurations/id_integrationaccount.go @@ -36,19 +36,9 @@ func ParseIntegrationAccountID(input string) (*IntegrationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IntegrationAccountId{} - - 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.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseIntegrationAccountIDInsensitively(input string) (*IntegrationAccountId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IntegrationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *IntegrationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", *parsed) + if id.IntegrationAccountName, ok = input.Parsed["integrationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", input) } - return &id, nil + return nil } // ValidateIntegrationAccountID checks that 'input' can be parsed as a Integration Account ID diff --git a/resource-manager/logic/2019-05-01/integrationaccountcertificates/id_certificate.go b/resource-manager/logic/2019-05-01/integrationaccountcertificates/id_certificate.go index 65f51a1b589..b106099252f 100644 --- a/resource-manager/logic/2019-05-01/integrationaccountcertificates/id_certificate.go +++ b/resource-manager/logic/2019-05-01/integrationaccountcertificates/id_certificate.go @@ -38,23 +38,9 @@ func ParseCertificateID(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} - - 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.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", *parsed) - } - - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCertificateIDInsensitively(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", *parsed) + if id.IntegrationAccountName, ok = input.Parsed["integrationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", input) } - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if id.CertificateName, ok = input.Parsed["certificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateName", input) } - return &id, nil + return nil } // ValidateCertificateID checks that 'input' can be parsed as a Certificate ID diff --git a/resource-manager/logic/2019-05-01/integrationaccountcertificates/id_integrationaccount.go b/resource-manager/logic/2019-05-01/integrationaccountcertificates/id_integrationaccount.go index 48a9e0be12b..eff965122d4 100644 --- a/resource-manager/logic/2019-05-01/integrationaccountcertificates/id_integrationaccount.go +++ b/resource-manager/logic/2019-05-01/integrationaccountcertificates/id_integrationaccount.go @@ -36,19 +36,9 @@ func ParseIntegrationAccountID(input string) (*IntegrationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IntegrationAccountId{} - - 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.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseIntegrationAccountIDInsensitively(input string) (*IntegrationAccountId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IntegrationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *IntegrationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", *parsed) + if id.IntegrationAccountName, ok = input.Parsed["integrationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", input) } - return &id, nil + return nil } // ValidateIntegrationAccountID checks that 'input' can be parsed as a Integration Account ID diff --git a/resource-manager/logic/2019-05-01/integrationaccountmaps/id_integrationaccount.go b/resource-manager/logic/2019-05-01/integrationaccountmaps/id_integrationaccount.go index bad2e827c2b..8b8292f6640 100644 --- a/resource-manager/logic/2019-05-01/integrationaccountmaps/id_integrationaccount.go +++ b/resource-manager/logic/2019-05-01/integrationaccountmaps/id_integrationaccount.go @@ -36,19 +36,9 @@ func ParseIntegrationAccountID(input string) (*IntegrationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IntegrationAccountId{} - - 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.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseIntegrationAccountIDInsensitively(input string) (*IntegrationAccountId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IntegrationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *IntegrationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", *parsed) + if id.IntegrationAccountName, ok = input.Parsed["integrationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", input) } - return &id, nil + return nil } // ValidateIntegrationAccountID checks that 'input' can be parsed as a Integration Account ID diff --git a/resource-manager/logic/2019-05-01/integrationaccountmaps/id_map.go b/resource-manager/logic/2019-05-01/integrationaccountmaps/id_map.go index e9daa1d3e3e..893b5d011cb 100644 --- a/resource-manager/logic/2019-05-01/integrationaccountmaps/id_map.go +++ b/resource-manager/logic/2019-05-01/integrationaccountmaps/id_map.go @@ -38,23 +38,9 @@ func ParseMapID(input string) (*MapId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MapId{} - - 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.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", *parsed) - } - - if id.MapName, ok = parsed.Parsed["mapName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mapName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseMapIDInsensitively(input string) (*MapId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MapId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *MapId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", *parsed) + if id.IntegrationAccountName, ok = input.Parsed["integrationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", input) } - if id.MapName, ok = parsed.Parsed["mapName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mapName", *parsed) + if id.MapName, ok = input.Parsed["mapName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mapName", input) } - return &id, nil + return nil } // ValidateMapID checks that 'input' can be parsed as a Map ID diff --git a/resource-manager/logic/2019-05-01/integrationaccountpartners/id_integrationaccount.go b/resource-manager/logic/2019-05-01/integrationaccountpartners/id_integrationaccount.go index 705ad1f643c..30ee409ab6c 100644 --- a/resource-manager/logic/2019-05-01/integrationaccountpartners/id_integrationaccount.go +++ b/resource-manager/logic/2019-05-01/integrationaccountpartners/id_integrationaccount.go @@ -36,19 +36,9 @@ func ParseIntegrationAccountID(input string) (*IntegrationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IntegrationAccountId{} - - 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.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseIntegrationAccountIDInsensitively(input string) (*IntegrationAccountId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IntegrationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *IntegrationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", *parsed) + if id.IntegrationAccountName, ok = input.Parsed["integrationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", input) } - return &id, nil + return nil } // ValidateIntegrationAccountID checks that 'input' can be parsed as a Integration Account ID diff --git a/resource-manager/logic/2019-05-01/integrationaccountpartners/id_partner.go b/resource-manager/logic/2019-05-01/integrationaccountpartners/id_partner.go index 0c9ab77be7d..0733f0d49a3 100644 --- a/resource-manager/logic/2019-05-01/integrationaccountpartners/id_partner.go +++ b/resource-manager/logic/2019-05-01/integrationaccountpartners/id_partner.go @@ -38,23 +38,9 @@ func ParsePartnerID(input string) (*PartnerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PartnerId{} - - 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.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", *parsed) - } - - if id.PartnerName, ok = parsed.Parsed["partnerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "partnerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePartnerIDInsensitively(input string) (*PartnerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PartnerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PartnerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", *parsed) + if id.IntegrationAccountName, ok = input.Parsed["integrationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", input) } - if id.PartnerName, ok = parsed.Parsed["partnerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "partnerName", *parsed) + if id.PartnerName, ok = input.Parsed["partnerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "partnerName", input) } - return &id, nil + return nil } // ValidatePartnerID checks that 'input' can be parsed as a Partner ID diff --git a/resource-manager/logic/2019-05-01/integrationaccounts/id_integrationaccount.go b/resource-manager/logic/2019-05-01/integrationaccounts/id_integrationaccount.go index 46b18fd59c7..4cc6584c2c2 100644 --- a/resource-manager/logic/2019-05-01/integrationaccounts/id_integrationaccount.go +++ b/resource-manager/logic/2019-05-01/integrationaccounts/id_integrationaccount.go @@ -36,19 +36,9 @@ func ParseIntegrationAccountID(input string) (*IntegrationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IntegrationAccountId{} - - 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.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseIntegrationAccountIDInsensitively(input string) (*IntegrationAccountId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IntegrationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *IntegrationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", *parsed) + if id.IntegrationAccountName, ok = input.Parsed["integrationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", input) } - return &id, nil + return nil } // ValidateIntegrationAccountID checks that 'input' can be parsed as a Integration Account ID diff --git a/resource-manager/logic/2019-05-01/integrationaccountschemas/id_integrationaccount.go b/resource-manager/logic/2019-05-01/integrationaccountschemas/id_integrationaccount.go index fcc7a369ce3..31cfd700920 100644 --- a/resource-manager/logic/2019-05-01/integrationaccountschemas/id_integrationaccount.go +++ b/resource-manager/logic/2019-05-01/integrationaccountschemas/id_integrationaccount.go @@ -36,19 +36,9 @@ func ParseIntegrationAccountID(input string) (*IntegrationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IntegrationAccountId{} - - 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.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseIntegrationAccountIDInsensitively(input string) (*IntegrationAccountId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IntegrationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *IntegrationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", *parsed) + if id.IntegrationAccountName, ok = input.Parsed["integrationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", input) } - return &id, nil + return nil } // ValidateIntegrationAccountID checks that 'input' can be parsed as a Integration Account ID diff --git a/resource-manager/logic/2019-05-01/integrationaccountschemas/id_schema.go b/resource-manager/logic/2019-05-01/integrationaccountschemas/id_schema.go index dd3ec83c469..8f13f733a97 100644 --- a/resource-manager/logic/2019-05-01/integrationaccountschemas/id_schema.go +++ b/resource-manager/logic/2019-05-01/integrationaccountschemas/id_schema.go @@ -38,23 +38,9 @@ func ParseSchemaID(input string) (*SchemaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SchemaId{} - - 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.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", *parsed) - } - - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSchemaIDInsensitively(input string) (*SchemaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SchemaId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SchemaId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", *parsed) + if id.IntegrationAccountName, ok = input.Parsed["integrationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", input) } - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) + if id.SchemaName, ok = input.Parsed["schemaName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "schemaName", input) } - return &id, nil + return nil } // ValidateSchemaID checks that 'input' can be parsed as a Schema ID diff --git a/resource-manager/logic/2019-05-01/integrationaccountsessions/id_integrationaccount.go b/resource-manager/logic/2019-05-01/integrationaccountsessions/id_integrationaccount.go index d4e0d688ca0..83c7af4b09b 100644 --- a/resource-manager/logic/2019-05-01/integrationaccountsessions/id_integrationaccount.go +++ b/resource-manager/logic/2019-05-01/integrationaccountsessions/id_integrationaccount.go @@ -36,19 +36,9 @@ func ParseIntegrationAccountID(input string) (*IntegrationAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IntegrationAccountId{} - - 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.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseIntegrationAccountIDInsensitively(input string) (*IntegrationAccountId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IntegrationAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *IntegrationAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", *parsed) + if id.IntegrationAccountName, ok = input.Parsed["integrationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", input) } - return &id, nil + return nil } // ValidateIntegrationAccountID checks that 'input' can be parsed as a Integration Account ID diff --git a/resource-manager/logic/2019-05-01/integrationaccountsessions/id_session.go b/resource-manager/logic/2019-05-01/integrationaccountsessions/id_session.go index dac0c7bd041..f4f52f36e81 100644 --- a/resource-manager/logic/2019-05-01/integrationaccountsessions/id_session.go +++ b/resource-manager/logic/2019-05-01/integrationaccountsessions/id_session.go @@ -38,23 +38,9 @@ func ParseSessionID(input string) (*SessionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SessionId{} - - 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.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", *parsed) - } - - if id.SessionName, ok = parsed.Parsed["sessionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sessionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSessionIDInsensitively(input string) (*SessionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SessionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SessionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.IntegrationAccountName, ok = parsed.Parsed["integrationAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", *parsed) + if id.IntegrationAccountName, ok = input.Parsed["integrationAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "integrationAccountName", input) } - if id.SessionName, ok = parsed.Parsed["sessionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sessionName", *parsed) + if id.SessionName, ok = input.Parsed["sessionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sessionName", input) } - return &id, nil + return nil } // ValidateSessionID checks that 'input' can be parsed as a Session ID diff --git a/resource-manager/logic/2019-05-01/integrationserviceenvironmentmanagedapi/id_managedapi.go b/resource-manager/logic/2019-05-01/integrationserviceenvironmentmanagedapi/id_managedapi.go index ccc14761c91..c8c0d1f5d57 100644 --- a/resource-manager/logic/2019-05-01/integrationserviceenvironmentmanagedapi/id_managedapi.go +++ b/resource-manager/logic/2019-05-01/integrationserviceenvironmentmanagedapi/id_managedapi.go @@ -38,23 +38,9 @@ func ParseManagedApiID(input string) (*ManagedApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedApiId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroup", *parsed) - } - - if id.IntegrationServiceEnvironmentName, ok = parsed.Parsed["integrationServiceEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationServiceEnvironmentName", *parsed) - } - - if id.ManagedApiName, ok = parsed.Parsed["managedApiName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedApiName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseManagedApiIDInsensitively(input string) (*ManagedApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ManagedApiId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroup", *parsed) + if id.ResourceGroup, ok = input.Parsed["resourceGroup"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroup", input) } - if id.IntegrationServiceEnvironmentName, ok = parsed.Parsed["integrationServiceEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationServiceEnvironmentName", *parsed) + if id.IntegrationServiceEnvironmentName, ok = input.Parsed["integrationServiceEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "integrationServiceEnvironmentName", input) } - if id.ManagedApiName, ok = parsed.Parsed["managedApiName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedApiName", *parsed) + if id.ManagedApiName, ok = input.Parsed["managedApiName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedApiName", input) } - return &id, nil + return nil } // ValidateManagedApiID checks that 'input' can be parsed as a Managed Api ID diff --git a/resource-manager/logic/2019-05-01/integrationserviceenvironmentmanagedapis/id_integrationserviceenvironment.go b/resource-manager/logic/2019-05-01/integrationserviceenvironmentmanagedapis/id_integrationserviceenvironment.go index 4c8bfe7d8da..2415eb003cc 100644 --- a/resource-manager/logic/2019-05-01/integrationserviceenvironmentmanagedapis/id_integrationserviceenvironment.go +++ b/resource-manager/logic/2019-05-01/integrationserviceenvironmentmanagedapis/id_integrationserviceenvironment.go @@ -36,19 +36,9 @@ func ParseIntegrationServiceEnvironmentID(input string) (*IntegrationServiceEnvi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IntegrationServiceEnvironmentId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroup", *parsed) - } - - if id.IntegrationServiceEnvironmentName, ok = parsed.Parsed["integrationServiceEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationServiceEnvironmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseIntegrationServiceEnvironmentIDInsensitively(input string) (*Integrati return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IntegrationServiceEnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *IntegrationServiceEnvironmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroup", *parsed) + if id.ResourceGroup, ok = input.Parsed["resourceGroup"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroup", input) } - if id.IntegrationServiceEnvironmentName, ok = parsed.Parsed["integrationServiceEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationServiceEnvironmentName", *parsed) + if id.IntegrationServiceEnvironmentName, ok = input.Parsed["integrationServiceEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "integrationServiceEnvironmentName", input) } - return &id, nil + return nil } // ValidateIntegrationServiceEnvironmentID checks that 'input' can be parsed as a Integration Service Environment ID diff --git a/resource-manager/logic/2019-05-01/integrationserviceenvironmentmanagedapis/id_managedapi.go b/resource-manager/logic/2019-05-01/integrationserviceenvironmentmanagedapis/id_managedapi.go index f5170e431a2..aca4c89cdef 100644 --- a/resource-manager/logic/2019-05-01/integrationserviceenvironmentmanagedapis/id_managedapi.go +++ b/resource-manager/logic/2019-05-01/integrationserviceenvironmentmanagedapis/id_managedapi.go @@ -38,23 +38,9 @@ func ParseManagedApiID(input string) (*ManagedApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedApiId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroup", *parsed) - } - - if id.IntegrationServiceEnvironmentName, ok = parsed.Parsed["integrationServiceEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationServiceEnvironmentName", *parsed) - } - - if id.ManagedApiName, ok = parsed.Parsed["managedApiName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedApiName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseManagedApiIDInsensitively(input string) (*ManagedApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ManagedApiId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroup", *parsed) + if id.ResourceGroup, ok = input.Parsed["resourceGroup"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroup", input) } - if id.IntegrationServiceEnvironmentName, ok = parsed.Parsed["integrationServiceEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationServiceEnvironmentName", *parsed) + if id.IntegrationServiceEnvironmentName, ok = input.Parsed["integrationServiceEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "integrationServiceEnvironmentName", input) } - if id.ManagedApiName, ok = parsed.Parsed["managedApiName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedApiName", *parsed) + if id.ManagedApiName, ok = input.Parsed["managedApiName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedApiName", input) } - return &id, nil + return nil } // ValidateManagedApiID checks that 'input' can be parsed as a Managed Api ID diff --git a/resource-manager/logic/2019-05-01/integrationserviceenvironmentnetworkhealth/id_integrationserviceenvironment.go b/resource-manager/logic/2019-05-01/integrationserviceenvironmentnetworkhealth/id_integrationserviceenvironment.go index d44f1b9c529..ea0b2c6eb08 100644 --- a/resource-manager/logic/2019-05-01/integrationserviceenvironmentnetworkhealth/id_integrationserviceenvironment.go +++ b/resource-manager/logic/2019-05-01/integrationserviceenvironmentnetworkhealth/id_integrationserviceenvironment.go @@ -36,19 +36,9 @@ func ParseIntegrationServiceEnvironmentID(input string) (*IntegrationServiceEnvi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IntegrationServiceEnvironmentId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroup", *parsed) - } - - if id.IntegrationServiceEnvironmentName, ok = parsed.Parsed["integrationServiceEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationServiceEnvironmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseIntegrationServiceEnvironmentIDInsensitively(input string) (*Integrati return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IntegrationServiceEnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *IntegrationServiceEnvironmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroup", *parsed) + if id.ResourceGroup, ok = input.Parsed["resourceGroup"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroup", input) } - if id.IntegrationServiceEnvironmentName, ok = parsed.Parsed["integrationServiceEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationServiceEnvironmentName", *parsed) + if id.IntegrationServiceEnvironmentName, ok = input.Parsed["integrationServiceEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "integrationServiceEnvironmentName", input) } - return &id, nil + return nil } // ValidateIntegrationServiceEnvironmentID checks that 'input' can be parsed as a Integration Service Environment ID diff --git a/resource-manager/logic/2019-05-01/integrationserviceenvironmentrestart/id_integrationserviceenvironment.go b/resource-manager/logic/2019-05-01/integrationserviceenvironmentrestart/id_integrationserviceenvironment.go index 00d958e19db..843719a94bb 100644 --- a/resource-manager/logic/2019-05-01/integrationserviceenvironmentrestart/id_integrationserviceenvironment.go +++ b/resource-manager/logic/2019-05-01/integrationserviceenvironmentrestart/id_integrationserviceenvironment.go @@ -36,19 +36,9 @@ func ParseIntegrationServiceEnvironmentID(input string) (*IntegrationServiceEnvi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IntegrationServiceEnvironmentId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroup", *parsed) - } - - if id.IntegrationServiceEnvironmentName, ok = parsed.Parsed["integrationServiceEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationServiceEnvironmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseIntegrationServiceEnvironmentIDInsensitively(input string) (*Integrati return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IntegrationServiceEnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *IntegrationServiceEnvironmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroup", *parsed) + if id.ResourceGroup, ok = input.Parsed["resourceGroup"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroup", input) } - if id.IntegrationServiceEnvironmentName, ok = parsed.Parsed["integrationServiceEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationServiceEnvironmentName", *parsed) + if id.IntegrationServiceEnvironmentName, ok = input.Parsed["integrationServiceEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "integrationServiceEnvironmentName", input) } - return &id, nil + return nil } // ValidateIntegrationServiceEnvironmentID checks that 'input' can be parsed as a Integration Service Environment ID diff --git a/resource-manager/logic/2019-05-01/integrationserviceenvironments/id_integrationserviceenvironment.go b/resource-manager/logic/2019-05-01/integrationserviceenvironments/id_integrationserviceenvironment.go index fd5369e6099..27f0256c894 100644 --- a/resource-manager/logic/2019-05-01/integrationserviceenvironments/id_integrationserviceenvironment.go +++ b/resource-manager/logic/2019-05-01/integrationserviceenvironments/id_integrationserviceenvironment.go @@ -36,19 +36,9 @@ func ParseIntegrationServiceEnvironmentID(input string) (*IntegrationServiceEnvi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IntegrationServiceEnvironmentId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroup", *parsed) - } - - if id.IntegrationServiceEnvironmentName, ok = parsed.Parsed["integrationServiceEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationServiceEnvironmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseIntegrationServiceEnvironmentIDInsensitively(input string) (*Integrati return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IntegrationServiceEnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *IntegrationServiceEnvironmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroup", *parsed) + if id.ResourceGroup, ok = input.Parsed["resourceGroup"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroup", input) } - if id.IntegrationServiceEnvironmentName, ok = parsed.Parsed["integrationServiceEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationServiceEnvironmentName", *parsed) + if id.IntegrationServiceEnvironmentName, ok = input.Parsed["integrationServiceEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "integrationServiceEnvironmentName", input) } - return &id, nil + return nil } // ValidateIntegrationServiceEnvironmentID checks that 'input' can be parsed as a Integration Service Environment ID diff --git a/resource-manager/logic/2019-05-01/integrationserviceenvironmentskus/id_integrationserviceenvironment.go b/resource-manager/logic/2019-05-01/integrationserviceenvironmentskus/id_integrationserviceenvironment.go index 5c7d1bb7447..ec2fd452cb5 100644 --- a/resource-manager/logic/2019-05-01/integrationserviceenvironmentskus/id_integrationserviceenvironment.go +++ b/resource-manager/logic/2019-05-01/integrationserviceenvironmentskus/id_integrationserviceenvironment.go @@ -36,19 +36,9 @@ func ParseIntegrationServiceEnvironmentID(input string) (*IntegrationServiceEnvi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IntegrationServiceEnvironmentId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroup", *parsed) - } - - if id.IntegrationServiceEnvironmentName, ok = parsed.Parsed["integrationServiceEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationServiceEnvironmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseIntegrationServiceEnvironmentIDInsensitively(input string) (*Integrati return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IntegrationServiceEnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *IntegrationServiceEnvironmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroup, ok = parsed.Parsed["resourceGroup"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroup", *parsed) + if id.ResourceGroup, ok = input.Parsed["resourceGroup"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroup", input) } - if id.IntegrationServiceEnvironmentName, ok = parsed.Parsed["integrationServiceEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "integrationServiceEnvironmentName", *parsed) + if id.IntegrationServiceEnvironmentName, ok = input.Parsed["integrationServiceEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "integrationServiceEnvironmentName", input) } - return &id, nil + return nil } // ValidateIntegrationServiceEnvironmentID checks that 'input' can be parsed as a Integration Service Environment ID diff --git a/resource-manager/logic/2019-05-01/workflowrunactions/id_action.go b/resource-manager/logic/2019-05-01/workflowrunactions/id_action.go index 79604b86961..52ee81de0c5 100644 --- a/resource-manager/logic/2019-05-01/workflowrunactions/id_action.go +++ b/resource-manager/logic/2019-05-01/workflowrunactions/id_action.go @@ -40,27 +40,9 @@ func ParseActionID(input string) (*ActionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ActionId{} - - 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.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) - } - - if id.RunName, ok = parsed.Parsed["runName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runName", *parsed) - } - - if id.ActionName, ok = parsed.Parsed["actionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseActionIDInsensitively(input string) (*ActionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ActionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ActionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - if id.RunName, ok = parsed.Parsed["runName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runName", *parsed) + if id.RunName, ok = input.Parsed["runName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runName", input) } - if id.ActionName, ok = parsed.Parsed["actionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionName", *parsed) + if id.ActionName, ok = input.Parsed["actionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "actionName", input) } - return &id, nil + return nil } // ValidateActionID checks that 'input' can be parsed as a Action ID diff --git a/resource-manager/logic/2019-05-01/workflowrunactions/id_repetition.go b/resource-manager/logic/2019-05-01/workflowrunactions/id_repetition.go index b95d1ef1498..d0c34fa9072 100644 --- a/resource-manager/logic/2019-05-01/workflowrunactions/id_repetition.go +++ b/resource-manager/logic/2019-05-01/workflowrunactions/id_repetition.go @@ -42,31 +42,9 @@ func ParseRepetitionID(input string) (*RepetitionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RepetitionId{} - - 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.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) - } - - if id.RunName, ok = parsed.Parsed["runName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runName", *parsed) - } - - if id.ActionName, ok = parsed.Parsed["actionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionName", *parsed) - } - - if id.RepetitionName, ok = parsed.Parsed["repetitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "repetitionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseRepetitionIDInsensitively(input string) (*RepetitionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RepetitionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RepetitionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - if id.RunName, ok = parsed.Parsed["runName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runName", *parsed) + if id.RunName, ok = input.Parsed["runName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runName", input) } - if id.ActionName, ok = parsed.Parsed["actionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionName", *parsed) + if id.ActionName, ok = input.Parsed["actionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "actionName", input) } - if id.RepetitionName, ok = parsed.Parsed["repetitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "repetitionName", *parsed) + if id.RepetitionName, ok = input.Parsed["repetitionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "repetitionName", input) } - return &id, nil + return nil } // ValidateRepetitionID checks that 'input' can be parsed as a Repetition ID diff --git a/resource-manager/logic/2019-05-01/workflowrunactions/id_repetitionrequesthistory.go b/resource-manager/logic/2019-05-01/workflowrunactions/id_repetitionrequesthistory.go index 901d59169bd..f0f90219914 100644 --- a/resource-manager/logic/2019-05-01/workflowrunactions/id_repetitionrequesthistory.go +++ b/resource-manager/logic/2019-05-01/workflowrunactions/id_repetitionrequesthistory.go @@ -44,35 +44,9 @@ func ParseRepetitionRequestHistoryID(input string) (*RepetitionRequestHistoryId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RepetitionRequestHistoryId{} - - 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.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) - } - - if id.RunName, ok = parsed.Parsed["runName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runName", *parsed) - } - - if id.ActionName, ok = parsed.Parsed["actionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionName", *parsed) - } - - if id.RepetitionName, ok = parsed.Parsed["repetitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "repetitionName", *parsed) - } - - if id.RequestHistoryName, ok = parsed.Parsed["requestHistoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "requestHistoryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseRepetitionRequestHistoryIDInsensitively(input string) (*RepetitionRequ return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RepetitionRequestHistoryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RepetitionRequestHistoryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - if id.RunName, ok = parsed.Parsed["runName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runName", *parsed) + if id.RunName, ok = input.Parsed["runName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runName", input) } - if id.ActionName, ok = parsed.Parsed["actionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionName", *parsed) + if id.ActionName, ok = input.Parsed["actionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "actionName", input) } - if id.RepetitionName, ok = parsed.Parsed["repetitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "repetitionName", *parsed) + if id.RepetitionName, ok = input.Parsed["repetitionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "repetitionName", input) } - if id.RequestHistoryName, ok = parsed.Parsed["requestHistoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "requestHistoryName", *parsed) + if id.RequestHistoryName, ok = input.Parsed["requestHistoryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "requestHistoryName", input) } - return &id, nil + return nil } // ValidateRepetitionRequestHistoryID checks that 'input' can be parsed as a Repetition Request History ID diff --git a/resource-manager/logic/2019-05-01/workflowrunactions/id_requesthistory.go b/resource-manager/logic/2019-05-01/workflowrunactions/id_requesthistory.go index da3fb4c3875..cafa5a6b3a9 100644 --- a/resource-manager/logic/2019-05-01/workflowrunactions/id_requesthistory.go +++ b/resource-manager/logic/2019-05-01/workflowrunactions/id_requesthistory.go @@ -42,31 +42,9 @@ func ParseRequestHistoryID(input string) (*RequestHistoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RequestHistoryId{} - - 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.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) - } - - if id.RunName, ok = parsed.Parsed["runName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runName", *parsed) - } - - if id.ActionName, ok = parsed.Parsed["actionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionName", *parsed) - } - - if id.RequestHistoryName, ok = parsed.Parsed["requestHistoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "requestHistoryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseRequestHistoryIDInsensitively(input string) (*RequestHistoryId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RequestHistoryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RequestHistoryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - if id.RunName, ok = parsed.Parsed["runName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runName", *parsed) + if id.RunName, ok = input.Parsed["runName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runName", input) } - if id.ActionName, ok = parsed.Parsed["actionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionName", *parsed) + if id.ActionName, ok = input.Parsed["actionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "actionName", input) } - if id.RequestHistoryName, ok = parsed.Parsed["requestHistoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "requestHistoryName", *parsed) + if id.RequestHistoryName, ok = input.Parsed["requestHistoryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "requestHistoryName", input) } - return &id, nil + return nil } // ValidateRequestHistoryID checks that 'input' can be parsed as a Request History ID diff --git a/resource-manager/logic/2019-05-01/workflowrunactions/id_run.go b/resource-manager/logic/2019-05-01/workflowrunactions/id_run.go index 1c853ba5d57..be780b1854f 100644 --- a/resource-manager/logic/2019-05-01/workflowrunactions/id_run.go +++ b/resource-manager/logic/2019-05-01/workflowrunactions/id_run.go @@ -38,23 +38,9 @@ func ParseRunID(input string) (*RunId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunId{} - - 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.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) - } - - if id.RunName, ok = parsed.Parsed["runName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRunIDInsensitively(input string) (*RunId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RunId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - if id.RunName, ok = parsed.Parsed["runName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runName", *parsed) + if id.RunName, ok = input.Parsed["runName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runName", input) } - return &id, nil + return nil } // ValidateRunID checks that 'input' can be parsed as a Run ID diff --git a/resource-manager/logic/2019-05-01/workflowrunactions/id_scoperepetition.go b/resource-manager/logic/2019-05-01/workflowrunactions/id_scoperepetition.go index 249f238585a..c9a16203c4c 100644 --- a/resource-manager/logic/2019-05-01/workflowrunactions/id_scoperepetition.go +++ b/resource-manager/logic/2019-05-01/workflowrunactions/id_scoperepetition.go @@ -42,31 +42,9 @@ func ParseScopeRepetitionID(input string) (*ScopeRepetitionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopeRepetitionId{} - - 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.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) - } - - if id.RunName, ok = parsed.Parsed["runName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runName", *parsed) - } - - if id.ActionName, ok = parsed.Parsed["actionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionName", *parsed) - } - - if id.ScopeRepetitionName, ok = parsed.Parsed["scopeRepetitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scopeRepetitionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseScopeRepetitionIDInsensitively(input string) (*ScopeRepetitionId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopeRepetitionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ScopeRepetitionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - if id.RunName, ok = parsed.Parsed["runName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runName", *parsed) + if id.RunName, ok = input.Parsed["runName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runName", input) } - if id.ActionName, ok = parsed.Parsed["actionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionName", *parsed) + if id.ActionName, ok = input.Parsed["actionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "actionName", input) } - if id.ScopeRepetitionName, ok = parsed.Parsed["scopeRepetitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scopeRepetitionName", *parsed) + if id.ScopeRepetitionName, ok = input.Parsed["scopeRepetitionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scopeRepetitionName", input) } - return &id, nil + return nil } // ValidateScopeRepetitionID checks that 'input' can be parsed as a Scope Repetition ID diff --git a/resource-manager/logic/2019-05-01/workflowrunoperations/id_operation.go b/resource-manager/logic/2019-05-01/workflowrunoperations/id_operation.go index 383fbb673f4..3955a102c8e 100644 --- a/resource-manager/logic/2019-05-01/workflowrunoperations/id_operation.go +++ b/resource-manager/logic/2019-05-01/workflowrunoperations/id_operation.go @@ -40,27 +40,9 @@ func ParseOperationID(input string) (*OperationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationId{} - - 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.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) - } - - if id.RunName, ok = parsed.Parsed["runName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runName", *parsed) - } - - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseOperationIDInsensitively(input string) (*OperationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *OperationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - if id.RunName, ok = parsed.Parsed["runName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runName", *parsed) + if id.RunName, ok = input.Parsed["runName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runName", input) } - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if id.OperationId, ok = input.Parsed["operationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "operationId", input) } - return &id, nil + return nil } // ValidateOperationID checks that 'input' can be parsed as a Operation ID diff --git a/resource-manager/logic/2019-05-01/workflowruns/id_run.go b/resource-manager/logic/2019-05-01/workflowruns/id_run.go index 8e3f3caa830..ac212339a1f 100644 --- a/resource-manager/logic/2019-05-01/workflowruns/id_run.go +++ b/resource-manager/logic/2019-05-01/workflowruns/id_run.go @@ -38,23 +38,9 @@ func ParseRunID(input string) (*RunId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunId{} - - 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.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) - } - - if id.RunName, ok = parsed.Parsed["runName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRunIDInsensitively(input string) (*RunId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RunId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - if id.RunName, ok = parsed.Parsed["runName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runName", *parsed) + if id.RunName, ok = input.Parsed["runName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runName", input) } - return &id, nil + return nil } // ValidateRunID checks that 'input' can be parsed as a Run ID diff --git a/resource-manager/logic/2019-05-01/workflowruns/id_workflow.go b/resource-manager/logic/2019-05-01/workflowruns/id_workflow.go index 4ddd8015e2e..57606648d34 100644 --- a/resource-manager/logic/2019-05-01/workflowruns/id_workflow.go +++ b/resource-manager/logic/2019-05-01/workflowruns/id_workflow.go @@ -36,19 +36,9 @@ func ParseWorkflowID(input string) (*WorkflowId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkflowId{} - - 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.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkflowIDInsensitively(input string) (*WorkflowId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkflowId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkflowId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - return &id, nil + return nil } // ValidateWorkflowID checks that 'input' can be parsed as a Workflow ID diff --git a/resource-manager/logic/2019-05-01/workflows/id_locationworkflow.go b/resource-manager/logic/2019-05-01/workflows/id_locationworkflow.go index cfc0c780556..05ee9d1773d 100644 --- a/resource-manager/logic/2019-05-01/workflows/id_locationworkflow.go +++ b/resource-manager/logic/2019-05-01/workflows/id_locationworkflow.go @@ -38,23 +38,9 @@ func ParseLocationWorkflowID(input string) (*LocationWorkflowId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationWorkflowId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLocationWorkflowIDInsensitively(input string) (*LocationWorkflowId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationWorkflowId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LocationWorkflowId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - return &id, nil + return nil } // ValidateLocationWorkflowID checks that 'input' can be parsed as a Location Workflow ID diff --git a/resource-manager/logic/2019-05-01/workflows/id_workflow.go b/resource-manager/logic/2019-05-01/workflows/id_workflow.go index bee34582ad0..fa95e6a4a57 100644 --- a/resource-manager/logic/2019-05-01/workflows/id_workflow.go +++ b/resource-manager/logic/2019-05-01/workflows/id_workflow.go @@ -36,19 +36,9 @@ func ParseWorkflowID(input string) (*WorkflowId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkflowId{} - - 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.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkflowIDInsensitively(input string) (*WorkflowId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkflowId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkflowId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - return &id, nil + return nil } // ValidateWorkflowID checks that 'input' can be parsed as a Workflow ID diff --git a/resource-manager/logic/2019-05-01/workflowtriggerhistories/id_history.go b/resource-manager/logic/2019-05-01/workflowtriggerhistories/id_history.go index 58ee11006e1..40daa6ce824 100644 --- a/resource-manager/logic/2019-05-01/workflowtriggerhistories/id_history.go +++ b/resource-manager/logic/2019-05-01/workflowtriggerhistories/id_history.go @@ -40,27 +40,9 @@ func ParseHistoryID(input string) (*HistoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HistoryId{} - - 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.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) - } - - if id.TriggerName, ok = parsed.Parsed["triggerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggerName", *parsed) - } - - if id.HistoryName, ok = parsed.Parsed["historyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "historyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseHistoryIDInsensitively(input string) (*HistoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HistoryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *HistoryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - if id.TriggerName, ok = parsed.Parsed["triggerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggerName", *parsed) + if id.TriggerName, ok = input.Parsed["triggerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "triggerName", input) } - if id.HistoryName, ok = parsed.Parsed["historyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "historyName", *parsed) + if id.HistoryName, ok = input.Parsed["historyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "historyName", input) } - return &id, nil + return nil } // ValidateHistoryID checks that 'input' can be parsed as a History ID diff --git a/resource-manager/logic/2019-05-01/workflowtriggerhistories/id_trigger.go b/resource-manager/logic/2019-05-01/workflowtriggerhistories/id_trigger.go index b441b42c984..628662678a5 100644 --- a/resource-manager/logic/2019-05-01/workflowtriggerhistories/id_trigger.go +++ b/resource-manager/logic/2019-05-01/workflowtriggerhistories/id_trigger.go @@ -38,23 +38,9 @@ func ParseTriggerID(input string) (*TriggerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TriggerId{} - - 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.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) - } - - if id.TriggerName, ok = parsed.Parsed["triggerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTriggerIDInsensitively(input string) (*TriggerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TriggerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TriggerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - if id.TriggerName, ok = parsed.Parsed["triggerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggerName", *parsed) + if id.TriggerName, ok = input.Parsed["triggerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "triggerName", input) } - return &id, nil + return nil } // ValidateTriggerID checks that 'input' can be parsed as a Trigger ID diff --git a/resource-manager/logic/2019-05-01/workflowtriggers/id_trigger.go b/resource-manager/logic/2019-05-01/workflowtriggers/id_trigger.go index 40db8daf975..6ce028b5087 100644 --- a/resource-manager/logic/2019-05-01/workflowtriggers/id_trigger.go +++ b/resource-manager/logic/2019-05-01/workflowtriggers/id_trigger.go @@ -38,23 +38,9 @@ func ParseTriggerID(input string) (*TriggerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TriggerId{} - - 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.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) - } - - if id.TriggerName, ok = parsed.Parsed["triggerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTriggerIDInsensitively(input string) (*TriggerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TriggerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TriggerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - if id.TriggerName, ok = parsed.Parsed["triggerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggerName", *parsed) + if id.TriggerName, ok = input.Parsed["triggerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "triggerName", input) } - return &id, nil + return nil } // ValidateTriggerID checks that 'input' can be parsed as a Trigger ID diff --git a/resource-manager/logic/2019-05-01/workflowtriggers/id_versiontrigger.go b/resource-manager/logic/2019-05-01/workflowtriggers/id_versiontrigger.go index d7e62385cc9..1d50afeaacf 100644 --- a/resource-manager/logic/2019-05-01/workflowtriggers/id_versiontrigger.go +++ b/resource-manager/logic/2019-05-01/workflowtriggers/id_versiontrigger.go @@ -40,27 +40,9 @@ func ParseVersionTriggerID(input string) (*VersionTriggerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionTriggerId{} - - 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.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) - } - - if id.VersionId, ok = parsed.Parsed["versionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionId", *parsed) - } - - if id.TriggerName, ok = parsed.Parsed["triggerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVersionTriggerIDInsensitively(input string) (*VersionTriggerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionTriggerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VersionTriggerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - if id.VersionId, ok = parsed.Parsed["versionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionId", *parsed) + if id.VersionId, ok = input.Parsed["versionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionId", input) } - if id.TriggerName, ok = parsed.Parsed["triggerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggerName", *parsed) + if id.TriggerName, ok = input.Parsed["triggerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "triggerName", input) } - return &id, nil + return nil } // ValidateVersionTriggerID checks that 'input' can be parsed as a Version Trigger ID diff --git a/resource-manager/logic/2019-05-01/workflowtriggers/id_workflow.go b/resource-manager/logic/2019-05-01/workflowtriggers/id_workflow.go index 4f83296b43a..14d14f7f8a2 100644 --- a/resource-manager/logic/2019-05-01/workflowtriggers/id_workflow.go +++ b/resource-manager/logic/2019-05-01/workflowtriggers/id_workflow.go @@ -36,19 +36,9 @@ func ParseWorkflowID(input string) (*WorkflowId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkflowId{} - - 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.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkflowIDInsensitively(input string) (*WorkflowId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkflowId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkflowId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - return &id, nil + return nil } // ValidateWorkflowID checks that 'input' can be parsed as a Workflow ID diff --git a/resource-manager/logic/2019-05-01/workflowversions/id_version.go b/resource-manager/logic/2019-05-01/workflowversions/id_version.go index 4599a952d26..c03fb0343eb 100644 --- a/resource-manager/logic/2019-05-01/workflowversions/id_version.go +++ b/resource-manager/logic/2019-05-01/workflowversions/id_version.go @@ -38,23 +38,9 @@ func ParseVersionID(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} - - 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.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) - } - - if id.VersionId, ok = parsed.Parsed["versionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVersionIDInsensitively(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - if id.VersionId, ok = parsed.Parsed["versionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionId", *parsed) + if id.VersionId, ok = input.Parsed["versionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionId", input) } - return &id, nil + return nil } // ValidateVersionID checks that 'input' can be parsed as a Version ID diff --git a/resource-manager/logic/2019-05-01/workflowversions/id_workflow.go b/resource-manager/logic/2019-05-01/workflowversions/id_workflow.go index dda981ce854..1463790240a 100644 --- a/resource-manager/logic/2019-05-01/workflowversions/id_workflow.go +++ b/resource-manager/logic/2019-05-01/workflowversions/id_workflow.go @@ -36,19 +36,9 @@ func ParseWorkflowID(input string) (*WorkflowId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkflowId{} - - 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.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkflowIDInsensitively(input string) (*WorkflowId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkflowId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkflowId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - return &id, nil + return nil } // ValidateWorkflowID checks that 'input' can be parsed as a Workflow ID diff --git a/resource-manager/logz/2020-10-01/monitors/id_monitor.go b/resource-manager/logz/2020-10-01/monitors/id_monitor.go index f33a6d052c8..5969c63ecba 100644 --- a/resource-manager/logz/2020-10-01/monitors/id_monitor.go +++ b/resource-manager/logz/2020-10-01/monitors/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/logz/2020-10-01/singlesignon/id_monitor.go b/resource-manager/logz/2020-10-01/singlesignon/id_monitor.go index eee4616e11e..89dd9200d6e 100644 --- a/resource-manager/logz/2020-10-01/singlesignon/id_monitor.go +++ b/resource-manager/logz/2020-10-01/singlesignon/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/logz/2020-10-01/singlesignon/id_singlesignonconfiguration.go b/resource-manager/logz/2020-10-01/singlesignon/id_singlesignonconfiguration.go index d032abafbc9..a2379fc0743 100644 --- a/resource-manager/logz/2020-10-01/singlesignon/id_singlesignonconfiguration.go +++ b/resource-manager/logz/2020-10-01/singlesignon/id_singlesignonconfiguration.go @@ -38,23 +38,9 @@ func ParseSingleSignOnConfigurationID(input string) (*SingleSignOnConfigurationI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SingleSignOnConfigurationId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) - } - - if id.SingleSignOnConfigurationName, ok = parsed.Parsed["singleSignOnConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "singleSignOnConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSingleSignOnConfigurationIDInsensitively(input string) (*SingleSignOnC return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SingleSignOnConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SingleSignOnConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - if id.SingleSignOnConfigurationName, ok = parsed.Parsed["singleSignOnConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "singleSignOnConfigurationName", *parsed) + if id.SingleSignOnConfigurationName, ok = input.Parsed["singleSignOnConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "singleSignOnConfigurationName", input) } - return &id, nil + return nil } // ValidateSingleSignOnConfigurationID checks that 'input' can be parsed as a Single Sign On Configuration ID diff --git a/resource-manager/logz/2020-10-01/subaccount/id_account.go b/resource-manager/logz/2020-10-01/subaccount/id_account.go index f4ddccf4db4..99fd4c046cc 100644 --- a/resource-manager/logz/2020-10-01/subaccount/id_account.go +++ b/resource-manager/logz/2020-10-01/subaccount/id_account.go @@ -38,23 +38,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/logz/2020-10-01/subaccount/id_monitor.go b/resource-manager/logz/2020-10-01/subaccount/id_monitor.go index 997f40bfc64..7f13a57dc80 100644 --- a/resource-manager/logz/2020-10-01/subaccount/id_monitor.go +++ b/resource-manager/logz/2020-10-01/subaccount/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/logz/2020-10-01/tagrules/id_account.go b/resource-manager/logz/2020-10-01/tagrules/id_account.go index de7a225a01e..37ffbd7d7fd 100644 --- a/resource-manager/logz/2020-10-01/tagrules/id_account.go +++ b/resource-manager/logz/2020-10-01/tagrules/id_account.go @@ -38,23 +38,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/logz/2020-10-01/tagrules/id_accounttagrule.go b/resource-manager/logz/2020-10-01/tagrules/id_accounttagrule.go index 943ea2481e9..d1c1eb68e5c 100644 --- a/resource-manager/logz/2020-10-01/tagrules/id_accounttagrule.go +++ b/resource-manager/logz/2020-10-01/tagrules/id_accounttagrule.go @@ -40,27 +40,9 @@ func ParseAccountTagRuleID(input string) (*AccountTagRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountTagRuleId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.TagRuleName, ok = parsed.Parsed["tagRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseAccountTagRuleIDInsensitively(input string) (*AccountTagRuleId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountTagRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *AccountTagRuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.TagRuleName, ok = parsed.Parsed["tagRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagRuleName", *parsed) + if id.TagRuleName, ok = input.Parsed["tagRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tagRuleName", input) } - return &id, nil + return nil } // ValidateAccountTagRuleID checks that 'input' can be parsed as a Account Tag Rule ID diff --git a/resource-manager/logz/2020-10-01/tagrules/id_monitor.go b/resource-manager/logz/2020-10-01/tagrules/id_monitor.go index dd7f0f6b170..09d0294ccb8 100644 --- a/resource-manager/logz/2020-10-01/tagrules/id_monitor.go +++ b/resource-manager/logz/2020-10-01/tagrules/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/logz/2020-10-01/tagrules/id_tagrule.go b/resource-manager/logz/2020-10-01/tagrules/id_tagrule.go index c81c8f37d12..6b16843c8a6 100644 --- a/resource-manager/logz/2020-10-01/tagrules/id_tagrule.go +++ b/resource-manager/logz/2020-10-01/tagrules/id_tagrule.go @@ -38,23 +38,9 @@ func ParseTagRuleID(input string) (*TagRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TagRuleId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) - } - - if id.TagRuleName, ok = parsed.Parsed["tagRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTagRuleIDInsensitively(input string) (*TagRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TagRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TagRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - if id.TagRuleName, ok = parsed.Parsed["tagRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagRuleName", *parsed) + if id.TagRuleName, ok = input.Parsed["tagRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tagRuleName", input) } - return &id, nil + return nil } // ValidateTagRuleID checks that 'input' can be parsed as a Tag Rule ID diff --git a/resource-manager/logz/2020-10-01/vmhost/id_account.go b/resource-manager/logz/2020-10-01/vmhost/id_account.go index 096d7c18e0a..f859ee5a439 100644 --- a/resource-manager/logz/2020-10-01/vmhost/id_account.go +++ b/resource-manager/logz/2020-10-01/vmhost/id_account.go @@ -38,23 +38,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) - } - - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/logz/2020-10-01/vmhost/id_monitor.go b/resource-manager/logz/2020-10-01/vmhost/id_monitor.go index aa2abb220e9..75ed847724a 100644 --- a/resource-manager/logz/2020-10-01/vmhost/id_monitor.go +++ b/resource-manager/logz/2020-10-01/vmhost/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/machinelearningservices/2022-05-01/batchdeployment/id_batchendpoint.go b/resource-manager/machinelearningservices/2022-05-01/batchdeployment/id_batchendpoint.go index f6c57ae42f6..4994081e112 100644 --- a/resource-manager/machinelearningservices/2022-05-01/batchdeployment/id_batchendpoint.go +++ b/resource-manager/machinelearningservices/2022-05-01/batchdeployment/id_batchendpoint.go @@ -38,23 +38,9 @@ func ParseBatchEndpointID(input string) (*BatchEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BatchEndpointId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.BatchEndpointName, ok = parsed.Parsed["batchEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBatchEndpointIDInsensitively(input string) (*BatchEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BatchEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BatchEndpointId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.BatchEndpointName, ok = parsed.Parsed["batchEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchEndpointName", *parsed) + if id.BatchEndpointName, ok = input.Parsed["batchEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "batchEndpointName", input) } - return &id, nil + return nil } // ValidateBatchEndpointID checks that 'input' can be parsed as a Batch Endpoint ID diff --git a/resource-manager/machinelearningservices/2022-05-01/batchdeployment/id_deployment.go b/resource-manager/machinelearningservices/2022-05-01/batchdeployment/id_deployment.go index 03fd9c38ff1..e424729f1e7 100644 --- a/resource-manager/machinelearningservices/2022-05-01/batchdeployment/id_deployment.go +++ b/resource-manager/machinelearningservices/2022-05-01/batchdeployment/id_deployment.go @@ -40,27 +40,9 @@ func ParseDeploymentID(input string) (*DeploymentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeploymentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.BatchEndpointName, ok = parsed.Parsed["batchEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchEndpointName", *parsed) - } - - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseDeploymentIDInsensitively(input string) (*DeploymentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeploymentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DeploymentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.BatchEndpointName, ok = parsed.Parsed["batchEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchEndpointName", *parsed) + if id.BatchEndpointName, ok = input.Parsed["batchEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "batchEndpointName", input) } - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if id.DeploymentName, ok = input.Parsed["deploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", input) } - return &id, nil + return nil } // ValidateDeploymentID checks that 'input' can be parsed as a Deployment ID diff --git a/resource-manager/machinelearningservices/2022-05-01/batchendpoint/id_batchendpoint.go b/resource-manager/machinelearningservices/2022-05-01/batchendpoint/id_batchendpoint.go index 74d905b4139..b80ac7f9b96 100644 --- a/resource-manager/machinelearningservices/2022-05-01/batchendpoint/id_batchendpoint.go +++ b/resource-manager/machinelearningservices/2022-05-01/batchendpoint/id_batchendpoint.go @@ -38,23 +38,9 @@ func ParseBatchEndpointID(input string) (*BatchEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BatchEndpointId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.BatchEndpointName, ok = parsed.Parsed["batchEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBatchEndpointIDInsensitively(input string) (*BatchEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BatchEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BatchEndpointId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.BatchEndpointName, ok = parsed.Parsed["batchEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchEndpointName", *parsed) + if id.BatchEndpointName, ok = input.Parsed["batchEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "batchEndpointName", input) } - return &id, nil + return nil } // ValidateBatchEndpointID checks that 'input' can be parsed as a Batch Endpoint ID diff --git a/resource-manager/machinelearningservices/2022-05-01/batchendpoint/id_workspace.go b/resource-manager/machinelearningservices/2022-05-01/batchendpoint/id_workspace.go index eb2c67ecd5d..f77478ba59b 100644 --- a/resource-manager/machinelearningservices/2022-05-01/batchendpoint/id_workspace.go +++ b/resource-manager/machinelearningservices/2022-05-01/batchendpoint/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2022-05-01/codecontainer/id_code.go b/resource-manager/machinelearningservices/2022-05-01/codecontainer/id_code.go index a473f62d1ef..9b66f97af38 100644 --- a/resource-manager/machinelearningservices/2022-05-01/codecontainer/id_code.go +++ b/resource-manager/machinelearningservices/2022-05-01/codecontainer/id_code.go @@ -38,23 +38,9 @@ func ParseCodeID(input string) (*CodeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CodeId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.CodeName, ok = parsed.Parsed["codeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "codeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCodeIDInsensitively(input string) (*CodeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CodeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CodeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.CodeName, ok = parsed.Parsed["codeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "codeName", *parsed) + if id.CodeName, ok = input.Parsed["codeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "codeName", input) } - return &id, nil + return nil } // ValidateCodeID checks that 'input' can be parsed as a Code ID diff --git a/resource-manager/machinelearningservices/2022-05-01/codecontainer/id_workspace.go b/resource-manager/machinelearningservices/2022-05-01/codecontainer/id_workspace.go index 608d0f7e0b5..cdacd37c4f8 100644 --- a/resource-manager/machinelearningservices/2022-05-01/codecontainer/id_workspace.go +++ b/resource-manager/machinelearningservices/2022-05-01/codecontainer/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2022-05-01/codeversion/id_code.go b/resource-manager/machinelearningservices/2022-05-01/codeversion/id_code.go index cf69b5b96ac..7e49572e0f5 100644 --- a/resource-manager/machinelearningservices/2022-05-01/codeversion/id_code.go +++ b/resource-manager/machinelearningservices/2022-05-01/codeversion/id_code.go @@ -38,23 +38,9 @@ func ParseCodeID(input string) (*CodeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CodeId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.CodeName, ok = parsed.Parsed["codeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "codeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCodeIDInsensitively(input string) (*CodeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CodeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CodeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.CodeName, ok = parsed.Parsed["codeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "codeName", *parsed) + if id.CodeName, ok = input.Parsed["codeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "codeName", input) } - return &id, nil + return nil } // ValidateCodeID checks that 'input' can be parsed as a Code ID diff --git a/resource-manager/machinelearningservices/2022-05-01/codeversion/id_codeversion.go b/resource-manager/machinelearningservices/2022-05-01/codeversion/id_codeversion.go index d6a502b6b5f..9311b38601a 100644 --- a/resource-manager/machinelearningservices/2022-05-01/codeversion/id_codeversion.go +++ b/resource-manager/machinelearningservices/2022-05-01/codeversion/id_codeversion.go @@ -40,27 +40,9 @@ func ParseCodeVersionID(input string) (*CodeVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CodeVersionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.CodeName, ok = parsed.Parsed["codeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "codeName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseCodeVersionIDInsensitively(input string) (*CodeVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CodeVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *CodeVersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.CodeName, ok = parsed.Parsed["codeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "codeName", *parsed) + if id.CodeName, ok = input.Parsed["codeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "codeName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateCodeVersionID checks that 'input' can be parsed as a Code Version ID diff --git a/resource-manager/machinelearningservices/2022-05-01/componentcontainer/id_component.go b/resource-manager/machinelearningservices/2022-05-01/componentcontainer/id_component.go index a4b869cfb1c..5b09bc73eee 100644 --- a/resource-manager/machinelearningservices/2022-05-01/componentcontainer/id_component.go +++ b/resource-manager/machinelearningservices/2022-05-01/componentcontainer/id_component.go @@ -38,23 +38,9 @@ func ParseComponentID(input string) (*ComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseComponentIDInsensitively(input string) (*ComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ComponentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) } - return &id, nil + return nil } // ValidateComponentID checks that 'input' can be parsed as a Component ID diff --git a/resource-manager/machinelearningservices/2022-05-01/componentcontainer/id_workspace.go b/resource-manager/machinelearningservices/2022-05-01/componentcontainer/id_workspace.go index 2bc7cff6726..5d1410ef408 100644 --- a/resource-manager/machinelearningservices/2022-05-01/componentcontainer/id_workspace.go +++ b/resource-manager/machinelearningservices/2022-05-01/componentcontainer/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2022-05-01/componentversion/id_component.go b/resource-manager/machinelearningservices/2022-05-01/componentversion/id_component.go index f4632d5a6a1..f3f3b99eaa1 100644 --- a/resource-manager/machinelearningservices/2022-05-01/componentversion/id_component.go +++ b/resource-manager/machinelearningservices/2022-05-01/componentversion/id_component.go @@ -38,23 +38,9 @@ func ParseComponentID(input string) (*ComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseComponentIDInsensitively(input string) (*ComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ComponentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) } - return &id, nil + return nil } // ValidateComponentID checks that 'input' can be parsed as a Component ID diff --git a/resource-manager/machinelearningservices/2022-05-01/componentversion/id_componentversion.go b/resource-manager/machinelearningservices/2022-05-01/componentversion/id_componentversion.go index 8e114d7dfe4..cbbb201c9bb 100644 --- a/resource-manager/machinelearningservices/2022-05-01/componentversion/id_componentversion.go +++ b/resource-manager/machinelearningservices/2022-05-01/componentversion/id_componentversion.go @@ -40,27 +40,9 @@ func ParseComponentVersionID(input string) (*ComponentVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentVersionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseComponentVersionIDInsensitively(input string) (*ComponentVersionId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ComponentVersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateComponentVersionID checks that 'input' can be parsed as a Component Version ID diff --git a/resource-manager/machinelearningservices/2022-05-01/datacontainer/id_data.go b/resource-manager/machinelearningservices/2022-05-01/datacontainer/id_data.go index 407f113b851..cbbce13ab8a 100644 --- a/resource-manager/machinelearningservices/2022-05-01/datacontainer/id_data.go +++ b/resource-manager/machinelearningservices/2022-05-01/datacontainer/id_data.go @@ -38,23 +38,9 @@ func ParseDataID(input string) (*DataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.DataName, ok = parsed.Parsed["dataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDataIDInsensitively(input string) (*DataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DataId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.DataName, ok = parsed.Parsed["dataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataName", *parsed) + if id.DataName, ok = input.Parsed["dataName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataName", input) } - return &id, nil + return nil } // ValidateDataID checks that 'input' can be parsed as a Data ID diff --git a/resource-manager/machinelearningservices/2022-05-01/datacontainer/id_workspace.go b/resource-manager/machinelearningservices/2022-05-01/datacontainer/id_workspace.go index 5c6b04e44e5..9939fbf03e9 100644 --- a/resource-manager/machinelearningservices/2022-05-01/datacontainer/id_workspace.go +++ b/resource-manager/machinelearningservices/2022-05-01/datacontainer/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2022-05-01/datastore/id_datastore.go b/resource-manager/machinelearningservices/2022-05-01/datastore/id_datastore.go index ee2428b4235..58fc7a10542 100644 --- a/resource-manager/machinelearningservices/2022-05-01/datastore/id_datastore.go +++ b/resource-manager/machinelearningservices/2022-05-01/datastore/id_datastore.go @@ -38,23 +38,9 @@ func ParseDataStoreID(input string) (*DataStoreId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataStoreId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.DataStoreName, ok = parsed.Parsed["dataStoreName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataStoreName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDataStoreIDInsensitively(input string) (*DataStoreId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataStoreId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DataStoreId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.DataStoreName, ok = parsed.Parsed["dataStoreName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataStoreName", *parsed) + if id.DataStoreName, ok = input.Parsed["dataStoreName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataStoreName", input) } - return &id, nil + return nil } // ValidateDataStoreID checks that 'input' can be parsed as a Data Store ID diff --git a/resource-manager/machinelearningservices/2022-05-01/datastore/id_workspace.go b/resource-manager/machinelearningservices/2022-05-01/datastore/id_workspace.go index b4cddf6dc62..008f9fac5fe 100644 --- a/resource-manager/machinelearningservices/2022-05-01/datastore/id_workspace.go +++ b/resource-manager/machinelearningservices/2022-05-01/datastore/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2022-05-01/dataversion/id_data.go b/resource-manager/machinelearningservices/2022-05-01/dataversion/id_data.go index e4304823691..8ad525d11da 100644 --- a/resource-manager/machinelearningservices/2022-05-01/dataversion/id_data.go +++ b/resource-manager/machinelearningservices/2022-05-01/dataversion/id_data.go @@ -38,23 +38,9 @@ func ParseDataID(input string) (*DataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.DataName, ok = parsed.Parsed["dataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDataIDInsensitively(input string) (*DataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DataId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.DataName, ok = parsed.Parsed["dataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataName", *parsed) + if id.DataName, ok = input.Parsed["dataName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataName", input) } - return &id, nil + return nil } // ValidateDataID checks that 'input' can be parsed as a Data ID diff --git a/resource-manager/machinelearningservices/2022-05-01/dataversion/id_version.go b/resource-manager/machinelearningservices/2022-05-01/dataversion/id_version.go index 744ff421311..af055f9a58b 100644 --- a/resource-manager/machinelearningservices/2022-05-01/dataversion/id_version.go +++ b/resource-manager/machinelearningservices/2022-05-01/dataversion/id_version.go @@ -40,27 +40,9 @@ func ParseVersionID(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.DataName, ok = parsed.Parsed["dataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVersionIDInsensitively(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.DataName, ok = parsed.Parsed["dataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataName", *parsed) + if id.DataName, ok = input.Parsed["dataName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateVersionID checks that 'input' can be parsed as a Version ID diff --git a/resource-manager/machinelearningservices/2022-05-01/environmentcontainer/id_environment.go b/resource-manager/machinelearningservices/2022-05-01/environmentcontainer/id_environment.go index 418572ed464..3c327afa0d6 100644 --- a/resource-manager/machinelearningservices/2022-05-01/environmentcontainer/id_environment.go +++ b/resource-manager/machinelearningservices/2022-05-01/environmentcontainer/id_environment.go @@ -38,23 +38,9 @@ func ParseEnvironmentID(input string) (*EnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseEnvironmentIDInsensitively(input string) (*EnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EnvironmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if id.EnvironmentName, ok = input.Parsed["environmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "environmentName", input) } - return &id, nil + return nil } // ValidateEnvironmentID checks that 'input' can be parsed as a Environment ID diff --git a/resource-manager/machinelearningservices/2022-05-01/environmentcontainer/id_workspace.go b/resource-manager/machinelearningservices/2022-05-01/environmentcontainer/id_workspace.go index 16ed5dfc856..4e121cbdd93 100644 --- a/resource-manager/machinelearningservices/2022-05-01/environmentcontainer/id_workspace.go +++ b/resource-manager/machinelearningservices/2022-05-01/environmentcontainer/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2022-05-01/environmentversion/id_environment.go b/resource-manager/machinelearningservices/2022-05-01/environmentversion/id_environment.go index ad15ca12921..3b5f2b580cc 100644 --- a/resource-manager/machinelearningservices/2022-05-01/environmentversion/id_environment.go +++ b/resource-manager/machinelearningservices/2022-05-01/environmentversion/id_environment.go @@ -38,23 +38,9 @@ func ParseEnvironmentID(input string) (*EnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseEnvironmentIDInsensitively(input string) (*EnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EnvironmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if id.EnvironmentName, ok = input.Parsed["environmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "environmentName", input) } - return &id, nil + return nil } // ValidateEnvironmentID checks that 'input' can be parsed as a Environment ID diff --git a/resource-manager/machinelearningservices/2022-05-01/environmentversion/id_environmentversion.go b/resource-manager/machinelearningservices/2022-05-01/environmentversion/id_environmentversion.go index 73dfc1108f1..880769b0baa 100644 --- a/resource-manager/machinelearningservices/2022-05-01/environmentversion/id_environmentversion.go +++ b/resource-manager/machinelearningservices/2022-05-01/environmentversion/id_environmentversion.go @@ -40,27 +40,9 @@ func ParseEnvironmentVersionID(input string) (*EnvironmentVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentVersionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseEnvironmentVersionIDInsensitively(input string) (*EnvironmentVersionId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *EnvironmentVersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if id.EnvironmentName, ok = input.Parsed["environmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "environmentName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateEnvironmentVersionID checks that 'input' can be parsed as a Environment Version ID diff --git a/resource-manager/machinelearningservices/2022-05-01/job/id_job.go b/resource-manager/machinelearningservices/2022-05-01/job/id_job.go index 78aa3ecfea9..563223eca08 100644 --- a/resource-manager/machinelearningservices/2022-05-01/job/id_job.go +++ b/resource-manager/machinelearningservices/2022-05-01/job/id_job.go @@ -38,23 +38,9 @@ func ParseJobID(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseJobIDInsensitively(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *JobId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - return &id, nil + return nil } // ValidateJobID checks that 'input' can be parsed as a Job ID diff --git a/resource-manager/machinelearningservices/2022-05-01/job/id_workspace.go b/resource-manager/machinelearningservices/2022-05-01/job/id_workspace.go index d3d669da0a3..165bda1d6b0 100644 --- a/resource-manager/machinelearningservices/2022-05-01/job/id_workspace.go +++ b/resource-manager/machinelearningservices/2022-05-01/job/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2022-05-01/machinelearningcomputes/id_compute.go b/resource-manager/machinelearningservices/2022-05-01/machinelearningcomputes/id_compute.go index 18a81277e2a..0a5c48c2b75 100644 --- a/resource-manager/machinelearningservices/2022-05-01/machinelearningcomputes/id_compute.go +++ b/resource-manager/machinelearningservices/2022-05-01/machinelearningcomputes/id_compute.go @@ -38,23 +38,9 @@ func ParseComputeID(input string) (*ComputeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComputeId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ComputeName, ok = parsed.Parsed["computeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "computeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseComputeIDInsensitively(input string) (*ComputeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComputeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ComputeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ComputeName, ok = parsed.Parsed["computeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "computeName", *parsed) + if id.ComputeName, ok = input.Parsed["computeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "computeName", input) } - return &id, nil + return nil } // ValidateComputeID checks that 'input' can be parsed as a Compute ID diff --git a/resource-manager/machinelearningservices/2022-05-01/machinelearningcomputes/id_workspace.go b/resource-manager/machinelearningservices/2022-05-01/machinelearningcomputes/id_workspace.go index 433fbb7591c..97b8f1ce442 100644 --- a/resource-manager/machinelearningservices/2022-05-01/machinelearningcomputes/id_workspace.go +++ b/resource-manager/machinelearningservices/2022-05-01/machinelearningcomputes/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2022-05-01/modelcontainer/id_model.go b/resource-manager/machinelearningservices/2022-05-01/modelcontainer/id_model.go index ba14ca74245..51fa4a9d96b 100644 --- a/resource-manager/machinelearningservices/2022-05-01/modelcontainer/id_model.go +++ b/resource-manager/machinelearningservices/2022-05-01/modelcontainer/id_model.go @@ -38,23 +38,9 @@ func ParseModelID(input string) (*ModelId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModelId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ModelName, ok = parsed.Parsed["modelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "modelName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseModelIDInsensitively(input string) (*ModelId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModelId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ModelId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ModelName, ok = parsed.Parsed["modelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "modelName", *parsed) + if id.ModelName, ok = input.Parsed["modelName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "modelName", input) } - return &id, nil + return nil } // ValidateModelID checks that 'input' can be parsed as a Model ID diff --git a/resource-manager/machinelearningservices/2022-05-01/modelcontainer/id_workspace.go b/resource-manager/machinelearningservices/2022-05-01/modelcontainer/id_workspace.go index bbc169a54bc..3e2ad09c644 100644 --- a/resource-manager/machinelearningservices/2022-05-01/modelcontainer/id_workspace.go +++ b/resource-manager/machinelearningservices/2022-05-01/modelcontainer/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2022-05-01/modelversion/id_model.go b/resource-manager/machinelearningservices/2022-05-01/modelversion/id_model.go index 46520fef955..1ac17714a02 100644 --- a/resource-manager/machinelearningservices/2022-05-01/modelversion/id_model.go +++ b/resource-manager/machinelearningservices/2022-05-01/modelversion/id_model.go @@ -38,23 +38,9 @@ func ParseModelID(input string) (*ModelId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModelId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ModelName, ok = parsed.Parsed["modelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "modelName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseModelIDInsensitively(input string) (*ModelId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModelId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ModelId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ModelName, ok = parsed.Parsed["modelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "modelName", *parsed) + if id.ModelName, ok = input.Parsed["modelName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "modelName", input) } - return &id, nil + return nil } // ValidateModelID checks that 'input' can be parsed as a Model ID diff --git a/resource-manager/machinelearningservices/2022-05-01/modelversion/id_modelversion.go b/resource-manager/machinelearningservices/2022-05-01/modelversion/id_modelversion.go index fa93daf0849..cc122322e68 100644 --- a/resource-manager/machinelearningservices/2022-05-01/modelversion/id_modelversion.go +++ b/resource-manager/machinelearningservices/2022-05-01/modelversion/id_modelversion.go @@ -40,27 +40,9 @@ func ParseModelVersionID(input string) (*ModelVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModelVersionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ModelName, ok = parsed.Parsed["modelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "modelName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseModelVersionIDInsensitively(input string) (*ModelVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModelVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ModelVersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ModelName, ok = parsed.Parsed["modelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "modelName", *parsed) + if id.ModelName, ok = input.Parsed["modelName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "modelName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateModelVersionID checks that 'input' can be parsed as a Model Version ID diff --git a/resource-manager/machinelearningservices/2022-05-01/onlinedeployment/id_onlineendpoint.go b/resource-manager/machinelearningservices/2022-05-01/onlinedeployment/id_onlineendpoint.go index 936f0a50c4b..4c677589ea1 100644 --- a/resource-manager/machinelearningservices/2022-05-01/onlinedeployment/id_onlineendpoint.go +++ b/resource-manager/machinelearningservices/2022-05-01/onlinedeployment/id_onlineendpoint.go @@ -38,23 +38,9 @@ func ParseOnlineEndpointID(input string) (*OnlineEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OnlineEndpointId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.OnlineEndpointName, ok = parsed.Parsed["onlineEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "onlineEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseOnlineEndpointIDInsensitively(input string) (*OnlineEndpointId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OnlineEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OnlineEndpointId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.OnlineEndpointName, ok = parsed.Parsed["onlineEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "onlineEndpointName", *parsed) + if id.OnlineEndpointName, ok = input.Parsed["onlineEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "onlineEndpointName", input) } - return &id, nil + return nil } // ValidateOnlineEndpointID checks that 'input' can be parsed as a Online Endpoint ID diff --git a/resource-manager/machinelearningservices/2022-05-01/onlinedeployment/id_onlineendpointdeployment.go b/resource-manager/machinelearningservices/2022-05-01/onlinedeployment/id_onlineendpointdeployment.go index 9aaeccc9396..2d307a61a3d 100644 --- a/resource-manager/machinelearningservices/2022-05-01/onlinedeployment/id_onlineendpointdeployment.go +++ b/resource-manager/machinelearningservices/2022-05-01/onlinedeployment/id_onlineendpointdeployment.go @@ -40,27 +40,9 @@ func ParseOnlineEndpointDeploymentID(input string) (*OnlineEndpointDeploymentId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OnlineEndpointDeploymentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.OnlineEndpointName, ok = parsed.Parsed["onlineEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "onlineEndpointName", *parsed) - } - - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseOnlineEndpointDeploymentIDInsensitively(input string) (*OnlineEndpoint return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OnlineEndpointDeploymentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *OnlineEndpointDeploymentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.OnlineEndpointName, ok = parsed.Parsed["onlineEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "onlineEndpointName", *parsed) + if id.OnlineEndpointName, ok = input.Parsed["onlineEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "onlineEndpointName", input) } - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if id.DeploymentName, ok = input.Parsed["deploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", input) } - return &id, nil + return nil } // ValidateOnlineEndpointDeploymentID checks that 'input' can be parsed as a Online Endpoint Deployment ID diff --git a/resource-manager/machinelearningservices/2022-05-01/onlineendpoint/id_onlineendpoint.go b/resource-manager/machinelearningservices/2022-05-01/onlineendpoint/id_onlineendpoint.go index 6c5c1518e8e..f258feb0620 100644 --- a/resource-manager/machinelearningservices/2022-05-01/onlineendpoint/id_onlineendpoint.go +++ b/resource-manager/machinelearningservices/2022-05-01/onlineendpoint/id_onlineendpoint.go @@ -38,23 +38,9 @@ func ParseOnlineEndpointID(input string) (*OnlineEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OnlineEndpointId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.OnlineEndpointName, ok = parsed.Parsed["onlineEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "onlineEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseOnlineEndpointIDInsensitively(input string) (*OnlineEndpointId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OnlineEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OnlineEndpointId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.OnlineEndpointName, ok = parsed.Parsed["onlineEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "onlineEndpointName", *parsed) + if id.OnlineEndpointName, ok = input.Parsed["onlineEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "onlineEndpointName", input) } - return &id, nil + return nil } // ValidateOnlineEndpointID checks that 'input' can be parsed as a Online Endpoint ID diff --git a/resource-manager/machinelearningservices/2022-05-01/onlineendpoint/id_workspace.go b/resource-manager/machinelearningservices/2022-05-01/onlineendpoint/id_workspace.go index 91faec139dc..1a4a0f46e0b 100644 --- a/resource-manager/machinelearningservices/2022-05-01/onlineendpoint/id_workspace.go +++ b/resource-manager/machinelearningservices/2022-05-01/onlineendpoint/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2022-05-01/operationalizationclusters/id_compute.go b/resource-manager/machinelearningservices/2022-05-01/operationalizationclusters/id_compute.go index e793df52d8b..de3a0b9b0ac 100644 --- a/resource-manager/machinelearningservices/2022-05-01/operationalizationclusters/id_compute.go +++ b/resource-manager/machinelearningservices/2022-05-01/operationalizationclusters/id_compute.go @@ -38,23 +38,9 @@ func ParseComputeID(input string) (*ComputeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComputeId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ComputeName, ok = parsed.Parsed["computeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "computeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseComputeIDInsensitively(input string) (*ComputeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComputeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ComputeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ComputeName, ok = parsed.Parsed["computeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "computeName", *parsed) + if id.ComputeName, ok = input.Parsed["computeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "computeName", input) } - return &id, nil + return nil } // ValidateComputeID checks that 'input' can be parsed as a Compute ID diff --git a/resource-manager/machinelearningservices/2022-05-01/operationalizationclusters/id_workspace.go b/resource-manager/machinelearningservices/2022-05-01/operationalizationclusters/id_workspace.go index 45ab1f8a7dd..856c1bd01eb 100644 --- a/resource-manager/machinelearningservices/2022-05-01/operationalizationclusters/id_workspace.go +++ b/resource-manager/machinelearningservices/2022-05-01/operationalizationclusters/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2022-05-01/outboundnetworkdependenciesendpoints/id_workspace.go b/resource-manager/machinelearningservices/2022-05-01/outboundnetworkdependenciesendpoints/id_workspace.go index f2100fe9487..009611da59e 100644 --- a/resource-manager/machinelearningservices/2022-05-01/outboundnetworkdependenciesendpoints/id_workspace.go +++ b/resource-manager/machinelearningservices/2022-05-01/outboundnetworkdependenciesendpoints/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2022-05-01/privateendpointconnections/id_workspace.go b/resource-manager/machinelearningservices/2022-05-01/privateendpointconnections/id_workspace.go index 8a826c3113b..da4a60605e1 100644 --- a/resource-manager/machinelearningservices/2022-05-01/privateendpointconnections/id_workspace.go +++ b/resource-manager/machinelearningservices/2022-05-01/privateendpointconnections/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2022-05-01/proxyoperations/id_workspace.go b/resource-manager/machinelearningservices/2022-05-01/proxyoperations/id_workspace.go index d0a1746d097..41efeaaa051 100644 --- a/resource-manager/machinelearningservices/2022-05-01/proxyoperations/id_workspace.go +++ b/resource-manager/machinelearningservices/2022-05-01/proxyoperations/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2022-05-01/quota/id_location.go b/resource-manager/machinelearningservices/2022-05-01/quota/id_location.go index 40067b81ab7..f7b04cfd405 100644 --- a/resource-manager/machinelearningservices/2022-05-01/quota/id_location.go +++ b/resource-manager/machinelearningservices/2022-05-01/quota/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/machinelearningservices/2022-05-01/v2workspaceconnectionresource/id_connection.go b/resource-manager/machinelearningservices/2022-05-01/v2workspaceconnectionresource/id_connection.go index a0b502452b4..b9a5e5d30c4 100644 --- a/resource-manager/machinelearningservices/2022-05-01/v2workspaceconnectionresource/id_connection.go +++ b/resource-manager/machinelearningservices/2022-05-01/v2workspaceconnectionresource/id_connection.go @@ -38,23 +38,9 @@ func ParseConnectionID(input string) (*ConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ConnectionName, ok = parsed.Parsed["connectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConnectionIDInsensitively(input string) (*ConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ConnectionName, ok = parsed.Parsed["connectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionName", *parsed) + if id.ConnectionName, ok = input.Parsed["connectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectionName", input) } - return &id, nil + return nil } // ValidateConnectionID checks that 'input' can be parsed as a Connection ID diff --git a/resource-manager/machinelearningservices/2022-05-01/v2workspaceconnectionresource/id_workspace.go b/resource-manager/machinelearningservices/2022-05-01/v2workspaceconnectionresource/id_workspace.go index 4883dc4d002..81abcff93a9 100644 --- a/resource-manager/machinelearningservices/2022-05-01/v2workspaceconnectionresource/id_workspace.go +++ b/resource-manager/machinelearningservices/2022-05-01/v2workspaceconnectionresource/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2022-05-01/virtualmachinesizes/id_location.go b/resource-manager/machinelearningservices/2022-05-01/virtualmachinesizes/id_location.go index 5b66f44c4f7..d887c2fb51f 100644 --- a/resource-manager/machinelearningservices/2022-05-01/virtualmachinesizes/id_location.go +++ b/resource-manager/machinelearningservices/2022-05-01/virtualmachinesizes/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/machinelearningservices/2022-05-01/workspaceprivateendpointconnections/id_privateendpointconnection.go b/resource-manager/machinelearningservices/2022-05-01/workspaceprivateendpointconnections/id_privateendpointconnection.go index e919def8163..3b6dfbac90e 100644 --- a/resource-manager/machinelearningservices/2022-05-01/workspaceprivateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/machinelearningservices/2022-05-01/workspaceprivateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/machinelearningservices/2022-05-01/workspaceprivatelinkresources/id_workspace.go b/resource-manager/machinelearningservices/2022-05-01/workspaceprivatelinkresources/id_workspace.go index 899fa30b3b8..5297b76da47 100644 --- a/resource-manager/machinelearningservices/2022-05-01/workspaceprivatelinkresources/id_workspace.go +++ b/resource-manager/machinelearningservices/2022-05-01/workspaceprivatelinkresources/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2022-05-01/workspaces/id_workspace.go b/resource-manager/machinelearningservices/2022-05-01/workspaces/id_workspace.go index c37f08503e2..42b6e9c9d8a 100644 --- a/resource-manager/machinelearningservices/2022-05-01/workspaces/id_workspace.go +++ b/resource-manager/machinelearningservices/2022-05-01/workspaces/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2022-10-01/batchdeployment/id_batchendpoint.go b/resource-manager/machinelearningservices/2022-10-01/batchdeployment/id_batchendpoint.go index f6c57ae42f6..4994081e112 100644 --- a/resource-manager/machinelearningservices/2022-10-01/batchdeployment/id_batchendpoint.go +++ b/resource-manager/machinelearningservices/2022-10-01/batchdeployment/id_batchendpoint.go @@ -38,23 +38,9 @@ func ParseBatchEndpointID(input string) (*BatchEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BatchEndpointId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.BatchEndpointName, ok = parsed.Parsed["batchEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBatchEndpointIDInsensitively(input string) (*BatchEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BatchEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BatchEndpointId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.BatchEndpointName, ok = parsed.Parsed["batchEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchEndpointName", *parsed) + if id.BatchEndpointName, ok = input.Parsed["batchEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "batchEndpointName", input) } - return &id, nil + return nil } // ValidateBatchEndpointID checks that 'input' can be parsed as a Batch Endpoint ID diff --git a/resource-manager/machinelearningservices/2022-10-01/batchdeployment/id_deployment.go b/resource-manager/machinelearningservices/2022-10-01/batchdeployment/id_deployment.go index 03fd9c38ff1..e424729f1e7 100644 --- a/resource-manager/machinelearningservices/2022-10-01/batchdeployment/id_deployment.go +++ b/resource-manager/machinelearningservices/2022-10-01/batchdeployment/id_deployment.go @@ -40,27 +40,9 @@ func ParseDeploymentID(input string) (*DeploymentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeploymentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.BatchEndpointName, ok = parsed.Parsed["batchEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchEndpointName", *parsed) - } - - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseDeploymentIDInsensitively(input string) (*DeploymentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeploymentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DeploymentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.BatchEndpointName, ok = parsed.Parsed["batchEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchEndpointName", *parsed) + if id.BatchEndpointName, ok = input.Parsed["batchEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "batchEndpointName", input) } - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if id.DeploymentName, ok = input.Parsed["deploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", input) } - return &id, nil + return nil } // ValidateDeploymentID checks that 'input' can be parsed as a Deployment ID diff --git a/resource-manager/machinelearningservices/2022-10-01/batchendpoint/id_batchendpoint.go b/resource-manager/machinelearningservices/2022-10-01/batchendpoint/id_batchendpoint.go index 74d905b4139..b80ac7f9b96 100644 --- a/resource-manager/machinelearningservices/2022-10-01/batchendpoint/id_batchendpoint.go +++ b/resource-manager/machinelearningservices/2022-10-01/batchendpoint/id_batchendpoint.go @@ -38,23 +38,9 @@ func ParseBatchEndpointID(input string) (*BatchEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BatchEndpointId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.BatchEndpointName, ok = parsed.Parsed["batchEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBatchEndpointIDInsensitively(input string) (*BatchEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BatchEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BatchEndpointId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.BatchEndpointName, ok = parsed.Parsed["batchEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchEndpointName", *parsed) + if id.BatchEndpointName, ok = input.Parsed["batchEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "batchEndpointName", input) } - return &id, nil + return nil } // ValidateBatchEndpointID checks that 'input' can be parsed as a Batch Endpoint ID diff --git a/resource-manager/machinelearningservices/2022-10-01/batchendpoint/id_workspace.go b/resource-manager/machinelearningservices/2022-10-01/batchendpoint/id_workspace.go index eb2c67ecd5d..f77478ba59b 100644 --- a/resource-manager/machinelearningservices/2022-10-01/batchendpoint/id_workspace.go +++ b/resource-manager/machinelearningservices/2022-10-01/batchendpoint/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2022-10-01/codecontainer/id_code.go b/resource-manager/machinelearningservices/2022-10-01/codecontainer/id_code.go index a473f62d1ef..9b66f97af38 100644 --- a/resource-manager/machinelearningservices/2022-10-01/codecontainer/id_code.go +++ b/resource-manager/machinelearningservices/2022-10-01/codecontainer/id_code.go @@ -38,23 +38,9 @@ func ParseCodeID(input string) (*CodeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CodeId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.CodeName, ok = parsed.Parsed["codeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "codeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCodeIDInsensitively(input string) (*CodeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CodeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CodeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.CodeName, ok = parsed.Parsed["codeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "codeName", *parsed) + if id.CodeName, ok = input.Parsed["codeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "codeName", input) } - return &id, nil + return nil } // ValidateCodeID checks that 'input' can be parsed as a Code ID diff --git a/resource-manager/machinelearningservices/2022-10-01/codecontainer/id_workspace.go b/resource-manager/machinelearningservices/2022-10-01/codecontainer/id_workspace.go index 608d0f7e0b5..cdacd37c4f8 100644 --- a/resource-manager/machinelearningservices/2022-10-01/codecontainer/id_workspace.go +++ b/resource-manager/machinelearningservices/2022-10-01/codecontainer/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2022-10-01/codeversion/id_code.go b/resource-manager/machinelearningservices/2022-10-01/codeversion/id_code.go index cf69b5b96ac..7e49572e0f5 100644 --- a/resource-manager/machinelearningservices/2022-10-01/codeversion/id_code.go +++ b/resource-manager/machinelearningservices/2022-10-01/codeversion/id_code.go @@ -38,23 +38,9 @@ func ParseCodeID(input string) (*CodeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CodeId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.CodeName, ok = parsed.Parsed["codeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "codeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCodeIDInsensitively(input string) (*CodeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CodeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CodeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.CodeName, ok = parsed.Parsed["codeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "codeName", *parsed) + if id.CodeName, ok = input.Parsed["codeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "codeName", input) } - return &id, nil + return nil } // ValidateCodeID checks that 'input' can be parsed as a Code ID diff --git a/resource-manager/machinelearningservices/2022-10-01/codeversion/id_codeversion.go b/resource-manager/machinelearningservices/2022-10-01/codeversion/id_codeversion.go index d6a502b6b5f..9311b38601a 100644 --- a/resource-manager/machinelearningservices/2022-10-01/codeversion/id_codeversion.go +++ b/resource-manager/machinelearningservices/2022-10-01/codeversion/id_codeversion.go @@ -40,27 +40,9 @@ func ParseCodeVersionID(input string) (*CodeVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CodeVersionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.CodeName, ok = parsed.Parsed["codeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "codeName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseCodeVersionIDInsensitively(input string) (*CodeVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CodeVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *CodeVersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.CodeName, ok = parsed.Parsed["codeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "codeName", *parsed) + if id.CodeName, ok = input.Parsed["codeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "codeName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateCodeVersionID checks that 'input' can be parsed as a Code Version ID diff --git a/resource-manager/machinelearningservices/2022-10-01/componentcontainer/id_component.go b/resource-manager/machinelearningservices/2022-10-01/componentcontainer/id_component.go index a4b869cfb1c..5b09bc73eee 100644 --- a/resource-manager/machinelearningservices/2022-10-01/componentcontainer/id_component.go +++ b/resource-manager/machinelearningservices/2022-10-01/componentcontainer/id_component.go @@ -38,23 +38,9 @@ func ParseComponentID(input string) (*ComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseComponentIDInsensitively(input string) (*ComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ComponentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) } - return &id, nil + return nil } // ValidateComponentID checks that 'input' can be parsed as a Component ID diff --git a/resource-manager/machinelearningservices/2022-10-01/componentcontainer/id_workspace.go b/resource-manager/machinelearningservices/2022-10-01/componentcontainer/id_workspace.go index 2bc7cff6726..5d1410ef408 100644 --- a/resource-manager/machinelearningservices/2022-10-01/componentcontainer/id_workspace.go +++ b/resource-manager/machinelearningservices/2022-10-01/componentcontainer/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2022-10-01/componentversion/id_component.go b/resource-manager/machinelearningservices/2022-10-01/componentversion/id_component.go index f4632d5a6a1..f3f3b99eaa1 100644 --- a/resource-manager/machinelearningservices/2022-10-01/componentversion/id_component.go +++ b/resource-manager/machinelearningservices/2022-10-01/componentversion/id_component.go @@ -38,23 +38,9 @@ func ParseComponentID(input string) (*ComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseComponentIDInsensitively(input string) (*ComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ComponentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) } - return &id, nil + return nil } // ValidateComponentID checks that 'input' can be parsed as a Component ID diff --git a/resource-manager/machinelearningservices/2022-10-01/componentversion/id_componentversion.go b/resource-manager/machinelearningservices/2022-10-01/componentversion/id_componentversion.go index 8e114d7dfe4..cbbb201c9bb 100644 --- a/resource-manager/machinelearningservices/2022-10-01/componentversion/id_componentversion.go +++ b/resource-manager/machinelearningservices/2022-10-01/componentversion/id_componentversion.go @@ -40,27 +40,9 @@ func ParseComponentVersionID(input string) (*ComponentVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentVersionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseComponentVersionIDInsensitively(input string) (*ComponentVersionId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ComponentVersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateComponentVersionID checks that 'input' can be parsed as a Component Version ID diff --git a/resource-manager/machinelearningservices/2022-10-01/datacontainer/id_data.go b/resource-manager/machinelearningservices/2022-10-01/datacontainer/id_data.go index 407f113b851..cbbce13ab8a 100644 --- a/resource-manager/machinelearningservices/2022-10-01/datacontainer/id_data.go +++ b/resource-manager/machinelearningservices/2022-10-01/datacontainer/id_data.go @@ -38,23 +38,9 @@ func ParseDataID(input string) (*DataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.DataName, ok = parsed.Parsed["dataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDataIDInsensitively(input string) (*DataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DataId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.DataName, ok = parsed.Parsed["dataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataName", *parsed) + if id.DataName, ok = input.Parsed["dataName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataName", input) } - return &id, nil + return nil } // ValidateDataID checks that 'input' can be parsed as a Data ID diff --git a/resource-manager/machinelearningservices/2022-10-01/datacontainer/id_workspace.go b/resource-manager/machinelearningservices/2022-10-01/datacontainer/id_workspace.go index 5c6b04e44e5..9939fbf03e9 100644 --- a/resource-manager/machinelearningservices/2022-10-01/datacontainer/id_workspace.go +++ b/resource-manager/machinelearningservices/2022-10-01/datacontainer/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2022-10-01/datastore/id_datastore.go b/resource-manager/machinelearningservices/2022-10-01/datastore/id_datastore.go index ee2428b4235..58fc7a10542 100644 --- a/resource-manager/machinelearningservices/2022-10-01/datastore/id_datastore.go +++ b/resource-manager/machinelearningservices/2022-10-01/datastore/id_datastore.go @@ -38,23 +38,9 @@ func ParseDataStoreID(input string) (*DataStoreId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataStoreId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.DataStoreName, ok = parsed.Parsed["dataStoreName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataStoreName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDataStoreIDInsensitively(input string) (*DataStoreId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataStoreId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DataStoreId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.DataStoreName, ok = parsed.Parsed["dataStoreName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataStoreName", *parsed) + if id.DataStoreName, ok = input.Parsed["dataStoreName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataStoreName", input) } - return &id, nil + return nil } // ValidateDataStoreID checks that 'input' can be parsed as a Data Store ID diff --git a/resource-manager/machinelearningservices/2022-10-01/datastore/id_workspace.go b/resource-manager/machinelearningservices/2022-10-01/datastore/id_workspace.go index b4cddf6dc62..008f9fac5fe 100644 --- a/resource-manager/machinelearningservices/2022-10-01/datastore/id_workspace.go +++ b/resource-manager/machinelearningservices/2022-10-01/datastore/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2022-10-01/dataversion/id_data.go b/resource-manager/machinelearningservices/2022-10-01/dataversion/id_data.go index e4304823691..8ad525d11da 100644 --- a/resource-manager/machinelearningservices/2022-10-01/dataversion/id_data.go +++ b/resource-manager/machinelearningservices/2022-10-01/dataversion/id_data.go @@ -38,23 +38,9 @@ func ParseDataID(input string) (*DataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.DataName, ok = parsed.Parsed["dataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDataIDInsensitively(input string) (*DataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DataId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.DataName, ok = parsed.Parsed["dataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataName", *parsed) + if id.DataName, ok = input.Parsed["dataName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataName", input) } - return &id, nil + return nil } // ValidateDataID checks that 'input' can be parsed as a Data ID diff --git a/resource-manager/machinelearningservices/2022-10-01/dataversion/id_version.go b/resource-manager/machinelearningservices/2022-10-01/dataversion/id_version.go index 744ff421311..af055f9a58b 100644 --- a/resource-manager/machinelearningservices/2022-10-01/dataversion/id_version.go +++ b/resource-manager/machinelearningservices/2022-10-01/dataversion/id_version.go @@ -40,27 +40,9 @@ func ParseVersionID(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.DataName, ok = parsed.Parsed["dataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVersionIDInsensitively(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.DataName, ok = parsed.Parsed["dataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataName", *parsed) + if id.DataName, ok = input.Parsed["dataName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateVersionID checks that 'input' can be parsed as a Version ID diff --git a/resource-manager/machinelearningservices/2022-10-01/environmentcontainer/id_environment.go b/resource-manager/machinelearningservices/2022-10-01/environmentcontainer/id_environment.go index 418572ed464..3c327afa0d6 100644 --- a/resource-manager/machinelearningservices/2022-10-01/environmentcontainer/id_environment.go +++ b/resource-manager/machinelearningservices/2022-10-01/environmentcontainer/id_environment.go @@ -38,23 +38,9 @@ func ParseEnvironmentID(input string) (*EnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseEnvironmentIDInsensitively(input string) (*EnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EnvironmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if id.EnvironmentName, ok = input.Parsed["environmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "environmentName", input) } - return &id, nil + return nil } // ValidateEnvironmentID checks that 'input' can be parsed as a Environment ID diff --git a/resource-manager/machinelearningservices/2022-10-01/environmentcontainer/id_workspace.go b/resource-manager/machinelearningservices/2022-10-01/environmentcontainer/id_workspace.go index 16ed5dfc856..4e121cbdd93 100644 --- a/resource-manager/machinelearningservices/2022-10-01/environmentcontainer/id_workspace.go +++ b/resource-manager/machinelearningservices/2022-10-01/environmentcontainer/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2022-10-01/environmentversion/id_environment.go b/resource-manager/machinelearningservices/2022-10-01/environmentversion/id_environment.go index ad15ca12921..3b5f2b580cc 100644 --- a/resource-manager/machinelearningservices/2022-10-01/environmentversion/id_environment.go +++ b/resource-manager/machinelearningservices/2022-10-01/environmentversion/id_environment.go @@ -38,23 +38,9 @@ func ParseEnvironmentID(input string) (*EnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseEnvironmentIDInsensitively(input string) (*EnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EnvironmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if id.EnvironmentName, ok = input.Parsed["environmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "environmentName", input) } - return &id, nil + return nil } // ValidateEnvironmentID checks that 'input' can be parsed as a Environment ID diff --git a/resource-manager/machinelearningservices/2022-10-01/environmentversion/id_environmentversion.go b/resource-manager/machinelearningservices/2022-10-01/environmentversion/id_environmentversion.go index 73dfc1108f1..880769b0baa 100644 --- a/resource-manager/machinelearningservices/2022-10-01/environmentversion/id_environmentversion.go +++ b/resource-manager/machinelearningservices/2022-10-01/environmentversion/id_environmentversion.go @@ -40,27 +40,9 @@ func ParseEnvironmentVersionID(input string) (*EnvironmentVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentVersionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseEnvironmentVersionIDInsensitively(input string) (*EnvironmentVersionId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *EnvironmentVersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if id.EnvironmentName, ok = input.Parsed["environmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "environmentName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateEnvironmentVersionID checks that 'input' can be parsed as a Environment Version ID diff --git a/resource-manager/machinelearningservices/2022-10-01/job/id_job.go b/resource-manager/machinelearningservices/2022-10-01/job/id_job.go index 78aa3ecfea9..563223eca08 100644 --- a/resource-manager/machinelearningservices/2022-10-01/job/id_job.go +++ b/resource-manager/machinelearningservices/2022-10-01/job/id_job.go @@ -38,23 +38,9 @@ func ParseJobID(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseJobIDInsensitively(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *JobId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - return &id, nil + return nil } // ValidateJobID checks that 'input' can be parsed as a Job ID diff --git a/resource-manager/machinelearningservices/2022-10-01/job/id_workspace.go b/resource-manager/machinelearningservices/2022-10-01/job/id_workspace.go index d3d669da0a3..165bda1d6b0 100644 --- a/resource-manager/machinelearningservices/2022-10-01/job/id_workspace.go +++ b/resource-manager/machinelearningservices/2022-10-01/job/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2022-10-01/machinelearningcomputes/id_compute.go b/resource-manager/machinelearningservices/2022-10-01/machinelearningcomputes/id_compute.go index 18a81277e2a..0a5c48c2b75 100644 --- a/resource-manager/machinelearningservices/2022-10-01/machinelearningcomputes/id_compute.go +++ b/resource-manager/machinelearningservices/2022-10-01/machinelearningcomputes/id_compute.go @@ -38,23 +38,9 @@ func ParseComputeID(input string) (*ComputeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComputeId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ComputeName, ok = parsed.Parsed["computeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "computeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseComputeIDInsensitively(input string) (*ComputeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComputeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ComputeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ComputeName, ok = parsed.Parsed["computeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "computeName", *parsed) + if id.ComputeName, ok = input.Parsed["computeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "computeName", input) } - return &id, nil + return nil } // ValidateComputeID checks that 'input' can be parsed as a Compute ID diff --git a/resource-manager/machinelearningservices/2022-10-01/machinelearningcomputes/id_workspace.go b/resource-manager/machinelearningservices/2022-10-01/machinelearningcomputes/id_workspace.go index 433fbb7591c..97b8f1ce442 100644 --- a/resource-manager/machinelearningservices/2022-10-01/machinelearningcomputes/id_workspace.go +++ b/resource-manager/machinelearningservices/2022-10-01/machinelearningcomputes/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2022-10-01/modelcontainer/id_model.go b/resource-manager/machinelearningservices/2022-10-01/modelcontainer/id_model.go index ba14ca74245..51fa4a9d96b 100644 --- a/resource-manager/machinelearningservices/2022-10-01/modelcontainer/id_model.go +++ b/resource-manager/machinelearningservices/2022-10-01/modelcontainer/id_model.go @@ -38,23 +38,9 @@ func ParseModelID(input string) (*ModelId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModelId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ModelName, ok = parsed.Parsed["modelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "modelName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseModelIDInsensitively(input string) (*ModelId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModelId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ModelId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ModelName, ok = parsed.Parsed["modelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "modelName", *parsed) + if id.ModelName, ok = input.Parsed["modelName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "modelName", input) } - return &id, nil + return nil } // ValidateModelID checks that 'input' can be parsed as a Model ID diff --git a/resource-manager/machinelearningservices/2022-10-01/modelcontainer/id_workspace.go b/resource-manager/machinelearningservices/2022-10-01/modelcontainer/id_workspace.go index bbc169a54bc..3e2ad09c644 100644 --- a/resource-manager/machinelearningservices/2022-10-01/modelcontainer/id_workspace.go +++ b/resource-manager/machinelearningservices/2022-10-01/modelcontainer/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2022-10-01/modelversion/id_model.go b/resource-manager/machinelearningservices/2022-10-01/modelversion/id_model.go index 46520fef955..1ac17714a02 100644 --- a/resource-manager/machinelearningservices/2022-10-01/modelversion/id_model.go +++ b/resource-manager/machinelearningservices/2022-10-01/modelversion/id_model.go @@ -38,23 +38,9 @@ func ParseModelID(input string) (*ModelId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModelId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ModelName, ok = parsed.Parsed["modelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "modelName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseModelIDInsensitively(input string) (*ModelId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModelId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ModelId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ModelName, ok = parsed.Parsed["modelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "modelName", *parsed) + if id.ModelName, ok = input.Parsed["modelName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "modelName", input) } - return &id, nil + return nil } // ValidateModelID checks that 'input' can be parsed as a Model ID diff --git a/resource-manager/machinelearningservices/2022-10-01/modelversion/id_modelversion.go b/resource-manager/machinelearningservices/2022-10-01/modelversion/id_modelversion.go index fa93daf0849..cc122322e68 100644 --- a/resource-manager/machinelearningservices/2022-10-01/modelversion/id_modelversion.go +++ b/resource-manager/machinelearningservices/2022-10-01/modelversion/id_modelversion.go @@ -40,27 +40,9 @@ func ParseModelVersionID(input string) (*ModelVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModelVersionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ModelName, ok = parsed.Parsed["modelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "modelName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseModelVersionIDInsensitively(input string) (*ModelVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModelVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ModelVersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ModelName, ok = parsed.Parsed["modelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "modelName", *parsed) + if id.ModelName, ok = input.Parsed["modelName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "modelName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateModelVersionID checks that 'input' can be parsed as a Model Version ID diff --git a/resource-manager/machinelearningservices/2022-10-01/onlinedeployment/id_onlineendpoint.go b/resource-manager/machinelearningservices/2022-10-01/onlinedeployment/id_onlineendpoint.go index 936f0a50c4b..4c677589ea1 100644 --- a/resource-manager/machinelearningservices/2022-10-01/onlinedeployment/id_onlineendpoint.go +++ b/resource-manager/machinelearningservices/2022-10-01/onlinedeployment/id_onlineendpoint.go @@ -38,23 +38,9 @@ func ParseOnlineEndpointID(input string) (*OnlineEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OnlineEndpointId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.OnlineEndpointName, ok = parsed.Parsed["onlineEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "onlineEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseOnlineEndpointIDInsensitively(input string) (*OnlineEndpointId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OnlineEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OnlineEndpointId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.OnlineEndpointName, ok = parsed.Parsed["onlineEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "onlineEndpointName", *parsed) + if id.OnlineEndpointName, ok = input.Parsed["onlineEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "onlineEndpointName", input) } - return &id, nil + return nil } // ValidateOnlineEndpointID checks that 'input' can be parsed as a Online Endpoint ID diff --git a/resource-manager/machinelearningservices/2022-10-01/onlinedeployment/id_onlineendpointdeployment.go b/resource-manager/machinelearningservices/2022-10-01/onlinedeployment/id_onlineendpointdeployment.go index 9aaeccc9396..2d307a61a3d 100644 --- a/resource-manager/machinelearningservices/2022-10-01/onlinedeployment/id_onlineendpointdeployment.go +++ b/resource-manager/machinelearningservices/2022-10-01/onlinedeployment/id_onlineendpointdeployment.go @@ -40,27 +40,9 @@ func ParseOnlineEndpointDeploymentID(input string) (*OnlineEndpointDeploymentId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OnlineEndpointDeploymentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.OnlineEndpointName, ok = parsed.Parsed["onlineEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "onlineEndpointName", *parsed) - } - - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseOnlineEndpointDeploymentIDInsensitively(input string) (*OnlineEndpoint return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OnlineEndpointDeploymentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *OnlineEndpointDeploymentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.OnlineEndpointName, ok = parsed.Parsed["onlineEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "onlineEndpointName", *parsed) + if id.OnlineEndpointName, ok = input.Parsed["onlineEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "onlineEndpointName", input) } - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if id.DeploymentName, ok = input.Parsed["deploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", input) } - return &id, nil + return nil } // ValidateOnlineEndpointDeploymentID checks that 'input' can be parsed as a Online Endpoint Deployment ID diff --git a/resource-manager/machinelearningservices/2022-10-01/onlineendpoint/id_onlineendpoint.go b/resource-manager/machinelearningservices/2022-10-01/onlineendpoint/id_onlineendpoint.go index 6c5c1518e8e..f258feb0620 100644 --- a/resource-manager/machinelearningservices/2022-10-01/onlineendpoint/id_onlineendpoint.go +++ b/resource-manager/machinelearningservices/2022-10-01/onlineendpoint/id_onlineendpoint.go @@ -38,23 +38,9 @@ func ParseOnlineEndpointID(input string) (*OnlineEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OnlineEndpointId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.OnlineEndpointName, ok = parsed.Parsed["onlineEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "onlineEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseOnlineEndpointIDInsensitively(input string) (*OnlineEndpointId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OnlineEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OnlineEndpointId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.OnlineEndpointName, ok = parsed.Parsed["onlineEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "onlineEndpointName", *parsed) + if id.OnlineEndpointName, ok = input.Parsed["onlineEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "onlineEndpointName", input) } - return &id, nil + return nil } // ValidateOnlineEndpointID checks that 'input' can be parsed as a Online Endpoint ID diff --git a/resource-manager/machinelearningservices/2022-10-01/onlineendpoint/id_workspace.go b/resource-manager/machinelearningservices/2022-10-01/onlineendpoint/id_workspace.go index 91faec139dc..1a4a0f46e0b 100644 --- a/resource-manager/machinelearningservices/2022-10-01/onlineendpoint/id_workspace.go +++ b/resource-manager/machinelearningservices/2022-10-01/onlineendpoint/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2022-10-01/operationalizationclusters/id_compute.go b/resource-manager/machinelearningservices/2022-10-01/operationalizationclusters/id_compute.go index e793df52d8b..de3a0b9b0ac 100644 --- a/resource-manager/machinelearningservices/2022-10-01/operationalizationclusters/id_compute.go +++ b/resource-manager/machinelearningservices/2022-10-01/operationalizationclusters/id_compute.go @@ -38,23 +38,9 @@ func ParseComputeID(input string) (*ComputeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComputeId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ComputeName, ok = parsed.Parsed["computeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "computeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseComputeIDInsensitively(input string) (*ComputeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComputeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ComputeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ComputeName, ok = parsed.Parsed["computeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "computeName", *parsed) + if id.ComputeName, ok = input.Parsed["computeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "computeName", input) } - return &id, nil + return nil } // ValidateComputeID checks that 'input' can be parsed as a Compute ID diff --git a/resource-manager/machinelearningservices/2022-10-01/operationalizationclusters/id_workspace.go b/resource-manager/machinelearningservices/2022-10-01/operationalizationclusters/id_workspace.go index 45ab1f8a7dd..856c1bd01eb 100644 --- a/resource-manager/machinelearningservices/2022-10-01/operationalizationclusters/id_workspace.go +++ b/resource-manager/machinelearningservices/2022-10-01/operationalizationclusters/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2022-10-01/outboundnetworkdependenciesendpoints/id_workspace.go b/resource-manager/machinelearningservices/2022-10-01/outboundnetworkdependenciesendpoints/id_workspace.go index f2100fe9487..009611da59e 100644 --- a/resource-manager/machinelearningservices/2022-10-01/outboundnetworkdependenciesendpoints/id_workspace.go +++ b/resource-manager/machinelearningservices/2022-10-01/outboundnetworkdependenciesendpoints/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2022-10-01/privateendpointconnections/id_workspace.go b/resource-manager/machinelearningservices/2022-10-01/privateendpointconnections/id_workspace.go index 8a826c3113b..da4a60605e1 100644 --- a/resource-manager/machinelearningservices/2022-10-01/privateendpointconnections/id_workspace.go +++ b/resource-manager/machinelearningservices/2022-10-01/privateendpointconnections/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2022-10-01/proxyoperations/id_workspace.go b/resource-manager/machinelearningservices/2022-10-01/proxyoperations/id_workspace.go index d0a1746d097..41efeaaa051 100644 --- a/resource-manager/machinelearningservices/2022-10-01/proxyoperations/id_workspace.go +++ b/resource-manager/machinelearningservices/2022-10-01/proxyoperations/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2022-10-01/quota/id_location.go b/resource-manager/machinelearningservices/2022-10-01/quota/id_location.go index 40067b81ab7..f7b04cfd405 100644 --- a/resource-manager/machinelearningservices/2022-10-01/quota/id_location.go +++ b/resource-manager/machinelearningservices/2022-10-01/quota/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/machinelearningservices/2022-10-01/schedule/id_schedule.go b/resource-manager/machinelearningservices/2022-10-01/schedule/id_schedule.go index 8d367d00b21..4eb871cac1c 100644 --- a/resource-manager/machinelearningservices/2022-10-01/schedule/id_schedule.go +++ b/resource-manager/machinelearningservices/2022-10-01/schedule/id_schedule.go @@ -38,23 +38,9 @@ func ParseScheduleID(input string) (*ScheduleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScheduleId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ScheduleName, ok = parsed.Parsed["scheduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseScheduleIDInsensitively(input string) (*ScheduleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScheduleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ScheduleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ScheduleName, ok = parsed.Parsed["scheduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", *parsed) + if id.ScheduleName, ok = input.Parsed["scheduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", input) } - return &id, nil + return nil } // ValidateScheduleID checks that 'input' can be parsed as a Schedule ID diff --git a/resource-manager/machinelearningservices/2022-10-01/schedule/id_workspace.go b/resource-manager/machinelearningservices/2022-10-01/schedule/id_workspace.go index d96ff4474fd..c8222a7ca8e 100644 --- a/resource-manager/machinelearningservices/2022-10-01/schedule/id_workspace.go +++ b/resource-manager/machinelearningservices/2022-10-01/schedule/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2022-10-01/v2workspaceconnectionresource/id_connection.go b/resource-manager/machinelearningservices/2022-10-01/v2workspaceconnectionresource/id_connection.go index a0b502452b4..b9a5e5d30c4 100644 --- a/resource-manager/machinelearningservices/2022-10-01/v2workspaceconnectionresource/id_connection.go +++ b/resource-manager/machinelearningservices/2022-10-01/v2workspaceconnectionresource/id_connection.go @@ -38,23 +38,9 @@ func ParseConnectionID(input string) (*ConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ConnectionName, ok = parsed.Parsed["connectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConnectionIDInsensitively(input string) (*ConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ConnectionName, ok = parsed.Parsed["connectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionName", *parsed) + if id.ConnectionName, ok = input.Parsed["connectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectionName", input) } - return &id, nil + return nil } // ValidateConnectionID checks that 'input' can be parsed as a Connection ID diff --git a/resource-manager/machinelearningservices/2022-10-01/v2workspaceconnectionresource/id_workspace.go b/resource-manager/machinelearningservices/2022-10-01/v2workspaceconnectionresource/id_workspace.go index 4883dc4d002..81abcff93a9 100644 --- a/resource-manager/machinelearningservices/2022-10-01/v2workspaceconnectionresource/id_workspace.go +++ b/resource-manager/machinelearningservices/2022-10-01/v2workspaceconnectionresource/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2022-10-01/virtualmachinesizes/id_location.go b/resource-manager/machinelearningservices/2022-10-01/virtualmachinesizes/id_location.go index 5b66f44c4f7..d887c2fb51f 100644 --- a/resource-manager/machinelearningservices/2022-10-01/virtualmachinesizes/id_location.go +++ b/resource-manager/machinelearningservices/2022-10-01/virtualmachinesizes/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/machinelearningservices/2022-10-01/workspaceprivateendpointconnections/id_privateendpointconnection.go b/resource-manager/machinelearningservices/2022-10-01/workspaceprivateendpointconnections/id_privateendpointconnection.go index e919def8163..3b6dfbac90e 100644 --- a/resource-manager/machinelearningservices/2022-10-01/workspaceprivateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/machinelearningservices/2022-10-01/workspaceprivateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/machinelearningservices/2022-10-01/workspaceprivatelinkresources/id_workspace.go b/resource-manager/machinelearningservices/2022-10-01/workspaceprivatelinkresources/id_workspace.go index 899fa30b3b8..5297b76da47 100644 --- a/resource-manager/machinelearningservices/2022-10-01/workspaceprivatelinkresources/id_workspace.go +++ b/resource-manager/machinelearningservices/2022-10-01/workspaceprivatelinkresources/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2022-10-01/workspaces/id_workspace.go b/resource-manager/machinelearningservices/2022-10-01/workspaces/id_workspace.go index c37f08503e2..42b6e9c9d8a 100644 --- a/resource-manager/machinelearningservices/2022-10-01/workspaces/id_workspace.go +++ b/resource-manager/machinelearningservices/2022-10-01/workspaces/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/batchdeployment/id_batchendpoint.go b/resource-manager/machinelearningservices/2023-04-01-preview/batchdeployment/id_batchendpoint.go index f6c57ae42f6..4994081e112 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/batchdeployment/id_batchendpoint.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/batchdeployment/id_batchendpoint.go @@ -38,23 +38,9 @@ func ParseBatchEndpointID(input string) (*BatchEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BatchEndpointId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.BatchEndpointName, ok = parsed.Parsed["batchEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBatchEndpointIDInsensitively(input string) (*BatchEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BatchEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BatchEndpointId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.BatchEndpointName, ok = parsed.Parsed["batchEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchEndpointName", *parsed) + if id.BatchEndpointName, ok = input.Parsed["batchEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "batchEndpointName", input) } - return &id, nil + return nil } // ValidateBatchEndpointID checks that 'input' can be parsed as a Batch Endpoint ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/batchdeployment/id_deployment.go b/resource-manager/machinelearningservices/2023-04-01-preview/batchdeployment/id_deployment.go index 03fd9c38ff1..e424729f1e7 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/batchdeployment/id_deployment.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/batchdeployment/id_deployment.go @@ -40,27 +40,9 @@ func ParseDeploymentID(input string) (*DeploymentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeploymentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.BatchEndpointName, ok = parsed.Parsed["batchEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchEndpointName", *parsed) - } - - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseDeploymentIDInsensitively(input string) (*DeploymentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeploymentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DeploymentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.BatchEndpointName, ok = parsed.Parsed["batchEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchEndpointName", *parsed) + if id.BatchEndpointName, ok = input.Parsed["batchEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "batchEndpointName", input) } - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if id.DeploymentName, ok = input.Parsed["deploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", input) } - return &id, nil + return nil } // ValidateDeploymentID checks that 'input' can be parsed as a Deployment ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/batchendpoint/id_batchendpoint.go b/resource-manager/machinelearningservices/2023-04-01-preview/batchendpoint/id_batchendpoint.go index 74d905b4139..b80ac7f9b96 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/batchendpoint/id_batchendpoint.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/batchendpoint/id_batchendpoint.go @@ -38,23 +38,9 @@ func ParseBatchEndpointID(input string) (*BatchEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BatchEndpointId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.BatchEndpointName, ok = parsed.Parsed["batchEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBatchEndpointIDInsensitively(input string) (*BatchEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BatchEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BatchEndpointId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.BatchEndpointName, ok = parsed.Parsed["batchEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchEndpointName", *parsed) + if id.BatchEndpointName, ok = input.Parsed["batchEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "batchEndpointName", input) } - return &id, nil + return nil } // ValidateBatchEndpointID checks that 'input' can be parsed as a Batch Endpoint ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/batchendpoint/id_workspace.go b/resource-manager/machinelearningservices/2023-04-01-preview/batchendpoint/id_workspace.go index eb2c67ecd5d..f77478ba59b 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/batchendpoint/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/batchendpoint/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/codecontainer/id_code.go b/resource-manager/machinelearningservices/2023-04-01-preview/codecontainer/id_code.go index a473f62d1ef..9b66f97af38 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/codecontainer/id_code.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/codecontainer/id_code.go @@ -38,23 +38,9 @@ func ParseCodeID(input string) (*CodeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CodeId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.CodeName, ok = parsed.Parsed["codeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "codeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCodeIDInsensitively(input string) (*CodeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CodeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CodeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.CodeName, ok = parsed.Parsed["codeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "codeName", *parsed) + if id.CodeName, ok = input.Parsed["codeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "codeName", input) } - return &id, nil + return nil } // ValidateCodeID checks that 'input' can be parsed as a Code ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/codecontainer/id_registry.go b/resource-manager/machinelearningservices/2023-04-01-preview/codecontainer/id_registry.go index 982facd0d25..e2f64413cee 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/codecontainer/id_registry.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/codecontainer/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/codecontainer/id_registrycode.go b/resource-manager/machinelearningservices/2023-04-01-preview/codecontainer/id_registrycode.go index 2b6961de6e4..6c053fed358 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/codecontainer/id_registrycode.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/codecontainer/id_registrycode.go @@ -38,23 +38,9 @@ func ParseRegistryCodeID(input string) (*RegistryCodeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryCodeId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.CodeName, ok = parsed.Parsed["codeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "codeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRegistryCodeIDInsensitively(input string) (*RegistryCodeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryCodeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RegistryCodeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.CodeName, ok = parsed.Parsed["codeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "codeName", *parsed) + if id.CodeName, ok = input.Parsed["codeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "codeName", input) } - return &id, nil + return nil } // ValidateRegistryCodeID checks that 'input' can be parsed as a Registry Code ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/codecontainer/id_workspace.go b/resource-manager/machinelearningservices/2023-04-01-preview/codecontainer/id_workspace.go index 608d0f7e0b5..cdacd37c4f8 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/codecontainer/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/codecontainer/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/codeversion/id_code.go b/resource-manager/machinelearningservices/2023-04-01-preview/codeversion/id_code.go index cf69b5b96ac..7e49572e0f5 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/codeversion/id_code.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/codeversion/id_code.go @@ -38,23 +38,9 @@ func ParseCodeID(input string) (*CodeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CodeId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.CodeName, ok = parsed.Parsed["codeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "codeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCodeIDInsensitively(input string) (*CodeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CodeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CodeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.CodeName, ok = parsed.Parsed["codeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "codeName", *parsed) + if id.CodeName, ok = input.Parsed["codeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "codeName", input) } - return &id, nil + return nil } // ValidateCodeID checks that 'input' can be parsed as a Code ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/codeversion/id_codeversion.go b/resource-manager/machinelearningservices/2023-04-01-preview/codeversion/id_codeversion.go index d6a502b6b5f..9311b38601a 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/codeversion/id_codeversion.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/codeversion/id_codeversion.go @@ -40,27 +40,9 @@ func ParseCodeVersionID(input string) (*CodeVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CodeVersionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.CodeName, ok = parsed.Parsed["codeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "codeName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseCodeVersionIDInsensitively(input string) (*CodeVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CodeVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *CodeVersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.CodeName, ok = parsed.Parsed["codeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "codeName", *parsed) + if id.CodeName, ok = input.Parsed["codeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "codeName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateCodeVersionID checks that 'input' can be parsed as a Code Version ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/codeversion/id_registrycode.go b/resource-manager/machinelearningservices/2023-04-01-preview/codeversion/id_registrycode.go index 66b26629270..1edce9291c9 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/codeversion/id_registrycode.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/codeversion/id_registrycode.go @@ -38,23 +38,9 @@ func ParseRegistryCodeID(input string) (*RegistryCodeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryCodeId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.CodeName, ok = parsed.Parsed["codeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "codeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRegistryCodeIDInsensitively(input string) (*RegistryCodeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryCodeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RegistryCodeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.CodeName, ok = parsed.Parsed["codeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "codeName", *parsed) + if id.CodeName, ok = input.Parsed["codeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "codeName", input) } - return &id, nil + return nil } // ValidateRegistryCodeID checks that 'input' can be parsed as a Registry Code ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/codeversion/id_registrycodeversion.go b/resource-manager/machinelearningservices/2023-04-01-preview/codeversion/id_registrycodeversion.go index ca9e06364bb..ab4a6a73bd5 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/codeversion/id_registrycodeversion.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/codeversion/id_registrycodeversion.go @@ -40,27 +40,9 @@ func ParseRegistryCodeVersionID(input string) (*RegistryCodeVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryCodeVersionId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.CodeName, ok = parsed.Parsed["codeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "codeName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseRegistryCodeVersionIDInsensitively(input string) (*RegistryCodeVersion return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryCodeVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RegistryCodeVersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.CodeName, ok = parsed.Parsed["codeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "codeName", *parsed) + if id.CodeName, ok = input.Parsed["codeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "codeName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateRegistryCodeVersionID checks that 'input' can be parsed as a Registry Code Version ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/componentcontainer/id_component.go b/resource-manager/machinelearningservices/2023-04-01-preview/componentcontainer/id_component.go index a4b869cfb1c..5b09bc73eee 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/componentcontainer/id_component.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/componentcontainer/id_component.go @@ -38,23 +38,9 @@ func ParseComponentID(input string) (*ComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseComponentIDInsensitively(input string) (*ComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ComponentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) } - return &id, nil + return nil } // ValidateComponentID checks that 'input' can be parsed as a Component ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/componentcontainer/id_registry.go b/resource-manager/machinelearningservices/2023-04-01-preview/componentcontainer/id_registry.go index 33b6af07f84..6d60f63cfd5 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/componentcontainer/id_registry.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/componentcontainer/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/componentcontainer/id_registrycomponent.go b/resource-manager/machinelearningservices/2023-04-01-preview/componentcontainer/id_registrycomponent.go index e4a9064fc32..0b1d043a826 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/componentcontainer/id_registrycomponent.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/componentcontainer/id_registrycomponent.go @@ -38,23 +38,9 @@ func ParseRegistryComponentID(input string) (*RegistryComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryComponentId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRegistryComponentIDInsensitively(input string) (*RegistryComponentId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryComponentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RegistryComponentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) } - return &id, nil + return nil } // ValidateRegistryComponentID checks that 'input' can be parsed as a Registry Component ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/componentcontainer/id_workspace.go b/resource-manager/machinelearningservices/2023-04-01-preview/componentcontainer/id_workspace.go index 2bc7cff6726..5d1410ef408 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/componentcontainer/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/componentcontainer/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/componentversion/id_component.go b/resource-manager/machinelearningservices/2023-04-01-preview/componentversion/id_component.go index f4632d5a6a1..f3f3b99eaa1 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/componentversion/id_component.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/componentversion/id_component.go @@ -38,23 +38,9 @@ func ParseComponentID(input string) (*ComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseComponentIDInsensitively(input string) (*ComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ComponentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) } - return &id, nil + return nil } // ValidateComponentID checks that 'input' can be parsed as a Component ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/componentversion/id_componentversion.go b/resource-manager/machinelearningservices/2023-04-01-preview/componentversion/id_componentversion.go index 8e114d7dfe4..cbbb201c9bb 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/componentversion/id_componentversion.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/componentversion/id_componentversion.go @@ -40,27 +40,9 @@ func ParseComponentVersionID(input string) (*ComponentVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentVersionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseComponentVersionIDInsensitively(input string) (*ComponentVersionId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ComponentVersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateComponentVersionID checks that 'input' can be parsed as a Component Version ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/componentversion/id_registrycomponent.go b/resource-manager/machinelearningservices/2023-04-01-preview/componentversion/id_registrycomponent.go index bb4657b70db..5fb1de1a8fc 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/componentversion/id_registrycomponent.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/componentversion/id_registrycomponent.go @@ -38,23 +38,9 @@ func ParseRegistryComponentID(input string) (*RegistryComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryComponentId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRegistryComponentIDInsensitively(input string) (*RegistryComponentId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryComponentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RegistryComponentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) } - return &id, nil + return nil } // ValidateRegistryComponentID checks that 'input' can be parsed as a Registry Component ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/componentversion/id_registrycomponentversion.go b/resource-manager/machinelearningservices/2023-04-01-preview/componentversion/id_registrycomponentversion.go index 2e445a443ab..0493925fc49 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/componentversion/id_registrycomponentversion.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/componentversion/id_registrycomponentversion.go @@ -40,27 +40,9 @@ func ParseRegistryComponentVersionID(input string) (*RegistryComponentVersionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryComponentVersionId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseRegistryComponentVersionIDInsensitively(input string) (*RegistryCompon return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryComponentVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RegistryComponentVersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateRegistryComponentVersionID checks that 'input' can be parsed as a Registry Component Version ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/datacontainer/id_workspace.go b/resource-manager/machinelearningservices/2023-04-01-preview/datacontainer/id_workspace.go index 5c6b04e44e5..9939fbf03e9 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/datacontainer/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/datacontainer/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/datacontainer/id_workspacedata.go b/resource-manager/machinelearningservices/2023-04-01-preview/datacontainer/id_workspacedata.go index 7025008b9a8..aa700a53555 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/datacontainer/id_workspacedata.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/datacontainer/id_workspacedata.go @@ -38,23 +38,9 @@ func ParseWorkspaceDataID(input string) (*WorkspaceDataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceDataId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.DataName, ok = parsed.Parsed["dataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWorkspaceDataIDInsensitively(input string) (*WorkspaceDataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceDataId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WorkspaceDataId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.DataName, ok = parsed.Parsed["dataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataName", *parsed) + if id.DataName, ok = input.Parsed["dataName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataName", input) } - return &id, nil + return nil } // ValidateWorkspaceDataID checks that 'input' can be parsed as a Workspace Data ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/datacontainerregistry/id_data.go b/resource-manager/machinelearningservices/2023-04-01-preview/datacontainerregistry/id_data.go index 4f9d77f22e4..88d291a6ed5 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/datacontainerregistry/id_data.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/datacontainerregistry/id_data.go @@ -38,23 +38,9 @@ func ParseDataID(input string) (*DataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.DataName, ok = parsed.Parsed["dataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDataIDInsensitively(input string) (*DataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DataId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.DataName, ok = parsed.Parsed["dataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataName", *parsed) + if id.DataName, ok = input.Parsed["dataName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataName", input) } - return &id, nil + return nil } // ValidateDataID checks that 'input' can be parsed as a Data ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/datacontainerregistry/id_registry.go b/resource-manager/machinelearningservices/2023-04-01-preview/datacontainerregistry/id_registry.go index cfd75714c2e..9bbb8b258f2 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/datacontainerregistry/id_registry.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/datacontainerregistry/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/datastore/id_datastore.go b/resource-manager/machinelearningservices/2023-04-01-preview/datastore/id_datastore.go index ee2428b4235..58fc7a10542 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/datastore/id_datastore.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/datastore/id_datastore.go @@ -38,23 +38,9 @@ func ParseDataStoreID(input string) (*DataStoreId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataStoreId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.DataStoreName, ok = parsed.Parsed["dataStoreName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataStoreName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDataStoreIDInsensitively(input string) (*DataStoreId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataStoreId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DataStoreId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.DataStoreName, ok = parsed.Parsed["dataStoreName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataStoreName", *parsed) + if id.DataStoreName, ok = input.Parsed["dataStoreName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataStoreName", input) } - return &id, nil + return nil } // ValidateDataStoreID checks that 'input' can be parsed as a Data Store ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/datastore/id_workspace.go b/resource-manager/machinelearningservices/2023-04-01-preview/datastore/id_workspace.go index b4cddf6dc62..008f9fac5fe 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/datastore/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/datastore/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/dataversion/id_dataversion.go b/resource-manager/machinelearningservices/2023-04-01-preview/dataversion/id_dataversion.go index cb2b1bf7d24..1e1a8c94823 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/dataversion/id_dataversion.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/dataversion/id_dataversion.go @@ -40,27 +40,9 @@ func ParseDataVersionID(input string) (*DataVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataVersionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.DataName, ok = parsed.Parsed["dataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseDataVersionIDInsensitively(input string) (*DataVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DataVersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.DataName, ok = parsed.Parsed["dataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataName", *parsed) + if id.DataName, ok = input.Parsed["dataName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateDataVersionID checks that 'input' can be parsed as a Data Version ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/dataversion/id_workspacedata.go b/resource-manager/machinelearningservices/2023-04-01-preview/dataversion/id_workspacedata.go index 23b7e36b2c0..b71830f429c 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/dataversion/id_workspacedata.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/dataversion/id_workspacedata.go @@ -38,23 +38,9 @@ func ParseWorkspaceDataID(input string) (*WorkspaceDataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceDataId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.DataName, ok = parsed.Parsed["dataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWorkspaceDataIDInsensitively(input string) (*WorkspaceDataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceDataId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WorkspaceDataId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.DataName, ok = parsed.Parsed["dataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataName", *parsed) + if id.DataName, ok = input.Parsed["dataName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataName", input) } - return &id, nil + return nil } // ValidateWorkspaceDataID checks that 'input' can be parsed as a Workspace Data ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/dataversionregistry/id_data.go b/resource-manager/machinelearningservices/2023-04-01-preview/dataversionregistry/id_data.go index 7f37bfb07eb..3e37746b0a7 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/dataversionregistry/id_data.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/dataversionregistry/id_data.go @@ -38,23 +38,9 @@ func ParseDataID(input string) (*DataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.DataName, ok = parsed.Parsed["dataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDataIDInsensitively(input string) (*DataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DataId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.DataName, ok = parsed.Parsed["dataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataName", *parsed) + if id.DataName, ok = input.Parsed["dataName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataName", input) } - return &id, nil + return nil } // ValidateDataID checks that 'input' can be parsed as a Data ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/dataversionregistry/id_version.go b/resource-manager/machinelearningservices/2023-04-01-preview/dataversionregistry/id_version.go index 56e33ffcb5e..c1f5119c271 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/dataversionregistry/id_version.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/dataversionregistry/id_version.go @@ -40,27 +40,9 @@ func ParseVersionID(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.DataName, ok = parsed.Parsed["dataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVersionIDInsensitively(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.DataName, ok = parsed.Parsed["dataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataName", *parsed) + if id.DataName, ok = input.Parsed["dataName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateVersionID checks that 'input' can be parsed as a Version ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/environmentcontainer/id_environment.go b/resource-manager/machinelearningservices/2023-04-01-preview/environmentcontainer/id_environment.go index 418572ed464..3c327afa0d6 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/environmentcontainer/id_environment.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/environmentcontainer/id_environment.go @@ -38,23 +38,9 @@ func ParseEnvironmentID(input string) (*EnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseEnvironmentIDInsensitively(input string) (*EnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EnvironmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if id.EnvironmentName, ok = input.Parsed["environmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "environmentName", input) } - return &id, nil + return nil } // ValidateEnvironmentID checks that 'input' can be parsed as a Environment ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/environmentcontainer/id_registry.go b/resource-manager/machinelearningservices/2023-04-01-preview/environmentcontainer/id_registry.go index 742cd182aa9..cf5cb218fc7 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/environmentcontainer/id_registry.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/environmentcontainer/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/environmentcontainer/id_registryenvironment.go b/resource-manager/machinelearningservices/2023-04-01-preview/environmentcontainer/id_registryenvironment.go index 26cb4953263..3cbab92e1f9 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/environmentcontainer/id_registryenvironment.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/environmentcontainer/id_registryenvironment.go @@ -38,23 +38,9 @@ func ParseRegistryEnvironmentID(input string) (*RegistryEnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryEnvironmentId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRegistryEnvironmentIDInsensitively(input string) (*RegistryEnvironment return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryEnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RegistryEnvironmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if id.EnvironmentName, ok = input.Parsed["environmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "environmentName", input) } - return &id, nil + return nil } // ValidateRegistryEnvironmentID checks that 'input' can be parsed as a Registry Environment ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/environmentcontainer/id_workspace.go b/resource-manager/machinelearningservices/2023-04-01-preview/environmentcontainer/id_workspace.go index 16ed5dfc856..4e121cbdd93 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/environmentcontainer/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/environmentcontainer/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/environmentversion/id_environment.go b/resource-manager/machinelearningservices/2023-04-01-preview/environmentversion/id_environment.go index ad15ca12921..3b5f2b580cc 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/environmentversion/id_environment.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/environmentversion/id_environment.go @@ -38,23 +38,9 @@ func ParseEnvironmentID(input string) (*EnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseEnvironmentIDInsensitively(input string) (*EnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EnvironmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if id.EnvironmentName, ok = input.Parsed["environmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "environmentName", input) } - return &id, nil + return nil } // ValidateEnvironmentID checks that 'input' can be parsed as a Environment ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/environmentversion/id_environmentversion.go b/resource-manager/machinelearningservices/2023-04-01-preview/environmentversion/id_environmentversion.go index 73dfc1108f1..880769b0baa 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/environmentversion/id_environmentversion.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/environmentversion/id_environmentversion.go @@ -40,27 +40,9 @@ func ParseEnvironmentVersionID(input string) (*EnvironmentVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentVersionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseEnvironmentVersionIDInsensitively(input string) (*EnvironmentVersionId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *EnvironmentVersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if id.EnvironmentName, ok = input.Parsed["environmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "environmentName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateEnvironmentVersionID checks that 'input' can be parsed as a Environment Version ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/environmentversion/id_registryenvironment.go b/resource-manager/machinelearningservices/2023-04-01-preview/environmentversion/id_registryenvironment.go index 5016ca1690e..53306c13dd1 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/environmentversion/id_registryenvironment.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/environmentversion/id_registryenvironment.go @@ -38,23 +38,9 @@ func ParseRegistryEnvironmentID(input string) (*RegistryEnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryEnvironmentId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRegistryEnvironmentIDInsensitively(input string) (*RegistryEnvironment return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryEnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RegistryEnvironmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if id.EnvironmentName, ok = input.Parsed["environmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "environmentName", input) } - return &id, nil + return nil } // ValidateRegistryEnvironmentID checks that 'input' can be parsed as a Registry Environment ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/environmentversion/id_registryenvironmentversion.go b/resource-manager/machinelearningservices/2023-04-01-preview/environmentversion/id_registryenvironmentversion.go index 1c60c9dcf82..1fd80a2986f 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/environmentversion/id_registryenvironmentversion.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/environmentversion/id_registryenvironmentversion.go @@ -40,27 +40,9 @@ func ParseRegistryEnvironmentVersionID(input string) (*RegistryEnvironmentVersio return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryEnvironmentVersionId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseRegistryEnvironmentVersionIDInsensitively(input string) (*RegistryEnvi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryEnvironmentVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RegistryEnvironmentVersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if id.EnvironmentName, ok = input.Parsed["environmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "environmentName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateRegistryEnvironmentVersionID checks that 'input' can be parsed as a Registry Environment Version ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/feature/id_feature.go b/resource-manager/machinelearningservices/2023-04-01-preview/feature/id_feature.go index 23fd4a8aaea..9199154f615 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/feature/id_feature.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/feature/id_feature.go @@ -42,31 +42,9 @@ func ParseFeatureID(input string) (*FeatureId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FeatureId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.FeatureSetName, ok = parsed.Parsed["featureSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "featureSetName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) - } - - if id.FeatureName, ok = parsed.Parsed["featureName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "featureName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseFeatureIDInsensitively(input string) (*FeatureId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FeatureId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FeatureId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.FeatureSetName, ok = parsed.Parsed["featureSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "featureSetName", *parsed) + if id.FeatureSetName, ok = input.Parsed["featureSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "featureSetName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - if id.FeatureName, ok = parsed.Parsed["featureName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "featureName", *parsed) + if id.FeatureName, ok = input.Parsed["featureName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "featureName", input) } - return &id, nil + return nil } // ValidateFeatureID checks that 'input' can be parsed as a Feature ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/feature/id_featuresetversion.go b/resource-manager/machinelearningservices/2023-04-01-preview/feature/id_featuresetversion.go index ea57e7f8d7a..fbceeea9e16 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/feature/id_featuresetversion.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/feature/id_featuresetversion.go @@ -40,27 +40,9 @@ func ParseFeatureSetVersionID(input string) (*FeatureSetVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FeatureSetVersionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.FeatureSetName, ok = parsed.Parsed["featureSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "featureSetName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseFeatureSetVersionIDInsensitively(input string) (*FeatureSetVersionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FeatureSetVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *FeatureSetVersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.FeatureSetName, ok = parsed.Parsed["featureSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "featureSetName", *parsed) + if id.FeatureSetName, ok = input.Parsed["featureSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "featureSetName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateFeatureSetVersionID checks that 'input' can be parsed as a Feature Set Version ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/featuresetcontainer/id_featureset.go b/resource-manager/machinelearningservices/2023-04-01-preview/featuresetcontainer/id_featureset.go index 7267252446b..84fd34706c4 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/featuresetcontainer/id_featureset.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/featuresetcontainer/id_featureset.go @@ -38,23 +38,9 @@ func ParseFeatureSetID(input string) (*FeatureSetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FeatureSetId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.FeatureSetName, ok = parsed.Parsed["featureSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "featureSetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFeatureSetIDInsensitively(input string) (*FeatureSetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FeatureSetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FeatureSetId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.FeatureSetName, ok = parsed.Parsed["featureSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "featureSetName", *parsed) + if id.FeatureSetName, ok = input.Parsed["featureSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "featureSetName", input) } - return &id, nil + return nil } // ValidateFeatureSetID checks that 'input' can be parsed as a Feature Set ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/featuresetcontainer/id_workspace.go b/resource-manager/machinelearningservices/2023-04-01-preview/featuresetcontainer/id_workspace.go index cc8eda06a66..132e34df3cb 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/featuresetcontainer/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/featuresetcontainer/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/featuresetversion/id_featureset.go b/resource-manager/machinelearningservices/2023-04-01-preview/featuresetversion/id_featureset.go index bb9b9f59c14..f96d46dded5 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/featuresetversion/id_featureset.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/featuresetversion/id_featureset.go @@ -38,23 +38,9 @@ func ParseFeatureSetID(input string) (*FeatureSetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FeatureSetId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.FeatureSetName, ok = parsed.Parsed["featureSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "featureSetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFeatureSetIDInsensitively(input string) (*FeatureSetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FeatureSetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FeatureSetId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.FeatureSetName, ok = parsed.Parsed["featureSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "featureSetName", *parsed) + if id.FeatureSetName, ok = input.Parsed["featureSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "featureSetName", input) } - return &id, nil + return nil } // ValidateFeatureSetID checks that 'input' can be parsed as a Feature Set ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/featuresetversion/id_featuresetversion.go b/resource-manager/machinelearningservices/2023-04-01-preview/featuresetversion/id_featuresetversion.go index 51049976166..f61ab4f0ec7 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/featuresetversion/id_featuresetversion.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/featuresetversion/id_featuresetversion.go @@ -40,27 +40,9 @@ func ParseFeatureSetVersionID(input string) (*FeatureSetVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FeatureSetVersionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.FeatureSetName, ok = parsed.Parsed["featureSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "featureSetName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseFeatureSetVersionIDInsensitively(input string) (*FeatureSetVersionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FeatureSetVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *FeatureSetVersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.FeatureSetName, ok = parsed.Parsed["featureSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "featureSetName", *parsed) + if id.FeatureSetName, ok = input.Parsed["featureSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "featureSetName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateFeatureSetVersionID checks that 'input' can be parsed as a Feature Set Version ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/featurestoreentitycontainer/id_featurestoreentity.go b/resource-manager/machinelearningservices/2023-04-01-preview/featurestoreentitycontainer/id_featurestoreentity.go index 36795761ba8..b2554ec5c56 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/featurestoreentitycontainer/id_featurestoreentity.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/featurestoreentitycontainer/id_featurestoreentity.go @@ -38,23 +38,9 @@ func ParseFeatureStoreEntityID(input string) (*FeatureStoreEntityId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FeatureStoreEntityId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.FeatureStoreEntityName, ok = parsed.Parsed["featureStoreEntityName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "featureStoreEntityName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFeatureStoreEntityIDInsensitively(input string) (*FeatureStoreEntityId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FeatureStoreEntityId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FeatureStoreEntityId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.FeatureStoreEntityName, ok = parsed.Parsed["featureStoreEntityName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "featureStoreEntityName", *parsed) + if id.FeatureStoreEntityName, ok = input.Parsed["featureStoreEntityName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "featureStoreEntityName", input) } - return &id, nil + return nil } // ValidateFeatureStoreEntityID checks that 'input' can be parsed as a Feature Store Entity ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/featurestoreentitycontainer/id_workspace.go b/resource-manager/machinelearningservices/2023-04-01-preview/featurestoreentitycontainer/id_workspace.go index 26ccba327bd..388cf563cfb 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/featurestoreentitycontainer/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/featurestoreentitycontainer/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/featurestoreentityversion/id_featurestoreentity.go b/resource-manager/machinelearningservices/2023-04-01-preview/featurestoreentityversion/id_featurestoreentity.go index ca8548c2517..62bde10f848 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/featurestoreentityversion/id_featurestoreentity.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/featurestoreentityversion/id_featurestoreentity.go @@ -38,23 +38,9 @@ func ParseFeatureStoreEntityID(input string) (*FeatureStoreEntityId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FeatureStoreEntityId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.FeatureStoreEntityName, ok = parsed.Parsed["featureStoreEntityName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "featureStoreEntityName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFeatureStoreEntityIDInsensitively(input string) (*FeatureStoreEntityId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FeatureStoreEntityId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FeatureStoreEntityId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.FeatureStoreEntityName, ok = parsed.Parsed["featureStoreEntityName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "featureStoreEntityName", *parsed) + if id.FeatureStoreEntityName, ok = input.Parsed["featureStoreEntityName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "featureStoreEntityName", input) } - return &id, nil + return nil } // ValidateFeatureStoreEntityID checks that 'input' can be parsed as a Feature Store Entity ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/featurestoreentityversion/id_featurestoreentityversion.go b/resource-manager/machinelearningservices/2023-04-01-preview/featurestoreentityversion/id_featurestoreentityversion.go index 621c16722e8..4ee7a03cfca 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/featurestoreentityversion/id_featurestoreentityversion.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/featurestoreentityversion/id_featurestoreentityversion.go @@ -40,27 +40,9 @@ func ParseFeatureStoreEntityVersionID(input string) (*FeatureStoreEntityVersionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FeatureStoreEntityVersionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.FeatureStoreEntityName, ok = parsed.Parsed["featureStoreEntityName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "featureStoreEntityName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseFeatureStoreEntityVersionIDInsensitively(input string) (*FeatureStoreE return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FeatureStoreEntityVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *FeatureStoreEntityVersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.FeatureStoreEntityName, ok = parsed.Parsed["featureStoreEntityName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "featureStoreEntityName", *parsed) + if id.FeatureStoreEntityName, ok = input.Parsed["featureStoreEntityName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "featureStoreEntityName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateFeatureStoreEntityVersionID checks that 'input' can be parsed as a Feature Store Entity Version ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/job/id_job.go b/resource-manager/machinelearningservices/2023-04-01-preview/job/id_job.go index 78aa3ecfea9..563223eca08 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/job/id_job.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/job/id_job.go @@ -38,23 +38,9 @@ func ParseJobID(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseJobIDInsensitively(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *JobId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - return &id, nil + return nil } // ValidateJobID checks that 'input' can be parsed as a Job ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/job/id_workspace.go b/resource-manager/machinelearningservices/2023-04-01-preview/job/id_workspace.go index d3d669da0a3..165bda1d6b0 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/job/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/job/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/labelingjob/id_labelingjob.go b/resource-manager/machinelearningservices/2023-04-01-preview/labelingjob/id_labelingjob.go index b13f1a1c2fb..01a273a26fe 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/labelingjob/id_labelingjob.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/labelingjob/id_labelingjob.go @@ -38,23 +38,9 @@ func ParseLabelingJobID(input string) (*LabelingJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabelingJobId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.LabelingJobName, ok = parsed.Parsed["labelingJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labelingJobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLabelingJobIDInsensitively(input string) (*LabelingJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LabelingJobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LabelingJobId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.LabelingJobName, ok = parsed.Parsed["labelingJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "labelingJobName", *parsed) + if id.LabelingJobName, ok = input.Parsed["labelingJobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "labelingJobName", input) } - return &id, nil + return nil } // ValidateLabelingJobID checks that 'input' can be parsed as a Labeling Job ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/labelingjob/id_workspace.go b/resource-manager/machinelearningservices/2023-04-01-preview/labelingjob/id_workspace.go index 8781fb0a166..d834680f5c8 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/labelingjob/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/labelingjob/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/machinelearningcomputes/id_compute.go b/resource-manager/machinelearningservices/2023-04-01-preview/machinelearningcomputes/id_compute.go index 18a81277e2a..0a5c48c2b75 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/machinelearningcomputes/id_compute.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/machinelearningcomputes/id_compute.go @@ -38,23 +38,9 @@ func ParseComputeID(input string) (*ComputeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComputeId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ComputeName, ok = parsed.Parsed["computeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "computeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseComputeIDInsensitively(input string) (*ComputeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComputeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ComputeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ComputeName, ok = parsed.Parsed["computeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "computeName", *parsed) + if id.ComputeName, ok = input.Parsed["computeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "computeName", input) } - return &id, nil + return nil } // ValidateComputeID checks that 'input' can be parsed as a Compute ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/machinelearningcomputes/id_workspace.go b/resource-manager/machinelearningservices/2023-04-01-preview/machinelearningcomputes/id_workspace.go index 433fbb7591c..97b8f1ce442 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/machinelearningcomputes/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/machinelearningcomputes/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/managednetwork/id_outboundrule.go b/resource-manager/machinelearningservices/2023-04-01-preview/managednetwork/id_outboundrule.go index 7df4f2db9c0..570d87bc6c8 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/managednetwork/id_outboundrule.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/managednetwork/id_outboundrule.go @@ -38,23 +38,9 @@ func ParseOutboundRuleID(input string) (*OutboundRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OutboundRuleId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.OutboundRuleName, ok = parsed.Parsed["outboundRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "outboundRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseOutboundRuleIDInsensitively(input string) (*OutboundRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OutboundRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OutboundRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.OutboundRuleName, ok = parsed.Parsed["outboundRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "outboundRuleName", *parsed) + if id.OutboundRuleName, ok = input.Parsed["outboundRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "outboundRuleName", input) } - return &id, nil + return nil } // ValidateOutboundRuleID checks that 'input' can be parsed as a Outbound Rule ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/managednetwork/id_workspace.go b/resource-manager/machinelearningservices/2023-04-01-preview/managednetwork/id_workspace.go index cd316134cb8..935643db062 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/managednetwork/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/managednetwork/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/modelcontainer/id_model.go b/resource-manager/machinelearningservices/2023-04-01-preview/modelcontainer/id_model.go index ba14ca74245..51fa4a9d96b 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/modelcontainer/id_model.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/modelcontainer/id_model.go @@ -38,23 +38,9 @@ func ParseModelID(input string) (*ModelId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModelId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ModelName, ok = parsed.Parsed["modelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "modelName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseModelIDInsensitively(input string) (*ModelId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModelId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ModelId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ModelName, ok = parsed.Parsed["modelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "modelName", *parsed) + if id.ModelName, ok = input.Parsed["modelName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "modelName", input) } - return &id, nil + return nil } // ValidateModelID checks that 'input' can be parsed as a Model ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/modelcontainer/id_registry.go b/resource-manager/machinelearningservices/2023-04-01-preview/modelcontainer/id_registry.go index 59c61078645..228bb2dd58a 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/modelcontainer/id_registry.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/modelcontainer/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/modelcontainer/id_registrymodel.go b/resource-manager/machinelearningservices/2023-04-01-preview/modelcontainer/id_registrymodel.go index f693ceb1cd4..4c44602fde0 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/modelcontainer/id_registrymodel.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/modelcontainer/id_registrymodel.go @@ -38,23 +38,9 @@ func ParseRegistryModelID(input string) (*RegistryModelId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryModelId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.ModelName, ok = parsed.Parsed["modelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "modelName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRegistryModelIDInsensitively(input string) (*RegistryModelId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryModelId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RegistryModelId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.ModelName, ok = parsed.Parsed["modelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "modelName", *parsed) + if id.ModelName, ok = input.Parsed["modelName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "modelName", input) } - return &id, nil + return nil } // ValidateRegistryModelID checks that 'input' can be parsed as a Registry Model ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/modelcontainer/id_workspace.go b/resource-manager/machinelearningservices/2023-04-01-preview/modelcontainer/id_workspace.go index bbc169a54bc..3e2ad09c644 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/modelcontainer/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/modelcontainer/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/modelversion/id_model.go b/resource-manager/machinelearningservices/2023-04-01-preview/modelversion/id_model.go index 46520fef955..1ac17714a02 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/modelversion/id_model.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/modelversion/id_model.go @@ -38,23 +38,9 @@ func ParseModelID(input string) (*ModelId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModelId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ModelName, ok = parsed.Parsed["modelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "modelName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseModelIDInsensitively(input string) (*ModelId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModelId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ModelId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ModelName, ok = parsed.Parsed["modelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "modelName", *parsed) + if id.ModelName, ok = input.Parsed["modelName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "modelName", input) } - return &id, nil + return nil } // ValidateModelID checks that 'input' can be parsed as a Model ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/modelversion/id_modelversion.go b/resource-manager/machinelearningservices/2023-04-01-preview/modelversion/id_modelversion.go index fa93daf0849..cc122322e68 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/modelversion/id_modelversion.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/modelversion/id_modelversion.go @@ -40,27 +40,9 @@ func ParseModelVersionID(input string) (*ModelVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModelVersionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ModelName, ok = parsed.Parsed["modelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "modelName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseModelVersionIDInsensitively(input string) (*ModelVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModelVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ModelVersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ModelName, ok = parsed.Parsed["modelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "modelName", *parsed) + if id.ModelName, ok = input.Parsed["modelName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "modelName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateModelVersionID checks that 'input' can be parsed as a Model Version ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/modelversion/id_registrymodel.go b/resource-manager/machinelearningservices/2023-04-01-preview/modelversion/id_registrymodel.go index 1457bb80bf6..db02121a75f 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/modelversion/id_registrymodel.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/modelversion/id_registrymodel.go @@ -38,23 +38,9 @@ func ParseRegistryModelID(input string) (*RegistryModelId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryModelId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.ModelName, ok = parsed.Parsed["modelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "modelName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRegistryModelIDInsensitively(input string) (*RegistryModelId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryModelId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RegistryModelId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.ModelName, ok = parsed.Parsed["modelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "modelName", *parsed) + if id.ModelName, ok = input.Parsed["modelName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "modelName", input) } - return &id, nil + return nil } // ValidateRegistryModelID checks that 'input' can be parsed as a Registry Model ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/modelversion/id_registrymodelversion.go b/resource-manager/machinelearningservices/2023-04-01-preview/modelversion/id_registrymodelversion.go index 2dfe2ef8206..305f6537025 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/modelversion/id_registrymodelversion.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/modelversion/id_registrymodelversion.go @@ -40,27 +40,9 @@ func ParseRegistryModelVersionID(input string) (*RegistryModelVersionId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryModelVersionId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.ModelName, ok = parsed.Parsed["modelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "modelName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseRegistryModelVersionIDInsensitively(input string) (*RegistryModelVersi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryModelVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RegistryModelVersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.ModelName, ok = parsed.Parsed["modelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "modelName", *parsed) + if id.ModelName, ok = input.Parsed["modelName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "modelName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateRegistryModelVersionID checks that 'input' can be parsed as a Registry Model Version ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/onlinedeployment/id_onlineendpoint.go b/resource-manager/machinelearningservices/2023-04-01-preview/onlinedeployment/id_onlineendpoint.go index 936f0a50c4b..4c677589ea1 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/onlinedeployment/id_onlineendpoint.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/onlinedeployment/id_onlineendpoint.go @@ -38,23 +38,9 @@ func ParseOnlineEndpointID(input string) (*OnlineEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OnlineEndpointId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.OnlineEndpointName, ok = parsed.Parsed["onlineEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "onlineEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseOnlineEndpointIDInsensitively(input string) (*OnlineEndpointId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OnlineEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OnlineEndpointId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.OnlineEndpointName, ok = parsed.Parsed["onlineEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "onlineEndpointName", *parsed) + if id.OnlineEndpointName, ok = input.Parsed["onlineEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "onlineEndpointName", input) } - return &id, nil + return nil } // ValidateOnlineEndpointID checks that 'input' can be parsed as a Online Endpoint ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/onlinedeployment/id_onlineendpointdeployment.go b/resource-manager/machinelearningservices/2023-04-01-preview/onlinedeployment/id_onlineendpointdeployment.go index 9aaeccc9396..2d307a61a3d 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/onlinedeployment/id_onlineendpointdeployment.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/onlinedeployment/id_onlineendpointdeployment.go @@ -40,27 +40,9 @@ func ParseOnlineEndpointDeploymentID(input string) (*OnlineEndpointDeploymentId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OnlineEndpointDeploymentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.OnlineEndpointName, ok = parsed.Parsed["onlineEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "onlineEndpointName", *parsed) - } - - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseOnlineEndpointDeploymentIDInsensitively(input string) (*OnlineEndpoint return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OnlineEndpointDeploymentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *OnlineEndpointDeploymentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.OnlineEndpointName, ok = parsed.Parsed["onlineEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "onlineEndpointName", *parsed) + if id.OnlineEndpointName, ok = input.Parsed["onlineEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "onlineEndpointName", input) } - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if id.DeploymentName, ok = input.Parsed["deploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", input) } - return &id, nil + return nil } // ValidateOnlineEndpointDeploymentID checks that 'input' can be parsed as a Online Endpoint Deployment ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/onlineendpoint/id_onlineendpoint.go b/resource-manager/machinelearningservices/2023-04-01-preview/onlineendpoint/id_onlineendpoint.go index 6c5c1518e8e..f258feb0620 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/onlineendpoint/id_onlineendpoint.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/onlineendpoint/id_onlineendpoint.go @@ -38,23 +38,9 @@ func ParseOnlineEndpointID(input string) (*OnlineEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OnlineEndpointId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.OnlineEndpointName, ok = parsed.Parsed["onlineEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "onlineEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseOnlineEndpointIDInsensitively(input string) (*OnlineEndpointId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OnlineEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OnlineEndpointId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.OnlineEndpointName, ok = parsed.Parsed["onlineEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "onlineEndpointName", *parsed) + if id.OnlineEndpointName, ok = input.Parsed["onlineEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "onlineEndpointName", input) } - return &id, nil + return nil } // ValidateOnlineEndpointID checks that 'input' can be parsed as a Online Endpoint ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/onlineendpoint/id_workspace.go b/resource-manager/machinelearningservices/2023-04-01-preview/onlineendpoint/id_workspace.go index 91faec139dc..1a4a0f46e0b 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/onlineendpoint/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/onlineendpoint/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/operationalizationclusters/id_compute.go b/resource-manager/machinelearningservices/2023-04-01-preview/operationalizationclusters/id_compute.go index e793df52d8b..de3a0b9b0ac 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/operationalizationclusters/id_compute.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/operationalizationclusters/id_compute.go @@ -38,23 +38,9 @@ func ParseComputeID(input string) (*ComputeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComputeId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ComputeName, ok = parsed.Parsed["computeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "computeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseComputeIDInsensitively(input string) (*ComputeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComputeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ComputeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ComputeName, ok = parsed.Parsed["computeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "computeName", *parsed) + if id.ComputeName, ok = input.Parsed["computeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "computeName", input) } - return &id, nil + return nil } // ValidateComputeID checks that 'input' can be parsed as a Compute ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/operationalizationclusters/id_workspace.go b/resource-manager/machinelearningservices/2023-04-01-preview/operationalizationclusters/id_workspace.go index 45ab1f8a7dd..856c1bd01eb 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/operationalizationclusters/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/operationalizationclusters/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/outboundnetworkdependenciesendpoints/id_workspace.go b/resource-manager/machinelearningservices/2023-04-01-preview/outboundnetworkdependenciesendpoints/id_workspace.go index f2100fe9487..009611da59e 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/outboundnetworkdependenciesendpoints/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/outboundnetworkdependenciesendpoints/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/privateendpointconnections/id_workspace.go b/resource-manager/machinelearningservices/2023-04-01-preview/privateendpointconnections/id_workspace.go index 8a826c3113b..da4a60605e1 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/privateendpointconnections/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/privateendpointconnections/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/proxyoperations/id_workspace.go b/resource-manager/machinelearningservices/2023-04-01-preview/proxyoperations/id_workspace.go index d0a1746d097..41efeaaa051 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/proxyoperations/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/proxyoperations/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/quota/id_location.go b/resource-manager/machinelearningservices/2023-04-01-preview/quota/id_location.go index 40067b81ab7..f7b04cfd405 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/quota/id_location.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/quota/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/registrymanagement/id_registry.go b/resource-manager/machinelearningservices/2023-04-01-preview/registrymanagement/id_registry.go index 8d966b0f9d9..8e3950d727a 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/registrymanagement/id_registry.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/registrymanagement/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/schedule/id_schedule.go b/resource-manager/machinelearningservices/2023-04-01-preview/schedule/id_schedule.go index 8d367d00b21..4eb871cac1c 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/schedule/id_schedule.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/schedule/id_schedule.go @@ -38,23 +38,9 @@ func ParseScheduleID(input string) (*ScheduleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScheduleId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ScheduleName, ok = parsed.Parsed["scheduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseScheduleIDInsensitively(input string) (*ScheduleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScheduleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ScheduleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ScheduleName, ok = parsed.Parsed["scheduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", *parsed) + if id.ScheduleName, ok = input.Parsed["scheduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", input) } - return &id, nil + return nil } // ValidateScheduleID checks that 'input' can be parsed as a Schedule ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/schedule/id_workspace.go b/resource-manager/machinelearningservices/2023-04-01-preview/schedule/id_workspace.go index d96ff4474fd..c8222a7ca8e 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/schedule/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/schedule/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/v2workspaceconnectionresource/id_connection.go b/resource-manager/machinelearningservices/2023-04-01-preview/v2workspaceconnectionresource/id_connection.go index a0b502452b4..b9a5e5d30c4 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/v2workspaceconnectionresource/id_connection.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/v2workspaceconnectionresource/id_connection.go @@ -38,23 +38,9 @@ func ParseConnectionID(input string) (*ConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ConnectionName, ok = parsed.Parsed["connectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConnectionIDInsensitively(input string) (*ConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ConnectionName, ok = parsed.Parsed["connectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionName", *parsed) + if id.ConnectionName, ok = input.Parsed["connectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectionName", input) } - return &id, nil + return nil } // ValidateConnectionID checks that 'input' can be parsed as a Connection ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/v2workspaceconnectionresource/id_workspace.go b/resource-manager/machinelearningservices/2023-04-01-preview/v2workspaceconnectionresource/id_workspace.go index 4883dc4d002..81abcff93a9 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/v2workspaceconnectionresource/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/v2workspaceconnectionresource/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/virtualmachinesizes/id_location.go b/resource-manager/machinelearningservices/2023-04-01-preview/virtualmachinesizes/id_location.go index 5b66f44c4f7..d887c2fb51f 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/virtualmachinesizes/id_location.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/virtualmachinesizes/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/workspaceprivateendpointconnections/id_privateendpointconnection.go b/resource-manager/machinelearningservices/2023-04-01-preview/workspaceprivateendpointconnections/id_privateendpointconnection.go index e919def8163..3b6dfbac90e 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/workspaceprivateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/workspaceprivateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/workspaceprivatelinkresources/id_workspace.go b/resource-manager/machinelearningservices/2023-04-01-preview/workspaceprivatelinkresources/id_workspace.go index 899fa30b3b8..5297b76da47 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/workspaceprivatelinkresources/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/workspaceprivatelinkresources/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-04-01-preview/workspaces/id_workspace.go b/resource-manager/machinelearningservices/2023-04-01-preview/workspaces/id_workspace.go index c37f08503e2..42b6e9c9d8a 100644 --- a/resource-manager/machinelearningservices/2023-04-01-preview/workspaces/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-04-01-preview/workspaces/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-04-01/batchdeployment/id_batchendpoint.go b/resource-manager/machinelearningservices/2023-04-01/batchdeployment/id_batchendpoint.go index f6c57ae42f6..4994081e112 100644 --- a/resource-manager/machinelearningservices/2023-04-01/batchdeployment/id_batchendpoint.go +++ b/resource-manager/machinelearningservices/2023-04-01/batchdeployment/id_batchendpoint.go @@ -38,23 +38,9 @@ func ParseBatchEndpointID(input string) (*BatchEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BatchEndpointId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.BatchEndpointName, ok = parsed.Parsed["batchEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBatchEndpointIDInsensitively(input string) (*BatchEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BatchEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BatchEndpointId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.BatchEndpointName, ok = parsed.Parsed["batchEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchEndpointName", *parsed) + if id.BatchEndpointName, ok = input.Parsed["batchEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "batchEndpointName", input) } - return &id, nil + return nil } // ValidateBatchEndpointID checks that 'input' can be parsed as a Batch Endpoint ID diff --git a/resource-manager/machinelearningservices/2023-04-01/batchdeployment/id_deployment.go b/resource-manager/machinelearningservices/2023-04-01/batchdeployment/id_deployment.go index 03fd9c38ff1..e424729f1e7 100644 --- a/resource-manager/machinelearningservices/2023-04-01/batchdeployment/id_deployment.go +++ b/resource-manager/machinelearningservices/2023-04-01/batchdeployment/id_deployment.go @@ -40,27 +40,9 @@ func ParseDeploymentID(input string) (*DeploymentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeploymentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.BatchEndpointName, ok = parsed.Parsed["batchEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchEndpointName", *parsed) - } - - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseDeploymentIDInsensitively(input string) (*DeploymentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeploymentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DeploymentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.BatchEndpointName, ok = parsed.Parsed["batchEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchEndpointName", *parsed) + if id.BatchEndpointName, ok = input.Parsed["batchEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "batchEndpointName", input) } - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if id.DeploymentName, ok = input.Parsed["deploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", input) } - return &id, nil + return nil } // ValidateDeploymentID checks that 'input' can be parsed as a Deployment ID diff --git a/resource-manager/machinelearningservices/2023-04-01/batchendpoint/id_batchendpoint.go b/resource-manager/machinelearningservices/2023-04-01/batchendpoint/id_batchendpoint.go index 74d905b4139..b80ac7f9b96 100644 --- a/resource-manager/machinelearningservices/2023-04-01/batchendpoint/id_batchendpoint.go +++ b/resource-manager/machinelearningservices/2023-04-01/batchendpoint/id_batchendpoint.go @@ -38,23 +38,9 @@ func ParseBatchEndpointID(input string) (*BatchEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BatchEndpointId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.BatchEndpointName, ok = parsed.Parsed["batchEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBatchEndpointIDInsensitively(input string) (*BatchEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BatchEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BatchEndpointId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.BatchEndpointName, ok = parsed.Parsed["batchEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchEndpointName", *parsed) + if id.BatchEndpointName, ok = input.Parsed["batchEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "batchEndpointName", input) } - return &id, nil + return nil } // ValidateBatchEndpointID checks that 'input' can be parsed as a Batch Endpoint ID diff --git a/resource-manager/machinelearningservices/2023-04-01/batchendpoint/id_workspace.go b/resource-manager/machinelearningservices/2023-04-01/batchendpoint/id_workspace.go index eb2c67ecd5d..f77478ba59b 100644 --- a/resource-manager/machinelearningservices/2023-04-01/batchendpoint/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-04-01/batchendpoint/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-04-01/codecontainer/id_code.go b/resource-manager/machinelearningservices/2023-04-01/codecontainer/id_code.go index a473f62d1ef..9b66f97af38 100644 --- a/resource-manager/machinelearningservices/2023-04-01/codecontainer/id_code.go +++ b/resource-manager/machinelearningservices/2023-04-01/codecontainer/id_code.go @@ -38,23 +38,9 @@ func ParseCodeID(input string) (*CodeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CodeId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.CodeName, ok = parsed.Parsed["codeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "codeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCodeIDInsensitively(input string) (*CodeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CodeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CodeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.CodeName, ok = parsed.Parsed["codeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "codeName", *parsed) + if id.CodeName, ok = input.Parsed["codeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "codeName", input) } - return &id, nil + return nil } // ValidateCodeID checks that 'input' can be parsed as a Code ID diff --git a/resource-manager/machinelearningservices/2023-04-01/codecontainer/id_registry.go b/resource-manager/machinelearningservices/2023-04-01/codecontainer/id_registry.go index 982facd0d25..e2f64413cee 100644 --- a/resource-manager/machinelearningservices/2023-04-01/codecontainer/id_registry.go +++ b/resource-manager/machinelearningservices/2023-04-01/codecontainer/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/machinelearningservices/2023-04-01/codecontainer/id_registrycode.go b/resource-manager/machinelearningservices/2023-04-01/codecontainer/id_registrycode.go index 2b6961de6e4..6c053fed358 100644 --- a/resource-manager/machinelearningservices/2023-04-01/codecontainer/id_registrycode.go +++ b/resource-manager/machinelearningservices/2023-04-01/codecontainer/id_registrycode.go @@ -38,23 +38,9 @@ func ParseRegistryCodeID(input string) (*RegistryCodeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryCodeId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.CodeName, ok = parsed.Parsed["codeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "codeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRegistryCodeIDInsensitively(input string) (*RegistryCodeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryCodeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RegistryCodeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.CodeName, ok = parsed.Parsed["codeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "codeName", *parsed) + if id.CodeName, ok = input.Parsed["codeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "codeName", input) } - return &id, nil + return nil } // ValidateRegistryCodeID checks that 'input' can be parsed as a Registry Code ID diff --git a/resource-manager/machinelearningservices/2023-04-01/codecontainer/id_workspace.go b/resource-manager/machinelearningservices/2023-04-01/codecontainer/id_workspace.go index 608d0f7e0b5..cdacd37c4f8 100644 --- a/resource-manager/machinelearningservices/2023-04-01/codecontainer/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-04-01/codecontainer/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-04-01/codeversion/id_code.go b/resource-manager/machinelearningservices/2023-04-01/codeversion/id_code.go index cf69b5b96ac..7e49572e0f5 100644 --- a/resource-manager/machinelearningservices/2023-04-01/codeversion/id_code.go +++ b/resource-manager/machinelearningservices/2023-04-01/codeversion/id_code.go @@ -38,23 +38,9 @@ func ParseCodeID(input string) (*CodeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CodeId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.CodeName, ok = parsed.Parsed["codeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "codeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCodeIDInsensitively(input string) (*CodeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CodeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CodeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.CodeName, ok = parsed.Parsed["codeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "codeName", *parsed) + if id.CodeName, ok = input.Parsed["codeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "codeName", input) } - return &id, nil + return nil } // ValidateCodeID checks that 'input' can be parsed as a Code ID diff --git a/resource-manager/machinelearningservices/2023-04-01/codeversion/id_codeversion.go b/resource-manager/machinelearningservices/2023-04-01/codeversion/id_codeversion.go index d6a502b6b5f..9311b38601a 100644 --- a/resource-manager/machinelearningservices/2023-04-01/codeversion/id_codeversion.go +++ b/resource-manager/machinelearningservices/2023-04-01/codeversion/id_codeversion.go @@ -40,27 +40,9 @@ func ParseCodeVersionID(input string) (*CodeVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CodeVersionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.CodeName, ok = parsed.Parsed["codeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "codeName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseCodeVersionIDInsensitively(input string) (*CodeVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CodeVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *CodeVersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.CodeName, ok = parsed.Parsed["codeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "codeName", *parsed) + if id.CodeName, ok = input.Parsed["codeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "codeName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateCodeVersionID checks that 'input' can be parsed as a Code Version ID diff --git a/resource-manager/machinelearningservices/2023-04-01/codeversion/id_registrycode.go b/resource-manager/machinelearningservices/2023-04-01/codeversion/id_registrycode.go index 66b26629270..1edce9291c9 100644 --- a/resource-manager/machinelearningservices/2023-04-01/codeversion/id_registrycode.go +++ b/resource-manager/machinelearningservices/2023-04-01/codeversion/id_registrycode.go @@ -38,23 +38,9 @@ func ParseRegistryCodeID(input string) (*RegistryCodeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryCodeId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.CodeName, ok = parsed.Parsed["codeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "codeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRegistryCodeIDInsensitively(input string) (*RegistryCodeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryCodeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RegistryCodeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.CodeName, ok = parsed.Parsed["codeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "codeName", *parsed) + if id.CodeName, ok = input.Parsed["codeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "codeName", input) } - return &id, nil + return nil } // ValidateRegistryCodeID checks that 'input' can be parsed as a Registry Code ID diff --git a/resource-manager/machinelearningservices/2023-04-01/codeversion/id_registrycodeversion.go b/resource-manager/machinelearningservices/2023-04-01/codeversion/id_registrycodeversion.go index ca9e06364bb..ab4a6a73bd5 100644 --- a/resource-manager/machinelearningservices/2023-04-01/codeversion/id_registrycodeversion.go +++ b/resource-manager/machinelearningservices/2023-04-01/codeversion/id_registrycodeversion.go @@ -40,27 +40,9 @@ func ParseRegistryCodeVersionID(input string) (*RegistryCodeVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryCodeVersionId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.CodeName, ok = parsed.Parsed["codeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "codeName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseRegistryCodeVersionIDInsensitively(input string) (*RegistryCodeVersion return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryCodeVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RegistryCodeVersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.CodeName, ok = parsed.Parsed["codeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "codeName", *parsed) + if id.CodeName, ok = input.Parsed["codeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "codeName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateRegistryCodeVersionID checks that 'input' can be parsed as a Registry Code Version ID diff --git a/resource-manager/machinelearningservices/2023-04-01/componentcontainer/id_component.go b/resource-manager/machinelearningservices/2023-04-01/componentcontainer/id_component.go index a4b869cfb1c..5b09bc73eee 100644 --- a/resource-manager/machinelearningservices/2023-04-01/componentcontainer/id_component.go +++ b/resource-manager/machinelearningservices/2023-04-01/componentcontainer/id_component.go @@ -38,23 +38,9 @@ func ParseComponentID(input string) (*ComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseComponentIDInsensitively(input string) (*ComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ComponentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) } - return &id, nil + return nil } // ValidateComponentID checks that 'input' can be parsed as a Component ID diff --git a/resource-manager/machinelearningservices/2023-04-01/componentcontainer/id_registry.go b/resource-manager/machinelearningservices/2023-04-01/componentcontainer/id_registry.go index 33b6af07f84..6d60f63cfd5 100644 --- a/resource-manager/machinelearningservices/2023-04-01/componentcontainer/id_registry.go +++ b/resource-manager/machinelearningservices/2023-04-01/componentcontainer/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/machinelearningservices/2023-04-01/componentcontainer/id_registrycomponent.go b/resource-manager/machinelearningservices/2023-04-01/componentcontainer/id_registrycomponent.go index e4a9064fc32..0b1d043a826 100644 --- a/resource-manager/machinelearningservices/2023-04-01/componentcontainer/id_registrycomponent.go +++ b/resource-manager/machinelearningservices/2023-04-01/componentcontainer/id_registrycomponent.go @@ -38,23 +38,9 @@ func ParseRegistryComponentID(input string) (*RegistryComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryComponentId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRegistryComponentIDInsensitively(input string) (*RegistryComponentId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryComponentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RegistryComponentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) } - return &id, nil + return nil } // ValidateRegistryComponentID checks that 'input' can be parsed as a Registry Component ID diff --git a/resource-manager/machinelearningservices/2023-04-01/componentcontainer/id_workspace.go b/resource-manager/machinelearningservices/2023-04-01/componentcontainer/id_workspace.go index 2bc7cff6726..5d1410ef408 100644 --- a/resource-manager/machinelearningservices/2023-04-01/componentcontainer/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-04-01/componentcontainer/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-04-01/componentversion/id_component.go b/resource-manager/machinelearningservices/2023-04-01/componentversion/id_component.go index f4632d5a6a1..f3f3b99eaa1 100644 --- a/resource-manager/machinelearningservices/2023-04-01/componentversion/id_component.go +++ b/resource-manager/machinelearningservices/2023-04-01/componentversion/id_component.go @@ -38,23 +38,9 @@ func ParseComponentID(input string) (*ComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseComponentIDInsensitively(input string) (*ComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ComponentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) } - return &id, nil + return nil } // ValidateComponentID checks that 'input' can be parsed as a Component ID diff --git a/resource-manager/machinelearningservices/2023-04-01/componentversion/id_componentversion.go b/resource-manager/machinelearningservices/2023-04-01/componentversion/id_componentversion.go index 8e114d7dfe4..cbbb201c9bb 100644 --- a/resource-manager/machinelearningservices/2023-04-01/componentversion/id_componentversion.go +++ b/resource-manager/machinelearningservices/2023-04-01/componentversion/id_componentversion.go @@ -40,27 +40,9 @@ func ParseComponentVersionID(input string) (*ComponentVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentVersionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseComponentVersionIDInsensitively(input string) (*ComponentVersionId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ComponentVersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateComponentVersionID checks that 'input' can be parsed as a Component Version ID diff --git a/resource-manager/machinelearningservices/2023-04-01/componentversion/id_registrycomponent.go b/resource-manager/machinelearningservices/2023-04-01/componentversion/id_registrycomponent.go index bb4657b70db..5fb1de1a8fc 100644 --- a/resource-manager/machinelearningservices/2023-04-01/componentversion/id_registrycomponent.go +++ b/resource-manager/machinelearningservices/2023-04-01/componentversion/id_registrycomponent.go @@ -38,23 +38,9 @@ func ParseRegistryComponentID(input string) (*RegistryComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryComponentId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRegistryComponentIDInsensitively(input string) (*RegistryComponentId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryComponentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RegistryComponentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) } - return &id, nil + return nil } // ValidateRegistryComponentID checks that 'input' can be parsed as a Registry Component ID diff --git a/resource-manager/machinelearningservices/2023-04-01/componentversion/id_registrycomponentversion.go b/resource-manager/machinelearningservices/2023-04-01/componentversion/id_registrycomponentversion.go index 2e445a443ab..0493925fc49 100644 --- a/resource-manager/machinelearningservices/2023-04-01/componentversion/id_registrycomponentversion.go +++ b/resource-manager/machinelearningservices/2023-04-01/componentversion/id_registrycomponentversion.go @@ -40,27 +40,9 @@ func ParseRegistryComponentVersionID(input string) (*RegistryComponentVersionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryComponentVersionId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseRegistryComponentVersionIDInsensitively(input string) (*RegistryCompon return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryComponentVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RegistryComponentVersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateRegistryComponentVersionID checks that 'input' can be parsed as a Registry Component Version ID diff --git a/resource-manager/machinelearningservices/2023-04-01/datacontainer/id_workspace.go b/resource-manager/machinelearningservices/2023-04-01/datacontainer/id_workspace.go index 5c6b04e44e5..9939fbf03e9 100644 --- a/resource-manager/machinelearningservices/2023-04-01/datacontainer/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-04-01/datacontainer/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-04-01/datacontainer/id_workspacedata.go b/resource-manager/machinelearningservices/2023-04-01/datacontainer/id_workspacedata.go index 7025008b9a8..aa700a53555 100644 --- a/resource-manager/machinelearningservices/2023-04-01/datacontainer/id_workspacedata.go +++ b/resource-manager/machinelearningservices/2023-04-01/datacontainer/id_workspacedata.go @@ -38,23 +38,9 @@ func ParseWorkspaceDataID(input string) (*WorkspaceDataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceDataId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.DataName, ok = parsed.Parsed["dataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWorkspaceDataIDInsensitively(input string) (*WorkspaceDataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceDataId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WorkspaceDataId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.DataName, ok = parsed.Parsed["dataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataName", *parsed) + if id.DataName, ok = input.Parsed["dataName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataName", input) } - return &id, nil + return nil } // ValidateWorkspaceDataID checks that 'input' can be parsed as a Workspace Data ID diff --git a/resource-manager/machinelearningservices/2023-04-01/datacontainerregistry/id_data.go b/resource-manager/machinelearningservices/2023-04-01/datacontainerregistry/id_data.go index 4f9d77f22e4..88d291a6ed5 100644 --- a/resource-manager/machinelearningservices/2023-04-01/datacontainerregistry/id_data.go +++ b/resource-manager/machinelearningservices/2023-04-01/datacontainerregistry/id_data.go @@ -38,23 +38,9 @@ func ParseDataID(input string) (*DataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.DataName, ok = parsed.Parsed["dataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDataIDInsensitively(input string) (*DataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DataId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.DataName, ok = parsed.Parsed["dataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataName", *parsed) + if id.DataName, ok = input.Parsed["dataName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataName", input) } - return &id, nil + return nil } // ValidateDataID checks that 'input' can be parsed as a Data ID diff --git a/resource-manager/machinelearningservices/2023-04-01/datacontainerregistry/id_registry.go b/resource-manager/machinelearningservices/2023-04-01/datacontainerregistry/id_registry.go index cfd75714c2e..9bbb8b258f2 100644 --- a/resource-manager/machinelearningservices/2023-04-01/datacontainerregistry/id_registry.go +++ b/resource-manager/machinelearningservices/2023-04-01/datacontainerregistry/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/machinelearningservices/2023-04-01/datastore/id_datastore.go b/resource-manager/machinelearningservices/2023-04-01/datastore/id_datastore.go index ee2428b4235..58fc7a10542 100644 --- a/resource-manager/machinelearningservices/2023-04-01/datastore/id_datastore.go +++ b/resource-manager/machinelearningservices/2023-04-01/datastore/id_datastore.go @@ -38,23 +38,9 @@ func ParseDataStoreID(input string) (*DataStoreId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataStoreId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.DataStoreName, ok = parsed.Parsed["dataStoreName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataStoreName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDataStoreIDInsensitively(input string) (*DataStoreId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataStoreId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DataStoreId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.DataStoreName, ok = parsed.Parsed["dataStoreName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataStoreName", *parsed) + if id.DataStoreName, ok = input.Parsed["dataStoreName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataStoreName", input) } - return &id, nil + return nil } // ValidateDataStoreID checks that 'input' can be parsed as a Data Store ID diff --git a/resource-manager/machinelearningservices/2023-04-01/datastore/id_workspace.go b/resource-manager/machinelearningservices/2023-04-01/datastore/id_workspace.go index b4cddf6dc62..008f9fac5fe 100644 --- a/resource-manager/machinelearningservices/2023-04-01/datastore/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-04-01/datastore/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-04-01/dataversion/id_dataversion.go b/resource-manager/machinelearningservices/2023-04-01/dataversion/id_dataversion.go index cb2b1bf7d24..1e1a8c94823 100644 --- a/resource-manager/machinelearningservices/2023-04-01/dataversion/id_dataversion.go +++ b/resource-manager/machinelearningservices/2023-04-01/dataversion/id_dataversion.go @@ -40,27 +40,9 @@ func ParseDataVersionID(input string) (*DataVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataVersionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.DataName, ok = parsed.Parsed["dataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseDataVersionIDInsensitively(input string) (*DataVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DataVersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.DataName, ok = parsed.Parsed["dataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataName", *parsed) + if id.DataName, ok = input.Parsed["dataName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateDataVersionID checks that 'input' can be parsed as a Data Version ID diff --git a/resource-manager/machinelearningservices/2023-04-01/dataversion/id_workspacedata.go b/resource-manager/machinelearningservices/2023-04-01/dataversion/id_workspacedata.go index 23b7e36b2c0..b71830f429c 100644 --- a/resource-manager/machinelearningservices/2023-04-01/dataversion/id_workspacedata.go +++ b/resource-manager/machinelearningservices/2023-04-01/dataversion/id_workspacedata.go @@ -38,23 +38,9 @@ func ParseWorkspaceDataID(input string) (*WorkspaceDataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceDataId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.DataName, ok = parsed.Parsed["dataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWorkspaceDataIDInsensitively(input string) (*WorkspaceDataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceDataId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WorkspaceDataId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.DataName, ok = parsed.Parsed["dataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataName", *parsed) + if id.DataName, ok = input.Parsed["dataName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataName", input) } - return &id, nil + return nil } // ValidateWorkspaceDataID checks that 'input' can be parsed as a Workspace Data ID diff --git a/resource-manager/machinelearningservices/2023-04-01/dataversionregistry/id_data.go b/resource-manager/machinelearningservices/2023-04-01/dataversionregistry/id_data.go index 7f37bfb07eb..3e37746b0a7 100644 --- a/resource-manager/machinelearningservices/2023-04-01/dataversionregistry/id_data.go +++ b/resource-manager/machinelearningservices/2023-04-01/dataversionregistry/id_data.go @@ -38,23 +38,9 @@ func ParseDataID(input string) (*DataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.DataName, ok = parsed.Parsed["dataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDataIDInsensitively(input string) (*DataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DataId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.DataName, ok = parsed.Parsed["dataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataName", *parsed) + if id.DataName, ok = input.Parsed["dataName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataName", input) } - return &id, nil + return nil } // ValidateDataID checks that 'input' can be parsed as a Data ID diff --git a/resource-manager/machinelearningservices/2023-04-01/dataversionregistry/id_version.go b/resource-manager/machinelearningservices/2023-04-01/dataversionregistry/id_version.go index 56e33ffcb5e..c1f5119c271 100644 --- a/resource-manager/machinelearningservices/2023-04-01/dataversionregistry/id_version.go +++ b/resource-manager/machinelearningservices/2023-04-01/dataversionregistry/id_version.go @@ -40,27 +40,9 @@ func ParseVersionID(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.DataName, ok = parsed.Parsed["dataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVersionIDInsensitively(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.DataName, ok = parsed.Parsed["dataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataName", *parsed) + if id.DataName, ok = input.Parsed["dataName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateVersionID checks that 'input' can be parsed as a Version ID diff --git a/resource-manager/machinelearningservices/2023-04-01/environmentcontainer/id_environment.go b/resource-manager/machinelearningservices/2023-04-01/environmentcontainer/id_environment.go index 418572ed464..3c327afa0d6 100644 --- a/resource-manager/machinelearningservices/2023-04-01/environmentcontainer/id_environment.go +++ b/resource-manager/machinelearningservices/2023-04-01/environmentcontainer/id_environment.go @@ -38,23 +38,9 @@ func ParseEnvironmentID(input string) (*EnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseEnvironmentIDInsensitively(input string) (*EnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EnvironmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if id.EnvironmentName, ok = input.Parsed["environmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "environmentName", input) } - return &id, nil + return nil } // ValidateEnvironmentID checks that 'input' can be parsed as a Environment ID diff --git a/resource-manager/machinelearningservices/2023-04-01/environmentcontainer/id_registry.go b/resource-manager/machinelearningservices/2023-04-01/environmentcontainer/id_registry.go index 742cd182aa9..cf5cb218fc7 100644 --- a/resource-manager/machinelearningservices/2023-04-01/environmentcontainer/id_registry.go +++ b/resource-manager/machinelearningservices/2023-04-01/environmentcontainer/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/machinelearningservices/2023-04-01/environmentcontainer/id_registryenvironment.go b/resource-manager/machinelearningservices/2023-04-01/environmentcontainer/id_registryenvironment.go index 26cb4953263..3cbab92e1f9 100644 --- a/resource-manager/machinelearningservices/2023-04-01/environmentcontainer/id_registryenvironment.go +++ b/resource-manager/machinelearningservices/2023-04-01/environmentcontainer/id_registryenvironment.go @@ -38,23 +38,9 @@ func ParseRegistryEnvironmentID(input string) (*RegistryEnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryEnvironmentId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRegistryEnvironmentIDInsensitively(input string) (*RegistryEnvironment return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryEnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RegistryEnvironmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if id.EnvironmentName, ok = input.Parsed["environmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "environmentName", input) } - return &id, nil + return nil } // ValidateRegistryEnvironmentID checks that 'input' can be parsed as a Registry Environment ID diff --git a/resource-manager/machinelearningservices/2023-04-01/environmentcontainer/id_workspace.go b/resource-manager/machinelearningservices/2023-04-01/environmentcontainer/id_workspace.go index 16ed5dfc856..4e121cbdd93 100644 --- a/resource-manager/machinelearningservices/2023-04-01/environmentcontainer/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-04-01/environmentcontainer/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-04-01/environmentversion/id_environment.go b/resource-manager/machinelearningservices/2023-04-01/environmentversion/id_environment.go index ad15ca12921..3b5f2b580cc 100644 --- a/resource-manager/machinelearningservices/2023-04-01/environmentversion/id_environment.go +++ b/resource-manager/machinelearningservices/2023-04-01/environmentversion/id_environment.go @@ -38,23 +38,9 @@ func ParseEnvironmentID(input string) (*EnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseEnvironmentIDInsensitively(input string) (*EnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EnvironmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if id.EnvironmentName, ok = input.Parsed["environmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "environmentName", input) } - return &id, nil + return nil } // ValidateEnvironmentID checks that 'input' can be parsed as a Environment ID diff --git a/resource-manager/machinelearningservices/2023-04-01/environmentversion/id_environmentversion.go b/resource-manager/machinelearningservices/2023-04-01/environmentversion/id_environmentversion.go index 73dfc1108f1..880769b0baa 100644 --- a/resource-manager/machinelearningservices/2023-04-01/environmentversion/id_environmentversion.go +++ b/resource-manager/machinelearningservices/2023-04-01/environmentversion/id_environmentversion.go @@ -40,27 +40,9 @@ func ParseEnvironmentVersionID(input string) (*EnvironmentVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentVersionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseEnvironmentVersionIDInsensitively(input string) (*EnvironmentVersionId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *EnvironmentVersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if id.EnvironmentName, ok = input.Parsed["environmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "environmentName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateEnvironmentVersionID checks that 'input' can be parsed as a Environment Version ID diff --git a/resource-manager/machinelearningservices/2023-04-01/environmentversion/id_registryenvironment.go b/resource-manager/machinelearningservices/2023-04-01/environmentversion/id_registryenvironment.go index 5016ca1690e..53306c13dd1 100644 --- a/resource-manager/machinelearningservices/2023-04-01/environmentversion/id_registryenvironment.go +++ b/resource-manager/machinelearningservices/2023-04-01/environmentversion/id_registryenvironment.go @@ -38,23 +38,9 @@ func ParseRegistryEnvironmentID(input string) (*RegistryEnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryEnvironmentId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRegistryEnvironmentIDInsensitively(input string) (*RegistryEnvironment return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryEnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RegistryEnvironmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if id.EnvironmentName, ok = input.Parsed["environmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "environmentName", input) } - return &id, nil + return nil } // ValidateRegistryEnvironmentID checks that 'input' can be parsed as a Registry Environment ID diff --git a/resource-manager/machinelearningservices/2023-04-01/environmentversion/id_registryenvironmentversion.go b/resource-manager/machinelearningservices/2023-04-01/environmentversion/id_registryenvironmentversion.go index 1c60c9dcf82..1fd80a2986f 100644 --- a/resource-manager/machinelearningservices/2023-04-01/environmentversion/id_registryenvironmentversion.go +++ b/resource-manager/machinelearningservices/2023-04-01/environmentversion/id_registryenvironmentversion.go @@ -40,27 +40,9 @@ func ParseRegistryEnvironmentVersionID(input string) (*RegistryEnvironmentVersio return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryEnvironmentVersionId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseRegistryEnvironmentVersionIDInsensitively(input string) (*RegistryEnvi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryEnvironmentVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RegistryEnvironmentVersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if id.EnvironmentName, ok = input.Parsed["environmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "environmentName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateRegistryEnvironmentVersionID checks that 'input' can be parsed as a Registry Environment Version ID diff --git a/resource-manager/machinelearningservices/2023-04-01/job/id_job.go b/resource-manager/machinelearningservices/2023-04-01/job/id_job.go index 78aa3ecfea9..563223eca08 100644 --- a/resource-manager/machinelearningservices/2023-04-01/job/id_job.go +++ b/resource-manager/machinelearningservices/2023-04-01/job/id_job.go @@ -38,23 +38,9 @@ func ParseJobID(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseJobIDInsensitively(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *JobId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - return &id, nil + return nil } // ValidateJobID checks that 'input' can be parsed as a Job ID diff --git a/resource-manager/machinelearningservices/2023-04-01/job/id_workspace.go b/resource-manager/machinelearningservices/2023-04-01/job/id_workspace.go index d3d669da0a3..165bda1d6b0 100644 --- a/resource-manager/machinelearningservices/2023-04-01/job/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-04-01/job/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-04-01/machinelearningcomputes/id_compute.go b/resource-manager/machinelearningservices/2023-04-01/machinelearningcomputes/id_compute.go index 18a81277e2a..0a5c48c2b75 100644 --- a/resource-manager/machinelearningservices/2023-04-01/machinelearningcomputes/id_compute.go +++ b/resource-manager/machinelearningservices/2023-04-01/machinelearningcomputes/id_compute.go @@ -38,23 +38,9 @@ func ParseComputeID(input string) (*ComputeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComputeId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ComputeName, ok = parsed.Parsed["computeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "computeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseComputeIDInsensitively(input string) (*ComputeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComputeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ComputeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ComputeName, ok = parsed.Parsed["computeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "computeName", *parsed) + if id.ComputeName, ok = input.Parsed["computeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "computeName", input) } - return &id, nil + return nil } // ValidateComputeID checks that 'input' can be parsed as a Compute ID diff --git a/resource-manager/machinelearningservices/2023-04-01/machinelearningcomputes/id_workspace.go b/resource-manager/machinelearningservices/2023-04-01/machinelearningcomputes/id_workspace.go index 433fbb7591c..97b8f1ce442 100644 --- a/resource-manager/machinelearningservices/2023-04-01/machinelearningcomputes/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-04-01/machinelearningcomputes/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-04-01/modelcontainer/id_model.go b/resource-manager/machinelearningservices/2023-04-01/modelcontainer/id_model.go index ba14ca74245..51fa4a9d96b 100644 --- a/resource-manager/machinelearningservices/2023-04-01/modelcontainer/id_model.go +++ b/resource-manager/machinelearningservices/2023-04-01/modelcontainer/id_model.go @@ -38,23 +38,9 @@ func ParseModelID(input string) (*ModelId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModelId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ModelName, ok = parsed.Parsed["modelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "modelName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseModelIDInsensitively(input string) (*ModelId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModelId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ModelId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ModelName, ok = parsed.Parsed["modelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "modelName", *parsed) + if id.ModelName, ok = input.Parsed["modelName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "modelName", input) } - return &id, nil + return nil } // ValidateModelID checks that 'input' can be parsed as a Model ID diff --git a/resource-manager/machinelearningservices/2023-04-01/modelcontainer/id_registry.go b/resource-manager/machinelearningservices/2023-04-01/modelcontainer/id_registry.go index 59c61078645..228bb2dd58a 100644 --- a/resource-manager/machinelearningservices/2023-04-01/modelcontainer/id_registry.go +++ b/resource-manager/machinelearningservices/2023-04-01/modelcontainer/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/machinelearningservices/2023-04-01/modelcontainer/id_registrymodel.go b/resource-manager/machinelearningservices/2023-04-01/modelcontainer/id_registrymodel.go index f693ceb1cd4..4c44602fde0 100644 --- a/resource-manager/machinelearningservices/2023-04-01/modelcontainer/id_registrymodel.go +++ b/resource-manager/machinelearningservices/2023-04-01/modelcontainer/id_registrymodel.go @@ -38,23 +38,9 @@ func ParseRegistryModelID(input string) (*RegistryModelId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryModelId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.ModelName, ok = parsed.Parsed["modelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "modelName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRegistryModelIDInsensitively(input string) (*RegistryModelId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryModelId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RegistryModelId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.ModelName, ok = parsed.Parsed["modelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "modelName", *parsed) + if id.ModelName, ok = input.Parsed["modelName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "modelName", input) } - return &id, nil + return nil } // ValidateRegistryModelID checks that 'input' can be parsed as a Registry Model ID diff --git a/resource-manager/machinelearningservices/2023-04-01/modelcontainer/id_workspace.go b/resource-manager/machinelearningservices/2023-04-01/modelcontainer/id_workspace.go index bbc169a54bc..3e2ad09c644 100644 --- a/resource-manager/machinelearningservices/2023-04-01/modelcontainer/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-04-01/modelcontainer/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-04-01/modelversion/id_model.go b/resource-manager/machinelearningservices/2023-04-01/modelversion/id_model.go index 46520fef955..1ac17714a02 100644 --- a/resource-manager/machinelearningservices/2023-04-01/modelversion/id_model.go +++ b/resource-manager/machinelearningservices/2023-04-01/modelversion/id_model.go @@ -38,23 +38,9 @@ func ParseModelID(input string) (*ModelId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModelId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ModelName, ok = parsed.Parsed["modelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "modelName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseModelIDInsensitively(input string) (*ModelId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModelId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ModelId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ModelName, ok = parsed.Parsed["modelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "modelName", *parsed) + if id.ModelName, ok = input.Parsed["modelName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "modelName", input) } - return &id, nil + return nil } // ValidateModelID checks that 'input' can be parsed as a Model ID diff --git a/resource-manager/machinelearningservices/2023-04-01/modelversion/id_modelversion.go b/resource-manager/machinelearningservices/2023-04-01/modelversion/id_modelversion.go index fa93daf0849..cc122322e68 100644 --- a/resource-manager/machinelearningservices/2023-04-01/modelversion/id_modelversion.go +++ b/resource-manager/machinelearningservices/2023-04-01/modelversion/id_modelversion.go @@ -40,27 +40,9 @@ func ParseModelVersionID(input string) (*ModelVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModelVersionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ModelName, ok = parsed.Parsed["modelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "modelName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseModelVersionIDInsensitively(input string) (*ModelVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModelVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ModelVersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ModelName, ok = parsed.Parsed["modelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "modelName", *parsed) + if id.ModelName, ok = input.Parsed["modelName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "modelName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateModelVersionID checks that 'input' can be parsed as a Model Version ID diff --git a/resource-manager/machinelearningservices/2023-04-01/modelversion/id_registrymodel.go b/resource-manager/machinelearningservices/2023-04-01/modelversion/id_registrymodel.go index 1457bb80bf6..db02121a75f 100644 --- a/resource-manager/machinelearningservices/2023-04-01/modelversion/id_registrymodel.go +++ b/resource-manager/machinelearningservices/2023-04-01/modelversion/id_registrymodel.go @@ -38,23 +38,9 @@ func ParseRegistryModelID(input string) (*RegistryModelId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryModelId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.ModelName, ok = parsed.Parsed["modelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "modelName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRegistryModelIDInsensitively(input string) (*RegistryModelId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryModelId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RegistryModelId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.ModelName, ok = parsed.Parsed["modelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "modelName", *parsed) + if id.ModelName, ok = input.Parsed["modelName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "modelName", input) } - return &id, nil + return nil } // ValidateRegistryModelID checks that 'input' can be parsed as a Registry Model ID diff --git a/resource-manager/machinelearningservices/2023-04-01/modelversion/id_registrymodelversion.go b/resource-manager/machinelearningservices/2023-04-01/modelversion/id_registrymodelversion.go index 2dfe2ef8206..305f6537025 100644 --- a/resource-manager/machinelearningservices/2023-04-01/modelversion/id_registrymodelversion.go +++ b/resource-manager/machinelearningservices/2023-04-01/modelversion/id_registrymodelversion.go @@ -40,27 +40,9 @@ func ParseRegistryModelVersionID(input string) (*RegistryModelVersionId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryModelVersionId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.ModelName, ok = parsed.Parsed["modelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "modelName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseRegistryModelVersionIDInsensitively(input string) (*RegistryModelVersi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryModelVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RegistryModelVersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.ModelName, ok = parsed.Parsed["modelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "modelName", *parsed) + if id.ModelName, ok = input.Parsed["modelName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "modelName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateRegistryModelVersionID checks that 'input' can be parsed as a Registry Model Version ID diff --git a/resource-manager/machinelearningservices/2023-04-01/onlinedeployment/id_onlineendpoint.go b/resource-manager/machinelearningservices/2023-04-01/onlinedeployment/id_onlineendpoint.go index 936f0a50c4b..4c677589ea1 100644 --- a/resource-manager/machinelearningservices/2023-04-01/onlinedeployment/id_onlineendpoint.go +++ b/resource-manager/machinelearningservices/2023-04-01/onlinedeployment/id_onlineendpoint.go @@ -38,23 +38,9 @@ func ParseOnlineEndpointID(input string) (*OnlineEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OnlineEndpointId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.OnlineEndpointName, ok = parsed.Parsed["onlineEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "onlineEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseOnlineEndpointIDInsensitively(input string) (*OnlineEndpointId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OnlineEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OnlineEndpointId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.OnlineEndpointName, ok = parsed.Parsed["onlineEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "onlineEndpointName", *parsed) + if id.OnlineEndpointName, ok = input.Parsed["onlineEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "onlineEndpointName", input) } - return &id, nil + return nil } // ValidateOnlineEndpointID checks that 'input' can be parsed as a Online Endpoint ID diff --git a/resource-manager/machinelearningservices/2023-04-01/onlinedeployment/id_onlineendpointdeployment.go b/resource-manager/machinelearningservices/2023-04-01/onlinedeployment/id_onlineendpointdeployment.go index 9aaeccc9396..2d307a61a3d 100644 --- a/resource-manager/machinelearningservices/2023-04-01/onlinedeployment/id_onlineendpointdeployment.go +++ b/resource-manager/machinelearningservices/2023-04-01/onlinedeployment/id_onlineendpointdeployment.go @@ -40,27 +40,9 @@ func ParseOnlineEndpointDeploymentID(input string) (*OnlineEndpointDeploymentId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OnlineEndpointDeploymentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.OnlineEndpointName, ok = parsed.Parsed["onlineEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "onlineEndpointName", *parsed) - } - - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseOnlineEndpointDeploymentIDInsensitively(input string) (*OnlineEndpoint return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OnlineEndpointDeploymentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *OnlineEndpointDeploymentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.OnlineEndpointName, ok = parsed.Parsed["onlineEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "onlineEndpointName", *parsed) + if id.OnlineEndpointName, ok = input.Parsed["onlineEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "onlineEndpointName", input) } - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if id.DeploymentName, ok = input.Parsed["deploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", input) } - return &id, nil + return nil } // ValidateOnlineEndpointDeploymentID checks that 'input' can be parsed as a Online Endpoint Deployment ID diff --git a/resource-manager/machinelearningservices/2023-04-01/onlineendpoint/id_onlineendpoint.go b/resource-manager/machinelearningservices/2023-04-01/onlineendpoint/id_onlineendpoint.go index 6c5c1518e8e..f258feb0620 100644 --- a/resource-manager/machinelearningservices/2023-04-01/onlineendpoint/id_onlineendpoint.go +++ b/resource-manager/machinelearningservices/2023-04-01/onlineendpoint/id_onlineendpoint.go @@ -38,23 +38,9 @@ func ParseOnlineEndpointID(input string) (*OnlineEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OnlineEndpointId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.OnlineEndpointName, ok = parsed.Parsed["onlineEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "onlineEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseOnlineEndpointIDInsensitively(input string) (*OnlineEndpointId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OnlineEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OnlineEndpointId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.OnlineEndpointName, ok = parsed.Parsed["onlineEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "onlineEndpointName", *parsed) + if id.OnlineEndpointName, ok = input.Parsed["onlineEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "onlineEndpointName", input) } - return &id, nil + return nil } // ValidateOnlineEndpointID checks that 'input' can be parsed as a Online Endpoint ID diff --git a/resource-manager/machinelearningservices/2023-04-01/onlineendpoint/id_workspace.go b/resource-manager/machinelearningservices/2023-04-01/onlineendpoint/id_workspace.go index 91faec139dc..1a4a0f46e0b 100644 --- a/resource-manager/machinelearningservices/2023-04-01/onlineendpoint/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-04-01/onlineendpoint/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-04-01/operationalizationclusters/id_compute.go b/resource-manager/machinelearningservices/2023-04-01/operationalizationclusters/id_compute.go index e793df52d8b..de3a0b9b0ac 100644 --- a/resource-manager/machinelearningservices/2023-04-01/operationalizationclusters/id_compute.go +++ b/resource-manager/machinelearningservices/2023-04-01/operationalizationclusters/id_compute.go @@ -38,23 +38,9 @@ func ParseComputeID(input string) (*ComputeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComputeId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ComputeName, ok = parsed.Parsed["computeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "computeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseComputeIDInsensitively(input string) (*ComputeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComputeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ComputeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ComputeName, ok = parsed.Parsed["computeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "computeName", *parsed) + if id.ComputeName, ok = input.Parsed["computeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "computeName", input) } - return &id, nil + return nil } // ValidateComputeID checks that 'input' can be parsed as a Compute ID diff --git a/resource-manager/machinelearningservices/2023-04-01/operationalizationclusters/id_workspace.go b/resource-manager/machinelearningservices/2023-04-01/operationalizationclusters/id_workspace.go index 45ab1f8a7dd..856c1bd01eb 100644 --- a/resource-manager/machinelearningservices/2023-04-01/operationalizationclusters/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-04-01/operationalizationclusters/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-04-01/outboundnetworkdependenciesendpoints/id_workspace.go b/resource-manager/machinelearningservices/2023-04-01/outboundnetworkdependenciesendpoints/id_workspace.go index f2100fe9487..009611da59e 100644 --- a/resource-manager/machinelearningservices/2023-04-01/outboundnetworkdependenciesendpoints/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-04-01/outboundnetworkdependenciesendpoints/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-04-01/privateendpointconnections/id_workspace.go b/resource-manager/machinelearningservices/2023-04-01/privateendpointconnections/id_workspace.go index 8a826c3113b..da4a60605e1 100644 --- a/resource-manager/machinelearningservices/2023-04-01/privateendpointconnections/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-04-01/privateendpointconnections/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-04-01/proxyoperations/id_workspace.go b/resource-manager/machinelearningservices/2023-04-01/proxyoperations/id_workspace.go index d0a1746d097..41efeaaa051 100644 --- a/resource-manager/machinelearningservices/2023-04-01/proxyoperations/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-04-01/proxyoperations/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-04-01/quota/id_location.go b/resource-manager/machinelearningservices/2023-04-01/quota/id_location.go index 40067b81ab7..f7b04cfd405 100644 --- a/resource-manager/machinelearningservices/2023-04-01/quota/id_location.go +++ b/resource-manager/machinelearningservices/2023-04-01/quota/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/machinelearningservices/2023-04-01/registrymanagement/id_registry.go b/resource-manager/machinelearningservices/2023-04-01/registrymanagement/id_registry.go index 8d966b0f9d9..8e3950d727a 100644 --- a/resource-manager/machinelearningservices/2023-04-01/registrymanagement/id_registry.go +++ b/resource-manager/machinelearningservices/2023-04-01/registrymanagement/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/machinelearningservices/2023-04-01/schedule/id_schedule.go b/resource-manager/machinelearningservices/2023-04-01/schedule/id_schedule.go index 8d367d00b21..4eb871cac1c 100644 --- a/resource-manager/machinelearningservices/2023-04-01/schedule/id_schedule.go +++ b/resource-manager/machinelearningservices/2023-04-01/schedule/id_schedule.go @@ -38,23 +38,9 @@ func ParseScheduleID(input string) (*ScheduleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScheduleId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ScheduleName, ok = parsed.Parsed["scheduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseScheduleIDInsensitively(input string) (*ScheduleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScheduleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ScheduleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ScheduleName, ok = parsed.Parsed["scheduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", *parsed) + if id.ScheduleName, ok = input.Parsed["scheduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", input) } - return &id, nil + return nil } // ValidateScheduleID checks that 'input' can be parsed as a Schedule ID diff --git a/resource-manager/machinelearningservices/2023-04-01/schedule/id_workspace.go b/resource-manager/machinelearningservices/2023-04-01/schedule/id_workspace.go index d96ff4474fd..c8222a7ca8e 100644 --- a/resource-manager/machinelearningservices/2023-04-01/schedule/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-04-01/schedule/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-04-01/v2workspaceconnectionresource/id_connection.go b/resource-manager/machinelearningservices/2023-04-01/v2workspaceconnectionresource/id_connection.go index a0b502452b4..b9a5e5d30c4 100644 --- a/resource-manager/machinelearningservices/2023-04-01/v2workspaceconnectionresource/id_connection.go +++ b/resource-manager/machinelearningservices/2023-04-01/v2workspaceconnectionresource/id_connection.go @@ -38,23 +38,9 @@ func ParseConnectionID(input string) (*ConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ConnectionName, ok = parsed.Parsed["connectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConnectionIDInsensitively(input string) (*ConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ConnectionName, ok = parsed.Parsed["connectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionName", *parsed) + if id.ConnectionName, ok = input.Parsed["connectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectionName", input) } - return &id, nil + return nil } // ValidateConnectionID checks that 'input' can be parsed as a Connection ID diff --git a/resource-manager/machinelearningservices/2023-04-01/v2workspaceconnectionresource/id_workspace.go b/resource-manager/machinelearningservices/2023-04-01/v2workspaceconnectionresource/id_workspace.go index 4883dc4d002..81abcff93a9 100644 --- a/resource-manager/machinelearningservices/2023-04-01/v2workspaceconnectionresource/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-04-01/v2workspaceconnectionresource/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-04-01/virtualmachinesizes/id_location.go b/resource-manager/machinelearningservices/2023-04-01/virtualmachinesizes/id_location.go index 5b66f44c4f7..d887c2fb51f 100644 --- a/resource-manager/machinelearningservices/2023-04-01/virtualmachinesizes/id_location.go +++ b/resource-manager/machinelearningservices/2023-04-01/virtualmachinesizes/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/machinelearningservices/2023-04-01/workspaceprivateendpointconnections/id_privateendpointconnection.go b/resource-manager/machinelearningservices/2023-04-01/workspaceprivateendpointconnections/id_privateendpointconnection.go index e919def8163..3b6dfbac90e 100644 --- a/resource-manager/machinelearningservices/2023-04-01/workspaceprivateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/machinelearningservices/2023-04-01/workspaceprivateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/machinelearningservices/2023-04-01/workspaceprivatelinkresources/id_workspace.go b/resource-manager/machinelearningservices/2023-04-01/workspaceprivatelinkresources/id_workspace.go index 899fa30b3b8..5297b76da47 100644 --- a/resource-manager/machinelearningservices/2023-04-01/workspaceprivatelinkresources/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-04-01/workspaceprivatelinkresources/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-04-01/workspaces/id_workspace.go b/resource-manager/machinelearningservices/2023-04-01/workspaces/id_workspace.go index c37f08503e2..42b6e9c9d8a 100644 --- a/resource-manager/machinelearningservices/2023-04-01/workspaces/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-04-01/workspaces/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-10-01/batchdeployment/id_batchendpoint.go b/resource-manager/machinelearningservices/2023-10-01/batchdeployment/id_batchendpoint.go index f6c57ae42f6..4994081e112 100644 --- a/resource-manager/machinelearningservices/2023-10-01/batchdeployment/id_batchendpoint.go +++ b/resource-manager/machinelearningservices/2023-10-01/batchdeployment/id_batchendpoint.go @@ -38,23 +38,9 @@ func ParseBatchEndpointID(input string) (*BatchEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BatchEndpointId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.BatchEndpointName, ok = parsed.Parsed["batchEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBatchEndpointIDInsensitively(input string) (*BatchEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BatchEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BatchEndpointId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.BatchEndpointName, ok = parsed.Parsed["batchEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchEndpointName", *parsed) + if id.BatchEndpointName, ok = input.Parsed["batchEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "batchEndpointName", input) } - return &id, nil + return nil } // ValidateBatchEndpointID checks that 'input' can be parsed as a Batch Endpoint ID diff --git a/resource-manager/machinelearningservices/2023-10-01/batchdeployment/id_deployment.go b/resource-manager/machinelearningservices/2023-10-01/batchdeployment/id_deployment.go index 03fd9c38ff1..e424729f1e7 100644 --- a/resource-manager/machinelearningservices/2023-10-01/batchdeployment/id_deployment.go +++ b/resource-manager/machinelearningservices/2023-10-01/batchdeployment/id_deployment.go @@ -40,27 +40,9 @@ func ParseDeploymentID(input string) (*DeploymentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeploymentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.BatchEndpointName, ok = parsed.Parsed["batchEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchEndpointName", *parsed) - } - - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseDeploymentIDInsensitively(input string) (*DeploymentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeploymentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DeploymentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.BatchEndpointName, ok = parsed.Parsed["batchEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchEndpointName", *parsed) + if id.BatchEndpointName, ok = input.Parsed["batchEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "batchEndpointName", input) } - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if id.DeploymentName, ok = input.Parsed["deploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", input) } - return &id, nil + return nil } // ValidateDeploymentID checks that 'input' can be parsed as a Deployment ID diff --git a/resource-manager/machinelearningservices/2023-10-01/batchendpoint/id_batchendpoint.go b/resource-manager/machinelearningservices/2023-10-01/batchendpoint/id_batchendpoint.go index 74d905b4139..b80ac7f9b96 100644 --- a/resource-manager/machinelearningservices/2023-10-01/batchendpoint/id_batchendpoint.go +++ b/resource-manager/machinelearningservices/2023-10-01/batchendpoint/id_batchendpoint.go @@ -38,23 +38,9 @@ func ParseBatchEndpointID(input string) (*BatchEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BatchEndpointId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.BatchEndpointName, ok = parsed.Parsed["batchEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBatchEndpointIDInsensitively(input string) (*BatchEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BatchEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BatchEndpointId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.BatchEndpointName, ok = parsed.Parsed["batchEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "batchEndpointName", *parsed) + if id.BatchEndpointName, ok = input.Parsed["batchEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "batchEndpointName", input) } - return &id, nil + return nil } // ValidateBatchEndpointID checks that 'input' can be parsed as a Batch Endpoint ID diff --git a/resource-manager/machinelearningservices/2023-10-01/batchendpoint/id_workspace.go b/resource-manager/machinelearningservices/2023-10-01/batchendpoint/id_workspace.go index eb2c67ecd5d..f77478ba59b 100644 --- a/resource-manager/machinelearningservices/2023-10-01/batchendpoint/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-10-01/batchendpoint/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-10-01/codecontainer/id_code.go b/resource-manager/machinelearningservices/2023-10-01/codecontainer/id_code.go index a473f62d1ef..9b66f97af38 100644 --- a/resource-manager/machinelearningservices/2023-10-01/codecontainer/id_code.go +++ b/resource-manager/machinelearningservices/2023-10-01/codecontainer/id_code.go @@ -38,23 +38,9 @@ func ParseCodeID(input string) (*CodeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CodeId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.CodeName, ok = parsed.Parsed["codeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "codeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCodeIDInsensitively(input string) (*CodeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CodeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CodeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.CodeName, ok = parsed.Parsed["codeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "codeName", *parsed) + if id.CodeName, ok = input.Parsed["codeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "codeName", input) } - return &id, nil + return nil } // ValidateCodeID checks that 'input' can be parsed as a Code ID diff --git a/resource-manager/machinelearningservices/2023-10-01/codecontainer/id_registry.go b/resource-manager/machinelearningservices/2023-10-01/codecontainer/id_registry.go index 982facd0d25..e2f64413cee 100644 --- a/resource-manager/machinelearningservices/2023-10-01/codecontainer/id_registry.go +++ b/resource-manager/machinelearningservices/2023-10-01/codecontainer/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/machinelearningservices/2023-10-01/codecontainer/id_registrycode.go b/resource-manager/machinelearningservices/2023-10-01/codecontainer/id_registrycode.go index 2b6961de6e4..6c053fed358 100644 --- a/resource-manager/machinelearningservices/2023-10-01/codecontainer/id_registrycode.go +++ b/resource-manager/machinelearningservices/2023-10-01/codecontainer/id_registrycode.go @@ -38,23 +38,9 @@ func ParseRegistryCodeID(input string) (*RegistryCodeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryCodeId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.CodeName, ok = parsed.Parsed["codeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "codeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRegistryCodeIDInsensitively(input string) (*RegistryCodeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryCodeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RegistryCodeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.CodeName, ok = parsed.Parsed["codeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "codeName", *parsed) + if id.CodeName, ok = input.Parsed["codeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "codeName", input) } - return &id, nil + return nil } // ValidateRegistryCodeID checks that 'input' can be parsed as a Registry Code ID diff --git a/resource-manager/machinelearningservices/2023-10-01/codecontainer/id_workspace.go b/resource-manager/machinelearningservices/2023-10-01/codecontainer/id_workspace.go index 608d0f7e0b5..cdacd37c4f8 100644 --- a/resource-manager/machinelearningservices/2023-10-01/codecontainer/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-10-01/codecontainer/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-10-01/codeversion/id_code.go b/resource-manager/machinelearningservices/2023-10-01/codeversion/id_code.go index cf69b5b96ac..7e49572e0f5 100644 --- a/resource-manager/machinelearningservices/2023-10-01/codeversion/id_code.go +++ b/resource-manager/machinelearningservices/2023-10-01/codeversion/id_code.go @@ -38,23 +38,9 @@ func ParseCodeID(input string) (*CodeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CodeId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.CodeName, ok = parsed.Parsed["codeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "codeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCodeIDInsensitively(input string) (*CodeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CodeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CodeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.CodeName, ok = parsed.Parsed["codeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "codeName", *parsed) + if id.CodeName, ok = input.Parsed["codeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "codeName", input) } - return &id, nil + return nil } // ValidateCodeID checks that 'input' can be parsed as a Code ID diff --git a/resource-manager/machinelearningservices/2023-10-01/codeversion/id_codeversion.go b/resource-manager/machinelearningservices/2023-10-01/codeversion/id_codeversion.go index d6a502b6b5f..9311b38601a 100644 --- a/resource-manager/machinelearningservices/2023-10-01/codeversion/id_codeversion.go +++ b/resource-manager/machinelearningservices/2023-10-01/codeversion/id_codeversion.go @@ -40,27 +40,9 @@ func ParseCodeVersionID(input string) (*CodeVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CodeVersionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.CodeName, ok = parsed.Parsed["codeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "codeName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseCodeVersionIDInsensitively(input string) (*CodeVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CodeVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *CodeVersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.CodeName, ok = parsed.Parsed["codeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "codeName", *parsed) + if id.CodeName, ok = input.Parsed["codeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "codeName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateCodeVersionID checks that 'input' can be parsed as a Code Version ID diff --git a/resource-manager/machinelearningservices/2023-10-01/codeversion/id_registrycode.go b/resource-manager/machinelearningservices/2023-10-01/codeversion/id_registrycode.go index 66b26629270..1edce9291c9 100644 --- a/resource-manager/machinelearningservices/2023-10-01/codeversion/id_registrycode.go +++ b/resource-manager/machinelearningservices/2023-10-01/codeversion/id_registrycode.go @@ -38,23 +38,9 @@ func ParseRegistryCodeID(input string) (*RegistryCodeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryCodeId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.CodeName, ok = parsed.Parsed["codeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "codeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRegistryCodeIDInsensitively(input string) (*RegistryCodeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryCodeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RegistryCodeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.CodeName, ok = parsed.Parsed["codeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "codeName", *parsed) + if id.CodeName, ok = input.Parsed["codeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "codeName", input) } - return &id, nil + return nil } // ValidateRegistryCodeID checks that 'input' can be parsed as a Registry Code ID diff --git a/resource-manager/machinelearningservices/2023-10-01/codeversion/id_registrycodeversion.go b/resource-manager/machinelearningservices/2023-10-01/codeversion/id_registrycodeversion.go index ca9e06364bb..ab4a6a73bd5 100644 --- a/resource-manager/machinelearningservices/2023-10-01/codeversion/id_registrycodeversion.go +++ b/resource-manager/machinelearningservices/2023-10-01/codeversion/id_registrycodeversion.go @@ -40,27 +40,9 @@ func ParseRegistryCodeVersionID(input string) (*RegistryCodeVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryCodeVersionId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.CodeName, ok = parsed.Parsed["codeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "codeName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseRegistryCodeVersionIDInsensitively(input string) (*RegistryCodeVersion return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryCodeVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RegistryCodeVersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.CodeName, ok = parsed.Parsed["codeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "codeName", *parsed) + if id.CodeName, ok = input.Parsed["codeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "codeName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateRegistryCodeVersionID checks that 'input' can be parsed as a Registry Code Version ID diff --git a/resource-manager/machinelearningservices/2023-10-01/componentcontainer/id_component.go b/resource-manager/machinelearningservices/2023-10-01/componentcontainer/id_component.go index a4b869cfb1c..5b09bc73eee 100644 --- a/resource-manager/machinelearningservices/2023-10-01/componentcontainer/id_component.go +++ b/resource-manager/machinelearningservices/2023-10-01/componentcontainer/id_component.go @@ -38,23 +38,9 @@ func ParseComponentID(input string) (*ComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseComponentIDInsensitively(input string) (*ComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ComponentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) } - return &id, nil + return nil } // ValidateComponentID checks that 'input' can be parsed as a Component ID diff --git a/resource-manager/machinelearningservices/2023-10-01/componentcontainer/id_registry.go b/resource-manager/machinelearningservices/2023-10-01/componentcontainer/id_registry.go index 33b6af07f84..6d60f63cfd5 100644 --- a/resource-manager/machinelearningservices/2023-10-01/componentcontainer/id_registry.go +++ b/resource-manager/machinelearningservices/2023-10-01/componentcontainer/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/machinelearningservices/2023-10-01/componentcontainer/id_registrycomponent.go b/resource-manager/machinelearningservices/2023-10-01/componentcontainer/id_registrycomponent.go index e4a9064fc32..0b1d043a826 100644 --- a/resource-manager/machinelearningservices/2023-10-01/componentcontainer/id_registrycomponent.go +++ b/resource-manager/machinelearningservices/2023-10-01/componentcontainer/id_registrycomponent.go @@ -38,23 +38,9 @@ func ParseRegistryComponentID(input string) (*RegistryComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryComponentId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRegistryComponentIDInsensitively(input string) (*RegistryComponentId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryComponentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RegistryComponentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) } - return &id, nil + return nil } // ValidateRegistryComponentID checks that 'input' can be parsed as a Registry Component ID diff --git a/resource-manager/machinelearningservices/2023-10-01/componentcontainer/id_workspace.go b/resource-manager/machinelearningservices/2023-10-01/componentcontainer/id_workspace.go index 2bc7cff6726..5d1410ef408 100644 --- a/resource-manager/machinelearningservices/2023-10-01/componentcontainer/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-10-01/componentcontainer/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-10-01/componentversion/id_component.go b/resource-manager/machinelearningservices/2023-10-01/componentversion/id_component.go index f4632d5a6a1..f3f3b99eaa1 100644 --- a/resource-manager/machinelearningservices/2023-10-01/componentversion/id_component.go +++ b/resource-manager/machinelearningservices/2023-10-01/componentversion/id_component.go @@ -38,23 +38,9 @@ func ParseComponentID(input string) (*ComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseComponentIDInsensitively(input string) (*ComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ComponentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) } - return &id, nil + return nil } // ValidateComponentID checks that 'input' can be parsed as a Component ID diff --git a/resource-manager/machinelearningservices/2023-10-01/componentversion/id_componentversion.go b/resource-manager/machinelearningservices/2023-10-01/componentversion/id_componentversion.go index 8e114d7dfe4..cbbb201c9bb 100644 --- a/resource-manager/machinelearningservices/2023-10-01/componentversion/id_componentversion.go +++ b/resource-manager/machinelearningservices/2023-10-01/componentversion/id_componentversion.go @@ -40,27 +40,9 @@ func ParseComponentVersionID(input string) (*ComponentVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentVersionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseComponentVersionIDInsensitively(input string) (*ComponentVersionId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComponentVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ComponentVersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateComponentVersionID checks that 'input' can be parsed as a Component Version ID diff --git a/resource-manager/machinelearningservices/2023-10-01/componentversion/id_registrycomponent.go b/resource-manager/machinelearningservices/2023-10-01/componentversion/id_registrycomponent.go index bb4657b70db..5fb1de1a8fc 100644 --- a/resource-manager/machinelearningservices/2023-10-01/componentversion/id_registrycomponent.go +++ b/resource-manager/machinelearningservices/2023-10-01/componentversion/id_registrycomponent.go @@ -38,23 +38,9 @@ func ParseRegistryComponentID(input string) (*RegistryComponentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryComponentId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRegistryComponentIDInsensitively(input string) (*RegistryComponentId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryComponentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RegistryComponentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) } - return &id, nil + return nil } // ValidateRegistryComponentID checks that 'input' can be parsed as a Registry Component ID diff --git a/resource-manager/machinelearningservices/2023-10-01/componentversion/id_registrycomponentversion.go b/resource-manager/machinelearningservices/2023-10-01/componentversion/id_registrycomponentversion.go index 2e445a443ab..0493925fc49 100644 --- a/resource-manager/machinelearningservices/2023-10-01/componentversion/id_registrycomponentversion.go +++ b/resource-manager/machinelearningservices/2023-10-01/componentversion/id_registrycomponentversion.go @@ -40,27 +40,9 @@ func ParseRegistryComponentVersionID(input string) (*RegistryComponentVersionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryComponentVersionId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseRegistryComponentVersionIDInsensitively(input string) (*RegistryCompon return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryComponentVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RegistryComponentVersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.ComponentName, ok = parsed.Parsed["componentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "componentName", *parsed) + if id.ComponentName, ok = input.Parsed["componentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "componentName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateRegistryComponentVersionID checks that 'input' can be parsed as a Registry Component Version ID diff --git a/resource-manager/machinelearningservices/2023-10-01/datacontainer/id_workspace.go b/resource-manager/machinelearningservices/2023-10-01/datacontainer/id_workspace.go index 5c6b04e44e5..9939fbf03e9 100644 --- a/resource-manager/machinelearningservices/2023-10-01/datacontainer/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-10-01/datacontainer/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-10-01/datacontainer/id_workspacedata.go b/resource-manager/machinelearningservices/2023-10-01/datacontainer/id_workspacedata.go index 7025008b9a8..aa700a53555 100644 --- a/resource-manager/machinelearningservices/2023-10-01/datacontainer/id_workspacedata.go +++ b/resource-manager/machinelearningservices/2023-10-01/datacontainer/id_workspacedata.go @@ -38,23 +38,9 @@ func ParseWorkspaceDataID(input string) (*WorkspaceDataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceDataId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.DataName, ok = parsed.Parsed["dataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWorkspaceDataIDInsensitively(input string) (*WorkspaceDataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceDataId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WorkspaceDataId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.DataName, ok = parsed.Parsed["dataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataName", *parsed) + if id.DataName, ok = input.Parsed["dataName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataName", input) } - return &id, nil + return nil } // ValidateWorkspaceDataID checks that 'input' can be parsed as a Workspace Data ID diff --git a/resource-manager/machinelearningservices/2023-10-01/datacontainerregistry/id_data.go b/resource-manager/machinelearningservices/2023-10-01/datacontainerregistry/id_data.go index 4f9d77f22e4..88d291a6ed5 100644 --- a/resource-manager/machinelearningservices/2023-10-01/datacontainerregistry/id_data.go +++ b/resource-manager/machinelearningservices/2023-10-01/datacontainerregistry/id_data.go @@ -38,23 +38,9 @@ func ParseDataID(input string) (*DataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.DataName, ok = parsed.Parsed["dataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDataIDInsensitively(input string) (*DataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DataId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.DataName, ok = parsed.Parsed["dataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataName", *parsed) + if id.DataName, ok = input.Parsed["dataName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataName", input) } - return &id, nil + return nil } // ValidateDataID checks that 'input' can be parsed as a Data ID diff --git a/resource-manager/machinelearningservices/2023-10-01/datacontainerregistry/id_registry.go b/resource-manager/machinelearningservices/2023-10-01/datacontainerregistry/id_registry.go index cfd75714c2e..9bbb8b258f2 100644 --- a/resource-manager/machinelearningservices/2023-10-01/datacontainerregistry/id_registry.go +++ b/resource-manager/machinelearningservices/2023-10-01/datacontainerregistry/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/machinelearningservices/2023-10-01/datareference/id_datareferenceversion.go b/resource-manager/machinelearningservices/2023-10-01/datareference/id_datareferenceversion.go index dba0f4b6d47..2460b232eab 100644 --- a/resource-manager/machinelearningservices/2023-10-01/datareference/id_datareferenceversion.go +++ b/resource-manager/machinelearningservices/2023-10-01/datareference/id_datareferenceversion.go @@ -40,27 +40,9 @@ func ParseDataReferenceVersionID(input string) (*DataReferenceVersionId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataReferenceVersionId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.DataReferenceName, ok = parsed.Parsed["dataReferenceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataReferenceName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseDataReferenceVersionIDInsensitively(input string) (*DataReferenceVersi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataReferenceVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DataReferenceVersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.DataReferenceName, ok = parsed.Parsed["dataReferenceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataReferenceName", *parsed) + if id.DataReferenceName, ok = input.Parsed["dataReferenceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataReferenceName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateDataReferenceVersionID checks that 'input' can be parsed as a Data Reference Version ID diff --git a/resource-manager/machinelearningservices/2023-10-01/datastore/id_datastore.go b/resource-manager/machinelearningservices/2023-10-01/datastore/id_datastore.go index ee2428b4235..58fc7a10542 100644 --- a/resource-manager/machinelearningservices/2023-10-01/datastore/id_datastore.go +++ b/resource-manager/machinelearningservices/2023-10-01/datastore/id_datastore.go @@ -38,23 +38,9 @@ func ParseDataStoreID(input string) (*DataStoreId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataStoreId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.DataStoreName, ok = parsed.Parsed["dataStoreName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataStoreName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDataStoreIDInsensitively(input string) (*DataStoreId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataStoreId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DataStoreId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.DataStoreName, ok = parsed.Parsed["dataStoreName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataStoreName", *parsed) + if id.DataStoreName, ok = input.Parsed["dataStoreName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataStoreName", input) } - return &id, nil + return nil } // ValidateDataStoreID checks that 'input' can be parsed as a Data Store ID diff --git a/resource-manager/machinelearningservices/2023-10-01/datastore/id_workspace.go b/resource-manager/machinelearningservices/2023-10-01/datastore/id_workspace.go index b4cddf6dc62..008f9fac5fe 100644 --- a/resource-manager/machinelearningservices/2023-10-01/datastore/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-10-01/datastore/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-10-01/dataversion/id_dataversion.go b/resource-manager/machinelearningservices/2023-10-01/dataversion/id_dataversion.go index cb2b1bf7d24..1e1a8c94823 100644 --- a/resource-manager/machinelearningservices/2023-10-01/dataversion/id_dataversion.go +++ b/resource-manager/machinelearningservices/2023-10-01/dataversion/id_dataversion.go @@ -40,27 +40,9 @@ func ParseDataVersionID(input string) (*DataVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataVersionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.DataName, ok = parsed.Parsed["dataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseDataVersionIDInsensitively(input string) (*DataVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DataVersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.DataName, ok = parsed.Parsed["dataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataName", *parsed) + if id.DataName, ok = input.Parsed["dataName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateDataVersionID checks that 'input' can be parsed as a Data Version ID diff --git a/resource-manager/machinelearningservices/2023-10-01/dataversion/id_workspacedata.go b/resource-manager/machinelearningservices/2023-10-01/dataversion/id_workspacedata.go index 23b7e36b2c0..b71830f429c 100644 --- a/resource-manager/machinelearningservices/2023-10-01/dataversion/id_workspacedata.go +++ b/resource-manager/machinelearningservices/2023-10-01/dataversion/id_workspacedata.go @@ -38,23 +38,9 @@ func ParseWorkspaceDataID(input string) (*WorkspaceDataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceDataId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.DataName, ok = parsed.Parsed["dataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWorkspaceDataIDInsensitively(input string) (*WorkspaceDataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceDataId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WorkspaceDataId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.DataName, ok = parsed.Parsed["dataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataName", *parsed) + if id.DataName, ok = input.Parsed["dataName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataName", input) } - return &id, nil + return nil } // ValidateWorkspaceDataID checks that 'input' can be parsed as a Workspace Data ID diff --git a/resource-manager/machinelearningservices/2023-10-01/dataversionregistry/id_data.go b/resource-manager/machinelearningservices/2023-10-01/dataversionregistry/id_data.go index 7f37bfb07eb..3e37746b0a7 100644 --- a/resource-manager/machinelearningservices/2023-10-01/dataversionregistry/id_data.go +++ b/resource-manager/machinelearningservices/2023-10-01/dataversionregistry/id_data.go @@ -38,23 +38,9 @@ func ParseDataID(input string) (*DataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.DataName, ok = parsed.Parsed["dataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDataIDInsensitively(input string) (*DataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DataId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.DataName, ok = parsed.Parsed["dataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataName", *parsed) + if id.DataName, ok = input.Parsed["dataName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataName", input) } - return &id, nil + return nil } // ValidateDataID checks that 'input' can be parsed as a Data ID diff --git a/resource-manager/machinelearningservices/2023-10-01/dataversionregistry/id_version.go b/resource-manager/machinelearningservices/2023-10-01/dataversionregistry/id_version.go index 56e33ffcb5e..c1f5119c271 100644 --- a/resource-manager/machinelearningservices/2023-10-01/dataversionregistry/id_version.go +++ b/resource-manager/machinelearningservices/2023-10-01/dataversionregistry/id_version.go @@ -40,27 +40,9 @@ func ParseVersionID(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.DataName, ok = parsed.Parsed["dataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVersionIDInsensitively(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.DataName, ok = parsed.Parsed["dataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataName", *parsed) + if id.DataName, ok = input.Parsed["dataName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateVersionID checks that 'input' can be parsed as a Version ID diff --git a/resource-manager/machinelearningservices/2023-10-01/environmentcontainer/id_environment.go b/resource-manager/machinelearningservices/2023-10-01/environmentcontainer/id_environment.go index 418572ed464..3c327afa0d6 100644 --- a/resource-manager/machinelearningservices/2023-10-01/environmentcontainer/id_environment.go +++ b/resource-manager/machinelearningservices/2023-10-01/environmentcontainer/id_environment.go @@ -38,23 +38,9 @@ func ParseEnvironmentID(input string) (*EnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseEnvironmentIDInsensitively(input string) (*EnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EnvironmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if id.EnvironmentName, ok = input.Parsed["environmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "environmentName", input) } - return &id, nil + return nil } // ValidateEnvironmentID checks that 'input' can be parsed as a Environment ID diff --git a/resource-manager/machinelearningservices/2023-10-01/environmentcontainer/id_registry.go b/resource-manager/machinelearningservices/2023-10-01/environmentcontainer/id_registry.go index 742cd182aa9..cf5cb218fc7 100644 --- a/resource-manager/machinelearningservices/2023-10-01/environmentcontainer/id_registry.go +++ b/resource-manager/machinelearningservices/2023-10-01/environmentcontainer/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/machinelearningservices/2023-10-01/environmentcontainer/id_registryenvironment.go b/resource-manager/machinelearningservices/2023-10-01/environmentcontainer/id_registryenvironment.go index 26cb4953263..3cbab92e1f9 100644 --- a/resource-manager/machinelearningservices/2023-10-01/environmentcontainer/id_registryenvironment.go +++ b/resource-manager/machinelearningservices/2023-10-01/environmentcontainer/id_registryenvironment.go @@ -38,23 +38,9 @@ func ParseRegistryEnvironmentID(input string) (*RegistryEnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryEnvironmentId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRegistryEnvironmentIDInsensitively(input string) (*RegistryEnvironment return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryEnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RegistryEnvironmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if id.EnvironmentName, ok = input.Parsed["environmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "environmentName", input) } - return &id, nil + return nil } // ValidateRegistryEnvironmentID checks that 'input' can be parsed as a Registry Environment ID diff --git a/resource-manager/machinelearningservices/2023-10-01/environmentcontainer/id_workspace.go b/resource-manager/machinelearningservices/2023-10-01/environmentcontainer/id_workspace.go index 16ed5dfc856..4e121cbdd93 100644 --- a/resource-manager/machinelearningservices/2023-10-01/environmentcontainer/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-10-01/environmentcontainer/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-10-01/environmentversion/id_environment.go b/resource-manager/machinelearningservices/2023-10-01/environmentversion/id_environment.go index ad15ca12921..3b5f2b580cc 100644 --- a/resource-manager/machinelearningservices/2023-10-01/environmentversion/id_environment.go +++ b/resource-manager/machinelearningservices/2023-10-01/environmentversion/id_environment.go @@ -38,23 +38,9 @@ func ParseEnvironmentID(input string) (*EnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseEnvironmentIDInsensitively(input string) (*EnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EnvironmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if id.EnvironmentName, ok = input.Parsed["environmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "environmentName", input) } - return &id, nil + return nil } // ValidateEnvironmentID checks that 'input' can be parsed as a Environment ID diff --git a/resource-manager/machinelearningservices/2023-10-01/environmentversion/id_environmentversion.go b/resource-manager/machinelearningservices/2023-10-01/environmentversion/id_environmentversion.go index 73dfc1108f1..880769b0baa 100644 --- a/resource-manager/machinelearningservices/2023-10-01/environmentversion/id_environmentversion.go +++ b/resource-manager/machinelearningservices/2023-10-01/environmentversion/id_environmentversion.go @@ -40,27 +40,9 @@ func ParseEnvironmentVersionID(input string) (*EnvironmentVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentVersionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseEnvironmentVersionIDInsensitively(input string) (*EnvironmentVersionId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *EnvironmentVersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if id.EnvironmentName, ok = input.Parsed["environmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "environmentName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateEnvironmentVersionID checks that 'input' can be parsed as a Environment Version ID diff --git a/resource-manager/machinelearningservices/2023-10-01/environmentversion/id_registryenvironment.go b/resource-manager/machinelearningservices/2023-10-01/environmentversion/id_registryenvironment.go index 5016ca1690e..53306c13dd1 100644 --- a/resource-manager/machinelearningservices/2023-10-01/environmentversion/id_registryenvironment.go +++ b/resource-manager/machinelearningservices/2023-10-01/environmentversion/id_registryenvironment.go @@ -38,23 +38,9 @@ func ParseRegistryEnvironmentID(input string) (*RegistryEnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryEnvironmentId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRegistryEnvironmentIDInsensitively(input string) (*RegistryEnvironment return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryEnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RegistryEnvironmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if id.EnvironmentName, ok = input.Parsed["environmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "environmentName", input) } - return &id, nil + return nil } // ValidateRegistryEnvironmentID checks that 'input' can be parsed as a Registry Environment ID diff --git a/resource-manager/machinelearningservices/2023-10-01/environmentversion/id_registryenvironmentversion.go b/resource-manager/machinelearningservices/2023-10-01/environmentversion/id_registryenvironmentversion.go index 1c60c9dcf82..1fd80a2986f 100644 --- a/resource-manager/machinelearningservices/2023-10-01/environmentversion/id_registryenvironmentversion.go +++ b/resource-manager/machinelearningservices/2023-10-01/environmentversion/id_registryenvironmentversion.go @@ -40,27 +40,9 @@ func ParseRegistryEnvironmentVersionID(input string) (*RegistryEnvironmentVersio return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryEnvironmentVersionId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseRegistryEnvironmentVersionIDInsensitively(input string) (*RegistryEnvi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryEnvironmentVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RegistryEnvironmentVersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if id.EnvironmentName, ok = input.Parsed["environmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "environmentName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateRegistryEnvironmentVersionID checks that 'input' can be parsed as a Registry Environment Version ID diff --git a/resource-manager/machinelearningservices/2023-10-01/feature/id_feature.go b/resource-manager/machinelearningservices/2023-10-01/feature/id_feature.go index 23fd4a8aaea..9199154f615 100644 --- a/resource-manager/machinelearningservices/2023-10-01/feature/id_feature.go +++ b/resource-manager/machinelearningservices/2023-10-01/feature/id_feature.go @@ -42,31 +42,9 @@ func ParseFeatureID(input string) (*FeatureId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FeatureId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.FeatureSetName, ok = parsed.Parsed["featureSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "featureSetName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) - } - - if id.FeatureName, ok = parsed.Parsed["featureName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "featureName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseFeatureIDInsensitively(input string) (*FeatureId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FeatureId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FeatureId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.FeatureSetName, ok = parsed.Parsed["featureSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "featureSetName", *parsed) + if id.FeatureSetName, ok = input.Parsed["featureSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "featureSetName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - if id.FeatureName, ok = parsed.Parsed["featureName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "featureName", *parsed) + if id.FeatureName, ok = input.Parsed["featureName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "featureName", input) } - return &id, nil + return nil } // ValidateFeatureID checks that 'input' can be parsed as a Feature ID diff --git a/resource-manager/machinelearningservices/2023-10-01/feature/id_featuresetversion.go b/resource-manager/machinelearningservices/2023-10-01/feature/id_featuresetversion.go index ea57e7f8d7a..fbceeea9e16 100644 --- a/resource-manager/machinelearningservices/2023-10-01/feature/id_featuresetversion.go +++ b/resource-manager/machinelearningservices/2023-10-01/feature/id_featuresetversion.go @@ -40,27 +40,9 @@ func ParseFeatureSetVersionID(input string) (*FeatureSetVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FeatureSetVersionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.FeatureSetName, ok = parsed.Parsed["featureSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "featureSetName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseFeatureSetVersionIDInsensitively(input string) (*FeatureSetVersionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FeatureSetVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *FeatureSetVersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.FeatureSetName, ok = parsed.Parsed["featureSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "featureSetName", *parsed) + if id.FeatureSetName, ok = input.Parsed["featureSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "featureSetName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateFeatureSetVersionID checks that 'input' can be parsed as a Feature Set Version ID diff --git a/resource-manager/machinelearningservices/2023-10-01/featuresetcontainer/id_featureset.go b/resource-manager/machinelearningservices/2023-10-01/featuresetcontainer/id_featureset.go index 7267252446b..84fd34706c4 100644 --- a/resource-manager/machinelearningservices/2023-10-01/featuresetcontainer/id_featureset.go +++ b/resource-manager/machinelearningservices/2023-10-01/featuresetcontainer/id_featureset.go @@ -38,23 +38,9 @@ func ParseFeatureSetID(input string) (*FeatureSetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FeatureSetId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.FeatureSetName, ok = parsed.Parsed["featureSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "featureSetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFeatureSetIDInsensitively(input string) (*FeatureSetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FeatureSetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FeatureSetId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.FeatureSetName, ok = parsed.Parsed["featureSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "featureSetName", *parsed) + if id.FeatureSetName, ok = input.Parsed["featureSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "featureSetName", input) } - return &id, nil + return nil } // ValidateFeatureSetID checks that 'input' can be parsed as a Feature Set ID diff --git a/resource-manager/machinelearningservices/2023-10-01/featuresetcontainer/id_workspace.go b/resource-manager/machinelearningservices/2023-10-01/featuresetcontainer/id_workspace.go index cc8eda06a66..132e34df3cb 100644 --- a/resource-manager/machinelearningservices/2023-10-01/featuresetcontainer/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-10-01/featuresetcontainer/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-10-01/featuresetversion/id_featureset.go b/resource-manager/machinelearningservices/2023-10-01/featuresetversion/id_featureset.go index bb9b9f59c14..f96d46dded5 100644 --- a/resource-manager/machinelearningservices/2023-10-01/featuresetversion/id_featureset.go +++ b/resource-manager/machinelearningservices/2023-10-01/featuresetversion/id_featureset.go @@ -38,23 +38,9 @@ func ParseFeatureSetID(input string) (*FeatureSetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FeatureSetId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.FeatureSetName, ok = parsed.Parsed["featureSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "featureSetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFeatureSetIDInsensitively(input string) (*FeatureSetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FeatureSetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FeatureSetId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.FeatureSetName, ok = parsed.Parsed["featureSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "featureSetName", *parsed) + if id.FeatureSetName, ok = input.Parsed["featureSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "featureSetName", input) } - return &id, nil + return nil } // ValidateFeatureSetID checks that 'input' can be parsed as a Feature Set ID diff --git a/resource-manager/machinelearningservices/2023-10-01/featuresetversion/id_featuresetversion.go b/resource-manager/machinelearningservices/2023-10-01/featuresetversion/id_featuresetversion.go index 51049976166..f61ab4f0ec7 100644 --- a/resource-manager/machinelearningservices/2023-10-01/featuresetversion/id_featuresetversion.go +++ b/resource-manager/machinelearningservices/2023-10-01/featuresetversion/id_featuresetversion.go @@ -40,27 +40,9 @@ func ParseFeatureSetVersionID(input string) (*FeatureSetVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FeatureSetVersionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.FeatureSetName, ok = parsed.Parsed["featureSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "featureSetName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseFeatureSetVersionIDInsensitively(input string) (*FeatureSetVersionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FeatureSetVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *FeatureSetVersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.FeatureSetName, ok = parsed.Parsed["featureSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "featureSetName", *parsed) + if id.FeatureSetName, ok = input.Parsed["featureSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "featureSetName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateFeatureSetVersionID checks that 'input' can be parsed as a Feature Set Version ID diff --git a/resource-manager/machinelearningservices/2023-10-01/featurestoreentitycontainer/id_featurestoreentity.go b/resource-manager/machinelearningservices/2023-10-01/featurestoreentitycontainer/id_featurestoreentity.go index 36795761ba8..b2554ec5c56 100644 --- a/resource-manager/machinelearningservices/2023-10-01/featurestoreentitycontainer/id_featurestoreentity.go +++ b/resource-manager/machinelearningservices/2023-10-01/featurestoreentitycontainer/id_featurestoreentity.go @@ -38,23 +38,9 @@ func ParseFeatureStoreEntityID(input string) (*FeatureStoreEntityId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FeatureStoreEntityId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.FeatureStoreEntityName, ok = parsed.Parsed["featureStoreEntityName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "featureStoreEntityName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFeatureStoreEntityIDInsensitively(input string) (*FeatureStoreEntityId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FeatureStoreEntityId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FeatureStoreEntityId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.FeatureStoreEntityName, ok = parsed.Parsed["featureStoreEntityName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "featureStoreEntityName", *parsed) + if id.FeatureStoreEntityName, ok = input.Parsed["featureStoreEntityName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "featureStoreEntityName", input) } - return &id, nil + return nil } // ValidateFeatureStoreEntityID checks that 'input' can be parsed as a Feature Store Entity ID diff --git a/resource-manager/machinelearningservices/2023-10-01/featurestoreentitycontainer/id_workspace.go b/resource-manager/machinelearningservices/2023-10-01/featurestoreentitycontainer/id_workspace.go index 26ccba327bd..388cf563cfb 100644 --- a/resource-manager/machinelearningservices/2023-10-01/featurestoreentitycontainer/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-10-01/featurestoreentitycontainer/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-10-01/featurestoreentityversion/id_featurestoreentity.go b/resource-manager/machinelearningservices/2023-10-01/featurestoreentityversion/id_featurestoreentity.go index ca8548c2517..62bde10f848 100644 --- a/resource-manager/machinelearningservices/2023-10-01/featurestoreentityversion/id_featurestoreentity.go +++ b/resource-manager/machinelearningservices/2023-10-01/featurestoreentityversion/id_featurestoreentity.go @@ -38,23 +38,9 @@ func ParseFeatureStoreEntityID(input string) (*FeatureStoreEntityId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FeatureStoreEntityId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.FeatureStoreEntityName, ok = parsed.Parsed["featureStoreEntityName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "featureStoreEntityName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFeatureStoreEntityIDInsensitively(input string) (*FeatureStoreEntityId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FeatureStoreEntityId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FeatureStoreEntityId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.FeatureStoreEntityName, ok = parsed.Parsed["featureStoreEntityName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "featureStoreEntityName", *parsed) + if id.FeatureStoreEntityName, ok = input.Parsed["featureStoreEntityName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "featureStoreEntityName", input) } - return &id, nil + return nil } // ValidateFeatureStoreEntityID checks that 'input' can be parsed as a Feature Store Entity ID diff --git a/resource-manager/machinelearningservices/2023-10-01/featurestoreentityversion/id_featurestoreentityversion.go b/resource-manager/machinelearningservices/2023-10-01/featurestoreentityversion/id_featurestoreentityversion.go index 621c16722e8..4ee7a03cfca 100644 --- a/resource-manager/machinelearningservices/2023-10-01/featurestoreentityversion/id_featurestoreentityversion.go +++ b/resource-manager/machinelearningservices/2023-10-01/featurestoreentityversion/id_featurestoreentityversion.go @@ -40,27 +40,9 @@ func ParseFeatureStoreEntityVersionID(input string) (*FeatureStoreEntityVersionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FeatureStoreEntityVersionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.FeatureStoreEntityName, ok = parsed.Parsed["featureStoreEntityName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "featureStoreEntityName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseFeatureStoreEntityVersionIDInsensitively(input string) (*FeatureStoreE return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FeatureStoreEntityVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *FeatureStoreEntityVersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.FeatureStoreEntityName, ok = parsed.Parsed["featureStoreEntityName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "featureStoreEntityName", *parsed) + if id.FeatureStoreEntityName, ok = input.Parsed["featureStoreEntityName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "featureStoreEntityName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateFeatureStoreEntityVersionID checks that 'input' can be parsed as a Feature Store Entity Version ID diff --git a/resource-manager/machinelearningservices/2023-10-01/job/id_job.go b/resource-manager/machinelearningservices/2023-10-01/job/id_job.go index 78aa3ecfea9..563223eca08 100644 --- a/resource-manager/machinelearningservices/2023-10-01/job/id_job.go +++ b/resource-manager/machinelearningservices/2023-10-01/job/id_job.go @@ -38,23 +38,9 @@ func ParseJobID(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseJobIDInsensitively(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *JobId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - return &id, nil + return nil } // ValidateJobID checks that 'input' can be parsed as a Job ID diff --git a/resource-manager/machinelearningservices/2023-10-01/job/id_workspace.go b/resource-manager/machinelearningservices/2023-10-01/job/id_workspace.go index d3d669da0a3..165bda1d6b0 100644 --- a/resource-manager/machinelearningservices/2023-10-01/job/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-10-01/job/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-10-01/machinelearningcomputes/id_compute.go b/resource-manager/machinelearningservices/2023-10-01/machinelearningcomputes/id_compute.go index 18a81277e2a..0a5c48c2b75 100644 --- a/resource-manager/machinelearningservices/2023-10-01/machinelearningcomputes/id_compute.go +++ b/resource-manager/machinelearningservices/2023-10-01/machinelearningcomputes/id_compute.go @@ -38,23 +38,9 @@ func ParseComputeID(input string) (*ComputeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComputeId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ComputeName, ok = parsed.Parsed["computeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "computeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseComputeIDInsensitively(input string) (*ComputeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComputeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ComputeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ComputeName, ok = parsed.Parsed["computeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "computeName", *parsed) + if id.ComputeName, ok = input.Parsed["computeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "computeName", input) } - return &id, nil + return nil } // ValidateComputeID checks that 'input' can be parsed as a Compute ID diff --git a/resource-manager/machinelearningservices/2023-10-01/machinelearningcomputes/id_workspace.go b/resource-manager/machinelearningservices/2023-10-01/machinelearningcomputes/id_workspace.go index 433fbb7591c..97b8f1ce442 100644 --- a/resource-manager/machinelearningservices/2023-10-01/machinelearningcomputes/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-10-01/machinelearningcomputes/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-10-01/managednetwork/id_outboundrule.go b/resource-manager/machinelearningservices/2023-10-01/managednetwork/id_outboundrule.go index 7df4f2db9c0..570d87bc6c8 100644 --- a/resource-manager/machinelearningservices/2023-10-01/managednetwork/id_outboundrule.go +++ b/resource-manager/machinelearningservices/2023-10-01/managednetwork/id_outboundrule.go @@ -38,23 +38,9 @@ func ParseOutboundRuleID(input string) (*OutboundRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OutboundRuleId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.OutboundRuleName, ok = parsed.Parsed["outboundRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "outboundRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseOutboundRuleIDInsensitively(input string) (*OutboundRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OutboundRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OutboundRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.OutboundRuleName, ok = parsed.Parsed["outboundRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "outboundRuleName", *parsed) + if id.OutboundRuleName, ok = input.Parsed["outboundRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "outboundRuleName", input) } - return &id, nil + return nil } // ValidateOutboundRuleID checks that 'input' can be parsed as a Outbound Rule ID diff --git a/resource-manager/machinelearningservices/2023-10-01/managednetwork/id_workspace.go b/resource-manager/machinelearningservices/2023-10-01/managednetwork/id_workspace.go index cd316134cb8..935643db062 100644 --- a/resource-manager/machinelearningservices/2023-10-01/managednetwork/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-10-01/managednetwork/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-10-01/modelcontainer/id_model.go b/resource-manager/machinelearningservices/2023-10-01/modelcontainer/id_model.go index ba14ca74245..51fa4a9d96b 100644 --- a/resource-manager/machinelearningservices/2023-10-01/modelcontainer/id_model.go +++ b/resource-manager/machinelearningservices/2023-10-01/modelcontainer/id_model.go @@ -38,23 +38,9 @@ func ParseModelID(input string) (*ModelId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModelId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ModelName, ok = parsed.Parsed["modelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "modelName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseModelIDInsensitively(input string) (*ModelId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModelId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ModelId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ModelName, ok = parsed.Parsed["modelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "modelName", *parsed) + if id.ModelName, ok = input.Parsed["modelName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "modelName", input) } - return &id, nil + return nil } // ValidateModelID checks that 'input' can be parsed as a Model ID diff --git a/resource-manager/machinelearningservices/2023-10-01/modelcontainer/id_registry.go b/resource-manager/machinelearningservices/2023-10-01/modelcontainer/id_registry.go index 59c61078645..228bb2dd58a 100644 --- a/resource-manager/machinelearningservices/2023-10-01/modelcontainer/id_registry.go +++ b/resource-manager/machinelearningservices/2023-10-01/modelcontainer/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/machinelearningservices/2023-10-01/modelcontainer/id_registrymodel.go b/resource-manager/machinelearningservices/2023-10-01/modelcontainer/id_registrymodel.go index f693ceb1cd4..4c44602fde0 100644 --- a/resource-manager/machinelearningservices/2023-10-01/modelcontainer/id_registrymodel.go +++ b/resource-manager/machinelearningservices/2023-10-01/modelcontainer/id_registrymodel.go @@ -38,23 +38,9 @@ func ParseRegistryModelID(input string) (*RegistryModelId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryModelId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.ModelName, ok = parsed.Parsed["modelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "modelName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRegistryModelIDInsensitively(input string) (*RegistryModelId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryModelId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RegistryModelId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.ModelName, ok = parsed.Parsed["modelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "modelName", *parsed) + if id.ModelName, ok = input.Parsed["modelName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "modelName", input) } - return &id, nil + return nil } // ValidateRegistryModelID checks that 'input' can be parsed as a Registry Model ID diff --git a/resource-manager/machinelearningservices/2023-10-01/modelcontainer/id_workspace.go b/resource-manager/machinelearningservices/2023-10-01/modelcontainer/id_workspace.go index bbc169a54bc..3e2ad09c644 100644 --- a/resource-manager/machinelearningservices/2023-10-01/modelcontainer/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-10-01/modelcontainer/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-10-01/modelversion/id_model.go b/resource-manager/machinelearningservices/2023-10-01/modelversion/id_model.go index 46520fef955..1ac17714a02 100644 --- a/resource-manager/machinelearningservices/2023-10-01/modelversion/id_model.go +++ b/resource-manager/machinelearningservices/2023-10-01/modelversion/id_model.go @@ -38,23 +38,9 @@ func ParseModelID(input string) (*ModelId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModelId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ModelName, ok = parsed.Parsed["modelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "modelName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseModelIDInsensitively(input string) (*ModelId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModelId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ModelId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ModelName, ok = parsed.Parsed["modelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "modelName", *parsed) + if id.ModelName, ok = input.Parsed["modelName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "modelName", input) } - return &id, nil + return nil } // ValidateModelID checks that 'input' can be parsed as a Model ID diff --git a/resource-manager/machinelearningservices/2023-10-01/modelversion/id_modelversion.go b/resource-manager/machinelearningservices/2023-10-01/modelversion/id_modelversion.go index fa93daf0849..cc122322e68 100644 --- a/resource-manager/machinelearningservices/2023-10-01/modelversion/id_modelversion.go +++ b/resource-manager/machinelearningservices/2023-10-01/modelversion/id_modelversion.go @@ -40,27 +40,9 @@ func ParseModelVersionID(input string) (*ModelVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModelVersionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ModelName, ok = parsed.Parsed["modelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "modelName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseModelVersionIDInsensitively(input string) (*ModelVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModelVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ModelVersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ModelName, ok = parsed.Parsed["modelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "modelName", *parsed) + if id.ModelName, ok = input.Parsed["modelName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "modelName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateModelVersionID checks that 'input' can be parsed as a Model Version ID diff --git a/resource-manager/machinelearningservices/2023-10-01/modelversion/id_registrymodel.go b/resource-manager/machinelearningservices/2023-10-01/modelversion/id_registrymodel.go index 1457bb80bf6..db02121a75f 100644 --- a/resource-manager/machinelearningservices/2023-10-01/modelversion/id_registrymodel.go +++ b/resource-manager/machinelearningservices/2023-10-01/modelversion/id_registrymodel.go @@ -38,23 +38,9 @@ func ParseRegistryModelID(input string) (*RegistryModelId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryModelId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.ModelName, ok = parsed.Parsed["modelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "modelName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRegistryModelIDInsensitively(input string) (*RegistryModelId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryModelId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RegistryModelId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.ModelName, ok = parsed.Parsed["modelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "modelName", *parsed) + if id.ModelName, ok = input.Parsed["modelName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "modelName", input) } - return &id, nil + return nil } // ValidateRegistryModelID checks that 'input' can be parsed as a Registry Model ID diff --git a/resource-manager/machinelearningservices/2023-10-01/modelversion/id_registrymodelversion.go b/resource-manager/machinelearningservices/2023-10-01/modelversion/id_registrymodelversion.go index 2dfe2ef8206..305f6537025 100644 --- a/resource-manager/machinelearningservices/2023-10-01/modelversion/id_registrymodelversion.go +++ b/resource-manager/machinelearningservices/2023-10-01/modelversion/id_registrymodelversion.go @@ -40,27 +40,9 @@ func ParseRegistryModelVersionID(input string) (*RegistryModelVersionId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryModelVersionId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) - } - - if id.ModelName, ok = parsed.Parsed["modelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "modelName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseRegistryModelVersionIDInsensitively(input string) (*RegistryModelVersi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryModelVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RegistryModelVersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - if id.ModelName, ok = parsed.Parsed["modelName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "modelName", *parsed) + if id.ModelName, ok = input.Parsed["modelName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "modelName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateRegistryModelVersionID checks that 'input' can be parsed as a Registry Model Version ID diff --git a/resource-manager/machinelearningservices/2023-10-01/onlinedeployment/id_onlineendpoint.go b/resource-manager/machinelearningservices/2023-10-01/onlinedeployment/id_onlineendpoint.go index 936f0a50c4b..4c677589ea1 100644 --- a/resource-manager/machinelearningservices/2023-10-01/onlinedeployment/id_onlineendpoint.go +++ b/resource-manager/machinelearningservices/2023-10-01/onlinedeployment/id_onlineendpoint.go @@ -38,23 +38,9 @@ func ParseOnlineEndpointID(input string) (*OnlineEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OnlineEndpointId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.OnlineEndpointName, ok = parsed.Parsed["onlineEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "onlineEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseOnlineEndpointIDInsensitively(input string) (*OnlineEndpointId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OnlineEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OnlineEndpointId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.OnlineEndpointName, ok = parsed.Parsed["onlineEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "onlineEndpointName", *parsed) + if id.OnlineEndpointName, ok = input.Parsed["onlineEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "onlineEndpointName", input) } - return &id, nil + return nil } // ValidateOnlineEndpointID checks that 'input' can be parsed as a Online Endpoint ID diff --git a/resource-manager/machinelearningservices/2023-10-01/onlinedeployment/id_onlineendpointdeployment.go b/resource-manager/machinelearningservices/2023-10-01/onlinedeployment/id_onlineendpointdeployment.go index 9aaeccc9396..2d307a61a3d 100644 --- a/resource-manager/machinelearningservices/2023-10-01/onlinedeployment/id_onlineendpointdeployment.go +++ b/resource-manager/machinelearningservices/2023-10-01/onlinedeployment/id_onlineendpointdeployment.go @@ -40,27 +40,9 @@ func ParseOnlineEndpointDeploymentID(input string) (*OnlineEndpointDeploymentId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OnlineEndpointDeploymentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.OnlineEndpointName, ok = parsed.Parsed["onlineEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "onlineEndpointName", *parsed) - } - - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseOnlineEndpointDeploymentIDInsensitively(input string) (*OnlineEndpoint return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OnlineEndpointDeploymentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *OnlineEndpointDeploymentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.OnlineEndpointName, ok = parsed.Parsed["onlineEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "onlineEndpointName", *parsed) + if id.OnlineEndpointName, ok = input.Parsed["onlineEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "onlineEndpointName", input) } - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if id.DeploymentName, ok = input.Parsed["deploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", input) } - return &id, nil + return nil } // ValidateOnlineEndpointDeploymentID checks that 'input' can be parsed as a Online Endpoint Deployment ID diff --git a/resource-manager/machinelearningservices/2023-10-01/onlineendpoint/id_onlineendpoint.go b/resource-manager/machinelearningservices/2023-10-01/onlineendpoint/id_onlineendpoint.go index 6c5c1518e8e..f258feb0620 100644 --- a/resource-manager/machinelearningservices/2023-10-01/onlineendpoint/id_onlineendpoint.go +++ b/resource-manager/machinelearningservices/2023-10-01/onlineendpoint/id_onlineendpoint.go @@ -38,23 +38,9 @@ func ParseOnlineEndpointID(input string) (*OnlineEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OnlineEndpointId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.OnlineEndpointName, ok = parsed.Parsed["onlineEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "onlineEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseOnlineEndpointIDInsensitively(input string) (*OnlineEndpointId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OnlineEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OnlineEndpointId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.OnlineEndpointName, ok = parsed.Parsed["onlineEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "onlineEndpointName", *parsed) + if id.OnlineEndpointName, ok = input.Parsed["onlineEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "onlineEndpointName", input) } - return &id, nil + return nil } // ValidateOnlineEndpointID checks that 'input' can be parsed as a Online Endpoint ID diff --git a/resource-manager/machinelearningservices/2023-10-01/onlineendpoint/id_workspace.go b/resource-manager/machinelearningservices/2023-10-01/onlineendpoint/id_workspace.go index 91faec139dc..1a4a0f46e0b 100644 --- a/resource-manager/machinelearningservices/2023-10-01/onlineendpoint/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-10-01/onlineendpoint/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-10-01/operationalizationclusters/id_compute.go b/resource-manager/machinelearningservices/2023-10-01/operationalizationclusters/id_compute.go index e793df52d8b..de3a0b9b0ac 100644 --- a/resource-manager/machinelearningservices/2023-10-01/operationalizationclusters/id_compute.go +++ b/resource-manager/machinelearningservices/2023-10-01/operationalizationclusters/id_compute.go @@ -38,23 +38,9 @@ func ParseComputeID(input string) (*ComputeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComputeId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ComputeName, ok = parsed.Parsed["computeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "computeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseComputeIDInsensitively(input string) (*ComputeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ComputeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ComputeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ComputeName, ok = parsed.Parsed["computeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "computeName", *parsed) + if id.ComputeName, ok = input.Parsed["computeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "computeName", input) } - return &id, nil + return nil } // ValidateComputeID checks that 'input' can be parsed as a Compute ID diff --git a/resource-manager/machinelearningservices/2023-10-01/operationalizationclusters/id_workspace.go b/resource-manager/machinelearningservices/2023-10-01/operationalizationclusters/id_workspace.go index 45ab1f8a7dd..856c1bd01eb 100644 --- a/resource-manager/machinelearningservices/2023-10-01/operationalizationclusters/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-10-01/operationalizationclusters/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-10-01/outboundnetworkdependenciesendpoints/id_workspace.go b/resource-manager/machinelearningservices/2023-10-01/outboundnetworkdependenciesendpoints/id_workspace.go index f2100fe9487..009611da59e 100644 --- a/resource-manager/machinelearningservices/2023-10-01/outboundnetworkdependenciesendpoints/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-10-01/outboundnetworkdependenciesendpoints/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-10-01/privateendpointconnections/id_workspace.go b/resource-manager/machinelearningservices/2023-10-01/privateendpointconnections/id_workspace.go index 8a826c3113b..da4a60605e1 100644 --- a/resource-manager/machinelearningservices/2023-10-01/privateendpointconnections/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-10-01/privateendpointconnections/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-10-01/proxyoperations/id_workspace.go b/resource-manager/machinelearningservices/2023-10-01/proxyoperations/id_workspace.go index d0a1746d097..41efeaaa051 100644 --- a/resource-manager/machinelearningservices/2023-10-01/proxyoperations/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-10-01/proxyoperations/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-10-01/quota/id_location.go b/resource-manager/machinelearningservices/2023-10-01/quota/id_location.go index 40067b81ab7..f7b04cfd405 100644 --- a/resource-manager/machinelearningservices/2023-10-01/quota/id_location.go +++ b/resource-manager/machinelearningservices/2023-10-01/quota/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/machinelearningservices/2023-10-01/registrymanagement/id_registry.go b/resource-manager/machinelearningservices/2023-10-01/registrymanagement/id_registry.go index 8d966b0f9d9..8e3950d727a 100644 --- a/resource-manager/machinelearningservices/2023-10-01/registrymanagement/id_registry.go +++ b/resource-manager/machinelearningservices/2023-10-01/registrymanagement/id_registry.go @@ -36,19 +36,9 @@ func ParseRegistryID(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} - - 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.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegistryIDInsensitively(input string) (*RegistryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegistryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegistryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RegistryName, ok = parsed.Parsed["registryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registryName", *parsed) + if id.RegistryName, ok = input.Parsed["registryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registryName", input) } - return &id, nil + return nil } // ValidateRegistryID checks that 'input' can be parsed as a Registry ID diff --git a/resource-manager/machinelearningservices/2023-10-01/schedule/id_schedule.go b/resource-manager/machinelearningservices/2023-10-01/schedule/id_schedule.go index 8d367d00b21..4eb871cac1c 100644 --- a/resource-manager/machinelearningservices/2023-10-01/schedule/id_schedule.go +++ b/resource-manager/machinelearningservices/2023-10-01/schedule/id_schedule.go @@ -38,23 +38,9 @@ func ParseScheduleID(input string) (*ScheduleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScheduleId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ScheduleName, ok = parsed.Parsed["scheduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseScheduleIDInsensitively(input string) (*ScheduleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScheduleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ScheduleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ScheduleName, ok = parsed.Parsed["scheduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", *parsed) + if id.ScheduleName, ok = input.Parsed["scheduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scheduleName", input) } - return &id, nil + return nil } // ValidateScheduleID checks that 'input' can be parsed as a Schedule ID diff --git a/resource-manager/machinelearningservices/2023-10-01/schedule/id_workspace.go b/resource-manager/machinelearningservices/2023-10-01/schedule/id_workspace.go index d96ff4474fd..c8222a7ca8e 100644 --- a/resource-manager/machinelearningservices/2023-10-01/schedule/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-10-01/schedule/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-10-01/v2workspaceconnectionresource/id_connection.go b/resource-manager/machinelearningservices/2023-10-01/v2workspaceconnectionresource/id_connection.go index a0b502452b4..b9a5e5d30c4 100644 --- a/resource-manager/machinelearningservices/2023-10-01/v2workspaceconnectionresource/id_connection.go +++ b/resource-manager/machinelearningservices/2023-10-01/v2workspaceconnectionresource/id_connection.go @@ -38,23 +38,9 @@ func ParseConnectionID(input string) (*ConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ConnectionName, ok = parsed.Parsed["connectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConnectionIDInsensitively(input string) (*ConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ConnectionName, ok = parsed.Parsed["connectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionName", *parsed) + if id.ConnectionName, ok = input.Parsed["connectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectionName", input) } - return &id, nil + return nil } // ValidateConnectionID checks that 'input' can be parsed as a Connection ID diff --git a/resource-manager/machinelearningservices/2023-10-01/v2workspaceconnectionresource/id_workspace.go b/resource-manager/machinelearningservices/2023-10-01/v2workspaceconnectionresource/id_workspace.go index 4883dc4d002..81abcff93a9 100644 --- a/resource-manager/machinelearningservices/2023-10-01/v2workspaceconnectionresource/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-10-01/v2workspaceconnectionresource/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-10-01/virtualmachinesizes/id_location.go b/resource-manager/machinelearningservices/2023-10-01/virtualmachinesizes/id_location.go index 5b66f44c4f7..d887c2fb51f 100644 --- a/resource-manager/machinelearningservices/2023-10-01/virtualmachinesizes/id_location.go +++ b/resource-manager/machinelearningservices/2023-10-01/virtualmachinesizes/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/machinelearningservices/2023-10-01/workspaceprivateendpointconnections/id_privateendpointconnection.go b/resource-manager/machinelearningservices/2023-10-01/workspaceprivateendpointconnections/id_privateendpointconnection.go index e919def8163..3b6dfbac90e 100644 --- a/resource-manager/machinelearningservices/2023-10-01/workspaceprivateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/machinelearningservices/2023-10-01/workspaceprivateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/machinelearningservices/2023-10-01/workspaceprivatelinkresources/id_workspace.go b/resource-manager/machinelearningservices/2023-10-01/workspaceprivatelinkresources/id_workspace.go index 899fa30b3b8..5297b76da47 100644 --- a/resource-manager/machinelearningservices/2023-10-01/workspaceprivatelinkresources/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-10-01/workspaceprivatelinkresources/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/machinelearningservices/2023-10-01/workspaces/id_workspace.go b/resource-manager/machinelearningservices/2023-10-01/workspaces/id_workspace.go index c37f08503e2..42b6e9c9d8a 100644 --- a/resource-manager/machinelearningservices/2023-10-01/workspaces/id_workspace.go +++ b/resource-manager/machinelearningservices/2023-10-01/workspaces/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/maintenance/2021-05-01/applyupdates/id_scopedapplyupdate.go b/resource-manager/maintenance/2021-05-01/applyupdates/id_scopedapplyupdate.go index cd96cf801dd..82b2d6f700f 100644 --- a/resource-manager/maintenance/2021-05-01/applyupdates/id_scopedapplyupdate.go +++ b/resource-manager/maintenance/2021-05-01/applyupdates/id_scopedapplyupdate.go @@ -34,15 +34,9 @@ func ParseScopedApplyUpdateID(input string) (*ScopedApplyUpdateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedApplyUpdateId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.ApplyUpdateName, ok = parsed.Parsed["applyUpdateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applyUpdateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedApplyUpdateIDInsensitively(input string) (*ScopedApplyUpdateId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedApplyUpdateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedApplyUpdateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.ApplyUpdateName, ok = parsed.Parsed["applyUpdateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applyUpdateName", *parsed) + if id.ApplyUpdateName, ok = input.Parsed["applyUpdateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applyUpdateName", input) } - return &id, nil + return nil } // ValidateScopedApplyUpdateID checks that 'input' can be parsed as a Scoped Apply Update ID diff --git a/resource-manager/maintenance/2021-05-01/configurationassignments/id_scopedconfigurationassignment.go b/resource-manager/maintenance/2021-05-01/configurationassignments/id_scopedconfigurationassignment.go index 9f95acbccce..38308f6c50c 100644 --- a/resource-manager/maintenance/2021-05-01/configurationassignments/id_scopedconfigurationassignment.go +++ b/resource-manager/maintenance/2021-05-01/configurationassignments/id_scopedconfigurationassignment.go @@ -34,15 +34,9 @@ func ParseScopedConfigurationAssignmentID(input string) (*ScopedConfigurationAss return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedConfigurationAssignmentId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.ConfigurationAssignmentName, ok = parsed.Parsed["configurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationAssignmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedConfigurationAssignmentIDInsensitively(input string) (*ScopedCon return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedConfigurationAssignmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedConfigurationAssignmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.ConfigurationAssignmentName, ok = parsed.Parsed["configurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationAssignmentName", *parsed) + if id.ConfigurationAssignmentName, ok = input.Parsed["configurationAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationAssignmentName", input) } - return &id, nil + return nil } // ValidateScopedConfigurationAssignmentID checks that 'input' can be parsed as a Scoped Configuration Assignment ID diff --git a/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/id_maintenanceconfiguration.go b/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/id_maintenanceconfiguration.go index 243e35bb5ca..51e5deca667 100644 --- a/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/id_maintenanceconfiguration.go +++ b/resource-manager/maintenance/2021-05-01/maintenanceconfigurations/id_maintenanceconfiguration.go @@ -36,19 +36,9 @@ func ParseMaintenanceConfigurationID(input string) (*MaintenanceConfigurationId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MaintenanceConfigurationId{} - - 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.MaintenanceConfigurationName, ok = parsed.Parsed["maintenanceConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "maintenanceConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMaintenanceConfigurationIDInsensitively(input string) (*MaintenanceCon return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MaintenanceConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MaintenanceConfigurationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MaintenanceConfigurationName, ok = parsed.Parsed["maintenanceConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "maintenanceConfigurationName", *parsed) + if id.MaintenanceConfigurationName, ok = input.Parsed["maintenanceConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "maintenanceConfigurationName", input) } - return &id, nil + return nil } // ValidateMaintenanceConfigurationID checks that 'input' can be parsed as a Maintenance Configuration ID diff --git a/resource-manager/maintenance/2021-05-01/publicmaintenanceconfigurations/id_publicmaintenanceconfiguration.go b/resource-manager/maintenance/2021-05-01/publicmaintenanceconfigurations/id_publicmaintenanceconfiguration.go index d8e3c20a03c..5f65e496d30 100644 --- a/resource-manager/maintenance/2021-05-01/publicmaintenanceconfigurations/id_publicmaintenanceconfiguration.go +++ b/resource-manager/maintenance/2021-05-01/publicmaintenanceconfigurations/id_publicmaintenanceconfiguration.go @@ -34,15 +34,9 @@ func ParsePublicMaintenanceConfigurationID(input string) (*PublicMaintenanceConf return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PublicMaintenanceConfigurationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.PublicMaintenanceConfigurationName, ok = parsed.Parsed["publicMaintenanceConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publicMaintenanceConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParsePublicMaintenanceConfigurationIDInsensitively(input string) (*PublicMa return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PublicMaintenanceConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *PublicMaintenanceConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.PublicMaintenanceConfigurationName, ok = parsed.Parsed["publicMaintenanceConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publicMaintenanceConfigurationName", *parsed) + if id.PublicMaintenanceConfigurationName, ok = input.Parsed["publicMaintenanceConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publicMaintenanceConfigurationName", input) } - return &id, nil + return nil } // ValidatePublicMaintenanceConfigurationID checks that 'input' can be parsed as a Public Maintenance Configuration ID diff --git a/resource-manager/maintenance/2022-07-01-preview/applyupdates/id_scopedapplyupdate.go b/resource-manager/maintenance/2022-07-01-preview/applyupdates/id_scopedapplyupdate.go index cd96cf801dd..82b2d6f700f 100644 --- a/resource-manager/maintenance/2022-07-01-preview/applyupdates/id_scopedapplyupdate.go +++ b/resource-manager/maintenance/2022-07-01-preview/applyupdates/id_scopedapplyupdate.go @@ -34,15 +34,9 @@ func ParseScopedApplyUpdateID(input string) (*ScopedApplyUpdateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedApplyUpdateId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.ApplyUpdateName, ok = parsed.Parsed["applyUpdateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applyUpdateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedApplyUpdateIDInsensitively(input string) (*ScopedApplyUpdateId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedApplyUpdateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedApplyUpdateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.ApplyUpdateName, ok = parsed.Parsed["applyUpdateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applyUpdateName", *parsed) + if id.ApplyUpdateName, ok = input.Parsed["applyUpdateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applyUpdateName", input) } - return &id, nil + return nil } // ValidateScopedApplyUpdateID checks that 'input' can be parsed as a Scoped Apply Update ID diff --git a/resource-manager/maintenance/2022-07-01-preview/configurationassignments/id_scopedconfigurationassignment.go b/resource-manager/maintenance/2022-07-01-preview/configurationassignments/id_scopedconfigurationassignment.go index 9f95acbccce..38308f6c50c 100644 --- a/resource-manager/maintenance/2022-07-01-preview/configurationassignments/id_scopedconfigurationassignment.go +++ b/resource-manager/maintenance/2022-07-01-preview/configurationassignments/id_scopedconfigurationassignment.go @@ -34,15 +34,9 @@ func ParseScopedConfigurationAssignmentID(input string) (*ScopedConfigurationAss return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedConfigurationAssignmentId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.ConfigurationAssignmentName, ok = parsed.Parsed["configurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationAssignmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedConfigurationAssignmentIDInsensitively(input string) (*ScopedCon return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedConfigurationAssignmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedConfigurationAssignmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.ConfigurationAssignmentName, ok = parsed.Parsed["configurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationAssignmentName", *parsed) + if id.ConfigurationAssignmentName, ok = input.Parsed["configurationAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationAssignmentName", input) } - return &id, nil + return nil } // ValidateScopedConfigurationAssignmentID checks that 'input' can be parsed as a Scoped Configuration Assignment ID diff --git a/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations/id_maintenanceconfiguration.go b/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations/id_maintenanceconfiguration.go index 243e35bb5ca..51e5deca667 100644 --- a/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations/id_maintenanceconfiguration.go +++ b/resource-manager/maintenance/2022-07-01-preview/maintenanceconfigurations/id_maintenanceconfiguration.go @@ -36,19 +36,9 @@ func ParseMaintenanceConfigurationID(input string) (*MaintenanceConfigurationId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MaintenanceConfigurationId{} - - 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.MaintenanceConfigurationName, ok = parsed.Parsed["maintenanceConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "maintenanceConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMaintenanceConfigurationIDInsensitively(input string) (*MaintenanceCon return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MaintenanceConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MaintenanceConfigurationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MaintenanceConfigurationName, ok = parsed.Parsed["maintenanceConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "maintenanceConfigurationName", *parsed) + if id.MaintenanceConfigurationName, ok = input.Parsed["maintenanceConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "maintenanceConfigurationName", input) } - return &id, nil + return nil } // ValidateMaintenanceConfigurationID checks that 'input' can be parsed as a Maintenance Configuration ID diff --git a/resource-manager/maintenance/2022-07-01-preview/publicmaintenanceconfigurations/id_publicmaintenanceconfiguration.go b/resource-manager/maintenance/2022-07-01-preview/publicmaintenanceconfigurations/id_publicmaintenanceconfiguration.go index d8e3c20a03c..5f65e496d30 100644 --- a/resource-manager/maintenance/2022-07-01-preview/publicmaintenanceconfigurations/id_publicmaintenanceconfiguration.go +++ b/resource-manager/maintenance/2022-07-01-preview/publicmaintenanceconfigurations/id_publicmaintenanceconfiguration.go @@ -34,15 +34,9 @@ func ParsePublicMaintenanceConfigurationID(input string) (*PublicMaintenanceConf return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PublicMaintenanceConfigurationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.PublicMaintenanceConfigurationName, ok = parsed.Parsed["publicMaintenanceConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publicMaintenanceConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParsePublicMaintenanceConfigurationIDInsensitively(input string) (*PublicMa return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PublicMaintenanceConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *PublicMaintenanceConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.PublicMaintenanceConfigurationName, ok = parsed.Parsed["publicMaintenanceConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publicMaintenanceConfigurationName", *parsed) + if id.PublicMaintenanceConfigurationName, ok = input.Parsed["publicMaintenanceConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publicMaintenanceConfigurationName", input) } - return &id, nil + return nil } // ValidatePublicMaintenanceConfigurationID checks that 'input' can be parsed as a Public Maintenance Configuration ID diff --git a/resource-manager/maintenance/2023-04-01/applyupdates/id_scopedapplyupdate.go b/resource-manager/maintenance/2023-04-01/applyupdates/id_scopedapplyupdate.go index cd96cf801dd..82b2d6f700f 100644 --- a/resource-manager/maintenance/2023-04-01/applyupdates/id_scopedapplyupdate.go +++ b/resource-manager/maintenance/2023-04-01/applyupdates/id_scopedapplyupdate.go @@ -34,15 +34,9 @@ func ParseScopedApplyUpdateID(input string) (*ScopedApplyUpdateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedApplyUpdateId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.ApplyUpdateName, ok = parsed.Parsed["applyUpdateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applyUpdateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedApplyUpdateIDInsensitively(input string) (*ScopedApplyUpdateId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedApplyUpdateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedApplyUpdateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.ApplyUpdateName, ok = parsed.Parsed["applyUpdateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applyUpdateName", *parsed) + if id.ApplyUpdateName, ok = input.Parsed["applyUpdateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applyUpdateName", input) } - return &id, nil + return nil } // ValidateScopedApplyUpdateID checks that 'input' can be parsed as a Scoped Apply Update ID diff --git a/resource-manager/maintenance/2023-04-01/configurationassignments/id_configurationassignment.go b/resource-manager/maintenance/2023-04-01/configurationassignments/id_configurationassignment.go index 229da97b84f..f723beb8c18 100644 --- a/resource-manager/maintenance/2023-04-01/configurationassignments/id_configurationassignment.go +++ b/resource-manager/maintenance/2023-04-01/configurationassignments/id_configurationassignment.go @@ -34,15 +34,9 @@ func ParseConfigurationAssignmentID(input string) (*ConfigurationAssignmentId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationAssignmentId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.ConfigurationAssignmentName, ok = parsed.Parsed["configurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationAssignmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseConfigurationAssignmentIDInsensitively(input string) (*ConfigurationAs return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationAssignmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ConfigurationAssignmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ConfigurationAssignmentName, ok = parsed.Parsed["configurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationAssignmentName", *parsed) + if id.ConfigurationAssignmentName, ok = input.Parsed["configurationAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationAssignmentName", input) } - return &id, nil + return nil } // ValidateConfigurationAssignmentID checks that 'input' can be parsed as a Configuration Assignment ID diff --git a/resource-manager/maintenance/2023-04-01/configurationassignments/id_providerconfigurationassignment.go b/resource-manager/maintenance/2023-04-01/configurationassignments/id_providerconfigurationassignment.go index 3058034339e..e70de84244d 100644 --- a/resource-manager/maintenance/2023-04-01/configurationassignments/id_providerconfigurationassignment.go +++ b/resource-manager/maintenance/2023-04-01/configurationassignments/id_providerconfigurationassignment.go @@ -36,19 +36,9 @@ func ParseProviderConfigurationAssignmentID(input string) (*ProviderConfiguratio return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderConfigurationAssignmentId{} - - 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.ConfigurationAssignmentName, ok = parsed.Parsed["configurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationAssignmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderConfigurationAssignmentIDInsensitively(input string) (*Provide return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderConfigurationAssignmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderConfigurationAssignmentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ConfigurationAssignmentName, ok = parsed.Parsed["configurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationAssignmentName", *parsed) + if id.ConfigurationAssignmentName, ok = input.Parsed["configurationAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationAssignmentName", input) } - return &id, nil + return nil } // ValidateProviderConfigurationAssignmentID checks that 'input' can be parsed as a Provider Configuration Assignment ID diff --git a/resource-manager/maintenance/2023-04-01/configurationassignments/id_scopedconfigurationassignment.go b/resource-manager/maintenance/2023-04-01/configurationassignments/id_scopedconfigurationassignment.go index 9f95acbccce..38308f6c50c 100644 --- a/resource-manager/maintenance/2023-04-01/configurationassignments/id_scopedconfigurationassignment.go +++ b/resource-manager/maintenance/2023-04-01/configurationassignments/id_scopedconfigurationassignment.go @@ -34,15 +34,9 @@ func ParseScopedConfigurationAssignmentID(input string) (*ScopedConfigurationAss return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedConfigurationAssignmentId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.ConfigurationAssignmentName, ok = parsed.Parsed["configurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationAssignmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedConfigurationAssignmentIDInsensitively(input string) (*ScopedCon return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedConfigurationAssignmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedConfigurationAssignmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.ConfigurationAssignmentName, ok = parsed.Parsed["configurationAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationAssignmentName", *parsed) + if id.ConfigurationAssignmentName, ok = input.Parsed["configurationAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationAssignmentName", input) } - return &id, nil + return nil } // ValidateScopedConfigurationAssignmentID checks that 'input' can be parsed as a Scoped Configuration Assignment ID diff --git a/resource-manager/maintenance/2023-04-01/maintenanceconfigurations/id_maintenanceconfiguration.go b/resource-manager/maintenance/2023-04-01/maintenanceconfigurations/id_maintenanceconfiguration.go index 243e35bb5ca..51e5deca667 100644 --- a/resource-manager/maintenance/2023-04-01/maintenanceconfigurations/id_maintenanceconfiguration.go +++ b/resource-manager/maintenance/2023-04-01/maintenanceconfigurations/id_maintenanceconfiguration.go @@ -36,19 +36,9 @@ func ParseMaintenanceConfigurationID(input string) (*MaintenanceConfigurationId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MaintenanceConfigurationId{} - - 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.MaintenanceConfigurationName, ok = parsed.Parsed["maintenanceConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "maintenanceConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMaintenanceConfigurationIDInsensitively(input string) (*MaintenanceCon return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MaintenanceConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MaintenanceConfigurationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MaintenanceConfigurationName, ok = parsed.Parsed["maintenanceConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "maintenanceConfigurationName", *parsed) + if id.MaintenanceConfigurationName, ok = input.Parsed["maintenanceConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "maintenanceConfigurationName", input) } - return &id, nil + return nil } // ValidateMaintenanceConfigurationID checks that 'input' can be parsed as a Maintenance Configuration ID diff --git a/resource-manager/maintenance/2023-04-01/publicmaintenanceconfigurations/id_publicmaintenanceconfiguration.go b/resource-manager/maintenance/2023-04-01/publicmaintenanceconfigurations/id_publicmaintenanceconfiguration.go index d8e3c20a03c..5f65e496d30 100644 --- a/resource-manager/maintenance/2023-04-01/publicmaintenanceconfigurations/id_publicmaintenanceconfiguration.go +++ b/resource-manager/maintenance/2023-04-01/publicmaintenanceconfigurations/id_publicmaintenanceconfiguration.go @@ -34,15 +34,9 @@ func ParsePublicMaintenanceConfigurationID(input string) (*PublicMaintenanceConf return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PublicMaintenanceConfigurationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.PublicMaintenanceConfigurationName, ok = parsed.Parsed["publicMaintenanceConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publicMaintenanceConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParsePublicMaintenanceConfigurationIDInsensitively(input string) (*PublicMa return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PublicMaintenanceConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *PublicMaintenanceConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.PublicMaintenanceConfigurationName, ok = parsed.Parsed["publicMaintenanceConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publicMaintenanceConfigurationName", *parsed) + if id.PublicMaintenanceConfigurationName, ok = input.Parsed["publicMaintenanceConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publicMaintenanceConfigurationName", input) } - return &id, nil + return nil } // ValidatePublicMaintenanceConfigurationID checks that 'input' can be parsed as a Public Maintenance Configuration ID diff --git a/resource-manager/managedapplications/2019-07-01/applicationdefinitions/id_applicationdefinition.go b/resource-manager/managedapplications/2019-07-01/applicationdefinitions/id_applicationdefinition.go index 833c66e0683..9871b0ac2a6 100644 --- a/resource-manager/managedapplications/2019-07-01/applicationdefinitions/id_applicationdefinition.go +++ b/resource-manager/managedapplications/2019-07-01/applicationdefinitions/id_applicationdefinition.go @@ -36,19 +36,9 @@ func ParseApplicationDefinitionID(input string) (*ApplicationDefinitionId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationDefinitionId{} - - 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.ApplicationDefinitionName, ok = parsed.Parsed["applicationDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationDefinitionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseApplicationDefinitionIDInsensitively(input string) (*ApplicationDefini return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationDefinitionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ApplicationDefinitionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ApplicationDefinitionName, ok = parsed.Parsed["applicationDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationDefinitionName", *parsed) + if id.ApplicationDefinitionName, ok = input.Parsed["applicationDefinitionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationDefinitionName", input) } - return &id, nil + return nil } // ValidateApplicationDefinitionID checks that 'input' can be parsed as a Application Definition ID diff --git a/resource-manager/managedapplications/2019-07-01/applications/id_application.go b/resource-manager/managedapplications/2019-07-01/applications/id_application.go index 45d20c2e894..5a3a4e4e279 100644 --- a/resource-manager/managedapplications/2019-07-01/applications/id_application.go +++ b/resource-manager/managedapplications/2019-07-01/applications/id_application.go @@ -36,19 +36,9 @@ func ParseApplicationID(input string) (*ApplicationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationId{} - - 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.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseApplicationIDInsensitively(input string) (*ApplicationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ApplicationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) + if id.ApplicationName, ok = input.Parsed["applicationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationName", input) } - return &id, nil + return nil } // ValidateApplicationID checks that 'input' can be parsed as a Application ID diff --git a/resource-manager/managedapplications/2019-07-01/applications/id_applicationid.go b/resource-manager/managedapplications/2019-07-01/applications/id_applicationid.go index 2960c4ce29b..814441d13f6 100644 --- a/resource-manager/managedapplications/2019-07-01/applications/id_applicationid.go +++ b/resource-manager/managedapplications/2019-07-01/applications/id_applicationid.go @@ -32,11 +32,9 @@ func ParseApplicationIdID(input string) (*ApplicationIdId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationIdId{} - - if id.ApplicationId, ok = parsed.Parsed["applicationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseApplicationIdIDInsensitively(input string) (*ApplicationIdId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationIdId{} - - if id.ApplicationId, ok = parsed.Parsed["applicationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *ApplicationIdId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ApplicationId, ok = input.Parsed["applicationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationId", input) + } + + return nil +} + // ValidateApplicationIdID checks that 'input' can be parsed as a Application Id ID func ValidateApplicationIdID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/managedapplications/2019-07-01/jitrequests/id_jitrequest.go b/resource-manager/managedapplications/2019-07-01/jitrequests/id_jitrequest.go index 78146668dc6..4baebab13f5 100644 --- a/resource-manager/managedapplications/2019-07-01/jitrequests/id_jitrequest.go +++ b/resource-manager/managedapplications/2019-07-01/jitrequests/id_jitrequest.go @@ -36,19 +36,9 @@ func ParseJitRequestID(input string) (*JitRequestId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JitRequestId{} - - 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.JitRequestName, ok = parsed.Parsed["jitRequestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jitRequestName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseJitRequestIDInsensitively(input string) (*JitRequestId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JitRequestId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *JitRequestId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.JitRequestName, ok = parsed.Parsed["jitRequestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jitRequestName", *parsed) + if id.JitRequestName, ok = input.Parsed["jitRequestName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jitRequestName", input) } - return &id, nil + return nil } // ValidateJitRequestID checks that 'input' can be parsed as a Jit Request ID diff --git a/resource-manager/managedapplications/2021-07-01/applicationdefinitions/id_applicationdefinition.go b/resource-manager/managedapplications/2021-07-01/applicationdefinitions/id_applicationdefinition.go index 833c66e0683..9871b0ac2a6 100644 --- a/resource-manager/managedapplications/2021-07-01/applicationdefinitions/id_applicationdefinition.go +++ b/resource-manager/managedapplications/2021-07-01/applicationdefinitions/id_applicationdefinition.go @@ -36,19 +36,9 @@ func ParseApplicationDefinitionID(input string) (*ApplicationDefinitionId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationDefinitionId{} - - 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.ApplicationDefinitionName, ok = parsed.Parsed["applicationDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationDefinitionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseApplicationDefinitionIDInsensitively(input string) (*ApplicationDefini return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationDefinitionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ApplicationDefinitionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ApplicationDefinitionName, ok = parsed.Parsed["applicationDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationDefinitionName", *parsed) + if id.ApplicationDefinitionName, ok = input.Parsed["applicationDefinitionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationDefinitionName", input) } - return &id, nil + return nil } // ValidateApplicationDefinitionID checks that 'input' can be parsed as a Application Definition ID diff --git a/resource-manager/managedapplications/2021-07-01/applications/id_application.go b/resource-manager/managedapplications/2021-07-01/applications/id_application.go index 45d20c2e894..5a3a4e4e279 100644 --- a/resource-manager/managedapplications/2021-07-01/applications/id_application.go +++ b/resource-manager/managedapplications/2021-07-01/applications/id_application.go @@ -36,19 +36,9 @@ func ParseApplicationID(input string) (*ApplicationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationId{} - - 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.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseApplicationIDInsensitively(input string) (*ApplicationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ApplicationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) + if id.ApplicationName, ok = input.Parsed["applicationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationName", input) } - return &id, nil + return nil } // ValidateApplicationID checks that 'input' can be parsed as a Application ID diff --git a/resource-manager/managedapplications/2021-07-01/applications/id_applicationid.go b/resource-manager/managedapplications/2021-07-01/applications/id_applicationid.go index 2960c4ce29b..814441d13f6 100644 --- a/resource-manager/managedapplications/2021-07-01/applications/id_applicationid.go +++ b/resource-manager/managedapplications/2021-07-01/applications/id_applicationid.go @@ -32,11 +32,9 @@ func ParseApplicationIdID(input string) (*ApplicationIdId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationIdId{} - - if id.ApplicationId, ok = parsed.Parsed["applicationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseApplicationIdIDInsensitively(input string) (*ApplicationIdId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationIdId{} - - if id.ApplicationId, ok = parsed.Parsed["applicationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *ApplicationIdId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ApplicationId, ok = input.Parsed["applicationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationId", input) + } + + return nil +} + // ValidateApplicationIdID checks that 'input' can be parsed as a Application Id ID func ValidateApplicationIdID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/managedapplications/2021-07-01/jitrequests/id_jitrequest.go b/resource-manager/managedapplications/2021-07-01/jitrequests/id_jitrequest.go index 78146668dc6..4baebab13f5 100644 --- a/resource-manager/managedapplications/2021-07-01/jitrequests/id_jitrequest.go +++ b/resource-manager/managedapplications/2021-07-01/jitrequests/id_jitrequest.go @@ -36,19 +36,9 @@ func ParseJitRequestID(input string) (*JitRequestId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JitRequestId{} - - 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.JitRequestName, ok = parsed.Parsed["jitRequestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jitRequestName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseJitRequestIDInsensitively(input string) (*JitRequestId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JitRequestId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *JitRequestId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.JitRequestName, ok = parsed.Parsed["jitRequestName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jitRequestName", *parsed) + if id.JitRequestName, ok = input.Parsed["jitRequestName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jitRequestName", input) } - return &id, nil + return nil } // ValidateJitRequestID checks that 'input' can be parsed as a Jit Request ID diff --git a/resource-manager/managedidentity/2023-01-31/managedidentities/id_federatedidentitycredential.go b/resource-manager/managedidentity/2023-01-31/managedidentities/id_federatedidentitycredential.go index 66f4b9d0313..89f0189be53 100644 --- a/resource-manager/managedidentity/2023-01-31/managedidentities/id_federatedidentitycredential.go +++ b/resource-manager/managedidentity/2023-01-31/managedidentities/id_federatedidentitycredential.go @@ -38,23 +38,9 @@ func ParseFederatedIdentityCredentialID(input string) (*FederatedIdentityCredent return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FederatedIdentityCredentialId{} - - 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.UserAssignedIdentityName, ok = parsed.Parsed["userAssignedIdentityName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userAssignedIdentityName", *parsed) - } - - if id.FederatedIdentityCredentialName, ok = parsed.Parsed["federatedIdentityCredentialName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "federatedIdentityCredentialName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFederatedIdentityCredentialIDInsensitively(input string) (*FederatedId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FederatedIdentityCredentialId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FederatedIdentityCredentialId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.UserAssignedIdentityName, ok = parsed.Parsed["userAssignedIdentityName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userAssignedIdentityName", *parsed) + if id.UserAssignedIdentityName, ok = input.Parsed["userAssignedIdentityName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userAssignedIdentityName", input) } - if id.FederatedIdentityCredentialName, ok = parsed.Parsed["federatedIdentityCredentialName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "federatedIdentityCredentialName", *parsed) + if id.FederatedIdentityCredentialName, ok = input.Parsed["federatedIdentityCredentialName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "federatedIdentityCredentialName", input) } - return &id, nil + return nil } // ValidateFederatedIdentityCredentialID checks that 'input' can be parsed as a Federated Identity Credential ID diff --git a/resource-manager/managedservices/2019-06-01/registrationassignments/id_scopedregistrationassignment.go b/resource-manager/managedservices/2019-06-01/registrationassignments/id_scopedregistrationassignment.go index 890cb0e8375..07354542e4a 100644 --- a/resource-manager/managedservices/2019-06-01/registrationassignments/id_scopedregistrationassignment.go +++ b/resource-manager/managedservices/2019-06-01/registrationassignments/id_scopedregistrationassignment.go @@ -34,15 +34,9 @@ func ParseScopedRegistrationAssignmentID(input string) (*ScopedRegistrationAssig return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedRegistrationAssignmentId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.RegistrationAssignmentId, ok = parsed.Parsed["registrationAssignmentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registrationAssignmentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedRegistrationAssignmentIDInsensitively(input string) (*ScopedRegi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedRegistrationAssignmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedRegistrationAssignmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.RegistrationAssignmentId, ok = parsed.Parsed["registrationAssignmentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registrationAssignmentId", *parsed) + if id.RegistrationAssignmentId, ok = input.Parsed["registrationAssignmentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registrationAssignmentId", input) } - return &id, nil + return nil } // ValidateScopedRegistrationAssignmentID checks that 'input' can be parsed as a Scoped Registration Assignment ID diff --git a/resource-manager/managedservices/2019-06-01/registrationdefinitions/id_scopedregistrationdefinition.go b/resource-manager/managedservices/2019-06-01/registrationdefinitions/id_scopedregistrationdefinition.go index 43622d6c56f..fda27852326 100644 --- a/resource-manager/managedservices/2019-06-01/registrationdefinitions/id_scopedregistrationdefinition.go +++ b/resource-manager/managedservices/2019-06-01/registrationdefinitions/id_scopedregistrationdefinition.go @@ -34,15 +34,9 @@ func ParseScopedRegistrationDefinitionID(input string) (*ScopedRegistrationDefin return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedRegistrationDefinitionId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.RegistrationDefinitionId, ok = parsed.Parsed["registrationDefinitionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registrationDefinitionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedRegistrationDefinitionIDInsensitively(input string) (*ScopedRegi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedRegistrationDefinitionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedRegistrationDefinitionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.RegistrationDefinitionId, ok = parsed.Parsed["registrationDefinitionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registrationDefinitionId", *parsed) + if id.RegistrationDefinitionId, ok = input.Parsed["registrationDefinitionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registrationDefinitionId", input) } - return &id, nil + return nil } // ValidateScopedRegistrationDefinitionID checks that 'input' can be parsed as a Scoped Registration Definition ID diff --git a/resource-manager/managedservices/2022-10-01/marketplaceregistrationdefinitions/id_marketplaceregistrationdefinition.go b/resource-manager/managedservices/2022-10-01/marketplaceregistrationdefinitions/id_marketplaceregistrationdefinition.go index 658141aac75..2fbb722f1fc 100644 --- a/resource-manager/managedservices/2022-10-01/marketplaceregistrationdefinitions/id_marketplaceregistrationdefinition.go +++ b/resource-manager/managedservices/2022-10-01/marketplaceregistrationdefinitions/id_marketplaceregistrationdefinition.go @@ -32,11 +32,9 @@ func ParseMarketplaceRegistrationDefinitionID(input string) (*MarketplaceRegistr return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MarketplaceRegistrationDefinitionId{} - - if id.MarketplaceIdentifier, ok = parsed.Parsed["marketplaceIdentifier"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "marketplaceIdentifier", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseMarketplaceRegistrationDefinitionIDInsensitively(input string) (*Marke return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MarketplaceRegistrationDefinitionId{} - - if id.MarketplaceIdentifier, ok = parsed.Parsed["marketplaceIdentifier"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "marketplaceIdentifier", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *MarketplaceRegistrationDefinitionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.MarketplaceIdentifier, ok = input.Parsed["marketplaceIdentifier"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "marketplaceIdentifier", input) + } + + return nil +} + // ValidateMarketplaceRegistrationDefinitionID checks that 'input' can be parsed as a Marketplace Registration Definition ID func ValidateMarketplaceRegistrationDefinitionID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/managedservices/2022-10-01/marketplaceregistrationdefinitions/id_scopedmarketplaceregistrationdefinition.go b/resource-manager/managedservices/2022-10-01/marketplaceregistrationdefinitions/id_scopedmarketplaceregistrationdefinition.go index 6bfef7f1584..386bd542dab 100644 --- a/resource-manager/managedservices/2022-10-01/marketplaceregistrationdefinitions/id_scopedmarketplaceregistrationdefinition.go +++ b/resource-manager/managedservices/2022-10-01/marketplaceregistrationdefinitions/id_scopedmarketplaceregistrationdefinition.go @@ -34,15 +34,9 @@ func ParseScopedMarketplaceRegistrationDefinitionID(input string) (*ScopedMarket return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedMarketplaceRegistrationDefinitionId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.MarketplaceIdentifier, ok = parsed.Parsed["marketplaceIdentifier"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "marketplaceIdentifier", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedMarketplaceRegistrationDefinitionIDInsensitively(input string) ( return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedMarketplaceRegistrationDefinitionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedMarketplaceRegistrationDefinitionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.MarketplaceIdentifier, ok = parsed.Parsed["marketplaceIdentifier"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "marketplaceIdentifier", *parsed) + if id.MarketplaceIdentifier, ok = input.Parsed["marketplaceIdentifier"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "marketplaceIdentifier", input) } - return &id, nil + return nil } // ValidateScopedMarketplaceRegistrationDefinitionID checks that 'input' can be parsed as a Scoped Marketplace Registration Definition ID diff --git a/resource-manager/managedservices/2022-10-01/registrationassignments/id_scopedregistrationassignment.go b/resource-manager/managedservices/2022-10-01/registrationassignments/id_scopedregistrationassignment.go index 890cb0e8375..07354542e4a 100644 --- a/resource-manager/managedservices/2022-10-01/registrationassignments/id_scopedregistrationassignment.go +++ b/resource-manager/managedservices/2022-10-01/registrationassignments/id_scopedregistrationassignment.go @@ -34,15 +34,9 @@ func ParseScopedRegistrationAssignmentID(input string) (*ScopedRegistrationAssig return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedRegistrationAssignmentId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.RegistrationAssignmentId, ok = parsed.Parsed["registrationAssignmentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registrationAssignmentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedRegistrationAssignmentIDInsensitively(input string) (*ScopedRegi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedRegistrationAssignmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedRegistrationAssignmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.RegistrationAssignmentId, ok = parsed.Parsed["registrationAssignmentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registrationAssignmentId", *parsed) + if id.RegistrationAssignmentId, ok = input.Parsed["registrationAssignmentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registrationAssignmentId", input) } - return &id, nil + return nil } // ValidateScopedRegistrationAssignmentID checks that 'input' can be parsed as a Scoped Registration Assignment ID diff --git a/resource-manager/managedservices/2022-10-01/registrationdefinitions/id_scopedregistrationdefinition.go b/resource-manager/managedservices/2022-10-01/registrationdefinitions/id_scopedregistrationdefinition.go index 43622d6c56f..fda27852326 100644 --- a/resource-manager/managedservices/2022-10-01/registrationdefinitions/id_scopedregistrationdefinition.go +++ b/resource-manager/managedservices/2022-10-01/registrationdefinitions/id_scopedregistrationdefinition.go @@ -34,15 +34,9 @@ func ParseScopedRegistrationDefinitionID(input string) (*ScopedRegistrationDefin return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedRegistrationDefinitionId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.RegistrationDefinitionId, ok = parsed.Parsed["registrationDefinitionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registrationDefinitionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedRegistrationDefinitionIDInsensitively(input string) (*ScopedRegi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedRegistrationDefinitionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedRegistrationDefinitionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.RegistrationDefinitionId, ok = parsed.Parsed["registrationDefinitionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registrationDefinitionId", *parsed) + if id.RegistrationDefinitionId, ok = input.Parsed["registrationDefinitionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registrationDefinitionId", input) } - return &id, nil + return nil } // ValidateScopedRegistrationDefinitionID checks that 'input' can be parsed as a Scoped Registration Definition ID diff --git a/resource-manager/managementgroups/2020-05-01/managementgroups/id_subscription.go b/resource-manager/managementgroups/2020-05-01/managementgroups/id_subscription.go index f8c89ac6f22..0f0ce3d8033 100644 --- a/resource-manager/managementgroups/2020-05-01/managementgroups/id_subscription.go +++ b/resource-manager/managementgroups/2020-05-01/managementgroups/id_subscription.go @@ -34,15 +34,9 @@ func ParseSubscriptionID(input string) (*SubscriptionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SubscriptionId{} - - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) - } - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseSubscriptionIDInsensitively(input string) (*SubscriptionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SubscriptionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + return &id, nil +} + +func (id *SubscriptionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.GroupId, ok = input.Parsed["groupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "groupId", input) } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - return &id, nil + return nil } // ValidateSubscriptionID checks that 'input' can be parsed as a Subscription ID diff --git a/resource-manager/managementgroups/2021-04-01/managementgroups/id_subscription.go b/resource-manager/managementgroups/2021-04-01/managementgroups/id_subscription.go index f8c89ac6f22..0f0ce3d8033 100644 --- a/resource-manager/managementgroups/2021-04-01/managementgroups/id_subscription.go +++ b/resource-manager/managementgroups/2021-04-01/managementgroups/id_subscription.go @@ -34,15 +34,9 @@ func ParseSubscriptionID(input string) (*SubscriptionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SubscriptionId{} - - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) - } - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseSubscriptionIDInsensitively(input string) (*SubscriptionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SubscriptionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + return &id, nil +} + +func (id *SubscriptionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.GroupId, ok = input.Parsed["groupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "groupId", input) } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - return &id, nil + return nil } // ValidateSubscriptionID checks that 'input' can be parsed as a Subscription ID diff --git a/resource-manager/managementgroups/2023-04-01/managementgroups/id_subscription.go b/resource-manager/managementgroups/2023-04-01/managementgroups/id_subscription.go index f8c89ac6f22..0f0ce3d8033 100644 --- a/resource-manager/managementgroups/2023-04-01/managementgroups/id_subscription.go +++ b/resource-manager/managementgroups/2023-04-01/managementgroups/id_subscription.go @@ -34,15 +34,9 @@ func ParseSubscriptionID(input string) (*SubscriptionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SubscriptionId{} - - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) - } - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseSubscriptionIDInsensitively(input string) (*SubscriptionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SubscriptionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + return &id, nil +} + +func (id *SubscriptionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.GroupId, ok = input.Parsed["groupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "groupId", input) } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - return &id, nil + return nil } // ValidateSubscriptionID checks that 'input' can be parsed as a Subscription ID diff --git a/resource-manager/maps/2021-02-01/accounts/id_account.go b/resource-manager/maps/2021-02-01/accounts/id_account.go index 08385f15f8e..45a52d08f0b 100644 --- a/resource-manager/maps/2021-02-01/accounts/id_account.go +++ b/resource-manager/maps/2021-02-01/accounts/id_account.go @@ -36,19 +36,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/maps/2021-02-01/creators/id_account.go b/resource-manager/maps/2021-02-01/creators/id_account.go index 4d069b36b07..6f136b9a08e 100644 --- a/resource-manager/maps/2021-02-01/creators/id_account.go +++ b/resource-manager/maps/2021-02-01/creators/id_account.go @@ -36,19 +36,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/maps/2021-02-01/creators/id_creator.go b/resource-manager/maps/2021-02-01/creators/id_creator.go index cded00e95ef..233238ce01d 100644 --- a/resource-manager/maps/2021-02-01/creators/id_creator.go +++ b/resource-manager/maps/2021-02-01/creators/id_creator.go @@ -38,23 +38,9 @@ func ParseCreatorID(input string) (*CreatorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CreatorId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.CreatorName, ok = parsed.Parsed["creatorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "creatorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCreatorIDInsensitively(input string) (*CreatorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CreatorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CreatorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.CreatorName, ok = parsed.Parsed["creatorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "creatorName", *parsed) + if id.CreatorName, ok = input.Parsed["creatorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "creatorName", input) } - return &id, nil + return nil } // ValidateCreatorID checks that 'input' can be parsed as a Creator ID diff --git a/resource-manager/maps/2023-06-01/accounts/id_account.go b/resource-manager/maps/2023-06-01/accounts/id_account.go index 08385f15f8e..45a52d08f0b 100644 --- a/resource-manager/maps/2023-06-01/accounts/id_account.go +++ b/resource-manager/maps/2023-06-01/accounts/id_account.go @@ -36,19 +36,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/maps/2023-06-01/creators/id_account.go b/resource-manager/maps/2023-06-01/creators/id_account.go index 4d069b36b07..6f136b9a08e 100644 --- a/resource-manager/maps/2023-06-01/creators/id_account.go +++ b/resource-manager/maps/2023-06-01/creators/id_account.go @@ -36,19 +36,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/maps/2023-06-01/creators/id_creator.go b/resource-manager/maps/2023-06-01/creators/id_creator.go index cded00e95ef..233238ce01d 100644 --- a/resource-manager/maps/2023-06-01/creators/id_creator.go +++ b/resource-manager/maps/2023-06-01/creators/id_creator.go @@ -38,23 +38,9 @@ func ParseCreatorID(input string) (*CreatorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CreatorId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.CreatorName, ok = parsed.Parsed["creatorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "creatorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCreatorIDInsensitively(input string) (*CreatorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CreatorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CreatorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.CreatorName, ok = parsed.Parsed["creatorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "creatorName", *parsed) + if id.CreatorName, ok = input.Parsed["creatorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "creatorName", input) } - return &id, nil + return nil } // ValidateCreatorID checks that 'input' can be parsed as a Creator ID diff --git a/resource-manager/mariadb/2018-06-01-preview/configurations/id_configuration.go b/resource-manager/mariadb/2018-06-01-preview/configurations/id_configuration.go index 52d9a37c587..de590df40d9 100644 --- a/resource-manager/mariadb/2018-06-01-preview/configurations/id_configuration.go +++ b/resource-manager/mariadb/2018-06-01-preview/configurations/id_configuration.go @@ -38,23 +38,9 @@ func ParseConfigurationID(input string) (*ConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationId{} - - 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.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConfigurationIDInsensitively(input string) (*ConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationName", *parsed) + if id.ConfigurationName, ok = input.Parsed["configurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationName", input) } - return &id, nil + return nil } // ValidateConfigurationID checks that 'input' can be parsed as a Configuration ID diff --git a/resource-manager/mariadb/2018-06-01-preview/configurations/id_server.go b/resource-manager/mariadb/2018-06-01-preview/configurations/id_server.go index 5535ba69e0e..39b4985e026 100644 --- a/resource-manager/mariadb/2018-06-01-preview/configurations/id_server.go +++ b/resource-manager/mariadb/2018-06-01-preview/configurations/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mariadb/2018-06-01-preview/databases/id_database.go b/resource-manager/mariadb/2018-06-01-preview/databases/id_database.go index de5b435be38..a991b41809e 100644 --- a/resource-manager/mariadb/2018-06-01-preview/databases/id_database.go +++ b/resource-manager/mariadb/2018-06-01-preview/databases/id_database.go @@ -38,23 +38,9 @@ func ParseDatabaseID(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} - - 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) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDatabaseIDInsensitively(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - return &id, nil + return nil } // ValidateDatabaseID checks that 'input' can be parsed as a Database ID diff --git a/resource-manager/mariadb/2018-06-01-preview/databases/id_server.go b/resource-manager/mariadb/2018-06-01-preview/databases/id_server.go index ed80580f2be..6f498c89c09 100644 --- a/resource-manager/mariadb/2018-06-01-preview/databases/id_server.go +++ b/resource-manager/mariadb/2018-06-01-preview/databases/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mariadb/2018-06-01-preview/firewallrules/id_firewallrule.go b/resource-manager/mariadb/2018-06-01-preview/firewallrules/id_firewallrule.go index 3c08343ab5b..3184f1cac52 100644 --- a/resource-manager/mariadb/2018-06-01-preview/firewallrules/id_firewallrule.go +++ b/resource-manager/mariadb/2018-06-01-preview/firewallrules/id_firewallrule.go @@ -38,23 +38,9 @@ func ParseFirewallRuleID(input string) (*FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallRuleId{} - - 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.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFirewallRuleIDInsensitively(input string) (*FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FirewallRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + if id.FirewallRuleName, ok = input.Parsed["firewallRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", input) } - return &id, nil + return nil } // ValidateFirewallRuleID checks that 'input' can be parsed as a Firewall Rule ID diff --git a/resource-manager/mariadb/2018-06-01-preview/firewallrules/id_server.go b/resource-manager/mariadb/2018-06-01-preview/firewallrules/id_server.go index 8b41503799c..ef21ad5326a 100644 --- a/resource-manager/mariadb/2018-06-01-preview/firewallrules/id_server.go +++ b/resource-manager/mariadb/2018-06-01-preview/firewallrules/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mariadb/2018-06-01-preview/locationbasedperformancetier/id_location.go b/resource-manager/mariadb/2018-06-01-preview/locationbasedperformancetier/id_location.go index a6c5f44c571..7a2376effad 100644 --- a/resource-manager/mariadb/2018-06-01-preview/locationbasedperformancetier/id_location.go +++ b/resource-manager/mariadb/2018-06-01-preview/locationbasedperformancetier/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/mariadb/2018-06-01-preview/logfiles/id_server.go b/resource-manager/mariadb/2018-06-01-preview/logfiles/id_server.go index d2af6868ee7..0e078ca3e33 100644 --- a/resource-manager/mariadb/2018-06-01-preview/logfiles/id_server.go +++ b/resource-manager/mariadb/2018-06-01-preview/logfiles/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mariadb/2018-06-01-preview/recoverableservers/id_server.go b/resource-manager/mariadb/2018-06-01-preview/recoverableservers/id_server.go index b34a7f1f595..ec96591abb0 100644 --- a/resource-manager/mariadb/2018-06-01-preview/recoverableservers/id_server.go +++ b/resource-manager/mariadb/2018-06-01-preview/recoverableservers/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mariadb/2018-06-01-preview/replicas/id_server.go b/resource-manager/mariadb/2018-06-01-preview/replicas/id_server.go index 21bba79c85e..4c357ad713a 100644 --- a/resource-manager/mariadb/2018-06-01-preview/replicas/id_server.go +++ b/resource-manager/mariadb/2018-06-01-preview/replicas/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mariadb/2018-06-01-preview/serverbasedperformancetier/id_server.go b/resource-manager/mariadb/2018-06-01-preview/serverbasedperformancetier/id_server.go index f004dd12e22..8d0fd62c584 100644 --- a/resource-manager/mariadb/2018-06-01-preview/serverbasedperformancetier/id_server.go +++ b/resource-manager/mariadb/2018-06-01-preview/serverbasedperformancetier/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mariadb/2018-06-01-preview/serverrestart/id_server.go b/resource-manager/mariadb/2018-06-01-preview/serverrestart/id_server.go index fa5b4fb03d4..7c497500bf8 100644 --- a/resource-manager/mariadb/2018-06-01-preview/serverrestart/id_server.go +++ b/resource-manager/mariadb/2018-06-01-preview/serverrestart/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mariadb/2018-06-01-preview/servers/id_server.go b/resource-manager/mariadb/2018-06-01-preview/servers/id_server.go index a178ad9ffd0..c887e84299e 100644 --- a/resource-manager/mariadb/2018-06-01-preview/servers/id_server.go +++ b/resource-manager/mariadb/2018-06-01-preview/servers/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mariadb/2018-06-01-preview/serversecurityalertpolicies/id_server.go b/resource-manager/mariadb/2018-06-01-preview/serversecurityalertpolicies/id_server.go index 0a97b270125..51e393339d8 100644 --- a/resource-manager/mariadb/2018-06-01-preview/serversecurityalertpolicies/id_server.go +++ b/resource-manager/mariadb/2018-06-01-preview/serversecurityalertpolicies/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mariadb/2018-06-01-preview/updateconfigurations/id_server.go b/resource-manager/mariadb/2018-06-01-preview/updateconfigurations/id_server.go index f4413cc51c6..47352dd97b7 100644 --- a/resource-manager/mariadb/2018-06-01-preview/updateconfigurations/id_server.go +++ b/resource-manager/mariadb/2018-06-01-preview/updateconfigurations/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mariadb/2018-06-01-preview/virtualnetworkrules/id_server.go b/resource-manager/mariadb/2018-06-01-preview/virtualnetworkrules/id_server.go index feb296326b9..50cbfedec11 100644 --- a/resource-manager/mariadb/2018-06-01-preview/virtualnetworkrules/id_server.go +++ b/resource-manager/mariadb/2018-06-01-preview/virtualnetworkrules/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mariadb/2018-06-01-preview/virtualnetworkrules/id_virtualnetworkrule.go b/resource-manager/mariadb/2018-06-01-preview/virtualnetworkrules/id_virtualnetworkrule.go index 7832b404ca1..2ead8a105fc 100644 --- a/resource-manager/mariadb/2018-06-01-preview/virtualnetworkrules/id_virtualnetworkrule.go +++ b/resource-manager/mariadb/2018-06-01-preview/virtualnetworkrules/id_virtualnetworkrule.go @@ -38,23 +38,9 @@ func ParseVirtualNetworkRuleID(input string) (*VirtualNetworkRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkRuleId{} - - 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.VirtualNetworkRuleName, ok = parsed.Parsed["virtualNetworkRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualNetworkRuleIDInsensitively(input string) (*VirtualNetworkRuleId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualNetworkRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.VirtualNetworkRuleName, ok = parsed.Parsed["virtualNetworkRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkRuleName", *parsed) + if id.VirtualNetworkRuleName, ok = input.Parsed["virtualNetworkRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkRuleName", input) } - return &id, nil + return nil } // ValidateVirtualNetworkRuleID checks that 'input' can be parsed as a Virtual Network Rule ID diff --git a/resource-manager/mariadb/2018-06-01/advisors/id_advisor.go b/resource-manager/mariadb/2018-06-01/advisors/id_advisor.go index bcd926d2049..e51b7720f23 100644 --- a/resource-manager/mariadb/2018-06-01/advisors/id_advisor.go +++ b/resource-manager/mariadb/2018-06-01/advisors/id_advisor.go @@ -38,23 +38,9 @@ func ParseAdvisorID(input string) (*AdvisorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AdvisorId{} - - 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.AdvisorName, ok = parsed.Parsed["advisorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "advisorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAdvisorIDInsensitively(input string) (*AdvisorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AdvisorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AdvisorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.AdvisorName, ok = parsed.Parsed["advisorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "advisorName", *parsed) + if id.AdvisorName, ok = input.Parsed["advisorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "advisorName", input) } - return &id, nil + return nil } // ValidateAdvisorID checks that 'input' can be parsed as a Advisor ID diff --git a/resource-manager/mariadb/2018-06-01/advisors/id_server.go b/resource-manager/mariadb/2018-06-01/advisors/id_server.go index a4dc60817ec..63c2a10d782 100644 --- a/resource-manager/mariadb/2018-06-01/advisors/id_server.go +++ b/resource-manager/mariadb/2018-06-01/advisors/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mariadb/2018-06-01/configurations/id_configuration.go b/resource-manager/mariadb/2018-06-01/configurations/id_configuration.go index 52d9a37c587..de590df40d9 100644 --- a/resource-manager/mariadb/2018-06-01/configurations/id_configuration.go +++ b/resource-manager/mariadb/2018-06-01/configurations/id_configuration.go @@ -38,23 +38,9 @@ func ParseConfigurationID(input string) (*ConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationId{} - - 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.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConfigurationIDInsensitively(input string) (*ConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationName", *parsed) + if id.ConfigurationName, ok = input.Parsed["configurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationName", input) } - return &id, nil + return nil } // ValidateConfigurationID checks that 'input' can be parsed as a Configuration ID diff --git a/resource-manager/mariadb/2018-06-01/configurations/id_server.go b/resource-manager/mariadb/2018-06-01/configurations/id_server.go index 5535ba69e0e..39b4985e026 100644 --- a/resource-manager/mariadb/2018-06-01/configurations/id_server.go +++ b/resource-manager/mariadb/2018-06-01/configurations/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mariadb/2018-06-01/configurationsupdate/id_server.go b/resource-manager/mariadb/2018-06-01/configurationsupdate/id_server.go index 4a66eef07c7..c94515fb822 100644 --- a/resource-manager/mariadb/2018-06-01/configurationsupdate/id_server.go +++ b/resource-manager/mariadb/2018-06-01/configurationsupdate/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mariadb/2018-06-01/databases/id_database.go b/resource-manager/mariadb/2018-06-01/databases/id_database.go index de5b435be38..a991b41809e 100644 --- a/resource-manager/mariadb/2018-06-01/databases/id_database.go +++ b/resource-manager/mariadb/2018-06-01/databases/id_database.go @@ -38,23 +38,9 @@ func ParseDatabaseID(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} - - 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) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDatabaseIDInsensitively(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - return &id, nil + return nil } // ValidateDatabaseID checks that 'input' can be parsed as a Database ID diff --git a/resource-manager/mariadb/2018-06-01/databases/id_server.go b/resource-manager/mariadb/2018-06-01/databases/id_server.go index ed80580f2be..6f498c89c09 100644 --- a/resource-manager/mariadb/2018-06-01/databases/id_server.go +++ b/resource-manager/mariadb/2018-06-01/databases/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mariadb/2018-06-01/firewallrules/id_firewallrule.go b/resource-manager/mariadb/2018-06-01/firewallrules/id_firewallrule.go index 3c08343ab5b..3184f1cac52 100644 --- a/resource-manager/mariadb/2018-06-01/firewallrules/id_firewallrule.go +++ b/resource-manager/mariadb/2018-06-01/firewallrules/id_firewallrule.go @@ -38,23 +38,9 @@ func ParseFirewallRuleID(input string) (*FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallRuleId{} - - 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.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFirewallRuleIDInsensitively(input string) (*FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FirewallRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + if id.FirewallRuleName, ok = input.Parsed["firewallRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", input) } - return &id, nil + return nil } // ValidateFirewallRuleID checks that 'input' can be parsed as a Firewall Rule ID diff --git a/resource-manager/mariadb/2018-06-01/firewallrules/id_server.go b/resource-manager/mariadb/2018-06-01/firewallrules/id_server.go index 8b41503799c..ef21ad5326a 100644 --- a/resource-manager/mariadb/2018-06-01/firewallrules/id_server.go +++ b/resource-manager/mariadb/2018-06-01/firewallrules/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mariadb/2018-06-01/locationbasedperformancetier/id_location.go b/resource-manager/mariadb/2018-06-01/locationbasedperformancetier/id_location.go index a6c5f44c571..7a2376effad 100644 --- a/resource-manager/mariadb/2018-06-01/locationbasedperformancetier/id_location.go +++ b/resource-manager/mariadb/2018-06-01/locationbasedperformancetier/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/mariadb/2018-06-01/logfiles/id_server.go b/resource-manager/mariadb/2018-06-01/logfiles/id_server.go index d2af6868ee7..0e078ca3e33 100644 --- a/resource-manager/mariadb/2018-06-01/logfiles/id_server.go +++ b/resource-manager/mariadb/2018-06-01/logfiles/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mariadb/2018-06-01/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/mariadb/2018-06-01/privateendpointconnections/id_privateendpointconnection.go index b9fa2b52542..3ad4d390297 100644 --- a/resource-manager/mariadb/2018-06-01/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/mariadb/2018-06-01/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/mariadb/2018-06-01/privateendpointconnections/id_server.go b/resource-manager/mariadb/2018-06-01/privateendpointconnections/id_server.go index e788e0e7c7c..44a37b477ad 100644 --- a/resource-manager/mariadb/2018-06-01/privateendpointconnections/id_server.go +++ b/resource-manager/mariadb/2018-06-01/privateendpointconnections/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mariadb/2018-06-01/privatelinkresources/id_privatelinkresource.go b/resource-manager/mariadb/2018-06-01/privatelinkresources/id_privatelinkresource.go index 2c83e958994..e0b17b35827 100644 --- a/resource-manager/mariadb/2018-06-01/privatelinkresources/id_privatelinkresource.go +++ b/resource-manager/mariadb/2018-06-01/privatelinkresources/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/mariadb/2018-06-01/privatelinkresources/id_server.go b/resource-manager/mariadb/2018-06-01/privatelinkresources/id_server.go index 13ef6ddb1d6..75fff95ccc7 100644 --- a/resource-manager/mariadb/2018-06-01/privatelinkresources/id_server.go +++ b/resource-manager/mariadb/2018-06-01/privatelinkresources/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mariadb/2018-06-01/querytexts/id_querytext.go b/resource-manager/mariadb/2018-06-01/querytexts/id_querytext.go index 1db5b240781..2b1c052e45e 100644 --- a/resource-manager/mariadb/2018-06-01/querytexts/id_querytext.go +++ b/resource-manager/mariadb/2018-06-01/querytexts/id_querytext.go @@ -38,23 +38,9 @@ func ParseQueryTextID(input string) (*QueryTextId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QueryTextId{} - - 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.QueryId, ok = parsed.Parsed["queryId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "queryId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseQueryTextIDInsensitively(input string) (*QueryTextId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QueryTextId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *QueryTextId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.QueryId, ok = parsed.Parsed["queryId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "queryId", *parsed) + if id.QueryId, ok = input.Parsed["queryId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "queryId", input) } - return &id, nil + return nil } // ValidateQueryTextID checks that 'input' can be parsed as a Query Text ID diff --git a/resource-manager/mariadb/2018-06-01/querytexts/id_server.go b/resource-manager/mariadb/2018-06-01/querytexts/id_server.go index 972bd060793..d8f63622f41 100644 --- a/resource-manager/mariadb/2018-06-01/querytexts/id_server.go +++ b/resource-manager/mariadb/2018-06-01/querytexts/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mariadb/2018-06-01/recommendedactions/id_advisor.go b/resource-manager/mariadb/2018-06-01/recommendedactions/id_advisor.go index cb747d76003..b20e93277a0 100644 --- a/resource-manager/mariadb/2018-06-01/recommendedactions/id_advisor.go +++ b/resource-manager/mariadb/2018-06-01/recommendedactions/id_advisor.go @@ -38,23 +38,9 @@ func ParseAdvisorID(input string) (*AdvisorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AdvisorId{} - - 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.AdvisorName, ok = parsed.Parsed["advisorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "advisorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAdvisorIDInsensitively(input string) (*AdvisorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AdvisorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AdvisorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.AdvisorName, ok = parsed.Parsed["advisorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "advisorName", *parsed) + if id.AdvisorName, ok = input.Parsed["advisorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "advisorName", input) } - return &id, nil + return nil } // ValidateAdvisorID checks that 'input' can be parsed as a Advisor ID diff --git a/resource-manager/mariadb/2018-06-01/recommendedactions/id_recommendedaction.go b/resource-manager/mariadb/2018-06-01/recommendedactions/id_recommendedaction.go index 9661cd6ebee..529adf780cb 100644 --- a/resource-manager/mariadb/2018-06-01/recommendedactions/id_recommendedaction.go +++ b/resource-manager/mariadb/2018-06-01/recommendedactions/id_recommendedaction.go @@ -40,27 +40,9 @@ func ParseRecommendedActionID(input string) (*RecommendedActionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecommendedActionId{} - - 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.AdvisorName, ok = parsed.Parsed["advisorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "advisorName", *parsed) - } - - if id.RecommendedActionName, ok = parsed.Parsed["recommendedActionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recommendedActionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseRecommendedActionIDInsensitively(input string) (*RecommendedActionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecommendedActionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RecommendedActionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.AdvisorName, ok = parsed.Parsed["advisorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "advisorName", *parsed) + if id.AdvisorName, ok = input.Parsed["advisorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "advisorName", input) } - if id.RecommendedActionName, ok = parsed.Parsed["recommendedActionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recommendedActionName", *parsed) + if id.RecommendedActionName, ok = input.Parsed["recommendedActionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "recommendedActionName", input) } - return &id, nil + return nil } // ValidateRecommendedActionID checks that 'input' can be parsed as a Recommended Action ID diff --git a/resource-manager/mariadb/2018-06-01/recommendedactionsessions/id_advisor.go b/resource-manager/mariadb/2018-06-01/recommendedactionsessions/id_advisor.go index 8810c4e2883..0a9e77acead 100644 --- a/resource-manager/mariadb/2018-06-01/recommendedactionsessions/id_advisor.go +++ b/resource-manager/mariadb/2018-06-01/recommendedactionsessions/id_advisor.go @@ -38,23 +38,9 @@ func ParseAdvisorID(input string) (*AdvisorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AdvisorId{} - - 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.AdvisorName, ok = parsed.Parsed["advisorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "advisorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAdvisorIDInsensitively(input string) (*AdvisorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AdvisorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AdvisorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.AdvisorName, ok = parsed.Parsed["advisorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "advisorName", *parsed) + if id.AdvisorName, ok = input.Parsed["advisorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "advisorName", input) } - return &id, nil + return nil } // ValidateAdvisorID checks that 'input' can be parsed as a Advisor ID diff --git a/resource-manager/mariadb/2018-06-01/recoverableservers/id_server.go b/resource-manager/mariadb/2018-06-01/recoverableservers/id_server.go index b34a7f1f595..ec96591abb0 100644 --- a/resource-manager/mariadb/2018-06-01/recoverableservers/id_server.go +++ b/resource-manager/mariadb/2018-06-01/recoverableservers/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mariadb/2018-06-01/replicas/id_server.go b/resource-manager/mariadb/2018-06-01/replicas/id_server.go index 21bba79c85e..4c357ad713a 100644 --- a/resource-manager/mariadb/2018-06-01/replicas/id_server.go +++ b/resource-manager/mariadb/2018-06-01/replicas/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mariadb/2018-06-01/resetqueryperformanceinsightdata/id_server.go b/resource-manager/mariadb/2018-06-01/resetqueryperformanceinsightdata/id_server.go index 78689981e47..5271b77ee68 100644 --- a/resource-manager/mariadb/2018-06-01/resetqueryperformanceinsightdata/id_server.go +++ b/resource-manager/mariadb/2018-06-01/resetqueryperformanceinsightdata/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mariadb/2018-06-01/serverbasedperformancetier/id_server.go b/resource-manager/mariadb/2018-06-01/serverbasedperformancetier/id_server.go index f004dd12e22..8d0fd62c584 100644 --- a/resource-manager/mariadb/2018-06-01/serverbasedperformancetier/id_server.go +++ b/resource-manager/mariadb/2018-06-01/serverbasedperformancetier/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mariadb/2018-06-01/serverrestart/id_server.go b/resource-manager/mariadb/2018-06-01/serverrestart/id_server.go index fa5b4fb03d4..7c497500bf8 100644 --- a/resource-manager/mariadb/2018-06-01/serverrestart/id_server.go +++ b/resource-manager/mariadb/2018-06-01/serverrestart/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mariadb/2018-06-01/servers/id_server.go b/resource-manager/mariadb/2018-06-01/servers/id_server.go index a178ad9ffd0..c887e84299e 100644 --- a/resource-manager/mariadb/2018-06-01/servers/id_server.go +++ b/resource-manager/mariadb/2018-06-01/servers/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mariadb/2018-06-01/serversecurityalertpolicies/id_server.go b/resource-manager/mariadb/2018-06-01/serversecurityalertpolicies/id_server.go index 0a97b270125..51e393339d8 100644 --- a/resource-manager/mariadb/2018-06-01/serversecurityalertpolicies/id_server.go +++ b/resource-manager/mariadb/2018-06-01/serversecurityalertpolicies/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mariadb/2018-06-01/topquerystatistics/id_server.go b/resource-manager/mariadb/2018-06-01/topquerystatistics/id_server.go index 8d3b1cec2e3..e048051d41c 100644 --- a/resource-manager/mariadb/2018-06-01/topquerystatistics/id_server.go +++ b/resource-manager/mariadb/2018-06-01/topquerystatistics/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mariadb/2018-06-01/topquerystatistics/id_topquerystatistic.go b/resource-manager/mariadb/2018-06-01/topquerystatistics/id_topquerystatistic.go index b9fd7c402d3..ee4c7c211c6 100644 --- a/resource-manager/mariadb/2018-06-01/topquerystatistics/id_topquerystatistic.go +++ b/resource-manager/mariadb/2018-06-01/topquerystatistics/id_topquerystatistic.go @@ -38,23 +38,9 @@ func ParseTopQueryStatisticID(input string) (*TopQueryStatisticId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TopQueryStatisticId{} - - 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.QueryStatisticId, ok = parsed.Parsed["queryStatisticId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "queryStatisticId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTopQueryStatisticIDInsensitively(input string) (*TopQueryStatisticId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TopQueryStatisticId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TopQueryStatisticId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.QueryStatisticId, ok = parsed.Parsed["queryStatisticId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "queryStatisticId", *parsed) + if id.QueryStatisticId, ok = input.Parsed["queryStatisticId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "queryStatisticId", input) } - return &id, nil + return nil } // ValidateTopQueryStatisticID checks that 'input' can be parsed as a Top Query Statistic ID diff --git a/resource-manager/mariadb/2018-06-01/virtualnetworkrules/id_server.go b/resource-manager/mariadb/2018-06-01/virtualnetworkrules/id_server.go index feb296326b9..50cbfedec11 100644 --- a/resource-manager/mariadb/2018-06-01/virtualnetworkrules/id_server.go +++ b/resource-manager/mariadb/2018-06-01/virtualnetworkrules/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mariadb/2018-06-01/virtualnetworkrules/id_virtualnetworkrule.go b/resource-manager/mariadb/2018-06-01/virtualnetworkrules/id_virtualnetworkrule.go index 7832b404ca1..2ead8a105fc 100644 --- a/resource-manager/mariadb/2018-06-01/virtualnetworkrules/id_virtualnetworkrule.go +++ b/resource-manager/mariadb/2018-06-01/virtualnetworkrules/id_virtualnetworkrule.go @@ -38,23 +38,9 @@ func ParseVirtualNetworkRuleID(input string) (*VirtualNetworkRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkRuleId{} - - 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.VirtualNetworkRuleName, ok = parsed.Parsed["virtualNetworkRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualNetworkRuleIDInsensitively(input string) (*VirtualNetworkRuleId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualNetworkRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.VirtualNetworkRuleName, ok = parsed.Parsed["virtualNetworkRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkRuleName", *parsed) + if id.VirtualNetworkRuleName, ok = input.Parsed["virtualNetworkRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkRuleName", input) } - return &id, nil + return nil } // ValidateVirtualNetworkRuleID checks that 'input' can be parsed as a Virtual Network Rule ID diff --git a/resource-manager/mariadb/2018-06-01/waitstatistics/id_server.go b/resource-manager/mariadb/2018-06-01/waitstatistics/id_server.go index 339928d9295..68cb64344b9 100644 --- a/resource-manager/mariadb/2018-06-01/waitstatistics/id_server.go +++ b/resource-manager/mariadb/2018-06-01/waitstatistics/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mariadb/2018-06-01/waitstatistics/id_waitstatistic.go b/resource-manager/mariadb/2018-06-01/waitstatistics/id_waitstatistic.go index 77e777bc1fe..be4e9bc87e6 100644 --- a/resource-manager/mariadb/2018-06-01/waitstatistics/id_waitstatistic.go +++ b/resource-manager/mariadb/2018-06-01/waitstatistics/id_waitstatistic.go @@ -38,23 +38,9 @@ func ParseWaitStatisticID(input string) (*WaitStatisticId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WaitStatisticId{} - - 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.WaitStatisticsId, ok = parsed.Parsed["waitStatisticsId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "waitStatisticsId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWaitStatisticIDInsensitively(input string) (*WaitStatisticId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WaitStatisticId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WaitStatisticId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.WaitStatisticsId, ok = parsed.Parsed["waitStatisticsId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "waitStatisticsId", *parsed) + if id.WaitStatisticsId, ok = input.Parsed["waitStatisticsId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "waitStatisticsId", input) } - return &id, nil + return nil } // ValidateWaitStatisticID checks that 'input' can be parsed as a Wait Statistic ID diff --git a/resource-manager/mariadb/2020-01-01/serverstart/id_server.go b/resource-manager/mariadb/2020-01-01/serverstart/id_server.go index 534479f7068..4adb6d6d933 100644 --- a/resource-manager/mariadb/2020-01-01/serverstart/id_server.go +++ b/resource-manager/mariadb/2020-01-01/serverstart/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mariadb/2020-01-01/serverstop/id_server.go b/resource-manager/mariadb/2020-01-01/serverstop/id_server.go index 931b14b603b..d2d02183d5d 100644 --- a/resource-manager/mariadb/2020-01-01/serverstop/id_server.go +++ b/resource-manager/mariadb/2020-01-01/serverstop/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/marketplaceordering/2015-06-01/agreements/id_offerplan.go b/resource-manager/marketplaceordering/2015-06-01/agreements/id_offerplan.go index cf08432ab6d..bd6fa00f4ea 100644 --- a/resource-manager/marketplaceordering/2015-06-01/agreements/id_offerplan.go +++ b/resource-manager/marketplaceordering/2015-06-01/agreements/id_offerplan.go @@ -38,23 +38,9 @@ func ParseOfferPlanID(input string) (*OfferPlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OfferPlanId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.PublisherId, ok = parsed.Parsed["publisherId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherId", *parsed) - } - - if id.OfferId, ok = parsed.Parsed["offerId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerId", *parsed) - } - - if id.PlanId, ok = parsed.Parsed["planId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "planId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseOfferPlanIDInsensitively(input string) (*OfferPlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OfferPlanId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OfferPlanId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.PublisherId, ok = parsed.Parsed["publisherId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherId", *parsed) + if id.PublisherId, ok = input.Parsed["publisherId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherId", input) } - if id.OfferId, ok = parsed.Parsed["offerId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerId", *parsed) + if id.OfferId, ok = input.Parsed["offerId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerId", input) } - if id.PlanId, ok = parsed.Parsed["planId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "planId", *parsed) + if id.PlanId, ok = input.Parsed["planId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "planId", input) } - return &id, nil + return nil } // ValidateOfferPlanID checks that 'input' can be parsed as a Offer Plan ID diff --git a/resource-manager/marketplaceordering/2015-06-01/agreements/id_plan.go b/resource-manager/marketplaceordering/2015-06-01/agreements/id_plan.go index 855bb585408..93f0547a335 100644 --- a/resource-manager/marketplaceordering/2015-06-01/agreements/id_plan.go +++ b/resource-manager/marketplaceordering/2015-06-01/agreements/id_plan.go @@ -38,23 +38,9 @@ func ParsePlanID(input string) (*PlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PlanId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.PublisherId, ok = parsed.Parsed["publisherId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherId", *parsed) - } - - if id.OfferId, ok = parsed.Parsed["offerId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerId", *parsed) - } - - if id.PlanId, ok = parsed.Parsed["planId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "planId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePlanIDInsensitively(input string) (*PlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PlanId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PlanId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.PublisherId, ok = parsed.Parsed["publisherId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherId", *parsed) + if id.PublisherId, ok = input.Parsed["publisherId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherId", input) } - if id.OfferId, ok = parsed.Parsed["offerId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerId", *parsed) + if id.OfferId, ok = input.Parsed["offerId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerId", input) } - if id.PlanId, ok = parsed.Parsed["planId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "planId", *parsed) + if id.PlanId, ok = input.Parsed["planId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "planId", input) } - return &id, nil + return nil } // ValidatePlanID checks that 'input' can be parsed as a Plan ID diff --git a/resource-manager/marketplaceordering/2021-01-01/agreements/id_offerplan.go b/resource-manager/marketplaceordering/2021-01-01/agreements/id_offerplan.go index cf08432ab6d..bd6fa00f4ea 100644 --- a/resource-manager/marketplaceordering/2021-01-01/agreements/id_offerplan.go +++ b/resource-manager/marketplaceordering/2021-01-01/agreements/id_offerplan.go @@ -38,23 +38,9 @@ func ParseOfferPlanID(input string) (*OfferPlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OfferPlanId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.PublisherId, ok = parsed.Parsed["publisherId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherId", *parsed) - } - - if id.OfferId, ok = parsed.Parsed["offerId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerId", *parsed) - } - - if id.PlanId, ok = parsed.Parsed["planId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "planId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseOfferPlanIDInsensitively(input string) (*OfferPlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OfferPlanId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OfferPlanId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.PublisherId, ok = parsed.Parsed["publisherId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherId", *parsed) + if id.PublisherId, ok = input.Parsed["publisherId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherId", input) } - if id.OfferId, ok = parsed.Parsed["offerId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerId", *parsed) + if id.OfferId, ok = input.Parsed["offerId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerId", input) } - if id.PlanId, ok = parsed.Parsed["planId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "planId", *parsed) + if id.PlanId, ok = input.Parsed["planId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "planId", input) } - return &id, nil + return nil } // ValidateOfferPlanID checks that 'input' can be parsed as a Offer Plan ID diff --git a/resource-manager/marketplaceordering/2021-01-01/agreements/id_plan.go b/resource-manager/marketplaceordering/2021-01-01/agreements/id_plan.go index 855bb585408..93f0547a335 100644 --- a/resource-manager/marketplaceordering/2021-01-01/agreements/id_plan.go +++ b/resource-manager/marketplaceordering/2021-01-01/agreements/id_plan.go @@ -38,23 +38,9 @@ func ParsePlanID(input string) (*PlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PlanId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.PublisherId, ok = parsed.Parsed["publisherId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherId", *parsed) - } - - if id.OfferId, ok = parsed.Parsed["offerId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerId", *parsed) - } - - if id.PlanId, ok = parsed.Parsed["planId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "planId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePlanIDInsensitively(input string) (*PlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PlanId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PlanId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.PublisherId, ok = parsed.Parsed["publisherId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publisherId", *parsed) + if id.PublisherId, ok = input.Parsed["publisherId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherId", input) } - if id.OfferId, ok = parsed.Parsed["offerId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "offerId", *parsed) + if id.OfferId, ok = input.Parsed["offerId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerId", input) } - if id.PlanId, ok = parsed.Parsed["planId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "planId", *parsed) + if id.PlanId, ok = input.Parsed["planId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "planId", input) } - return &id, nil + return nil } // ValidatePlanID checks that 'input' can be parsed as a Plan ID diff --git a/resource-manager/media/2021-11-01/accountfilters/id_accountfilter.go b/resource-manager/media/2021-11-01/accountfilters/id_accountfilter.go index 09bebc83a96..1e2781ba04d 100644 --- a/resource-manager/media/2021-11-01/accountfilters/id_accountfilter.go +++ b/resource-manager/media/2021-11-01/accountfilters/id_accountfilter.go @@ -38,23 +38,9 @@ func ParseAccountFilterID(input string) (*AccountFilterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountFilterId{} - - 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.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) - } - - if id.AccountFilterName, ok = parsed.Parsed["accountFilterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountFilterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAccountFilterIDInsensitively(input string) (*AccountFilterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountFilterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AccountFilterId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if id.MediaServiceName, ok = input.Parsed["mediaServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", input) } - if id.AccountFilterName, ok = parsed.Parsed["accountFilterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountFilterName", *parsed) + if id.AccountFilterName, ok = input.Parsed["accountFilterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountFilterName", input) } - return &id, nil + return nil } // ValidateAccountFilterID checks that 'input' can be parsed as a Account Filter ID diff --git a/resource-manager/media/2021-11-01/accountfilters/id_mediaservice.go b/resource-manager/media/2021-11-01/accountfilters/id_mediaservice.go index fdc7ca2a0c5..aa414f3938b 100644 --- a/resource-manager/media/2021-11-01/accountfilters/id_mediaservice.go +++ b/resource-manager/media/2021-11-01/accountfilters/id_mediaservice.go @@ -36,19 +36,9 @@ func ParseMediaServiceID(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MediaServiceId{} - - 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.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMediaServiceIDInsensitively(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MediaServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MediaServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if id.MediaServiceName, ok = input.Parsed["mediaServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", input) } - return &id, nil + return nil } // ValidateMediaServiceID checks that 'input' can be parsed as a Media Service ID diff --git a/resource-manager/media/2021-11-01/accounts/id_location.go b/resource-manager/media/2021-11-01/accounts/id_location.go index 09d6433cf7f..07bd0ab76a1 100644 --- a/resource-manager/media/2021-11-01/accounts/id_location.go +++ b/resource-manager/media/2021-11-01/accounts/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/media/2021-11-01/accounts/id_mediaservice.go b/resource-manager/media/2021-11-01/accounts/id_mediaservice.go index b87c1167ac0..6b30ea8bace 100644 --- a/resource-manager/media/2021-11-01/accounts/id_mediaservice.go +++ b/resource-manager/media/2021-11-01/accounts/id_mediaservice.go @@ -36,19 +36,9 @@ func ParseMediaServiceID(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MediaServiceId{} - - 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.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMediaServiceIDInsensitively(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MediaServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MediaServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if id.MediaServiceName, ok = input.Parsed["mediaServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", input) } - return &id, nil + return nil } // ValidateMediaServiceID checks that 'input' can be parsed as a Media Service ID diff --git a/resource-manager/media/2021-11-01/accounts/id_privateendpointconnection.go b/resource-manager/media/2021-11-01/accounts/id_privateendpointconnection.go index 4bf408f5804..500f951c157 100644 --- a/resource-manager/media/2021-11-01/accounts/id_privateendpointconnection.go +++ b/resource-manager/media/2021-11-01/accounts/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if id.MediaServiceName, ok = input.Parsed["mediaServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/media/2021-11-01/accounts/id_privatelinkresource.go b/resource-manager/media/2021-11-01/accounts/id_privatelinkresource.go index 0ece273e442..8f4df28715b 100644 --- a/resource-manager/media/2021-11-01/accounts/id_privatelinkresource.go +++ b/resource-manager/media/2021-11-01/accounts/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) - } - - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if id.MediaServiceName, ok = input.Parsed["mediaServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/media/2021-11-01/assetsandassetfilters/id_asset.go b/resource-manager/media/2021-11-01/assetsandassetfilters/id_asset.go index 388aedc8f81..d81235d8dfe 100644 --- a/resource-manager/media/2021-11-01/assetsandassetfilters/id_asset.go +++ b/resource-manager/media/2021-11-01/assetsandassetfilters/id_asset.go @@ -38,23 +38,9 @@ func ParseAssetID(input string) (*AssetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AssetId{} - - 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.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) - } - - if id.AssetName, ok = parsed.Parsed["assetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "assetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAssetIDInsensitively(input string) (*AssetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AssetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AssetId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if id.MediaServiceName, ok = input.Parsed["mediaServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", input) } - if id.AssetName, ok = parsed.Parsed["assetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "assetName", *parsed) + if id.AssetName, ok = input.Parsed["assetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "assetName", input) } - return &id, nil + return nil } // ValidateAssetID checks that 'input' can be parsed as a Asset ID diff --git a/resource-manager/media/2021-11-01/assetsandassetfilters/id_assetfilter.go b/resource-manager/media/2021-11-01/assetsandassetfilters/id_assetfilter.go index 9c7367af6b4..641b06dede9 100644 --- a/resource-manager/media/2021-11-01/assetsandassetfilters/id_assetfilter.go +++ b/resource-manager/media/2021-11-01/assetsandassetfilters/id_assetfilter.go @@ -40,27 +40,9 @@ func ParseAssetFilterID(input string) (*AssetFilterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AssetFilterId{} - - 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.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) - } - - if id.AssetName, ok = parsed.Parsed["assetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "assetName", *parsed) - } - - if id.AssetFilterName, ok = parsed.Parsed["assetFilterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "assetFilterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseAssetFilterIDInsensitively(input string) (*AssetFilterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AssetFilterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *AssetFilterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if id.MediaServiceName, ok = input.Parsed["mediaServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", input) } - if id.AssetName, ok = parsed.Parsed["assetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "assetName", *parsed) + if id.AssetName, ok = input.Parsed["assetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "assetName", input) } - if id.AssetFilterName, ok = parsed.Parsed["assetFilterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "assetFilterName", *parsed) + if id.AssetFilterName, ok = input.Parsed["assetFilterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "assetFilterName", input) } - return &id, nil + return nil } // ValidateAssetFilterID checks that 'input' can be parsed as a Asset Filter ID diff --git a/resource-manager/media/2021-11-01/assetsandassetfilters/id_mediaservice.go b/resource-manager/media/2021-11-01/assetsandassetfilters/id_mediaservice.go index 98df2e0ff2b..04814d7bcae 100644 --- a/resource-manager/media/2021-11-01/assetsandassetfilters/id_mediaservice.go +++ b/resource-manager/media/2021-11-01/assetsandassetfilters/id_mediaservice.go @@ -36,19 +36,9 @@ func ParseMediaServiceID(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MediaServiceId{} - - 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.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMediaServiceIDInsensitively(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MediaServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MediaServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if id.MediaServiceName, ok = input.Parsed["mediaServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", input) } - return &id, nil + return nil } // ValidateMediaServiceID checks that 'input' can be parsed as a Media Service ID diff --git a/resource-manager/media/2021-11-01/assetsandassetfilters/id_track.go b/resource-manager/media/2021-11-01/assetsandassetfilters/id_track.go index 7b0956f2429..411058d73de 100644 --- a/resource-manager/media/2021-11-01/assetsandassetfilters/id_track.go +++ b/resource-manager/media/2021-11-01/assetsandassetfilters/id_track.go @@ -40,27 +40,9 @@ func ParseTrackID(input string) (*TrackId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TrackId{} - - 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.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) - } - - if id.AssetName, ok = parsed.Parsed["assetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "assetName", *parsed) - } - - if id.TrackName, ok = parsed.Parsed["trackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "trackName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseTrackIDInsensitively(input string) (*TrackId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TrackId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TrackId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if id.MediaServiceName, ok = input.Parsed["mediaServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", input) } - if id.AssetName, ok = parsed.Parsed["assetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "assetName", *parsed) + if id.AssetName, ok = input.Parsed["assetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "assetName", input) } - if id.TrackName, ok = parsed.Parsed["trackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "trackName", *parsed) + if id.TrackName, ok = input.Parsed["trackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "trackName", input) } - return &id, nil + return nil } // ValidateTrackID checks that 'input' can be parsed as a Track ID diff --git a/resource-manager/media/2021-11-01/contentkeypolicies/id_contentkeypolicy.go b/resource-manager/media/2021-11-01/contentkeypolicies/id_contentkeypolicy.go index a639f299f7d..c6d19670d29 100644 --- a/resource-manager/media/2021-11-01/contentkeypolicies/id_contentkeypolicy.go +++ b/resource-manager/media/2021-11-01/contentkeypolicies/id_contentkeypolicy.go @@ -38,23 +38,9 @@ func ParseContentKeyPolicyID(input string) (*ContentKeyPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContentKeyPolicyId{} - - 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.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) - } - - if id.ContentKeyPolicyName, ok = parsed.Parsed["contentKeyPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "contentKeyPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseContentKeyPolicyIDInsensitively(input string) (*ContentKeyPolicyId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContentKeyPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ContentKeyPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if id.MediaServiceName, ok = input.Parsed["mediaServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", input) } - if id.ContentKeyPolicyName, ok = parsed.Parsed["contentKeyPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "contentKeyPolicyName", *parsed) + if id.ContentKeyPolicyName, ok = input.Parsed["contentKeyPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "contentKeyPolicyName", input) } - return &id, nil + return nil } // ValidateContentKeyPolicyID checks that 'input' can be parsed as a Content Key Policy ID diff --git a/resource-manager/media/2021-11-01/contentkeypolicies/id_mediaservice.go b/resource-manager/media/2021-11-01/contentkeypolicies/id_mediaservice.go index 0530b48da90..4b966221c63 100644 --- a/resource-manager/media/2021-11-01/contentkeypolicies/id_mediaservice.go +++ b/resource-manager/media/2021-11-01/contentkeypolicies/id_mediaservice.go @@ -36,19 +36,9 @@ func ParseMediaServiceID(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MediaServiceId{} - - 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.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMediaServiceIDInsensitively(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MediaServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MediaServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if id.MediaServiceName, ok = input.Parsed["mediaServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", input) } - return &id, nil + return nil } // ValidateMediaServiceID checks that 'input' can be parsed as a Media Service ID diff --git a/resource-manager/media/2021-11-01/encodings/id_job.go b/resource-manager/media/2021-11-01/encodings/id_job.go index 2815b6b89fc..74fcdc7af72 100644 --- a/resource-manager/media/2021-11-01/encodings/id_job.go +++ b/resource-manager/media/2021-11-01/encodings/id_job.go @@ -40,27 +40,9 @@ func ParseJobID(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} - - 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.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) - } - - if id.TransformName, ok = parsed.Parsed["transformName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "transformName", *parsed) - } - - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseJobIDInsensitively(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *JobId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if id.MediaServiceName, ok = input.Parsed["mediaServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", input) } - if id.TransformName, ok = parsed.Parsed["transformName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "transformName", *parsed) + if id.TransformName, ok = input.Parsed["transformName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "transformName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - return &id, nil + return nil } // ValidateJobID checks that 'input' can be parsed as a Job ID diff --git a/resource-manager/media/2021-11-01/encodings/id_mediaservice.go b/resource-manager/media/2021-11-01/encodings/id_mediaservice.go index 132ac54ae21..4700fb1369d 100644 --- a/resource-manager/media/2021-11-01/encodings/id_mediaservice.go +++ b/resource-manager/media/2021-11-01/encodings/id_mediaservice.go @@ -36,19 +36,9 @@ func ParseMediaServiceID(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MediaServiceId{} - - 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.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMediaServiceIDInsensitively(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MediaServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MediaServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if id.MediaServiceName, ok = input.Parsed["mediaServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", input) } - return &id, nil + return nil } // ValidateMediaServiceID checks that 'input' can be parsed as a Media Service ID diff --git a/resource-manager/media/2021-11-01/encodings/id_transform.go b/resource-manager/media/2021-11-01/encodings/id_transform.go index edbadbb57c0..5bd09bf2f20 100644 --- a/resource-manager/media/2021-11-01/encodings/id_transform.go +++ b/resource-manager/media/2021-11-01/encodings/id_transform.go @@ -38,23 +38,9 @@ func ParseTransformID(input string) (*TransformId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TransformId{} - - 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.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) - } - - if id.TransformName, ok = parsed.Parsed["transformName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "transformName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTransformIDInsensitively(input string) (*TransformId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TransformId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TransformId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if id.MediaServiceName, ok = input.Parsed["mediaServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", input) } - if id.TransformName, ok = parsed.Parsed["transformName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "transformName", *parsed) + if id.TransformName, ok = input.Parsed["transformName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "transformName", input) } - return &id, nil + return nil } // ValidateTransformID checks that 'input' can be parsed as a Transform ID diff --git a/resource-manager/media/2021-11-01/liveevents/id_liveevent.go b/resource-manager/media/2021-11-01/liveevents/id_liveevent.go index 54f722e0dc1..29356220675 100644 --- a/resource-manager/media/2021-11-01/liveevents/id_liveevent.go +++ b/resource-manager/media/2021-11-01/liveevents/id_liveevent.go @@ -38,23 +38,9 @@ func ParseLiveEventID(input string) (*LiveEventId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LiveEventId{} - - 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.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) - } - - if id.LiveEventName, ok = parsed.Parsed["liveEventName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "liveEventName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLiveEventIDInsensitively(input string) (*LiveEventId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LiveEventId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LiveEventId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if id.MediaServiceName, ok = input.Parsed["mediaServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", input) } - if id.LiveEventName, ok = parsed.Parsed["liveEventName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "liveEventName", *parsed) + if id.LiveEventName, ok = input.Parsed["liveEventName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "liveEventName", input) } - return &id, nil + return nil } // ValidateLiveEventID checks that 'input' can be parsed as a Live Event ID diff --git a/resource-manager/media/2021-11-01/liveevents/id_mediaservice.go b/resource-manager/media/2021-11-01/liveevents/id_mediaservice.go index 354f5f9e6e9..a5c9eedcee0 100644 --- a/resource-manager/media/2021-11-01/liveevents/id_mediaservice.go +++ b/resource-manager/media/2021-11-01/liveevents/id_mediaservice.go @@ -36,19 +36,9 @@ func ParseMediaServiceID(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MediaServiceId{} - - 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.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMediaServiceIDInsensitively(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MediaServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MediaServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if id.MediaServiceName, ok = input.Parsed["mediaServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", input) } - return &id, nil + return nil } // ValidateMediaServiceID checks that 'input' can be parsed as a Media Service ID diff --git a/resource-manager/media/2021-11-01/liveoutputs/id_liveevent.go b/resource-manager/media/2021-11-01/liveoutputs/id_liveevent.go index daf535f56d4..2a294bb2a87 100644 --- a/resource-manager/media/2021-11-01/liveoutputs/id_liveevent.go +++ b/resource-manager/media/2021-11-01/liveoutputs/id_liveevent.go @@ -38,23 +38,9 @@ func ParseLiveEventID(input string) (*LiveEventId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LiveEventId{} - - 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.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) - } - - if id.LiveEventName, ok = parsed.Parsed["liveEventName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "liveEventName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLiveEventIDInsensitively(input string) (*LiveEventId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LiveEventId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LiveEventId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if id.MediaServiceName, ok = input.Parsed["mediaServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", input) } - if id.LiveEventName, ok = parsed.Parsed["liveEventName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "liveEventName", *parsed) + if id.LiveEventName, ok = input.Parsed["liveEventName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "liveEventName", input) } - return &id, nil + return nil } // ValidateLiveEventID checks that 'input' can be parsed as a Live Event ID diff --git a/resource-manager/media/2021-11-01/liveoutputs/id_liveoutput.go b/resource-manager/media/2021-11-01/liveoutputs/id_liveoutput.go index 8d9aa43084a..dea2b65f673 100644 --- a/resource-manager/media/2021-11-01/liveoutputs/id_liveoutput.go +++ b/resource-manager/media/2021-11-01/liveoutputs/id_liveoutput.go @@ -40,27 +40,9 @@ func ParseLiveOutputID(input string) (*LiveOutputId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LiveOutputId{} - - 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.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) - } - - if id.LiveEventName, ok = parsed.Parsed["liveEventName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "liveEventName", *parsed) - } - - if id.LiveOutputName, ok = parsed.Parsed["liveOutputName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "liveOutputName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseLiveOutputIDInsensitively(input string) (*LiveOutputId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LiveOutputId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LiveOutputId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if id.MediaServiceName, ok = input.Parsed["mediaServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", input) } - if id.LiveEventName, ok = parsed.Parsed["liveEventName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "liveEventName", *parsed) + if id.LiveEventName, ok = input.Parsed["liveEventName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "liveEventName", input) } - if id.LiveOutputName, ok = parsed.Parsed["liveOutputName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "liveOutputName", *parsed) + if id.LiveOutputName, ok = input.Parsed["liveOutputName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "liveOutputName", input) } - return &id, nil + return nil } // ValidateLiveOutputID checks that 'input' can be parsed as a Live Output ID diff --git a/resource-manager/media/2021-11-01/streamingendpoints/id_mediaservice.go b/resource-manager/media/2021-11-01/streamingendpoints/id_mediaservice.go index 4e906722e84..9396721536c 100644 --- a/resource-manager/media/2021-11-01/streamingendpoints/id_mediaservice.go +++ b/resource-manager/media/2021-11-01/streamingendpoints/id_mediaservice.go @@ -36,19 +36,9 @@ func ParseMediaServiceID(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MediaServiceId{} - - 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.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMediaServiceIDInsensitively(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MediaServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MediaServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if id.MediaServiceName, ok = input.Parsed["mediaServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", input) } - return &id, nil + return nil } // ValidateMediaServiceID checks that 'input' can be parsed as a Media Service ID diff --git a/resource-manager/media/2021-11-01/streamingendpoints/id_streamingendpoint.go b/resource-manager/media/2021-11-01/streamingendpoints/id_streamingendpoint.go index e49e92304ff..3cb564769bc 100644 --- a/resource-manager/media/2021-11-01/streamingendpoints/id_streamingendpoint.go +++ b/resource-manager/media/2021-11-01/streamingendpoints/id_streamingendpoint.go @@ -38,23 +38,9 @@ func ParseStreamingEndpointID(input string) (*StreamingEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StreamingEndpointId{} - - 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.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) - } - - if id.StreamingEndpointName, ok = parsed.Parsed["streamingEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamingEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseStreamingEndpointIDInsensitively(input string) (*StreamingEndpointId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StreamingEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *StreamingEndpointId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if id.MediaServiceName, ok = input.Parsed["mediaServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", input) } - if id.StreamingEndpointName, ok = parsed.Parsed["streamingEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamingEndpointName", *parsed) + if id.StreamingEndpointName, ok = input.Parsed["streamingEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "streamingEndpointName", input) } - return &id, nil + return nil } // ValidateStreamingEndpointID checks that 'input' can be parsed as a Streaming Endpoint ID diff --git a/resource-manager/media/2021-11-01/streamingpoliciesandstreaminglocators/id_mediaservice.go b/resource-manager/media/2021-11-01/streamingpoliciesandstreaminglocators/id_mediaservice.go index f5ec1a628f9..a7b698c9222 100644 --- a/resource-manager/media/2021-11-01/streamingpoliciesandstreaminglocators/id_mediaservice.go +++ b/resource-manager/media/2021-11-01/streamingpoliciesandstreaminglocators/id_mediaservice.go @@ -36,19 +36,9 @@ func ParseMediaServiceID(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MediaServiceId{} - - 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.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMediaServiceIDInsensitively(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MediaServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MediaServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if id.MediaServiceName, ok = input.Parsed["mediaServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", input) } - return &id, nil + return nil } // ValidateMediaServiceID checks that 'input' can be parsed as a Media Service ID diff --git a/resource-manager/media/2021-11-01/streamingpoliciesandstreaminglocators/id_streaminglocator.go b/resource-manager/media/2021-11-01/streamingpoliciesandstreaminglocators/id_streaminglocator.go index 7685f6c1705..54a38d652e4 100644 --- a/resource-manager/media/2021-11-01/streamingpoliciesandstreaminglocators/id_streaminglocator.go +++ b/resource-manager/media/2021-11-01/streamingpoliciesandstreaminglocators/id_streaminglocator.go @@ -38,23 +38,9 @@ func ParseStreamingLocatorID(input string) (*StreamingLocatorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StreamingLocatorId{} - - 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.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) - } - - if id.StreamingLocatorName, ok = parsed.Parsed["streamingLocatorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamingLocatorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseStreamingLocatorIDInsensitively(input string) (*StreamingLocatorId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StreamingLocatorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *StreamingLocatorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if id.MediaServiceName, ok = input.Parsed["mediaServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", input) } - if id.StreamingLocatorName, ok = parsed.Parsed["streamingLocatorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamingLocatorName", *parsed) + if id.StreamingLocatorName, ok = input.Parsed["streamingLocatorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "streamingLocatorName", input) } - return &id, nil + return nil } // ValidateStreamingLocatorID checks that 'input' can be parsed as a Streaming Locator ID diff --git a/resource-manager/media/2021-11-01/streamingpoliciesandstreaminglocators/id_streamingpolicy.go b/resource-manager/media/2021-11-01/streamingpoliciesandstreaminglocators/id_streamingpolicy.go index 2575a685a18..b9c3100c7f2 100644 --- a/resource-manager/media/2021-11-01/streamingpoliciesandstreaminglocators/id_streamingpolicy.go +++ b/resource-manager/media/2021-11-01/streamingpoliciesandstreaminglocators/id_streamingpolicy.go @@ -38,23 +38,9 @@ func ParseStreamingPolicyID(input string) (*StreamingPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StreamingPolicyId{} - - 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.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) - } - - if id.StreamingPolicyName, ok = parsed.Parsed["streamingPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamingPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseStreamingPolicyIDInsensitively(input string) (*StreamingPolicyId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StreamingPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *StreamingPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if id.MediaServiceName, ok = input.Parsed["mediaServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", input) } - if id.StreamingPolicyName, ok = parsed.Parsed["streamingPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamingPolicyName", *parsed) + if id.StreamingPolicyName, ok = input.Parsed["streamingPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "streamingPolicyName", input) } - return &id, nil + return nil } // ValidateStreamingPolicyID checks that 'input' can be parsed as a Streaming Policy ID diff --git a/resource-manager/media/2022-07-01/encodings/id_job.go b/resource-manager/media/2022-07-01/encodings/id_job.go index 2815b6b89fc..74fcdc7af72 100644 --- a/resource-manager/media/2022-07-01/encodings/id_job.go +++ b/resource-manager/media/2022-07-01/encodings/id_job.go @@ -40,27 +40,9 @@ func ParseJobID(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} - - 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.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) - } - - if id.TransformName, ok = parsed.Parsed["transformName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "transformName", *parsed) - } - - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseJobIDInsensitively(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *JobId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if id.MediaServiceName, ok = input.Parsed["mediaServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", input) } - if id.TransformName, ok = parsed.Parsed["transformName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "transformName", *parsed) + if id.TransformName, ok = input.Parsed["transformName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "transformName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - return &id, nil + return nil } // ValidateJobID checks that 'input' can be parsed as a Job ID diff --git a/resource-manager/media/2022-07-01/encodings/id_mediaservice.go b/resource-manager/media/2022-07-01/encodings/id_mediaservice.go index 132ac54ae21..4700fb1369d 100644 --- a/resource-manager/media/2022-07-01/encodings/id_mediaservice.go +++ b/resource-manager/media/2022-07-01/encodings/id_mediaservice.go @@ -36,19 +36,9 @@ func ParseMediaServiceID(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MediaServiceId{} - - 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.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMediaServiceIDInsensitively(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MediaServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MediaServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if id.MediaServiceName, ok = input.Parsed["mediaServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", input) } - return &id, nil + return nil } // ValidateMediaServiceID checks that 'input' can be parsed as a Media Service ID diff --git a/resource-manager/media/2022-07-01/encodings/id_transform.go b/resource-manager/media/2022-07-01/encodings/id_transform.go index edbadbb57c0..5bd09bf2f20 100644 --- a/resource-manager/media/2022-07-01/encodings/id_transform.go +++ b/resource-manager/media/2022-07-01/encodings/id_transform.go @@ -38,23 +38,9 @@ func ParseTransformID(input string) (*TransformId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TransformId{} - - 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.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) - } - - if id.TransformName, ok = parsed.Parsed["transformName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "transformName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTransformIDInsensitively(input string) (*TransformId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TransformId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TransformId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if id.MediaServiceName, ok = input.Parsed["mediaServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", input) } - if id.TransformName, ok = parsed.Parsed["transformName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "transformName", *parsed) + if id.TransformName, ok = input.Parsed["transformName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "transformName", input) } - return &id, nil + return nil } // ValidateTransformID checks that 'input' can be parsed as a Transform ID diff --git a/resource-manager/media/2022-08-01/accountfilters/id_accountfilter.go b/resource-manager/media/2022-08-01/accountfilters/id_accountfilter.go index 09bebc83a96..1e2781ba04d 100644 --- a/resource-manager/media/2022-08-01/accountfilters/id_accountfilter.go +++ b/resource-manager/media/2022-08-01/accountfilters/id_accountfilter.go @@ -38,23 +38,9 @@ func ParseAccountFilterID(input string) (*AccountFilterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountFilterId{} - - 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.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) - } - - if id.AccountFilterName, ok = parsed.Parsed["accountFilterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountFilterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAccountFilterIDInsensitively(input string) (*AccountFilterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountFilterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AccountFilterId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if id.MediaServiceName, ok = input.Parsed["mediaServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", input) } - if id.AccountFilterName, ok = parsed.Parsed["accountFilterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountFilterName", *parsed) + if id.AccountFilterName, ok = input.Parsed["accountFilterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountFilterName", input) } - return &id, nil + return nil } // ValidateAccountFilterID checks that 'input' can be parsed as a Account Filter ID diff --git a/resource-manager/media/2022-08-01/accountfilters/id_mediaservice.go b/resource-manager/media/2022-08-01/accountfilters/id_mediaservice.go index fdc7ca2a0c5..aa414f3938b 100644 --- a/resource-manager/media/2022-08-01/accountfilters/id_mediaservice.go +++ b/resource-manager/media/2022-08-01/accountfilters/id_mediaservice.go @@ -36,19 +36,9 @@ func ParseMediaServiceID(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MediaServiceId{} - - 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.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMediaServiceIDInsensitively(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MediaServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MediaServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if id.MediaServiceName, ok = input.Parsed["mediaServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", input) } - return &id, nil + return nil } // ValidateMediaServiceID checks that 'input' can be parsed as a Media Service ID diff --git a/resource-manager/media/2022-08-01/assetsandassetfilters/id_asset.go b/resource-manager/media/2022-08-01/assetsandassetfilters/id_asset.go index 388aedc8f81..d81235d8dfe 100644 --- a/resource-manager/media/2022-08-01/assetsandassetfilters/id_asset.go +++ b/resource-manager/media/2022-08-01/assetsandassetfilters/id_asset.go @@ -38,23 +38,9 @@ func ParseAssetID(input string) (*AssetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AssetId{} - - 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.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) - } - - if id.AssetName, ok = parsed.Parsed["assetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "assetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAssetIDInsensitively(input string) (*AssetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AssetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AssetId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if id.MediaServiceName, ok = input.Parsed["mediaServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", input) } - if id.AssetName, ok = parsed.Parsed["assetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "assetName", *parsed) + if id.AssetName, ok = input.Parsed["assetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "assetName", input) } - return &id, nil + return nil } // ValidateAssetID checks that 'input' can be parsed as a Asset ID diff --git a/resource-manager/media/2022-08-01/assetsandassetfilters/id_assetfilter.go b/resource-manager/media/2022-08-01/assetsandassetfilters/id_assetfilter.go index 9c7367af6b4..641b06dede9 100644 --- a/resource-manager/media/2022-08-01/assetsandassetfilters/id_assetfilter.go +++ b/resource-manager/media/2022-08-01/assetsandassetfilters/id_assetfilter.go @@ -40,27 +40,9 @@ func ParseAssetFilterID(input string) (*AssetFilterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AssetFilterId{} - - 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.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) - } - - if id.AssetName, ok = parsed.Parsed["assetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "assetName", *parsed) - } - - if id.AssetFilterName, ok = parsed.Parsed["assetFilterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "assetFilterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseAssetFilterIDInsensitively(input string) (*AssetFilterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AssetFilterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *AssetFilterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if id.MediaServiceName, ok = input.Parsed["mediaServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", input) } - if id.AssetName, ok = parsed.Parsed["assetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "assetName", *parsed) + if id.AssetName, ok = input.Parsed["assetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "assetName", input) } - if id.AssetFilterName, ok = parsed.Parsed["assetFilterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "assetFilterName", *parsed) + if id.AssetFilterName, ok = input.Parsed["assetFilterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "assetFilterName", input) } - return &id, nil + return nil } // ValidateAssetFilterID checks that 'input' can be parsed as a Asset Filter ID diff --git a/resource-manager/media/2022-08-01/assetsandassetfilters/id_mediaservice.go b/resource-manager/media/2022-08-01/assetsandassetfilters/id_mediaservice.go index 98df2e0ff2b..04814d7bcae 100644 --- a/resource-manager/media/2022-08-01/assetsandassetfilters/id_mediaservice.go +++ b/resource-manager/media/2022-08-01/assetsandassetfilters/id_mediaservice.go @@ -36,19 +36,9 @@ func ParseMediaServiceID(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MediaServiceId{} - - 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.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMediaServiceIDInsensitively(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MediaServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MediaServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if id.MediaServiceName, ok = input.Parsed["mediaServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", input) } - return &id, nil + return nil } // ValidateMediaServiceID checks that 'input' can be parsed as a Media Service ID diff --git a/resource-manager/media/2022-08-01/assetsandassetfilters/id_track.go b/resource-manager/media/2022-08-01/assetsandassetfilters/id_track.go index 7b0956f2429..411058d73de 100644 --- a/resource-manager/media/2022-08-01/assetsandassetfilters/id_track.go +++ b/resource-manager/media/2022-08-01/assetsandassetfilters/id_track.go @@ -40,27 +40,9 @@ func ParseTrackID(input string) (*TrackId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TrackId{} - - 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.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) - } - - if id.AssetName, ok = parsed.Parsed["assetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "assetName", *parsed) - } - - if id.TrackName, ok = parsed.Parsed["trackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "trackName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseTrackIDInsensitively(input string) (*TrackId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TrackId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TrackId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if id.MediaServiceName, ok = input.Parsed["mediaServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", input) } - if id.AssetName, ok = parsed.Parsed["assetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "assetName", *parsed) + if id.AssetName, ok = input.Parsed["assetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "assetName", input) } - if id.TrackName, ok = parsed.Parsed["trackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "trackName", *parsed) + if id.TrackName, ok = input.Parsed["trackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "trackName", input) } - return &id, nil + return nil } // ValidateTrackID checks that 'input' can be parsed as a Track ID diff --git a/resource-manager/media/2022-08-01/contentkeypolicies/id_contentkeypolicy.go b/resource-manager/media/2022-08-01/contentkeypolicies/id_contentkeypolicy.go index a639f299f7d..c6d19670d29 100644 --- a/resource-manager/media/2022-08-01/contentkeypolicies/id_contentkeypolicy.go +++ b/resource-manager/media/2022-08-01/contentkeypolicies/id_contentkeypolicy.go @@ -38,23 +38,9 @@ func ParseContentKeyPolicyID(input string) (*ContentKeyPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContentKeyPolicyId{} - - 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.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) - } - - if id.ContentKeyPolicyName, ok = parsed.Parsed["contentKeyPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "contentKeyPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseContentKeyPolicyIDInsensitively(input string) (*ContentKeyPolicyId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContentKeyPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ContentKeyPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if id.MediaServiceName, ok = input.Parsed["mediaServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", input) } - if id.ContentKeyPolicyName, ok = parsed.Parsed["contentKeyPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "contentKeyPolicyName", *parsed) + if id.ContentKeyPolicyName, ok = input.Parsed["contentKeyPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "contentKeyPolicyName", input) } - return &id, nil + return nil } // ValidateContentKeyPolicyID checks that 'input' can be parsed as a Content Key Policy ID diff --git a/resource-manager/media/2022-08-01/contentkeypolicies/id_mediaservice.go b/resource-manager/media/2022-08-01/contentkeypolicies/id_mediaservice.go index 0530b48da90..4b966221c63 100644 --- a/resource-manager/media/2022-08-01/contentkeypolicies/id_mediaservice.go +++ b/resource-manager/media/2022-08-01/contentkeypolicies/id_mediaservice.go @@ -36,19 +36,9 @@ func ParseMediaServiceID(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MediaServiceId{} - - 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.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMediaServiceIDInsensitively(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MediaServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MediaServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if id.MediaServiceName, ok = input.Parsed["mediaServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", input) } - return &id, nil + return nil } // ValidateMediaServiceID checks that 'input' can be parsed as a Media Service ID diff --git a/resource-manager/media/2022-08-01/liveevents/id_liveevent.go b/resource-manager/media/2022-08-01/liveevents/id_liveevent.go index 54f722e0dc1..29356220675 100644 --- a/resource-manager/media/2022-08-01/liveevents/id_liveevent.go +++ b/resource-manager/media/2022-08-01/liveevents/id_liveevent.go @@ -38,23 +38,9 @@ func ParseLiveEventID(input string) (*LiveEventId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LiveEventId{} - - 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.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) - } - - if id.LiveEventName, ok = parsed.Parsed["liveEventName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "liveEventName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLiveEventIDInsensitively(input string) (*LiveEventId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LiveEventId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LiveEventId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if id.MediaServiceName, ok = input.Parsed["mediaServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", input) } - if id.LiveEventName, ok = parsed.Parsed["liveEventName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "liveEventName", *parsed) + if id.LiveEventName, ok = input.Parsed["liveEventName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "liveEventName", input) } - return &id, nil + return nil } // ValidateLiveEventID checks that 'input' can be parsed as a Live Event ID diff --git a/resource-manager/media/2022-08-01/liveevents/id_liveeventoperation.go b/resource-manager/media/2022-08-01/liveevents/id_liveeventoperation.go index efe6b92d3a1..8395bebf02e 100644 --- a/resource-manager/media/2022-08-01/liveevents/id_liveeventoperation.go +++ b/resource-manager/media/2022-08-01/liveevents/id_liveeventoperation.go @@ -38,23 +38,9 @@ func ParseLiveEventOperationID(input string) (*LiveEventOperationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LiveEventOperationId{} - - 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.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) - } - - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLiveEventOperationIDInsensitively(input string) (*LiveEventOperationId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LiveEventOperationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LiveEventOperationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if id.MediaServiceName, ok = input.Parsed["mediaServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", input) } - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if id.OperationId, ok = input.Parsed["operationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "operationId", input) } - return &id, nil + return nil } // ValidateLiveEventOperationID checks that 'input' can be parsed as a Live Event Operation ID diff --git a/resource-manager/media/2022-08-01/liveevents/id_mediaservice.go b/resource-manager/media/2022-08-01/liveevents/id_mediaservice.go index 354f5f9e6e9..a5c9eedcee0 100644 --- a/resource-manager/media/2022-08-01/liveevents/id_mediaservice.go +++ b/resource-manager/media/2022-08-01/liveevents/id_mediaservice.go @@ -36,19 +36,9 @@ func ParseMediaServiceID(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MediaServiceId{} - - 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.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMediaServiceIDInsensitively(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MediaServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MediaServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if id.MediaServiceName, ok = input.Parsed["mediaServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", input) } - return &id, nil + return nil } // ValidateMediaServiceID checks that 'input' can be parsed as a Media Service ID diff --git a/resource-manager/media/2022-08-01/liveoutputs/id_liveevent.go b/resource-manager/media/2022-08-01/liveoutputs/id_liveevent.go index daf535f56d4..2a294bb2a87 100644 --- a/resource-manager/media/2022-08-01/liveoutputs/id_liveevent.go +++ b/resource-manager/media/2022-08-01/liveoutputs/id_liveevent.go @@ -38,23 +38,9 @@ func ParseLiveEventID(input string) (*LiveEventId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LiveEventId{} - - 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.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) - } - - if id.LiveEventName, ok = parsed.Parsed["liveEventName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "liveEventName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLiveEventIDInsensitively(input string) (*LiveEventId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LiveEventId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LiveEventId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if id.MediaServiceName, ok = input.Parsed["mediaServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", input) } - if id.LiveEventName, ok = parsed.Parsed["liveEventName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "liveEventName", *parsed) + if id.LiveEventName, ok = input.Parsed["liveEventName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "liveEventName", input) } - return &id, nil + return nil } // ValidateLiveEventID checks that 'input' can be parsed as a Live Event ID diff --git a/resource-manager/media/2022-08-01/liveoutputs/id_liveoutput.go b/resource-manager/media/2022-08-01/liveoutputs/id_liveoutput.go index 8d9aa43084a..dea2b65f673 100644 --- a/resource-manager/media/2022-08-01/liveoutputs/id_liveoutput.go +++ b/resource-manager/media/2022-08-01/liveoutputs/id_liveoutput.go @@ -40,27 +40,9 @@ func ParseLiveOutputID(input string) (*LiveOutputId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LiveOutputId{} - - 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.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) - } - - if id.LiveEventName, ok = parsed.Parsed["liveEventName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "liveEventName", *parsed) - } - - if id.LiveOutputName, ok = parsed.Parsed["liveOutputName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "liveOutputName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseLiveOutputIDInsensitively(input string) (*LiveOutputId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LiveOutputId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LiveOutputId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if id.MediaServiceName, ok = input.Parsed["mediaServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", input) } - if id.LiveEventName, ok = parsed.Parsed["liveEventName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "liveEventName", *parsed) + if id.LiveEventName, ok = input.Parsed["liveEventName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "liveEventName", input) } - if id.LiveOutputName, ok = parsed.Parsed["liveOutputName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "liveOutputName", *parsed) + if id.LiveOutputName, ok = input.Parsed["liveOutputName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "liveOutputName", input) } - return &id, nil + return nil } // ValidateLiveOutputID checks that 'input' can be parsed as a Live Output ID diff --git a/resource-manager/media/2022-08-01/liveoutputs/id_liveoutputoperation.go b/resource-manager/media/2022-08-01/liveoutputs/id_liveoutputoperation.go index 24b0d84bd27..45d739eb46e 100644 --- a/resource-manager/media/2022-08-01/liveoutputs/id_liveoutputoperation.go +++ b/resource-manager/media/2022-08-01/liveoutputs/id_liveoutputoperation.go @@ -38,23 +38,9 @@ func ParseLiveOutputOperationID(input string) (*LiveOutputOperationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LiveOutputOperationId{} - - 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.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) - } - - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLiveOutputOperationIDInsensitively(input string) (*LiveOutputOperation return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LiveOutputOperationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LiveOutputOperationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if id.MediaServiceName, ok = input.Parsed["mediaServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", input) } - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if id.OperationId, ok = input.Parsed["operationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "operationId", input) } - return &id, nil + return nil } // ValidateLiveOutputOperationID checks that 'input' can be parsed as a Live Output Operation ID diff --git a/resource-manager/media/2022-08-01/streamingendpoints/id_mediaservice.go b/resource-manager/media/2022-08-01/streamingendpoints/id_mediaservice.go index 4e906722e84..9396721536c 100644 --- a/resource-manager/media/2022-08-01/streamingendpoints/id_mediaservice.go +++ b/resource-manager/media/2022-08-01/streamingendpoints/id_mediaservice.go @@ -36,19 +36,9 @@ func ParseMediaServiceID(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MediaServiceId{} - - 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.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMediaServiceIDInsensitively(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MediaServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MediaServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if id.MediaServiceName, ok = input.Parsed["mediaServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", input) } - return &id, nil + return nil } // ValidateMediaServiceID checks that 'input' can be parsed as a Media Service ID diff --git a/resource-manager/media/2022-08-01/streamingendpoints/id_streamingendpoint.go b/resource-manager/media/2022-08-01/streamingendpoints/id_streamingendpoint.go index e49e92304ff..3cb564769bc 100644 --- a/resource-manager/media/2022-08-01/streamingendpoints/id_streamingendpoint.go +++ b/resource-manager/media/2022-08-01/streamingendpoints/id_streamingendpoint.go @@ -38,23 +38,9 @@ func ParseStreamingEndpointID(input string) (*StreamingEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StreamingEndpointId{} - - 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.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) - } - - if id.StreamingEndpointName, ok = parsed.Parsed["streamingEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamingEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseStreamingEndpointIDInsensitively(input string) (*StreamingEndpointId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StreamingEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *StreamingEndpointId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if id.MediaServiceName, ok = input.Parsed["mediaServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", input) } - if id.StreamingEndpointName, ok = parsed.Parsed["streamingEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamingEndpointName", *parsed) + if id.StreamingEndpointName, ok = input.Parsed["streamingEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "streamingEndpointName", input) } - return &id, nil + return nil } // ValidateStreamingEndpointID checks that 'input' can be parsed as a Streaming Endpoint ID diff --git a/resource-manager/media/2022-08-01/streamingendpoints/id_streamingendpointoperation.go b/resource-manager/media/2022-08-01/streamingendpoints/id_streamingendpointoperation.go index bde054415ac..01924ca1ba2 100644 --- a/resource-manager/media/2022-08-01/streamingendpoints/id_streamingendpointoperation.go +++ b/resource-manager/media/2022-08-01/streamingendpoints/id_streamingendpointoperation.go @@ -38,23 +38,9 @@ func ParseStreamingEndpointOperationID(input string) (*StreamingEndpointOperatio return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StreamingEndpointOperationId{} - - 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.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) - } - - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseStreamingEndpointOperationIDInsensitively(input string) (*StreamingEnd return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StreamingEndpointOperationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *StreamingEndpointOperationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if id.MediaServiceName, ok = input.Parsed["mediaServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", input) } - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if id.OperationId, ok = input.Parsed["operationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "operationId", input) } - return &id, nil + return nil } // ValidateStreamingEndpointOperationID checks that 'input' can be parsed as a Streaming Endpoint Operation ID diff --git a/resource-manager/media/2022-08-01/streamingpoliciesandstreaminglocators/id_mediaservice.go b/resource-manager/media/2022-08-01/streamingpoliciesandstreaminglocators/id_mediaservice.go index f5ec1a628f9..a7b698c9222 100644 --- a/resource-manager/media/2022-08-01/streamingpoliciesandstreaminglocators/id_mediaservice.go +++ b/resource-manager/media/2022-08-01/streamingpoliciesandstreaminglocators/id_mediaservice.go @@ -36,19 +36,9 @@ func ParseMediaServiceID(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MediaServiceId{} - - 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.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMediaServiceIDInsensitively(input string) (*MediaServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MediaServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MediaServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if id.MediaServiceName, ok = input.Parsed["mediaServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", input) } - return &id, nil + return nil } // ValidateMediaServiceID checks that 'input' can be parsed as a Media Service ID diff --git a/resource-manager/media/2022-08-01/streamingpoliciesandstreaminglocators/id_streaminglocator.go b/resource-manager/media/2022-08-01/streamingpoliciesandstreaminglocators/id_streaminglocator.go index 7685f6c1705..54a38d652e4 100644 --- a/resource-manager/media/2022-08-01/streamingpoliciesandstreaminglocators/id_streaminglocator.go +++ b/resource-manager/media/2022-08-01/streamingpoliciesandstreaminglocators/id_streaminglocator.go @@ -38,23 +38,9 @@ func ParseStreamingLocatorID(input string) (*StreamingLocatorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StreamingLocatorId{} - - 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.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) - } - - if id.StreamingLocatorName, ok = parsed.Parsed["streamingLocatorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamingLocatorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseStreamingLocatorIDInsensitively(input string) (*StreamingLocatorId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StreamingLocatorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *StreamingLocatorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if id.MediaServiceName, ok = input.Parsed["mediaServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", input) } - if id.StreamingLocatorName, ok = parsed.Parsed["streamingLocatorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamingLocatorName", *parsed) + if id.StreamingLocatorName, ok = input.Parsed["streamingLocatorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "streamingLocatorName", input) } - return &id, nil + return nil } // ValidateStreamingLocatorID checks that 'input' can be parsed as a Streaming Locator ID diff --git a/resource-manager/media/2022-08-01/streamingpoliciesandstreaminglocators/id_streamingpolicy.go b/resource-manager/media/2022-08-01/streamingpoliciesandstreaminglocators/id_streamingpolicy.go index 2575a685a18..b9c3100c7f2 100644 --- a/resource-manager/media/2022-08-01/streamingpoliciesandstreaminglocators/id_streamingpolicy.go +++ b/resource-manager/media/2022-08-01/streamingpoliciesandstreaminglocators/id_streamingpolicy.go @@ -38,23 +38,9 @@ func ParseStreamingPolicyID(input string) (*StreamingPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StreamingPolicyId{} - - 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.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) - } - - if id.StreamingPolicyName, ok = parsed.Parsed["streamingPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamingPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseStreamingPolicyIDInsensitively(input string) (*StreamingPolicyId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StreamingPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *StreamingPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MediaServiceName, ok = parsed.Parsed["mediaServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", *parsed) + if id.MediaServiceName, ok = input.Parsed["mediaServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mediaServiceName", input) } - if id.StreamingPolicyName, ok = parsed.Parsed["streamingPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamingPolicyName", *parsed) + if id.StreamingPolicyName, ok = input.Parsed["streamingPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "streamingPolicyName", input) } - return &id, nil + return nil } // ValidateStreamingPolicyID checks that 'input' can be parsed as a Streaming Policy ID diff --git a/resource-manager/migrate/2020-01-01/hypervcluster/id_cluster.go b/resource-manager/migrate/2020-01-01/hypervcluster/id_cluster.go index 1da81988aff..759b77d7c9d 100644 --- a/resource-manager/migrate/2020-01-01/hypervcluster/id_cluster.go +++ b/resource-manager/migrate/2020-01-01/hypervcluster/id_cluster.go @@ -38,23 +38,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.HyperVSiteName, ok = parsed.Parsed["hyperVSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", *parsed) - } - - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ClusterId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HyperVSiteName, ok = parsed.Parsed["hyperVSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", *parsed) + if id.HyperVSiteName, ok = input.Parsed["hyperVSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/migrate/2020-01-01/hypervcluster/id_hypervsite.go b/resource-manager/migrate/2020-01-01/hypervcluster/id_hypervsite.go index 7b4b7b83206..061429e1064 100644 --- a/resource-manager/migrate/2020-01-01/hypervcluster/id_hypervsite.go +++ b/resource-manager/migrate/2020-01-01/hypervcluster/id_hypervsite.go @@ -36,19 +36,9 @@ func ParseHyperVSiteID(input string) (*HyperVSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HyperVSiteId{} - - 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.HyperVSiteName, ok = parsed.Parsed["hyperVSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseHyperVSiteIDInsensitively(input string) (*HyperVSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HyperVSiteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *HyperVSiteId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HyperVSiteName, ok = parsed.Parsed["hyperVSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", *parsed) + if id.HyperVSiteName, ok = input.Parsed["hyperVSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", input) } - return &id, nil + return nil } // ValidateHyperVSiteID checks that 'input' can be parsed as a Hyper V Site ID diff --git a/resource-manager/migrate/2020-01-01/hypervhost/id_host.go b/resource-manager/migrate/2020-01-01/hypervhost/id_host.go index 4f0d082dfc8..8ff4a6133c9 100644 --- a/resource-manager/migrate/2020-01-01/hypervhost/id_host.go +++ b/resource-manager/migrate/2020-01-01/hypervhost/id_host.go @@ -38,23 +38,9 @@ func ParseHostID(input string) (*HostId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostId{} - - 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.HyperVSiteName, ok = parsed.Parsed["hyperVSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", *parsed) - } - - if id.HostName, ok = parsed.Parsed["hostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseHostIDInsensitively(input string) (*HostId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *HostId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HyperVSiteName, ok = parsed.Parsed["hyperVSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", *parsed) + if id.HyperVSiteName, ok = input.Parsed["hyperVSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", input) } - if id.HostName, ok = parsed.Parsed["hostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostName", *parsed) + if id.HostName, ok = input.Parsed["hostName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostName", input) } - return &id, nil + return nil } // ValidateHostID checks that 'input' can be parsed as a Host ID diff --git a/resource-manager/migrate/2020-01-01/hypervhost/id_hypervsite.go b/resource-manager/migrate/2020-01-01/hypervhost/id_hypervsite.go index 33e86af19b5..bb4e62e9d9c 100644 --- a/resource-manager/migrate/2020-01-01/hypervhost/id_hypervsite.go +++ b/resource-manager/migrate/2020-01-01/hypervhost/id_hypervsite.go @@ -36,19 +36,9 @@ func ParseHyperVSiteID(input string) (*HyperVSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HyperVSiteId{} - - 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.HyperVSiteName, ok = parsed.Parsed["hyperVSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseHyperVSiteIDInsensitively(input string) (*HyperVSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HyperVSiteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *HyperVSiteId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HyperVSiteName, ok = parsed.Parsed["hyperVSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", *parsed) + if id.HyperVSiteName, ok = input.Parsed["hyperVSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", input) } - return &id, nil + return nil } // ValidateHyperVSiteID checks that 'input' can be parsed as a Hyper V Site ID diff --git a/resource-manager/migrate/2020-01-01/hypervjobs/id_hypervsite.go b/resource-manager/migrate/2020-01-01/hypervjobs/id_hypervsite.go index 6d3bed24a08..84a9f56877f 100644 --- a/resource-manager/migrate/2020-01-01/hypervjobs/id_hypervsite.go +++ b/resource-manager/migrate/2020-01-01/hypervjobs/id_hypervsite.go @@ -36,19 +36,9 @@ func ParseHyperVSiteID(input string) (*HyperVSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HyperVSiteId{} - - 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.HyperVSiteName, ok = parsed.Parsed["hyperVSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseHyperVSiteIDInsensitively(input string) (*HyperVSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HyperVSiteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *HyperVSiteId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HyperVSiteName, ok = parsed.Parsed["hyperVSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", *parsed) + if id.HyperVSiteName, ok = input.Parsed["hyperVSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", input) } - return &id, nil + return nil } // ValidateHyperVSiteID checks that 'input' can be parsed as a Hyper V Site ID diff --git a/resource-manager/migrate/2020-01-01/hypervmachines/id_hypervsite.go b/resource-manager/migrate/2020-01-01/hypervmachines/id_hypervsite.go index 47820a0c614..1e6ac90af9b 100644 --- a/resource-manager/migrate/2020-01-01/hypervmachines/id_hypervsite.go +++ b/resource-manager/migrate/2020-01-01/hypervmachines/id_hypervsite.go @@ -36,19 +36,9 @@ func ParseHyperVSiteID(input string) (*HyperVSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HyperVSiteId{} - - 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.HyperVSiteName, ok = parsed.Parsed["hyperVSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseHyperVSiteIDInsensitively(input string) (*HyperVSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HyperVSiteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *HyperVSiteId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HyperVSiteName, ok = parsed.Parsed["hyperVSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", *parsed) + if id.HyperVSiteName, ok = input.Parsed["hyperVSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", input) } - return &id, nil + return nil } // ValidateHyperVSiteID checks that 'input' can be parsed as a Hyper V Site ID diff --git a/resource-manager/migrate/2020-01-01/hypervrunasaccounts/id_hypervsite.go b/resource-manager/migrate/2020-01-01/hypervrunasaccounts/id_hypervsite.go index 9f9deb8b4c1..dc03f101366 100644 --- a/resource-manager/migrate/2020-01-01/hypervrunasaccounts/id_hypervsite.go +++ b/resource-manager/migrate/2020-01-01/hypervrunasaccounts/id_hypervsite.go @@ -36,19 +36,9 @@ func ParseHyperVSiteID(input string) (*HyperVSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HyperVSiteId{} - - 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.HyperVSiteName, ok = parsed.Parsed["hyperVSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseHyperVSiteIDInsensitively(input string) (*HyperVSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HyperVSiteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *HyperVSiteId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HyperVSiteName, ok = parsed.Parsed["hyperVSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", *parsed) + if id.HyperVSiteName, ok = input.Parsed["hyperVSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", input) } - return &id, nil + return nil } // ValidateHyperVSiteID checks that 'input' can be parsed as a Hyper V Site ID diff --git a/resource-manager/migrate/2020-01-01/hypervsites/id_hypervsite.go b/resource-manager/migrate/2020-01-01/hypervsites/id_hypervsite.go index b3514dcff87..f462e2dead0 100644 --- a/resource-manager/migrate/2020-01-01/hypervsites/id_hypervsite.go +++ b/resource-manager/migrate/2020-01-01/hypervsites/id_hypervsite.go @@ -36,19 +36,9 @@ func ParseHyperVSiteID(input string) (*HyperVSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HyperVSiteId{} - - 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.HyperVSiteName, ok = parsed.Parsed["hyperVSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseHyperVSiteIDInsensitively(input string) (*HyperVSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HyperVSiteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *HyperVSiteId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HyperVSiteName, ok = parsed.Parsed["hyperVSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", *parsed) + if id.HyperVSiteName, ok = input.Parsed["hyperVSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", input) } - return &id, nil + return nil } // ValidateHyperVSiteID checks that 'input' can be parsed as a Hyper V Site ID diff --git a/resource-manager/migrate/2020-01-01/jobs/id_vmwaresite.go b/resource-manager/migrate/2020-01-01/jobs/id_vmwaresite.go index 3c0a092f95e..e84703acd4d 100644 --- a/resource-manager/migrate/2020-01-01/jobs/id_vmwaresite.go +++ b/resource-manager/migrate/2020-01-01/jobs/id_vmwaresite.go @@ -36,19 +36,9 @@ func ParseVMwareSiteID(input string) (*VMwareSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VMwareSiteId{} - - 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.VmwareSiteName, ok = parsed.Parsed["vmwareSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vmwareSiteName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVMwareSiteIDInsensitively(input string) (*VMwareSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VMwareSiteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VMwareSiteId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VmwareSiteName, ok = parsed.Parsed["vmwareSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vmwareSiteName", *parsed) + if id.VmwareSiteName, ok = input.Parsed["vmwareSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vmwareSiteName", input) } - return &id, nil + return nil } // ValidateVMwareSiteID checks that 'input' can be parsed as a V Mware Site ID diff --git a/resource-manager/migrate/2020-01-01/machines/id_vmwaresite.go b/resource-manager/migrate/2020-01-01/machines/id_vmwaresite.go index d7c350b4e0f..ce511fde5bd 100644 --- a/resource-manager/migrate/2020-01-01/machines/id_vmwaresite.go +++ b/resource-manager/migrate/2020-01-01/machines/id_vmwaresite.go @@ -36,19 +36,9 @@ func ParseVMwareSiteID(input string) (*VMwareSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VMwareSiteId{} - - 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.VmwareSiteName, ok = parsed.Parsed["vmwareSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vmwareSiteName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVMwareSiteIDInsensitively(input string) (*VMwareSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VMwareSiteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VMwareSiteId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VmwareSiteName, ok = parsed.Parsed["vmwareSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vmwareSiteName", *parsed) + if id.VmwareSiteName, ok = input.Parsed["vmwareSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vmwareSiteName", input) } - return &id, nil + return nil } // ValidateVMwareSiteID checks that 'input' can be parsed as a V Mware Site ID diff --git a/resource-manager/migrate/2020-01-01/runasaccounts/id_vmwaresite.go b/resource-manager/migrate/2020-01-01/runasaccounts/id_vmwaresite.go index efaf5b4477f..20b7b8a5146 100644 --- a/resource-manager/migrate/2020-01-01/runasaccounts/id_vmwaresite.go +++ b/resource-manager/migrate/2020-01-01/runasaccounts/id_vmwaresite.go @@ -36,19 +36,9 @@ func ParseVMwareSiteID(input string) (*VMwareSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VMwareSiteId{} - - 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.VmwareSiteName, ok = parsed.Parsed["vmwareSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vmwareSiteName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVMwareSiteIDInsensitively(input string) (*VMwareSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VMwareSiteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VMwareSiteId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VmwareSiteName, ok = parsed.Parsed["vmwareSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vmwareSiteName", *parsed) + if id.VmwareSiteName, ok = input.Parsed["vmwareSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vmwareSiteName", input) } - return &id, nil + return nil } // ValidateVMwareSiteID checks that 'input' can be parsed as a V Mware Site ID diff --git a/resource-manager/migrate/2020-01-01/sites/id_vmwaresite.go b/resource-manager/migrate/2020-01-01/sites/id_vmwaresite.go index b42685a6e8a..a4f4aded647 100644 --- a/resource-manager/migrate/2020-01-01/sites/id_vmwaresite.go +++ b/resource-manager/migrate/2020-01-01/sites/id_vmwaresite.go @@ -36,19 +36,9 @@ func ParseVMwareSiteID(input string) (*VMwareSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VMwareSiteId{} - - 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.VmwareSiteName, ok = parsed.Parsed["vmwareSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vmwareSiteName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVMwareSiteIDInsensitively(input string) (*VMwareSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VMwareSiteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VMwareSiteId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VmwareSiteName, ok = parsed.Parsed["vmwareSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vmwareSiteName", *parsed) + if id.VmwareSiteName, ok = input.Parsed["vmwareSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vmwareSiteName", input) } - return &id, nil + return nil } // ValidateVMwareSiteID checks that 'input' can be parsed as a V Mware Site ID diff --git a/resource-manager/migrate/2020-01-01/vcenter/id_vcenter.go b/resource-manager/migrate/2020-01-01/vcenter/id_vcenter.go index 95b4222253c..09fd1d6b697 100644 --- a/resource-manager/migrate/2020-01-01/vcenter/id_vcenter.go +++ b/resource-manager/migrate/2020-01-01/vcenter/id_vcenter.go @@ -38,23 +38,9 @@ func ParseVCenterID(input string) (*VCenterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VCenterId{} - - 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.VmwareSiteName, ok = parsed.Parsed["vmwareSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vmwareSiteName", *parsed) - } - - if id.VCenterName, ok = parsed.Parsed["vCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vCenterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVCenterIDInsensitively(input string) (*VCenterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VCenterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VCenterId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VmwareSiteName, ok = parsed.Parsed["vmwareSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vmwareSiteName", *parsed) + if id.VmwareSiteName, ok = input.Parsed["vmwareSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vmwareSiteName", input) } - if id.VCenterName, ok = parsed.Parsed["vCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vCenterName", *parsed) + if id.VCenterName, ok = input.Parsed["vCenterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vCenterName", input) } - return &id, nil + return nil } // ValidateVCenterID checks that 'input' can be parsed as a V Center ID diff --git a/resource-manager/migrate/2020-01-01/vcenter/id_vmwaresite.go b/resource-manager/migrate/2020-01-01/vcenter/id_vmwaresite.go index 280cb324392..3ef9e47174e 100644 --- a/resource-manager/migrate/2020-01-01/vcenter/id_vmwaresite.go +++ b/resource-manager/migrate/2020-01-01/vcenter/id_vmwaresite.go @@ -36,19 +36,9 @@ func ParseVMwareSiteID(input string) (*VMwareSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VMwareSiteId{} - - 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.VmwareSiteName, ok = parsed.Parsed["vmwareSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vmwareSiteName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVMwareSiteIDInsensitively(input string) (*VMwareSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VMwareSiteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VMwareSiteId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VmwareSiteName, ok = parsed.Parsed["vmwareSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vmwareSiteName", *parsed) + if id.VmwareSiteName, ok = input.Parsed["vmwareSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vmwareSiteName", input) } - return &id, nil + return nil } // ValidateVMwareSiteID checks that 'input' can be parsed as a V Mware Site ID diff --git a/resource-manager/migrate/2020-07-07/hypervcluster/id_cluster.go b/resource-manager/migrate/2020-07-07/hypervcluster/id_cluster.go index 1da81988aff..759b77d7c9d 100644 --- a/resource-manager/migrate/2020-07-07/hypervcluster/id_cluster.go +++ b/resource-manager/migrate/2020-07-07/hypervcluster/id_cluster.go @@ -38,23 +38,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.HyperVSiteName, ok = parsed.Parsed["hyperVSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", *parsed) - } - - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ClusterId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HyperVSiteName, ok = parsed.Parsed["hyperVSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", *parsed) + if id.HyperVSiteName, ok = input.Parsed["hyperVSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/migrate/2020-07-07/hypervcluster/id_hypervsite.go b/resource-manager/migrate/2020-07-07/hypervcluster/id_hypervsite.go index 7b4b7b83206..061429e1064 100644 --- a/resource-manager/migrate/2020-07-07/hypervcluster/id_hypervsite.go +++ b/resource-manager/migrate/2020-07-07/hypervcluster/id_hypervsite.go @@ -36,19 +36,9 @@ func ParseHyperVSiteID(input string) (*HyperVSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HyperVSiteId{} - - 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.HyperVSiteName, ok = parsed.Parsed["hyperVSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseHyperVSiteIDInsensitively(input string) (*HyperVSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HyperVSiteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *HyperVSiteId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HyperVSiteName, ok = parsed.Parsed["hyperVSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", *parsed) + if id.HyperVSiteName, ok = input.Parsed["hyperVSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", input) } - return &id, nil + return nil } // ValidateHyperVSiteID checks that 'input' can be parsed as a Hyper V Site ID diff --git a/resource-manager/migrate/2020-07-07/hypervhost/id_host.go b/resource-manager/migrate/2020-07-07/hypervhost/id_host.go index 4f0d082dfc8..8ff4a6133c9 100644 --- a/resource-manager/migrate/2020-07-07/hypervhost/id_host.go +++ b/resource-manager/migrate/2020-07-07/hypervhost/id_host.go @@ -38,23 +38,9 @@ func ParseHostID(input string) (*HostId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostId{} - - 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.HyperVSiteName, ok = parsed.Parsed["hyperVSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", *parsed) - } - - if id.HostName, ok = parsed.Parsed["hostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseHostIDInsensitively(input string) (*HostId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *HostId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HyperVSiteName, ok = parsed.Parsed["hyperVSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", *parsed) + if id.HyperVSiteName, ok = input.Parsed["hyperVSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", input) } - if id.HostName, ok = parsed.Parsed["hostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostName", *parsed) + if id.HostName, ok = input.Parsed["hostName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostName", input) } - return &id, nil + return nil } // ValidateHostID checks that 'input' can be parsed as a Host ID diff --git a/resource-manager/migrate/2020-07-07/hypervhost/id_hypervsite.go b/resource-manager/migrate/2020-07-07/hypervhost/id_hypervsite.go index 33e86af19b5..bb4e62e9d9c 100644 --- a/resource-manager/migrate/2020-07-07/hypervhost/id_hypervsite.go +++ b/resource-manager/migrate/2020-07-07/hypervhost/id_hypervsite.go @@ -36,19 +36,9 @@ func ParseHyperVSiteID(input string) (*HyperVSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HyperVSiteId{} - - 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.HyperVSiteName, ok = parsed.Parsed["hyperVSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseHyperVSiteIDInsensitively(input string) (*HyperVSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HyperVSiteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *HyperVSiteId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HyperVSiteName, ok = parsed.Parsed["hyperVSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", *parsed) + if id.HyperVSiteName, ok = input.Parsed["hyperVSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", input) } - return &id, nil + return nil } // ValidateHyperVSiteID checks that 'input' can be parsed as a Hyper V Site ID diff --git a/resource-manager/migrate/2020-07-07/hypervjobs/id_hypervsite.go b/resource-manager/migrate/2020-07-07/hypervjobs/id_hypervsite.go index 6d3bed24a08..84a9f56877f 100644 --- a/resource-manager/migrate/2020-07-07/hypervjobs/id_hypervsite.go +++ b/resource-manager/migrate/2020-07-07/hypervjobs/id_hypervsite.go @@ -36,19 +36,9 @@ func ParseHyperVSiteID(input string) (*HyperVSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HyperVSiteId{} - - 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.HyperVSiteName, ok = parsed.Parsed["hyperVSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseHyperVSiteIDInsensitively(input string) (*HyperVSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HyperVSiteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *HyperVSiteId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HyperVSiteName, ok = parsed.Parsed["hyperVSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", *parsed) + if id.HyperVSiteName, ok = input.Parsed["hyperVSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", input) } - return &id, nil + return nil } // ValidateHyperVSiteID checks that 'input' can be parsed as a Hyper V Site ID diff --git a/resource-manager/migrate/2020-07-07/hypervmachines/id_hypervsite.go b/resource-manager/migrate/2020-07-07/hypervmachines/id_hypervsite.go index 47820a0c614..1e6ac90af9b 100644 --- a/resource-manager/migrate/2020-07-07/hypervmachines/id_hypervsite.go +++ b/resource-manager/migrate/2020-07-07/hypervmachines/id_hypervsite.go @@ -36,19 +36,9 @@ func ParseHyperVSiteID(input string) (*HyperVSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HyperVSiteId{} - - 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.HyperVSiteName, ok = parsed.Parsed["hyperVSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseHyperVSiteIDInsensitively(input string) (*HyperVSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HyperVSiteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *HyperVSiteId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HyperVSiteName, ok = parsed.Parsed["hyperVSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", *parsed) + if id.HyperVSiteName, ok = input.Parsed["hyperVSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", input) } - return &id, nil + return nil } // ValidateHyperVSiteID checks that 'input' can be parsed as a Hyper V Site ID diff --git a/resource-manager/migrate/2020-07-07/hypervrunasaccounts/id_hypervsite.go b/resource-manager/migrate/2020-07-07/hypervrunasaccounts/id_hypervsite.go index 9f9deb8b4c1..dc03f101366 100644 --- a/resource-manager/migrate/2020-07-07/hypervrunasaccounts/id_hypervsite.go +++ b/resource-manager/migrate/2020-07-07/hypervrunasaccounts/id_hypervsite.go @@ -36,19 +36,9 @@ func ParseHyperVSiteID(input string) (*HyperVSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HyperVSiteId{} - - 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.HyperVSiteName, ok = parsed.Parsed["hyperVSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseHyperVSiteIDInsensitively(input string) (*HyperVSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HyperVSiteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *HyperVSiteId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HyperVSiteName, ok = parsed.Parsed["hyperVSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", *parsed) + if id.HyperVSiteName, ok = input.Parsed["hyperVSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", input) } - return &id, nil + return nil } // ValidateHyperVSiteID checks that 'input' can be parsed as a Hyper V Site ID diff --git a/resource-manager/migrate/2020-07-07/hypervsites/id_hypervsite.go b/resource-manager/migrate/2020-07-07/hypervsites/id_hypervsite.go index b3514dcff87..f462e2dead0 100644 --- a/resource-manager/migrate/2020-07-07/hypervsites/id_hypervsite.go +++ b/resource-manager/migrate/2020-07-07/hypervsites/id_hypervsite.go @@ -36,19 +36,9 @@ func ParseHyperVSiteID(input string) (*HyperVSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HyperVSiteId{} - - 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.HyperVSiteName, ok = parsed.Parsed["hyperVSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseHyperVSiteIDInsensitively(input string) (*HyperVSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HyperVSiteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *HyperVSiteId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HyperVSiteName, ok = parsed.Parsed["hyperVSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", *parsed) + if id.HyperVSiteName, ok = input.Parsed["hyperVSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hyperVSiteName", input) } - return &id, nil + return nil } // ValidateHyperVSiteID checks that 'input' can be parsed as a Hyper V Site ID diff --git a/resource-manager/migrate/2020-07-07/jobs/id_vmwaresite.go b/resource-manager/migrate/2020-07-07/jobs/id_vmwaresite.go index 3c0a092f95e..e84703acd4d 100644 --- a/resource-manager/migrate/2020-07-07/jobs/id_vmwaresite.go +++ b/resource-manager/migrate/2020-07-07/jobs/id_vmwaresite.go @@ -36,19 +36,9 @@ func ParseVMwareSiteID(input string) (*VMwareSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VMwareSiteId{} - - 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.VmwareSiteName, ok = parsed.Parsed["vmwareSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vmwareSiteName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVMwareSiteIDInsensitively(input string) (*VMwareSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VMwareSiteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VMwareSiteId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VmwareSiteName, ok = parsed.Parsed["vmwareSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vmwareSiteName", *parsed) + if id.VmwareSiteName, ok = input.Parsed["vmwareSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vmwareSiteName", input) } - return &id, nil + return nil } // ValidateVMwareSiteID checks that 'input' can be parsed as a V Mware Site ID diff --git a/resource-manager/migrate/2020-07-07/machines/id_vmwaresite.go b/resource-manager/migrate/2020-07-07/machines/id_vmwaresite.go index d7c350b4e0f..ce511fde5bd 100644 --- a/resource-manager/migrate/2020-07-07/machines/id_vmwaresite.go +++ b/resource-manager/migrate/2020-07-07/machines/id_vmwaresite.go @@ -36,19 +36,9 @@ func ParseVMwareSiteID(input string) (*VMwareSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VMwareSiteId{} - - 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.VmwareSiteName, ok = parsed.Parsed["vmwareSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vmwareSiteName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVMwareSiteIDInsensitively(input string) (*VMwareSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VMwareSiteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VMwareSiteId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VmwareSiteName, ok = parsed.Parsed["vmwareSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vmwareSiteName", *parsed) + if id.VmwareSiteName, ok = input.Parsed["vmwareSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vmwareSiteName", input) } - return &id, nil + return nil } // ValidateVMwareSiteID checks that 'input' can be parsed as a V Mware Site ID diff --git a/resource-manager/migrate/2020-07-07/mastersites/id_mastersite.go b/resource-manager/migrate/2020-07-07/mastersites/id_mastersite.go index 34fdf86e617..95555951bcf 100644 --- a/resource-manager/migrate/2020-07-07/mastersites/id_mastersite.go +++ b/resource-manager/migrate/2020-07-07/mastersites/id_mastersite.go @@ -36,19 +36,9 @@ func ParseMasterSiteID(input string) (*MasterSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MasterSiteId{} - - 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.MasterSiteName, ok = parsed.Parsed["masterSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "masterSiteName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMasterSiteIDInsensitively(input string) (*MasterSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MasterSiteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MasterSiteId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MasterSiteName, ok = parsed.Parsed["masterSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "masterSiteName", *parsed) + if id.MasterSiteName, ok = input.Parsed["masterSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "masterSiteName", input) } - return &id, nil + return nil } // ValidateMasterSiteID checks that 'input' can be parsed as a Master Site ID diff --git a/resource-manager/migrate/2020-07-07/privateendpointconnection/id_mastersite.go b/resource-manager/migrate/2020-07-07/privateendpointconnection/id_mastersite.go index 9e3f6c463da..46c23350a44 100644 --- a/resource-manager/migrate/2020-07-07/privateendpointconnection/id_mastersite.go +++ b/resource-manager/migrate/2020-07-07/privateendpointconnection/id_mastersite.go @@ -36,19 +36,9 @@ func ParseMasterSiteID(input string) (*MasterSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MasterSiteId{} - - 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.MasterSiteName, ok = parsed.Parsed["masterSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "masterSiteName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMasterSiteIDInsensitively(input string) (*MasterSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MasterSiteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MasterSiteId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MasterSiteName, ok = parsed.Parsed["masterSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "masterSiteName", *parsed) + if id.MasterSiteName, ok = input.Parsed["masterSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "masterSiteName", input) } - return &id, nil + return nil } // ValidateMasterSiteID checks that 'input' can be parsed as a Master Site ID diff --git a/resource-manager/migrate/2020-07-07/privateendpointconnection/id_privateendpointconnection.go b/resource-manager/migrate/2020-07-07/privateendpointconnection/id_privateendpointconnection.go index f15be6e5e44..5a61117ba40 100644 --- a/resource-manager/migrate/2020-07-07/privateendpointconnection/id_privateendpointconnection.go +++ b/resource-manager/migrate/2020-07-07/privateendpointconnection/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.MasterSiteName, ok = parsed.Parsed["masterSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "masterSiteName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MasterSiteName, ok = parsed.Parsed["masterSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "masterSiteName", *parsed) + if id.MasterSiteName, ok = input.Parsed["masterSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "masterSiteName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/migrate/2020-07-07/privatelinkresources/id_mastersite.go b/resource-manager/migrate/2020-07-07/privatelinkresources/id_mastersite.go index ee4e7d4be1d..75a2fae0b2b 100644 --- a/resource-manager/migrate/2020-07-07/privatelinkresources/id_mastersite.go +++ b/resource-manager/migrate/2020-07-07/privatelinkresources/id_mastersite.go @@ -36,19 +36,9 @@ func ParseMasterSiteID(input string) (*MasterSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MasterSiteId{} - - 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.MasterSiteName, ok = parsed.Parsed["masterSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "masterSiteName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMasterSiteIDInsensitively(input string) (*MasterSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MasterSiteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MasterSiteId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MasterSiteName, ok = parsed.Parsed["masterSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "masterSiteName", *parsed) + if id.MasterSiteName, ok = input.Parsed["masterSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "masterSiteName", input) } - return &id, nil + return nil } // ValidateMasterSiteID checks that 'input' can be parsed as a Master Site ID diff --git a/resource-manager/migrate/2020-07-07/privatelinkresources/id_privatelinkresource.go b/resource-manager/migrate/2020-07-07/privatelinkresources/id_privatelinkresource.go index 8930d7998b2..80d9012ac0e 100644 --- a/resource-manager/migrate/2020-07-07/privatelinkresources/id_privatelinkresource.go +++ b/resource-manager/migrate/2020-07-07/privatelinkresources/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.MasterSiteName, ok = parsed.Parsed["masterSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "masterSiteName", *parsed) - } - - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MasterSiteName, ok = parsed.Parsed["masterSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "masterSiteName", *parsed) + if id.MasterSiteName, ok = input.Parsed["masterSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "masterSiteName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/migrate/2020-07-07/runasaccounts/id_vmwaresite.go b/resource-manager/migrate/2020-07-07/runasaccounts/id_vmwaresite.go index efaf5b4477f..20b7b8a5146 100644 --- a/resource-manager/migrate/2020-07-07/runasaccounts/id_vmwaresite.go +++ b/resource-manager/migrate/2020-07-07/runasaccounts/id_vmwaresite.go @@ -36,19 +36,9 @@ func ParseVMwareSiteID(input string) (*VMwareSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VMwareSiteId{} - - 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.VmwareSiteName, ok = parsed.Parsed["vmwareSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vmwareSiteName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVMwareSiteIDInsensitively(input string) (*VMwareSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VMwareSiteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VMwareSiteId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VmwareSiteName, ok = parsed.Parsed["vmwareSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vmwareSiteName", *parsed) + if id.VmwareSiteName, ok = input.Parsed["vmwareSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vmwareSiteName", input) } - return &id, nil + return nil } // ValidateVMwareSiteID checks that 'input' can be parsed as a V Mware Site ID diff --git a/resource-manager/migrate/2020-07-07/sites/id_vmwaresite.go b/resource-manager/migrate/2020-07-07/sites/id_vmwaresite.go index b42685a6e8a..a4f4aded647 100644 --- a/resource-manager/migrate/2020-07-07/sites/id_vmwaresite.go +++ b/resource-manager/migrate/2020-07-07/sites/id_vmwaresite.go @@ -36,19 +36,9 @@ func ParseVMwareSiteID(input string) (*VMwareSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VMwareSiteId{} - - 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.VmwareSiteName, ok = parsed.Parsed["vmwareSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vmwareSiteName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVMwareSiteIDInsensitively(input string) (*VMwareSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VMwareSiteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VMwareSiteId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VmwareSiteName, ok = parsed.Parsed["vmwareSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vmwareSiteName", *parsed) + if id.VmwareSiteName, ok = input.Parsed["vmwareSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vmwareSiteName", input) } - return &id, nil + return nil } // ValidateVMwareSiteID checks that 'input' can be parsed as a V Mware Site ID diff --git a/resource-manager/migrate/2020-07-07/vcenter/id_vcenter.go b/resource-manager/migrate/2020-07-07/vcenter/id_vcenter.go index 95b4222253c..09fd1d6b697 100644 --- a/resource-manager/migrate/2020-07-07/vcenter/id_vcenter.go +++ b/resource-manager/migrate/2020-07-07/vcenter/id_vcenter.go @@ -38,23 +38,9 @@ func ParseVCenterID(input string) (*VCenterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VCenterId{} - - 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.VmwareSiteName, ok = parsed.Parsed["vmwareSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vmwareSiteName", *parsed) - } - - if id.VCenterName, ok = parsed.Parsed["vCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vCenterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVCenterIDInsensitively(input string) (*VCenterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VCenterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VCenterId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VmwareSiteName, ok = parsed.Parsed["vmwareSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vmwareSiteName", *parsed) + if id.VmwareSiteName, ok = input.Parsed["vmwareSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vmwareSiteName", input) } - if id.VCenterName, ok = parsed.Parsed["vCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vCenterName", *parsed) + if id.VCenterName, ok = input.Parsed["vCenterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vCenterName", input) } - return &id, nil + return nil } // ValidateVCenterID checks that 'input' can be parsed as a V Center ID diff --git a/resource-manager/migrate/2020-07-07/vcenter/id_vmwaresite.go b/resource-manager/migrate/2020-07-07/vcenter/id_vmwaresite.go index 280cb324392..3ef9e47174e 100644 --- a/resource-manager/migrate/2020-07-07/vcenter/id_vmwaresite.go +++ b/resource-manager/migrate/2020-07-07/vcenter/id_vmwaresite.go @@ -36,19 +36,9 @@ func ParseVMwareSiteID(input string) (*VMwareSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VMwareSiteId{} - - 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.VmwareSiteName, ok = parsed.Parsed["vmwareSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vmwareSiteName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVMwareSiteIDInsensitively(input string) (*VMwareSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VMwareSiteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VMwareSiteId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VmwareSiteName, ok = parsed.Parsed["vmwareSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vmwareSiteName", *parsed) + if id.VmwareSiteName, ok = input.Parsed["vmwareSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vmwareSiteName", input) } - return &id, nil + return nil } // ValidateVMwareSiteID checks that 'input' can be parsed as a V Mware Site ID diff --git a/resource-manager/mixedreality/2021-01-01/key/id_remoterenderingaccount.go b/resource-manager/mixedreality/2021-01-01/key/id_remoterenderingaccount.go index 1d815465967..72fed3c5c87 100644 --- a/resource-manager/mixedreality/2021-01-01/key/id_remoterenderingaccount.go +++ b/resource-manager/mixedreality/2021-01-01/key/id_remoterenderingaccount.go @@ -36,19 +36,9 @@ func ParseRemoteRenderingAccountID(input string) (*RemoteRenderingAccountId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RemoteRenderingAccountId{} - - 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.RemoteRenderingAccountName, ok = parsed.Parsed["remoteRenderingAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "remoteRenderingAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRemoteRenderingAccountIDInsensitively(input string) (*RemoteRenderingA return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RemoteRenderingAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RemoteRenderingAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RemoteRenderingAccountName, ok = parsed.Parsed["remoteRenderingAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "remoteRenderingAccountName", *parsed) + if id.RemoteRenderingAccountName, ok = input.Parsed["remoteRenderingAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "remoteRenderingAccountName", input) } - return &id, nil + return nil } // ValidateRemoteRenderingAccountID checks that 'input' can be parsed as a Remote Rendering Account ID diff --git a/resource-manager/mixedreality/2021-01-01/key/id_spatialanchorsaccount.go b/resource-manager/mixedreality/2021-01-01/key/id_spatialanchorsaccount.go index 2ff01051f9e..37b81238f75 100644 --- a/resource-manager/mixedreality/2021-01-01/key/id_spatialanchorsaccount.go +++ b/resource-manager/mixedreality/2021-01-01/key/id_spatialanchorsaccount.go @@ -36,19 +36,9 @@ func ParseSpatialAnchorsAccountID(input string) (*SpatialAnchorsAccountId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SpatialAnchorsAccountId{} - - 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.SpatialAnchorsAccountName, ok = parsed.Parsed["spatialAnchorsAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "spatialAnchorsAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSpatialAnchorsAccountIDInsensitively(input string) (*SpatialAnchorsAcc return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SpatialAnchorsAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SpatialAnchorsAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpatialAnchorsAccountName, ok = parsed.Parsed["spatialAnchorsAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "spatialAnchorsAccountName", *parsed) + if id.SpatialAnchorsAccountName, ok = input.Parsed["spatialAnchorsAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "spatialAnchorsAccountName", input) } - return &id, nil + return nil } // ValidateSpatialAnchorsAccountID checks that 'input' can be parsed as a Spatial Anchors Account ID diff --git a/resource-manager/mixedreality/2021-01-01/proxy/id_location.go b/resource-manager/mixedreality/2021-01-01/proxy/id_location.go index a781863ce43..28d2cb888a5 100644 --- a/resource-manager/mixedreality/2021-01-01/proxy/id_location.go +++ b/resource-manager/mixedreality/2021-01-01/proxy/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/mixedreality/2021-01-01/resource/id_remoterenderingaccount.go b/resource-manager/mixedreality/2021-01-01/resource/id_remoterenderingaccount.go index 6fa891a5fe9..aba7a0e6ade 100644 --- a/resource-manager/mixedreality/2021-01-01/resource/id_remoterenderingaccount.go +++ b/resource-manager/mixedreality/2021-01-01/resource/id_remoterenderingaccount.go @@ -36,19 +36,9 @@ func ParseRemoteRenderingAccountID(input string) (*RemoteRenderingAccountId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RemoteRenderingAccountId{} - - 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.RemoteRenderingAccountName, ok = parsed.Parsed["remoteRenderingAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "remoteRenderingAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRemoteRenderingAccountIDInsensitively(input string) (*RemoteRenderingA return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RemoteRenderingAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RemoteRenderingAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RemoteRenderingAccountName, ok = parsed.Parsed["remoteRenderingAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "remoteRenderingAccountName", *parsed) + if id.RemoteRenderingAccountName, ok = input.Parsed["remoteRenderingAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "remoteRenderingAccountName", input) } - return &id, nil + return nil } // ValidateRemoteRenderingAccountID checks that 'input' can be parsed as a Remote Rendering Account ID diff --git a/resource-manager/mixedreality/2021-01-01/resource/id_spatialanchorsaccount.go b/resource-manager/mixedreality/2021-01-01/resource/id_spatialanchorsaccount.go index 1f8fcebfce7..f827c8e6f2a 100644 --- a/resource-manager/mixedreality/2021-01-01/resource/id_spatialanchorsaccount.go +++ b/resource-manager/mixedreality/2021-01-01/resource/id_spatialanchorsaccount.go @@ -36,19 +36,9 @@ func ParseSpatialAnchorsAccountID(input string) (*SpatialAnchorsAccountId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SpatialAnchorsAccountId{} - - 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.SpatialAnchorsAccountName, ok = parsed.Parsed["spatialAnchorsAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "spatialAnchorsAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSpatialAnchorsAccountIDInsensitively(input string) (*SpatialAnchorsAcc return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SpatialAnchorsAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SpatialAnchorsAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpatialAnchorsAccountName, ok = parsed.Parsed["spatialAnchorsAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "spatialAnchorsAccountName", *parsed) + if id.SpatialAnchorsAccountName, ok = input.Parsed["spatialAnchorsAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "spatialAnchorsAccountName", input) } - return &id, nil + return nil } // ValidateSpatialAnchorsAccountID checks that 'input' can be parsed as a Spatial Anchors Account ID diff --git a/resource-manager/mobilenetwork/2022-11-01/attacheddatanetwork/id_attacheddatanetwork.go b/resource-manager/mobilenetwork/2022-11-01/attacheddatanetwork/id_attacheddatanetwork.go index 6587ebe8161..5ad3ee42b4e 100644 --- a/resource-manager/mobilenetwork/2022-11-01/attacheddatanetwork/id_attacheddatanetwork.go +++ b/resource-manager/mobilenetwork/2022-11-01/attacheddatanetwork/id_attacheddatanetwork.go @@ -40,27 +40,9 @@ func ParseAttachedDataNetworkID(input string) (*AttachedDataNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AttachedDataNetworkId{} - - 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.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) - } - - if id.PacketCoreDataPlaneName, ok = parsed.Parsed["packetCoreDataPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreDataPlaneName", *parsed) - } - - if id.AttachedDataNetworkName, ok = parsed.Parsed["attachedDataNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "attachedDataNetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseAttachedDataNetworkIDInsensitively(input string) (*AttachedDataNetwork return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AttachedDataNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *AttachedDataNetworkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if id.PacketCoreControlPlaneName, ok = input.Parsed["packetCoreControlPlaneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", input) } - if id.PacketCoreDataPlaneName, ok = parsed.Parsed["packetCoreDataPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreDataPlaneName", *parsed) + if id.PacketCoreDataPlaneName, ok = input.Parsed["packetCoreDataPlaneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCoreDataPlaneName", input) } - if id.AttachedDataNetworkName, ok = parsed.Parsed["attachedDataNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "attachedDataNetworkName", *parsed) + if id.AttachedDataNetworkName, ok = input.Parsed["attachedDataNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "attachedDataNetworkName", input) } - return &id, nil + return nil } // ValidateAttachedDataNetworkID checks that 'input' can be parsed as a Attached Data Network ID diff --git a/resource-manager/mobilenetwork/2022-11-01/attacheddatanetworks/id_packetcoredataplane.go b/resource-manager/mobilenetwork/2022-11-01/attacheddatanetworks/id_packetcoredataplane.go index 06d5e228864..ec86ada6e12 100644 --- a/resource-manager/mobilenetwork/2022-11-01/attacheddatanetworks/id_packetcoredataplane.go +++ b/resource-manager/mobilenetwork/2022-11-01/attacheddatanetworks/id_packetcoredataplane.go @@ -38,23 +38,9 @@ func ParsePacketCoreDataPlaneID(input string) (*PacketCoreDataPlaneId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreDataPlaneId{} - - 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.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) - } - - if id.PacketCoreDataPlaneName, ok = parsed.Parsed["packetCoreDataPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreDataPlaneName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePacketCoreDataPlaneIDInsensitively(input string) (*PacketCoreDataPlane return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreDataPlaneId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PacketCoreDataPlaneId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if id.PacketCoreControlPlaneName, ok = input.Parsed["packetCoreControlPlaneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", input) } - if id.PacketCoreDataPlaneName, ok = parsed.Parsed["packetCoreDataPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreDataPlaneName", *parsed) + if id.PacketCoreDataPlaneName, ok = input.Parsed["packetCoreDataPlaneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCoreDataPlaneName", input) } - return &id, nil + return nil } // ValidatePacketCoreDataPlaneID checks that 'input' can be parsed as a Packet Core Data Plane ID diff --git a/resource-manager/mobilenetwork/2022-11-01/datanetwork/id_datanetwork.go b/resource-manager/mobilenetwork/2022-11-01/datanetwork/id_datanetwork.go index 44fa45ae132..686dadce350 100644 --- a/resource-manager/mobilenetwork/2022-11-01/datanetwork/id_datanetwork.go +++ b/resource-manager/mobilenetwork/2022-11-01/datanetwork/id_datanetwork.go @@ -38,23 +38,9 @@ func ParseDataNetworkID(input string) (*DataNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataNetworkId{} - - 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.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) - } - - if id.DataNetworkName, ok = parsed.Parsed["dataNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataNetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDataNetworkIDInsensitively(input string) (*DataNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DataNetworkId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if id.MobileNetworkName, ok = input.Parsed["mobileNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", input) } - if id.DataNetworkName, ok = parsed.Parsed["dataNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataNetworkName", *parsed) + if id.DataNetworkName, ok = input.Parsed["dataNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataNetworkName", input) } - return &id, nil + return nil } // ValidateDataNetworkID checks that 'input' can be parsed as a Data Network ID diff --git a/resource-manager/mobilenetwork/2022-11-01/datanetworks/id_mobilenetwork.go b/resource-manager/mobilenetwork/2022-11-01/datanetworks/id_mobilenetwork.go index bc1a5dd5096..a3a3b174d47 100644 --- a/resource-manager/mobilenetwork/2022-11-01/datanetworks/id_mobilenetwork.go +++ b/resource-manager/mobilenetwork/2022-11-01/datanetworks/id_mobilenetwork.go @@ -36,19 +36,9 @@ func ParseMobileNetworkID(input string) (*MobileNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MobileNetworkId{} - - 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.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMobileNetworkIDInsensitively(input string) (*MobileNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MobileNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MobileNetworkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if id.MobileNetworkName, ok = input.Parsed["mobileNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", input) } - return &id, nil + return nil } // ValidateMobileNetworkID checks that 'input' can be parsed as a Mobile Network ID diff --git a/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/id_mobilenetwork.go b/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/id_mobilenetwork.go index 3926cdecf40..3db623b94b4 100644 --- a/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/id_mobilenetwork.go +++ b/resource-manager/mobilenetwork/2022-11-01/mobilenetwork/id_mobilenetwork.go @@ -36,19 +36,9 @@ func ParseMobileNetworkID(input string) (*MobileNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MobileNetworkId{} - - 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.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMobileNetworkIDInsensitively(input string) (*MobileNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MobileNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MobileNetworkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if id.MobileNetworkName, ok = input.Parsed["mobileNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", input) } - return &id, nil + return nil } // ValidateMobileNetworkID checks that 'input' can be parsed as a Mobile Network ID diff --git a/resource-manager/mobilenetwork/2022-11-01/packetcorecontrolplane/id_packetcorecontrolplane.go b/resource-manager/mobilenetwork/2022-11-01/packetcorecontrolplane/id_packetcorecontrolplane.go index 07ed6877907..a5fd1409642 100644 --- a/resource-manager/mobilenetwork/2022-11-01/packetcorecontrolplane/id_packetcorecontrolplane.go +++ b/resource-manager/mobilenetwork/2022-11-01/packetcorecontrolplane/id_packetcorecontrolplane.go @@ -36,19 +36,9 @@ func ParsePacketCoreControlPlaneID(input string) (*PacketCoreControlPlaneId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreControlPlaneId{} - - 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.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePacketCoreControlPlaneIDInsensitively(input string) (*PacketCoreContro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreControlPlaneId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PacketCoreControlPlaneId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if id.PacketCoreControlPlaneName, ok = input.Parsed["packetCoreControlPlaneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", input) } - return &id, nil + return nil } // ValidatePacketCoreControlPlaneID checks that 'input' can be parsed as a Packet Core Control Plane ID diff --git a/resource-manager/mobilenetwork/2022-11-01/packetcorecontrolplanecollectdiagnosticspackage/id_packetcorecontrolplane.go b/resource-manager/mobilenetwork/2022-11-01/packetcorecontrolplanecollectdiagnosticspackage/id_packetcorecontrolplane.go index f9989a1c1eb..6fd52a8809b 100644 --- a/resource-manager/mobilenetwork/2022-11-01/packetcorecontrolplanecollectdiagnosticspackage/id_packetcorecontrolplane.go +++ b/resource-manager/mobilenetwork/2022-11-01/packetcorecontrolplanecollectdiagnosticspackage/id_packetcorecontrolplane.go @@ -36,19 +36,9 @@ func ParsePacketCoreControlPlaneID(input string) (*PacketCoreControlPlaneId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreControlPlaneId{} - - 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.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePacketCoreControlPlaneIDInsensitively(input string) (*PacketCoreContro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreControlPlaneId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PacketCoreControlPlaneId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if id.PacketCoreControlPlaneName, ok = input.Parsed["packetCoreControlPlaneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", input) } - return &id, nil + return nil } // ValidatePacketCoreControlPlaneID checks that 'input' can be parsed as a Packet Core Control Plane ID diff --git a/resource-manager/mobilenetwork/2022-11-01/packetcorecontrolplanereinstall/id_packetcorecontrolplane.go b/resource-manager/mobilenetwork/2022-11-01/packetcorecontrolplanereinstall/id_packetcorecontrolplane.go index a0e8f462822..cffc717a5b9 100644 --- a/resource-manager/mobilenetwork/2022-11-01/packetcorecontrolplanereinstall/id_packetcorecontrolplane.go +++ b/resource-manager/mobilenetwork/2022-11-01/packetcorecontrolplanereinstall/id_packetcorecontrolplane.go @@ -36,19 +36,9 @@ func ParsePacketCoreControlPlaneID(input string) (*PacketCoreControlPlaneId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreControlPlaneId{} - - 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.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePacketCoreControlPlaneIDInsensitively(input string) (*PacketCoreContro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreControlPlaneId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PacketCoreControlPlaneId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if id.PacketCoreControlPlaneName, ok = input.Parsed["packetCoreControlPlaneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", input) } - return &id, nil + return nil } // ValidatePacketCoreControlPlaneID checks that 'input' can be parsed as a Packet Core Control Plane ID diff --git a/resource-manager/mobilenetwork/2022-11-01/packetcorecontrolplanerollback/id_packetcorecontrolplane.go b/resource-manager/mobilenetwork/2022-11-01/packetcorecontrolplanerollback/id_packetcorecontrolplane.go index 2c76bbcc174..de14ef3a114 100644 --- a/resource-manager/mobilenetwork/2022-11-01/packetcorecontrolplanerollback/id_packetcorecontrolplane.go +++ b/resource-manager/mobilenetwork/2022-11-01/packetcorecontrolplanerollback/id_packetcorecontrolplane.go @@ -36,19 +36,9 @@ func ParsePacketCoreControlPlaneID(input string) (*PacketCoreControlPlaneId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreControlPlaneId{} - - 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.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePacketCoreControlPlaneIDInsensitively(input string) (*PacketCoreContro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreControlPlaneId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PacketCoreControlPlaneId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if id.PacketCoreControlPlaneName, ok = input.Parsed["packetCoreControlPlaneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", input) } - return &id, nil + return nil } // ValidatePacketCoreControlPlaneID checks that 'input' can be parsed as a Packet Core Control Plane ID diff --git a/resource-manager/mobilenetwork/2022-11-01/packetcorecontrolplaneversion/id_packetcorecontrolplaneversion.go b/resource-manager/mobilenetwork/2022-11-01/packetcorecontrolplaneversion/id_packetcorecontrolplaneversion.go index a1469485fc0..5da90cacdc4 100644 --- a/resource-manager/mobilenetwork/2022-11-01/packetcorecontrolplaneversion/id_packetcorecontrolplaneversion.go +++ b/resource-manager/mobilenetwork/2022-11-01/packetcorecontrolplaneversion/id_packetcorecontrolplaneversion.go @@ -32,11 +32,9 @@ func ParsePacketCoreControlPlaneVersionID(input string) (*PacketCoreControlPlane return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreControlPlaneVersionId{} - - if id.PacketCoreControlPlaneVersionName, ok = parsed.Parsed["packetCoreControlPlaneVersionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneVersionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParsePacketCoreControlPlaneVersionIDInsensitively(input string) (*PacketCor return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreControlPlaneVersionId{} - - if id.PacketCoreControlPlaneVersionName, ok = parsed.Parsed["packetCoreControlPlaneVersionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneVersionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *PacketCoreControlPlaneVersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.PacketCoreControlPlaneVersionName, ok = input.Parsed["packetCoreControlPlaneVersionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneVersionName", input) + } + + return nil +} + // ValidatePacketCoreControlPlaneVersionID checks that 'input' can be parsed as a Packet Core Control Plane Version ID func ValidatePacketCoreControlPlaneVersionID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/mobilenetwork/2022-11-01/packetcoredataplane/id_packetcoredataplane.go b/resource-manager/mobilenetwork/2022-11-01/packetcoredataplane/id_packetcoredataplane.go index e6890480af8..48c6b1f4d77 100644 --- a/resource-manager/mobilenetwork/2022-11-01/packetcoredataplane/id_packetcoredataplane.go +++ b/resource-manager/mobilenetwork/2022-11-01/packetcoredataplane/id_packetcoredataplane.go @@ -38,23 +38,9 @@ func ParsePacketCoreDataPlaneID(input string) (*PacketCoreDataPlaneId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreDataPlaneId{} - - 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.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) - } - - if id.PacketCoreDataPlaneName, ok = parsed.Parsed["packetCoreDataPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreDataPlaneName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePacketCoreDataPlaneIDInsensitively(input string) (*PacketCoreDataPlane return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreDataPlaneId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PacketCoreDataPlaneId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if id.PacketCoreControlPlaneName, ok = input.Parsed["packetCoreControlPlaneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", input) } - if id.PacketCoreDataPlaneName, ok = parsed.Parsed["packetCoreDataPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreDataPlaneName", *parsed) + if id.PacketCoreDataPlaneName, ok = input.Parsed["packetCoreDataPlaneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCoreDataPlaneName", input) } - return &id, nil + return nil } // ValidatePacketCoreDataPlaneID checks that 'input' can be parsed as a Packet Core Data Plane ID diff --git a/resource-manager/mobilenetwork/2022-11-01/packetcoredataplanes/id_packetcorecontrolplane.go b/resource-manager/mobilenetwork/2022-11-01/packetcoredataplanes/id_packetcorecontrolplane.go index 26e6b066fea..c5b4944eeee 100644 --- a/resource-manager/mobilenetwork/2022-11-01/packetcoredataplanes/id_packetcorecontrolplane.go +++ b/resource-manager/mobilenetwork/2022-11-01/packetcoredataplanes/id_packetcorecontrolplane.go @@ -36,19 +36,9 @@ func ParsePacketCoreControlPlaneID(input string) (*PacketCoreControlPlaneId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreControlPlaneId{} - - 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.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePacketCoreControlPlaneIDInsensitively(input string) (*PacketCoreContro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreControlPlaneId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PacketCoreControlPlaneId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if id.PacketCoreControlPlaneName, ok = input.Parsed["packetCoreControlPlaneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", input) } - return &id, nil + return nil } // ValidatePacketCoreControlPlaneID checks that 'input' can be parsed as a Packet Core Control Plane ID diff --git a/resource-manager/mobilenetwork/2022-11-01/service/id_service.go b/resource-manager/mobilenetwork/2022-11-01/service/id_service.go index 323042964f5..cb22af83146 100644 --- a/resource-manager/mobilenetwork/2022-11-01/service/id_service.go +++ b/resource-manager/mobilenetwork/2022-11-01/service/id_service.go @@ -38,23 +38,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) - } - - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ServiceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if id.MobileNetworkName, ok = input.Parsed["mobileNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/mobilenetwork/2022-11-01/services/id_mobilenetwork.go b/resource-manager/mobilenetwork/2022-11-01/services/id_mobilenetwork.go index 6419461f44c..7a539e012d5 100644 --- a/resource-manager/mobilenetwork/2022-11-01/services/id_mobilenetwork.go +++ b/resource-manager/mobilenetwork/2022-11-01/services/id_mobilenetwork.go @@ -36,19 +36,9 @@ func ParseMobileNetworkID(input string) (*MobileNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MobileNetworkId{} - - 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.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMobileNetworkIDInsensitively(input string) (*MobileNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MobileNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MobileNetworkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if id.MobileNetworkName, ok = input.Parsed["mobileNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", input) } - return &id, nil + return nil } // ValidateMobileNetworkID checks that 'input' can be parsed as a Mobile Network ID diff --git a/resource-manager/mobilenetwork/2022-11-01/sim/id_sim.go b/resource-manager/mobilenetwork/2022-11-01/sim/id_sim.go index f8d6b241f81..02e82cea2ca 100644 --- a/resource-manager/mobilenetwork/2022-11-01/sim/id_sim.go +++ b/resource-manager/mobilenetwork/2022-11-01/sim/id_sim.go @@ -38,23 +38,9 @@ func ParseSimID(input string) (*SimId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SimId{} - - 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.SimGroupName, ok = parsed.Parsed["simGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "simGroupName", *parsed) - } - - if id.SimName, ok = parsed.Parsed["simName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "simName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSimIDInsensitively(input string) (*SimId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SimId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SimId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SimGroupName, ok = parsed.Parsed["simGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "simGroupName", *parsed) + if id.SimGroupName, ok = input.Parsed["simGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "simGroupName", input) } - if id.SimName, ok = parsed.Parsed["simName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "simName", *parsed) + if id.SimName, ok = input.Parsed["simName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "simName", input) } - return &id, nil + return nil } // ValidateSimID checks that 'input' can be parsed as a Sim ID diff --git a/resource-manager/mobilenetwork/2022-11-01/simgroup/id_simgroup.go b/resource-manager/mobilenetwork/2022-11-01/simgroup/id_simgroup.go index 303774665e0..f6d2c61b7cc 100644 --- a/resource-manager/mobilenetwork/2022-11-01/simgroup/id_simgroup.go +++ b/resource-manager/mobilenetwork/2022-11-01/simgroup/id_simgroup.go @@ -36,19 +36,9 @@ func ParseSimGroupID(input string) (*SimGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SimGroupId{} - - 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.SimGroupName, ok = parsed.Parsed["simGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "simGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSimGroupIDInsensitively(input string) (*SimGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SimGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SimGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SimGroupName, ok = parsed.Parsed["simGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "simGroupName", *parsed) + if id.SimGroupName, ok = input.Parsed["simGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "simGroupName", input) } - return &id, nil + return nil } // ValidateSimGroupID checks that 'input' can be parsed as a Sim Group ID diff --git a/resource-manager/mobilenetwork/2022-11-01/simpolicies/id_mobilenetwork.go b/resource-manager/mobilenetwork/2022-11-01/simpolicies/id_mobilenetwork.go index 5ad1c170641..1e0c9b08f00 100644 --- a/resource-manager/mobilenetwork/2022-11-01/simpolicies/id_mobilenetwork.go +++ b/resource-manager/mobilenetwork/2022-11-01/simpolicies/id_mobilenetwork.go @@ -36,19 +36,9 @@ func ParseMobileNetworkID(input string) (*MobileNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MobileNetworkId{} - - 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.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMobileNetworkIDInsensitively(input string) (*MobileNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MobileNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MobileNetworkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if id.MobileNetworkName, ok = input.Parsed["mobileNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", input) } - return &id, nil + return nil } // ValidateMobileNetworkID checks that 'input' can be parsed as a Mobile Network ID diff --git a/resource-manager/mobilenetwork/2022-11-01/simpolicy/id_simpolicy.go b/resource-manager/mobilenetwork/2022-11-01/simpolicy/id_simpolicy.go index 85abda18014..f9339520002 100644 --- a/resource-manager/mobilenetwork/2022-11-01/simpolicy/id_simpolicy.go +++ b/resource-manager/mobilenetwork/2022-11-01/simpolicy/id_simpolicy.go @@ -38,23 +38,9 @@ func ParseSimPolicyID(input string) (*SimPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SimPolicyId{} - - 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.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) - } - - if id.SimPolicyName, ok = parsed.Parsed["simPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "simPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSimPolicyIDInsensitively(input string) (*SimPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SimPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SimPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if id.MobileNetworkName, ok = input.Parsed["mobileNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", input) } - if id.SimPolicyName, ok = parsed.Parsed["simPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "simPolicyName", *parsed) + if id.SimPolicyName, ok = input.Parsed["simPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "simPolicyName", input) } - return &id, nil + return nil } // ValidateSimPolicyID checks that 'input' can be parsed as a Sim Policy ID diff --git a/resource-manager/mobilenetwork/2022-11-01/sims/id_simgroup.go b/resource-manager/mobilenetwork/2022-11-01/sims/id_simgroup.go index c553ab78fac..6e642f5fa18 100644 --- a/resource-manager/mobilenetwork/2022-11-01/sims/id_simgroup.go +++ b/resource-manager/mobilenetwork/2022-11-01/sims/id_simgroup.go @@ -36,19 +36,9 @@ func ParseSimGroupID(input string) (*SimGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SimGroupId{} - - 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.SimGroupName, ok = parsed.Parsed["simGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "simGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSimGroupIDInsensitively(input string) (*SimGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SimGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SimGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SimGroupName, ok = parsed.Parsed["simGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "simGroupName", *parsed) + if id.SimGroupName, ok = input.Parsed["simGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "simGroupName", input) } - return &id, nil + return nil } // ValidateSimGroupID checks that 'input' can be parsed as a Sim Group ID diff --git a/resource-manager/mobilenetwork/2022-11-01/site/id_site.go b/resource-manager/mobilenetwork/2022-11-01/site/id_site.go index ff3d6a3d975..d81ac0d5a65 100644 --- a/resource-manager/mobilenetwork/2022-11-01/site/id_site.go +++ b/resource-manager/mobilenetwork/2022-11-01/site/id_site.go @@ -38,23 +38,9 @@ func ParseSiteID(input string) (*SiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SiteId{} - - 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.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) - } - - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSiteIDInsensitively(input string) (*SiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SiteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SiteId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if id.MobileNetworkName, ok = input.Parsed["mobileNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - return &id, nil + return nil } // ValidateSiteID checks that 'input' can be parsed as a Site ID diff --git a/resource-manager/mobilenetwork/2022-11-01/sites/id_mobilenetwork.go b/resource-manager/mobilenetwork/2022-11-01/sites/id_mobilenetwork.go index dc17a8a4194..7a4bf647cb0 100644 --- a/resource-manager/mobilenetwork/2022-11-01/sites/id_mobilenetwork.go +++ b/resource-manager/mobilenetwork/2022-11-01/sites/id_mobilenetwork.go @@ -36,19 +36,9 @@ func ParseMobileNetworkID(input string) (*MobileNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MobileNetworkId{} - - 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.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMobileNetworkIDInsensitively(input string) (*MobileNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MobileNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MobileNetworkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if id.MobileNetworkName, ok = input.Parsed["mobileNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", input) } - return &id, nil + return nil } // ValidateMobileNetworkID checks that 'input' can be parsed as a Mobile Network ID diff --git a/resource-manager/mobilenetwork/2022-11-01/slice/id_slice.go b/resource-manager/mobilenetwork/2022-11-01/slice/id_slice.go index 62541dc50bc..23a1463fc8a 100644 --- a/resource-manager/mobilenetwork/2022-11-01/slice/id_slice.go +++ b/resource-manager/mobilenetwork/2022-11-01/slice/id_slice.go @@ -38,23 +38,9 @@ func ParseSliceID(input string) (*SliceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SliceId{} - - 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.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) - } - - if id.SliceName, ok = parsed.Parsed["sliceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sliceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSliceIDInsensitively(input string) (*SliceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SliceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SliceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if id.MobileNetworkName, ok = input.Parsed["mobileNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", input) } - if id.SliceName, ok = parsed.Parsed["sliceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sliceName", *parsed) + if id.SliceName, ok = input.Parsed["sliceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sliceName", input) } - return &id, nil + return nil } // ValidateSliceID checks that 'input' can be parsed as a Slice ID diff --git a/resource-manager/mobilenetwork/2022-11-01/slices/id_mobilenetwork.go b/resource-manager/mobilenetwork/2022-11-01/slices/id_mobilenetwork.go index 7c0313ba29b..055e2b441d7 100644 --- a/resource-manager/mobilenetwork/2022-11-01/slices/id_mobilenetwork.go +++ b/resource-manager/mobilenetwork/2022-11-01/slices/id_mobilenetwork.go @@ -36,19 +36,9 @@ func ParseMobileNetworkID(input string) (*MobileNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MobileNetworkId{} - - 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.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMobileNetworkIDInsensitively(input string) (*MobileNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MobileNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MobileNetworkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if id.MobileNetworkName, ok = input.Parsed["mobileNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", input) } - return &id, nil + return nil } // ValidateMobileNetworkID checks that 'input' can be parsed as a Mobile Network ID diff --git a/resource-manager/mobilenetwork/2023-06-01/attacheddatanetwork/id_attacheddatanetwork.go b/resource-manager/mobilenetwork/2023-06-01/attacheddatanetwork/id_attacheddatanetwork.go index 6587ebe8161..5ad3ee42b4e 100644 --- a/resource-manager/mobilenetwork/2023-06-01/attacheddatanetwork/id_attacheddatanetwork.go +++ b/resource-manager/mobilenetwork/2023-06-01/attacheddatanetwork/id_attacheddatanetwork.go @@ -40,27 +40,9 @@ func ParseAttachedDataNetworkID(input string) (*AttachedDataNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AttachedDataNetworkId{} - - 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.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) - } - - if id.PacketCoreDataPlaneName, ok = parsed.Parsed["packetCoreDataPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreDataPlaneName", *parsed) - } - - if id.AttachedDataNetworkName, ok = parsed.Parsed["attachedDataNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "attachedDataNetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseAttachedDataNetworkIDInsensitively(input string) (*AttachedDataNetwork return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AttachedDataNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *AttachedDataNetworkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if id.PacketCoreControlPlaneName, ok = input.Parsed["packetCoreControlPlaneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", input) } - if id.PacketCoreDataPlaneName, ok = parsed.Parsed["packetCoreDataPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreDataPlaneName", *parsed) + if id.PacketCoreDataPlaneName, ok = input.Parsed["packetCoreDataPlaneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCoreDataPlaneName", input) } - if id.AttachedDataNetworkName, ok = parsed.Parsed["attachedDataNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "attachedDataNetworkName", *parsed) + if id.AttachedDataNetworkName, ok = input.Parsed["attachedDataNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "attachedDataNetworkName", input) } - return &id, nil + return nil } // ValidateAttachedDataNetworkID checks that 'input' can be parsed as a Attached Data Network ID diff --git a/resource-manager/mobilenetwork/2023-06-01/attacheddatanetworks/id_packetcoredataplane.go b/resource-manager/mobilenetwork/2023-06-01/attacheddatanetworks/id_packetcoredataplane.go index 06d5e228864..ec86ada6e12 100644 --- a/resource-manager/mobilenetwork/2023-06-01/attacheddatanetworks/id_packetcoredataplane.go +++ b/resource-manager/mobilenetwork/2023-06-01/attacheddatanetworks/id_packetcoredataplane.go @@ -38,23 +38,9 @@ func ParsePacketCoreDataPlaneID(input string) (*PacketCoreDataPlaneId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreDataPlaneId{} - - 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.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) - } - - if id.PacketCoreDataPlaneName, ok = parsed.Parsed["packetCoreDataPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreDataPlaneName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePacketCoreDataPlaneIDInsensitively(input string) (*PacketCoreDataPlane return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreDataPlaneId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PacketCoreDataPlaneId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if id.PacketCoreControlPlaneName, ok = input.Parsed["packetCoreControlPlaneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", input) } - if id.PacketCoreDataPlaneName, ok = parsed.Parsed["packetCoreDataPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreDataPlaneName", *parsed) + if id.PacketCoreDataPlaneName, ok = input.Parsed["packetCoreDataPlaneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCoreDataPlaneName", input) } - return &id, nil + return nil } // ValidatePacketCoreDataPlaneID checks that 'input' can be parsed as a Packet Core Data Plane ID diff --git a/resource-manager/mobilenetwork/2023-06-01/datanetwork/id_datanetwork.go b/resource-manager/mobilenetwork/2023-06-01/datanetwork/id_datanetwork.go index 44fa45ae132..686dadce350 100644 --- a/resource-manager/mobilenetwork/2023-06-01/datanetwork/id_datanetwork.go +++ b/resource-manager/mobilenetwork/2023-06-01/datanetwork/id_datanetwork.go @@ -38,23 +38,9 @@ func ParseDataNetworkID(input string) (*DataNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataNetworkId{} - - 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.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) - } - - if id.DataNetworkName, ok = parsed.Parsed["dataNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataNetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDataNetworkIDInsensitively(input string) (*DataNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DataNetworkId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if id.MobileNetworkName, ok = input.Parsed["mobileNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", input) } - if id.DataNetworkName, ok = parsed.Parsed["dataNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataNetworkName", *parsed) + if id.DataNetworkName, ok = input.Parsed["dataNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataNetworkName", input) } - return &id, nil + return nil } // ValidateDataNetworkID checks that 'input' can be parsed as a Data Network ID diff --git a/resource-manager/mobilenetwork/2023-06-01/datanetworks/id_mobilenetwork.go b/resource-manager/mobilenetwork/2023-06-01/datanetworks/id_mobilenetwork.go index bc1a5dd5096..a3a3b174d47 100644 --- a/resource-manager/mobilenetwork/2023-06-01/datanetworks/id_mobilenetwork.go +++ b/resource-manager/mobilenetwork/2023-06-01/datanetworks/id_mobilenetwork.go @@ -36,19 +36,9 @@ func ParseMobileNetworkID(input string) (*MobileNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MobileNetworkId{} - - 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.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMobileNetworkIDInsensitively(input string) (*MobileNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MobileNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MobileNetworkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if id.MobileNetworkName, ok = input.Parsed["mobileNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", input) } - return &id, nil + return nil } // ValidateMobileNetworkID checks that 'input' can be parsed as a Mobile Network ID diff --git a/resource-manager/mobilenetwork/2023-06-01/diagnosticspackages/id_diagnosticspackage.go b/resource-manager/mobilenetwork/2023-06-01/diagnosticspackages/id_diagnosticspackage.go index 8a549e85906..6c27f5b3e4d 100644 --- a/resource-manager/mobilenetwork/2023-06-01/diagnosticspackages/id_diagnosticspackage.go +++ b/resource-manager/mobilenetwork/2023-06-01/diagnosticspackages/id_diagnosticspackage.go @@ -38,23 +38,9 @@ func ParseDiagnosticsPackageID(input string) (*DiagnosticsPackageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiagnosticsPackageId{} - - 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.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) - } - - if id.DiagnosticsPackageName, ok = parsed.Parsed["diagnosticsPackageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticsPackageName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDiagnosticsPackageIDInsensitively(input string) (*DiagnosticsPackageId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiagnosticsPackageId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DiagnosticsPackageId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if id.PacketCoreControlPlaneName, ok = input.Parsed["packetCoreControlPlaneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", input) } - if id.DiagnosticsPackageName, ok = parsed.Parsed["diagnosticsPackageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticsPackageName", *parsed) + if id.DiagnosticsPackageName, ok = input.Parsed["diagnosticsPackageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "diagnosticsPackageName", input) } - return &id, nil + return nil } // ValidateDiagnosticsPackageID checks that 'input' can be parsed as a Diagnostics Package ID diff --git a/resource-manager/mobilenetwork/2023-06-01/diagnosticspackages/id_packetcorecontrolplane.go b/resource-manager/mobilenetwork/2023-06-01/diagnosticspackages/id_packetcorecontrolplane.go index a8256e566af..26853c823a4 100644 --- a/resource-manager/mobilenetwork/2023-06-01/diagnosticspackages/id_packetcorecontrolplane.go +++ b/resource-manager/mobilenetwork/2023-06-01/diagnosticspackages/id_packetcorecontrolplane.go @@ -36,19 +36,9 @@ func ParsePacketCoreControlPlaneID(input string) (*PacketCoreControlPlaneId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreControlPlaneId{} - - 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.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePacketCoreControlPlaneIDInsensitively(input string) (*PacketCoreContro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreControlPlaneId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PacketCoreControlPlaneId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if id.PacketCoreControlPlaneName, ok = input.Parsed["packetCoreControlPlaneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", input) } - return &id, nil + return nil } // ValidatePacketCoreControlPlaneID checks that 'input' can be parsed as a Packet Core Control Plane ID diff --git a/resource-manager/mobilenetwork/2023-06-01/mobilenetwork/id_mobilenetwork.go b/resource-manager/mobilenetwork/2023-06-01/mobilenetwork/id_mobilenetwork.go index 3926cdecf40..3db623b94b4 100644 --- a/resource-manager/mobilenetwork/2023-06-01/mobilenetwork/id_mobilenetwork.go +++ b/resource-manager/mobilenetwork/2023-06-01/mobilenetwork/id_mobilenetwork.go @@ -36,19 +36,9 @@ func ParseMobileNetworkID(input string) (*MobileNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MobileNetworkId{} - - 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.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMobileNetworkIDInsensitively(input string) (*MobileNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MobileNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MobileNetworkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if id.MobileNetworkName, ok = input.Parsed["mobileNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", input) } - return &id, nil + return nil } // ValidateMobileNetworkID checks that 'input' can be parsed as a Mobile Network ID diff --git a/resource-manager/mobilenetwork/2023-06-01/packetcaptures/id_packetcapture.go b/resource-manager/mobilenetwork/2023-06-01/packetcaptures/id_packetcapture.go index ae5c926d1a0..236f522bfc1 100644 --- a/resource-manager/mobilenetwork/2023-06-01/packetcaptures/id_packetcapture.go +++ b/resource-manager/mobilenetwork/2023-06-01/packetcaptures/id_packetcapture.go @@ -38,23 +38,9 @@ func ParsePacketCaptureID(input string) (*PacketCaptureId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCaptureId{} - - 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.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) - } - - if id.PacketCaptureName, ok = parsed.Parsed["packetCaptureName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCaptureName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePacketCaptureIDInsensitively(input string) (*PacketCaptureId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCaptureId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PacketCaptureId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if id.PacketCoreControlPlaneName, ok = input.Parsed["packetCoreControlPlaneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", input) } - if id.PacketCaptureName, ok = parsed.Parsed["packetCaptureName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCaptureName", *parsed) + if id.PacketCaptureName, ok = input.Parsed["packetCaptureName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCaptureName", input) } - return &id, nil + return nil } // ValidatePacketCaptureID checks that 'input' can be parsed as a Packet Capture ID diff --git a/resource-manager/mobilenetwork/2023-06-01/packetcaptures/id_packetcorecontrolplane.go b/resource-manager/mobilenetwork/2023-06-01/packetcaptures/id_packetcorecontrolplane.go index 406694534be..7911a728152 100644 --- a/resource-manager/mobilenetwork/2023-06-01/packetcaptures/id_packetcorecontrolplane.go +++ b/resource-manager/mobilenetwork/2023-06-01/packetcaptures/id_packetcorecontrolplane.go @@ -36,19 +36,9 @@ func ParsePacketCoreControlPlaneID(input string) (*PacketCoreControlPlaneId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreControlPlaneId{} - - 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.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePacketCoreControlPlaneIDInsensitively(input string) (*PacketCoreContro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreControlPlaneId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PacketCoreControlPlaneId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if id.PacketCoreControlPlaneName, ok = input.Parsed["packetCoreControlPlaneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", input) } - return &id, nil + return nil } // ValidatePacketCoreControlPlaneID checks that 'input' can be parsed as a Packet Core Control Plane ID diff --git a/resource-manager/mobilenetwork/2023-06-01/packetcorecontrolplane/id_packetcorecontrolplane.go b/resource-manager/mobilenetwork/2023-06-01/packetcorecontrolplane/id_packetcorecontrolplane.go index 07ed6877907..a5fd1409642 100644 --- a/resource-manager/mobilenetwork/2023-06-01/packetcorecontrolplane/id_packetcorecontrolplane.go +++ b/resource-manager/mobilenetwork/2023-06-01/packetcorecontrolplane/id_packetcorecontrolplane.go @@ -36,19 +36,9 @@ func ParsePacketCoreControlPlaneID(input string) (*PacketCoreControlPlaneId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreControlPlaneId{} - - 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.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePacketCoreControlPlaneIDInsensitively(input string) (*PacketCoreContro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreControlPlaneId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PacketCoreControlPlaneId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if id.PacketCoreControlPlaneName, ok = input.Parsed["packetCoreControlPlaneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", input) } - return &id, nil + return nil } // ValidatePacketCoreControlPlaneID checks that 'input' can be parsed as a Packet Core Control Plane ID diff --git a/resource-manager/mobilenetwork/2023-06-01/packetcorecontrolplanecollectdiagnosticspackage/id_packetcorecontrolplane.go b/resource-manager/mobilenetwork/2023-06-01/packetcorecontrolplanecollectdiagnosticspackage/id_packetcorecontrolplane.go index f9989a1c1eb..6fd52a8809b 100644 --- a/resource-manager/mobilenetwork/2023-06-01/packetcorecontrolplanecollectdiagnosticspackage/id_packetcorecontrolplane.go +++ b/resource-manager/mobilenetwork/2023-06-01/packetcorecontrolplanecollectdiagnosticspackage/id_packetcorecontrolplane.go @@ -36,19 +36,9 @@ func ParsePacketCoreControlPlaneID(input string) (*PacketCoreControlPlaneId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreControlPlaneId{} - - 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.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePacketCoreControlPlaneIDInsensitively(input string) (*PacketCoreContro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreControlPlaneId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PacketCoreControlPlaneId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if id.PacketCoreControlPlaneName, ok = input.Parsed["packetCoreControlPlaneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", input) } - return &id, nil + return nil } // ValidatePacketCoreControlPlaneID checks that 'input' can be parsed as a Packet Core Control Plane ID diff --git a/resource-manager/mobilenetwork/2023-06-01/packetcorecontrolplanereinstall/id_packetcorecontrolplane.go b/resource-manager/mobilenetwork/2023-06-01/packetcorecontrolplanereinstall/id_packetcorecontrolplane.go index a0e8f462822..cffc717a5b9 100644 --- a/resource-manager/mobilenetwork/2023-06-01/packetcorecontrolplanereinstall/id_packetcorecontrolplane.go +++ b/resource-manager/mobilenetwork/2023-06-01/packetcorecontrolplanereinstall/id_packetcorecontrolplane.go @@ -36,19 +36,9 @@ func ParsePacketCoreControlPlaneID(input string) (*PacketCoreControlPlaneId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreControlPlaneId{} - - 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.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePacketCoreControlPlaneIDInsensitively(input string) (*PacketCoreContro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreControlPlaneId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PacketCoreControlPlaneId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if id.PacketCoreControlPlaneName, ok = input.Parsed["packetCoreControlPlaneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", input) } - return &id, nil + return nil } // ValidatePacketCoreControlPlaneID checks that 'input' can be parsed as a Packet Core Control Plane ID diff --git a/resource-manager/mobilenetwork/2023-06-01/packetcorecontrolplanerollback/id_packetcorecontrolplane.go b/resource-manager/mobilenetwork/2023-06-01/packetcorecontrolplanerollback/id_packetcorecontrolplane.go index 2c76bbcc174..de14ef3a114 100644 --- a/resource-manager/mobilenetwork/2023-06-01/packetcorecontrolplanerollback/id_packetcorecontrolplane.go +++ b/resource-manager/mobilenetwork/2023-06-01/packetcorecontrolplanerollback/id_packetcorecontrolplane.go @@ -36,19 +36,9 @@ func ParsePacketCoreControlPlaneID(input string) (*PacketCoreControlPlaneId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreControlPlaneId{} - - 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.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePacketCoreControlPlaneIDInsensitively(input string) (*PacketCoreContro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreControlPlaneId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PacketCoreControlPlaneId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if id.PacketCoreControlPlaneName, ok = input.Parsed["packetCoreControlPlaneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", input) } - return &id, nil + return nil } // ValidatePacketCoreControlPlaneID checks that 'input' can be parsed as a Packet Core Control Plane ID diff --git a/resource-manager/mobilenetwork/2023-06-01/packetcorecontrolplaneversion/id_packetcorecontrolplaneversion.go b/resource-manager/mobilenetwork/2023-06-01/packetcorecontrolplaneversion/id_packetcorecontrolplaneversion.go index a1469485fc0..5da90cacdc4 100644 --- a/resource-manager/mobilenetwork/2023-06-01/packetcorecontrolplaneversion/id_packetcorecontrolplaneversion.go +++ b/resource-manager/mobilenetwork/2023-06-01/packetcorecontrolplaneversion/id_packetcorecontrolplaneversion.go @@ -32,11 +32,9 @@ func ParsePacketCoreControlPlaneVersionID(input string) (*PacketCoreControlPlane return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreControlPlaneVersionId{} - - if id.PacketCoreControlPlaneVersionName, ok = parsed.Parsed["packetCoreControlPlaneVersionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneVersionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParsePacketCoreControlPlaneVersionIDInsensitively(input string) (*PacketCor return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreControlPlaneVersionId{} - - if id.PacketCoreControlPlaneVersionName, ok = parsed.Parsed["packetCoreControlPlaneVersionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneVersionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *PacketCoreControlPlaneVersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.PacketCoreControlPlaneVersionName, ok = input.Parsed["packetCoreControlPlaneVersionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneVersionName", input) + } + + return nil +} + // ValidatePacketCoreControlPlaneVersionID checks that 'input' can be parsed as a Packet Core Control Plane Version ID func ValidatePacketCoreControlPlaneVersionID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/mobilenetwork/2023-06-01/packetcorecontrolplaneversion/id_providerpacketcorecontrolplaneversion.go b/resource-manager/mobilenetwork/2023-06-01/packetcorecontrolplaneversion/id_providerpacketcorecontrolplaneversion.go index b86603e80b9..55ac7714f76 100644 --- a/resource-manager/mobilenetwork/2023-06-01/packetcorecontrolplaneversion/id_providerpacketcorecontrolplaneversion.go +++ b/resource-manager/mobilenetwork/2023-06-01/packetcorecontrolplaneversion/id_providerpacketcorecontrolplaneversion.go @@ -34,15 +34,9 @@ func ParseProviderPacketCoreControlPlaneVersionID(input string) (*ProviderPacket return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderPacketCoreControlPlaneVersionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.PacketCoreControlPlaneVersionName, ok = parsed.Parsed["packetCoreControlPlaneVersionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneVersionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviderPacketCoreControlPlaneVersionIDInsensitively(input string) (*P return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderPacketCoreControlPlaneVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ProviderPacketCoreControlPlaneVersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.PacketCoreControlPlaneVersionName, ok = parsed.Parsed["packetCoreControlPlaneVersionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneVersionName", *parsed) + if id.PacketCoreControlPlaneVersionName, ok = input.Parsed["packetCoreControlPlaneVersionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneVersionName", input) } - return &id, nil + return nil } // ValidateProviderPacketCoreControlPlaneVersionID checks that 'input' can be parsed as a Provider Packet Core Control Plane Version ID diff --git a/resource-manager/mobilenetwork/2023-06-01/packetcoredataplane/id_packetcoredataplane.go b/resource-manager/mobilenetwork/2023-06-01/packetcoredataplane/id_packetcoredataplane.go index e6890480af8..48c6b1f4d77 100644 --- a/resource-manager/mobilenetwork/2023-06-01/packetcoredataplane/id_packetcoredataplane.go +++ b/resource-manager/mobilenetwork/2023-06-01/packetcoredataplane/id_packetcoredataplane.go @@ -38,23 +38,9 @@ func ParsePacketCoreDataPlaneID(input string) (*PacketCoreDataPlaneId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreDataPlaneId{} - - 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.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) - } - - if id.PacketCoreDataPlaneName, ok = parsed.Parsed["packetCoreDataPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreDataPlaneName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePacketCoreDataPlaneIDInsensitively(input string) (*PacketCoreDataPlane return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreDataPlaneId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PacketCoreDataPlaneId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if id.PacketCoreControlPlaneName, ok = input.Parsed["packetCoreControlPlaneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", input) } - if id.PacketCoreDataPlaneName, ok = parsed.Parsed["packetCoreDataPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreDataPlaneName", *parsed) + if id.PacketCoreDataPlaneName, ok = input.Parsed["packetCoreDataPlaneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCoreDataPlaneName", input) } - return &id, nil + return nil } // ValidatePacketCoreDataPlaneID checks that 'input' can be parsed as a Packet Core Data Plane ID diff --git a/resource-manager/mobilenetwork/2023-06-01/packetcoredataplanes/id_packetcorecontrolplane.go b/resource-manager/mobilenetwork/2023-06-01/packetcoredataplanes/id_packetcorecontrolplane.go index 26e6b066fea..c5b4944eeee 100644 --- a/resource-manager/mobilenetwork/2023-06-01/packetcoredataplanes/id_packetcorecontrolplane.go +++ b/resource-manager/mobilenetwork/2023-06-01/packetcoredataplanes/id_packetcorecontrolplane.go @@ -36,19 +36,9 @@ func ParsePacketCoreControlPlaneID(input string) (*PacketCoreControlPlaneId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreControlPlaneId{} - - 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.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePacketCoreControlPlaneIDInsensitively(input string) (*PacketCoreContro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreControlPlaneId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PacketCoreControlPlaneId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if id.PacketCoreControlPlaneName, ok = input.Parsed["packetCoreControlPlaneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", input) } - return &id, nil + return nil } // ValidatePacketCoreControlPlaneID checks that 'input' can be parsed as a Packet Core Control Plane ID diff --git a/resource-manager/mobilenetwork/2023-06-01/service/id_service.go b/resource-manager/mobilenetwork/2023-06-01/service/id_service.go index 323042964f5..cb22af83146 100644 --- a/resource-manager/mobilenetwork/2023-06-01/service/id_service.go +++ b/resource-manager/mobilenetwork/2023-06-01/service/id_service.go @@ -38,23 +38,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) - } - - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ServiceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if id.MobileNetworkName, ok = input.Parsed["mobileNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/mobilenetwork/2023-06-01/services/id_mobilenetwork.go b/resource-manager/mobilenetwork/2023-06-01/services/id_mobilenetwork.go index 6419461f44c..7a539e012d5 100644 --- a/resource-manager/mobilenetwork/2023-06-01/services/id_mobilenetwork.go +++ b/resource-manager/mobilenetwork/2023-06-01/services/id_mobilenetwork.go @@ -36,19 +36,9 @@ func ParseMobileNetworkID(input string) (*MobileNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MobileNetworkId{} - - 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.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMobileNetworkIDInsensitively(input string) (*MobileNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MobileNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MobileNetworkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if id.MobileNetworkName, ok = input.Parsed["mobileNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", input) } - return &id, nil + return nil } // ValidateMobileNetworkID checks that 'input' can be parsed as a Mobile Network ID diff --git a/resource-manager/mobilenetwork/2023-06-01/sim/id_sim.go b/resource-manager/mobilenetwork/2023-06-01/sim/id_sim.go index f8d6b241f81..02e82cea2ca 100644 --- a/resource-manager/mobilenetwork/2023-06-01/sim/id_sim.go +++ b/resource-manager/mobilenetwork/2023-06-01/sim/id_sim.go @@ -38,23 +38,9 @@ func ParseSimID(input string) (*SimId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SimId{} - - 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.SimGroupName, ok = parsed.Parsed["simGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "simGroupName", *parsed) - } - - if id.SimName, ok = parsed.Parsed["simName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "simName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSimIDInsensitively(input string) (*SimId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SimId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SimId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SimGroupName, ok = parsed.Parsed["simGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "simGroupName", *parsed) + if id.SimGroupName, ok = input.Parsed["simGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "simGroupName", input) } - if id.SimName, ok = parsed.Parsed["simName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "simName", *parsed) + if id.SimName, ok = input.Parsed["simName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "simName", input) } - return &id, nil + return nil } // ValidateSimID checks that 'input' can be parsed as a Sim ID diff --git a/resource-manager/mobilenetwork/2023-06-01/simgroup/id_simgroup.go b/resource-manager/mobilenetwork/2023-06-01/simgroup/id_simgroup.go index 303774665e0..f6d2c61b7cc 100644 --- a/resource-manager/mobilenetwork/2023-06-01/simgroup/id_simgroup.go +++ b/resource-manager/mobilenetwork/2023-06-01/simgroup/id_simgroup.go @@ -36,19 +36,9 @@ func ParseSimGroupID(input string) (*SimGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SimGroupId{} - - 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.SimGroupName, ok = parsed.Parsed["simGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "simGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSimGroupIDInsensitively(input string) (*SimGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SimGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SimGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SimGroupName, ok = parsed.Parsed["simGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "simGroupName", *parsed) + if id.SimGroupName, ok = input.Parsed["simGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "simGroupName", input) } - return &id, nil + return nil } // ValidateSimGroupID checks that 'input' can be parsed as a Sim Group ID diff --git a/resource-manager/mobilenetwork/2023-06-01/simpolicies/id_mobilenetwork.go b/resource-manager/mobilenetwork/2023-06-01/simpolicies/id_mobilenetwork.go index 5ad1c170641..1e0c9b08f00 100644 --- a/resource-manager/mobilenetwork/2023-06-01/simpolicies/id_mobilenetwork.go +++ b/resource-manager/mobilenetwork/2023-06-01/simpolicies/id_mobilenetwork.go @@ -36,19 +36,9 @@ func ParseMobileNetworkID(input string) (*MobileNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MobileNetworkId{} - - 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.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMobileNetworkIDInsensitively(input string) (*MobileNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MobileNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MobileNetworkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if id.MobileNetworkName, ok = input.Parsed["mobileNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", input) } - return &id, nil + return nil } // ValidateMobileNetworkID checks that 'input' can be parsed as a Mobile Network ID diff --git a/resource-manager/mobilenetwork/2023-06-01/simpolicy/id_simpolicy.go b/resource-manager/mobilenetwork/2023-06-01/simpolicy/id_simpolicy.go index 85abda18014..f9339520002 100644 --- a/resource-manager/mobilenetwork/2023-06-01/simpolicy/id_simpolicy.go +++ b/resource-manager/mobilenetwork/2023-06-01/simpolicy/id_simpolicy.go @@ -38,23 +38,9 @@ func ParseSimPolicyID(input string) (*SimPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SimPolicyId{} - - 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.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) - } - - if id.SimPolicyName, ok = parsed.Parsed["simPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "simPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSimPolicyIDInsensitively(input string) (*SimPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SimPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SimPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if id.MobileNetworkName, ok = input.Parsed["mobileNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", input) } - if id.SimPolicyName, ok = parsed.Parsed["simPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "simPolicyName", *parsed) + if id.SimPolicyName, ok = input.Parsed["simPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "simPolicyName", input) } - return &id, nil + return nil } // ValidateSimPolicyID checks that 'input' can be parsed as a Sim Policy ID diff --git a/resource-manager/mobilenetwork/2023-06-01/sims/id_simgroup.go b/resource-manager/mobilenetwork/2023-06-01/sims/id_simgroup.go index c553ab78fac..6e642f5fa18 100644 --- a/resource-manager/mobilenetwork/2023-06-01/sims/id_simgroup.go +++ b/resource-manager/mobilenetwork/2023-06-01/sims/id_simgroup.go @@ -36,19 +36,9 @@ func ParseSimGroupID(input string) (*SimGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SimGroupId{} - - 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.SimGroupName, ok = parsed.Parsed["simGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "simGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSimGroupIDInsensitively(input string) (*SimGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SimGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SimGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SimGroupName, ok = parsed.Parsed["simGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "simGroupName", *parsed) + if id.SimGroupName, ok = input.Parsed["simGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "simGroupName", input) } - return &id, nil + return nil } // ValidateSimGroupID checks that 'input' can be parsed as a Sim Group ID diff --git a/resource-manager/mobilenetwork/2023-06-01/site/id_site.go b/resource-manager/mobilenetwork/2023-06-01/site/id_site.go index ff3d6a3d975..d81ac0d5a65 100644 --- a/resource-manager/mobilenetwork/2023-06-01/site/id_site.go +++ b/resource-manager/mobilenetwork/2023-06-01/site/id_site.go @@ -38,23 +38,9 @@ func ParseSiteID(input string) (*SiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SiteId{} - - 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.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) - } - - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSiteIDInsensitively(input string) (*SiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SiteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SiteId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if id.MobileNetworkName, ok = input.Parsed["mobileNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - return &id, nil + return nil } // ValidateSiteID checks that 'input' can be parsed as a Site ID diff --git a/resource-manager/mobilenetwork/2023-06-01/sites/id_mobilenetwork.go b/resource-manager/mobilenetwork/2023-06-01/sites/id_mobilenetwork.go index dc17a8a4194..7a4bf647cb0 100644 --- a/resource-manager/mobilenetwork/2023-06-01/sites/id_mobilenetwork.go +++ b/resource-manager/mobilenetwork/2023-06-01/sites/id_mobilenetwork.go @@ -36,19 +36,9 @@ func ParseMobileNetworkID(input string) (*MobileNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MobileNetworkId{} - - 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.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMobileNetworkIDInsensitively(input string) (*MobileNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MobileNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MobileNetworkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if id.MobileNetworkName, ok = input.Parsed["mobileNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", input) } - return &id, nil + return nil } // ValidateMobileNetworkID checks that 'input' can be parsed as a Mobile Network ID diff --git a/resource-manager/mobilenetwork/2023-06-01/slice/id_slice.go b/resource-manager/mobilenetwork/2023-06-01/slice/id_slice.go index 62541dc50bc..23a1463fc8a 100644 --- a/resource-manager/mobilenetwork/2023-06-01/slice/id_slice.go +++ b/resource-manager/mobilenetwork/2023-06-01/slice/id_slice.go @@ -38,23 +38,9 @@ func ParseSliceID(input string) (*SliceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SliceId{} - - 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.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) - } - - if id.SliceName, ok = parsed.Parsed["sliceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sliceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSliceIDInsensitively(input string) (*SliceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SliceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SliceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if id.MobileNetworkName, ok = input.Parsed["mobileNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", input) } - if id.SliceName, ok = parsed.Parsed["sliceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sliceName", *parsed) + if id.SliceName, ok = input.Parsed["sliceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sliceName", input) } - return &id, nil + return nil } // ValidateSliceID checks that 'input' can be parsed as a Slice ID diff --git a/resource-manager/mobilenetwork/2023-06-01/slices/id_mobilenetwork.go b/resource-manager/mobilenetwork/2023-06-01/slices/id_mobilenetwork.go index 7c0313ba29b..055e2b441d7 100644 --- a/resource-manager/mobilenetwork/2023-06-01/slices/id_mobilenetwork.go +++ b/resource-manager/mobilenetwork/2023-06-01/slices/id_mobilenetwork.go @@ -36,19 +36,9 @@ func ParseMobileNetworkID(input string) (*MobileNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MobileNetworkId{} - - 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.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMobileNetworkIDInsensitively(input string) (*MobileNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MobileNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MobileNetworkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if id.MobileNetworkName, ok = input.Parsed["mobileNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", input) } - return &id, nil + return nil } // ValidateMobileNetworkID checks that 'input' can be parsed as a Mobile Network ID diff --git a/resource-manager/mobilenetwork/2023-09-01/attacheddatanetwork/id_attacheddatanetwork.go b/resource-manager/mobilenetwork/2023-09-01/attacheddatanetwork/id_attacheddatanetwork.go index 6587ebe8161..5ad3ee42b4e 100644 --- a/resource-manager/mobilenetwork/2023-09-01/attacheddatanetwork/id_attacheddatanetwork.go +++ b/resource-manager/mobilenetwork/2023-09-01/attacheddatanetwork/id_attacheddatanetwork.go @@ -40,27 +40,9 @@ func ParseAttachedDataNetworkID(input string) (*AttachedDataNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AttachedDataNetworkId{} - - 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.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) - } - - if id.PacketCoreDataPlaneName, ok = parsed.Parsed["packetCoreDataPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreDataPlaneName", *parsed) - } - - if id.AttachedDataNetworkName, ok = parsed.Parsed["attachedDataNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "attachedDataNetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseAttachedDataNetworkIDInsensitively(input string) (*AttachedDataNetwork return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AttachedDataNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *AttachedDataNetworkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if id.PacketCoreControlPlaneName, ok = input.Parsed["packetCoreControlPlaneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", input) } - if id.PacketCoreDataPlaneName, ok = parsed.Parsed["packetCoreDataPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreDataPlaneName", *parsed) + if id.PacketCoreDataPlaneName, ok = input.Parsed["packetCoreDataPlaneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCoreDataPlaneName", input) } - if id.AttachedDataNetworkName, ok = parsed.Parsed["attachedDataNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "attachedDataNetworkName", *parsed) + if id.AttachedDataNetworkName, ok = input.Parsed["attachedDataNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "attachedDataNetworkName", input) } - return &id, nil + return nil } // ValidateAttachedDataNetworkID checks that 'input' can be parsed as a Attached Data Network ID diff --git a/resource-manager/mobilenetwork/2023-09-01/attacheddatanetworks/id_packetcoredataplane.go b/resource-manager/mobilenetwork/2023-09-01/attacheddatanetworks/id_packetcoredataplane.go index 06d5e228864..ec86ada6e12 100644 --- a/resource-manager/mobilenetwork/2023-09-01/attacheddatanetworks/id_packetcoredataplane.go +++ b/resource-manager/mobilenetwork/2023-09-01/attacheddatanetworks/id_packetcoredataplane.go @@ -38,23 +38,9 @@ func ParsePacketCoreDataPlaneID(input string) (*PacketCoreDataPlaneId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreDataPlaneId{} - - 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.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) - } - - if id.PacketCoreDataPlaneName, ok = parsed.Parsed["packetCoreDataPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreDataPlaneName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePacketCoreDataPlaneIDInsensitively(input string) (*PacketCoreDataPlane return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreDataPlaneId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PacketCoreDataPlaneId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if id.PacketCoreControlPlaneName, ok = input.Parsed["packetCoreControlPlaneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", input) } - if id.PacketCoreDataPlaneName, ok = parsed.Parsed["packetCoreDataPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreDataPlaneName", *parsed) + if id.PacketCoreDataPlaneName, ok = input.Parsed["packetCoreDataPlaneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCoreDataPlaneName", input) } - return &id, nil + return nil } // ValidatePacketCoreDataPlaneID checks that 'input' can be parsed as a Packet Core Data Plane ID diff --git a/resource-manager/mobilenetwork/2023-09-01/datanetwork/id_datanetwork.go b/resource-manager/mobilenetwork/2023-09-01/datanetwork/id_datanetwork.go index 44fa45ae132..686dadce350 100644 --- a/resource-manager/mobilenetwork/2023-09-01/datanetwork/id_datanetwork.go +++ b/resource-manager/mobilenetwork/2023-09-01/datanetwork/id_datanetwork.go @@ -38,23 +38,9 @@ func ParseDataNetworkID(input string) (*DataNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataNetworkId{} - - 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.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) - } - - if id.DataNetworkName, ok = parsed.Parsed["dataNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataNetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDataNetworkIDInsensitively(input string) (*DataNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DataNetworkId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if id.MobileNetworkName, ok = input.Parsed["mobileNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", input) } - if id.DataNetworkName, ok = parsed.Parsed["dataNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataNetworkName", *parsed) + if id.DataNetworkName, ok = input.Parsed["dataNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataNetworkName", input) } - return &id, nil + return nil } // ValidateDataNetworkID checks that 'input' can be parsed as a Data Network ID diff --git a/resource-manager/mobilenetwork/2023-09-01/datanetworks/id_mobilenetwork.go b/resource-manager/mobilenetwork/2023-09-01/datanetworks/id_mobilenetwork.go index bc1a5dd5096..a3a3b174d47 100644 --- a/resource-manager/mobilenetwork/2023-09-01/datanetworks/id_mobilenetwork.go +++ b/resource-manager/mobilenetwork/2023-09-01/datanetworks/id_mobilenetwork.go @@ -36,19 +36,9 @@ func ParseMobileNetworkID(input string) (*MobileNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MobileNetworkId{} - - 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.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMobileNetworkIDInsensitively(input string) (*MobileNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MobileNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MobileNetworkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if id.MobileNetworkName, ok = input.Parsed["mobileNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", input) } - return &id, nil + return nil } // ValidateMobileNetworkID checks that 'input' can be parsed as a Mobile Network ID diff --git a/resource-manager/mobilenetwork/2023-09-01/diagnosticspackages/id_diagnosticspackage.go b/resource-manager/mobilenetwork/2023-09-01/diagnosticspackages/id_diagnosticspackage.go index 8a549e85906..6c27f5b3e4d 100644 --- a/resource-manager/mobilenetwork/2023-09-01/diagnosticspackages/id_diagnosticspackage.go +++ b/resource-manager/mobilenetwork/2023-09-01/diagnosticspackages/id_diagnosticspackage.go @@ -38,23 +38,9 @@ func ParseDiagnosticsPackageID(input string) (*DiagnosticsPackageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiagnosticsPackageId{} - - 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.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) - } - - if id.DiagnosticsPackageName, ok = parsed.Parsed["diagnosticsPackageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticsPackageName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDiagnosticsPackageIDInsensitively(input string) (*DiagnosticsPackageId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiagnosticsPackageId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DiagnosticsPackageId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if id.PacketCoreControlPlaneName, ok = input.Parsed["packetCoreControlPlaneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", input) } - if id.DiagnosticsPackageName, ok = parsed.Parsed["diagnosticsPackageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticsPackageName", *parsed) + if id.DiagnosticsPackageName, ok = input.Parsed["diagnosticsPackageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "diagnosticsPackageName", input) } - return &id, nil + return nil } // ValidateDiagnosticsPackageID checks that 'input' can be parsed as a Diagnostics Package ID diff --git a/resource-manager/mobilenetwork/2023-09-01/diagnosticspackages/id_packetcorecontrolplane.go b/resource-manager/mobilenetwork/2023-09-01/diagnosticspackages/id_packetcorecontrolplane.go index a8256e566af..26853c823a4 100644 --- a/resource-manager/mobilenetwork/2023-09-01/diagnosticspackages/id_packetcorecontrolplane.go +++ b/resource-manager/mobilenetwork/2023-09-01/diagnosticspackages/id_packetcorecontrolplane.go @@ -36,19 +36,9 @@ func ParsePacketCoreControlPlaneID(input string) (*PacketCoreControlPlaneId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreControlPlaneId{} - - 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.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePacketCoreControlPlaneIDInsensitively(input string) (*PacketCoreContro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreControlPlaneId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PacketCoreControlPlaneId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if id.PacketCoreControlPlaneName, ok = input.Parsed["packetCoreControlPlaneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", input) } - return &id, nil + return nil } // ValidatePacketCoreControlPlaneID checks that 'input' can be parsed as a Packet Core Control Plane ID diff --git a/resource-manager/mobilenetwork/2023-09-01/mobilenetwork/id_mobilenetwork.go b/resource-manager/mobilenetwork/2023-09-01/mobilenetwork/id_mobilenetwork.go index 3926cdecf40..3db623b94b4 100644 --- a/resource-manager/mobilenetwork/2023-09-01/mobilenetwork/id_mobilenetwork.go +++ b/resource-manager/mobilenetwork/2023-09-01/mobilenetwork/id_mobilenetwork.go @@ -36,19 +36,9 @@ func ParseMobileNetworkID(input string) (*MobileNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MobileNetworkId{} - - 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.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMobileNetworkIDInsensitively(input string) (*MobileNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MobileNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MobileNetworkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if id.MobileNetworkName, ok = input.Parsed["mobileNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", input) } - return &id, nil + return nil } // ValidateMobileNetworkID checks that 'input' can be parsed as a Mobile Network ID diff --git a/resource-manager/mobilenetwork/2023-09-01/packetcaptures/id_packetcapture.go b/resource-manager/mobilenetwork/2023-09-01/packetcaptures/id_packetcapture.go index ae5c926d1a0..236f522bfc1 100644 --- a/resource-manager/mobilenetwork/2023-09-01/packetcaptures/id_packetcapture.go +++ b/resource-manager/mobilenetwork/2023-09-01/packetcaptures/id_packetcapture.go @@ -38,23 +38,9 @@ func ParsePacketCaptureID(input string) (*PacketCaptureId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCaptureId{} - - 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.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) - } - - if id.PacketCaptureName, ok = parsed.Parsed["packetCaptureName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCaptureName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePacketCaptureIDInsensitively(input string) (*PacketCaptureId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCaptureId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PacketCaptureId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if id.PacketCoreControlPlaneName, ok = input.Parsed["packetCoreControlPlaneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", input) } - if id.PacketCaptureName, ok = parsed.Parsed["packetCaptureName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCaptureName", *parsed) + if id.PacketCaptureName, ok = input.Parsed["packetCaptureName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCaptureName", input) } - return &id, nil + return nil } // ValidatePacketCaptureID checks that 'input' can be parsed as a Packet Capture ID diff --git a/resource-manager/mobilenetwork/2023-09-01/packetcaptures/id_packetcorecontrolplane.go b/resource-manager/mobilenetwork/2023-09-01/packetcaptures/id_packetcorecontrolplane.go index 406694534be..7911a728152 100644 --- a/resource-manager/mobilenetwork/2023-09-01/packetcaptures/id_packetcorecontrolplane.go +++ b/resource-manager/mobilenetwork/2023-09-01/packetcaptures/id_packetcorecontrolplane.go @@ -36,19 +36,9 @@ func ParsePacketCoreControlPlaneID(input string) (*PacketCoreControlPlaneId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreControlPlaneId{} - - 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.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePacketCoreControlPlaneIDInsensitively(input string) (*PacketCoreContro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreControlPlaneId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PacketCoreControlPlaneId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if id.PacketCoreControlPlaneName, ok = input.Parsed["packetCoreControlPlaneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", input) } - return &id, nil + return nil } // ValidatePacketCoreControlPlaneID checks that 'input' can be parsed as a Packet Core Control Plane ID diff --git a/resource-manager/mobilenetwork/2023-09-01/packetcorecontrolplane/id_packetcorecontrolplane.go b/resource-manager/mobilenetwork/2023-09-01/packetcorecontrolplane/id_packetcorecontrolplane.go index 07ed6877907..a5fd1409642 100644 --- a/resource-manager/mobilenetwork/2023-09-01/packetcorecontrolplane/id_packetcorecontrolplane.go +++ b/resource-manager/mobilenetwork/2023-09-01/packetcorecontrolplane/id_packetcorecontrolplane.go @@ -36,19 +36,9 @@ func ParsePacketCoreControlPlaneID(input string) (*PacketCoreControlPlaneId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreControlPlaneId{} - - 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.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePacketCoreControlPlaneIDInsensitively(input string) (*PacketCoreContro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreControlPlaneId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PacketCoreControlPlaneId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if id.PacketCoreControlPlaneName, ok = input.Parsed["packetCoreControlPlaneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", input) } - return &id, nil + return nil } // ValidatePacketCoreControlPlaneID checks that 'input' can be parsed as a Packet Core Control Plane ID diff --git a/resource-manager/mobilenetwork/2023-09-01/packetcorecontrolplanecollectdiagnosticspackage/id_packetcorecontrolplane.go b/resource-manager/mobilenetwork/2023-09-01/packetcorecontrolplanecollectdiagnosticspackage/id_packetcorecontrolplane.go index f9989a1c1eb..6fd52a8809b 100644 --- a/resource-manager/mobilenetwork/2023-09-01/packetcorecontrolplanecollectdiagnosticspackage/id_packetcorecontrolplane.go +++ b/resource-manager/mobilenetwork/2023-09-01/packetcorecontrolplanecollectdiagnosticspackage/id_packetcorecontrolplane.go @@ -36,19 +36,9 @@ func ParsePacketCoreControlPlaneID(input string) (*PacketCoreControlPlaneId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreControlPlaneId{} - - 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.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePacketCoreControlPlaneIDInsensitively(input string) (*PacketCoreContro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreControlPlaneId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PacketCoreControlPlaneId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if id.PacketCoreControlPlaneName, ok = input.Parsed["packetCoreControlPlaneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", input) } - return &id, nil + return nil } // ValidatePacketCoreControlPlaneID checks that 'input' can be parsed as a Packet Core Control Plane ID diff --git a/resource-manager/mobilenetwork/2023-09-01/packetcorecontrolplanereinstall/id_packetcorecontrolplane.go b/resource-manager/mobilenetwork/2023-09-01/packetcorecontrolplanereinstall/id_packetcorecontrolplane.go index a0e8f462822..cffc717a5b9 100644 --- a/resource-manager/mobilenetwork/2023-09-01/packetcorecontrolplanereinstall/id_packetcorecontrolplane.go +++ b/resource-manager/mobilenetwork/2023-09-01/packetcorecontrolplanereinstall/id_packetcorecontrolplane.go @@ -36,19 +36,9 @@ func ParsePacketCoreControlPlaneID(input string) (*PacketCoreControlPlaneId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreControlPlaneId{} - - 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.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePacketCoreControlPlaneIDInsensitively(input string) (*PacketCoreContro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreControlPlaneId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PacketCoreControlPlaneId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if id.PacketCoreControlPlaneName, ok = input.Parsed["packetCoreControlPlaneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", input) } - return &id, nil + return nil } // ValidatePacketCoreControlPlaneID checks that 'input' can be parsed as a Packet Core Control Plane ID diff --git a/resource-manager/mobilenetwork/2023-09-01/packetcorecontrolplanerollback/id_packetcorecontrolplane.go b/resource-manager/mobilenetwork/2023-09-01/packetcorecontrolplanerollback/id_packetcorecontrolplane.go index 2c76bbcc174..de14ef3a114 100644 --- a/resource-manager/mobilenetwork/2023-09-01/packetcorecontrolplanerollback/id_packetcorecontrolplane.go +++ b/resource-manager/mobilenetwork/2023-09-01/packetcorecontrolplanerollback/id_packetcorecontrolplane.go @@ -36,19 +36,9 @@ func ParsePacketCoreControlPlaneID(input string) (*PacketCoreControlPlaneId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreControlPlaneId{} - - 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.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePacketCoreControlPlaneIDInsensitively(input string) (*PacketCoreContro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreControlPlaneId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PacketCoreControlPlaneId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if id.PacketCoreControlPlaneName, ok = input.Parsed["packetCoreControlPlaneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", input) } - return &id, nil + return nil } // ValidatePacketCoreControlPlaneID checks that 'input' can be parsed as a Packet Core Control Plane ID diff --git a/resource-manager/mobilenetwork/2023-09-01/packetcorecontrolplaneversion/id_packetcorecontrolplaneversion.go b/resource-manager/mobilenetwork/2023-09-01/packetcorecontrolplaneversion/id_packetcorecontrolplaneversion.go index a1469485fc0..5da90cacdc4 100644 --- a/resource-manager/mobilenetwork/2023-09-01/packetcorecontrolplaneversion/id_packetcorecontrolplaneversion.go +++ b/resource-manager/mobilenetwork/2023-09-01/packetcorecontrolplaneversion/id_packetcorecontrolplaneversion.go @@ -32,11 +32,9 @@ func ParsePacketCoreControlPlaneVersionID(input string) (*PacketCoreControlPlane return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreControlPlaneVersionId{} - - if id.PacketCoreControlPlaneVersionName, ok = parsed.Parsed["packetCoreControlPlaneVersionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneVersionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParsePacketCoreControlPlaneVersionIDInsensitively(input string) (*PacketCor return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreControlPlaneVersionId{} - - if id.PacketCoreControlPlaneVersionName, ok = parsed.Parsed["packetCoreControlPlaneVersionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneVersionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *PacketCoreControlPlaneVersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.PacketCoreControlPlaneVersionName, ok = input.Parsed["packetCoreControlPlaneVersionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneVersionName", input) + } + + return nil +} + // ValidatePacketCoreControlPlaneVersionID checks that 'input' can be parsed as a Packet Core Control Plane Version ID func ValidatePacketCoreControlPlaneVersionID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/mobilenetwork/2023-09-01/packetcorecontrolplaneversion/id_providerpacketcorecontrolplaneversion.go b/resource-manager/mobilenetwork/2023-09-01/packetcorecontrolplaneversion/id_providerpacketcorecontrolplaneversion.go index b86603e80b9..55ac7714f76 100644 --- a/resource-manager/mobilenetwork/2023-09-01/packetcorecontrolplaneversion/id_providerpacketcorecontrolplaneversion.go +++ b/resource-manager/mobilenetwork/2023-09-01/packetcorecontrolplaneversion/id_providerpacketcorecontrolplaneversion.go @@ -34,15 +34,9 @@ func ParseProviderPacketCoreControlPlaneVersionID(input string) (*ProviderPacket return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderPacketCoreControlPlaneVersionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.PacketCoreControlPlaneVersionName, ok = parsed.Parsed["packetCoreControlPlaneVersionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneVersionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviderPacketCoreControlPlaneVersionIDInsensitively(input string) (*P return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderPacketCoreControlPlaneVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ProviderPacketCoreControlPlaneVersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.PacketCoreControlPlaneVersionName, ok = parsed.Parsed["packetCoreControlPlaneVersionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneVersionName", *parsed) + if id.PacketCoreControlPlaneVersionName, ok = input.Parsed["packetCoreControlPlaneVersionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneVersionName", input) } - return &id, nil + return nil } // ValidateProviderPacketCoreControlPlaneVersionID checks that 'input' can be parsed as a Provider Packet Core Control Plane Version ID diff --git a/resource-manager/mobilenetwork/2023-09-01/packetcoredataplane/id_packetcoredataplane.go b/resource-manager/mobilenetwork/2023-09-01/packetcoredataplane/id_packetcoredataplane.go index e6890480af8..48c6b1f4d77 100644 --- a/resource-manager/mobilenetwork/2023-09-01/packetcoredataplane/id_packetcoredataplane.go +++ b/resource-manager/mobilenetwork/2023-09-01/packetcoredataplane/id_packetcoredataplane.go @@ -38,23 +38,9 @@ func ParsePacketCoreDataPlaneID(input string) (*PacketCoreDataPlaneId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreDataPlaneId{} - - 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.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) - } - - if id.PacketCoreDataPlaneName, ok = parsed.Parsed["packetCoreDataPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreDataPlaneName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePacketCoreDataPlaneIDInsensitively(input string) (*PacketCoreDataPlane return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreDataPlaneId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PacketCoreDataPlaneId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if id.PacketCoreControlPlaneName, ok = input.Parsed["packetCoreControlPlaneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", input) } - if id.PacketCoreDataPlaneName, ok = parsed.Parsed["packetCoreDataPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreDataPlaneName", *parsed) + if id.PacketCoreDataPlaneName, ok = input.Parsed["packetCoreDataPlaneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCoreDataPlaneName", input) } - return &id, nil + return nil } // ValidatePacketCoreDataPlaneID checks that 'input' can be parsed as a Packet Core Data Plane ID diff --git a/resource-manager/mobilenetwork/2023-09-01/packetcoredataplanes/id_packetcorecontrolplane.go b/resource-manager/mobilenetwork/2023-09-01/packetcoredataplanes/id_packetcorecontrolplane.go index 26e6b066fea..c5b4944eeee 100644 --- a/resource-manager/mobilenetwork/2023-09-01/packetcoredataplanes/id_packetcorecontrolplane.go +++ b/resource-manager/mobilenetwork/2023-09-01/packetcoredataplanes/id_packetcorecontrolplane.go @@ -36,19 +36,9 @@ func ParsePacketCoreControlPlaneID(input string) (*PacketCoreControlPlaneId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreControlPlaneId{} - - 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.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePacketCoreControlPlaneIDInsensitively(input string) (*PacketCoreContro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCoreControlPlaneId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PacketCoreControlPlaneId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PacketCoreControlPlaneName, ok = parsed.Parsed["packetCoreControlPlaneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", *parsed) + if id.PacketCoreControlPlaneName, ok = input.Parsed["packetCoreControlPlaneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCoreControlPlaneName", input) } - return &id, nil + return nil } // ValidatePacketCoreControlPlaneID checks that 'input' can be parsed as a Packet Core Control Plane ID diff --git a/resource-manager/mobilenetwork/2023-09-01/service/id_service.go b/resource-manager/mobilenetwork/2023-09-01/service/id_service.go index 323042964f5..cb22af83146 100644 --- a/resource-manager/mobilenetwork/2023-09-01/service/id_service.go +++ b/resource-manager/mobilenetwork/2023-09-01/service/id_service.go @@ -38,23 +38,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) - } - - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ServiceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if id.MobileNetworkName, ok = input.Parsed["mobileNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/mobilenetwork/2023-09-01/services/id_mobilenetwork.go b/resource-manager/mobilenetwork/2023-09-01/services/id_mobilenetwork.go index 6419461f44c..7a539e012d5 100644 --- a/resource-manager/mobilenetwork/2023-09-01/services/id_mobilenetwork.go +++ b/resource-manager/mobilenetwork/2023-09-01/services/id_mobilenetwork.go @@ -36,19 +36,9 @@ func ParseMobileNetworkID(input string) (*MobileNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MobileNetworkId{} - - 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.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMobileNetworkIDInsensitively(input string) (*MobileNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MobileNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MobileNetworkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if id.MobileNetworkName, ok = input.Parsed["mobileNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", input) } - return &id, nil + return nil } // ValidateMobileNetworkID checks that 'input' can be parsed as a Mobile Network ID diff --git a/resource-manager/mobilenetwork/2023-09-01/sim/id_sim.go b/resource-manager/mobilenetwork/2023-09-01/sim/id_sim.go index f8d6b241f81..02e82cea2ca 100644 --- a/resource-manager/mobilenetwork/2023-09-01/sim/id_sim.go +++ b/resource-manager/mobilenetwork/2023-09-01/sim/id_sim.go @@ -38,23 +38,9 @@ func ParseSimID(input string) (*SimId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SimId{} - - 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.SimGroupName, ok = parsed.Parsed["simGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "simGroupName", *parsed) - } - - if id.SimName, ok = parsed.Parsed["simName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "simName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSimIDInsensitively(input string) (*SimId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SimId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SimId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SimGroupName, ok = parsed.Parsed["simGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "simGroupName", *parsed) + if id.SimGroupName, ok = input.Parsed["simGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "simGroupName", input) } - if id.SimName, ok = parsed.Parsed["simName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "simName", *parsed) + if id.SimName, ok = input.Parsed["simName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "simName", input) } - return &id, nil + return nil } // ValidateSimID checks that 'input' can be parsed as a Sim ID diff --git a/resource-manager/mobilenetwork/2023-09-01/simgroup/id_simgroup.go b/resource-manager/mobilenetwork/2023-09-01/simgroup/id_simgroup.go index 303774665e0..f6d2c61b7cc 100644 --- a/resource-manager/mobilenetwork/2023-09-01/simgroup/id_simgroup.go +++ b/resource-manager/mobilenetwork/2023-09-01/simgroup/id_simgroup.go @@ -36,19 +36,9 @@ func ParseSimGroupID(input string) (*SimGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SimGroupId{} - - 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.SimGroupName, ok = parsed.Parsed["simGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "simGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSimGroupIDInsensitively(input string) (*SimGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SimGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SimGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SimGroupName, ok = parsed.Parsed["simGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "simGroupName", *parsed) + if id.SimGroupName, ok = input.Parsed["simGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "simGroupName", input) } - return &id, nil + return nil } // ValidateSimGroupID checks that 'input' can be parsed as a Sim Group ID diff --git a/resource-manager/mobilenetwork/2023-09-01/simpolicies/id_mobilenetwork.go b/resource-manager/mobilenetwork/2023-09-01/simpolicies/id_mobilenetwork.go index 5ad1c170641..1e0c9b08f00 100644 --- a/resource-manager/mobilenetwork/2023-09-01/simpolicies/id_mobilenetwork.go +++ b/resource-manager/mobilenetwork/2023-09-01/simpolicies/id_mobilenetwork.go @@ -36,19 +36,9 @@ func ParseMobileNetworkID(input string) (*MobileNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MobileNetworkId{} - - 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.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMobileNetworkIDInsensitively(input string) (*MobileNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MobileNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MobileNetworkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if id.MobileNetworkName, ok = input.Parsed["mobileNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", input) } - return &id, nil + return nil } // ValidateMobileNetworkID checks that 'input' can be parsed as a Mobile Network ID diff --git a/resource-manager/mobilenetwork/2023-09-01/simpolicy/id_simpolicy.go b/resource-manager/mobilenetwork/2023-09-01/simpolicy/id_simpolicy.go index 85abda18014..f9339520002 100644 --- a/resource-manager/mobilenetwork/2023-09-01/simpolicy/id_simpolicy.go +++ b/resource-manager/mobilenetwork/2023-09-01/simpolicy/id_simpolicy.go @@ -38,23 +38,9 @@ func ParseSimPolicyID(input string) (*SimPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SimPolicyId{} - - 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.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) - } - - if id.SimPolicyName, ok = parsed.Parsed["simPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "simPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSimPolicyIDInsensitively(input string) (*SimPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SimPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SimPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if id.MobileNetworkName, ok = input.Parsed["mobileNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", input) } - if id.SimPolicyName, ok = parsed.Parsed["simPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "simPolicyName", *parsed) + if id.SimPolicyName, ok = input.Parsed["simPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "simPolicyName", input) } - return &id, nil + return nil } // ValidateSimPolicyID checks that 'input' can be parsed as a Sim Policy ID diff --git a/resource-manager/mobilenetwork/2023-09-01/sims/id_simgroup.go b/resource-manager/mobilenetwork/2023-09-01/sims/id_simgroup.go index c553ab78fac..6e642f5fa18 100644 --- a/resource-manager/mobilenetwork/2023-09-01/sims/id_simgroup.go +++ b/resource-manager/mobilenetwork/2023-09-01/sims/id_simgroup.go @@ -36,19 +36,9 @@ func ParseSimGroupID(input string) (*SimGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SimGroupId{} - - 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.SimGroupName, ok = parsed.Parsed["simGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "simGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSimGroupIDInsensitively(input string) (*SimGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SimGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SimGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SimGroupName, ok = parsed.Parsed["simGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "simGroupName", *parsed) + if id.SimGroupName, ok = input.Parsed["simGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "simGroupName", input) } - return &id, nil + return nil } // ValidateSimGroupID checks that 'input' can be parsed as a Sim Group ID diff --git a/resource-manager/mobilenetwork/2023-09-01/site/id_site.go b/resource-manager/mobilenetwork/2023-09-01/site/id_site.go index ff3d6a3d975..d81ac0d5a65 100644 --- a/resource-manager/mobilenetwork/2023-09-01/site/id_site.go +++ b/resource-manager/mobilenetwork/2023-09-01/site/id_site.go @@ -38,23 +38,9 @@ func ParseSiteID(input string) (*SiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SiteId{} - - 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.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) - } - - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSiteIDInsensitively(input string) (*SiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SiteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SiteId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if id.MobileNetworkName, ok = input.Parsed["mobileNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - return &id, nil + return nil } // ValidateSiteID checks that 'input' can be parsed as a Site ID diff --git a/resource-manager/mobilenetwork/2023-09-01/sites/id_mobilenetwork.go b/resource-manager/mobilenetwork/2023-09-01/sites/id_mobilenetwork.go index dc17a8a4194..7a4bf647cb0 100644 --- a/resource-manager/mobilenetwork/2023-09-01/sites/id_mobilenetwork.go +++ b/resource-manager/mobilenetwork/2023-09-01/sites/id_mobilenetwork.go @@ -36,19 +36,9 @@ func ParseMobileNetworkID(input string) (*MobileNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MobileNetworkId{} - - 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.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMobileNetworkIDInsensitively(input string) (*MobileNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MobileNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MobileNetworkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if id.MobileNetworkName, ok = input.Parsed["mobileNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", input) } - return &id, nil + return nil } // ValidateMobileNetworkID checks that 'input' can be parsed as a Mobile Network ID diff --git a/resource-manager/mobilenetwork/2023-09-01/slice/id_slice.go b/resource-manager/mobilenetwork/2023-09-01/slice/id_slice.go index 62541dc50bc..23a1463fc8a 100644 --- a/resource-manager/mobilenetwork/2023-09-01/slice/id_slice.go +++ b/resource-manager/mobilenetwork/2023-09-01/slice/id_slice.go @@ -38,23 +38,9 @@ func ParseSliceID(input string) (*SliceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SliceId{} - - 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.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) - } - - if id.SliceName, ok = parsed.Parsed["sliceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sliceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSliceIDInsensitively(input string) (*SliceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SliceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SliceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if id.MobileNetworkName, ok = input.Parsed["mobileNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", input) } - if id.SliceName, ok = parsed.Parsed["sliceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sliceName", *parsed) + if id.SliceName, ok = input.Parsed["sliceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sliceName", input) } - return &id, nil + return nil } // ValidateSliceID checks that 'input' can be parsed as a Slice ID diff --git a/resource-manager/mobilenetwork/2023-09-01/slices/id_mobilenetwork.go b/resource-manager/mobilenetwork/2023-09-01/slices/id_mobilenetwork.go index 7c0313ba29b..055e2b441d7 100644 --- a/resource-manager/mobilenetwork/2023-09-01/slices/id_mobilenetwork.go +++ b/resource-manager/mobilenetwork/2023-09-01/slices/id_mobilenetwork.go @@ -36,19 +36,9 @@ func ParseMobileNetworkID(input string) (*MobileNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MobileNetworkId{} - - 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.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMobileNetworkIDInsensitively(input string) (*MobileNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MobileNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MobileNetworkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MobileNetworkName, ok = parsed.Parsed["mobileNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", *parsed) + if id.MobileNetworkName, ok = input.Parsed["mobileNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "mobileNetworkName", input) } - return &id, nil + return nil } // ValidateMobileNetworkID checks that 'input' can be parsed as a Mobile Network ID diff --git a/resource-manager/mysql/2017-12-01/configurations/id_configuration.go b/resource-manager/mysql/2017-12-01/configurations/id_configuration.go index 7feaec23025..dc6ea0c822f 100644 --- a/resource-manager/mysql/2017-12-01/configurations/id_configuration.go +++ b/resource-manager/mysql/2017-12-01/configurations/id_configuration.go @@ -38,23 +38,9 @@ func ParseConfigurationID(input string) (*ConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationId{} - - 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.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConfigurationIDInsensitively(input string) (*ConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationName", *parsed) + if id.ConfigurationName, ok = input.Parsed["configurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationName", input) } - return &id, nil + return nil } // ValidateConfigurationID checks that 'input' can be parsed as a Configuration ID diff --git a/resource-manager/mysql/2017-12-01/configurations/id_server.go b/resource-manager/mysql/2017-12-01/configurations/id_server.go index bae6e89be79..f7b042cd7d4 100644 --- a/resource-manager/mysql/2017-12-01/configurations/id_server.go +++ b/resource-manager/mysql/2017-12-01/configurations/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mysql/2017-12-01/configurationsupdate/id_server.go b/resource-manager/mysql/2017-12-01/configurationsupdate/id_server.go index bdb29836fd5..efb972cbeed 100644 --- a/resource-manager/mysql/2017-12-01/configurationsupdate/id_server.go +++ b/resource-manager/mysql/2017-12-01/configurationsupdate/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mysql/2017-12-01/databases/id_database.go b/resource-manager/mysql/2017-12-01/databases/id_database.go index a979b0a51f8..8f354bccb47 100644 --- a/resource-manager/mysql/2017-12-01/databases/id_database.go +++ b/resource-manager/mysql/2017-12-01/databases/id_database.go @@ -38,23 +38,9 @@ func ParseDatabaseID(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} - - 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) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDatabaseIDInsensitively(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - return &id, nil + return nil } // ValidateDatabaseID checks that 'input' can be parsed as a Database ID diff --git a/resource-manager/mysql/2017-12-01/databases/id_server.go b/resource-manager/mysql/2017-12-01/databases/id_server.go index 2b5b57fedae..f384090c29d 100644 --- a/resource-manager/mysql/2017-12-01/databases/id_server.go +++ b/resource-manager/mysql/2017-12-01/databases/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mysql/2017-12-01/firewallrules/id_firewallrule.go b/resource-manager/mysql/2017-12-01/firewallrules/id_firewallrule.go index 44ddf9c5e09..e7264d43452 100644 --- a/resource-manager/mysql/2017-12-01/firewallrules/id_firewallrule.go +++ b/resource-manager/mysql/2017-12-01/firewallrules/id_firewallrule.go @@ -38,23 +38,9 @@ func ParseFirewallRuleID(input string) (*FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallRuleId{} - - 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.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFirewallRuleIDInsensitively(input string) (*FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FirewallRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + if id.FirewallRuleName, ok = input.Parsed["firewallRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", input) } - return &id, nil + return nil } // ValidateFirewallRuleID checks that 'input' can be parsed as a Firewall Rule ID diff --git a/resource-manager/mysql/2017-12-01/firewallrules/id_server.go b/resource-manager/mysql/2017-12-01/firewallrules/id_server.go index e17ef27d140..ab6f9b4a1fd 100644 --- a/resource-manager/mysql/2017-12-01/firewallrules/id_server.go +++ b/resource-manager/mysql/2017-12-01/firewallrules/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mysql/2017-12-01/locationbasedperformancetier/id_location.go b/resource-manager/mysql/2017-12-01/locationbasedperformancetier/id_location.go index 8153c2241ff..365b797aceb 100644 --- a/resource-manager/mysql/2017-12-01/locationbasedperformancetier/id_location.go +++ b/resource-manager/mysql/2017-12-01/locationbasedperformancetier/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/mysql/2017-12-01/logfiles/id_server.go b/resource-manager/mysql/2017-12-01/logfiles/id_server.go index d1d651dd73e..4e4a7a6822d 100644 --- a/resource-manager/mysql/2017-12-01/logfiles/id_server.go +++ b/resource-manager/mysql/2017-12-01/logfiles/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mysql/2017-12-01/recoverableservers/id_server.go b/resource-manager/mysql/2017-12-01/recoverableservers/id_server.go index b6c50db61a1..7ba9fb7c494 100644 --- a/resource-manager/mysql/2017-12-01/recoverableservers/id_server.go +++ b/resource-manager/mysql/2017-12-01/recoverableservers/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mysql/2017-12-01/replicas/id_server.go b/resource-manager/mysql/2017-12-01/replicas/id_server.go index 66bf4a46371..1c26ddbe211 100644 --- a/resource-manager/mysql/2017-12-01/replicas/id_server.go +++ b/resource-manager/mysql/2017-12-01/replicas/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mysql/2017-12-01/serveradministrators/id_server.go b/resource-manager/mysql/2017-12-01/serveradministrators/id_server.go index e6e1ed4b264..8281d219c7e 100644 --- a/resource-manager/mysql/2017-12-01/serveradministrators/id_server.go +++ b/resource-manager/mysql/2017-12-01/serveradministrators/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mysql/2017-12-01/serverbasedperformancetier/id_server.go b/resource-manager/mysql/2017-12-01/serverbasedperformancetier/id_server.go index 7e4d55fd016..47b68da44f5 100644 --- a/resource-manager/mysql/2017-12-01/serverbasedperformancetier/id_server.go +++ b/resource-manager/mysql/2017-12-01/serverbasedperformancetier/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mysql/2017-12-01/serverrestart/id_server.go b/resource-manager/mysql/2017-12-01/serverrestart/id_server.go index c5975a59e6c..5c641cda3aa 100644 --- a/resource-manager/mysql/2017-12-01/serverrestart/id_server.go +++ b/resource-manager/mysql/2017-12-01/serverrestart/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mysql/2017-12-01/servers/id_server.go b/resource-manager/mysql/2017-12-01/servers/id_server.go index 13b3bb2dbaa..f20da0b3bee 100644 --- a/resource-manager/mysql/2017-12-01/servers/id_server.go +++ b/resource-manager/mysql/2017-12-01/servers/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mysql/2017-12-01/serversecurityalertpolicies/id_server.go b/resource-manager/mysql/2017-12-01/serversecurityalertpolicies/id_server.go index a387281b4b4..c8a190f79c8 100644 --- a/resource-manager/mysql/2017-12-01/serversecurityalertpolicies/id_server.go +++ b/resource-manager/mysql/2017-12-01/serversecurityalertpolicies/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mysql/2017-12-01/virtualnetworkrules/id_server.go b/resource-manager/mysql/2017-12-01/virtualnetworkrules/id_server.go index e959cb6c60d..0d3dbbe78b0 100644 --- a/resource-manager/mysql/2017-12-01/virtualnetworkrules/id_server.go +++ b/resource-manager/mysql/2017-12-01/virtualnetworkrules/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mysql/2017-12-01/virtualnetworkrules/id_virtualnetworkrule.go b/resource-manager/mysql/2017-12-01/virtualnetworkrules/id_virtualnetworkrule.go index c49b840001e..76235fd2db6 100644 --- a/resource-manager/mysql/2017-12-01/virtualnetworkrules/id_virtualnetworkrule.go +++ b/resource-manager/mysql/2017-12-01/virtualnetworkrules/id_virtualnetworkrule.go @@ -38,23 +38,9 @@ func ParseVirtualNetworkRuleID(input string) (*VirtualNetworkRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkRuleId{} - - 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.VirtualNetworkRuleName, ok = parsed.Parsed["virtualNetworkRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualNetworkRuleIDInsensitively(input string) (*VirtualNetworkRuleId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualNetworkRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.VirtualNetworkRuleName, ok = parsed.Parsed["virtualNetworkRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkRuleName", *parsed) + if id.VirtualNetworkRuleName, ok = input.Parsed["virtualNetworkRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkRuleName", input) } - return &id, nil + return nil } // ValidateVirtualNetworkRuleID checks that 'input' can be parsed as a Virtual Network Rule ID diff --git a/resource-manager/mysql/2020-01-01/serverkeys/id_key.go b/resource-manager/mysql/2020-01-01/serverkeys/id_key.go index 1ce5b050816..107fa7f3af1 100644 --- a/resource-manager/mysql/2020-01-01/serverkeys/id_key.go +++ b/resource-manager/mysql/2020-01-01/serverkeys/id_key.go @@ -38,23 +38,9 @@ func ParseKeyID(input string) (*KeyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := KeyId{} - - 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.KeyName, ok = parsed.Parsed["keyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseKeyIDInsensitively(input string) (*KeyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := KeyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *KeyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.KeyName, ok = parsed.Parsed["keyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyName", *parsed) + if id.KeyName, ok = input.Parsed["keyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "keyName", input) } - return &id, nil + return nil } // ValidateKeyID checks that 'input' can be parsed as a Key ID diff --git a/resource-manager/mysql/2020-01-01/serverkeys/id_server.go b/resource-manager/mysql/2020-01-01/serverkeys/id_server.go index cd6654c4b9f..19c9dcde6a0 100644 --- a/resource-manager/mysql/2020-01-01/serverkeys/id_server.go +++ b/resource-manager/mysql/2020-01-01/serverkeys/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mysql/2020-01-01/serverstart/id_server.go b/resource-manager/mysql/2020-01-01/serverstart/id_server.go index fd31671afb9..bf3a3cdc0bc 100644 --- a/resource-manager/mysql/2020-01-01/serverstart/id_server.go +++ b/resource-manager/mysql/2020-01-01/serverstart/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mysql/2020-01-01/serverstop/id_server.go b/resource-manager/mysql/2020-01-01/serverstop/id_server.go index fe255126afd..92adf6095bd 100644 --- a/resource-manager/mysql/2020-01-01/serverstop/id_server.go +++ b/resource-manager/mysql/2020-01-01/serverstop/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mysql/2020-01-01/serverupgrade/id_server.go b/resource-manager/mysql/2020-01-01/serverupgrade/id_server.go index db03967b9b7..e547cc337e5 100644 --- a/resource-manager/mysql/2020-01-01/serverupgrade/id_server.go +++ b/resource-manager/mysql/2020-01-01/serverupgrade/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/mysql/2021-05-01/backups/id_backup.go b/resource-manager/mysql/2021-05-01/backups/id_backup.go index 6d16556c185..24d47198d90 100644 --- a/resource-manager/mysql/2021-05-01/backups/id_backup.go +++ b/resource-manager/mysql/2021-05-01/backups/id_backup.go @@ -38,23 +38,9 @@ func ParseBackupID(input string) (*BackupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) - } - - if id.BackupName, ok = parsed.Parsed["backupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupIDInsensitively(input string) (*BackupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - if id.BackupName, ok = parsed.Parsed["backupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupName", *parsed) + if id.BackupName, ok = input.Parsed["backupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupName", input) } - return &id, nil + return nil } // ValidateBackupID checks that 'input' can be parsed as a Backup ID diff --git a/resource-manager/mysql/2021-05-01/backups/id_flexibleserver.go b/resource-manager/mysql/2021-05-01/backups/id_flexibleserver.go index cc9dd2b0d94..dcd8092ba62 100644 --- a/resource-manager/mysql/2021-05-01/backups/id_flexibleserver.go +++ b/resource-manager/mysql/2021-05-01/backups/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/mysql/2021-05-01/checknameavailability/id_location.go b/resource-manager/mysql/2021-05-01/checknameavailability/id_location.go index 1f4564c3d8f..ea659695dff 100644 --- a/resource-manager/mysql/2021-05-01/checknameavailability/id_location.go +++ b/resource-manager/mysql/2021-05-01/checknameavailability/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/mysql/2021-05-01/configurations/id_configuration.go b/resource-manager/mysql/2021-05-01/configurations/id_configuration.go index a9d0908a7b6..ad74c51e2bd 100644 --- a/resource-manager/mysql/2021-05-01/configurations/id_configuration.go +++ b/resource-manager/mysql/2021-05-01/configurations/id_configuration.go @@ -38,23 +38,9 @@ func ParseConfigurationID(input string) (*ConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) - } - - if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConfigurationIDInsensitively(input string) (*ConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationName", *parsed) + if id.ConfigurationName, ok = input.Parsed["configurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationName", input) } - return &id, nil + return nil } // ValidateConfigurationID checks that 'input' can be parsed as a Configuration ID diff --git a/resource-manager/mysql/2021-05-01/configurations/id_flexibleserver.go b/resource-manager/mysql/2021-05-01/configurations/id_flexibleserver.go index 72241638a66..75a9b36af4a 100644 --- a/resource-manager/mysql/2021-05-01/configurations/id_flexibleserver.go +++ b/resource-manager/mysql/2021-05-01/configurations/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/mysql/2021-05-01/databases/id_database.go b/resource-manager/mysql/2021-05-01/databases/id_database.go index 2fd0eb19498..06dd8ff5cd6 100644 --- a/resource-manager/mysql/2021-05-01/databases/id_database.go +++ b/resource-manager/mysql/2021-05-01/databases/id_database.go @@ -38,23 +38,9 @@ func ParseDatabaseID(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDatabaseIDInsensitively(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - return &id, nil + return nil } // ValidateDatabaseID checks that 'input' can be parsed as a Database ID diff --git a/resource-manager/mysql/2021-05-01/databases/id_flexibleserver.go b/resource-manager/mysql/2021-05-01/databases/id_flexibleserver.go index a9924e6f1c6..9b7ecf2c706 100644 --- a/resource-manager/mysql/2021-05-01/databases/id_flexibleserver.go +++ b/resource-manager/mysql/2021-05-01/databases/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/mysql/2021-05-01/firewallrules/id_firewallrule.go b/resource-manager/mysql/2021-05-01/firewallrules/id_firewallrule.go index b735e21dc57..022c44812fa 100644 --- a/resource-manager/mysql/2021-05-01/firewallrules/id_firewallrule.go +++ b/resource-manager/mysql/2021-05-01/firewallrules/id_firewallrule.go @@ -38,23 +38,9 @@ func ParseFirewallRuleID(input string) (*FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallRuleId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) - } - - if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFirewallRuleIDInsensitively(input string) (*FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FirewallRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + if id.FirewallRuleName, ok = input.Parsed["firewallRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", input) } - return &id, nil + return nil } // ValidateFirewallRuleID checks that 'input' can be parsed as a Firewall Rule ID diff --git a/resource-manager/mysql/2021-05-01/firewallrules/id_flexibleserver.go b/resource-manager/mysql/2021-05-01/firewallrules/id_flexibleserver.go index 88b84fdedf9..76281db5b46 100644 --- a/resource-manager/mysql/2021-05-01/firewallrules/id_flexibleserver.go +++ b/resource-manager/mysql/2021-05-01/firewallrules/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/mysql/2021-05-01/locationbasedcapabilities/id_location.go b/resource-manager/mysql/2021-05-01/locationbasedcapabilities/id_location.go index 7934cb55cf2..59873015513 100644 --- a/resource-manager/mysql/2021-05-01/locationbasedcapabilities/id_location.go +++ b/resource-manager/mysql/2021-05-01/locationbasedcapabilities/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/mysql/2021-05-01/serverfailover/id_flexibleserver.go b/resource-manager/mysql/2021-05-01/serverfailover/id_flexibleserver.go index 615ca132014..d3629dbd923 100644 --- a/resource-manager/mysql/2021-05-01/serverfailover/id_flexibleserver.go +++ b/resource-manager/mysql/2021-05-01/serverfailover/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/mysql/2021-05-01/serverrestart/id_flexibleserver.go b/resource-manager/mysql/2021-05-01/serverrestart/id_flexibleserver.go index 105a7af57d4..2f2e3695f4b 100644 --- a/resource-manager/mysql/2021-05-01/serverrestart/id_flexibleserver.go +++ b/resource-manager/mysql/2021-05-01/serverrestart/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/mysql/2021-05-01/servers/id_flexibleserver.go b/resource-manager/mysql/2021-05-01/servers/id_flexibleserver.go index de1a095f0c2..fc9e940a757 100644 --- a/resource-manager/mysql/2021-05-01/servers/id_flexibleserver.go +++ b/resource-manager/mysql/2021-05-01/servers/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/mysql/2021-05-01/serverstart/id_flexibleserver.go b/resource-manager/mysql/2021-05-01/serverstart/id_flexibleserver.go index 993b5a194b3..ce569c538f6 100644 --- a/resource-manager/mysql/2021-05-01/serverstart/id_flexibleserver.go +++ b/resource-manager/mysql/2021-05-01/serverstart/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/mysql/2021-05-01/serverstop/id_flexibleserver.go b/resource-manager/mysql/2021-05-01/serverstop/id_flexibleserver.go index aaaee2ed29e..13e7981cb3d 100644 --- a/resource-manager/mysql/2021-05-01/serverstop/id_flexibleserver.go +++ b/resource-manager/mysql/2021-05-01/serverstop/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/mysql/2021-12-01-preview/azureadadministrators/id_flexibleserver.go b/resource-manager/mysql/2021-12-01-preview/azureadadministrators/id_flexibleserver.go index 6b11b280352..1d5f7413413 100644 --- a/resource-manager/mysql/2021-12-01-preview/azureadadministrators/id_flexibleserver.go +++ b/resource-manager/mysql/2021-12-01-preview/azureadadministrators/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/mysql/2021-12-01-preview/backups/id_backup.go b/resource-manager/mysql/2021-12-01-preview/backups/id_backup.go index 6d16556c185..24d47198d90 100644 --- a/resource-manager/mysql/2021-12-01-preview/backups/id_backup.go +++ b/resource-manager/mysql/2021-12-01-preview/backups/id_backup.go @@ -38,23 +38,9 @@ func ParseBackupID(input string) (*BackupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) - } - - if id.BackupName, ok = parsed.Parsed["backupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupIDInsensitively(input string) (*BackupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - if id.BackupName, ok = parsed.Parsed["backupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupName", *parsed) + if id.BackupName, ok = input.Parsed["backupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupName", input) } - return &id, nil + return nil } // ValidateBackupID checks that 'input' can be parsed as a Backup ID diff --git a/resource-manager/mysql/2021-12-01-preview/backups/id_flexibleserver.go b/resource-manager/mysql/2021-12-01-preview/backups/id_flexibleserver.go index cc9dd2b0d94..dcd8092ba62 100644 --- a/resource-manager/mysql/2021-12-01-preview/backups/id_flexibleserver.go +++ b/resource-manager/mysql/2021-12-01-preview/backups/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/mysql/2021-12-01-preview/checknameavailability/id_location.go b/resource-manager/mysql/2021-12-01-preview/checknameavailability/id_location.go index 1f4564c3d8f..ea659695dff 100644 --- a/resource-manager/mysql/2021-12-01-preview/checknameavailability/id_location.go +++ b/resource-manager/mysql/2021-12-01-preview/checknameavailability/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/mysql/2021-12-01-preview/configurations/id_configuration.go b/resource-manager/mysql/2021-12-01-preview/configurations/id_configuration.go index a9d0908a7b6..ad74c51e2bd 100644 --- a/resource-manager/mysql/2021-12-01-preview/configurations/id_configuration.go +++ b/resource-manager/mysql/2021-12-01-preview/configurations/id_configuration.go @@ -38,23 +38,9 @@ func ParseConfigurationID(input string) (*ConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) - } - - if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConfigurationIDInsensitively(input string) (*ConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationName", *parsed) + if id.ConfigurationName, ok = input.Parsed["configurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationName", input) } - return &id, nil + return nil } // ValidateConfigurationID checks that 'input' can be parsed as a Configuration ID diff --git a/resource-manager/mysql/2021-12-01-preview/configurations/id_flexibleserver.go b/resource-manager/mysql/2021-12-01-preview/configurations/id_flexibleserver.go index 72241638a66..75a9b36af4a 100644 --- a/resource-manager/mysql/2021-12-01-preview/configurations/id_flexibleserver.go +++ b/resource-manager/mysql/2021-12-01-preview/configurations/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/mysql/2021-12-01-preview/databases/id_database.go b/resource-manager/mysql/2021-12-01-preview/databases/id_database.go index 2fd0eb19498..06dd8ff5cd6 100644 --- a/resource-manager/mysql/2021-12-01-preview/databases/id_database.go +++ b/resource-manager/mysql/2021-12-01-preview/databases/id_database.go @@ -38,23 +38,9 @@ func ParseDatabaseID(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDatabaseIDInsensitively(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - return &id, nil + return nil } // ValidateDatabaseID checks that 'input' can be parsed as a Database ID diff --git a/resource-manager/mysql/2021-12-01-preview/databases/id_flexibleserver.go b/resource-manager/mysql/2021-12-01-preview/databases/id_flexibleserver.go index a9924e6f1c6..9b7ecf2c706 100644 --- a/resource-manager/mysql/2021-12-01-preview/databases/id_flexibleserver.go +++ b/resource-manager/mysql/2021-12-01-preview/databases/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/mysql/2021-12-01-preview/firewallrules/id_firewallrule.go b/resource-manager/mysql/2021-12-01-preview/firewallrules/id_firewallrule.go index b735e21dc57..022c44812fa 100644 --- a/resource-manager/mysql/2021-12-01-preview/firewallrules/id_firewallrule.go +++ b/resource-manager/mysql/2021-12-01-preview/firewallrules/id_firewallrule.go @@ -38,23 +38,9 @@ func ParseFirewallRuleID(input string) (*FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallRuleId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) - } - - if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFirewallRuleIDInsensitively(input string) (*FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FirewallRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + if id.FirewallRuleName, ok = input.Parsed["firewallRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", input) } - return &id, nil + return nil } // ValidateFirewallRuleID checks that 'input' can be parsed as a Firewall Rule ID diff --git a/resource-manager/mysql/2021-12-01-preview/firewallrules/id_flexibleserver.go b/resource-manager/mysql/2021-12-01-preview/firewallrules/id_flexibleserver.go index 88b84fdedf9..76281db5b46 100644 --- a/resource-manager/mysql/2021-12-01-preview/firewallrules/id_flexibleserver.go +++ b/resource-manager/mysql/2021-12-01-preview/firewallrules/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/mysql/2021-12-01-preview/locationbasedcapabilities/id_location.go b/resource-manager/mysql/2021-12-01-preview/locationbasedcapabilities/id_location.go index 7934cb55cf2..59873015513 100644 --- a/resource-manager/mysql/2021-12-01-preview/locationbasedcapabilities/id_location.go +++ b/resource-manager/mysql/2021-12-01-preview/locationbasedcapabilities/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/mysql/2021-12-01-preview/logfiles/id_flexibleserver.go b/resource-manager/mysql/2021-12-01-preview/logfiles/id_flexibleserver.go index 3bf684f08d9..c7280c91e32 100644 --- a/resource-manager/mysql/2021-12-01-preview/logfiles/id_flexibleserver.go +++ b/resource-manager/mysql/2021-12-01-preview/logfiles/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/mysql/2021-12-01-preview/serverfailover/id_flexibleserver.go b/resource-manager/mysql/2021-12-01-preview/serverfailover/id_flexibleserver.go index 615ca132014..d3629dbd923 100644 --- a/resource-manager/mysql/2021-12-01-preview/serverfailover/id_flexibleserver.go +++ b/resource-manager/mysql/2021-12-01-preview/serverfailover/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/mysql/2021-12-01-preview/serverrestart/id_flexibleserver.go b/resource-manager/mysql/2021-12-01-preview/serverrestart/id_flexibleserver.go index 105a7af57d4..2f2e3695f4b 100644 --- a/resource-manager/mysql/2021-12-01-preview/serverrestart/id_flexibleserver.go +++ b/resource-manager/mysql/2021-12-01-preview/serverrestart/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/mysql/2021-12-01-preview/servers/id_flexibleserver.go b/resource-manager/mysql/2021-12-01-preview/servers/id_flexibleserver.go index de1a095f0c2..fc9e940a757 100644 --- a/resource-manager/mysql/2021-12-01-preview/servers/id_flexibleserver.go +++ b/resource-manager/mysql/2021-12-01-preview/servers/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/mysql/2021-12-01-preview/serverstart/id_flexibleserver.go b/resource-manager/mysql/2021-12-01-preview/serverstart/id_flexibleserver.go index 993b5a194b3..ce569c538f6 100644 --- a/resource-manager/mysql/2021-12-01-preview/serverstart/id_flexibleserver.go +++ b/resource-manager/mysql/2021-12-01-preview/serverstart/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/mysql/2021-12-01-preview/serverstop/id_flexibleserver.go b/resource-manager/mysql/2021-12-01-preview/serverstop/id_flexibleserver.go index aaaee2ed29e..13e7981cb3d 100644 --- a/resource-manager/mysql/2021-12-01-preview/serverstop/id_flexibleserver.go +++ b/resource-manager/mysql/2021-12-01-preview/serverstop/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/mysql/2022-01-01/azureadadministrators/id_flexibleserver.go b/resource-manager/mysql/2022-01-01/azureadadministrators/id_flexibleserver.go index 6b11b280352..1d5f7413413 100644 --- a/resource-manager/mysql/2022-01-01/azureadadministrators/id_flexibleserver.go +++ b/resource-manager/mysql/2022-01-01/azureadadministrators/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/mysql/2022-01-01/backups/id_backup.go b/resource-manager/mysql/2022-01-01/backups/id_backup.go index 6d16556c185..24d47198d90 100644 --- a/resource-manager/mysql/2022-01-01/backups/id_backup.go +++ b/resource-manager/mysql/2022-01-01/backups/id_backup.go @@ -38,23 +38,9 @@ func ParseBackupID(input string) (*BackupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) - } - - if id.BackupName, ok = parsed.Parsed["backupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupIDInsensitively(input string) (*BackupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - if id.BackupName, ok = parsed.Parsed["backupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupName", *parsed) + if id.BackupName, ok = input.Parsed["backupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupName", input) } - return &id, nil + return nil } // ValidateBackupID checks that 'input' can be parsed as a Backup ID diff --git a/resource-manager/mysql/2022-01-01/backups/id_flexibleserver.go b/resource-manager/mysql/2022-01-01/backups/id_flexibleserver.go index cc9dd2b0d94..dcd8092ba62 100644 --- a/resource-manager/mysql/2022-01-01/backups/id_flexibleserver.go +++ b/resource-manager/mysql/2022-01-01/backups/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/mysql/2022-01-01/checknameavailability/id_location.go b/resource-manager/mysql/2022-01-01/checknameavailability/id_location.go index 1f4564c3d8f..ea659695dff 100644 --- a/resource-manager/mysql/2022-01-01/checknameavailability/id_location.go +++ b/resource-manager/mysql/2022-01-01/checknameavailability/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/mysql/2022-01-01/configurations/id_configuration.go b/resource-manager/mysql/2022-01-01/configurations/id_configuration.go index a9d0908a7b6..ad74c51e2bd 100644 --- a/resource-manager/mysql/2022-01-01/configurations/id_configuration.go +++ b/resource-manager/mysql/2022-01-01/configurations/id_configuration.go @@ -38,23 +38,9 @@ func ParseConfigurationID(input string) (*ConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) - } - - if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConfigurationIDInsensitively(input string) (*ConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationName", *parsed) + if id.ConfigurationName, ok = input.Parsed["configurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationName", input) } - return &id, nil + return nil } // ValidateConfigurationID checks that 'input' can be parsed as a Configuration ID diff --git a/resource-manager/mysql/2022-01-01/configurations/id_flexibleserver.go b/resource-manager/mysql/2022-01-01/configurations/id_flexibleserver.go index 72241638a66..75a9b36af4a 100644 --- a/resource-manager/mysql/2022-01-01/configurations/id_flexibleserver.go +++ b/resource-manager/mysql/2022-01-01/configurations/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/mysql/2022-01-01/databases/id_database.go b/resource-manager/mysql/2022-01-01/databases/id_database.go index 2fd0eb19498..06dd8ff5cd6 100644 --- a/resource-manager/mysql/2022-01-01/databases/id_database.go +++ b/resource-manager/mysql/2022-01-01/databases/id_database.go @@ -38,23 +38,9 @@ func ParseDatabaseID(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDatabaseIDInsensitively(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - return &id, nil + return nil } // ValidateDatabaseID checks that 'input' can be parsed as a Database ID diff --git a/resource-manager/mysql/2022-01-01/databases/id_flexibleserver.go b/resource-manager/mysql/2022-01-01/databases/id_flexibleserver.go index a9924e6f1c6..9b7ecf2c706 100644 --- a/resource-manager/mysql/2022-01-01/databases/id_flexibleserver.go +++ b/resource-manager/mysql/2022-01-01/databases/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/mysql/2022-01-01/firewallrules/id_firewallrule.go b/resource-manager/mysql/2022-01-01/firewallrules/id_firewallrule.go index b735e21dc57..022c44812fa 100644 --- a/resource-manager/mysql/2022-01-01/firewallrules/id_firewallrule.go +++ b/resource-manager/mysql/2022-01-01/firewallrules/id_firewallrule.go @@ -38,23 +38,9 @@ func ParseFirewallRuleID(input string) (*FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallRuleId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) - } - - if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFirewallRuleIDInsensitively(input string) (*FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FirewallRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + if id.FirewallRuleName, ok = input.Parsed["firewallRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", input) } - return &id, nil + return nil } // ValidateFirewallRuleID checks that 'input' can be parsed as a Firewall Rule ID diff --git a/resource-manager/mysql/2022-01-01/firewallrules/id_flexibleserver.go b/resource-manager/mysql/2022-01-01/firewallrules/id_flexibleserver.go index 88b84fdedf9..76281db5b46 100644 --- a/resource-manager/mysql/2022-01-01/firewallrules/id_flexibleserver.go +++ b/resource-manager/mysql/2022-01-01/firewallrules/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/mysql/2022-01-01/locationbasedcapabilities/id_location.go b/resource-manager/mysql/2022-01-01/locationbasedcapabilities/id_location.go index 7934cb55cf2..59873015513 100644 --- a/resource-manager/mysql/2022-01-01/locationbasedcapabilities/id_location.go +++ b/resource-manager/mysql/2022-01-01/locationbasedcapabilities/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/mysql/2022-01-01/logfiles/id_flexibleserver.go b/resource-manager/mysql/2022-01-01/logfiles/id_flexibleserver.go index 3bf684f08d9..c7280c91e32 100644 --- a/resource-manager/mysql/2022-01-01/logfiles/id_flexibleserver.go +++ b/resource-manager/mysql/2022-01-01/logfiles/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/mysql/2022-01-01/serverfailover/id_flexibleserver.go b/resource-manager/mysql/2022-01-01/serverfailover/id_flexibleserver.go index 615ca132014..d3629dbd923 100644 --- a/resource-manager/mysql/2022-01-01/serverfailover/id_flexibleserver.go +++ b/resource-manager/mysql/2022-01-01/serverfailover/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/mysql/2022-01-01/serverrestart/id_flexibleserver.go b/resource-manager/mysql/2022-01-01/serverrestart/id_flexibleserver.go index 105a7af57d4..2f2e3695f4b 100644 --- a/resource-manager/mysql/2022-01-01/serverrestart/id_flexibleserver.go +++ b/resource-manager/mysql/2022-01-01/serverrestart/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/mysql/2022-01-01/servers/id_flexibleserver.go b/resource-manager/mysql/2022-01-01/servers/id_flexibleserver.go index de1a095f0c2..fc9e940a757 100644 --- a/resource-manager/mysql/2022-01-01/servers/id_flexibleserver.go +++ b/resource-manager/mysql/2022-01-01/servers/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/mysql/2022-01-01/serverstart/id_flexibleserver.go b/resource-manager/mysql/2022-01-01/serverstart/id_flexibleserver.go index 993b5a194b3..ce569c538f6 100644 --- a/resource-manager/mysql/2022-01-01/serverstart/id_flexibleserver.go +++ b/resource-manager/mysql/2022-01-01/serverstart/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/mysql/2022-01-01/serverstop/id_flexibleserver.go b/resource-manager/mysql/2022-01-01/serverstop/id_flexibleserver.go index aaaee2ed29e..13e7981cb3d 100644 --- a/resource-manager/mysql/2022-01-01/serverstop/id_flexibleserver.go +++ b/resource-manager/mysql/2022-01-01/serverstop/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/netapp/2022-05-01/backuppolicy/id_backuppolicy.go b/resource-manager/netapp/2022-05-01/backuppolicy/id_backuppolicy.go index be7dcea83e7..f16f0b462b8 100644 --- a/resource-manager/netapp/2022-05-01/backuppolicy/id_backuppolicy.go +++ b/resource-manager/netapp/2022-05-01/backuppolicy/id_backuppolicy.go @@ -38,23 +38,9 @@ func ParseBackupPolicyID(input string) (*BackupPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupPolicyId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.BackupPolicyName, ok = parsed.Parsed["backupPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupPolicyIDInsensitively(input string) (*BackupPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.BackupPolicyName, ok = parsed.Parsed["backupPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupPolicyName", *parsed) + if id.BackupPolicyName, ok = input.Parsed["backupPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupPolicyName", input) } - return &id, nil + return nil } // ValidateBackupPolicyID checks that 'input' can be parsed as a Backup Policy ID diff --git a/resource-manager/netapp/2022-05-01/backuppolicy/id_netappaccount.go b/resource-manager/netapp/2022-05-01/backuppolicy/id_netappaccount.go index f9f08268b3e..6b11cb40365 100644 --- a/resource-manager/netapp/2022-05-01/backuppolicy/id_netappaccount.go +++ b/resource-manager/netapp/2022-05-01/backuppolicy/id_netappaccount.go @@ -36,19 +36,9 @@ func ParseNetAppAccountID(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetAppAccountIDInsensitively(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetAppAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - return &id, nil + return nil } // ValidateNetAppAccountID checks that 'input' can be parsed as a Net App Account ID diff --git a/resource-manager/netapp/2022-05-01/backups/id_accountbackup.go b/resource-manager/netapp/2022-05-01/backups/id_accountbackup.go index f2f3727d464..b4091d27265 100644 --- a/resource-manager/netapp/2022-05-01/backups/id_accountbackup.go +++ b/resource-manager/netapp/2022-05-01/backups/id_accountbackup.go @@ -38,23 +38,9 @@ func ParseAccountBackupID(input string) (*AccountBackupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountBackupId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.AccountBackupName, ok = parsed.Parsed["accountBackupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountBackupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAccountBackupIDInsensitively(input string) (*AccountBackupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountBackupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AccountBackupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.AccountBackupName, ok = parsed.Parsed["accountBackupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountBackupName", *parsed) + if id.AccountBackupName, ok = input.Parsed["accountBackupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountBackupName", input) } - return &id, nil + return nil } // ValidateAccountBackupID checks that 'input' can be parsed as a Account Backup ID diff --git a/resource-manager/netapp/2022-05-01/backups/id_backup.go b/resource-manager/netapp/2022-05-01/backups/id_backup.go index d4dfe8b796e..9c95bd9350f 100644 --- a/resource-manager/netapp/2022-05-01/backups/id_backup.go +++ b/resource-manager/netapp/2022-05-01/backups/id_backup.go @@ -42,31 +42,9 @@ func ParseBackupID(input string) (*BackupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) - } - - if id.BackupName, ok = parsed.Parsed["backupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseBackupIDInsensitively(input string) (*BackupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *BackupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - if id.BackupName, ok = parsed.Parsed["backupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupName", *parsed) + if id.BackupName, ok = input.Parsed["backupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupName", input) } - return &id, nil + return nil } // ValidateBackupID checks that 'input' can be parsed as a Backup ID diff --git a/resource-manager/netapp/2022-05-01/backups/id_netappaccount.go b/resource-manager/netapp/2022-05-01/backups/id_netappaccount.go index 304edc5df29..ced6c2088e0 100644 --- a/resource-manager/netapp/2022-05-01/backups/id_netappaccount.go +++ b/resource-manager/netapp/2022-05-01/backups/id_netappaccount.go @@ -36,19 +36,9 @@ func ParseNetAppAccountID(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetAppAccountIDInsensitively(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetAppAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - return &id, nil + return nil } // ValidateNetAppAccountID checks that 'input' can be parsed as a Net App Account ID diff --git a/resource-manager/netapp/2022-05-01/backups/id_volume.go b/resource-manager/netapp/2022-05-01/backups/id_volume.go index 69bcd9c2450..247b20b073e 100644 --- a/resource-manager/netapp/2022-05-01/backups/id_volume.go +++ b/resource-manager/netapp/2022-05-01/backups/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2022-05-01/capacitypools/id_capacitypool.go b/resource-manager/netapp/2022-05-01/capacitypools/id_capacitypool.go index c2e4d58474e..69954702fd9 100644 --- a/resource-manager/netapp/2022-05-01/capacitypools/id_capacitypool.go +++ b/resource-manager/netapp/2022-05-01/capacitypools/id_capacitypool.go @@ -38,23 +38,9 @@ func ParseCapacityPoolID(input string) (*CapacityPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapacityPoolId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCapacityPoolIDInsensitively(input string) (*CapacityPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapacityPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CapacityPoolId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - return &id, nil + return nil } // ValidateCapacityPoolID checks that 'input' can be parsed as a Capacity Pool ID diff --git a/resource-manager/netapp/2022-05-01/capacitypools/id_netappaccount.go b/resource-manager/netapp/2022-05-01/capacitypools/id_netappaccount.go index 43537ad3c8a..f424e58a9e8 100644 --- a/resource-manager/netapp/2022-05-01/capacitypools/id_netappaccount.go +++ b/resource-manager/netapp/2022-05-01/capacitypools/id_netappaccount.go @@ -36,19 +36,9 @@ func ParseNetAppAccountID(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetAppAccountIDInsensitively(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetAppAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - return &id, nil + return nil } // ValidateNetAppAccountID checks that 'input' can be parsed as a Net App Account ID diff --git a/resource-manager/netapp/2022-05-01/netappaccounts/id_netappaccount.go b/resource-manager/netapp/2022-05-01/netappaccounts/id_netappaccount.go index 65af9c406fe..07a8ef7a579 100644 --- a/resource-manager/netapp/2022-05-01/netappaccounts/id_netappaccount.go +++ b/resource-manager/netapp/2022-05-01/netappaccounts/id_netappaccount.go @@ -36,19 +36,9 @@ func ParseNetAppAccountID(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetAppAccountIDInsensitively(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetAppAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - return &id, nil + return nil } // ValidateNetAppAccountID checks that 'input' can be parsed as a Net App Account ID diff --git a/resource-manager/netapp/2022-05-01/netappresource/id_location.go b/resource-manager/netapp/2022-05-01/netappresource/id_location.go index 8c8f5f240ba..7c120e2a191 100644 --- a/resource-manager/netapp/2022-05-01/netappresource/id_location.go +++ b/resource-manager/netapp/2022-05-01/netappresource/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/netapp/2022-05-01/netappresource/id_quotalimit.go b/resource-manager/netapp/2022-05-01/netappresource/id_quotalimit.go index e203fa4b75f..aa29f073d5d 100644 --- a/resource-manager/netapp/2022-05-01/netappresource/id_quotalimit.go +++ b/resource-manager/netapp/2022-05-01/netappresource/id_quotalimit.go @@ -36,19 +36,9 @@ func ParseQuotaLimitID(input string) (*QuotaLimitId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QuotaLimitId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.QuotaLimitName, ok = parsed.Parsed["quotaLimitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "quotaLimitName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseQuotaLimitIDInsensitively(input string) (*QuotaLimitId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QuotaLimitId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *QuotaLimitId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.QuotaLimitName, ok = parsed.Parsed["quotaLimitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "quotaLimitName", *parsed) + if id.QuotaLimitName, ok = input.Parsed["quotaLimitName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "quotaLimitName", input) } - return &id, nil + return nil } // ValidateQuotaLimitID checks that 'input' can be parsed as a Quota Limit ID diff --git a/resource-manager/netapp/2022-05-01/poolchange/id_volume.go b/resource-manager/netapp/2022-05-01/poolchange/id_volume.go index 1cbbb19f5d6..60065ac10ae 100644 --- a/resource-manager/netapp/2022-05-01/poolchange/id_volume.go +++ b/resource-manager/netapp/2022-05-01/poolchange/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2022-05-01/resetcifspassword/id_volume.go b/resource-manager/netapp/2022-05-01/resetcifspassword/id_volume.go index bfb8d8033c2..69421cfe5d9 100644 --- a/resource-manager/netapp/2022-05-01/resetcifspassword/id_volume.go +++ b/resource-manager/netapp/2022-05-01/resetcifspassword/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2022-05-01/restore/id_volume.go b/resource-manager/netapp/2022-05-01/restore/id_volume.go index b7036691358..46089747e17 100644 --- a/resource-manager/netapp/2022-05-01/restore/id_volume.go +++ b/resource-manager/netapp/2022-05-01/restore/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2022-05-01/snapshotpolicy/id_netappaccount.go b/resource-manager/netapp/2022-05-01/snapshotpolicy/id_netappaccount.go index 6def655e7c0..162b7094379 100644 --- a/resource-manager/netapp/2022-05-01/snapshotpolicy/id_netappaccount.go +++ b/resource-manager/netapp/2022-05-01/snapshotpolicy/id_netappaccount.go @@ -36,19 +36,9 @@ func ParseNetAppAccountID(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetAppAccountIDInsensitively(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetAppAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - return &id, nil + return nil } // ValidateNetAppAccountID checks that 'input' can be parsed as a Net App Account ID diff --git a/resource-manager/netapp/2022-05-01/snapshotpolicy/id_snapshotpolicy.go b/resource-manager/netapp/2022-05-01/snapshotpolicy/id_snapshotpolicy.go index a751a65ec3b..3daea71a654 100644 --- a/resource-manager/netapp/2022-05-01/snapshotpolicy/id_snapshotpolicy.go +++ b/resource-manager/netapp/2022-05-01/snapshotpolicy/id_snapshotpolicy.go @@ -38,23 +38,9 @@ func ParseSnapshotPolicyID(input string) (*SnapshotPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SnapshotPolicyId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.SnapshotPolicyName, ok = parsed.Parsed["snapshotPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSnapshotPolicyIDInsensitively(input string) (*SnapshotPolicyId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SnapshotPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SnapshotPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.SnapshotPolicyName, ok = parsed.Parsed["snapshotPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotPolicyName", *parsed) + if id.SnapshotPolicyName, ok = input.Parsed["snapshotPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "snapshotPolicyName", input) } - return &id, nil + return nil } // ValidateSnapshotPolicyID checks that 'input' can be parsed as a Snapshot Policy ID diff --git a/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/id_snapshotpolicy.go b/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/id_snapshotpolicy.go index 7b918942253..37d159192cf 100644 --- a/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/id_snapshotpolicy.go +++ b/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/id_snapshotpolicy.go @@ -38,23 +38,9 @@ func ParseSnapshotPolicyID(input string) (*SnapshotPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SnapshotPolicyId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.SnapshotPolicyName, ok = parsed.Parsed["snapshotPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSnapshotPolicyIDInsensitively(input string) (*SnapshotPolicyId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SnapshotPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SnapshotPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.SnapshotPolicyName, ok = parsed.Parsed["snapshotPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotPolicyName", *parsed) + if id.SnapshotPolicyName, ok = input.Parsed["snapshotPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "snapshotPolicyName", input) } - return &id, nil + return nil } // ValidateSnapshotPolicyID checks that 'input' can be parsed as a Snapshot Policy ID diff --git a/resource-manager/netapp/2022-05-01/snapshots/id_snapshot.go b/resource-manager/netapp/2022-05-01/snapshots/id_snapshot.go index d7cb729822b..8a20d21ec27 100644 --- a/resource-manager/netapp/2022-05-01/snapshots/id_snapshot.go +++ b/resource-manager/netapp/2022-05-01/snapshots/id_snapshot.go @@ -42,31 +42,9 @@ func ParseSnapshotID(input string) (*SnapshotId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SnapshotId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) - } - - if id.SnapshotName, ok = parsed.Parsed["snapshotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseSnapshotIDInsensitively(input string) (*SnapshotId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SnapshotId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SnapshotId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - if id.SnapshotName, ok = parsed.Parsed["snapshotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotName", *parsed) + if id.SnapshotName, ok = input.Parsed["snapshotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "snapshotName", input) } - return &id, nil + return nil } // ValidateSnapshotID checks that 'input' can be parsed as a Snapshot ID diff --git a/resource-manager/netapp/2022-05-01/snapshots/id_volume.go b/resource-manager/netapp/2022-05-01/snapshots/id_volume.go index b144bfb03c7..06879ea6a3a 100644 --- a/resource-manager/netapp/2022-05-01/snapshots/id_volume.go +++ b/resource-manager/netapp/2022-05-01/snapshots/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2022-05-01/subvolumes/id_subvolume.go b/resource-manager/netapp/2022-05-01/subvolumes/id_subvolume.go index 5ebb6d8054b..0649b6aeac0 100644 --- a/resource-manager/netapp/2022-05-01/subvolumes/id_subvolume.go +++ b/resource-manager/netapp/2022-05-01/subvolumes/id_subvolume.go @@ -42,31 +42,9 @@ func ParseSubVolumeID(input string) (*SubVolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SubVolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) - } - - if id.SubVolumeName, ok = parsed.Parsed["subVolumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subVolumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseSubVolumeIDInsensitively(input string) (*SubVolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SubVolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SubVolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - if id.SubVolumeName, ok = parsed.Parsed["subVolumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subVolumeName", *parsed) + if id.SubVolumeName, ok = input.Parsed["subVolumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subVolumeName", input) } - return &id, nil + return nil } // ValidateSubVolumeID checks that 'input' can be parsed as a Sub Volume ID diff --git a/resource-manager/netapp/2022-05-01/subvolumes/id_volume.go b/resource-manager/netapp/2022-05-01/subvolumes/id_volume.go index b64821a5f09..8bbeb6c9e23 100644 --- a/resource-manager/netapp/2022-05-01/subvolumes/id_volume.go +++ b/resource-manager/netapp/2022-05-01/subvolumes/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2022-05-01/vaults/id_netappaccount.go b/resource-manager/netapp/2022-05-01/vaults/id_netappaccount.go index 02e7a64c369..b71b0d0cf87 100644 --- a/resource-manager/netapp/2022-05-01/vaults/id_netappaccount.go +++ b/resource-manager/netapp/2022-05-01/vaults/id_netappaccount.go @@ -36,19 +36,9 @@ func ParseNetAppAccountID(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetAppAccountIDInsensitively(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetAppAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - return &id, nil + return nil } // ValidateNetAppAccountID checks that 'input' can be parsed as a Net App Account ID diff --git a/resource-manager/netapp/2022-05-01/volumegroups/id_netappaccount.go b/resource-manager/netapp/2022-05-01/volumegroups/id_netappaccount.go index 5cf7bb72331..180947b711b 100644 --- a/resource-manager/netapp/2022-05-01/volumegroups/id_netappaccount.go +++ b/resource-manager/netapp/2022-05-01/volumegroups/id_netappaccount.go @@ -36,19 +36,9 @@ func ParseNetAppAccountID(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetAppAccountIDInsensitively(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetAppAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - return &id, nil + return nil } // ValidateNetAppAccountID checks that 'input' can be parsed as a Net App Account ID diff --git a/resource-manager/netapp/2022-05-01/volumegroups/id_volumegroup.go b/resource-manager/netapp/2022-05-01/volumegroups/id_volumegroup.go index fbd627e4b85..f97a6bb10bd 100644 --- a/resource-manager/netapp/2022-05-01/volumegroups/id_volumegroup.go +++ b/resource-manager/netapp/2022-05-01/volumegroups/id_volumegroup.go @@ -38,23 +38,9 @@ func ParseVolumeGroupID(input string) (*VolumeGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeGroupId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.VolumeGroupName, ok = parsed.Parsed["volumeGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVolumeGroupIDInsensitively(input string) (*VolumeGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VolumeGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.VolumeGroupName, ok = parsed.Parsed["volumeGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeGroupName", *parsed) + if id.VolumeGroupName, ok = input.Parsed["volumeGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeGroupName", input) } - return &id, nil + return nil } // ValidateVolumeGroupID checks that 'input' can be parsed as a Volume Group ID diff --git a/resource-manager/netapp/2022-05-01/volumequotarules/id_volume.go b/resource-manager/netapp/2022-05-01/volumequotarules/id_volume.go index 306e2dc6219..b3d6ab761b3 100644 --- a/resource-manager/netapp/2022-05-01/volumequotarules/id_volume.go +++ b/resource-manager/netapp/2022-05-01/volumequotarules/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2022-05-01/volumequotarules/id_volumequotarule.go b/resource-manager/netapp/2022-05-01/volumequotarules/id_volumequotarule.go index f86acf65be7..711a80ae5cd 100644 --- a/resource-manager/netapp/2022-05-01/volumequotarules/id_volumequotarule.go +++ b/resource-manager/netapp/2022-05-01/volumequotarules/id_volumequotarule.go @@ -42,31 +42,9 @@ func ParseVolumeQuotaRuleID(input string) (*VolumeQuotaRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeQuotaRuleId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) - } - - if id.VolumeQuotaRuleName, ok = parsed.Parsed["volumeQuotaRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeQuotaRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseVolumeQuotaRuleIDInsensitively(input string) (*VolumeQuotaRuleId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeQuotaRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VolumeQuotaRuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - if id.VolumeQuotaRuleName, ok = parsed.Parsed["volumeQuotaRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeQuotaRuleName", *parsed) + if id.VolumeQuotaRuleName, ok = input.Parsed["volumeQuotaRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeQuotaRuleName", input) } - return &id, nil + return nil } // ValidateVolumeQuotaRuleID checks that 'input' can be parsed as a Volume Quota Rule ID diff --git a/resource-manager/netapp/2022-05-01/volumes/id_capacitypool.go b/resource-manager/netapp/2022-05-01/volumes/id_capacitypool.go index edb30a75b16..9ce092f4fe4 100644 --- a/resource-manager/netapp/2022-05-01/volumes/id_capacitypool.go +++ b/resource-manager/netapp/2022-05-01/volumes/id_capacitypool.go @@ -38,23 +38,9 @@ func ParseCapacityPoolID(input string) (*CapacityPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapacityPoolId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCapacityPoolIDInsensitively(input string) (*CapacityPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapacityPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CapacityPoolId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - return &id, nil + return nil } // ValidateCapacityPoolID checks that 'input' can be parsed as a Capacity Pool ID diff --git a/resource-manager/netapp/2022-05-01/volumes/id_volume.go b/resource-manager/netapp/2022-05-01/volumes/id_volume.go index 142e376a72c..0b27e4a330c 100644 --- a/resource-manager/netapp/2022-05-01/volumes/id_volume.go +++ b/resource-manager/netapp/2022-05-01/volumes/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2022-05-01/volumesrelocation/id_volume.go b/resource-manager/netapp/2022-05-01/volumesrelocation/id_volume.go index f5049fb2828..c10d0bf30cd 100644 --- a/resource-manager/netapp/2022-05-01/volumesrelocation/id_volume.go +++ b/resource-manager/netapp/2022-05-01/volumesrelocation/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2022-05-01/volumesreplication/id_volume.go b/resource-manager/netapp/2022-05-01/volumesreplication/id_volume.go index 1a057729587..c68d5f31c45 100644 --- a/resource-manager/netapp/2022-05-01/volumesreplication/id_volume.go +++ b/resource-manager/netapp/2022-05-01/volumesreplication/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2022-05-01/volumesrevert/id_volume.go b/resource-manager/netapp/2022-05-01/volumesrevert/id_volume.go index 1b1c739e625..576a30b9904 100644 --- a/resource-manager/netapp/2022-05-01/volumesrevert/id_volume.go +++ b/resource-manager/netapp/2022-05-01/volumesrevert/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2022-09-01/backuppolicy/id_backuppolicy.go b/resource-manager/netapp/2022-09-01/backuppolicy/id_backuppolicy.go index be7dcea83e7..f16f0b462b8 100644 --- a/resource-manager/netapp/2022-09-01/backuppolicy/id_backuppolicy.go +++ b/resource-manager/netapp/2022-09-01/backuppolicy/id_backuppolicy.go @@ -38,23 +38,9 @@ func ParseBackupPolicyID(input string) (*BackupPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupPolicyId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.BackupPolicyName, ok = parsed.Parsed["backupPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupPolicyIDInsensitively(input string) (*BackupPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.BackupPolicyName, ok = parsed.Parsed["backupPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupPolicyName", *parsed) + if id.BackupPolicyName, ok = input.Parsed["backupPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupPolicyName", input) } - return &id, nil + return nil } // ValidateBackupPolicyID checks that 'input' can be parsed as a Backup Policy ID diff --git a/resource-manager/netapp/2022-09-01/backuppolicy/id_netappaccount.go b/resource-manager/netapp/2022-09-01/backuppolicy/id_netappaccount.go index f9f08268b3e..6b11cb40365 100644 --- a/resource-manager/netapp/2022-09-01/backuppolicy/id_netappaccount.go +++ b/resource-manager/netapp/2022-09-01/backuppolicy/id_netappaccount.go @@ -36,19 +36,9 @@ func ParseNetAppAccountID(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetAppAccountIDInsensitively(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetAppAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - return &id, nil + return nil } // ValidateNetAppAccountID checks that 'input' can be parsed as a Net App Account ID diff --git a/resource-manager/netapp/2022-09-01/backups/id_accountbackup.go b/resource-manager/netapp/2022-09-01/backups/id_accountbackup.go index f2f3727d464..b4091d27265 100644 --- a/resource-manager/netapp/2022-09-01/backups/id_accountbackup.go +++ b/resource-manager/netapp/2022-09-01/backups/id_accountbackup.go @@ -38,23 +38,9 @@ func ParseAccountBackupID(input string) (*AccountBackupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountBackupId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.AccountBackupName, ok = parsed.Parsed["accountBackupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountBackupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAccountBackupIDInsensitively(input string) (*AccountBackupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountBackupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AccountBackupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.AccountBackupName, ok = parsed.Parsed["accountBackupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountBackupName", *parsed) + if id.AccountBackupName, ok = input.Parsed["accountBackupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountBackupName", input) } - return &id, nil + return nil } // ValidateAccountBackupID checks that 'input' can be parsed as a Account Backup ID diff --git a/resource-manager/netapp/2022-09-01/backups/id_backup.go b/resource-manager/netapp/2022-09-01/backups/id_backup.go index d4dfe8b796e..9c95bd9350f 100644 --- a/resource-manager/netapp/2022-09-01/backups/id_backup.go +++ b/resource-manager/netapp/2022-09-01/backups/id_backup.go @@ -42,31 +42,9 @@ func ParseBackupID(input string) (*BackupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) - } - - if id.BackupName, ok = parsed.Parsed["backupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseBackupIDInsensitively(input string) (*BackupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *BackupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - if id.BackupName, ok = parsed.Parsed["backupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupName", *parsed) + if id.BackupName, ok = input.Parsed["backupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupName", input) } - return &id, nil + return nil } // ValidateBackupID checks that 'input' can be parsed as a Backup ID diff --git a/resource-manager/netapp/2022-09-01/backups/id_netappaccount.go b/resource-manager/netapp/2022-09-01/backups/id_netappaccount.go index 304edc5df29..ced6c2088e0 100644 --- a/resource-manager/netapp/2022-09-01/backups/id_netappaccount.go +++ b/resource-manager/netapp/2022-09-01/backups/id_netappaccount.go @@ -36,19 +36,9 @@ func ParseNetAppAccountID(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetAppAccountIDInsensitively(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetAppAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - return &id, nil + return nil } // ValidateNetAppAccountID checks that 'input' can be parsed as a Net App Account ID diff --git a/resource-manager/netapp/2022-09-01/backups/id_volume.go b/resource-manager/netapp/2022-09-01/backups/id_volume.go index 69bcd9c2450..247b20b073e 100644 --- a/resource-manager/netapp/2022-09-01/backups/id_volume.go +++ b/resource-manager/netapp/2022-09-01/backups/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2022-09-01/capacitypools/id_capacitypool.go b/resource-manager/netapp/2022-09-01/capacitypools/id_capacitypool.go index c2e4d58474e..69954702fd9 100644 --- a/resource-manager/netapp/2022-09-01/capacitypools/id_capacitypool.go +++ b/resource-manager/netapp/2022-09-01/capacitypools/id_capacitypool.go @@ -38,23 +38,9 @@ func ParseCapacityPoolID(input string) (*CapacityPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapacityPoolId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCapacityPoolIDInsensitively(input string) (*CapacityPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapacityPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CapacityPoolId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - return &id, nil + return nil } // ValidateCapacityPoolID checks that 'input' can be parsed as a Capacity Pool ID diff --git a/resource-manager/netapp/2022-09-01/capacitypools/id_netappaccount.go b/resource-manager/netapp/2022-09-01/capacitypools/id_netappaccount.go index 43537ad3c8a..f424e58a9e8 100644 --- a/resource-manager/netapp/2022-09-01/capacitypools/id_netappaccount.go +++ b/resource-manager/netapp/2022-09-01/capacitypools/id_netappaccount.go @@ -36,19 +36,9 @@ func ParseNetAppAccountID(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetAppAccountIDInsensitively(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetAppAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - return &id, nil + return nil } // ValidateNetAppAccountID checks that 'input' can be parsed as a Net App Account ID diff --git a/resource-manager/netapp/2022-09-01/filelocks/id_volume.go b/resource-manager/netapp/2022-09-01/filelocks/id_volume.go index 97947a0c338..446434f9140 100644 --- a/resource-manager/netapp/2022-09-01/filelocks/id_volume.go +++ b/resource-manager/netapp/2022-09-01/filelocks/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2022-09-01/netappaccounts/id_netappaccount.go b/resource-manager/netapp/2022-09-01/netappaccounts/id_netappaccount.go index 65af9c406fe..07a8ef7a579 100644 --- a/resource-manager/netapp/2022-09-01/netappaccounts/id_netappaccount.go +++ b/resource-manager/netapp/2022-09-01/netappaccounts/id_netappaccount.go @@ -36,19 +36,9 @@ func ParseNetAppAccountID(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetAppAccountIDInsensitively(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetAppAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - return &id, nil + return nil } // ValidateNetAppAccountID checks that 'input' can be parsed as a Net App Account ID diff --git a/resource-manager/netapp/2022-09-01/netappresource/id_location.go b/resource-manager/netapp/2022-09-01/netappresource/id_location.go index 8c8f5f240ba..7c120e2a191 100644 --- a/resource-manager/netapp/2022-09-01/netappresource/id_location.go +++ b/resource-manager/netapp/2022-09-01/netappresource/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/netapp/2022-09-01/netappresource/id_quotalimit.go b/resource-manager/netapp/2022-09-01/netappresource/id_quotalimit.go index e203fa4b75f..aa29f073d5d 100644 --- a/resource-manager/netapp/2022-09-01/netappresource/id_quotalimit.go +++ b/resource-manager/netapp/2022-09-01/netappresource/id_quotalimit.go @@ -36,19 +36,9 @@ func ParseQuotaLimitID(input string) (*QuotaLimitId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QuotaLimitId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.QuotaLimitName, ok = parsed.Parsed["quotaLimitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "quotaLimitName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseQuotaLimitIDInsensitively(input string) (*QuotaLimitId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QuotaLimitId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *QuotaLimitId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.QuotaLimitName, ok = parsed.Parsed["quotaLimitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "quotaLimitName", *parsed) + if id.QuotaLimitName, ok = input.Parsed["quotaLimitName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "quotaLimitName", input) } - return &id, nil + return nil } // ValidateQuotaLimitID checks that 'input' can be parsed as a Quota Limit ID diff --git a/resource-manager/netapp/2022-09-01/poolchange/id_volume.go b/resource-manager/netapp/2022-09-01/poolchange/id_volume.go index 1cbbb19f5d6..60065ac10ae 100644 --- a/resource-manager/netapp/2022-09-01/poolchange/id_volume.go +++ b/resource-manager/netapp/2022-09-01/poolchange/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2022-09-01/resetcifspassword/id_volume.go b/resource-manager/netapp/2022-09-01/resetcifspassword/id_volume.go index bfb8d8033c2..69421cfe5d9 100644 --- a/resource-manager/netapp/2022-09-01/resetcifspassword/id_volume.go +++ b/resource-manager/netapp/2022-09-01/resetcifspassword/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2022-09-01/restore/id_volume.go b/resource-manager/netapp/2022-09-01/restore/id_volume.go index b7036691358..46089747e17 100644 --- a/resource-manager/netapp/2022-09-01/restore/id_volume.go +++ b/resource-manager/netapp/2022-09-01/restore/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2022-09-01/snapshotpolicy/id_netappaccount.go b/resource-manager/netapp/2022-09-01/snapshotpolicy/id_netappaccount.go index 6def655e7c0..162b7094379 100644 --- a/resource-manager/netapp/2022-09-01/snapshotpolicy/id_netappaccount.go +++ b/resource-manager/netapp/2022-09-01/snapshotpolicy/id_netappaccount.go @@ -36,19 +36,9 @@ func ParseNetAppAccountID(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetAppAccountIDInsensitively(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetAppAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - return &id, nil + return nil } // ValidateNetAppAccountID checks that 'input' can be parsed as a Net App Account ID diff --git a/resource-manager/netapp/2022-09-01/snapshotpolicy/id_snapshotpolicy.go b/resource-manager/netapp/2022-09-01/snapshotpolicy/id_snapshotpolicy.go index a751a65ec3b..3daea71a654 100644 --- a/resource-manager/netapp/2022-09-01/snapshotpolicy/id_snapshotpolicy.go +++ b/resource-manager/netapp/2022-09-01/snapshotpolicy/id_snapshotpolicy.go @@ -38,23 +38,9 @@ func ParseSnapshotPolicyID(input string) (*SnapshotPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SnapshotPolicyId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.SnapshotPolicyName, ok = parsed.Parsed["snapshotPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSnapshotPolicyIDInsensitively(input string) (*SnapshotPolicyId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SnapshotPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SnapshotPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.SnapshotPolicyName, ok = parsed.Parsed["snapshotPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotPolicyName", *parsed) + if id.SnapshotPolicyName, ok = input.Parsed["snapshotPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "snapshotPolicyName", input) } - return &id, nil + return nil } // ValidateSnapshotPolicyID checks that 'input' can be parsed as a Snapshot Policy ID diff --git a/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/id_snapshotpolicy.go b/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/id_snapshotpolicy.go index 7b918942253..37d159192cf 100644 --- a/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/id_snapshotpolicy.go +++ b/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/id_snapshotpolicy.go @@ -38,23 +38,9 @@ func ParseSnapshotPolicyID(input string) (*SnapshotPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SnapshotPolicyId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.SnapshotPolicyName, ok = parsed.Parsed["snapshotPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSnapshotPolicyIDInsensitively(input string) (*SnapshotPolicyId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SnapshotPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SnapshotPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.SnapshotPolicyName, ok = parsed.Parsed["snapshotPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotPolicyName", *parsed) + if id.SnapshotPolicyName, ok = input.Parsed["snapshotPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "snapshotPolicyName", input) } - return &id, nil + return nil } // ValidateSnapshotPolicyID checks that 'input' can be parsed as a Snapshot Policy ID diff --git a/resource-manager/netapp/2022-09-01/snapshots/id_snapshot.go b/resource-manager/netapp/2022-09-01/snapshots/id_snapshot.go index d7cb729822b..8a20d21ec27 100644 --- a/resource-manager/netapp/2022-09-01/snapshots/id_snapshot.go +++ b/resource-manager/netapp/2022-09-01/snapshots/id_snapshot.go @@ -42,31 +42,9 @@ func ParseSnapshotID(input string) (*SnapshotId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SnapshotId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) - } - - if id.SnapshotName, ok = parsed.Parsed["snapshotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseSnapshotIDInsensitively(input string) (*SnapshotId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SnapshotId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SnapshotId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - if id.SnapshotName, ok = parsed.Parsed["snapshotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotName", *parsed) + if id.SnapshotName, ok = input.Parsed["snapshotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "snapshotName", input) } - return &id, nil + return nil } // ValidateSnapshotID checks that 'input' can be parsed as a Snapshot ID diff --git a/resource-manager/netapp/2022-09-01/snapshots/id_volume.go b/resource-manager/netapp/2022-09-01/snapshots/id_volume.go index b144bfb03c7..06879ea6a3a 100644 --- a/resource-manager/netapp/2022-09-01/snapshots/id_volume.go +++ b/resource-manager/netapp/2022-09-01/snapshots/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2022-09-01/subvolumes/id_subvolume.go b/resource-manager/netapp/2022-09-01/subvolumes/id_subvolume.go index 5ebb6d8054b..0649b6aeac0 100644 --- a/resource-manager/netapp/2022-09-01/subvolumes/id_subvolume.go +++ b/resource-manager/netapp/2022-09-01/subvolumes/id_subvolume.go @@ -42,31 +42,9 @@ func ParseSubVolumeID(input string) (*SubVolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SubVolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) - } - - if id.SubVolumeName, ok = parsed.Parsed["subVolumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subVolumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseSubVolumeIDInsensitively(input string) (*SubVolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SubVolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SubVolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - if id.SubVolumeName, ok = parsed.Parsed["subVolumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subVolumeName", *parsed) + if id.SubVolumeName, ok = input.Parsed["subVolumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subVolumeName", input) } - return &id, nil + return nil } // ValidateSubVolumeID checks that 'input' can be parsed as a Sub Volume ID diff --git a/resource-manager/netapp/2022-09-01/subvolumes/id_volume.go b/resource-manager/netapp/2022-09-01/subvolumes/id_volume.go index b64821a5f09..8bbeb6c9e23 100644 --- a/resource-manager/netapp/2022-09-01/subvolumes/id_volume.go +++ b/resource-manager/netapp/2022-09-01/subvolumes/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2022-09-01/volumegroups/id_netappaccount.go b/resource-manager/netapp/2022-09-01/volumegroups/id_netappaccount.go index 5cf7bb72331..180947b711b 100644 --- a/resource-manager/netapp/2022-09-01/volumegroups/id_netappaccount.go +++ b/resource-manager/netapp/2022-09-01/volumegroups/id_netappaccount.go @@ -36,19 +36,9 @@ func ParseNetAppAccountID(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetAppAccountIDInsensitively(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetAppAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - return &id, nil + return nil } // ValidateNetAppAccountID checks that 'input' can be parsed as a Net App Account ID diff --git a/resource-manager/netapp/2022-09-01/volumegroups/id_volumegroup.go b/resource-manager/netapp/2022-09-01/volumegroups/id_volumegroup.go index fbd627e4b85..f97a6bb10bd 100644 --- a/resource-manager/netapp/2022-09-01/volumegroups/id_volumegroup.go +++ b/resource-manager/netapp/2022-09-01/volumegroups/id_volumegroup.go @@ -38,23 +38,9 @@ func ParseVolumeGroupID(input string) (*VolumeGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeGroupId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.VolumeGroupName, ok = parsed.Parsed["volumeGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVolumeGroupIDInsensitively(input string) (*VolumeGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VolumeGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.VolumeGroupName, ok = parsed.Parsed["volumeGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeGroupName", *parsed) + if id.VolumeGroupName, ok = input.Parsed["volumeGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeGroupName", input) } - return &id, nil + return nil } // ValidateVolumeGroupID checks that 'input' can be parsed as a Volume Group ID diff --git a/resource-manager/netapp/2022-09-01/volumequotarules/id_volume.go b/resource-manager/netapp/2022-09-01/volumequotarules/id_volume.go index 306e2dc6219..b3d6ab761b3 100644 --- a/resource-manager/netapp/2022-09-01/volumequotarules/id_volume.go +++ b/resource-manager/netapp/2022-09-01/volumequotarules/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2022-09-01/volumequotarules/id_volumequotarule.go b/resource-manager/netapp/2022-09-01/volumequotarules/id_volumequotarule.go index f86acf65be7..711a80ae5cd 100644 --- a/resource-manager/netapp/2022-09-01/volumequotarules/id_volumequotarule.go +++ b/resource-manager/netapp/2022-09-01/volumequotarules/id_volumequotarule.go @@ -42,31 +42,9 @@ func ParseVolumeQuotaRuleID(input string) (*VolumeQuotaRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeQuotaRuleId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) - } - - if id.VolumeQuotaRuleName, ok = parsed.Parsed["volumeQuotaRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeQuotaRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseVolumeQuotaRuleIDInsensitively(input string) (*VolumeQuotaRuleId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeQuotaRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VolumeQuotaRuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - if id.VolumeQuotaRuleName, ok = parsed.Parsed["volumeQuotaRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeQuotaRuleName", *parsed) + if id.VolumeQuotaRuleName, ok = input.Parsed["volumeQuotaRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeQuotaRuleName", input) } - return &id, nil + return nil } // ValidateVolumeQuotaRuleID checks that 'input' can be parsed as a Volume Quota Rule ID diff --git a/resource-manager/netapp/2022-09-01/volumes/id_capacitypool.go b/resource-manager/netapp/2022-09-01/volumes/id_capacitypool.go index edb30a75b16..9ce092f4fe4 100644 --- a/resource-manager/netapp/2022-09-01/volumes/id_capacitypool.go +++ b/resource-manager/netapp/2022-09-01/volumes/id_capacitypool.go @@ -38,23 +38,9 @@ func ParseCapacityPoolID(input string) (*CapacityPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapacityPoolId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCapacityPoolIDInsensitively(input string) (*CapacityPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapacityPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CapacityPoolId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - return &id, nil + return nil } // ValidateCapacityPoolID checks that 'input' can be parsed as a Capacity Pool ID diff --git a/resource-manager/netapp/2022-09-01/volumes/id_volume.go b/resource-manager/netapp/2022-09-01/volumes/id_volume.go index 142e376a72c..0b27e4a330c 100644 --- a/resource-manager/netapp/2022-09-01/volumes/id_volume.go +++ b/resource-manager/netapp/2022-09-01/volumes/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2022-09-01/volumesrelocation/id_volume.go b/resource-manager/netapp/2022-09-01/volumesrelocation/id_volume.go index f5049fb2828..c10d0bf30cd 100644 --- a/resource-manager/netapp/2022-09-01/volumesrelocation/id_volume.go +++ b/resource-manager/netapp/2022-09-01/volumesrelocation/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2022-09-01/volumesreplication/id_volume.go b/resource-manager/netapp/2022-09-01/volumesreplication/id_volume.go index 1a057729587..c68d5f31c45 100644 --- a/resource-manager/netapp/2022-09-01/volumesreplication/id_volume.go +++ b/resource-manager/netapp/2022-09-01/volumesreplication/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2022-09-01/volumesrevert/id_volume.go b/resource-manager/netapp/2022-09-01/volumesrevert/id_volume.go index 1b1c739e625..576a30b9904 100644 --- a/resource-manager/netapp/2022-09-01/volumesrevert/id_volume.go +++ b/resource-manager/netapp/2022-09-01/volumesrevert/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2022-11-01-preview/backuppolicy/id_backuppolicy.go b/resource-manager/netapp/2022-11-01-preview/backuppolicy/id_backuppolicy.go index be7dcea83e7..f16f0b462b8 100644 --- a/resource-manager/netapp/2022-11-01-preview/backuppolicy/id_backuppolicy.go +++ b/resource-manager/netapp/2022-11-01-preview/backuppolicy/id_backuppolicy.go @@ -38,23 +38,9 @@ func ParseBackupPolicyID(input string) (*BackupPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupPolicyId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.BackupPolicyName, ok = parsed.Parsed["backupPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupPolicyIDInsensitively(input string) (*BackupPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.BackupPolicyName, ok = parsed.Parsed["backupPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupPolicyName", *parsed) + if id.BackupPolicyName, ok = input.Parsed["backupPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupPolicyName", input) } - return &id, nil + return nil } // ValidateBackupPolicyID checks that 'input' can be parsed as a Backup Policy ID diff --git a/resource-manager/netapp/2022-11-01-preview/backuppolicy/id_netappaccount.go b/resource-manager/netapp/2022-11-01-preview/backuppolicy/id_netappaccount.go index f9f08268b3e..6b11cb40365 100644 --- a/resource-manager/netapp/2022-11-01-preview/backuppolicy/id_netappaccount.go +++ b/resource-manager/netapp/2022-11-01-preview/backuppolicy/id_netappaccount.go @@ -36,19 +36,9 @@ func ParseNetAppAccountID(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetAppAccountIDInsensitively(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetAppAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - return &id, nil + return nil } // ValidateNetAppAccountID checks that 'input' can be parsed as a Net App Account ID diff --git a/resource-manager/netapp/2022-11-01-preview/backups/id_accountbackup.go b/resource-manager/netapp/2022-11-01-preview/backups/id_accountbackup.go index f2f3727d464..b4091d27265 100644 --- a/resource-manager/netapp/2022-11-01-preview/backups/id_accountbackup.go +++ b/resource-manager/netapp/2022-11-01-preview/backups/id_accountbackup.go @@ -38,23 +38,9 @@ func ParseAccountBackupID(input string) (*AccountBackupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountBackupId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.AccountBackupName, ok = parsed.Parsed["accountBackupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountBackupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAccountBackupIDInsensitively(input string) (*AccountBackupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountBackupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AccountBackupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.AccountBackupName, ok = parsed.Parsed["accountBackupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountBackupName", *parsed) + if id.AccountBackupName, ok = input.Parsed["accountBackupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountBackupName", input) } - return &id, nil + return nil } // ValidateAccountBackupID checks that 'input' can be parsed as a Account Backup ID diff --git a/resource-manager/netapp/2022-11-01-preview/backups/id_backup.go b/resource-manager/netapp/2022-11-01-preview/backups/id_backup.go index 8ed5ce54640..ec7b08aa37f 100644 --- a/resource-manager/netapp/2022-11-01-preview/backups/id_backup.go +++ b/resource-manager/netapp/2022-11-01-preview/backups/id_backup.go @@ -40,27 +40,9 @@ func ParseBackupID(input string) (*BackupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) - } - - if id.BackupName, ok = parsed.Parsed["backupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseBackupIDInsensitively(input string) (*BackupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *BackupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) } - if id.BackupName, ok = parsed.Parsed["backupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupName", *parsed) + if id.BackupName, ok = input.Parsed["backupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupName", input) } - return &id, nil + return nil } // ValidateBackupID checks that 'input' can be parsed as a Backup ID diff --git a/resource-manager/netapp/2022-11-01-preview/backups/id_backupvault.go b/resource-manager/netapp/2022-11-01-preview/backups/id_backupvault.go index bf22b11fb09..5f9227f4c54 100644 --- a/resource-manager/netapp/2022-11-01-preview/backups/id_backupvault.go +++ b/resource-manager/netapp/2022-11-01-preview/backups/id_backupvault.go @@ -38,23 +38,9 @@ func ParseBackupVaultID(input string) (*BackupVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupVaultId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupVaultIDInsensitively(input string) (*BackupVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupVaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupVaultId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) } - return &id, nil + return nil } // ValidateBackupVaultID checks that 'input' can be parsed as a Backup Vault ID diff --git a/resource-manager/netapp/2022-11-01-preview/backups/id_netappaccount.go b/resource-manager/netapp/2022-11-01-preview/backups/id_netappaccount.go index 304edc5df29..ced6c2088e0 100644 --- a/resource-manager/netapp/2022-11-01-preview/backups/id_netappaccount.go +++ b/resource-manager/netapp/2022-11-01-preview/backups/id_netappaccount.go @@ -36,19 +36,9 @@ func ParseNetAppAccountID(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetAppAccountIDInsensitively(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetAppAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - return &id, nil + return nil } // ValidateNetAppAccountID checks that 'input' can be parsed as a Net App Account ID diff --git a/resource-manager/netapp/2022-11-01-preview/backups/id_volume.go b/resource-manager/netapp/2022-11-01-preview/backups/id_volume.go index 69bcd9c2450..247b20b073e 100644 --- a/resource-manager/netapp/2022-11-01-preview/backups/id_volume.go +++ b/resource-manager/netapp/2022-11-01-preview/backups/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2022-11-01-preview/backupvaults/id_backupvault.go b/resource-manager/netapp/2022-11-01-preview/backupvaults/id_backupvault.go index d6cc9008f93..740bed9355f 100644 --- a/resource-manager/netapp/2022-11-01-preview/backupvaults/id_backupvault.go +++ b/resource-manager/netapp/2022-11-01-preview/backupvaults/id_backupvault.go @@ -38,23 +38,9 @@ func ParseBackupVaultID(input string) (*BackupVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupVaultId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupVaultIDInsensitively(input string) (*BackupVaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupVaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupVaultId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.BackupVaultName, ok = parsed.Parsed["backupVaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", *parsed) + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) } - return &id, nil + return nil } // ValidateBackupVaultID checks that 'input' can be parsed as a Backup Vault ID diff --git a/resource-manager/netapp/2022-11-01-preview/backupvaults/id_netappaccount.go b/resource-manager/netapp/2022-11-01-preview/backupvaults/id_netappaccount.go index 5b5814b9e04..9be4411d949 100644 --- a/resource-manager/netapp/2022-11-01-preview/backupvaults/id_netappaccount.go +++ b/resource-manager/netapp/2022-11-01-preview/backupvaults/id_netappaccount.go @@ -36,19 +36,9 @@ func ParseNetAppAccountID(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetAppAccountIDInsensitively(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetAppAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - return &id, nil + return nil } // ValidateNetAppAccountID checks that 'input' can be parsed as a Net App Account ID diff --git a/resource-manager/netapp/2022-11-01-preview/capacitypools/id_capacitypool.go b/resource-manager/netapp/2022-11-01-preview/capacitypools/id_capacitypool.go index c2e4d58474e..69954702fd9 100644 --- a/resource-manager/netapp/2022-11-01-preview/capacitypools/id_capacitypool.go +++ b/resource-manager/netapp/2022-11-01-preview/capacitypools/id_capacitypool.go @@ -38,23 +38,9 @@ func ParseCapacityPoolID(input string) (*CapacityPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapacityPoolId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCapacityPoolIDInsensitively(input string) (*CapacityPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapacityPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CapacityPoolId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - return &id, nil + return nil } // ValidateCapacityPoolID checks that 'input' can be parsed as a Capacity Pool ID diff --git a/resource-manager/netapp/2022-11-01-preview/capacitypools/id_netappaccount.go b/resource-manager/netapp/2022-11-01-preview/capacitypools/id_netappaccount.go index 43537ad3c8a..f424e58a9e8 100644 --- a/resource-manager/netapp/2022-11-01-preview/capacitypools/id_netappaccount.go +++ b/resource-manager/netapp/2022-11-01-preview/capacitypools/id_netappaccount.go @@ -36,19 +36,9 @@ func ParseNetAppAccountID(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetAppAccountIDInsensitively(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetAppAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - return &id, nil + return nil } // ValidateNetAppAccountID checks that 'input' can be parsed as a Net App Account ID diff --git a/resource-manager/netapp/2022-11-01-preview/filelocks/id_volume.go b/resource-manager/netapp/2022-11-01-preview/filelocks/id_volume.go index 97947a0c338..446434f9140 100644 --- a/resource-manager/netapp/2022-11-01-preview/filelocks/id_volume.go +++ b/resource-manager/netapp/2022-11-01-preview/filelocks/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2022-11-01-preview/groupidlistforldapuser/id_volume.go b/resource-manager/netapp/2022-11-01-preview/groupidlistforldapuser/id_volume.go index 5952f1bf01e..af00678327a 100644 --- a/resource-manager/netapp/2022-11-01-preview/groupidlistforldapuser/id_volume.go +++ b/resource-manager/netapp/2022-11-01-preview/groupidlistforldapuser/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2022-11-01-preview/netappaccounts/id_netappaccount.go b/resource-manager/netapp/2022-11-01-preview/netappaccounts/id_netappaccount.go index 65af9c406fe..07a8ef7a579 100644 --- a/resource-manager/netapp/2022-11-01-preview/netappaccounts/id_netappaccount.go +++ b/resource-manager/netapp/2022-11-01-preview/netappaccounts/id_netappaccount.go @@ -36,19 +36,9 @@ func ParseNetAppAccountID(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetAppAccountIDInsensitively(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetAppAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - return &id, nil + return nil } // ValidateNetAppAccountID checks that 'input' can be parsed as a Net App Account ID diff --git a/resource-manager/netapp/2022-11-01-preview/netappresource/id_location.go b/resource-manager/netapp/2022-11-01-preview/netappresource/id_location.go index 8c8f5f240ba..7c120e2a191 100644 --- a/resource-manager/netapp/2022-11-01-preview/netappresource/id_location.go +++ b/resource-manager/netapp/2022-11-01-preview/netappresource/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/netapp/2022-11-01-preview/netappresource/id_quotalimit.go b/resource-manager/netapp/2022-11-01-preview/netappresource/id_quotalimit.go index e203fa4b75f..aa29f073d5d 100644 --- a/resource-manager/netapp/2022-11-01-preview/netappresource/id_quotalimit.go +++ b/resource-manager/netapp/2022-11-01-preview/netappresource/id_quotalimit.go @@ -36,19 +36,9 @@ func ParseQuotaLimitID(input string) (*QuotaLimitId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QuotaLimitId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.QuotaLimitName, ok = parsed.Parsed["quotaLimitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "quotaLimitName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseQuotaLimitIDInsensitively(input string) (*QuotaLimitId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QuotaLimitId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *QuotaLimitId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.QuotaLimitName, ok = parsed.Parsed["quotaLimitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "quotaLimitName", *parsed) + if id.QuotaLimitName, ok = input.Parsed["quotaLimitName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "quotaLimitName", input) } - return &id, nil + return nil } // ValidateQuotaLimitID checks that 'input' can be parsed as a Quota Limit ID diff --git a/resource-manager/netapp/2022-11-01-preview/poolchange/id_volume.go b/resource-manager/netapp/2022-11-01-preview/poolchange/id_volume.go index 1cbbb19f5d6..60065ac10ae 100644 --- a/resource-manager/netapp/2022-11-01-preview/poolchange/id_volume.go +++ b/resource-manager/netapp/2022-11-01-preview/poolchange/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2022-11-01-preview/resetcifspassword/id_volume.go b/resource-manager/netapp/2022-11-01-preview/resetcifspassword/id_volume.go index bfb8d8033c2..69421cfe5d9 100644 --- a/resource-manager/netapp/2022-11-01-preview/resetcifspassword/id_volume.go +++ b/resource-manager/netapp/2022-11-01-preview/resetcifspassword/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2022-11-01-preview/restore/id_volume.go b/resource-manager/netapp/2022-11-01-preview/restore/id_volume.go index b7036691358..46089747e17 100644 --- a/resource-manager/netapp/2022-11-01-preview/restore/id_volume.go +++ b/resource-manager/netapp/2022-11-01-preview/restore/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/id_netappaccount.go b/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/id_netappaccount.go index 6def655e7c0..162b7094379 100644 --- a/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/id_netappaccount.go +++ b/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/id_netappaccount.go @@ -36,19 +36,9 @@ func ParseNetAppAccountID(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetAppAccountIDInsensitively(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetAppAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - return &id, nil + return nil } // ValidateNetAppAccountID checks that 'input' can be parsed as a Net App Account ID diff --git a/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/id_snapshotpolicy.go b/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/id_snapshotpolicy.go index a751a65ec3b..3daea71a654 100644 --- a/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/id_snapshotpolicy.go +++ b/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/id_snapshotpolicy.go @@ -38,23 +38,9 @@ func ParseSnapshotPolicyID(input string) (*SnapshotPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SnapshotPolicyId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.SnapshotPolicyName, ok = parsed.Parsed["snapshotPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSnapshotPolicyIDInsensitively(input string) (*SnapshotPolicyId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SnapshotPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SnapshotPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.SnapshotPolicyName, ok = parsed.Parsed["snapshotPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotPolicyName", *parsed) + if id.SnapshotPolicyName, ok = input.Parsed["snapshotPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "snapshotPolicyName", input) } - return &id, nil + return nil } // ValidateSnapshotPolicyID checks that 'input' can be parsed as a Snapshot Policy ID diff --git a/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/id_snapshotpolicy.go b/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/id_snapshotpolicy.go index 7b918942253..37d159192cf 100644 --- a/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/id_snapshotpolicy.go +++ b/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/id_snapshotpolicy.go @@ -38,23 +38,9 @@ func ParseSnapshotPolicyID(input string) (*SnapshotPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SnapshotPolicyId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.SnapshotPolicyName, ok = parsed.Parsed["snapshotPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSnapshotPolicyIDInsensitively(input string) (*SnapshotPolicyId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SnapshotPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SnapshotPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.SnapshotPolicyName, ok = parsed.Parsed["snapshotPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotPolicyName", *parsed) + if id.SnapshotPolicyName, ok = input.Parsed["snapshotPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "snapshotPolicyName", input) } - return &id, nil + return nil } // ValidateSnapshotPolicyID checks that 'input' can be parsed as a Snapshot Policy ID diff --git a/resource-manager/netapp/2022-11-01-preview/snapshots/id_snapshot.go b/resource-manager/netapp/2022-11-01-preview/snapshots/id_snapshot.go index d7cb729822b..8a20d21ec27 100644 --- a/resource-manager/netapp/2022-11-01-preview/snapshots/id_snapshot.go +++ b/resource-manager/netapp/2022-11-01-preview/snapshots/id_snapshot.go @@ -42,31 +42,9 @@ func ParseSnapshotID(input string) (*SnapshotId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SnapshotId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) - } - - if id.SnapshotName, ok = parsed.Parsed["snapshotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseSnapshotIDInsensitively(input string) (*SnapshotId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SnapshotId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SnapshotId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - if id.SnapshotName, ok = parsed.Parsed["snapshotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotName", *parsed) + if id.SnapshotName, ok = input.Parsed["snapshotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "snapshotName", input) } - return &id, nil + return nil } // ValidateSnapshotID checks that 'input' can be parsed as a Snapshot ID diff --git a/resource-manager/netapp/2022-11-01-preview/snapshots/id_volume.go b/resource-manager/netapp/2022-11-01-preview/snapshots/id_volume.go index b144bfb03c7..06879ea6a3a 100644 --- a/resource-manager/netapp/2022-11-01-preview/snapshots/id_volume.go +++ b/resource-manager/netapp/2022-11-01-preview/snapshots/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2022-11-01-preview/subvolumes/id_subvolume.go b/resource-manager/netapp/2022-11-01-preview/subvolumes/id_subvolume.go index 5ebb6d8054b..0649b6aeac0 100644 --- a/resource-manager/netapp/2022-11-01-preview/subvolumes/id_subvolume.go +++ b/resource-manager/netapp/2022-11-01-preview/subvolumes/id_subvolume.go @@ -42,31 +42,9 @@ func ParseSubVolumeID(input string) (*SubVolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SubVolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) - } - - if id.SubVolumeName, ok = parsed.Parsed["subVolumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subVolumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseSubVolumeIDInsensitively(input string) (*SubVolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SubVolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SubVolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - if id.SubVolumeName, ok = parsed.Parsed["subVolumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subVolumeName", *parsed) + if id.SubVolumeName, ok = input.Parsed["subVolumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subVolumeName", input) } - return &id, nil + return nil } // ValidateSubVolumeID checks that 'input' can be parsed as a Sub Volume ID diff --git a/resource-manager/netapp/2022-11-01-preview/subvolumes/id_volume.go b/resource-manager/netapp/2022-11-01-preview/subvolumes/id_volume.go index b64821a5f09..8bbeb6c9e23 100644 --- a/resource-manager/netapp/2022-11-01-preview/subvolumes/id_volume.go +++ b/resource-manager/netapp/2022-11-01-preview/subvolumes/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2022-11-01-preview/volumegroups/id_netappaccount.go b/resource-manager/netapp/2022-11-01-preview/volumegroups/id_netappaccount.go index 5cf7bb72331..180947b711b 100644 --- a/resource-manager/netapp/2022-11-01-preview/volumegroups/id_netappaccount.go +++ b/resource-manager/netapp/2022-11-01-preview/volumegroups/id_netappaccount.go @@ -36,19 +36,9 @@ func ParseNetAppAccountID(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetAppAccountIDInsensitively(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetAppAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - return &id, nil + return nil } // ValidateNetAppAccountID checks that 'input' can be parsed as a Net App Account ID diff --git a/resource-manager/netapp/2022-11-01-preview/volumegroups/id_volumegroup.go b/resource-manager/netapp/2022-11-01-preview/volumegroups/id_volumegroup.go index fbd627e4b85..f97a6bb10bd 100644 --- a/resource-manager/netapp/2022-11-01-preview/volumegroups/id_volumegroup.go +++ b/resource-manager/netapp/2022-11-01-preview/volumegroups/id_volumegroup.go @@ -38,23 +38,9 @@ func ParseVolumeGroupID(input string) (*VolumeGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeGroupId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.VolumeGroupName, ok = parsed.Parsed["volumeGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVolumeGroupIDInsensitively(input string) (*VolumeGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VolumeGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.VolumeGroupName, ok = parsed.Parsed["volumeGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeGroupName", *parsed) + if id.VolumeGroupName, ok = input.Parsed["volumeGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeGroupName", input) } - return &id, nil + return nil } // ValidateVolumeGroupID checks that 'input' can be parsed as a Volume Group ID diff --git a/resource-manager/netapp/2022-11-01-preview/volumequotarules/id_volume.go b/resource-manager/netapp/2022-11-01-preview/volumequotarules/id_volume.go index 306e2dc6219..b3d6ab761b3 100644 --- a/resource-manager/netapp/2022-11-01-preview/volumequotarules/id_volume.go +++ b/resource-manager/netapp/2022-11-01-preview/volumequotarules/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2022-11-01-preview/volumequotarules/id_volumequotarule.go b/resource-manager/netapp/2022-11-01-preview/volumequotarules/id_volumequotarule.go index f86acf65be7..711a80ae5cd 100644 --- a/resource-manager/netapp/2022-11-01-preview/volumequotarules/id_volumequotarule.go +++ b/resource-manager/netapp/2022-11-01-preview/volumequotarules/id_volumequotarule.go @@ -42,31 +42,9 @@ func ParseVolumeQuotaRuleID(input string) (*VolumeQuotaRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeQuotaRuleId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) - } - - if id.VolumeQuotaRuleName, ok = parsed.Parsed["volumeQuotaRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeQuotaRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseVolumeQuotaRuleIDInsensitively(input string) (*VolumeQuotaRuleId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeQuotaRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VolumeQuotaRuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - if id.VolumeQuotaRuleName, ok = parsed.Parsed["volumeQuotaRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeQuotaRuleName", *parsed) + if id.VolumeQuotaRuleName, ok = input.Parsed["volumeQuotaRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeQuotaRuleName", input) } - return &id, nil + return nil } // ValidateVolumeQuotaRuleID checks that 'input' can be parsed as a Volume Quota Rule ID diff --git a/resource-manager/netapp/2022-11-01-preview/volumes/id_capacitypool.go b/resource-manager/netapp/2022-11-01-preview/volumes/id_capacitypool.go index edb30a75b16..9ce092f4fe4 100644 --- a/resource-manager/netapp/2022-11-01-preview/volumes/id_capacitypool.go +++ b/resource-manager/netapp/2022-11-01-preview/volumes/id_capacitypool.go @@ -38,23 +38,9 @@ func ParseCapacityPoolID(input string) (*CapacityPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapacityPoolId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCapacityPoolIDInsensitively(input string) (*CapacityPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapacityPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CapacityPoolId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - return &id, nil + return nil } // ValidateCapacityPoolID checks that 'input' can be parsed as a Capacity Pool ID diff --git a/resource-manager/netapp/2022-11-01-preview/volumes/id_volume.go b/resource-manager/netapp/2022-11-01-preview/volumes/id_volume.go index 142e376a72c..0b27e4a330c 100644 --- a/resource-manager/netapp/2022-11-01-preview/volumes/id_volume.go +++ b/resource-manager/netapp/2022-11-01-preview/volumes/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2022-11-01-preview/volumesrelocation/id_volume.go b/resource-manager/netapp/2022-11-01-preview/volumesrelocation/id_volume.go index f5049fb2828..c10d0bf30cd 100644 --- a/resource-manager/netapp/2022-11-01-preview/volumesrelocation/id_volume.go +++ b/resource-manager/netapp/2022-11-01-preview/volumesrelocation/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2022-11-01-preview/volumesreplication/id_volume.go b/resource-manager/netapp/2022-11-01-preview/volumesreplication/id_volume.go index 1a057729587..c68d5f31c45 100644 --- a/resource-manager/netapp/2022-11-01-preview/volumesreplication/id_volume.go +++ b/resource-manager/netapp/2022-11-01-preview/volumesreplication/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2022-11-01-preview/volumesrevert/id_volume.go b/resource-manager/netapp/2022-11-01-preview/volumesrevert/id_volume.go index 1b1c739e625..576a30b9904 100644 --- a/resource-manager/netapp/2022-11-01-preview/volumesrevert/id_volume.go +++ b/resource-manager/netapp/2022-11-01-preview/volumesrevert/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2022-11-01/backuppolicy/id_backuppolicy.go b/resource-manager/netapp/2022-11-01/backuppolicy/id_backuppolicy.go index be7dcea83e7..f16f0b462b8 100644 --- a/resource-manager/netapp/2022-11-01/backuppolicy/id_backuppolicy.go +++ b/resource-manager/netapp/2022-11-01/backuppolicy/id_backuppolicy.go @@ -38,23 +38,9 @@ func ParseBackupPolicyID(input string) (*BackupPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupPolicyId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.BackupPolicyName, ok = parsed.Parsed["backupPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupPolicyIDInsensitively(input string) (*BackupPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.BackupPolicyName, ok = parsed.Parsed["backupPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupPolicyName", *parsed) + if id.BackupPolicyName, ok = input.Parsed["backupPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupPolicyName", input) } - return &id, nil + return nil } // ValidateBackupPolicyID checks that 'input' can be parsed as a Backup Policy ID diff --git a/resource-manager/netapp/2022-11-01/backuppolicy/id_netappaccount.go b/resource-manager/netapp/2022-11-01/backuppolicy/id_netappaccount.go index f9f08268b3e..6b11cb40365 100644 --- a/resource-manager/netapp/2022-11-01/backuppolicy/id_netappaccount.go +++ b/resource-manager/netapp/2022-11-01/backuppolicy/id_netappaccount.go @@ -36,19 +36,9 @@ func ParseNetAppAccountID(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetAppAccountIDInsensitively(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetAppAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - return &id, nil + return nil } // ValidateNetAppAccountID checks that 'input' can be parsed as a Net App Account ID diff --git a/resource-manager/netapp/2022-11-01/backups/id_accountbackup.go b/resource-manager/netapp/2022-11-01/backups/id_accountbackup.go index f2f3727d464..b4091d27265 100644 --- a/resource-manager/netapp/2022-11-01/backups/id_accountbackup.go +++ b/resource-manager/netapp/2022-11-01/backups/id_accountbackup.go @@ -38,23 +38,9 @@ func ParseAccountBackupID(input string) (*AccountBackupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountBackupId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.AccountBackupName, ok = parsed.Parsed["accountBackupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountBackupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAccountBackupIDInsensitively(input string) (*AccountBackupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountBackupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AccountBackupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.AccountBackupName, ok = parsed.Parsed["accountBackupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountBackupName", *parsed) + if id.AccountBackupName, ok = input.Parsed["accountBackupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountBackupName", input) } - return &id, nil + return nil } // ValidateAccountBackupID checks that 'input' can be parsed as a Account Backup ID diff --git a/resource-manager/netapp/2022-11-01/backups/id_backup.go b/resource-manager/netapp/2022-11-01/backups/id_backup.go index d4dfe8b796e..9c95bd9350f 100644 --- a/resource-manager/netapp/2022-11-01/backups/id_backup.go +++ b/resource-manager/netapp/2022-11-01/backups/id_backup.go @@ -42,31 +42,9 @@ func ParseBackupID(input string) (*BackupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) - } - - if id.BackupName, ok = parsed.Parsed["backupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseBackupIDInsensitively(input string) (*BackupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *BackupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - if id.BackupName, ok = parsed.Parsed["backupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupName", *parsed) + if id.BackupName, ok = input.Parsed["backupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupName", input) } - return &id, nil + return nil } // ValidateBackupID checks that 'input' can be parsed as a Backup ID diff --git a/resource-manager/netapp/2022-11-01/backups/id_netappaccount.go b/resource-manager/netapp/2022-11-01/backups/id_netappaccount.go index 304edc5df29..ced6c2088e0 100644 --- a/resource-manager/netapp/2022-11-01/backups/id_netappaccount.go +++ b/resource-manager/netapp/2022-11-01/backups/id_netappaccount.go @@ -36,19 +36,9 @@ func ParseNetAppAccountID(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetAppAccountIDInsensitively(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetAppAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - return &id, nil + return nil } // ValidateNetAppAccountID checks that 'input' can be parsed as a Net App Account ID diff --git a/resource-manager/netapp/2022-11-01/backups/id_volume.go b/resource-manager/netapp/2022-11-01/backups/id_volume.go index 69bcd9c2450..247b20b073e 100644 --- a/resource-manager/netapp/2022-11-01/backups/id_volume.go +++ b/resource-manager/netapp/2022-11-01/backups/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2022-11-01/capacitypools/id_capacitypool.go b/resource-manager/netapp/2022-11-01/capacitypools/id_capacitypool.go index c2e4d58474e..69954702fd9 100644 --- a/resource-manager/netapp/2022-11-01/capacitypools/id_capacitypool.go +++ b/resource-manager/netapp/2022-11-01/capacitypools/id_capacitypool.go @@ -38,23 +38,9 @@ func ParseCapacityPoolID(input string) (*CapacityPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapacityPoolId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCapacityPoolIDInsensitively(input string) (*CapacityPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapacityPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CapacityPoolId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - return &id, nil + return nil } // ValidateCapacityPoolID checks that 'input' can be parsed as a Capacity Pool ID diff --git a/resource-manager/netapp/2022-11-01/capacitypools/id_netappaccount.go b/resource-manager/netapp/2022-11-01/capacitypools/id_netappaccount.go index 43537ad3c8a..f424e58a9e8 100644 --- a/resource-manager/netapp/2022-11-01/capacitypools/id_netappaccount.go +++ b/resource-manager/netapp/2022-11-01/capacitypools/id_netappaccount.go @@ -36,19 +36,9 @@ func ParseNetAppAccountID(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetAppAccountIDInsensitively(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetAppAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - return &id, nil + return nil } // ValidateNetAppAccountID checks that 'input' can be parsed as a Net App Account ID diff --git a/resource-manager/netapp/2022-11-01/filelocks/id_volume.go b/resource-manager/netapp/2022-11-01/filelocks/id_volume.go index 97947a0c338..446434f9140 100644 --- a/resource-manager/netapp/2022-11-01/filelocks/id_volume.go +++ b/resource-manager/netapp/2022-11-01/filelocks/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2022-11-01/groupidlistforldapuser/id_volume.go b/resource-manager/netapp/2022-11-01/groupidlistforldapuser/id_volume.go index 5952f1bf01e..af00678327a 100644 --- a/resource-manager/netapp/2022-11-01/groupidlistforldapuser/id_volume.go +++ b/resource-manager/netapp/2022-11-01/groupidlistforldapuser/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2022-11-01/netappaccounts/id_netappaccount.go b/resource-manager/netapp/2022-11-01/netappaccounts/id_netappaccount.go index 65af9c406fe..07a8ef7a579 100644 --- a/resource-manager/netapp/2022-11-01/netappaccounts/id_netappaccount.go +++ b/resource-manager/netapp/2022-11-01/netappaccounts/id_netappaccount.go @@ -36,19 +36,9 @@ func ParseNetAppAccountID(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetAppAccountIDInsensitively(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetAppAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - return &id, nil + return nil } // ValidateNetAppAccountID checks that 'input' can be parsed as a Net App Account ID diff --git a/resource-manager/netapp/2022-11-01/netappresource/id_location.go b/resource-manager/netapp/2022-11-01/netappresource/id_location.go index 8c8f5f240ba..7c120e2a191 100644 --- a/resource-manager/netapp/2022-11-01/netappresource/id_location.go +++ b/resource-manager/netapp/2022-11-01/netappresource/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/netapp/2022-11-01/netappresource/id_quotalimit.go b/resource-manager/netapp/2022-11-01/netappresource/id_quotalimit.go index e203fa4b75f..aa29f073d5d 100644 --- a/resource-manager/netapp/2022-11-01/netappresource/id_quotalimit.go +++ b/resource-manager/netapp/2022-11-01/netappresource/id_quotalimit.go @@ -36,19 +36,9 @@ func ParseQuotaLimitID(input string) (*QuotaLimitId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QuotaLimitId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.QuotaLimitName, ok = parsed.Parsed["quotaLimitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "quotaLimitName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseQuotaLimitIDInsensitively(input string) (*QuotaLimitId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QuotaLimitId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *QuotaLimitId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.QuotaLimitName, ok = parsed.Parsed["quotaLimitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "quotaLimitName", *parsed) + if id.QuotaLimitName, ok = input.Parsed["quotaLimitName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "quotaLimitName", input) } - return &id, nil + return nil } // ValidateQuotaLimitID checks that 'input' can be parsed as a Quota Limit ID diff --git a/resource-manager/netapp/2022-11-01/poolchange/id_volume.go b/resource-manager/netapp/2022-11-01/poolchange/id_volume.go index 1cbbb19f5d6..60065ac10ae 100644 --- a/resource-manager/netapp/2022-11-01/poolchange/id_volume.go +++ b/resource-manager/netapp/2022-11-01/poolchange/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2022-11-01/resetcifspassword/id_volume.go b/resource-manager/netapp/2022-11-01/resetcifspassword/id_volume.go index bfb8d8033c2..69421cfe5d9 100644 --- a/resource-manager/netapp/2022-11-01/resetcifspassword/id_volume.go +++ b/resource-manager/netapp/2022-11-01/resetcifspassword/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2022-11-01/restore/id_volume.go b/resource-manager/netapp/2022-11-01/restore/id_volume.go index b7036691358..46089747e17 100644 --- a/resource-manager/netapp/2022-11-01/restore/id_volume.go +++ b/resource-manager/netapp/2022-11-01/restore/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2022-11-01/snapshotpolicy/id_netappaccount.go b/resource-manager/netapp/2022-11-01/snapshotpolicy/id_netappaccount.go index 6def655e7c0..162b7094379 100644 --- a/resource-manager/netapp/2022-11-01/snapshotpolicy/id_netappaccount.go +++ b/resource-manager/netapp/2022-11-01/snapshotpolicy/id_netappaccount.go @@ -36,19 +36,9 @@ func ParseNetAppAccountID(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetAppAccountIDInsensitively(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetAppAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - return &id, nil + return nil } // ValidateNetAppAccountID checks that 'input' can be parsed as a Net App Account ID diff --git a/resource-manager/netapp/2022-11-01/snapshotpolicy/id_snapshotpolicy.go b/resource-manager/netapp/2022-11-01/snapshotpolicy/id_snapshotpolicy.go index a751a65ec3b..3daea71a654 100644 --- a/resource-manager/netapp/2022-11-01/snapshotpolicy/id_snapshotpolicy.go +++ b/resource-manager/netapp/2022-11-01/snapshotpolicy/id_snapshotpolicy.go @@ -38,23 +38,9 @@ func ParseSnapshotPolicyID(input string) (*SnapshotPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SnapshotPolicyId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.SnapshotPolicyName, ok = parsed.Parsed["snapshotPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSnapshotPolicyIDInsensitively(input string) (*SnapshotPolicyId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SnapshotPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SnapshotPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.SnapshotPolicyName, ok = parsed.Parsed["snapshotPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotPolicyName", *parsed) + if id.SnapshotPolicyName, ok = input.Parsed["snapshotPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "snapshotPolicyName", input) } - return &id, nil + return nil } // ValidateSnapshotPolicyID checks that 'input' can be parsed as a Snapshot Policy ID diff --git a/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/id_snapshotpolicy.go b/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/id_snapshotpolicy.go index 7b918942253..37d159192cf 100644 --- a/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/id_snapshotpolicy.go +++ b/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/id_snapshotpolicy.go @@ -38,23 +38,9 @@ func ParseSnapshotPolicyID(input string) (*SnapshotPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SnapshotPolicyId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.SnapshotPolicyName, ok = parsed.Parsed["snapshotPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSnapshotPolicyIDInsensitively(input string) (*SnapshotPolicyId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SnapshotPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SnapshotPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.SnapshotPolicyName, ok = parsed.Parsed["snapshotPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotPolicyName", *parsed) + if id.SnapshotPolicyName, ok = input.Parsed["snapshotPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "snapshotPolicyName", input) } - return &id, nil + return nil } // ValidateSnapshotPolicyID checks that 'input' can be parsed as a Snapshot Policy ID diff --git a/resource-manager/netapp/2022-11-01/snapshots/id_snapshot.go b/resource-manager/netapp/2022-11-01/snapshots/id_snapshot.go index d7cb729822b..8a20d21ec27 100644 --- a/resource-manager/netapp/2022-11-01/snapshots/id_snapshot.go +++ b/resource-manager/netapp/2022-11-01/snapshots/id_snapshot.go @@ -42,31 +42,9 @@ func ParseSnapshotID(input string) (*SnapshotId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SnapshotId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) - } - - if id.SnapshotName, ok = parsed.Parsed["snapshotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseSnapshotIDInsensitively(input string) (*SnapshotId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SnapshotId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SnapshotId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - if id.SnapshotName, ok = parsed.Parsed["snapshotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotName", *parsed) + if id.SnapshotName, ok = input.Parsed["snapshotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "snapshotName", input) } - return &id, nil + return nil } // ValidateSnapshotID checks that 'input' can be parsed as a Snapshot ID diff --git a/resource-manager/netapp/2022-11-01/snapshots/id_volume.go b/resource-manager/netapp/2022-11-01/snapshots/id_volume.go index b144bfb03c7..06879ea6a3a 100644 --- a/resource-manager/netapp/2022-11-01/snapshots/id_volume.go +++ b/resource-manager/netapp/2022-11-01/snapshots/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2022-11-01/subvolumes/id_subvolume.go b/resource-manager/netapp/2022-11-01/subvolumes/id_subvolume.go index 5ebb6d8054b..0649b6aeac0 100644 --- a/resource-manager/netapp/2022-11-01/subvolumes/id_subvolume.go +++ b/resource-manager/netapp/2022-11-01/subvolumes/id_subvolume.go @@ -42,31 +42,9 @@ func ParseSubVolumeID(input string) (*SubVolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SubVolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) - } - - if id.SubVolumeName, ok = parsed.Parsed["subVolumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subVolumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseSubVolumeIDInsensitively(input string) (*SubVolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SubVolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SubVolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - if id.SubVolumeName, ok = parsed.Parsed["subVolumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subVolumeName", *parsed) + if id.SubVolumeName, ok = input.Parsed["subVolumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subVolumeName", input) } - return &id, nil + return nil } // ValidateSubVolumeID checks that 'input' can be parsed as a Sub Volume ID diff --git a/resource-manager/netapp/2022-11-01/subvolumes/id_volume.go b/resource-manager/netapp/2022-11-01/subvolumes/id_volume.go index b64821a5f09..8bbeb6c9e23 100644 --- a/resource-manager/netapp/2022-11-01/subvolumes/id_volume.go +++ b/resource-manager/netapp/2022-11-01/subvolumes/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2022-11-01/volumegroups/id_netappaccount.go b/resource-manager/netapp/2022-11-01/volumegroups/id_netappaccount.go index 5cf7bb72331..180947b711b 100644 --- a/resource-manager/netapp/2022-11-01/volumegroups/id_netappaccount.go +++ b/resource-manager/netapp/2022-11-01/volumegroups/id_netappaccount.go @@ -36,19 +36,9 @@ func ParseNetAppAccountID(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetAppAccountIDInsensitively(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetAppAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - return &id, nil + return nil } // ValidateNetAppAccountID checks that 'input' can be parsed as a Net App Account ID diff --git a/resource-manager/netapp/2022-11-01/volumegroups/id_volumegroup.go b/resource-manager/netapp/2022-11-01/volumegroups/id_volumegroup.go index fbd627e4b85..f97a6bb10bd 100644 --- a/resource-manager/netapp/2022-11-01/volumegroups/id_volumegroup.go +++ b/resource-manager/netapp/2022-11-01/volumegroups/id_volumegroup.go @@ -38,23 +38,9 @@ func ParseVolumeGroupID(input string) (*VolumeGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeGroupId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.VolumeGroupName, ok = parsed.Parsed["volumeGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVolumeGroupIDInsensitively(input string) (*VolumeGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VolumeGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.VolumeGroupName, ok = parsed.Parsed["volumeGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeGroupName", *parsed) + if id.VolumeGroupName, ok = input.Parsed["volumeGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeGroupName", input) } - return &id, nil + return nil } // ValidateVolumeGroupID checks that 'input' can be parsed as a Volume Group ID diff --git a/resource-manager/netapp/2022-11-01/volumequotarules/id_volume.go b/resource-manager/netapp/2022-11-01/volumequotarules/id_volume.go index 306e2dc6219..b3d6ab761b3 100644 --- a/resource-manager/netapp/2022-11-01/volumequotarules/id_volume.go +++ b/resource-manager/netapp/2022-11-01/volumequotarules/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2022-11-01/volumequotarules/id_volumequotarule.go b/resource-manager/netapp/2022-11-01/volumequotarules/id_volumequotarule.go index f86acf65be7..711a80ae5cd 100644 --- a/resource-manager/netapp/2022-11-01/volumequotarules/id_volumequotarule.go +++ b/resource-manager/netapp/2022-11-01/volumequotarules/id_volumequotarule.go @@ -42,31 +42,9 @@ func ParseVolumeQuotaRuleID(input string) (*VolumeQuotaRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeQuotaRuleId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) - } - - if id.VolumeQuotaRuleName, ok = parsed.Parsed["volumeQuotaRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeQuotaRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseVolumeQuotaRuleIDInsensitively(input string) (*VolumeQuotaRuleId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeQuotaRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VolumeQuotaRuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - if id.VolumeQuotaRuleName, ok = parsed.Parsed["volumeQuotaRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeQuotaRuleName", *parsed) + if id.VolumeQuotaRuleName, ok = input.Parsed["volumeQuotaRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeQuotaRuleName", input) } - return &id, nil + return nil } // ValidateVolumeQuotaRuleID checks that 'input' can be parsed as a Volume Quota Rule ID diff --git a/resource-manager/netapp/2022-11-01/volumes/id_capacitypool.go b/resource-manager/netapp/2022-11-01/volumes/id_capacitypool.go index edb30a75b16..9ce092f4fe4 100644 --- a/resource-manager/netapp/2022-11-01/volumes/id_capacitypool.go +++ b/resource-manager/netapp/2022-11-01/volumes/id_capacitypool.go @@ -38,23 +38,9 @@ func ParseCapacityPoolID(input string) (*CapacityPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapacityPoolId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCapacityPoolIDInsensitively(input string) (*CapacityPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapacityPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CapacityPoolId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - return &id, nil + return nil } // ValidateCapacityPoolID checks that 'input' can be parsed as a Capacity Pool ID diff --git a/resource-manager/netapp/2022-11-01/volumes/id_volume.go b/resource-manager/netapp/2022-11-01/volumes/id_volume.go index 142e376a72c..0b27e4a330c 100644 --- a/resource-manager/netapp/2022-11-01/volumes/id_volume.go +++ b/resource-manager/netapp/2022-11-01/volumes/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2022-11-01/volumesrelocation/id_volume.go b/resource-manager/netapp/2022-11-01/volumesrelocation/id_volume.go index f5049fb2828..c10d0bf30cd 100644 --- a/resource-manager/netapp/2022-11-01/volumesrelocation/id_volume.go +++ b/resource-manager/netapp/2022-11-01/volumesrelocation/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2022-11-01/volumesreplication/id_volume.go b/resource-manager/netapp/2022-11-01/volumesreplication/id_volume.go index 1a057729587..c68d5f31c45 100644 --- a/resource-manager/netapp/2022-11-01/volumesreplication/id_volume.go +++ b/resource-manager/netapp/2022-11-01/volumesreplication/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2022-11-01/volumesrevert/id_volume.go b/resource-manager/netapp/2022-11-01/volumesrevert/id_volume.go index 1b1c739e625..576a30b9904 100644 --- a/resource-manager/netapp/2022-11-01/volumesrevert/id_volume.go +++ b/resource-manager/netapp/2022-11-01/volumesrevert/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2023-05-01/backuppolicy/id_backuppolicy.go b/resource-manager/netapp/2023-05-01/backuppolicy/id_backuppolicy.go index be7dcea83e7..f16f0b462b8 100644 --- a/resource-manager/netapp/2023-05-01/backuppolicy/id_backuppolicy.go +++ b/resource-manager/netapp/2023-05-01/backuppolicy/id_backuppolicy.go @@ -38,23 +38,9 @@ func ParseBackupPolicyID(input string) (*BackupPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupPolicyId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.BackupPolicyName, ok = parsed.Parsed["backupPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupPolicyIDInsensitively(input string) (*BackupPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.BackupPolicyName, ok = parsed.Parsed["backupPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupPolicyName", *parsed) + if id.BackupPolicyName, ok = input.Parsed["backupPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupPolicyName", input) } - return &id, nil + return nil } // ValidateBackupPolicyID checks that 'input' can be parsed as a Backup Policy ID diff --git a/resource-manager/netapp/2023-05-01/backuppolicy/id_netappaccount.go b/resource-manager/netapp/2023-05-01/backuppolicy/id_netappaccount.go index f9f08268b3e..6b11cb40365 100644 --- a/resource-manager/netapp/2023-05-01/backuppolicy/id_netappaccount.go +++ b/resource-manager/netapp/2023-05-01/backuppolicy/id_netappaccount.go @@ -36,19 +36,9 @@ func ParseNetAppAccountID(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetAppAccountIDInsensitively(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetAppAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - return &id, nil + return nil } // ValidateNetAppAccountID checks that 'input' can be parsed as a Net App Account ID diff --git a/resource-manager/netapp/2023-05-01/capacitypools/id_capacitypool.go b/resource-manager/netapp/2023-05-01/capacitypools/id_capacitypool.go index c2e4d58474e..69954702fd9 100644 --- a/resource-manager/netapp/2023-05-01/capacitypools/id_capacitypool.go +++ b/resource-manager/netapp/2023-05-01/capacitypools/id_capacitypool.go @@ -38,23 +38,9 @@ func ParseCapacityPoolID(input string) (*CapacityPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapacityPoolId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCapacityPoolIDInsensitively(input string) (*CapacityPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapacityPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CapacityPoolId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - return &id, nil + return nil } // ValidateCapacityPoolID checks that 'input' can be parsed as a Capacity Pool ID diff --git a/resource-manager/netapp/2023-05-01/capacitypools/id_netappaccount.go b/resource-manager/netapp/2023-05-01/capacitypools/id_netappaccount.go index 43537ad3c8a..f424e58a9e8 100644 --- a/resource-manager/netapp/2023-05-01/capacitypools/id_netappaccount.go +++ b/resource-manager/netapp/2023-05-01/capacitypools/id_netappaccount.go @@ -36,19 +36,9 @@ func ParseNetAppAccountID(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetAppAccountIDInsensitively(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetAppAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - return &id, nil + return nil } // ValidateNetAppAccountID checks that 'input' can be parsed as a Net App Account ID diff --git a/resource-manager/netapp/2023-05-01/filelocks/id_volume.go b/resource-manager/netapp/2023-05-01/filelocks/id_volume.go index 97947a0c338..446434f9140 100644 --- a/resource-manager/netapp/2023-05-01/filelocks/id_volume.go +++ b/resource-manager/netapp/2023-05-01/filelocks/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2023-05-01/groupidlistforldapuser/id_volume.go b/resource-manager/netapp/2023-05-01/groupidlistforldapuser/id_volume.go index 5952f1bf01e..af00678327a 100644 --- a/resource-manager/netapp/2023-05-01/groupidlistforldapuser/id_volume.go +++ b/resource-manager/netapp/2023-05-01/groupidlistforldapuser/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2023-05-01/netappaccounts/id_netappaccount.go b/resource-manager/netapp/2023-05-01/netappaccounts/id_netappaccount.go index 65af9c406fe..07a8ef7a579 100644 --- a/resource-manager/netapp/2023-05-01/netappaccounts/id_netappaccount.go +++ b/resource-manager/netapp/2023-05-01/netappaccounts/id_netappaccount.go @@ -36,19 +36,9 @@ func ParseNetAppAccountID(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetAppAccountIDInsensitively(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetAppAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - return &id, nil + return nil } // ValidateNetAppAccountID checks that 'input' can be parsed as a Net App Account ID diff --git a/resource-manager/netapp/2023-05-01/netappresource/id_location.go b/resource-manager/netapp/2023-05-01/netappresource/id_location.go index 8c8f5f240ba..7c120e2a191 100644 --- a/resource-manager/netapp/2023-05-01/netappresource/id_location.go +++ b/resource-manager/netapp/2023-05-01/netappresource/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/netapp/2023-05-01/netappresource/id_quotalimit.go b/resource-manager/netapp/2023-05-01/netappresource/id_quotalimit.go index e203fa4b75f..aa29f073d5d 100644 --- a/resource-manager/netapp/2023-05-01/netappresource/id_quotalimit.go +++ b/resource-manager/netapp/2023-05-01/netappresource/id_quotalimit.go @@ -36,19 +36,9 @@ func ParseQuotaLimitID(input string) (*QuotaLimitId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QuotaLimitId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.QuotaLimitName, ok = parsed.Parsed["quotaLimitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "quotaLimitName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseQuotaLimitIDInsensitively(input string) (*QuotaLimitId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QuotaLimitId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *QuotaLimitId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.QuotaLimitName, ok = parsed.Parsed["quotaLimitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "quotaLimitName", *parsed) + if id.QuotaLimitName, ok = input.Parsed["quotaLimitName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "quotaLimitName", input) } - return &id, nil + return nil } // ValidateQuotaLimitID checks that 'input' can be parsed as a Quota Limit ID diff --git a/resource-manager/netapp/2023-05-01/poolchange/id_volume.go b/resource-manager/netapp/2023-05-01/poolchange/id_volume.go index 1cbbb19f5d6..60065ac10ae 100644 --- a/resource-manager/netapp/2023-05-01/poolchange/id_volume.go +++ b/resource-manager/netapp/2023-05-01/poolchange/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2023-05-01/resetcifspassword/id_volume.go b/resource-manager/netapp/2023-05-01/resetcifspassword/id_volume.go index bfb8d8033c2..69421cfe5d9 100644 --- a/resource-manager/netapp/2023-05-01/resetcifspassword/id_volume.go +++ b/resource-manager/netapp/2023-05-01/resetcifspassword/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2023-05-01/restore/id_volume.go b/resource-manager/netapp/2023-05-01/restore/id_volume.go index b7036691358..46089747e17 100644 --- a/resource-manager/netapp/2023-05-01/restore/id_volume.go +++ b/resource-manager/netapp/2023-05-01/restore/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2023-05-01/snapshotpolicy/id_netappaccount.go b/resource-manager/netapp/2023-05-01/snapshotpolicy/id_netappaccount.go index 6def655e7c0..162b7094379 100644 --- a/resource-manager/netapp/2023-05-01/snapshotpolicy/id_netappaccount.go +++ b/resource-manager/netapp/2023-05-01/snapshotpolicy/id_netappaccount.go @@ -36,19 +36,9 @@ func ParseNetAppAccountID(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetAppAccountIDInsensitively(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetAppAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - return &id, nil + return nil } // ValidateNetAppAccountID checks that 'input' can be parsed as a Net App Account ID diff --git a/resource-manager/netapp/2023-05-01/snapshotpolicy/id_snapshotpolicy.go b/resource-manager/netapp/2023-05-01/snapshotpolicy/id_snapshotpolicy.go index a751a65ec3b..3daea71a654 100644 --- a/resource-manager/netapp/2023-05-01/snapshotpolicy/id_snapshotpolicy.go +++ b/resource-manager/netapp/2023-05-01/snapshotpolicy/id_snapshotpolicy.go @@ -38,23 +38,9 @@ func ParseSnapshotPolicyID(input string) (*SnapshotPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SnapshotPolicyId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.SnapshotPolicyName, ok = parsed.Parsed["snapshotPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSnapshotPolicyIDInsensitively(input string) (*SnapshotPolicyId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SnapshotPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SnapshotPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.SnapshotPolicyName, ok = parsed.Parsed["snapshotPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotPolicyName", *parsed) + if id.SnapshotPolicyName, ok = input.Parsed["snapshotPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "snapshotPolicyName", input) } - return &id, nil + return nil } // ValidateSnapshotPolicyID checks that 'input' can be parsed as a Snapshot Policy ID diff --git a/resource-manager/netapp/2023-05-01/snapshotpolicylistvolumes/id_snapshotpolicy.go b/resource-manager/netapp/2023-05-01/snapshotpolicylistvolumes/id_snapshotpolicy.go index 7b918942253..37d159192cf 100644 --- a/resource-manager/netapp/2023-05-01/snapshotpolicylistvolumes/id_snapshotpolicy.go +++ b/resource-manager/netapp/2023-05-01/snapshotpolicylistvolumes/id_snapshotpolicy.go @@ -38,23 +38,9 @@ func ParseSnapshotPolicyID(input string) (*SnapshotPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SnapshotPolicyId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.SnapshotPolicyName, ok = parsed.Parsed["snapshotPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSnapshotPolicyIDInsensitively(input string) (*SnapshotPolicyId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SnapshotPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SnapshotPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.SnapshotPolicyName, ok = parsed.Parsed["snapshotPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotPolicyName", *parsed) + if id.SnapshotPolicyName, ok = input.Parsed["snapshotPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "snapshotPolicyName", input) } - return &id, nil + return nil } // ValidateSnapshotPolicyID checks that 'input' can be parsed as a Snapshot Policy ID diff --git a/resource-manager/netapp/2023-05-01/snapshots/id_snapshot.go b/resource-manager/netapp/2023-05-01/snapshots/id_snapshot.go index d7cb729822b..8a20d21ec27 100644 --- a/resource-manager/netapp/2023-05-01/snapshots/id_snapshot.go +++ b/resource-manager/netapp/2023-05-01/snapshots/id_snapshot.go @@ -42,31 +42,9 @@ func ParseSnapshotID(input string) (*SnapshotId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SnapshotId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) - } - - if id.SnapshotName, ok = parsed.Parsed["snapshotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseSnapshotIDInsensitively(input string) (*SnapshotId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SnapshotId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SnapshotId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - if id.SnapshotName, ok = parsed.Parsed["snapshotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotName", *parsed) + if id.SnapshotName, ok = input.Parsed["snapshotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "snapshotName", input) } - return &id, nil + return nil } // ValidateSnapshotID checks that 'input' can be parsed as a Snapshot ID diff --git a/resource-manager/netapp/2023-05-01/snapshots/id_volume.go b/resource-manager/netapp/2023-05-01/snapshots/id_volume.go index b144bfb03c7..06879ea6a3a 100644 --- a/resource-manager/netapp/2023-05-01/snapshots/id_volume.go +++ b/resource-manager/netapp/2023-05-01/snapshots/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2023-05-01/subvolumes/id_subvolume.go b/resource-manager/netapp/2023-05-01/subvolumes/id_subvolume.go index 5ebb6d8054b..0649b6aeac0 100644 --- a/resource-manager/netapp/2023-05-01/subvolumes/id_subvolume.go +++ b/resource-manager/netapp/2023-05-01/subvolumes/id_subvolume.go @@ -42,31 +42,9 @@ func ParseSubVolumeID(input string) (*SubVolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SubVolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) - } - - if id.SubVolumeName, ok = parsed.Parsed["subVolumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subVolumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseSubVolumeIDInsensitively(input string) (*SubVolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SubVolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SubVolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - if id.SubVolumeName, ok = parsed.Parsed["subVolumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subVolumeName", *parsed) + if id.SubVolumeName, ok = input.Parsed["subVolumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subVolumeName", input) } - return &id, nil + return nil } // ValidateSubVolumeID checks that 'input' can be parsed as a Sub Volume ID diff --git a/resource-manager/netapp/2023-05-01/subvolumes/id_volume.go b/resource-manager/netapp/2023-05-01/subvolumes/id_volume.go index b64821a5f09..8bbeb6c9e23 100644 --- a/resource-manager/netapp/2023-05-01/subvolumes/id_volume.go +++ b/resource-manager/netapp/2023-05-01/subvolumes/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2023-05-01/volumegroups/id_netappaccount.go b/resource-manager/netapp/2023-05-01/volumegroups/id_netappaccount.go index 5cf7bb72331..180947b711b 100644 --- a/resource-manager/netapp/2023-05-01/volumegroups/id_netappaccount.go +++ b/resource-manager/netapp/2023-05-01/volumegroups/id_netappaccount.go @@ -36,19 +36,9 @@ func ParseNetAppAccountID(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetAppAccountIDInsensitively(input string) (*NetAppAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetAppAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetAppAccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - return &id, nil + return nil } // ValidateNetAppAccountID checks that 'input' can be parsed as a Net App Account ID diff --git a/resource-manager/netapp/2023-05-01/volumegroups/id_volumegroup.go b/resource-manager/netapp/2023-05-01/volumegroups/id_volumegroup.go index fbd627e4b85..f97a6bb10bd 100644 --- a/resource-manager/netapp/2023-05-01/volumegroups/id_volumegroup.go +++ b/resource-manager/netapp/2023-05-01/volumegroups/id_volumegroup.go @@ -38,23 +38,9 @@ func ParseVolumeGroupID(input string) (*VolumeGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeGroupId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.VolumeGroupName, ok = parsed.Parsed["volumeGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVolumeGroupIDInsensitively(input string) (*VolumeGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VolumeGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.VolumeGroupName, ok = parsed.Parsed["volumeGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeGroupName", *parsed) + if id.VolumeGroupName, ok = input.Parsed["volumeGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeGroupName", input) } - return &id, nil + return nil } // ValidateVolumeGroupID checks that 'input' can be parsed as a Volume Group ID diff --git a/resource-manager/netapp/2023-05-01/volumequotarules/id_volume.go b/resource-manager/netapp/2023-05-01/volumequotarules/id_volume.go index 306e2dc6219..b3d6ab761b3 100644 --- a/resource-manager/netapp/2023-05-01/volumequotarules/id_volume.go +++ b/resource-manager/netapp/2023-05-01/volumequotarules/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2023-05-01/volumequotarules/id_volumequotarule.go b/resource-manager/netapp/2023-05-01/volumequotarules/id_volumequotarule.go index f86acf65be7..711a80ae5cd 100644 --- a/resource-manager/netapp/2023-05-01/volumequotarules/id_volumequotarule.go +++ b/resource-manager/netapp/2023-05-01/volumequotarules/id_volumequotarule.go @@ -42,31 +42,9 @@ func ParseVolumeQuotaRuleID(input string) (*VolumeQuotaRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeQuotaRuleId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) - } - - if id.VolumeQuotaRuleName, ok = parsed.Parsed["volumeQuotaRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeQuotaRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseVolumeQuotaRuleIDInsensitively(input string) (*VolumeQuotaRuleId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeQuotaRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VolumeQuotaRuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - if id.VolumeQuotaRuleName, ok = parsed.Parsed["volumeQuotaRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeQuotaRuleName", *parsed) + if id.VolumeQuotaRuleName, ok = input.Parsed["volumeQuotaRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeQuotaRuleName", input) } - return &id, nil + return nil } // ValidateVolumeQuotaRuleID checks that 'input' can be parsed as a Volume Quota Rule ID diff --git a/resource-manager/netapp/2023-05-01/volumes/id_capacitypool.go b/resource-manager/netapp/2023-05-01/volumes/id_capacitypool.go index edb30a75b16..9ce092f4fe4 100644 --- a/resource-manager/netapp/2023-05-01/volumes/id_capacitypool.go +++ b/resource-manager/netapp/2023-05-01/volumes/id_capacitypool.go @@ -38,23 +38,9 @@ func ParseCapacityPoolID(input string) (*CapacityPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapacityPoolId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCapacityPoolIDInsensitively(input string) (*CapacityPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapacityPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CapacityPoolId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - return &id, nil + return nil } // ValidateCapacityPoolID checks that 'input' can be parsed as a Capacity Pool ID diff --git a/resource-manager/netapp/2023-05-01/volumes/id_volume.go b/resource-manager/netapp/2023-05-01/volumes/id_volume.go index 142e376a72c..0b27e4a330c 100644 --- a/resource-manager/netapp/2023-05-01/volumes/id_volume.go +++ b/resource-manager/netapp/2023-05-01/volumes/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2023-05-01/volumesrelocation/id_volume.go b/resource-manager/netapp/2023-05-01/volumesrelocation/id_volume.go index f5049fb2828..c10d0bf30cd 100644 --- a/resource-manager/netapp/2023-05-01/volumesrelocation/id_volume.go +++ b/resource-manager/netapp/2023-05-01/volumesrelocation/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2023-05-01/volumesreplication/id_volume.go b/resource-manager/netapp/2023-05-01/volumesreplication/id_volume.go index 1a057729587..c68d5f31c45 100644 --- a/resource-manager/netapp/2023-05-01/volumesreplication/id_volume.go +++ b/resource-manager/netapp/2023-05-01/volumesreplication/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/netapp/2023-05-01/volumesrevert/id_volume.go b/resource-manager/netapp/2023-05-01/volumesrevert/id_volume.go index 1b1c739e625..576a30b9904 100644 --- a/resource-manager/netapp/2023-05-01/volumesrevert/id_volume.go +++ b/resource-manager/netapp/2023-05-01/volumesrevert/id_volume.go @@ -40,27 +40,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) - } - - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) - } - - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetAppAccountName, ok = parsed.Parsed["netAppAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", *parsed) + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) } - if id.CapacityPoolName, ok = parsed.Parsed["capacityPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", *parsed) + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/network/2023-04-01/adminrulecollections/id_rulecollection.go b/resource-manager/network/2023-04-01/adminrulecollections/id_rulecollection.go index 49cb86529fd..e872007ab21 100644 --- a/resource-manager/network/2023-04-01/adminrulecollections/id_rulecollection.go +++ b/resource-manager/network/2023-04-01/adminrulecollections/id_rulecollection.go @@ -40,27 +40,9 @@ func ParseRuleCollectionID(input string) (*RuleCollectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RuleCollectionId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) - } - - if id.SecurityAdminConfigurationName, ok = parsed.Parsed["securityAdminConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityAdminConfigurationName", *parsed) - } - - if id.RuleCollectionName, ok = parsed.Parsed["ruleCollectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleCollectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseRuleCollectionIDInsensitively(input string) (*RuleCollectionId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RuleCollectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RuleCollectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - if id.SecurityAdminConfigurationName, ok = parsed.Parsed["securityAdminConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityAdminConfigurationName", *parsed) + if id.SecurityAdminConfigurationName, ok = input.Parsed["securityAdminConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "securityAdminConfigurationName", input) } - if id.RuleCollectionName, ok = parsed.Parsed["ruleCollectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleCollectionName", *parsed) + if id.RuleCollectionName, ok = input.Parsed["ruleCollectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleCollectionName", input) } - return &id, nil + return nil } // ValidateRuleCollectionID checks that 'input' can be parsed as a Rule Collection ID diff --git a/resource-manager/network/2023-04-01/adminrulecollections/id_securityadminconfiguration.go b/resource-manager/network/2023-04-01/adminrulecollections/id_securityadminconfiguration.go index 6e36b78776a..a623baf41bc 100644 --- a/resource-manager/network/2023-04-01/adminrulecollections/id_securityadminconfiguration.go +++ b/resource-manager/network/2023-04-01/adminrulecollections/id_securityadminconfiguration.go @@ -38,23 +38,9 @@ func ParseSecurityAdminConfigurationID(input string) (*SecurityAdminConfiguratio return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecurityAdminConfigurationId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) - } - - if id.SecurityAdminConfigurationName, ok = parsed.Parsed["securityAdminConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityAdminConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSecurityAdminConfigurationIDInsensitively(input string) (*SecurityAdmi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecurityAdminConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SecurityAdminConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - if id.SecurityAdminConfigurationName, ok = parsed.Parsed["securityAdminConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityAdminConfigurationName", *parsed) + if id.SecurityAdminConfigurationName, ok = input.Parsed["securityAdminConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "securityAdminConfigurationName", input) } - return &id, nil + return nil } // ValidateSecurityAdminConfigurationID checks that 'input' can be parsed as a Security Admin Configuration ID diff --git a/resource-manager/network/2023-04-01/adminrules/id_rule.go b/resource-manager/network/2023-04-01/adminrules/id_rule.go index d93cbce740e..1773ee5f02e 100644 --- a/resource-manager/network/2023-04-01/adminrules/id_rule.go +++ b/resource-manager/network/2023-04-01/adminrules/id_rule.go @@ -42,31 +42,9 @@ func ParseRuleID(input string) (*RuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RuleId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) - } - - if id.SecurityAdminConfigurationName, ok = parsed.Parsed["securityAdminConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityAdminConfigurationName", *parsed) - } - - if id.RuleCollectionName, ok = parsed.Parsed["ruleCollectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleCollectionName", *parsed) - } - - if id.RuleName, ok = parsed.Parsed["ruleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseRuleIDInsensitively(input string) (*RuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - if id.SecurityAdminConfigurationName, ok = parsed.Parsed["securityAdminConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityAdminConfigurationName", *parsed) + if id.SecurityAdminConfigurationName, ok = input.Parsed["securityAdminConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "securityAdminConfigurationName", input) } - if id.RuleCollectionName, ok = parsed.Parsed["ruleCollectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleCollectionName", *parsed) + if id.RuleCollectionName, ok = input.Parsed["ruleCollectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleCollectionName", input) } - if id.RuleName, ok = parsed.Parsed["ruleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleName", *parsed) + if id.RuleName, ok = input.Parsed["ruleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleName", input) } - return &id, nil + return nil } // ValidateRuleID checks that 'input' can be parsed as a Rule ID diff --git a/resource-manager/network/2023-04-01/adminrules/id_rulecollection.go b/resource-manager/network/2023-04-01/adminrules/id_rulecollection.go index 1cdbb320880..9755614ded3 100644 --- a/resource-manager/network/2023-04-01/adminrules/id_rulecollection.go +++ b/resource-manager/network/2023-04-01/adminrules/id_rulecollection.go @@ -40,27 +40,9 @@ func ParseRuleCollectionID(input string) (*RuleCollectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RuleCollectionId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) - } - - if id.SecurityAdminConfigurationName, ok = parsed.Parsed["securityAdminConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityAdminConfigurationName", *parsed) - } - - if id.RuleCollectionName, ok = parsed.Parsed["ruleCollectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleCollectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseRuleCollectionIDInsensitively(input string) (*RuleCollectionId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RuleCollectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RuleCollectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - if id.SecurityAdminConfigurationName, ok = parsed.Parsed["securityAdminConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityAdminConfigurationName", *parsed) + if id.SecurityAdminConfigurationName, ok = input.Parsed["securityAdminConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "securityAdminConfigurationName", input) } - if id.RuleCollectionName, ok = parsed.Parsed["ruleCollectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleCollectionName", *parsed) + if id.RuleCollectionName, ok = input.Parsed["ruleCollectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleCollectionName", input) } - return &id, nil + return nil } // ValidateRuleCollectionID checks that 'input' can be parsed as a Rule Collection ID diff --git a/resource-manager/network/2023-04-01/applicationgatewayprivateendpointconnections/id_applicationgateway.go b/resource-manager/network/2023-04-01/applicationgatewayprivateendpointconnections/id_applicationgateway.go index 58498d25a2c..cfc53ebc341 100644 --- a/resource-manager/network/2023-04-01/applicationgatewayprivateendpointconnections/id_applicationgateway.go +++ b/resource-manager/network/2023-04-01/applicationgatewayprivateendpointconnections/id_applicationgateway.go @@ -36,19 +36,9 @@ func ParseApplicationGatewayID(input string) (*ApplicationGatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGatewayId{} - - 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.ApplicationGatewayName, ok = parsed.Parsed["applicationGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGatewayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseApplicationGatewayIDInsensitively(input string) (*ApplicationGatewayId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ApplicationGatewayId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ApplicationGatewayName, ok = parsed.Parsed["applicationGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGatewayName", *parsed) + if id.ApplicationGatewayName, ok = input.Parsed["applicationGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationGatewayName", input) } - return &id, nil + return nil } // ValidateApplicationGatewayID checks that 'input' can be parsed as a Application Gateway ID diff --git a/resource-manager/network/2023-04-01/applicationgatewayprivateendpointconnections/id_applicationgatewayprivateendpointconnection.go b/resource-manager/network/2023-04-01/applicationgatewayprivateendpointconnections/id_applicationgatewayprivateendpointconnection.go index 16e2175839e..e7d21df9e97 100644 --- a/resource-manager/network/2023-04-01/applicationgatewayprivateendpointconnections/id_applicationgatewayprivateendpointconnection.go +++ b/resource-manager/network/2023-04-01/applicationgatewayprivateendpointconnections/id_applicationgatewayprivateendpointconnection.go @@ -38,23 +38,9 @@ func ParseApplicationGatewayPrivateEndpointConnectionID(input string) (*Applicat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGatewayPrivateEndpointConnectionId{} - - 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.ApplicationGatewayName, ok = parsed.Parsed["applicationGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGatewayName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApplicationGatewayPrivateEndpointConnectionIDInsensitively(input strin return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGatewayPrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApplicationGatewayPrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ApplicationGatewayName, ok = parsed.Parsed["applicationGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGatewayName", *parsed) + if id.ApplicationGatewayName, ok = input.Parsed["applicationGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationGatewayName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidateApplicationGatewayPrivateEndpointConnectionID checks that 'input' can be parsed as a Application Gateway Private Endpoint Connection ID diff --git a/resource-manager/network/2023-04-01/applicationgatewayprivatelinkresources/id_applicationgateway.go b/resource-manager/network/2023-04-01/applicationgatewayprivatelinkresources/id_applicationgateway.go index 6a994cbbf56..40c8e0927cc 100644 --- a/resource-manager/network/2023-04-01/applicationgatewayprivatelinkresources/id_applicationgateway.go +++ b/resource-manager/network/2023-04-01/applicationgatewayprivatelinkresources/id_applicationgateway.go @@ -36,19 +36,9 @@ func ParseApplicationGatewayID(input string) (*ApplicationGatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGatewayId{} - - 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.ApplicationGatewayName, ok = parsed.Parsed["applicationGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGatewayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseApplicationGatewayIDInsensitively(input string) (*ApplicationGatewayId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ApplicationGatewayId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ApplicationGatewayName, ok = parsed.Parsed["applicationGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGatewayName", *parsed) + if id.ApplicationGatewayName, ok = input.Parsed["applicationGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationGatewayName", input) } - return &id, nil + return nil } // ValidateApplicationGatewayID checks that 'input' can be parsed as a Application Gateway ID diff --git a/resource-manager/network/2023-04-01/applicationgateways/id_applicationgateway.go b/resource-manager/network/2023-04-01/applicationgateways/id_applicationgateway.go index c9e4b9d3cbb..599b534439a 100644 --- a/resource-manager/network/2023-04-01/applicationgateways/id_applicationgateway.go +++ b/resource-manager/network/2023-04-01/applicationgateways/id_applicationgateway.go @@ -36,19 +36,9 @@ func ParseApplicationGatewayID(input string) (*ApplicationGatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGatewayId{} - - 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.ApplicationGatewayName, ok = parsed.Parsed["applicationGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGatewayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseApplicationGatewayIDInsensitively(input string) (*ApplicationGatewayId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ApplicationGatewayId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ApplicationGatewayName, ok = parsed.Parsed["applicationGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGatewayName", *parsed) + if id.ApplicationGatewayName, ok = input.Parsed["applicationGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationGatewayName", input) } - return &id, nil + return nil } // ValidateApplicationGatewayID checks that 'input' can be parsed as a Application Gateway ID diff --git a/resource-manager/network/2023-04-01/applicationgateways/id_predefinedpolicy.go b/resource-manager/network/2023-04-01/applicationgateways/id_predefinedpolicy.go index b49384e166d..b5821036369 100644 --- a/resource-manager/network/2023-04-01/applicationgateways/id_predefinedpolicy.go +++ b/resource-manager/network/2023-04-01/applicationgateways/id_predefinedpolicy.go @@ -34,15 +34,9 @@ func ParsePredefinedPolicyID(input string) (*PredefinedPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PredefinedPolicyId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.PredefinedPolicyName, ok = parsed.Parsed["predefinedPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "predefinedPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParsePredefinedPolicyIDInsensitively(input string) (*PredefinedPolicyId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PredefinedPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *PredefinedPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.PredefinedPolicyName, ok = parsed.Parsed["predefinedPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "predefinedPolicyName", *parsed) + if id.PredefinedPolicyName, ok = input.Parsed["predefinedPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "predefinedPolicyName", input) } - return &id, nil + return nil } // ValidatePredefinedPolicyID checks that 'input' can be parsed as a Predefined Policy ID diff --git a/resource-manager/network/2023-04-01/applicationgatewaywafdynamicmanifests/id_location.go b/resource-manager/network/2023-04-01/applicationgatewaywafdynamicmanifests/id_location.go index d3b01a8cfce..1d6c45d8226 100644 --- a/resource-manager/network/2023-04-01/applicationgatewaywafdynamicmanifests/id_location.go +++ b/resource-manager/network/2023-04-01/applicationgatewaywafdynamicmanifests/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/network/2023-04-01/applicationsecuritygroups/id_applicationsecuritygroup.go b/resource-manager/network/2023-04-01/applicationsecuritygroups/id_applicationsecuritygroup.go index 34de777e09e..c457f791c4b 100644 --- a/resource-manager/network/2023-04-01/applicationsecuritygroups/id_applicationsecuritygroup.go +++ b/resource-manager/network/2023-04-01/applicationsecuritygroups/id_applicationsecuritygroup.go @@ -36,19 +36,9 @@ func ParseApplicationSecurityGroupID(input string) (*ApplicationSecurityGroupId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationSecurityGroupId{} - - 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.ApplicationSecurityGroupName, ok = parsed.Parsed["applicationSecurityGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationSecurityGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseApplicationSecurityGroupIDInsensitively(input string) (*ApplicationSec return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationSecurityGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ApplicationSecurityGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ApplicationSecurityGroupName, ok = parsed.Parsed["applicationSecurityGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationSecurityGroupName", *parsed) + if id.ApplicationSecurityGroupName, ok = input.Parsed["applicationSecurityGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationSecurityGroupName", input) } - return &id, nil + return nil } // ValidateApplicationSecurityGroupID checks that 'input' can be parsed as a Application Security Group ID diff --git a/resource-manager/network/2023-04-01/availabledelegations/id_location.go b/resource-manager/network/2023-04-01/availabledelegations/id_location.go index a6a158e88e6..92bfc72a62b 100644 --- a/resource-manager/network/2023-04-01/availabledelegations/id_location.go +++ b/resource-manager/network/2023-04-01/availabledelegations/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/network/2023-04-01/availabledelegations/id_providerlocation.go b/resource-manager/network/2023-04-01/availabledelegations/id_providerlocation.go index a5f5134b65c..8fdfc45fb95 100644 --- a/resource-manager/network/2023-04-01/availabledelegations/id_providerlocation.go +++ b/resource-manager/network/2023-04-01/availabledelegations/id_providerlocation.go @@ -36,19 +36,9 @@ func ParseProviderLocationID(input string) (*ProviderLocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderLocationIDInsensitively(input string) (*ProviderLocationId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderLocationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateProviderLocationID checks that 'input' can be parsed as a Provider Location ID diff --git a/resource-manager/network/2023-04-01/availableservicealiases/id_location.go b/resource-manager/network/2023-04-01/availableservicealiases/id_location.go index 7d25a1ec759..98a110bc9e5 100644 --- a/resource-manager/network/2023-04-01/availableservicealiases/id_location.go +++ b/resource-manager/network/2023-04-01/availableservicealiases/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/network/2023-04-01/availableservicealiases/id_providerlocation.go b/resource-manager/network/2023-04-01/availableservicealiases/id_providerlocation.go index 0eb12f2b132..5d51d89a821 100644 --- a/resource-manager/network/2023-04-01/availableservicealiases/id_providerlocation.go +++ b/resource-manager/network/2023-04-01/availableservicealiases/id_providerlocation.go @@ -36,19 +36,9 @@ func ParseProviderLocationID(input string) (*ProviderLocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderLocationIDInsensitively(input string) (*ProviderLocationId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderLocationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateProviderLocationID checks that 'input' can be parsed as a Provider Location ID diff --git a/resource-manager/network/2023-04-01/azurefirewalls/id_azurefirewall.go b/resource-manager/network/2023-04-01/azurefirewalls/id_azurefirewall.go index 1c8e506ab97..e1afeeca58f 100644 --- a/resource-manager/network/2023-04-01/azurefirewalls/id_azurefirewall.go +++ b/resource-manager/network/2023-04-01/azurefirewalls/id_azurefirewall.go @@ -36,19 +36,9 @@ func ParseAzureFirewallID(input string) (*AzureFirewallId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AzureFirewallId{} - - 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.AzureFirewallName, ok = parsed.Parsed["azureFirewallName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "azureFirewallName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAzureFirewallIDInsensitively(input string) (*AzureFirewallId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AzureFirewallId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AzureFirewallId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AzureFirewallName, ok = parsed.Parsed["azureFirewallName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "azureFirewallName", *parsed) + if id.AzureFirewallName, ok = input.Parsed["azureFirewallName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "azureFirewallName", input) } - return &id, nil + return nil } // ValidateAzureFirewallID checks that 'input' can be parsed as a Azure Firewall ID diff --git a/resource-manager/network/2023-04-01/bastionhosts/id_bastionhost.go b/resource-manager/network/2023-04-01/bastionhosts/id_bastionhost.go index deb83136787..b9b0bd95a9b 100644 --- a/resource-manager/network/2023-04-01/bastionhosts/id_bastionhost.go +++ b/resource-manager/network/2023-04-01/bastionhosts/id_bastionhost.go @@ -36,19 +36,9 @@ func ParseBastionHostID(input string) (*BastionHostId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BastionHostId{} - - 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.BastionHostName, ok = parsed.Parsed["bastionHostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bastionHostName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseBastionHostIDInsensitively(input string) (*BastionHostId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BastionHostId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *BastionHostId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BastionHostName, ok = parsed.Parsed["bastionHostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bastionHostName", *parsed) + if id.BastionHostName, ok = input.Parsed["bastionHostName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "bastionHostName", input) } - return &id, nil + return nil } // ValidateBastionHostID checks that 'input' can be parsed as a Bastion Host ID diff --git a/resource-manager/network/2023-04-01/bastionshareablelink/id_bastionhost.go b/resource-manager/network/2023-04-01/bastionshareablelink/id_bastionhost.go index 28c97854f8d..b000a81dd74 100644 --- a/resource-manager/network/2023-04-01/bastionshareablelink/id_bastionhost.go +++ b/resource-manager/network/2023-04-01/bastionshareablelink/id_bastionhost.go @@ -36,19 +36,9 @@ func ParseBastionHostID(input string) (*BastionHostId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BastionHostId{} - - 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.BastionHostName, ok = parsed.Parsed["bastionHostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bastionHostName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseBastionHostIDInsensitively(input string) (*BastionHostId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BastionHostId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *BastionHostId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BastionHostName, ok = parsed.Parsed["bastionHostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bastionHostName", *parsed) + if id.BastionHostName, ok = input.Parsed["bastionHostName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "bastionHostName", input) } - return &id, nil + return nil } // ValidateBastionHostID checks that 'input' can be parsed as a Bastion Host ID diff --git a/resource-manager/network/2023-04-01/checkdnsavailabilities/id_location.go b/resource-manager/network/2023-04-01/checkdnsavailabilities/id_location.go index 474bff1709b..6b84973a31b 100644 --- a/resource-manager/network/2023-04-01/checkdnsavailabilities/id_location.go +++ b/resource-manager/network/2023-04-01/checkdnsavailabilities/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/network/2023-04-01/cloudservicepublicipaddresses/id_providercloudservice.go b/resource-manager/network/2023-04-01/cloudservicepublicipaddresses/id_providercloudservice.go index 0a86336f5d8..135ae6b32ec 100644 --- a/resource-manager/network/2023-04-01/cloudservicepublicipaddresses/id_providercloudservice.go +++ b/resource-manager/network/2023-04-01/cloudservicepublicipaddresses/id_providercloudservice.go @@ -36,19 +36,9 @@ func ParseProviderCloudServiceID(input string) (*ProviderCloudServiceId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderCloudServiceId{} - - 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.CloudServiceName, ok = parsed.Parsed["cloudServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderCloudServiceIDInsensitively(input string) (*ProviderCloudServi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderCloudServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderCloudServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CloudServiceName, ok = parsed.Parsed["cloudServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", *parsed) + if id.CloudServiceName, ok = input.Parsed["cloudServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", input) } - return &id, nil + return nil } // ValidateProviderCloudServiceID checks that 'input' can be parsed as a Provider Cloud Service ID diff --git a/resource-manager/network/2023-04-01/connectionmonitors/id_connectionmonitor.go b/resource-manager/network/2023-04-01/connectionmonitors/id_connectionmonitor.go index a7922c2d666..59380596a99 100644 --- a/resource-manager/network/2023-04-01/connectionmonitors/id_connectionmonitor.go +++ b/resource-manager/network/2023-04-01/connectionmonitors/id_connectionmonitor.go @@ -38,23 +38,9 @@ func ParseConnectionMonitorID(input string) (*ConnectionMonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionMonitorId{} - - 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.NetworkWatcherName, ok = parsed.Parsed["networkWatcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", *parsed) - } - - if id.ConnectionMonitorName, ok = parsed.Parsed["connectionMonitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionMonitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConnectionMonitorIDInsensitively(input string) (*ConnectionMonitorId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionMonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConnectionMonitorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkWatcherName, ok = parsed.Parsed["networkWatcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", *parsed) + if id.NetworkWatcherName, ok = input.Parsed["networkWatcherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", input) } - if id.ConnectionMonitorName, ok = parsed.Parsed["connectionMonitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionMonitorName", *parsed) + if id.ConnectionMonitorName, ok = input.Parsed["connectionMonitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectionMonitorName", input) } - return &id, nil + return nil } // ValidateConnectionMonitorID checks that 'input' can be parsed as a Connection Monitor ID diff --git a/resource-manager/network/2023-04-01/connectionmonitors/id_networkwatcher.go b/resource-manager/network/2023-04-01/connectionmonitors/id_networkwatcher.go index 9827216a58b..363c1317ad3 100644 --- a/resource-manager/network/2023-04-01/connectionmonitors/id_networkwatcher.go +++ b/resource-manager/network/2023-04-01/connectionmonitors/id_networkwatcher.go @@ -36,19 +36,9 @@ func ParseNetworkWatcherID(input string) (*NetworkWatcherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkWatcherId{} - - 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.NetworkWatcherName, ok = parsed.Parsed["networkWatcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkWatcherIDInsensitively(input string) (*NetworkWatcherId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkWatcherId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkWatcherId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkWatcherName, ok = parsed.Parsed["networkWatcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", *parsed) + if id.NetworkWatcherName, ok = input.Parsed["networkWatcherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", input) } - return &id, nil + return nil } // ValidateNetworkWatcherID checks that 'input' can be parsed as a Network Watcher ID diff --git a/resource-manager/network/2023-04-01/connectivityconfigurations/id_connectivityconfiguration.go b/resource-manager/network/2023-04-01/connectivityconfigurations/id_connectivityconfiguration.go index 65487e1c102..5d5da37b711 100644 --- a/resource-manager/network/2023-04-01/connectivityconfigurations/id_connectivityconfiguration.go +++ b/resource-manager/network/2023-04-01/connectivityconfigurations/id_connectivityconfiguration.go @@ -38,23 +38,9 @@ func ParseConnectivityConfigurationID(input string) (*ConnectivityConfigurationI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectivityConfigurationId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) - } - - if id.ConnectivityConfigurationName, ok = parsed.Parsed["connectivityConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectivityConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConnectivityConfigurationIDInsensitively(input string) (*ConnectivityC return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectivityConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConnectivityConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - if id.ConnectivityConfigurationName, ok = parsed.Parsed["connectivityConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectivityConfigurationName", *parsed) + if id.ConnectivityConfigurationName, ok = input.Parsed["connectivityConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectivityConfigurationName", input) } - return &id, nil + return nil } // ValidateConnectivityConfigurationID checks that 'input' can be parsed as a Connectivity Configuration ID diff --git a/resource-manager/network/2023-04-01/connectivityconfigurations/id_networkmanager.go b/resource-manager/network/2023-04-01/connectivityconfigurations/id_networkmanager.go index 087c284a6d4..ec4128ee5c8 100644 --- a/resource-manager/network/2023-04-01/connectivityconfigurations/id_networkmanager.go +++ b/resource-manager/network/2023-04-01/connectivityconfigurations/id_networkmanager.go @@ -36,19 +36,9 @@ func ParseNetworkManagerID(input string) (*NetworkManagerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkManagerId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkManagerIDInsensitively(input string) (*NetworkManagerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkManagerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkManagerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - return &id, nil + return nil } // ValidateNetworkManagerID checks that 'input' can be parsed as a Network Manager ID diff --git a/resource-manager/network/2023-04-01/customipprefixes/id_customipprefix.go b/resource-manager/network/2023-04-01/customipprefixes/id_customipprefix.go index 088e2b59a9a..a409949ab9a 100644 --- a/resource-manager/network/2023-04-01/customipprefixes/id_customipprefix.go +++ b/resource-manager/network/2023-04-01/customipprefixes/id_customipprefix.go @@ -36,19 +36,9 @@ func ParseCustomIPPrefixID(input string) (*CustomIPPrefixId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CustomIPPrefixId{} - - 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.CustomIPPrefixName, ok = parsed.Parsed["customIPPrefixName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "customIPPrefixName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseCustomIPPrefixIDInsensitively(input string) (*CustomIPPrefixId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CustomIPPrefixId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CustomIPPrefixId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CustomIPPrefixName, ok = parsed.Parsed["customIPPrefixName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "customIPPrefixName", *parsed) + if id.CustomIPPrefixName, ok = input.Parsed["customIPPrefixName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "customIPPrefixName", input) } - return &id, nil + return nil } // ValidateCustomIPPrefixID checks that 'input' can be parsed as a Custom I P Prefix ID diff --git a/resource-manager/network/2023-04-01/ddoscustompolicies/id_ddoscustompolicy.go b/resource-manager/network/2023-04-01/ddoscustompolicies/id_ddoscustompolicy.go index 311930ea740..ad86631a79a 100644 --- a/resource-manager/network/2023-04-01/ddoscustompolicies/id_ddoscustompolicy.go +++ b/resource-manager/network/2023-04-01/ddoscustompolicies/id_ddoscustompolicy.go @@ -36,19 +36,9 @@ func ParseDdosCustomPolicyID(input string) (*DdosCustomPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DdosCustomPolicyId{} - - 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.DdosCustomPolicyName, ok = parsed.Parsed["ddosCustomPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ddosCustomPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDdosCustomPolicyIDInsensitively(input string) (*DdosCustomPolicyId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DdosCustomPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DdosCustomPolicyId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DdosCustomPolicyName, ok = parsed.Parsed["ddosCustomPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ddosCustomPolicyName", *parsed) + if id.DdosCustomPolicyName, ok = input.Parsed["ddosCustomPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ddosCustomPolicyName", input) } - return &id, nil + return nil } // ValidateDdosCustomPolicyID checks that 'input' can be parsed as a Ddos Custom Policy ID diff --git a/resource-manager/network/2023-04-01/ddosprotectionplans/id_ddosprotectionplan.go b/resource-manager/network/2023-04-01/ddosprotectionplans/id_ddosprotectionplan.go index 24d6a8f8f24..4dfddca2d86 100644 --- a/resource-manager/network/2023-04-01/ddosprotectionplans/id_ddosprotectionplan.go +++ b/resource-manager/network/2023-04-01/ddosprotectionplans/id_ddosprotectionplan.go @@ -36,19 +36,9 @@ func ParseDdosProtectionPlanID(input string) (*DdosProtectionPlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DdosProtectionPlanId{} - - 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.DdosProtectionPlanName, ok = parsed.Parsed["ddosProtectionPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ddosProtectionPlanName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDdosProtectionPlanIDInsensitively(input string) (*DdosProtectionPlanId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DdosProtectionPlanId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DdosProtectionPlanId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DdosProtectionPlanName, ok = parsed.Parsed["ddosProtectionPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ddosProtectionPlanName", *parsed) + if id.DdosProtectionPlanName, ok = input.Parsed["ddosProtectionPlanName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ddosProtectionPlanName", input) } - return &id, nil + return nil } // ValidateDdosProtectionPlanID checks that 'input' can be parsed as a Ddos Protection Plan ID diff --git a/resource-manager/network/2023-04-01/dscpconfiguration/id_dscpconfiguration.go b/resource-manager/network/2023-04-01/dscpconfiguration/id_dscpconfiguration.go index 4f0d024833c..6997820990c 100644 --- a/resource-manager/network/2023-04-01/dscpconfiguration/id_dscpconfiguration.go +++ b/resource-manager/network/2023-04-01/dscpconfiguration/id_dscpconfiguration.go @@ -36,19 +36,9 @@ func ParseDscpConfigurationID(input string) (*DscpConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DscpConfigurationId{} - - 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.DscpConfigurationName, ok = parsed.Parsed["dscpConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dscpConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDscpConfigurationIDInsensitively(input string) (*DscpConfigurationId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DscpConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DscpConfigurationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DscpConfigurationName, ok = parsed.Parsed["dscpConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dscpConfigurationName", *parsed) + if id.DscpConfigurationName, ok = input.Parsed["dscpConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dscpConfigurationName", input) } - return &id, nil + return nil } // ValidateDscpConfigurationID checks that 'input' can be parsed as a Dscp Configuration ID diff --git a/resource-manager/network/2023-04-01/endpointservices/id_location.go b/resource-manager/network/2023-04-01/endpointservices/id_location.go index cb3d2ffd4c8..5728b9db337 100644 --- a/resource-manager/network/2023-04-01/endpointservices/id_location.go +++ b/resource-manager/network/2023-04-01/endpointservices/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/network/2023-04-01/expressroutecircuitarptable/id_arptable.go b/resource-manager/network/2023-04-01/expressroutecircuitarptable/id_arptable.go index 0771397d6bb..4255998ba5b 100644 --- a/resource-manager/network/2023-04-01/expressroutecircuitarptable/id_arptable.go +++ b/resource-manager/network/2023-04-01/expressroutecircuitarptable/id_arptable.go @@ -40,27 +40,9 @@ func ParseArpTableID(input string) (*ArpTableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ArpTableId{} - - 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.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) - } - - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) - } - - if id.ArpTableName, ok = parsed.Parsed["arpTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "arpTableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseArpTableIDInsensitively(input string) (*ArpTableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ArpTableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ArpTableId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) + if id.ExpressRouteCircuitName, ok = input.Parsed["expressRouteCircuitName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", input) } - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) + if id.PeeringName, ok = input.Parsed["peeringName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "peeringName", input) } - if id.ArpTableName, ok = parsed.Parsed["arpTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "arpTableName", *parsed) + if id.ArpTableName, ok = input.Parsed["arpTableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "arpTableName", input) } - return &id, nil + return nil } // ValidateArpTableID checks that 'input' can be parsed as a Arp Table ID diff --git a/resource-manager/network/2023-04-01/expressroutecircuitauthorizations/id_authorization.go b/resource-manager/network/2023-04-01/expressroutecircuitauthorizations/id_authorization.go index 614f1572fa7..e0c5a60e3e6 100644 --- a/resource-manager/network/2023-04-01/expressroutecircuitauthorizations/id_authorization.go +++ b/resource-manager/network/2023-04-01/expressroutecircuitauthorizations/id_authorization.go @@ -38,23 +38,9 @@ func ParseAuthorizationID(input string) (*AuthorizationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationId{} - - 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.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) - } - - if id.AuthorizationName, ok = parsed.Parsed["authorizationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAuthorizationIDInsensitively(input string) (*AuthorizationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AuthorizationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) + if id.ExpressRouteCircuitName, ok = input.Parsed["expressRouteCircuitName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", input) } - if id.AuthorizationName, ok = parsed.Parsed["authorizationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationName", *parsed) + if id.AuthorizationName, ok = input.Parsed["authorizationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationName", input) } - return &id, nil + return nil } // ValidateAuthorizationID checks that 'input' can be parsed as a Authorization ID diff --git a/resource-manager/network/2023-04-01/expressroutecircuitauthorizations/id_expressroutecircuit.go b/resource-manager/network/2023-04-01/expressroutecircuitauthorizations/id_expressroutecircuit.go index 502b311d236..29b136159f3 100644 --- a/resource-manager/network/2023-04-01/expressroutecircuitauthorizations/id_expressroutecircuit.go +++ b/resource-manager/network/2023-04-01/expressroutecircuitauthorizations/id_expressroutecircuit.go @@ -36,19 +36,9 @@ func ParseExpressRouteCircuitID(input string) (*ExpressRouteCircuitId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteCircuitId{} - - 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.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseExpressRouteCircuitIDInsensitively(input string) (*ExpressRouteCircuit return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteCircuitId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ExpressRouteCircuitId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) + if id.ExpressRouteCircuitName, ok = input.Parsed["expressRouteCircuitName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", input) } - return &id, nil + return nil } // ValidateExpressRouteCircuitID checks that 'input' can be parsed as a Express Route Circuit ID diff --git a/resource-manager/network/2023-04-01/expressroutecircuitconnections/id_peeringconnection.go b/resource-manager/network/2023-04-01/expressroutecircuitconnections/id_peeringconnection.go index 4bdac2a095a..eba1c63329b 100644 --- a/resource-manager/network/2023-04-01/expressroutecircuitconnections/id_peeringconnection.go +++ b/resource-manager/network/2023-04-01/expressroutecircuitconnections/id_peeringconnection.go @@ -40,27 +40,9 @@ func ParsePeeringConnectionID(input string) (*PeeringConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PeeringConnectionId{} - - 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.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) - } - - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) - } - - if id.ConnectionName, ok = parsed.Parsed["connectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParsePeeringConnectionIDInsensitively(input string) (*PeeringConnectionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PeeringConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *PeeringConnectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) + if id.ExpressRouteCircuitName, ok = input.Parsed["expressRouteCircuitName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", input) } - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) + if id.PeeringName, ok = input.Parsed["peeringName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "peeringName", input) } - if id.ConnectionName, ok = parsed.Parsed["connectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionName", *parsed) + if id.ConnectionName, ok = input.Parsed["connectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectionName", input) } - return &id, nil + return nil } // ValidatePeeringConnectionID checks that 'input' can be parsed as a Peering Connection ID diff --git a/resource-manager/network/2023-04-01/expressroutecircuitpeerings/id_expressroutecircuit.go b/resource-manager/network/2023-04-01/expressroutecircuitpeerings/id_expressroutecircuit.go index 80bd7e639d7..b36253f5c4a 100644 --- a/resource-manager/network/2023-04-01/expressroutecircuitpeerings/id_expressroutecircuit.go +++ b/resource-manager/network/2023-04-01/expressroutecircuitpeerings/id_expressroutecircuit.go @@ -36,19 +36,9 @@ func ParseExpressRouteCircuitID(input string) (*ExpressRouteCircuitId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteCircuitId{} - - 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.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseExpressRouteCircuitIDInsensitively(input string) (*ExpressRouteCircuit return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteCircuitId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ExpressRouteCircuitId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) + if id.ExpressRouteCircuitName, ok = input.Parsed["expressRouteCircuitName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", input) } - return &id, nil + return nil } // ValidateExpressRouteCircuitID checks that 'input' can be parsed as a Express Route Circuit ID diff --git a/resource-manager/network/2023-04-01/expressroutecircuitroutestable/id_peeringroutetable.go b/resource-manager/network/2023-04-01/expressroutecircuitroutestable/id_peeringroutetable.go index b383a1c57d2..2aa9e827b69 100644 --- a/resource-manager/network/2023-04-01/expressroutecircuitroutestable/id_peeringroutetable.go +++ b/resource-manager/network/2023-04-01/expressroutecircuitroutestable/id_peeringroutetable.go @@ -40,27 +40,9 @@ func ParsePeeringRouteTableID(input string) (*PeeringRouteTableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PeeringRouteTableId{} - - 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.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) - } - - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) - } - - if id.RouteTableName, ok = parsed.Parsed["routeTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParsePeeringRouteTableIDInsensitively(input string) (*PeeringRouteTableId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PeeringRouteTableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *PeeringRouteTableId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) + if id.ExpressRouteCircuitName, ok = input.Parsed["expressRouteCircuitName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", input) } - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) + if id.PeeringName, ok = input.Parsed["peeringName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "peeringName", input) } - if id.RouteTableName, ok = parsed.Parsed["routeTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", *parsed) + if id.RouteTableName, ok = input.Parsed["routeTableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", input) } - return &id, nil + return nil } // ValidatePeeringRouteTableID checks that 'input' can be parsed as a Peering Route Table ID diff --git a/resource-manager/network/2023-04-01/expressroutecircuitroutestablesummary/id_routetablessummary.go b/resource-manager/network/2023-04-01/expressroutecircuitroutestablesummary/id_routetablessummary.go index 1cbf9698584..8f8c7f0a726 100644 --- a/resource-manager/network/2023-04-01/expressroutecircuitroutestablesummary/id_routetablessummary.go +++ b/resource-manager/network/2023-04-01/expressroutecircuitroutestablesummary/id_routetablessummary.go @@ -40,27 +40,9 @@ func ParseRouteTablesSummaryID(input string) (*RouteTablesSummaryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteTablesSummaryId{} - - 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.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) - } - - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) - } - - if id.RouteTablesSummaryName, ok = parsed.Parsed["routeTablesSummaryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeTablesSummaryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseRouteTablesSummaryIDInsensitively(input string) (*RouteTablesSummaryId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteTablesSummaryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RouteTablesSummaryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) + if id.ExpressRouteCircuitName, ok = input.Parsed["expressRouteCircuitName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", input) } - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) + if id.PeeringName, ok = input.Parsed["peeringName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "peeringName", input) } - if id.RouteTablesSummaryName, ok = parsed.Parsed["routeTablesSummaryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeTablesSummaryName", *parsed) + if id.RouteTablesSummaryName, ok = input.Parsed["routeTablesSummaryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routeTablesSummaryName", input) } - return &id, nil + return nil } // ValidateRouteTablesSummaryID checks that 'input' can be parsed as a Route Tables Summary ID diff --git a/resource-manager/network/2023-04-01/expressroutecircuits/id_expressroutecircuit.go b/resource-manager/network/2023-04-01/expressroutecircuits/id_expressroutecircuit.go index 76f0cad7940..386f2129eb8 100644 --- a/resource-manager/network/2023-04-01/expressroutecircuits/id_expressroutecircuit.go +++ b/resource-manager/network/2023-04-01/expressroutecircuits/id_expressroutecircuit.go @@ -36,19 +36,9 @@ func ParseExpressRouteCircuitID(input string) (*ExpressRouteCircuitId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteCircuitId{} - - 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.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseExpressRouteCircuitIDInsensitively(input string) (*ExpressRouteCircuit return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteCircuitId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ExpressRouteCircuitId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) + if id.ExpressRouteCircuitName, ok = input.Parsed["expressRouteCircuitName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", input) } - return &id, nil + return nil } // ValidateExpressRouteCircuitID checks that 'input' can be parsed as a Express Route Circuit ID diff --git a/resource-manager/network/2023-04-01/expressroutecircuitstats/id_expressroutecircuit.go b/resource-manager/network/2023-04-01/expressroutecircuitstats/id_expressroutecircuit.go index 8f5bdbd93bb..defd9b84aac 100644 --- a/resource-manager/network/2023-04-01/expressroutecircuitstats/id_expressroutecircuit.go +++ b/resource-manager/network/2023-04-01/expressroutecircuitstats/id_expressroutecircuit.go @@ -36,19 +36,9 @@ func ParseExpressRouteCircuitID(input string) (*ExpressRouteCircuitId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteCircuitId{} - - 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.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseExpressRouteCircuitIDInsensitively(input string) (*ExpressRouteCircuit return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteCircuitId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ExpressRouteCircuitId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) + if id.ExpressRouteCircuitName, ok = input.Parsed["expressRouteCircuitName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", input) } - return &id, nil + return nil } // ValidateExpressRouteCircuitID checks that 'input' can be parsed as a Express Route Circuit ID diff --git a/resource-manager/network/2023-04-01/expressrouteconnections/id_expressrouteconnection.go b/resource-manager/network/2023-04-01/expressrouteconnections/id_expressrouteconnection.go index 9df4b46202b..b43720635d6 100644 --- a/resource-manager/network/2023-04-01/expressrouteconnections/id_expressrouteconnection.go +++ b/resource-manager/network/2023-04-01/expressrouteconnections/id_expressrouteconnection.go @@ -38,23 +38,9 @@ func ParseExpressRouteConnectionID(input string) (*ExpressRouteConnectionId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteConnectionId{} - - 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.ExpressRouteGatewayName, ok = parsed.Parsed["expressRouteGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteGatewayName", *parsed) - } - - if id.ExpressRouteConnectionName, ok = parsed.Parsed["expressRouteConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseExpressRouteConnectionIDInsensitively(input string) (*ExpressRouteConn return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ExpressRouteConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteGatewayName, ok = parsed.Parsed["expressRouteGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteGatewayName", *parsed) + if id.ExpressRouteGatewayName, ok = input.Parsed["expressRouteGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteGatewayName", input) } - if id.ExpressRouteConnectionName, ok = parsed.Parsed["expressRouteConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteConnectionName", *parsed) + if id.ExpressRouteConnectionName, ok = input.Parsed["expressRouteConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteConnectionName", input) } - return &id, nil + return nil } // ValidateExpressRouteConnectionID checks that 'input' can be parsed as a Express Route Connection ID diff --git a/resource-manager/network/2023-04-01/expressrouteconnections/id_expressroutegateway.go b/resource-manager/network/2023-04-01/expressrouteconnections/id_expressroutegateway.go index a697ea8a7e4..25fd28d50f5 100644 --- a/resource-manager/network/2023-04-01/expressrouteconnections/id_expressroutegateway.go +++ b/resource-manager/network/2023-04-01/expressrouteconnections/id_expressroutegateway.go @@ -36,19 +36,9 @@ func ParseExpressRouteGatewayID(input string) (*ExpressRouteGatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteGatewayId{} - - 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.ExpressRouteGatewayName, ok = parsed.Parsed["expressRouteGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteGatewayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseExpressRouteGatewayIDInsensitively(input string) (*ExpressRouteGateway return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteGatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ExpressRouteGatewayId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteGatewayName, ok = parsed.Parsed["expressRouteGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteGatewayName", *parsed) + if id.ExpressRouteGatewayName, ok = input.Parsed["expressRouteGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteGatewayName", input) } - return &id, nil + return nil } // ValidateExpressRouteGatewayID checks that 'input' can be parsed as a Express Route Gateway ID diff --git a/resource-manager/network/2023-04-01/expressroutecrossconnectionarptable/id_peeringarptable.go b/resource-manager/network/2023-04-01/expressroutecrossconnectionarptable/id_peeringarptable.go index c7d0e4d6c08..1fa7715c5c3 100644 --- a/resource-manager/network/2023-04-01/expressroutecrossconnectionarptable/id_peeringarptable.go +++ b/resource-manager/network/2023-04-01/expressroutecrossconnectionarptable/id_peeringarptable.go @@ -40,27 +40,9 @@ func ParsePeeringArpTableID(input string) (*PeeringArpTableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PeeringArpTableId{} - - 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.ExpressRouteCrossConnectionName, ok = parsed.Parsed["expressRouteCrossConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", *parsed) - } - - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) - } - - if id.ArpTableName, ok = parsed.Parsed["arpTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "arpTableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParsePeeringArpTableIDInsensitively(input string) (*PeeringArpTableId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PeeringArpTableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *PeeringArpTableId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteCrossConnectionName, ok = parsed.Parsed["expressRouteCrossConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", *parsed) + if id.ExpressRouteCrossConnectionName, ok = input.Parsed["expressRouteCrossConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", input) } - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) + if id.PeeringName, ok = input.Parsed["peeringName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "peeringName", input) } - if id.ArpTableName, ok = parsed.Parsed["arpTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "arpTableName", *parsed) + if id.ArpTableName, ok = input.Parsed["arpTableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "arpTableName", input) } - return &id, nil + return nil } // ValidatePeeringArpTableID checks that 'input' can be parsed as a Peering Arp Table ID diff --git a/resource-manager/network/2023-04-01/expressroutecrossconnectionpeerings/id_expressroutecrossconnection.go b/resource-manager/network/2023-04-01/expressroutecrossconnectionpeerings/id_expressroutecrossconnection.go index c2abc2bcb6e..79fdcaa3b4a 100644 --- a/resource-manager/network/2023-04-01/expressroutecrossconnectionpeerings/id_expressroutecrossconnection.go +++ b/resource-manager/network/2023-04-01/expressroutecrossconnectionpeerings/id_expressroutecrossconnection.go @@ -36,19 +36,9 @@ func ParseExpressRouteCrossConnectionID(input string) (*ExpressRouteCrossConnect return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteCrossConnectionId{} - - 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.ExpressRouteCrossConnectionName, ok = parsed.Parsed["expressRouteCrossConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseExpressRouteCrossConnectionIDInsensitively(input string) (*ExpressRout return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteCrossConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ExpressRouteCrossConnectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteCrossConnectionName, ok = parsed.Parsed["expressRouteCrossConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", *parsed) + if id.ExpressRouteCrossConnectionName, ok = input.Parsed["expressRouteCrossConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", input) } - return &id, nil + return nil } // ValidateExpressRouteCrossConnectionID checks that 'input' can be parsed as a Express Route Cross Connection ID diff --git a/resource-manager/network/2023-04-01/expressroutecrossconnectionpeerings/id_peering.go b/resource-manager/network/2023-04-01/expressroutecrossconnectionpeerings/id_peering.go index 8ff1861f76d..c01ecaf33ae 100644 --- a/resource-manager/network/2023-04-01/expressroutecrossconnectionpeerings/id_peering.go +++ b/resource-manager/network/2023-04-01/expressroutecrossconnectionpeerings/id_peering.go @@ -38,23 +38,9 @@ func ParsePeeringID(input string) (*PeeringId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PeeringId{} - - 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.ExpressRouteCrossConnectionName, ok = parsed.Parsed["expressRouteCrossConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", *parsed) - } - - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePeeringIDInsensitively(input string) (*PeeringId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PeeringId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PeeringId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteCrossConnectionName, ok = parsed.Parsed["expressRouteCrossConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", *parsed) + if id.ExpressRouteCrossConnectionName, ok = input.Parsed["expressRouteCrossConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", input) } - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) + if id.PeeringName, ok = input.Parsed["peeringName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "peeringName", input) } - return &id, nil + return nil } // ValidatePeeringID checks that 'input' can be parsed as a Peering ID diff --git a/resource-manager/network/2023-04-01/expressroutecrossconnectionroutetable/id_expressroutecrossconnectionpeeringroutetable.go b/resource-manager/network/2023-04-01/expressroutecrossconnectionroutetable/id_expressroutecrossconnectionpeeringroutetable.go index 5c0a0ea5302..8b8c3b8bcb7 100644 --- a/resource-manager/network/2023-04-01/expressroutecrossconnectionroutetable/id_expressroutecrossconnectionpeeringroutetable.go +++ b/resource-manager/network/2023-04-01/expressroutecrossconnectionroutetable/id_expressroutecrossconnectionpeeringroutetable.go @@ -40,27 +40,9 @@ func ParseExpressRouteCrossConnectionPeeringRouteTableID(input string) (*Express return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteCrossConnectionPeeringRouteTableId{} - - 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.ExpressRouteCrossConnectionName, ok = parsed.Parsed["expressRouteCrossConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", *parsed) - } - - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) - } - - if id.RouteTableName, ok = parsed.Parsed["routeTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseExpressRouteCrossConnectionPeeringRouteTableIDInsensitively(input stri return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteCrossConnectionPeeringRouteTableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ExpressRouteCrossConnectionPeeringRouteTableId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteCrossConnectionName, ok = parsed.Parsed["expressRouteCrossConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", *parsed) + if id.ExpressRouteCrossConnectionName, ok = input.Parsed["expressRouteCrossConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", input) } - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) + if id.PeeringName, ok = input.Parsed["peeringName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "peeringName", input) } - if id.RouteTableName, ok = parsed.Parsed["routeTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", *parsed) + if id.RouteTableName, ok = input.Parsed["routeTableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", input) } - return &id, nil + return nil } // ValidateExpressRouteCrossConnectionPeeringRouteTableID checks that 'input' can be parsed as a Express Route Cross Connection Peering Route Table ID diff --git a/resource-manager/network/2023-04-01/expressroutecrossconnectionroutetablesummary/id_peeringroutetablessummary.go b/resource-manager/network/2023-04-01/expressroutecrossconnectionroutetablesummary/id_peeringroutetablessummary.go index d679350bf9b..cb2b91c3cb9 100644 --- a/resource-manager/network/2023-04-01/expressroutecrossconnectionroutetablesummary/id_peeringroutetablessummary.go +++ b/resource-manager/network/2023-04-01/expressroutecrossconnectionroutetablesummary/id_peeringroutetablessummary.go @@ -40,27 +40,9 @@ func ParsePeeringRouteTablesSummaryID(input string) (*PeeringRouteTablesSummaryI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PeeringRouteTablesSummaryId{} - - 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.ExpressRouteCrossConnectionName, ok = parsed.Parsed["expressRouteCrossConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", *parsed) - } - - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) - } - - if id.RouteTablesSummaryName, ok = parsed.Parsed["routeTablesSummaryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeTablesSummaryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParsePeeringRouteTablesSummaryIDInsensitively(input string) (*PeeringRouteT return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PeeringRouteTablesSummaryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *PeeringRouteTablesSummaryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteCrossConnectionName, ok = parsed.Parsed["expressRouteCrossConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", *parsed) + if id.ExpressRouteCrossConnectionName, ok = input.Parsed["expressRouteCrossConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", input) } - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) + if id.PeeringName, ok = input.Parsed["peeringName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "peeringName", input) } - if id.RouteTablesSummaryName, ok = parsed.Parsed["routeTablesSummaryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeTablesSummaryName", *parsed) + if id.RouteTablesSummaryName, ok = input.Parsed["routeTablesSummaryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routeTablesSummaryName", input) } - return &id, nil + return nil } // ValidatePeeringRouteTablesSummaryID checks that 'input' can be parsed as a Peering Route Tables Summary ID diff --git a/resource-manager/network/2023-04-01/expressroutecrossconnections/id_expressroutecrossconnection.go b/resource-manager/network/2023-04-01/expressroutecrossconnections/id_expressroutecrossconnection.go index a8eb6b95127..1007905256c 100644 --- a/resource-manager/network/2023-04-01/expressroutecrossconnections/id_expressroutecrossconnection.go +++ b/resource-manager/network/2023-04-01/expressroutecrossconnections/id_expressroutecrossconnection.go @@ -36,19 +36,9 @@ func ParseExpressRouteCrossConnectionID(input string) (*ExpressRouteCrossConnect return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteCrossConnectionId{} - - 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.ExpressRouteCrossConnectionName, ok = parsed.Parsed["expressRouteCrossConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseExpressRouteCrossConnectionIDInsensitively(input string) (*ExpressRout return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteCrossConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ExpressRouteCrossConnectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteCrossConnectionName, ok = parsed.Parsed["expressRouteCrossConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", *parsed) + if id.ExpressRouteCrossConnectionName, ok = input.Parsed["expressRouteCrossConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", input) } - return &id, nil + return nil } // ValidateExpressRouteCrossConnectionID checks that 'input' can be parsed as a Express Route Cross Connection ID diff --git a/resource-manager/network/2023-04-01/expressroutegateways/id_expressroutegateway.go b/resource-manager/network/2023-04-01/expressroutegateways/id_expressroutegateway.go index 4e9f6ccc25f..0e940d12bdf 100644 --- a/resource-manager/network/2023-04-01/expressroutegateways/id_expressroutegateway.go +++ b/resource-manager/network/2023-04-01/expressroutegateways/id_expressroutegateway.go @@ -36,19 +36,9 @@ func ParseExpressRouteGatewayID(input string) (*ExpressRouteGatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteGatewayId{} - - 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.ExpressRouteGatewayName, ok = parsed.Parsed["expressRouteGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteGatewayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseExpressRouteGatewayIDInsensitively(input string) (*ExpressRouteGateway return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteGatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ExpressRouteGatewayId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteGatewayName, ok = parsed.Parsed["expressRouteGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteGatewayName", *parsed) + if id.ExpressRouteGatewayName, ok = input.Parsed["expressRouteGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteGatewayName", input) } - return &id, nil + return nil } // ValidateExpressRouteGatewayID checks that 'input' can be parsed as a Express Route Gateway ID diff --git a/resource-manager/network/2023-04-01/expressroutelinks/id_expressrouteport.go b/resource-manager/network/2023-04-01/expressroutelinks/id_expressrouteport.go index 4c0b60ea457..1ddfc494185 100644 --- a/resource-manager/network/2023-04-01/expressroutelinks/id_expressrouteport.go +++ b/resource-manager/network/2023-04-01/expressroutelinks/id_expressrouteport.go @@ -36,19 +36,9 @@ func ParseExpressRoutePortID(input string) (*ExpressRoutePortId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRoutePortId{} - - 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.ExpressRoutePortName, ok = parsed.Parsed["expressRoutePortName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseExpressRoutePortIDInsensitively(input string) (*ExpressRoutePortId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRoutePortId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ExpressRoutePortId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRoutePortName, ok = parsed.Parsed["expressRoutePortName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortName", *parsed) + if id.ExpressRoutePortName, ok = input.Parsed["expressRoutePortName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortName", input) } - return &id, nil + return nil } // ValidateExpressRoutePortID checks that 'input' can be parsed as a Express Route Port ID diff --git a/resource-manager/network/2023-04-01/expressroutelinks/id_link.go b/resource-manager/network/2023-04-01/expressroutelinks/id_link.go index 39a80538a62..3e4266036c2 100644 --- a/resource-manager/network/2023-04-01/expressroutelinks/id_link.go +++ b/resource-manager/network/2023-04-01/expressroutelinks/id_link.go @@ -38,23 +38,9 @@ func ParseLinkID(input string) (*LinkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LinkId{} - - 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.ExpressRoutePortName, ok = parsed.Parsed["expressRoutePortName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortName", *parsed) - } - - if id.LinkName, ok = parsed.Parsed["linkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "linkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLinkIDInsensitively(input string) (*LinkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LinkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LinkId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRoutePortName, ok = parsed.Parsed["expressRoutePortName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortName", *parsed) + if id.ExpressRoutePortName, ok = input.Parsed["expressRoutePortName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortName", input) } - if id.LinkName, ok = parsed.Parsed["linkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "linkName", *parsed) + if id.LinkName, ok = input.Parsed["linkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "linkName", input) } - return &id, nil + return nil } // ValidateLinkID checks that 'input' can be parsed as a Link ID diff --git a/resource-manager/network/2023-04-01/expressrouteportauthorizations/id_expressrouteport.go b/resource-manager/network/2023-04-01/expressrouteportauthorizations/id_expressrouteport.go index be98e366b7f..a2222ad6d45 100644 --- a/resource-manager/network/2023-04-01/expressrouteportauthorizations/id_expressrouteport.go +++ b/resource-manager/network/2023-04-01/expressrouteportauthorizations/id_expressrouteport.go @@ -36,19 +36,9 @@ func ParseExpressRoutePortID(input string) (*ExpressRoutePortId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRoutePortId{} - - 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.ExpressRoutePortName, ok = parsed.Parsed["expressRoutePortName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseExpressRoutePortIDInsensitively(input string) (*ExpressRoutePortId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRoutePortId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ExpressRoutePortId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRoutePortName, ok = parsed.Parsed["expressRoutePortName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortName", *parsed) + if id.ExpressRoutePortName, ok = input.Parsed["expressRoutePortName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortName", input) } - return &id, nil + return nil } // ValidateExpressRoutePortID checks that 'input' can be parsed as a Express Route Port ID diff --git a/resource-manager/network/2023-04-01/expressrouteportauthorizations/id_expressrouteportauthorization.go b/resource-manager/network/2023-04-01/expressrouteportauthorizations/id_expressrouteportauthorization.go index 5b7042091d0..8af9ba18bf6 100644 --- a/resource-manager/network/2023-04-01/expressrouteportauthorizations/id_expressrouteportauthorization.go +++ b/resource-manager/network/2023-04-01/expressrouteportauthorizations/id_expressrouteportauthorization.go @@ -38,23 +38,9 @@ func ParseExpressRoutePortAuthorizationID(input string) (*ExpressRoutePortAuthor return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRoutePortAuthorizationId{} - - 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.ExpressRoutePortName, ok = parsed.Parsed["expressRoutePortName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortName", *parsed) - } - - if id.AuthorizationName, ok = parsed.Parsed["authorizationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseExpressRoutePortAuthorizationIDInsensitively(input string) (*ExpressRo return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRoutePortAuthorizationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ExpressRoutePortAuthorizationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRoutePortName, ok = parsed.Parsed["expressRoutePortName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortName", *parsed) + if id.ExpressRoutePortName, ok = input.Parsed["expressRoutePortName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortName", input) } - if id.AuthorizationName, ok = parsed.Parsed["authorizationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationName", *parsed) + if id.AuthorizationName, ok = input.Parsed["authorizationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationName", input) } - return &id, nil + return nil } // ValidateExpressRoutePortAuthorizationID checks that 'input' can be parsed as a Express Route Port Authorization ID diff --git a/resource-manager/network/2023-04-01/expressrouteports/id_expressrouteport.go b/resource-manager/network/2023-04-01/expressrouteports/id_expressrouteport.go index 2d3ef3fed81..ee7a7081bcc 100644 --- a/resource-manager/network/2023-04-01/expressrouteports/id_expressrouteport.go +++ b/resource-manager/network/2023-04-01/expressrouteports/id_expressrouteport.go @@ -36,19 +36,9 @@ func ParseExpressRoutePortID(input string) (*ExpressRoutePortId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRoutePortId{} - - 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.ExpressRoutePortName, ok = parsed.Parsed["expressRoutePortName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseExpressRoutePortIDInsensitively(input string) (*ExpressRoutePortId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRoutePortId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ExpressRoutePortId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRoutePortName, ok = parsed.Parsed["expressRoutePortName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortName", *parsed) + if id.ExpressRoutePortName, ok = input.Parsed["expressRoutePortName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortName", input) } - return &id, nil + return nil } // ValidateExpressRoutePortID checks that 'input' can be parsed as a Express Route Port ID diff --git a/resource-manager/network/2023-04-01/expressrouteportslocations/id_expressrouteportslocation.go b/resource-manager/network/2023-04-01/expressrouteportslocations/id_expressrouteportslocation.go index 096c43de667..bde80a447d3 100644 --- a/resource-manager/network/2023-04-01/expressrouteportslocations/id_expressrouteportslocation.go +++ b/resource-manager/network/2023-04-01/expressrouteportslocations/id_expressrouteportslocation.go @@ -34,15 +34,9 @@ func ParseExpressRoutePortsLocationID(input string) (*ExpressRoutePortsLocationI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRoutePortsLocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.ExpressRoutePortsLocationName, ok = parsed.Parsed["expressRoutePortsLocationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortsLocationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseExpressRoutePortsLocationIDInsensitively(input string) (*ExpressRouteP return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRoutePortsLocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ExpressRoutePortsLocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ExpressRoutePortsLocationName, ok = parsed.Parsed["expressRoutePortsLocationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortsLocationName", *parsed) + if id.ExpressRoutePortsLocationName, ok = input.Parsed["expressRoutePortsLocationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortsLocationName", input) } - return &id, nil + return nil } // ValidateExpressRoutePortsLocationID checks that 'input' can be parsed as a Express Route Ports Location ID diff --git a/resource-manager/network/2023-04-01/expressrouteproviderports/id_expressrouteproviderport.go b/resource-manager/network/2023-04-01/expressrouteproviderports/id_expressrouteproviderport.go index e7df5d969e9..c331d574152 100644 --- a/resource-manager/network/2023-04-01/expressrouteproviderports/id_expressrouteproviderport.go +++ b/resource-manager/network/2023-04-01/expressrouteproviderports/id_expressrouteproviderport.go @@ -34,15 +34,9 @@ func ParseExpressRouteProviderPortID(input string) (*ExpressRouteProviderPortId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteProviderPortId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.ExpressRouteProviderPortName, ok = parsed.Parsed["expressRouteProviderPortName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteProviderPortName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseExpressRouteProviderPortIDInsensitively(input string) (*ExpressRoutePr return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteProviderPortId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ExpressRouteProviderPortId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ExpressRouteProviderPortName, ok = parsed.Parsed["expressRouteProviderPortName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteProviderPortName", *parsed) + if id.ExpressRouteProviderPortName, ok = input.Parsed["expressRouteProviderPortName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteProviderPortName", input) } - return &id, nil + return nil } // ValidateExpressRouteProviderPortID checks that 'input' can be parsed as a Express Route Provider Port ID diff --git a/resource-manager/network/2023-04-01/firewallpolicies/id_firewallpolicy.go b/resource-manager/network/2023-04-01/firewallpolicies/id_firewallpolicy.go index 7b760ef341f..6cbb1ce8493 100644 --- a/resource-manager/network/2023-04-01/firewallpolicies/id_firewallpolicy.go +++ b/resource-manager/network/2023-04-01/firewallpolicies/id_firewallpolicy.go @@ -36,19 +36,9 @@ func ParseFirewallPolicyID(input string) (*FirewallPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallPolicyId{} - - 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.FirewallPolicyName, ok = parsed.Parsed["firewallPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFirewallPolicyIDInsensitively(input string) (*FirewallPolicyId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FirewallPolicyId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FirewallPolicyName, ok = parsed.Parsed["firewallPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallPolicyName", *parsed) + if id.FirewallPolicyName, ok = input.Parsed["firewallPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "firewallPolicyName", input) } - return &id, nil + return nil } // ValidateFirewallPolicyID checks that 'input' can be parsed as a Firewall Policy ID diff --git a/resource-manager/network/2023-04-01/firewallpolicyrulecollectiongroups/id_firewallpolicy.go b/resource-manager/network/2023-04-01/firewallpolicyrulecollectiongroups/id_firewallpolicy.go index 0ab64308936..2082c31895f 100644 --- a/resource-manager/network/2023-04-01/firewallpolicyrulecollectiongroups/id_firewallpolicy.go +++ b/resource-manager/network/2023-04-01/firewallpolicyrulecollectiongroups/id_firewallpolicy.go @@ -36,19 +36,9 @@ func ParseFirewallPolicyID(input string) (*FirewallPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallPolicyId{} - - 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.FirewallPolicyName, ok = parsed.Parsed["firewallPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFirewallPolicyIDInsensitively(input string) (*FirewallPolicyId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FirewallPolicyId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FirewallPolicyName, ok = parsed.Parsed["firewallPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallPolicyName", *parsed) + if id.FirewallPolicyName, ok = input.Parsed["firewallPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "firewallPolicyName", input) } - return &id, nil + return nil } // ValidateFirewallPolicyID checks that 'input' can be parsed as a Firewall Policy ID diff --git a/resource-manager/network/2023-04-01/firewallpolicyrulecollectiongroups/id_rulecollectiongroup.go b/resource-manager/network/2023-04-01/firewallpolicyrulecollectiongroups/id_rulecollectiongroup.go index 8ab322f77ac..a53efd19810 100644 --- a/resource-manager/network/2023-04-01/firewallpolicyrulecollectiongroups/id_rulecollectiongroup.go +++ b/resource-manager/network/2023-04-01/firewallpolicyrulecollectiongroups/id_rulecollectiongroup.go @@ -38,23 +38,9 @@ func ParseRuleCollectionGroupID(input string) (*RuleCollectionGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RuleCollectionGroupId{} - - 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.FirewallPolicyName, ok = parsed.Parsed["firewallPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallPolicyName", *parsed) - } - - if id.RuleCollectionGroupName, ok = parsed.Parsed["ruleCollectionGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleCollectionGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRuleCollectionGroupIDInsensitively(input string) (*RuleCollectionGroup return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RuleCollectionGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RuleCollectionGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FirewallPolicyName, ok = parsed.Parsed["firewallPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallPolicyName", *parsed) + if id.FirewallPolicyName, ok = input.Parsed["firewallPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "firewallPolicyName", input) } - if id.RuleCollectionGroupName, ok = parsed.Parsed["ruleCollectionGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleCollectionGroupName", *parsed) + if id.RuleCollectionGroupName, ok = input.Parsed["ruleCollectionGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleCollectionGroupName", input) } - return &id, nil + return nil } // ValidateRuleCollectionGroupID checks that 'input' can be parsed as a Rule Collection Group ID diff --git a/resource-manager/network/2023-04-01/flowlogs/id_flowlog.go b/resource-manager/network/2023-04-01/flowlogs/id_flowlog.go index 531b76451d0..aa2aae5403e 100644 --- a/resource-manager/network/2023-04-01/flowlogs/id_flowlog.go +++ b/resource-manager/network/2023-04-01/flowlogs/id_flowlog.go @@ -38,23 +38,9 @@ func ParseFlowLogID(input string) (*FlowLogId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlowLogId{} - - 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.NetworkWatcherName, ok = parsed.Parsed["networkWatcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", *parsed) - } - - if id.FlowLogName, ok = parsed.Parsed["flowLogName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flowLogName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFlowLogIDInsensitively(input string) (*FlowLogId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlowLogId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FlowLogId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkWatcherName, ok = parsed.Parsed["networkWatcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", *parsed) + if id.NetworkWatcherName, ok = input.Parsed["networkWatcherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", input) } - if id.FlowLogName, ok = parsed.Parsed["flowLogName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flowLogName", *parsed) + if id.FlowLogName, ok = input.Parsed["flowLogName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flowLogName", input) } - return &id, nil + return nil } // ValidateFlowLogID checks that 'input' can be parsed as a Flow Log ID diff --git a/resource-manager/network/2023-04-01/flowlogs/id_networkwatcher.go b/resource-manager/network/2023-04-01/flowlogs/id_networkwatcher.go index 5fc6d966ffe..3bbc6a1f659 100644 --- a/resource-manager/network/2023-04-01/flowlogs/id_networkwatcher.go +++ b/resource-manager/network/2023-04-01/flowlogs/id_networkwatcher.go @@ -36,19 +36,9 @@ func ParseNetworkWatcherID(input string) (*NetworkWatcherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkWatcherId{} - - 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.NetworkWatcherName, ok = parsed.Parsed["networkWatcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkWatcherIDInsensitively(input string) (*NetworkWatcherId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkWatcherId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkWatcherId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkWatcherName, ok = parsed.Parsed["networkWatcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", *parsed) + if id.NetworkWatcherName, ok = input.Parsed["networkWatcherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", input) } - return &id, nil + return nil } // ValidateNetworkWatcherID checks that 'input' can be parsed as a Network Watcher ID diff --git a/resource-manager/network/2023-04-01/ipallocations/id_ipallocation.go b/resource-manager/network/2023-04-01/ipallocations/id_ipallocation.go index 6e8aa2517f8..2a747377218 100644 --- a/resource-manager/network/2023-04-01/ipallocations/id_ipallocation.go +++ b/resource-manager/network/2023-04-01/ipallocations/id_ipallocation.go @@ -36,19 +36,9 @@ func ParseIPAllocationID(input string) (*IPAllocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IPAllocationId{} - - 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.IpAllocationName, ok = parsed.Parsed["ipAllocationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ipAllocationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseIPAllocationIDInsensitively(input string) (*IPAllocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IPAllocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *IPAllocationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.IpAllocationName, ok = parsed.Parsed["ipAllocationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ipAllocationName", *parsed) + if id.IpAllocationName, ok = input.Parsed["ipAllocationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ipAllocationName", input) } - return &id, nil + return nil } // ValidateIPAllocationID checks that 'input' can be parsed as a I P Allocation ID diff --git a/resource-manager/network/2023-04-01/ipgroups/id_ipgroup.go b/resource-manager/network/2023-04-01/ipgroups/id_ipgroup.go index 8ca4249bbd4..45902765d86 100644 --- a/resource-manager/network/2023-04-01/ipgroups/id_ipgroup.go +++ b/resource-manager/network/2023-04-01/ipgroups/id_ipgroup.go @@ -36,19 +36,9 @@ func ParseIPGroupID(input string) (*IPGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IPGroupId{} - - 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.IpGroupName, ok = parsed.Parsed["ipGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ipGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseIPGroupIDInsensitively(input string) (*IPGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IPGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *IPGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.IpGroupName, ok = parsed.Parsed["ipGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ipGroupName", *parsed) + if id.IpGroupName, ok = input.Parsed["ipGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ipGroupName", input) } - return &id, nil + return nil } // ValidateIPGroupID checks that 'input' can be parsed as a I P Group ID diff --git a/resource-manager/network/2023-04-01/loadbalancers/id_backendaddresspool.go b/resource-manager/network/2023-04-01/loadbalancers/id_backendaddresspool.go index 39e1f9356f9..8f5a557e2b8 100644 --- a/resource-manager/network/2023-04-01/loadbalancers/id_backendaddresspool.go +++ b/resource-manager/network/2023-04-01/loadbalancers/id_backendaddresspool.go @@ -38,23 +38,9 @@ func ParseBackendAddressPoolID(input string) (*BackendAddressPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackendAddressPoolId{} - - 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.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) - } - - if id.BackendAddressPoolName, ok = parsed.Parsed["backendAddressPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backendAddressPoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackendAddressPoolIDInsensitively(input string) (*BackendAddressPoolId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackendAddressPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackendAddressPoolId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) + if id.LoadBalancerName, ok = input.Parsed["loadBalancerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", input) } - if id.BackendAddressPoolName, ok = parsed.Parsed["backendAddressPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backendAddressPoolName", *parsed) + if id.BackendAddressPoolName, ok = input.Parsed["backendAddressPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backendAddressPoolName", input) } - return &id, nil + return nil } // ValidateBackendAddressPoolID checks that 'input' can be parsed as a Backend Address Pool ID diff --git a/resource-manager/network/2023-04-01/loadbalancers/id_frontendipconfiguration.go b/resource-manager/network/2023-04-01/loadbalancers/id_frontendipconfiguration.go index 9f6c3f96a03..aafe02ffabc 100644 --- a/resource-manager/network/2023-04-01/loadbalancers/id_frontendipconfiguration.go +++ b/resource-manager/network/2023-04-01/loadbalancers/id_frontendipconfiguration.go @@ -38,23 +38,9 @@ func ParseFrontendIPConfigurationID(input string) (*FrontendIPConfigurationId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FrontendIPConfigurationId{} - - 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.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) - } - - if id.FrontendIPConfigurationName, ok = parsed.Parsed["frontendIPConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "frontendIPConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFrontendIPConfigurationIDInsensitively(input string) (*FrontendIPConfi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FrontendIPConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FrontendIPConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) + if id.LoadBalancerName, ok = input.Parsed["loadBalancerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", input) } - if id.FrontendIPConfigurationName, ok = parsed.Parsed["frontendIPConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "frontendIPConfigurationName", *parsed) + if id.FrontendIPConfigurationName, ok = input.Parsed["frontendIPConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "frontendIPConfigurationName", input) } - return &id, nil + return nil } // ValidateFrontendIPConfigurationID checks that 'input' can be parsed as a Frontend I P Configuration ID diff --git a/resource-manager/network/2023-04-01/loadbalancers/id_inboundnatrule.go b/resource-manager/network/2023-04-01/loadbalancers/id_inboundnatrule.go index 8a803ad6788..6bd76e31f88 100644 --- a/resource-manager/network/2023-04-01/loadbalancers/id_inboundnatrule.go +++ b/resource-manager/network/2023-04-01/loadbalancers/id_inboundnatrule.go @@ -38,23 +38,9 @@ func ParseInboundNatRuleID(input string) (*InboundNatRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InboundNatRuleId{} - - 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.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) - } - - if id.InboundNatRuleName, ok = parsed.Parsed["inboundNatRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "inboundNatRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseInboundNatRuleIDInsensitively(input string) (*InboundNatRuleId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InboundNatRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *InboundNatRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) + if id.LoadBalancerName, ok = input.Parsed["loadBalancerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", input) } - if id.InboundNatRuleName, ok = parsed.Parsed["inboundNatRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "inboundNatRuleName", *parsed) + if id.InboundNatRuleName, ok = input.Parsed["inboundNatRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "inboundNatRuleName", input) } - return &id, nil + return nil } // ValidateInboundNatRuleID checks that 'input' can be parsed as a Inbound Nat Rule ID diff --git a/resource-manager/network/2023-04-01/loadbalancers/id_loadbalancer.go b/resource-manager/network/2023-04-01/loadbalancers/id_loadbalancer.go index 28f94e2cf3f..7bdb2e468e1 100644 --- a/resource-manager/network/2023-04-01/loadbalancers/id_loadbalancer.go +++ b/resource-manager/network/2023-04-01/loadbalancers/id_loadbalancer.go @@ -36,19 +36,9 @@ func ParseLoadBalancerID(input string) (*LoadBalancerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LoadBalancerId{} - - 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.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLoadBalancerIDInsensitively(input string) (*LoadBalancerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LoadBalancerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LoadBalancerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) + if id.LoadBalancerName, ok = input.Parsed["loadBalancerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", input) } - return &id, nil + return nil } // ValidateLoadBalancerID checks that 'input' can be parsed as a Load Balancer ID diff --git a/resource-manager/network/2023-04-01/loadbalancers/id_loadbalancerbackendaddresspool.go b/resource-manager/network/2023-04-01/loadbalancers/id_loadbalancerbackendaddresspool.go index 98ac08abc20..8698d328a33 100644 --- a/resource-manager/network/2023-04-01/loadbalancers/id_loadbalancerbackendaddresspool.go +++ b/resource-manager/network/2023-04-01/loadbalancers/id_loadbalancerbackendaddresspool.go @@ -38,23 +38,9 @@ func ParseLoadBalancerBackendAddressPoolID(input string) (*LoadBalancerBackendAd return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LoadBalancerBackendAddressPoolId{} - - 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.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) - } - - if id.BackendAddressPoolName, ok = parsed.Parsed["backendAddressPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backendAddressPoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLoadBalancerBackendAddressPoolIDInsensitively(input string) (*LoadBala return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LoadBalancerBackendAddressPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LoadBalancerBackendAddressPoolId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) + if id.LoadBalancerName, ok = input.Parsed["loadBalancerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", input) } - if id.BackendAddressPoolName, ok = parsed.Parsed["backendAddressPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backendAddressPoolName", *parsed) + if id.BackendAddressPoolName, ok = input.Parsed["backendAddressPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backendAddressPoolName", input) } - return &id, nil + return nil } // ValidateLoadBalancerBackendAddressPoolID checks that 'input' can be parsed as a Load Balancer Backend Address Pool ID diff --git a/resource-manager/network/2023-04-01/loadbalancers/id_loadbalancingrule.go b/resource-manager/network/2023-04-01/loadbalancers/id_loadbalancingrule.go index 4b3bb48b397..e5622c56f46 100644 --- a/resource-manager/network/2023-04-01/loadbalancers/id_loadbalancingrule.go +++ b/resource-manager/network/2023-04-01/loadbalancers/id_loadbalancingrule.go @@ -38,23 +38,9 @@ func ParseLoadBalancingRuleID(input string) (*LoadBalancingRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LoadBalancingRuleId{} - - 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.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) - } - - if id.LoadBalancingRuleName, ok = parsed.Parsed["loadBalancingRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancingRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLoadBalancingRuleIDInsensitively(input string) (*LoadBalancingRuleId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LoadBalancingRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LoadBalancingRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) + if id.LoadBalancerName, ok = input.Parsed["loadBalancerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", input) } - if id.LoadBalancingRuleName, ok = parsed.Parsed["loadBalancingRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancingRuleName", *parsed) + if id.LoadBalancingRuleName, ok = input.Parsed["loadBalancingRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "loadBalancingRuleName", input) } - return &id, nil + return nil } // ValidateLoadBalancingRuleID checks that 'input' can be parsed as a Load Balancing Rule ID diff --git a/resource-manager/network/2023-04-01/loadbalancers/id_location.go b/resource-manager/network/2023-04-01/loadbalancers/id_location.go index 3a2efc6db17..7a45a89e1ae 100644 --- a/resource-manager/network/2023-04-01/loadbalancers/id_location.go +++ b/resource-manager/network/2023-04-01/loadbalancers/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/network/2023-04-01/loadbalancers/id_outboundrule.go b/resource-manager/network/2023-04-01/loadbalancers/id_outboundrule.go index b2c3cafa61b..651a601a0f4 100644 --- a/resource-manager/network/2023-04-01/loadbalancers/id_outboundrule.go +++ b/resource-manager/network/2023-04-01/loadbalancers/id_outboundrule.go @@ -38,23 +38,9 @@ func ParseOutboundRuleID(input string) (*OutboundRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OutboundRuleId{} - - 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.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) - } - - if id.OutboundRuleName, ok = parsed.Parsed["outboundRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "outboundRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseOutboundRuleIDInsensitively(input string) (*OutboundRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OutboundRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OutboundRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) + if id.LoadBalancerName, ok = input.Parsed["loadBalancerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", input) } - if id.OutboundRuleName, ok = parsed.Parsed["outboundRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "outboundRuleName", *parsed) + if id.OutboundRuleName, ok = input.Parsed["outboundRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "outboundRuleName", input) } - return &id, nil + return nil } // ValidateOutboundRuleID checks that 'input' can be parsed as a Outbound Rule ID diff --git a/resource-manager/network/2023-04-01/loadbalancers/id_probe.go b/resource-manager/network/2023-04-01/loadbalancers/id_probe.go index 6307740b0b8..a6df1c3f1b1 100644 --- a/resource-manager/network/2023-04-01/loadbalancers/id_probe.go +++ b/resource-manager/network/2023-04-01/loadbalancers/id_probe.go @@ -38,23 +38,9 @@ func ParseProbeID(input string) (*ProbeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProbeId{} - - 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.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) - } - - if id.ProbeName, ok = parsed.Parsed["probeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "probeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProbeIDInsensitively(input string) (*ProbeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProbeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProbeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) + if id.LoadBalancerName, ok = input.Parsed["loadBalancerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", input) } - if id.ProbeName, ok = parsed.Parsed["probeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "probeName", *parsed) + if id.ProbeName, ok = input.Parsed["probeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "probeName", input) } - return &id, nil + return nil } // ValidateProbeID checks that 'input' can be parsed as a Probe ID diff --git a/resource-manager/network/2023-04-01/loadbalancers/id_providerloadbalancer.go b/resource-manager/network/2023-04-01/loadbalancers/id_providerloadbalancer.go index d93844028b6..c66a2652fd8 100644 --- a/resource-manager/network/2023-04-01/loadbalancers/id_providerloadbalancer.go +++ b/resource-manager/network/2023-04-01/loadbalancers/id_providerloadbalancer.go @@ -36,19 +36,9 @@ func ParseProviderLoadBalancerID(input string) (*ProviderLoadBalancerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLoadBalancerId{} - - 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.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderLoadBalancerIDInsensitively(input string) (*ProviderLoadBalanc return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLoadBalancerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderLoadBalancerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) + if id.LoadBalancerName, ok = input.Parsed["loadBalancerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", input) } - return &id, nil + return nil } // ValidateProviderLoadBalancerID checks that 'input' can be parsed as a Provider Load Balancer ID diff --git a/resource-manager/network/2023-04-01/localnetworkgateways/id_localnetworkgateway.go b/resource-manager/network/2023-04-01/localnetworkgateways/id_localnetworkgateway.go index 9e5a1b39e8c..6242e60495d 100644 --- a/resource-manager/network/2023-04-01/localnetworkgateways/id_localnetworkgateway.go +++ b/resource-manager/network/2023-04-01/localnetworkgateways/id_localnetworkgateway.go @@ -36,19 +36,9 @@ func ParseLocalNetworkGatewayID(input string) (*LocalNetworkGatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocalNetworkGatewayId{} - - 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.LocalNetworkGatewayName, ok = parsed.Parsed["localNetworkGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localNetworkGatewayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLocalNetworkGatewayIDInsensitively(input string) (*LocalNetworkGateway return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocalNetworkGatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LocalNetworkGatewayId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocalNetworkGatewayName, ok = parsed.Parsed["localNetworkGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localNetworkGatewayName", *parsed) + if id.LocalNetworkGatewayName, ok = input.Parsed["localNetworkGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "localNetworkGatewayName", input) } - return &id, nil + return nil } // ValidateLocalNetworkGatewayID checks that 'input' can be parsed as a Local Network Gateway ID diff --git a/resource-manager/network/2023-04-01/natgateways/id_natgateway.go b/resource-manager/network/2023-04-01/natgateways/id_natgateway.go index 2ce4673298f..2d35c738748 100644 --- a/resource-manager/network/2023-04-01/natgateways/id_natgateway.go +++ b/resource-manager/network/2023-04-01/natgateways/id_natgateway.go @@ -36,19 +36,9 @@ func ParseNatGatewayID(input string) (*NatGatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NatGatewayId{} - - 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.NatGatewayName, ok = parsed.Parsed["natGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "natGatewayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNatGatewayIDInsensitively(input string) (*NatGatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NatGatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NatGatewayId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NatGatewayName, ok = parsed.Parsed["natGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "natGatewayName", *parsed) + if id.NatGatewayName, ok = input.Parsed["natGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "natGatewayName", input) } - return &id, nil + return nil } // ValidateNatGatewayID checks that 'input' can be parsed as a Nat Gateway ID diff --git a/resource-manager/network/2023-04-01/networkgroups/id_networkgroup.go b/resource-manager/network/2023-04-01/networkgroups/id_networkgroup.go index e96f87ea6b4..186c7965e71 100644 --- a/resource-manager/network/2023-04-01/networkgroups/id_networkgroup.go +++ b/resource-manager/network/2023-04-01/networkgroups/id_networkgroup.go @@ -38,23 +38,9 @@ func ParseNetworkGroupID(input string) (*NetworkGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkGroupId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) - } - - if id.NetworkGroupName, ok = parsed.Parsed["networkGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseNetworkGroupIDInsensitively(input string) (*NetworkGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *NetworkGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - if id.NetworkGroupName, ok = parsed.Parsed["networkGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkGroupName", *parsed) + if id.NetworkGroupName, ok = input.Parsed["networkGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkGroupName", input) } - return &id, nil + return nil } // ValidateNetworkGroupID checks that 'input' can be parsed as a Network Group ID diff --git a/resource-manager/network/2023-04-01/networkgroups/id_networkmanager.go b/resource-manager/network/2023-04-01/networkgroups/id_networkmanager.go index 0524156947b..bcdb5221bdd 100644 --- a/resource-manager/network/2023-04-01/networkgroups/id_networkmanager.go +++ b/resource-manager/network/2023-04-01/networkgroups/id_networkmanager.go @@ -36,19 +36,9 @@ func ParseNetworkManagerID(input string) (*NetworkManagerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkManagerId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkManagerIDInsensitively(input string) (*NetworkManagerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkManagerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkManagerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - return &id, nil + return nil } // ValidateNetworkManagerID checks that 'input' can be parsed as a Network Manager ID diff --git a/resource-manager/network/2023-04-01/networkinterfaces/id_providercloudservice.go b/resource-manager/network/2023-04-01/networkinterfaces/id_providercloudservice.go index 3fcfcb53fc7..6493dd6d4f7 100644 --- a/resource-manager/network/2023-04-01/networkinterfaces/id_providercloudservice.go +++ b/resource-manager/network/2023-04-01/networkinterfaces/id_providercloudservice.go @@ -36,19 +36,9 @@ func ParseProviderCloudServiceID(input string) (*ProviderCloudServiceId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderCloudServiceId{} - - 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.CloudServiceName, ok = parsed.Parsed["cloudServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderCloudServiceIDInsensitively(input string) (*ProviderCloudServi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderCloudServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderCloudServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CloudServiceName, ok = parsed.Parsed["cloudServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", *parsed) + if id.CloudServiceName, ok = input.Parsed["cloudServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", input) } - return &id, nil + return nil } // ValidateProviderCloudServiceID checks that 'input' can be parsed as a Provider Cloud Service ID diff --git a/resource-manager/network/2023-04-01/networkinterfaces/id_roleinstance.go b/resource-manager/network/2023-04-01/networkinterfaces/id_roleinstance.go index 5c916d65fd8..8f24317428a 100644 --- a/resource-manager/network/2023-04-01/networkinterfaces/id_roleinstance.go +++ b/resource-manager/network/2023-04-01/networkinterfaces/id_roleinstance.go @@ -38,23 +38,9 @@ func ParseRoleInstanceID(input string) (*RoleInstanceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RoleInstanceId{} - - 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.CloudServiceName, ok = parsed.Parsed["cloudServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", *parsed) - } - - if id.RoleInstanceName, ok = parsed.Parsed["roleInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleInstanceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRoleInstanceIDInsensitively(input string) (*RoleInstanceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RoleInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RoleInstanceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CloudServiceName, ok = parsed.Parsed["cloudServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", *parsed) + if id.CloudServiceName, ok = input.Parsed["cloudServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", input) } - if id.RoleInstanceName, ok = parsed.Parsed["roleInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleInstanceName", *parsed) + if id.RoleInstanceName, ok = input.Parsed["roleInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "roleInstanceName", input) } - return &id, nil + return nil } // ValidateRoleInstanceID checks that 'input' can be parsed as a Role Instance ID diff --git a/resource-manager/network/2023-04-01/networkinterfaces/id_roleinstancenetworkinterface.go b/resource-manager/network/2023-04-01/networkinterfaces/id_roleinstancenetworkinterface.go index b0f618d319e..39a088a38c0 100644 --- a/resource-manager/network/2023-04-01/networkinterfaces/id_roleinstancenetworkinterface.go +++ b/resource-manager/network/2023-04-01/networkinterfaces/id_roleinstancenetworkinterface.go @@ -40,27 +40,9 @@ func ParseRoleInstanceNetworkInterfaceID(input string) (*RoleInstanceNetworkInte return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RoleInstanceNetworkInterfaceId{} - - 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.CloudServiceName, ok = parsed.Parsed["cloudServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", *parsed) - } - - if id.RoleInstanceName, ok = parsed.Parsed["roleInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleInstanceName", *parsed) - } - - if id.NetworkInterfaceName, ok = parsed.Parsed["networkInterfaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkInterfaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseRoleInstanceNetworkInterfaceIDInsensitively(input string) (*RoleInstan return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RoleInstanceNetworkInterfaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RoleInstanceNetworkInterfaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CloudServiceName, ok = parsed.Parsed["cloudServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", *parsed) + if id.CloudServiceName, ok = input.Parsed["cloudServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", input) } - if id.RoleInstanceName, ok = parsed.Parsed["roleInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleInstanceName", *parsed) + if id.RoleInstanceName, ok = input.Parsed["roleInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "roleInstanceName", input) } - if id.NetworkInterfaceName, ok = parsed.Parsed["networkInterfaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkInterfaceName", *parsed) + if id.NetworkInterfaceName, ok = input.Parsed["networkInterfaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkInterfaceName", input) } - return &id, nil + return nil } // ValidateRoleInstanceNetworkInterfaceID checks that 'input' can be parsed as a Role Instance Network Interface ID diff --git a/resource-manager/network/2023-04-01/networkinterfaces/id_tapconfiguration.go b/resource-manager/network/2023-04-01/networkinterfaces/id_tapconfiguration.go index c7879c40c1f..846e65a80a8 100644 --- a/resource-manager/network/2023-04-01/networkinterfaces/id_tapconfiguration.go +++ b/resource-manager/network/2023-04-01/networkinterfaces/id_tapconfiguration.go @@ -38,23 +38,9 @@ func ParseTapConfigurationID(input string) (*TapConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TapConfigurationId{} - - 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.NetworkInterfaceName, ok = parsed.Parsed["networkInterfaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkInterfaceName", *parsed) - } - - if id.TapConfigurationName, ok = parsed.Parsed["tapConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tapConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTapConfigurationIDInsensitively(input string) (*TapConfigurationId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TapConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TapConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkInterfaceName, ok = parsed.Parsed["networkInterfaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkInterfaceName", *parsed) + if id.NetworkInterfaceName, ok = input.Parsed["networkInterfaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkInterfaceName", input) } - if id.TapConfigurationName, ok = parsed.Parsed["tapConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tapConfigurationName", *parsed) + if id.TapConfigurationName, ok = input.Parsed["tapConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tapConfigurationName", input) } - return &id, nil + return nil } // ValidateTapConfigurationID checks that 'input' can be parsed as a Tap Configuration ID diff --git a/resource-manager/network/2023-04-01/networkinterfaces/id_virtualmachine.go b/resource-manager/network/2023-04-01/networkinterfaces/id_virtualmachine.go index c0c1dd29a1b..263ea367221 100644 --- a/resource-manager/network/2023-04-01/networkinterfaces/id_virtualmachine.go +++ b/resource-manager/network/2023-04-01/networkinterfaces/id_virtualmachine.go @@ -38,23 +38,9 @@ func ParseVirtualMachineID(input string) (*VirtualMachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) - } - - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualMachineIDInsensitively(input string) (*VirtualMachineId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - return &id, nil + return nil } // ValidateVirtualMachineID checks that 'input' can be parsed as a Virtual Machine ID diff --git a/resource-manager/network/2023-04-01/networkinterfaces/id_virtualmachinescaleset.go b/resource-manager/network/2023-04-01/networkinterfaces/id_virtualmachinescaleset.go index 8435bb247a2..04a66737ce3 100644 --- a/resource-manager/network/2023-04-01/networkinterfaces/id_virtualmachinescaleset.go +++ b/resource-manager/network/2023-04-01/networkinterfaces/id_virtualmachinescaleset.go @@ -36,19 +36,9 @@ func ParseVirtualMachineScaleSetID(input string) (*VirtualMachineScaleSetId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineScaleSetIDInsensitively(input string) (*VirtualMachineSc return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineScaleSetId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - return &id, nil + return nil } // ValidateVirtualMachineScaleSetID checks that 'input' can be parsed as a Virtual Machine Scale Set ID diff --git a/resource-manager/network/2023-04-01/networkmanageractiveconfigurations/id_networkmanager.go b/resource-manager/network/2023-04-01/networkmanageractiveconfigurations/id_networkmanager.go index eb40c45d568..1188c8c4e05 100644 --- a/resource-manager/network/2023-04-01/networkmanageractiveconfigurations/id_networkmanager.go +++ b/resource-manager/network/2023-04-01/networkmanageractiveconfigurations/id_networkmanager.go @@ -36,19 +36,9 @@ func ParseNetworkManagerID(input string) (*NetworkManagerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkManagerId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkManagerIDInsensitively(input string) (*NetworkManagerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkManagerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkManagerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - return &id, nil + return nil } // ValidateNetworkManagerID checks that 'input' can be parsed as a Network Manager ID diff --git a/resource-manager/network/2023-04-01/networkmanageractiveconnectivityconfigurations/id_networkmanager.go b/resource-manager/network/2023-04-01/networkmanageractiveconnectivityconfigurations/id_networkmanager.go index 6f686aaaba2..1bda39b2b1e 100644 --- a/resource-manager/network/2023-04-01/networkmanageractiveconnectivityconfigurations/id_networkmanager.go +++ b/resource-manager/network/2023-04-01/networkmanageractiveconnectivityconfigurations/id_networkmanager.go @@ -36,19 +36,9 @@ func ParseNetworkManagerID(input string) (*NetworkManagerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkManagerId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkManagerIDInsensitively(input string) (*NetworkManagerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkManagerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkManagerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - return &id, nil + return nil } // ValidateNetworkManagerID checks that 'input' can be parsed as a Network Manager ID diff --git a/resource-manager/network/2023-04-01/networkmanagerconnections/id_networkmanagerconnection.go b/resource-manager/network/2023-04-01/networkmanagerconnections/id_networkmanagerconnection.go index 257d0dbb580..0cee14099cf 100644 --- a/resource-manager/network/2023-04-01/networkmanagerconnections/id_networkmanagerconnection.go +++ b/resource-manager/network/2023-04-01/networkmanagerconnections/id_networkmanagerconnection.go @@ -34,15 +34,9 @@ func ParseNetworkManagerConnectionID(input string) (*NetworkManagerConnectionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkManagerConnectionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.NetworkManagerConnectionName, ok = parsed.Parsed["networkManagerConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseNetworkManagerConnectionIDInsensitively(input string) (*NetworkManager return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkManagerConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *NetworkManagerConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.NetworkManagerConnectionName, ok = parsed.Parsed["networkManagerConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerConnectionName", *parsed) + if id.NetworkManagerConnectionName, ok = input.Parsed["networkManagerConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerConnectionName", input) } - return &id, nil + return nil } // ValidateNetworkManagerConnectionID checks that 'input' can be parsed as a Network Manager Connection ID diff --git a/resource-manager/network/2023-04-01/networkmanagerconnections/id_providers2networkmanagerconnection.go b/resource-manager/network/2023-04-01/networkmanagerconnections/id_providers2networkmanagerconnection.go index eb0ead3de30..a6fa4fd9225 100644 --- a/resource-manager/network/2023-04-01/networkmanagerconnections/id_providers2networkmanagerconnection.go +++ b/resource-manager/network/2023-04-01/networkmanagerconnections/id_providers2networkmanagerconnection.go @@ -34,15 +34,9 @@ func ParseProviders2NetworkManagerConnectionID(input string) (*Providers2Network return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2NetworkManagerConnectionId{} - - if id.ManagementGroupId, ok = parsed.Parsed["managementGroupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managementGroupId", *parsed) - } - - if id.NetworkManagerConnectionName, ok = parsed.Parsed["networkManagerConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviders2NetworkManagerConnectionIDInsensitively(input string) (*Prov return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2NetworkManagerConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ManagementGroupId, ok = parsed.Parsed["managementGroupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managementGroupId", *parsed) + return &id, nil +} + +func (id *Providers2NetworkManagerConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ManagementGroupId, ok = input.Parsed["managementGroupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managementGroupId", input) } - if id.NetworkManagerConnectionName, ok = parsed.Parsed["networkManagerConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerConnectionName", *parsed) + if id.NetworkManagerConnectionName, ok = input.Parsed["networkManagerConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerConnectionName", input) } - return &id, nil + return nil } // ValidateProviders2NetworkManagerConnectionID checks that 'input' can be parsed as a Providers 2 Network Manager Connection ID diff --git a/resource-manager/network/2023-04-01/networkmanagers/id_networkmanager.go b/resource-manager/network/2023-04-01/networkmanagers/id_networkmanager.go index fa90a755a35..6ab905990a9 100644 --- a/resource-manager/network/2023-04-01/networkmanagers/id_networkmanager.go +++ b/resource-manager/network/2023-04-01/networkmanagers/id_networkmanager.go @@ -36,19 +36,9 @@ func ParseNetworkManagerID(input string) (*NetworkManagerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkManagerId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkManagerIDInsensitively(input string) (*NetworkManagerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkManagerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkManagerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - return &id, nil + return nil } // ValidateNetworkManagerID checks that 'input' can be parsed as a Network Manager ID diff --git a/resource-manager/network/2023-04-01/networkprofiles/id_networkprofile.go b/resource-manager/network/2023-04-01/networkprofiles/id_networkprofile.go index 0cacfb77d6a..75ac2822b5d 100644 --- a/resource-manager/network/2023-04-01/networkprofiles/id_networkprofile.go +++ b/resource-manager/network/2023-04-01/networkprofiles/id_networkprofile.go @@ -36,19 +36,9 @@ func ParseNetworkProfileID(input string) (*NetworkProfileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkProfileId{} - - 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.NetworkProfileName, ok = parsed.Parsed["networkProfileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkProfileName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkProfileIDInsensitively(input string) (*NetworkProfileId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkProfileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkProfileId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkProfileName, ok = parsed.Parsed["networkProfileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkProfileName", *parsed) + if id.NetworkProfileName, ok = input.Parsed["networkProfileName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkProfileName", input) } - return &id, nil + return nil } // ValidateNetworkProfileID checks that 'input' can be parsed as a Network Profile ID diff --git a/resource-manager/network/2023-04-01/networksecuritygroups/id_networksecuritygroup.go b/resource-manager/network/2023-04-01/networksecuritygroups/id_networksecuritygroup.go index 976358d972c..4714b6b6f8b 100644 --- a/resource-manager/network/2023-04-01/networksecuritygroups/id_networksecuritygroup.go +++ b/resource-manager/network/2023-04-01/networksecuritygroups/id_networksecuritygroup.go @@ -36,19 +36,9 @@ func ParseNetworkSecurityGroupID(input string) (*NetworkSecurityGroupId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkSecurityGroupId{} - - 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.NetworkSecurityGroupName, ok = parsed.Parsed["networkSecurityGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkSecurityGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkSecurityGroupIDInsensitively(input string) (*NetworkSecurityGro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkSecurityGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkSecurityGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkSecurityGroupName, ok = parsed.Parsed["networkSecurityGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkSecurityGroupName", *parsed) + if id.NetworkSecurityGroupName, ok = input.Parsed["networkSecurityGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkSecurityGroupName", input) } - return &id, nil + return nil } // ValidateNetworkSecurityGroupID checks that 'input' can be parsed as a Network Security Group ID diff --git a/resource-manager/network/2023-04-01/networkvirtualappliances/id_inboundsecurityrule.go b/resource-manager/network/2023-04-01/networkvirtualappliances/id_inboundsecurityrule.go index 57ed3f89cae..55aff9179bf 100644 --- a/resource-manager/network/2023-04-01/networkvirtualappliances/id_inboundsecurityrule.go +++ b/resource-manager/network/2023-04-01/networkvirtualappliances/id_inboundsecurityrule.go @@ -38,23 +38,9 @@ func ParseInboundSecurityRuleID(input string) (*InboundSecurityRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InboundSecurityRuleId{} - - 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.NetworkVirtualApplianceName, ok = parsed.Parsed["networkVirtualApplianceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceName", *parsed) - } - - if id.InboundSecurityRuleName, ok = parsed.Parsed["inboundSecurityRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "inboundSecurityRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseInboundSecurityRuleIDInsensitively(input string) (*InboundSecurityRule return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InboundSecurityRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *InboundSecurityRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkVirtualApplianceName, ok = parsed.Parsed["networkVirtualApplianceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceName", *parsed) + if id.NetworkVirtualApplianceName, ok = input.Parsed["networkVirtualApplianceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceName", input) } - if id.InboundSecurityRuleName, ok = parsed.Parsed["inboundSecurityRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "inboundSecurityRuleName", *parsed) + if id.InboundSecurityRuleName, ok = input.Parsed["inboundSecurityRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "inboundSecurityRuleName", input) } - return &id, nil + return nil } // ValidateInboundSecurityRuleID checks that 'input' can be parsed as a Inbound Security Rule ID diff --git a/resource-manager/network/2023-04-01/networkvirtualappliances/id_networkvirtualappliance.go b/resource-manager/network/2023-04-01/networkvirtualappliances/id_networkvirtualappliance.go index c4feaf36235..58a3908e643 100644 --- a/resource-manager/network/2023-04-01/networkvirtualappliances/id_networkvirtualappliance.go +++ b/resource-manager/network/2023-04-01/networkvirtualappliances/id_networkvirtualappliance.go @@ -36,19 +36,9 @@ func ParseNetworkVirtualApplianceID(input string) (*NetworkVirtualApplianceId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkVirtualApplianceId{} - - 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.NetworkVirtualApplianceName, ok = parsed.Parsed["networkVirtualApplianceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkVirtualApplianceIDInsensitively(input string) (*NetworkVirtualA return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkVirtualApplianceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkVirtualApplianceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkVirtualApplianceName, ok = parsed.Parsed["networkVirtualApplianceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceName", *parsed) + if id.NetworkVirtualApplianceName, ok = input.Parsed["networkVirtualApplianceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceName", input) } - return &id, nil + return nil } // ValidateNetworkVirtualApplianceID checks that 'input' can be parsed as a Network Virtual Appliance ID diff --git a/resource-manager/network/2023-04-01/networkwatchers/id_networkwatcher.go b/resource-manager/network/2023-04-01/networkwatchers/id_networkwatcher.go index 2cb57313a16..88102cbe0ba 100644 --- a/resource-manager/network/2023-04-01/networkwatchers/id_networkwatcher.go +++ b/resource-manager/network/2023-04-01/networkwatchers/id_networkwatcher.go @@ -36,19 +36,9 @@ func ParseNetworkWatcherID(input string) (*NetworkWatcherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkWatcherId{} - - 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.NetworkWatcherName, ok = parsed.Parsed["networkWatcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkWatcherIDInsensitively(input string) (*NetworkWatcherId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkWatcherId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkWatcherId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkWatcherName, ok = parsed.Parsed["networkWatcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", *parsed) + if id.NetworkWatcherName, ok = input.Parsed["networkWatcherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", input) } - return &id, nil + return nil } // ValidateNetworkWatcherID checks that 'input' can be parsed as a Network Watcher ID diff --git a/resource-manager/network/2023-04-01/packetcaptures/id_networkwatcher.go b/resource-manager/network/2023-04-01/packetcaptures/id_networkwatcher.go index b5478e241e2..05a87434be6 100644 --- a/resource-manager/network/2023-04-01/packetcaptures/id_networkwatcher.go +++ b/resource-manager/network/2023-04-01/packetcaptures/id_networkwatcher.go @@ -36,19 +36,9 @@ func ParseNetworkWatcherID(input string) (*NetworkWatcherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkWatcherId{} - - 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.NetworkWatcherName, ok = parsed.Parsed["networkWatcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkWatcherIDInsensitively(input string) (*NetworkWatcherId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkWatcherId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkWatcherId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkWatcherName, ok = parsed.Parsed["networkWatcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", *parsed) + if id.NetworkWatcherName, ok = input.Parsed["networkWatcherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", input) } - return &id, nil + return nil } // ValidateNetworkWatcherID checks that 'input' can be parsed as a Network Watcher ID diff --git a/resource-manager/network/2023-04-01/packetcaptures/id_packetcapture.go b/resource-manager/network/2023-04-01/packetcaptures/id_packetcapture.go index 57e35d5f1f2..e56233f86a2 100644 --- a/resource-manager/network/2023-04-01/packetcaptures/id_packetcapture.go +++ b/resource-manager/network/2023-04-01/packetcaptures/id_packetcapture.go @@ -38,23 +38,9 @@ func ParsePacketCaptureID(input string) (*PacketCaptureId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCaptureId{} - - 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.NetworkWatcherName, ok = parsed.Parsed["networkWatcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", *parsed) - } - - if id.PacketCaptureName, ok = parsed.Parsed["packetCaptureName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCaptureName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePacketCaptureIDInsensitively(input string) (*PacketCaptureId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCaptureId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PacketCaptureId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkWatcherName, ok = parsed.Parsed["networkWatcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", *parsed) + if id.NetworkWatcherName, ok = input.Parsed["networkWatcherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", input) } - if id.PacketCaptureName, ok = parsed.Parsed["packetCaptureName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCaptureName", *parsed) + if id.PacketCaptureName, ok = input.Parsed["packetCaptureName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCaptureName", input) } - return &id, nil + return nil } // ValidatePacketCaptureID checks that 'input' can be parsed as a Packet Capture ID diff --git a/resource-manager/network/2023-04-01/peerexpressroutecircuitconnections/id_peerconnection.go b/resource-manager/network/2023-04-01/peerexpressroutecircuitconnections/id_peerconnection.go index 9e974b3fad5..13e4d8f3184 100644 --- a/resource-manager/network/2023-04-01/peerexpressroutecircuitconnections/id_peerconnection.go +++ b/resource-manager/network/2023-04-01/peerexpressroutecircuitconnections/id_peerconnection.go @@ -40,27 +40,9 @@ func ParsePeerConnectionID(input string) (*PeerConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PeerConnectionId{} - - 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.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) - } - - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) - } - - if id.PeerConnectionName, ok = parsed.Parsed["peerConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peerConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParsePeerConnectionIDInsensitively(input string) (*PeerConnectionId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PeerConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *PeerConnectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) + if id.ExpressRouteCircuitName, ok = input.Parsed["expressRouteCircuitName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", input) } - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) + if id.PeeringName, ok = input.Parsed["peeringName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "peeringName", input) } - if id.PeerConnectionName, ok = parsed.Parsed["peerConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peerConnectionName", *parsed) + if id.PeerConnectionName, ok = input.Parsed["peerConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "peerConnectionName", input) } - return &id, nil + return nil } // ValidatePeerConnectionID checks that 'input' can be parsed as a Peer Connection ID diff --git a/resource-manager/network/2023-04-01/privatednszonegroups/id_privatednszonegroup.go b/resource-manager/network/2023-04-01/privatednszonegroups/id_privatednszonegroup.go index 532e498e159..c4cd41f32d5 100644 --- a/resource-manager/network/2023-04-01/privatednszonegroups/id_privatednszonegroup.go +++ b/resource-manager/network/2023-04-01/privatednszonegroups/id_privatednszonegroup.go @@ -38,23 +38,9 @@ func ParsePrivateDnsZoneGroupID(input string) (*PrivateDnsZoneGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateDnsZoneGroupId{} - - 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.PrivateEndpointName, ok = parsed.Parsed["privateEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointName", *parsed) - } - - if id.PrivateDnsZoneGroupName, ok = parsed.Parsed["privateDnsZoneGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateDnsZoneGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateDnsZoneGroupIDInsensitively(input string) (*PrivateDnsZoneGroup return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateDnsZoneGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateDnsZoneGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateEndpointName, ok = parsed.Parsed["privateEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointName", *parsed) + if id.PrivateEndpointName, ok = input.Parsed["privateEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointName", input) } - if id.PrivateDnsZoneGroupName, ok = parsed.Parsed["privateDnsZoneGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateDnsZoneGroupName", *parsed) + if id.PrivateDnsZoneGroupName, ok = input.Parsed["privateDnsZoneGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateDnsZoneGroupName", input) } - return &id, nil + return nil } // ValidatePrivateDnsZoneGroupID checks that 'input' can be parsed as a Private Dns Zone Group ID diff --git a/resource-manager/network/2023-04-01/privatednszonegroups/id_privateendpoint.go b/resource-manager/network/2023-04-01/privatednszonegroups/id_privateendpoint.go index a547392c0f3..16a2e56d16c 100644 --- a/resource-manager/network/2023-04-01/privatednszonegroups/id_privateendpoint.go +++ b/resource-manager/network/2023-04-01/privatednszonegroups/id_privateendpoint.go @@ -36,19 +36,9 @@ func ParsePrivateEndpointID(input string) (*PrivateEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointId{} - - 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.PrivateEndpointName, ok = parsed.Parsed["privateEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePrivateEndpointIDInsensitively(input string) (*PrivateEndpointId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PrivateEndpointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateEndpointName, ok = parsed.Parsed["privateEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointName", *parsed) + if id.PrivateEndpointName, ok = input.Parsed["privateEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointID checks that 'input' can be parsed as a Private Endpoint ID diff --git a/resource-manager/network/2023-04-01/privateendpoints/id_location.go b/resource-manager/network/2023-04-01/privateendpoints/id_location.go index 146a6110738..f2d86134426 100644 --- a/resource-manager/network/2023-04-01/privateendpoints/id_location.go +++ b/resource-manager/network/2023-04-01/privateendpoints/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/network/2023-04-01/privateendpoints/id_privateendpoint.go b/resource-manager/network/2023-04-01/privateendpoints/id_privateendpoint.go index 219fe0f7906..2122ecbbc30 100644 --- a/resource-manager/network/2023-04-01/privateendpoints/id_privateendpoint.go +++ b/resource-manager/network/2023-04-01/privateendpoints/id_privateendpoint.go @@ -36,19 +36,9 @@ func ParsePrivateEndpointID(input string) (*PrivateEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointId{} - - 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.PrivateEndpointName, ok = parsed.Parsed["privateEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePrivateEndpointIDInsensitively(input string) (*PrivateEndpointId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PrivateEndpointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateEndpointName, ok = parsed.Parsed["privateEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointName", *parsed) + if id.PrivateEndpointName, ok = input.Parsed["privateEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointID checks that 'input' can be parsed as a Private Endpoint ID diff --git a/resource-manager/network/2023-04-01/privateendpoints/id_providerlocation.go b/resource-manager/network/2023-04-01/privateendpoints/id_providerlocation.go index bdc082c0530..e412f544122 100644 --- a/resource-manager/network/2023-04-01/privateendpoints/id_providerlocation.go +++ b/resource-manager/network/2023-04-01/privateendpoints/id_providerlocation.go @@ -36,19 +36,9 @@ func ParseProviderLocationID(input string) (*ProviderLocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderLocationIDInsensitively(input string) (*ProviderLocationId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderLocationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateProviderLocationID checks that 'input' can be parsed as a Provider Location ID diff --git a/resource-manager/network/2023-04-01/privatelinkservice/id_privatelinkservice.go b/resource-manager/network/2023-04-01/privatelinkservice/id_privatelinkservice.go index 1565b227dbd..8eae2881181 100644 --- a/resource-manager/network/2023-04-01/privatelinkservice/id_privatelinkservice.go +++ b/resource-manager/network/2023-04-01/privatelinkservice/id_privatelinkservice.go @@ -36,19 +36,9 @@ func ParsePrivateLinkServiceID(input string) (*PrivateLinkServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkServiceId{} - - 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.PrivateLinkServiceName, ok = parsed.Parsed["privateLinkServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePrivateLinkServiceIDInsensitively(input string) (*PrivateLinkServiceId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PrivateLinkServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateLinkServiceName, ok = parsed.Parsed["privateLinkServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkServiceName", *parsed) + if id.PrivateLinkServiceName, ok = input.Parsed["privateLinkServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkServiceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkServiceID checks that 'input' can be parsed as a Private Link Service ID diff --git a/resource-manager/network/2023-04-01/privatelinkservices/id_location.go b/resource-manager/network/2023-04-01/privatelinkservices/id_location.go index 24e86662059..95e950e7e64 100644 --- a/resource-manager/network/2023-04-01/privatelinkservices/id_location.go +++ b/resource-manager/network/2023-04-01/privatelinkservices/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/network/2023-04-01/privatelinkservices/id_privateendpointconnection.go b/resource-manager/network/2023-04-01/privatelinkservices/id_privateendpointconnection.go index d6a66965d1b..d9cd7306b2c 100644 --- a/resource-manager/network/2023-04-01/privatelinkservices/id_privateendpointconnection.go +++ b/resource-manager/network/2023-04-01/privatelinkservices/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.PrivateLinkServiceName, ok = parsed.Parsed["privateLinkServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkServiceName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateLinkServiceName, ok = parsed.Parsed["privateLinkServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkServiceName", *parsed) + if id.PrivateLinkServiceName, ok = input.Parsed["privateLinkServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkServiceName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/network/2023-04-01/privatelinkservices/id_privatelinkservice.go b/resource-manager/network/2023-04-01/privatelinkservices/id_privatelinkservice.go index 94f3432277b..45249de5a73 100644 --- a/resource-manager/network/2023-04-01/privatelinkservices/id_privatelinkservice.go +++ b/resource-manager/network/2023-04-01/privatelinkservices/id_privatelinkservice.go @@ -36,19 +36,9 @@ func ParsePrivateLinkServiceID(input string) (*PrivateLinkServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkServiceId{} - - 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.PrivateLinkServiceName, ok = parsed.Parsed["privateLinkServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePrivateLinkServiceIDInsensitively(input string) (*PrivateLinkServiceId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PrivateLinkServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateLinkServiceName, ok = parsed.Parsed["privateLinkServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkServiceName", *parsed) + if id.PrivateLinkServiceName, ok = input.Parsed["privateLinkServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkServiceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkServiceID checks that 'input' can be parsed as a Private Link Service ID diff --git a/resource-manager/network/2023-04-01/privatelinkservices/id_providerlocation.go b/resource-manager/network/2023-04-01/privatelinkservices/id_providerlocation.go index 2b075dec749..16521a221cb 100644 --- a/resource-manager/network/2023-04-01/privatelinkservices/id_providerlocation.go +++ b/resource-manager/network/2023-04-01/privatelinkservices/id_providerlocation.go @@ -36,19 +36,9 @@ func ParseProviderLocationID(input string) (*ProviderLocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderLocationIDInsensitively(input string) (*ProviderLocationId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderLocationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateProviderLocationID checks that 'input' can be parsed as a Provider Location ID diff --git a/resource-manager/network/2023-04-01/publicipprefixes/id_publicipprefix.go b/resource-manager/network/2023-04-01/publicipprefixes/id_publicipprefix.go index 545d5140e51..8a54fd6b51e 100644 --- a/resource-manager/network/2023-04-01/publicipprefixes/id_publicipprefix.go +++ b/resource-manager/network/2023-04-01/publicipprefixes/id_publicipprefix.go @@ -36,19 +36,9 @@ func ParsePublicIPPrefixID(input string) (*PublicIPPrefixId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PublicIPPrefixId{} - - 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.PublicIPPrefixName, ok = parsed.Parsed["publicIPPrefixName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publicIPPrefixName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePublicIPPrefixIDInsensitively(input string) (*PublicIPPrefixId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PublicIPPrefixId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PublicIPPrefixId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PublicIPPrefixName, ok = parsed.Parsed["publicIPPrefixName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publicIPPrefixName", *parsed) + if id.PublicIPPrefixName, ok = input.Parsed["publicIPPrefixName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publicIPPrefixName", input) } - return &id, nil + return nil } // ValidatePublicIPPrefixID checks that 'input' can be parsed as a Public I P Prefix ID diff --git a/resource-manager/network/2023-04-01/routefilterrules/id_routefilter.go b/resource-manager/network/2023-04-01/routefilterrules/id_routefilter.go index 6ada8a037fc..20669cb3c9f 100644 --- a/resource-manager/network/2023-04-01/routefilterrules/id_routefilter.go +++ b/resource-manager/network/2023-04-01/routefilterrules/id_routefilter.go @@ -36,19 +36,9 @@ func ParseRouteFilterID(input string) (*RouteFilterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteFilterId{} - - 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.RouteFilterName, ok = parsed.Parsed["routeFilterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeFilterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRouteFilterIDInsensitively(input string) (*RouteFilterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteFilterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RouteFilterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RouteFilterName, ok = parsed.Parsed["routeFilterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeFilterName", *parsed) + if id.RouteFilterName, ok = input.Parsed["routeFilterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routeFilterName", input) } - return &id, nil + return nil } // ValidateRouteFilterID checks that 'input' can be parsed as a Route Filter ID diff --git a/resource-manager/network/2023-04-01/routefilterrules/id_routefilterrule.go b/resource-manager/network/2023-04-01/routefilterrules/id_routefilterrule.go index e4cf470acdc..fffc56ea557 100644 --- a/resource-manager/network/2023-04-01/routefilterrules/id_routefilterrule.go +++ b/resource-manager/network/2023-04-01/routefilterrules/id_routefilterrule.go @@ -38,23 +38,9 @@ func ParseRouteFilterRuleID(input string) (*RouteFilterRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteFilterRuleId{} - - 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.RouteFilterName, ok = parsed.Parsed["routeFilterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeFilterName", *parsed) - } - - if id.RouteFilterRuleName, ok = parsed.Parsed["routeFilterRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeFilterRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRouteFilterRuleIDInsensitively(input string) (*RouteFilterRuleId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteFilterRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RouteFilterRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RouteFilterName, ok = parsed.Parsed["routeFilterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeFilterName", *parsed) + if id.RouteFilterName, ok = input.Parsed["routeFilterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routeFilterName", input) } - if id.RouteFilterRuleName, ok = parsed.Parsed["routeFilterRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeFilterRuleName", *parsed) + if id.RouteFilterRuleName, ok = input.Parsed["routeFilterRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routeFilterRuleName", input) } - return &id, nil + return nil } // ValidateRouteFilterRuleID checks that 'input' can be parsed as a Route Filter Rule ID diff --git a/resource-manager/network/2023-04-01/routefilters/id_routefilter.go b/resource-manager/network/2023-04-01/routefilters/id_routefilter.go index 0d539e18cc3..4104bf0d154 100644 --- a/resource-manager/network/2023-04-01/routefilters/id_routefilter.go +++ b/resource-manager/network/2023-04-01/routefilters/id_routefilter.go @@ -36,19 +36,9 @@ func ParseRouteFilterID(input string) (*RouteFilterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteFilterId{} - - 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.RouteFilterName, ok = parsed.Parsed["routeFilterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeFilterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRouteFilterIDInsensitively(input string) (*RouteFilterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteFilterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RouteFilterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RouteFilterName, ok = parsed.Parsed["routeFilterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeFilterName", *parsed) + if id.RouteFilterName, ok = input.Parsed["routeFilterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routeFilterName", input) } - return &id, nil + return nil } // ValidateRouteFilterID checks that 'input' can be parsed as a Route Filter ID diff --git a/resource-manager/network/2023-04-01/routes/id_route.go b/resource-manager/network/2023-04-01/routes/id_route.go index f2bbb0efdb5..aa8060fb8f7 100644 --- a/resource-manager/network/2023-04-01/routes/id_route.go +++ b/resource-manager/network/2023-04-01/routes/id_route.go @@ -38,23 +38,9 @@ func ParseRouteID(input string) (*RouteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteId{} - - 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.RouteTableName, ok = parsed.Parsed["routeTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", *parsed) - } - - if id.RouteName, ok = parsed.Parsed["routeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRouteIDInsensitively(input string) (*RouteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RouteId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RouteTableName, ok = parsed.Parsed["routeTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", *parsed) + if id.RouteTableName, ok = input.Parsed["routeTableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", input) } - if id.RouteName, ok = parsed.Parsed["routeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeName", *parsed) + if id.RouteName, ok = input.Parsed["routeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routeName", input) } - return &id, nil + return nil } // ValidateRouteID checks that 'input' can be parsed as a Route ID diff --git a/resource-manager/network/2023-04-01/routes/id_routetable.go b/resource-manager/network/2023-04-01/routes/id_routetable.go index c8aadc85160..2aaab7c00d7 100644 --- a/resource-manager/network/2023-04-01/routes/id_routetable.go +++ b/resource-manager/network/2023-04-01/routes/id_routetable.go @@ -36,19 +36,9 @@ func ParseRouteTableID(input string) (*RouteTableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteTableId{} - - 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.RouteTableName, ok = parsed.Parsed["routeTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRouteTableIDInsensitively(input string) (*RouteTableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteTableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RouteTableId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RouteTableName, ok = parsed.Parsed["routeTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", *parsed) + if id.RouteTableName, ok = input.Parsed["routeTableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", input) } - return &id, nil + return nil } // ValidateRouteTableID checks that 'input' can be parsed as a Route Table ID diff --git a/resource-manager/network/2023-04-01/routetables/id_routetable.go b/resource-manager/network/2023-04-01/routetables/id_routetable.go index 15838ef16b1..8fe456d11cd 100644 --- a/resource-manager/network/2023-04-01/routetables/id_routetable.go +++ b/resource-manager/network/2023-04-01/routetables/id_routetable.go @@ -36,19 +36,9 @@ func ParseRouteTableID(input string) (*RouteTableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteTableId{} - - 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.RouteTableName, ok = parsed.Parsed["routeTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRouteTableIDInsensitively(input string) (*RouteTableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteTableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RouteTableId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RouteTableName, ok = parsed.Parsed["routeTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", *parsed) + if id.RouteTableName, ok = input.Parsed["routeTableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", input) } - return &id, nil + return nil } // ValidateRouteTableID checks that 'input' can be parsed as a Route Table ID diff --git a/resource-manager/network/2023-04-01/scopeconnections/id_networkmanager.go b/resource-manager/network/2023-04-01/scopeconnections/id_networkmanager.go index 8e518126e3d..168e6173785 100644 --- a/resource-manager/network/2023-04-01/scopeconnections/id_networkmanager.go +++ b/resource-manager/network/2023-04-01/scopeconnections/id_networkmanager.go @@ -36,19 +36,9 @@ func ParseNetworkManagerID(input string) (*NetworkManagerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkManagerId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkManagerIDInsensitively(input string) (*NetworkManagerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkManagerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkManagerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - return &id, nil + return nil } // ValidateNetworkManagerID checks that 'input' can be parsed as a Network Manager ID diff --git a/resource-manager/network/2023-04-01/scopeconnections/id_scopeconnection.go b/resource-manager/network/2023-04-01/scopeconnections/id_scopeconnection.go index dbc1fb7a7a7..bafad6ca7ab 100644 --- a/resource-manager/network/2023-04-01/scopeconnections/id_scopeconnection.go +++ b/resource-manager/network/2023-04-01/scopeconnections/id_scopeconnection.go @@ -38,23 +38,9 @@ func ParseScopeConnectionID(input string) (*ScopeConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopeConnectionId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) - } - - if id.ScopeConnectionName, ok = parsed.Parsed["scopeConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scopeConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseScopeConnectionIDInsensitively(input string) (*ScopeConnectionId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopeConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ScopeConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - if id.ScopeConnectionName, ok = parsed.Parsed["scopeConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scopeConnectionName", *parsed) + if id.ScopeConnectionName, ok = input.Parsed["scopeConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scopeConnectionName", input) } - return &id, nil + return nil } // ValidateScopeConnectionID checks that 'input' can be parsed as a Scope Connection ID diff --git a/resource-manager/network/2023-04-01/securityadminconfigurations/id_networkmanager.go b/resource-manager/network/2023-04-01/securityadminconfigurations/id_networkmanager.go index aec8d0fdd53..89b28c6005a 100644 --- a/resource-manager/network/2023-04-01/securityadminconfigurations/id_networkmanager.go +++ b/resource-manager/network/2023-04-01/securityadminconfigurations/id_networkmanager.go @@ -36,19 +36,9 @@ func ParseNetworkManagerID(input string) (*NetworkManagerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkManagerId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkManagerIDInsensitively(input string) (*NetworkManagerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkManagerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkManagerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - return &id, nil + return nil } // ValidateNetworkManagerID checks that 'input' can be parsed as a Network Manager ID diff --git a/resource-manager/network/2023-04-01/securityadminconfigurations/id_securityadminconfiguration.go b/resource-manager/network/2023-04-01/securityadminconfigurations/id_securityadminconfiguration.go index 3c2a8543126..5876385de21 100644 --- a/resource-manager/network/2023-04-01/securityadminconfigurations/id_securityadminconfiguration.go +++ b/resource-manager/network/2023-04-01/securityadminconfigurations/id_securityadminconfiguration.go @@ -38,23 +38,9 @@ func ParseSecurityAdminConfigurationID(input string) (*SecurityAdminConfiguratio return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecurityAdminConfigurationId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) - } - - if id.SecurityAdminConfigurationName, ok = parsed.Parsed["securityAdminConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityAdminConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSecurityAdminConfigurationIDInsensitively(input string) (*SecurityAdmi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecurityAdminConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SecurityAdminConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - if id.SecurityAdminConfigurationName, ok = parsed.Parsed["securityAdminConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityAdminConfigurationName", *parsed) + if id.SecurityAdminConfigurationName, ok = input.Parsed["securityAdminConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "securityAdminConfigurationName", input) } - return &id, nil + return nil } // ValidateSecurityAdminConfigurationID checks that 'input' can be parsed as a Security Admin Configuration ID diff --git a/resource-manager/network/2023-04-01/securitypartnerproviders/id_securitypartnerprovider.go b/resource-manager/network/2023-04-01/securitypartnerproviders/id_securitypartnerprovider.go index 3ebe53eb67a..91f369b0d33 100644 --- a/resource-manager/network/2023-04-01/securitypartnerproviders/id_securitypartnerprovider.go +++ b/resource-manager/network/2023-04-01/securitypartnerproviders/id_securitypartnerprovider.go @@ -36,19 +36,9 @@ func ParseSecurityPartnerProviderID(input string) (*SecurityPartnerProviderId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecurityPartnerProviderId{} - - 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.SecurityPartnerProviderName, ok = parsed.Parsed["securityPartnerProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityPartnerProviderName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSecurityPartnerProviderIDInsensitively(input string) (*SecurityPartner return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecurityPartnerProviderId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SecurityPartnerProviderId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SecurityPartnerProviderName, ok = parsed.Parsed["securityPartnerProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityPartnerProviderName", *parsed) + if id.SecurityPartnerProviderName, ok = input.Parsed["securityPartnerProviderName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "securityPartnerProviderName", input) } - return &id, nil + return nil } // ValidateSecurityPartnerProviderID checks that 'input' can be parsed as a Security Partner Provider ID diff --git a/resource-manager/network/2023-04-01/securityrules/id_defaultsecurityrule.go b/resource-manager/network/2023-04-01/securityrules/id_defaultsecurityrule.go index e4a89e02f98..6c7a0c23433 100644 --- a/resource-manager/network/2023-04-01/securityrules/id_defaultsecurityrule.go +++ b/resource-manager/network/2023-04-01/securityrules/id_defaultsecurityrule.go @@ -38,23 +38,9 @@ func ParseDefaultSecurityRuleID(input string) (*DefaultSecurityRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DefaultSecurityRuleId{} - - 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.NetworkSecurityGroupName, ok = parsed.Parsed["networkSecurityGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkSecurityGroupName", *parsed) - } - - if id.DefaultSecurityRuleName, ok = parsed.Parsed["defaultSecurityRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "defaultSecurityRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDefaultSecurityRuleIDInsensitively(input string) (*DefaultSecurityRule return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DefaultSecurityRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DefaultSecurityRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkSecurityGroupName, ok = parsed.Parsed["networkSecurityGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkSecurityGroupName", *parsed) + if id.NetworkSecurityGroupName, ok = input.Parsed["networkSecurityGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkSecurityGroupName", input) } - if id.DefaultSecurityRuleName, ok = parsed.Parsed["defaultSecurityRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "defaultSecurityRuleName", *parsed) + if id.DefaultSecurityRuleName, ok = input.Parsed["defaultSecurityRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "defaultSecurityRuleName", input) } - return &id, nil + return nil } // ValidateDefaultSecurityRuleID checks that 'input' can be parsed as a Default Security Rule ID diff --git a/resource-manager/network/2023-04-01/securityrules/id_networksecuritygroup.go b/resource-manager/network/2023-04-01/securityrules/id_networksecuritygroup.go index 07dda76386b..2a508ada09a 100644 --- a/resource-manager/network/2023-04-01/securityrules/id_networksecuritygroup.go +++ b/resource-manager/network/2023-04-01/securityrules/id_networksecuritygroup.go @@ -36,19 +36,9 @@ func ParseNetworkSecurityGroupID(input string) (*NetworkSecurityGroupId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkSecurityGroupId{} - - 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.NetworkSecurityGroupName, ok = parsed.Parsed["networkSecurityGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkSecurityGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkSecurityGroupIDInsensitively(input string) (*NetworkSecurityGro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkSecurityGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkSecurityGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkSecurityGroupName, ok = parsed.Parsed["networkSecurityGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkSecurityGroupName", *parsed) + if id.NetworkSecurityGroupName, ok = input.Parsed["networkSecurityGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkSecurityGroupName", input) } - return &id, nil + return nil } // ValidateNetworkSecurityGroupID checks that 'input' can be parsed as a Network Security Group ID diff --git a/resource-manager/network/2023-04-01/securityrules/id_securityrule.go b/resource-manager/network/2023-04-01/securityrules/id_securityrule.go index 32ca98be479..3c3391537ed 100644 --- a/resource-manager/network/2023-04-01/securityrules/id_securityrule.go +++ b/resource-manager/network/2023-04-01/securityrules/id_securityrule.go @@ -38,23 +38,9 @@ func ParseSecurityRuleID(input string) (*SecurityRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecurityRuleId{} - - 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.NetworkSecurityGroupName, ok = parsed.Parsed["networkSecurityGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkSecurityGroupName", *parsed) - } - - if id.SecurityRuleName, ok = parsed.Parsed["securityRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSecurityRuleIDInsensitively(input string) (*SecurityRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecurityRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SecurityRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkSecurityGroupName, ok = parsed.Parsed["networkSecurityGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkSecurityGroupName", *parsed) + if id.NetworkSecurityGroupName, ok = input.Parsed["networkSecurityGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkSecurityGroupName", input) } - if id.SecurityRuleName, ok = parsed.Parsed["securityRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityRuleName", *parsed) + if id.SecurityRuleName, ok = input.Parsed["securityRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "securityRuleName", input) } - return &id, nil + return nil } // ValidateSecurityRuleID checks that 'input' can be parsed as a Security Rule ID diff --git a/resource-manager/network/2023-04-01/serviceendpointpolicies/id_serviceendpointpolicy.go b/resource-manager/network/2023-04-01/serviceendpointpolicies/id_serviceendpointpolicy.go index 1df0f6e4676..2b791b53a7e 100644 --- a/resource-manager/network/2023-04-01/serviceendpointpolicies/id_serviceendpointpolicy.go +++ b/resource-manager/network/2023-04-01/serviceendpointpolicies/id_serviceendpointpolicy.go @@ -36,19 +36,9 @@ func ParseServiceEndpointPolicyID(input string) (*ServiceEndpointPolicyId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceEndpointPolicyId{} - - 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.ServiceEndpointPolicyName, ok = parsed.Parsed["serviceEndpointPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceEndpointPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceEndpointPolicyIDInsensitively(input string) (*ServiceEndpointPo return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceEndpointPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceEndpointPolicyId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceEndpointPolicyName, ok = parsed.Parsed["serviceEndpointPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceEndpointPolicyName", *parsed) + if id.ServiceEndpointPolicyName, ok = input.Parsed["serviceEndpointPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceEndpointPolicyName", input) } - return &id, nil + return nil } // ValidateServiceEndpointPolicyID checks that 'input' can be parsed as a Service Endpoint Policy ID diff --git a/resource-manager/network/2023-04-01/serviceendpointpolicydefinitions/id_serviceendpointpolicy.go b/resource-manager/network/2023-04-01/serviceendpointpolicydefinitions/id_serviceendpointpolicy.go index 979cf4f022e..83015de951d 100644 --- a/resource-manager/network/2023-04-01/serviceendpointpolicydefinitions/id_serviceendpointpolicy.go +++ b/resource-manager/network/2023-04-01/serviceendpointpolicydefinitions/id_serviceendpointpolicy.go @@ -36,19 +36,9 @@ func ParseServiceEndpointPolicyID(input string) (*ServiceEndpointPolicyId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceEndpointPolicyId{} - - 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.ServiceEndpointPolicyName, ok = parsed.Parsed["serviceEndpointPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceEndpointPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceEndpointPolicyIDInsensitively(input string) (*ServiceEndpointPo return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceEndpointPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceEndpointPolicyId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceEndpointPolicyName, ok = parsed.Parsed["serviceEndpointPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceEndpointPolicyName", *parsed) + if id.ServiceEndpointPolicyName, ok = input.Parsed["serviceEndpointPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceEndpointPolicyName", input) } - return &id, nil + return nil } // ValidateServiceEndpointPolicyID checks that 'input' can be parsed as a Service Endpoint Policy ID diff --git a/resource-manager/network/2023-04-01/serviceendpointpolicydefinitions/id_serviceendpointpolicydefinition.go b/resource-manager/network/2023-04-01/serviceendpointpolicydefinitions/id_serviceendpointpolicydefinition.go index f8fabb5925a..f64efcf7090 100644 --- a/resource-manager/network/2023-04-01/serviceendpointpolicydefinitions/id_serviceendpointpolicydefinition.go +++ b/resource-manager/network/2023-04-01/serviceendpointpolicydefinitions/id_serviceendpointpolicydefinition.go @@ -38,23 +38,9 @@ func ParseServiceEndpointPolicyDefinitionID(input string) (*ServiceEndpointPolic return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceEndpointPolicyDefinitionId{} - - 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.ServiceEndpointPolicyName, ok = parsed.Parsed["serviceEndpointPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceEndpointPolicyName", *parsed) - } - - if id.ServiceEndpointPolicyDefinitionName, ok = parsed.Parsed["serviceEndpointPolicyDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceEndpointPolicyDefinitionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseServiceEndpointPolicyDefinitionIDInsensitively(input string) (*Service return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceEndpointPolicyDefinitionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ServiceEndpointPolicyDefinitionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceEndpointPolicyName, ok = parsed.Parsed["serviceEndpointPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceEndpointPolicyName", *parsed) + if id.ServiceEndpointPolicyName, ok = input.Parsed["serviceEndpointPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceEndpointPolicyName", input) } - if id.ServiceEndpointPolicyDefinitionName, ok = parsed.Parsed["serviceEndpointPolicyDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceEndpointPolicyDefinitionName", *parsed) + if id.ServiceEndpointPolicyDefinitionName, ok = input.Parsed["serviceEndpointPolicyDefinitionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceEndpointPolicyDefinitionName", input) } - return &id, nil + return nil } // ValidateServiceEndpointPolicyDefinitionID checks that 'input' can be parsed as a Service Endpoint Policy Definition ID diff --git a/resource-manager/network/2023-04-01/servicetags/id_location.go b/resource-manager/network/2023-04-01/servicetags/id_location.go index 2d8a29c22d9..768bb04fc55 100644 --- a/resource-manager/network/2023-04-01/servicetags/id_location.go +++ b/resource-manager/network/2023-04-01/servicetags/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/network/2023-04-01/staticmembers/id_networkgroup.go b/resource-manager/network/2023-04-01/staticmembers/id_networkgroup.go index 67b3fd5daf1..85f6e10e5ea 100644 --- a/resource-manager/network/2023-04-01/staticmembers/id_networkgroup.go +++ b/resource-manager/network/2023-04-01/staticmembers/id_networkgroup.go @@ -38,23 +38,9 @@ func ParseNetworkGroupID(input string) (*NetworkGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkGroupId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) - } - - if id.NetworkGroupName, ok = parsed.Parsed["networkGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseNetworkGroupIDInsensitively(input string) (*NetworkGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *NetworkGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - if id.NetworkGroupName, ok = parsed.Parsed["networkGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkGroupName", *parsed) + if id.NetworkGroupName, ok = input.Parsed["networkGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkGroupName", input) } - return &id, nil + return nil } // ValidateNetworkGroupID checks that 'input' can be parsed as a Network Group ID diff --git a/resource-manager/network/2023-04-01/staticmembers/id_staticmember.go b/resource-manager/network/2023-04-01/staticmembers/id_staticmember.go index c42f4e8bd27..92cd458d75c 100644 --- a/resource-manager/network/2023-04-01/staticmembers/id_staticmember.go +++ b/resource-manager/network/2023-04-01/staticmembers/id_staticmember.go @@ -40,27 +40,9 @@ func ParseStaticMemberID(input string) (*StaticMemberId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StaticMemberId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) - } - - if id.NetworkGroupName, ok = parsed.Parsed["networkGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkGroupName", *parsed) - } - - if id.StaticMemberName, ok = parsed.Parsed["staticMemberName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticMemberName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseStaticMemberIDInsensitively(input string) (*StaticMemberId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StaticMemberId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *StaticMemberId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - if id.NetworkGroupName, ok = parsed.Parsed["networkGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkGroupName", *parsed) + if id.NetworkGroupName, ok = input.Parsed["networkGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkGroupName", input) } - if id.StaticMemberName, ok = parsed.Parsed["staticMemberName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticMemberName", *parsed) + if id.StaticMemberName, ok = input.Parsed["staticMemberName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "staticMemberName", input) } - return &id, nil + return nil } // ValidateStaticMemberID checks that 'input' can be parsed as a Static Member ID diff --git a/resource-manager/network/2023-04-01/trafficanalytics/id_networkwatcher.go b/resource-manager/network/2023-04-01/trafficanalytics/id_networkwatcher.go index 28df98e2c49..cf23d7e1b6b 100644 --- a/resource-manager/network/2023-04-01/trafficanalytics/id_networkwatcher.go +++ b/resource-manager/network/2023-04-01/trafficanalytics/id_networkwatcher.go @@ -36,19 +36,9 @@ func ParseNetworkWatcherID(input string) (*NetworkWatcherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkWatcherId{} - - 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.NetworkWatcherName, ok = parsed.Parsed["networkWatcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkWatcherIDInsensitively(input string) (*NetworkWatcherId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkWatcherId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkWatcherId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkWatcherName, ok = parsed.Parsed["networkWatcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", *parsed) + if id.NetworkWatcherName, ok = input.Parsed["networkWatcherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", input) } - return &id, nil + return nil } // ValidateNetworkWatcherID checks that 'input' can be parsed as a Network Watcher ID diff --git a/resource-manager/network/2023-04-01/usages/id_location.go b/resource-manager/network/2023-04-01/usages/id_location.go index ef70b32225b..0ea1a3015ad 100644 --- a/resource-manager/network/2023-04-01/usages/id_location.go +++ b/resource-manager/network/2023-04-01/usages/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/network/2023-04-01/vipswap/id_cloudservice.go b/resource-manager/network/2023-04-01/vipswap/id_cloudservice.go index 9544661fbc5..aab8095b940 100644 --- a/resource-manager/network/2023-04-01/vipswap/id_cloudservice.go +++ b/resource-manager/network/2023-04-01/vipswap/id_cloudservice.go @@ -36,19 +36,9 @@ func ParseCloudServiceID(input string) (*CloudServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CloudServiceId{} - - 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.CloudServiceName, ok = parsed.Parsed["cloudServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseCloudServiceIDInsensitively(input string) (*CloudServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CloudServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CloudServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CloudServiceName, ok = parsed.Parsed["cloudServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", *parsed) + if id.CloudServiceName, ok = input.Parsed["cloudServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", input) } - return &id, nil + return nil } // ValidateCloudServiceID checks that 'input' can be parsed as a Cloud Service ID diff --git a/resource-manager/network/2023-04-01/virtualappliancesites/id_networkvirtualappliance.go b/resource-manager/network/2023-04-01/virtualappliancesites/id_networkvirtualappliance.go index 2ae3ddeb528..3a98094ce5f 100644 --- a/resource-manager/network/2023-04-01/virtualappliancesites/id_networkvirtualappliance.go +++ b/resource-manager/network/2023-04-01/virtualappliancesites/id_networkvirtualappliance.go @@ -36,19 +36,9 @@ func ParseNetworkVirtualApplianceID(input string) (*NetworkVirtualApplianceId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkVirtualApplianceId{} - - 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.NetworkVirtualApplianceName, ok = parsed.Parsed["networkVirtualApplianceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkVirtualApplianceIDInsensitively(input string) (*NetworkVirtualA return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkVirtualApplianceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkVirtualApplianceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkVirtualApplianceName, ok = parsed.Parsed["networkVirtualApplianceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceName", *parsed) + if id.NetworkVirtualApplianceName, ok = input.Parsed["networkVirtualApplianceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceName", input) } - return &id, nil + return nil } // ValidateNetworkVirtualApplianceID checks that 'input' can be parsed as a Network Virtual Appliance ID diff --git a/resource-manager/network/2023-04-01/virtualappliancesites/id_virtualappliancesite.go b/resource-manager/network/2023-04-01/virtualappliancesites/id_virtualappliancesite.go index 62bcc9817bf..64fcaa60c67 100644 --- a/resource-manager/network/2023-04-01/virtualappliancesites/id_virtualappliancesite.go +++ b/resource-manager/network/2023-04-01/virtualappliancesites/id_virtualappliancesite.go @@ -38,23 +38,9 @@ func ParseVirtualApplianceSiteID(input string) (*VirtualApplianceSiteId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualApplianceSiteId{} - - 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.NetworkVirtualApplianceName, ok = parsed.Parsed["networkVirtualApplianceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceName", *parsed) - } - - if id.VirtualApplianceSiteName, ok = parsed.Parsed["virtualApplianceSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualApplianceSiteName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualApplianceSiteIDInsensitively(input string) (*VirtualApplianceSi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualApplianceSiteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualApplianceSiteId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkVirtualApplianceName, ok = parsed.Parsed["networkVirtualApplianceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceName", *parsed) + if id.NetworkVirtualApplianceName, ok = input.Parsed["networkVirtualApplianceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceName", input) } - if id.VirtualApplianceSiteName, ok = parsed.Parsed["virtualApplianceSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualApplianceSiteName", *parsed) + if id.VirtualApplianceSiteName, ok = input.Parsed["virtualApplianceSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualApplianceSiteName", input) } - return &id, nil + return nil } // ValidateVirtualApplianceSiteID checks that 'input' can be parsed as a Virtual Appliance Site ID diff --git a/resource-manager/network/2023-04-01/virtualapplianceskus/id_networkvirtualappliancesku.go b/resource-manager/network/2023-04-01/virtualapplianceskus/id_networkvirtualappliancesku.go index 7558f22904e..9a208383365 100644 --- a/resource-manager/network/2023-04-01/virtualapplianceskus/id_networkvirtualappliancesku.go +++ b/resource-manager/network/2023-04-01/virtualapplianceskus/id_networkvirtualappliancesku.go @@ -34,15 +34,9 @@ func ParseNetworkVirtualApplianceSkuID(input string) (*NetworkVirtualApplianceSk return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkVirtualApplianceSkuId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.NetworkVirtualApplianceSkuName, ok = parsed.Parsed["networkVirtualApplianceSkuName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceSkuName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseNetworkVirtualApplianceSkuIDInsensitively(input string) (*NetworkVirtu return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkVirtualApplianceSkuId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *NetworkVirtualApplianceSkuId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.NetworkVirtualApplianceSkuName, ok = parsed.Parsed["networkVirtualApplianceSkuName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceSkuName", *parsed) + if id.NetworkVirtualApplianceSkuName, ok = input.Parsed["networkVirtualApplianceSkuName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceSkuName", input) } - return &id, nil + return nil } // ValidateNetworkVirtualApplianceSkuID checks that 'input' can be parsed as a Network Virtual Appliance Sku ID diff --git a/resource-manager/network/2023-04-01/virtualnetworkgatewayconnections/id_connection.go b/resource-manager/network/2023-04-01/virtualnetworkgatewayconnections/id_connection.go index 20cd2e94077..d894548ccde 100644 --- a/resource-manager/network/2023-04-01/virtualnetworkgatewayconnections/id_connection.go +++ b/resource-manager/network/2023-04-01/virtualnetworkgatewayconnections/id_connection.go @@ -36,19 +36,9 @@ func ParseConnectionID(input string) (*ConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionId{} - - 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.ConnectionName, ok = parsed.Parsed["connectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseConnectionIDInsensitively(input string) (*ConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ConnectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ConnectionName, ok = parsed.Parsed["connectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionName", *parsed) + if id.ConnectionName, ok = input.Parsed["connectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectionName", input) } - return &id, nil + return nil } // ValidateConnectionID checks that 'input' can be parsed as a Connection ID diff --git a/resource-manager/network/2023-04-01/virtualnetworkgateways/id_connection.go b/resource-manager/network/2023-04-01/virtualnetworkgateways/id_connection.go index 0474f12724b..bdc065e680c 100644 --- a/resource-manager/network/2023-04-01/virtualnetworkgateways/id_connection.go +++ b/resource-manager/network/2023-04-01/virtualnetworkgateways/id_connection.go @@ -36,19 +36,9 @@ func ParseConnectionID(input string) (*ConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionId{} - - 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.ConnectionName, ok = parsed.Parsed["connectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseConnectionIDInsensitively(input string) (*ConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ConnectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ConnectionName, ok = parsed.Parsed["connectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionName", *parsed) + if id.ConnectionName, ok = input.Parsed["connectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectionName", input) } - return &id, nil + return nil } // ValidateConnectionID checks that 'input' can be parsed as a Connection ID diff --git a/resource-manager/network/2023-04-01/virtualnetworkgateways/id_virtualnetworkgateway.go b/resource-manager/network/2023-04-01/virtualnetworkgateways/id_virtualnetworkgateway.go index f405ee0a07d..30e96c0b114 100644 --- a/resource-manager/network/2023-04-01/virtualnetworkgateways/id_virtualnetworkgateway.go +++ b/resource-manager/network/2023-04-01/virtualnetworkgateways/id_virtualnetworkgateway.go @@ -36,19 +36,9 @@ func ParseVirtualNetworkGatewayID(input string) (*VirtualNetworkGatewayId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkGatewayId{} - - 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.VirtualNetworkGatewayName, ok = parsed.Parsed["virtualNetworkGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkGatewayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualNetworkGatewayIDInsensitively(input string) (*VirtualNetworkGat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkGatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualNetworkGatewayId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualNetworkGatewayName, ok = parsed.Parsed["virtualNetworkGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkGatewayName", *parsed) + if id.VirtualNetworkGatewayName, ok = input.Parsed["virtualNetworkGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkGatewayName", input) } - return &id, nil + return nil } // ValidateVirtualNetworkGatewayID checks that 'input' can be parsed as a Virtual Network Gateway ID diff --git a/resource-manager/network/2023-04-01/virtualnetworkgateways/id_virtualnetworkgatewaynatrule.go b/resource-manager/network/2023-04-01/virtualnetworkgateways/id_virtualnetworkgatewaynatrule.go index 76631d94563..d261f426c85 100644 --- a/resource-manager/network/2023-04-01/virtualnetworkgateways/id_virtualnetworkgatewaynatrule.go +++ b/resource-manager/network/2023-04-01/virtualnetworkgateways/id_virtualnetworkgatewaynatrule.go @@ -38,23 +38,9 @@ func ParseVirtualNetworkGatewayNatRuleID(input string) (*VirtualNetworkGatewayNa return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkGatewayNatRuleId{} - - 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.VirtualNetworkGatewayName, ok = parsed.Parsed["virtualNetworkGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkGatewayName", *parsed) - } - - if id.NatRuleName, ok = parsed.Parsed["natRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "natRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualNetworkGatewayNatRuleIDInsensitively(input string) (*VirtualNet return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkGatewayNatRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualNetworkGatewayNatRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualNetworkGatewayName, ok = parsed.Parsed["virtualNetworkGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkGatewayName", *parsed) + if id.VirtualNetworkGatewayName, ok = input.Parsed["virtualNetworkGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkGatewayName", input) } - if id.NatRuleName, ok = parsed.Parsed["natRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "natRuleName", *parsed) + if id.NatRuleName, ok = input.Parsed["natRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "natRuleName", input) } - return &id, nil + return nil } // ValidateVirtualNetworkGatewayNatRuleID checks that 'input' can be parsed as a Virtual Network Gateway Nat Rule ID diff --git a/resource-manager/network/2023-04-01/virtualnetworkpeerings/id_virtualnetworkpeering.go b/resource-manager/network/2023-04-01/virtualnetworkpeerings/id_virtualnetworkpeering.go index aaaf017cf07..de01f35aeb8 100644 --- a/resource-manager/network/2023-04-01/virtualnetworkpeerings/id_virtualnetworkpeering.go +++ b/resource-manager/network/2023-04-01/virtualnetworkpeerings/id_virtualnetworkpeering.go @@ -38,23 +38,9 @@ func ParseVirtualNetworkPeeringID(input string) (*VirtualNetworkPeeringId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkPeeringId{} - - 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.VirtualNetworkName, ok = parsed.Parsed["virtualNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkName", *parsed) - } - - if id.VirtualNetworkPeeringName, ok = parsed.Parsed["virtualNetworkPeeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkPeeringName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualNetworkPeeringIDInsensitively(input string) (*VirtualNetworkPee return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkPeeringId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualNetworkPeeringId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualNetworkName, ok = parsed.Parsed["virtualNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkName", *parsed) + if id.VirtualNetworkName, ok = input.Parsed["virtualNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkName", input) } - if id.VirtualNetworkPeeringName, ok = parsed.Parsed["virtualNetworkPeeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkPeeringName", *parsed) + if id.VirtualNetworkPeeringName, ok = input.Parsed["virtualNetworkPeeringName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkPeeringName", input) } - return &id, nil + return nil } // ValidateVirtualNetworkPeeringID checks that 'input' can be parsed as a Virtual Network Peering ID diff --git a/resource-manager/network/2023-04-01/virtualnetworktap/id_virtualnetworktap.go b/resource-manager/network/2023-04-01/virtualnetworktap/id_virtualnetworktap.go index 7e7e843e4d1..1264701d515 100644 --- a/resource-manager/network/2023-04-01/virtualnetworktap/id_virtualnetworktap.go +++ b/resource-manager/network/2023-04-01/virtualnetworktap/id_virtualnetworktap.go @@ -36,19 +36,9 @@ func ParseVirtualNetworkTapID(input string) (*VirtualNetworkTapId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkTapId{} - - 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.VirtualNetworkTapName, ok = parsed.Parsed["virtualNetworkTapName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkTapName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualNetworkTapIDInsensitively(input string) (*VirtualNetworkTapId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkTapId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualNetworkTapId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualNetworkTapName, ok = parsed.Parsed["virtualNetworkTapName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkTapName", *parsed) + if id.VirtualNetworkTapName, ok = input.Parsed["virtualNetworkTapName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkTapName", input) } - return &id, nil + return nil } // ValidateVirtualNetworkTapID checks that 'input' can be parsed as a Virtual Network Tap ID diff --git a/resource-manager/network/2023-04-01/virtualrouterpeerings/id_virtualrouter.go b/resource-manager/network/2023-04-01/virtualrouterpeerings/id_virtualrouter.go index 885ce3a276a..0cfcf59d124 100644 --- a/resource-manager/network/2023-04-01/virtualrouterpeerings/id_virtualrouter.go +++ b/resource-manager/network/2023-04-01/virtualrouterpeerings/id_virtualrouter.go @@ -36,19 +36,9 @@ func ParseVirtualRouterID(input string) (*VirtualRouterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualRouterId{} - - 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.VirtualRouterName, ok = parsed.Parsed["virtualRouterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualRouterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualRouterIDInsensitively(input string) (*VirtualRouterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualRouterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualRouterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualRouterName, ok = parsed.Parsed["virtualRouterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualRouterName", *parsed) + if id.VirtualRouterName, ok = input.Parsed["virtualRouterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualRouterName", input) } - return &id, nil + return nil } // ValidateVirtualRouterID checks that 'input' can be parsed as a Virtual Router ID diff --git a/resource-manager/network/2023-04-01/virtualrouters/id_virtualrouter.go b/resource-manager/network/2023-04-01/virtualrouters/id_virtualrouter.go index ecb01bd99e5..5832396424b 100644 --- a/resource-manager/network/2023-04-01/virtualrouters/id_virtualrouter.go +++ b/resource-manager/network/2023-04-01/virtualrouters/id_virtualrouter.go @@ -36,19 +36,9 @@ func ParseVirtualRouterID(input string) (*VirtualRouterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualRouterId{} - - 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.VirtualRouterName, ok = parsed.Parsed["virtualRouterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualRouterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualRouterIDInsensitively(input string) (*VirtualRouterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualRouterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualRouterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualRouterName, ok = parsed.Parsed["virtualRouterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualRouterName", *parsed) + if id.VirtualRouterName, ok = input.Parsed["virtualRouterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualRouterName", input) } - return &id, nil + return nil } // ValidateVirtualRouterID checks that 'input' can be parsed as a Virtual Router ID diff --git a/resource-manager/network/2023-04-01/virtualwans/id_configurationpolicygroup.go b/resource-manager/network/2023-04-01/virtualwans/id_configurationpolicygroup.go index d6c7f2eaff8..dff384d30ca 100644 --- a/resource-manager/network/2023-04-01/virtualwans/id_configurationpolicygroup.go +++ b/resource-manager/network/2023-04-01/virtualwans/id_configurationpolicygroup.go @@ -38,23 +38,9 @@ func ParseConfigurationPolicyGroupID(input string) (*ConfigurationPolicyGroupId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationPolicyGroupId{} - - 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.VpnServerConfigurationName, ok = parsed.Parsed["vpnServerConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnServerConfigurationName", *parsed) - } - - if id.ConfigurationPolicyGroupName, ok = parsed.Parsed["configurationPolicyGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationPolicyGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConfigurationPolicyGroupIDInsensitively(input string) (*ConfigurationP return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationPolicyGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConfigurationPolicyGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VpnServerConfigurationName, ok = parsed.Parsed["vpnServerConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnServerConfigurationName", *parsed) + if id.VpnServerConfigurationName, ok = input.Parsed["vpnServerConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vpnServerConfigurationName", input) } - if id.ConfigurationPolicyGroupName, ok = parsed.Parsed["configurationPolicyGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationPolicyGroupName", *parsed) + if id.ConfigurationPolicyGroupName, ok = input.Parsed["configurationPolicyGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationPolicyGroupName", input) } - return &id, nil + return nil } // ValidateConfigurationPolicyGroupID checks that 'input' can be parsed as a Configuration Policy Group ID diff --git a/resource-manager/network/2023-04-01/virtualwans/id_hubroutetable.go b/resource-manager/network/2023-04-01/virtualwans/id_hubroutetable.go index 0297471a681..72310881bba 100644 --- a/resource-manager/network/2023-04-01/virtualwans/id_hubroutetable.go +++ b/resource-manager/network/2023-04-01/virtualwans/id_hubroutetable.go @@ -38,23 +38,9 @@ func ParseHubRouteTableID(input string) (*HubRouteTableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HubRouteTableId{} - - 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.VirtualHubName, ok = parsed.Parsed["virtualHubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", *parsed) - } - - if id.HubRouteTableName, ok = parsed.Parsed["hubRouteTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hubRouteTableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseHubRouteTableIDInsensitively(input string) (*HubRouteTableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HubRouteTableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *HubRouteTableId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualHubName, ok = parsed.Parsed["virtualHubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", *parsed) + if id.VirtualHubName, ok = input.Parsed["virtualHubName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", input) } - if id.HubRouteTableName, ok = parsed.Parsed["hubRouteTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hubRouteTableName", *parsed) + if id.HubRouteTableName, ok = input.Parsed["hubRouteTableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hubRouteTableName", input) } - return &id, nil + return nil } // ValidateHubRouteTableID checks that 'input' can be parsed as a Hub Route Table ID diff --git a/resource-manager/network/2023-04-01/virtualwans/id_hubvirtualnetworkconnection.go b/resource-manager/network/2023-04-01/virtualwans/id_hubvirtualnetworkconnection.go index e5bc46da4b4..116cf5cd477 100644 --- a/resource-manager/network/2023-04-01/virtualwans/id_hubvirtualnetworkconnection.go +++ b/resource-manager/network/2023-04-01/virtualwans/id_hubvirtualnetworkconnection.go @@ -38,23 +38,9 @@ func ParseHubVirtualNetworkConnectionID(input string) (*HubVirtualNetworkConnect return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HubVirtualNetworkConnectionId{} - - 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.VirtualHubName, ok = parsed.Parsed["virtualHubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", *parsed) - } - - if id.HubVirtualNetworkConnectionName, ok = parsed.Parsed["hubVirtualNetworkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hubVirtualNetworkConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseHubVirtualNetworkConnectionIDInsensitively(input string) (*HubVirtualN return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HubVirtualNetworkConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *HubVirtualNetworkConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualHubName, ok = parsed.Parsed["virtualHubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", *parsed) + if id.VirtualHubName, ok = input.Parsed["virtualHubName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", input) } - if id.HubVirtualNetworkConnectionName, ok = parsed.Parsed["hubVirtualNetworkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hubVirtualNetworkConnectionName", *parsed) + if id.HubVirtualNetworkConnectionName, ok = input.Parsed["hubVirtualNetworkConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hubVirtualNetworkConnectionName", input) } - return &id, nil + return nil } // ValidateHubVirtualNetworkConnectionID checks that 'input' can be parsed as a Hub Virtual Network Connection ID diff --git a/resource-manager/network/2023-04-01/virtualwans/id_natrule.go b/resource-manager/network/2023-04-01/virtualwans/id_natrule.go index 2563c42130d..93cab37e7c6 100644 --- a/resource-manager/network/2023-04-01/virtualwans/id_natrule.go +++ b/resource-manager/network/2023-04-01/virtualwans/id_natrule.go @@ -38,23 +38,9 @@ func ParseNatRuleID(input string) (*NatRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NatRuleId{} - - 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.VpnGatewayName, ok = parsed.Parsed["vpnGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnGatewayName", *parsed) - } - - if id.NatRuleName, ok = parsed.Parsed["natRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "natRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseNatRuleIDInsensitively(input string) (*NatRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NatRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *NatRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VpnGatewayName, ok = parsed.Parsed["vpnGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnGatewayName", *parsed) + if id.VpnGatewayName, ok = input.Parsed["vpnGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vpnGatewayName", input) } - if id.NatRuleName, ok = parsed.Parsed["natRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "natRuleName", *parsed) + if id.NatRuleName, ok = input.Parsed["natRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "natRuleName", input) } - return &id, nil + return nil } // ValidateNatRuleID checks that 'input' can be parsed as a Nat Rule ID diff --git a/resource-manager/network/2023-04-01/virtualwans/id_routemap.go b/resource-manager/network/2023-04-01/virtualwans/id_routemap.go index a7eb1850cb8..ff3a75a5126 100644 --- a/resource-manager/network/2023-04-01/virtualwans/id_routemap.go +++ b/resource-manager/network/2023-04-01/virtualwans/id_routemap.go @@ -38,23 +38,9 @@ func ParseRouteMapID(input string) (*RouteMapId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteMapId{} - - 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.VirtualHubName, ok = parsed.Parsed["virtualHubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", *parsed) - } - - if id.RouteMapName, ok = parsed.Parsed["routeMapName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeMapName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRouteMapIDInsensitively(input string) (*RouteMapId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteMapId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RouteMapId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualHubName, ok = parsed.Parsed["virtualHubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", *parsed) + if id.VirtualHubName, ok = input.Parsed["virtualHubName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", input) } - if id.RouteMapName, ok = parsed.Parsed["routeMapName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeMapName", *parsed) + if id.RouteMapName, ok = input.Parsed["routeMapName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routeMapName", input) } - return &id, nil + return nil } // ValidateRouteMapID checks that 'input' can be parsed as a Route Map ID diff --git a/resource-manager/network/2023-04-01/virtualwans/id_routingintent.go b/resource-manager/network/2023-04-01/virtualwans/id_routingintent.go index 9a8b1a5cc31..dbc58606bae 100644 --- a/resource-manager/network/2023-04-01/virtualwans/id_routingintent.go +++ b/resource-manager/network/2023-04-01/virtualwans/id_routingintent.go @@ -38,23 +38,9 @@ func ParseRoutingIntentID(input string) (*RoutingIntentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RoutingIntentId{} - - 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.VirtualHubName, ok = parsed.Parsed["virtualHubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", *parsed) - } - - if id.RoutingIntentName, ok = parsed.Parsed["routingIntentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routingIntentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRoutingIntentIDInsensitively(input string) (*RoutingIntentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RoutingIntentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RoutingIntentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualHubName, ok = parsed.Parsed["virtualHubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", *parsed) + if id.VirtualHubName, ok = input.Parsed["virtualHubName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", input) } - if id.RoutingIntentName, ok = parsed.Parsed["routingIntentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routingIntentName", *parsed) + if id.RoutingIntentName, ok = input.Parsed["routingIntentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routingIntentName", input) } - return &id, nil + return nil } // ValidateRoutingIntentID checks that 'input' can be parsed as a Routing Intent ID diff --git a/resource-manager/network/2023-04-01/virtualwans/id_virtualhub.go b/resource-manager/network/2023-04-01/virtualwans/id_virtualhub.go index 3f42afd7fc5..7b6723ff9e3 100644 --- a/resource-manager/network/2023-04-01/virtualwans/id_virtualhub.go +++ b/resource-manager/network/2023-04-01/virtualwans/id_virtualhub.go @@ -36,19 +36,9 @@ func ParseVirtualHubID(input string) (*VirtualHubId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualHubId{} - - 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.VirtualHubName, ok = parsed.Parsed["virtualHubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualHubIDInsensitively(input string) (*VirtualHubId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualHubId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualHubId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualHubName, ok = parsed.Parsed["virtualHubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", *parsed) + if id.VirtualHubName, ok = input.Parsed["virtualHubName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", input) } - return &id, nil + return nil } // ValidateVirtualHubID checks that 'input' can be parsed as a Virtual Hub ID diff --git a/resource-manager/network/2023-04-01/virtualwans/id_virtualhubroutetable.go b/resource-manager/network/2023-04-01/virtualwans/id_virtualhubroutetable.go index ccb706e1460..c62be8a98a8 100644 --- a/resource-manager/network/2023-04-01/virtualwans/id_virtualhubroutetable.go +++ b/resource-manager/network/2023-04-01/virtualwans/id_virtualhubroutetable.go @@ -38,23 +38,9 @@ func ParseVirtualHubRouteTableID(input string) (*VirtualHubRouteTableId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualHubRouteTableId{} - - 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.VirtualHubName, ok = parsed.Parsed["virtualHubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", *parsed) - } - - if id.RouteTableName, ok = parsed.Parsed["routeTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualHubRouteTableIDInsensitively(input string) (*VirtualHubRouteTab return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualHubRouteTableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualHubRouteTableId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualHubName, ok = parsed.Parsed["virtualHubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", *parsed) + if id.VirtualHubName, ok = input.Parsed["virtualHubName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", input) } - if id.RouteTableName, ok = parsed.Parsed["routeTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", *parsed) + if id.RouteTableName, ok = input.Parsed["routeTableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", input) } - return &id, nil + return nil } // ValidateVirtualHubRouteTableID checks that 'input' can be parsed as a Virtual Hub Route Table ID diff --git a/resource-manager/network/2023-04-01/virtualwans/id_virtualwan.go b/resource-manager/network/2023-04-01/virtualwans/id_virtualwan.go index 590264a9ee1..db457c86102 100644 --- a/resource-manager/network/2023-04-01/virtualwans/id_virtualwan.go +++ b/resource-manager/network/2023-04-01/virtualwans/id_virtualwan.go @@ -36,19 +36,9 @@ func ParseVirtualWANID(input string) (*VirtualWANId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualWANId{} - - 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.VirtualWanName, ok = parsed.Parsed["virtualWanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualWanName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualWANIDInsensitively(input string) (*VirtualWANId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualWANId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualWANId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualWanName, ok = parsed.Parsed["virtualWanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualWanName", *parsed) + if id.VirtualWanName, ok = input.Parsed["virtualWanName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualWanName", input) } - return &id, nil + return nil } // ValidateVirtualWANID checks that 'input' can be parsed as a Virtual W A N ID diff --git a/resource-manager/network/2023-04-01/virtualwans/id_vpngateway.go b/resource-manager/network/2023-04-01/virtualwans/id_vpngateway.go index a438d896289..cf7683ac9e3 100644 --- a/resource-manager/network/2023-04-01/virtualwans/id_vpngateway.go +++ b/resource-manager/network/2023-04-01/virtualwans/id_vpngateway.go @@ -36,19 +36,9 @@ func ParseVpnGatewayID(input string) (*VpnGatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnGatewayId{} - - 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.VpnGatewayName, ok = parsed.Parsed["vpnGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnGatewayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVpnGatewayIDInsensitively(input string) (*VpnGatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnGatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VpnGatewayId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VpnGatewayName, ok = parsed.Parsed["vpnGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnGatewayName", *parsed) + if id.VpnGatewayName, ok = input.Parsed["vpnGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vpnGatewayName", input) } - return &id, nil + return nil } // ValidateVpnGatewayID checks that 'input' can be parsed as a Vpn Gateway ID diff --git a/resource-manager/network/2023-04-01/virtualwans/id_vpnlinkconnection.go b/resource-manager/network/2023-04-01/virtualwans/id_vpnlinkconnection.go index f8c398dc7ac..dfeff21ccfc 100644 --- a/resource-manager/network/2023-04-01/virtualwans/id_vpnlinkconnection.go +++ b/resource-manager/network/2023-04-01/virtualwans/id_vpnlinkconnection.go @@ -40,27 +40,9 @@ func ParseVpnLinkConnectionID(input string) (*VpnLinkConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnLinkConnectionId{} - - 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.VpnGatewayName, ok = parsed.Parsed["vpnGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnGatewayName", *parsed) - } - - if id.VpnConnectionName, ok = parsed.Parsed["vpnConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnConnectionName", *parsed) - } - - if id.VpnLinkConnectionName, ok = parsed.Parsed["vpnLinkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnLinkConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVpnLinkConnectionIDInsensitively(input string) (*VpnLinkConnectionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnLinkConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VpnLinkConnectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VpnGatewayName, ok = parsed.Parsed["vpnGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnGatewayName", *parsed) + if id.VpnGatewayName, ok = input.Parsed["vpnGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vpnGatewayName", input) } - if id.VpnConnectionName, ok = parsed.Parsed["vpnConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnConnectionName", *parsed) + if id.VpnConnectionName, ok = input.Parsed["vpnConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vpnConnectionName", input) } - if id.VpnLinkConnectionName, ok = parsed.Parsed["vpnLinkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnLinkConnectionName", *parsed) + if id.VpnLinkConnectionName, ok = input.Parsed["vpnLinkConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vpnLinkConnectionName", input) } - return &id, nil + return nil } // ValidateVpnLinkConnectionID checks that 'input' can be parsed as a Vpn Link Connection ID diff --git a/resource-manager/network/2023-04-01/virtualwans/id_vpnserverconfiguration.go b/resource-manager/network/2023-04-01/virtualwans/id_vpnserverconfiguration.go index 194ee0e58a3..9bd02160920 100644 --- a/resource-manager/network/2023-04-01/virtualwans/id_vpnserverconfiguration.go +++ b/resource-manager/network/2023-04-01/virtualwans/id_vpnserverconfiguration.go @@ -36,19 +36,9 @@ func ParseVpnServerConfigurationID(input string) (*VpnServerConfigurationId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnServerConfigurationId{} - - 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.VpnServerConfigurationName, ok = parsed.Parsed["vpnServerConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnServerConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVpnServerConfigurationIDInsensitively(input string) (*VpnServerConfigu return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnServerConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VpnServerConfigurationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VpnServerConfigurationName, ok = parsed.Parsed["vpnServerConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnServerConfigurationName", *parsed) + if id.VpnServerConfigurationName, ok = input.Parsed["vpnServerConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vpnServerConfigurationName", input) } - return &id, nil + return nil } // ValidateVpnServerConfigurationID checks that 'input' can be parsed as a Vpn Server Configuration ID diff --git a/resource-manager/network/2023-04-01/virtualwans/id_vpnsite.go b/resource-manager/network/2023-04-01/virtualwans/id_vpnsite.go index d32b6f6dba4..4c1e5f7deec 100644 --- a/resource-manager/network/2023-04-01/virtualwans/id_vpnsite.go +++ b/resource-manager/network/2023-04-01/virtualwans/id_vpnsite.go @@ -36,19 +36,9 @@ func ParseVpnSiteID(input string) (*VpnSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnSiteId{} - - 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.VpnSiteName, ok = parsed.Parsed["vpnSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnSiteName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVpnSiteIDInsensitively(input string) (*VpnSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnSiteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VpnSiteId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VpnSiteName, ok = parsed.Parsed["vpnSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnSiteName", *parsed) + if id.VpnSiteName, ok = input.Parsed["vpnSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vpnSiteName", input) } - return &id, nil + return nil } // ValidateVpnSiteID checks that 'input' can be parsed as a Vpn Site ID diff --git a/resource-manager/network/2023-04-01/virtualwans/id_vpnsitelink.go b/resource-manager/network/2023-04-01/virtualwans/id_vpnsitelink.go index e43deb2be92..aebb2d3d5d6 100644 --- a/resource-manager/network/2023-04-01/virtualwans/id_vpnsitelink.go +++ b/resource-manager/network/2023-04-01/virtualwans/id_vpnsitelink.go @@ -38,23 +38,9 @@ func ParseVpnSiteLinkID(input string) (*VpnSiteLinkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnSiteLinkId{} - - 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.VpnSiteName, ok = parsed.Parsed["vpnSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnSiteName", *parsed) - } - - if id.VpnSiteLinkName, ok = parsed.Parsed["vpnSiteLinkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnSiteLinkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVpnSiteLinkIDInsensitively(input string) (*VpnSiteLinkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnSiteLinkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VpnSiteLinkId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VpnSiteName, ok = parsed.Parsed["vpnSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnSiteName", *parsed) + if id.VpnSiteName, ok = input.Parsed["vpnSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vpnSiteName", input) } - if id.VpnSiteLinkName, ok = parsed.Parsed["vpnSiteLinkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnSiteLinkName", *parsed) + if id.VpnSiteLinkName, ok = input.Parsed["vpnSiteLinkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vpnSiteLinkName", input) } - return &id, nil + return nil } // ValidateVpnSiteLinkID checks that 'input' can be parsed as a Vpn Site Link ID diff --git a/resource-manager/network/2023-04-01/vmsspublicipaddresses/id_virtualmachinescaleset.go b/resource-manager/network/2023-04-01/vmsspublicipaddresses/id_virtualmachinescaleset.go index b798e513d2e..7f2795675f6 100644 --- a/resource-manager/network/2023-04-01/vmsspublicipaddresses/id_virtualmachinescaleset.go +++ b/resource-manager/network/2023-04-01/vmsspublicipaddresses/id_virtualmachinescaleset.go @@ -36,19 +36,9 @@ func ParseVirtualMachineScaleSetID(input string) (*VirtualMachineScaleSetId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineScaleSetIDInsensitively(input string) (*VirtualMachineSc return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineScaleSetId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - return &id, nil + return nil } // ValidateVirtualMachineScaleSetID checks that 'input' can be parsed as a Virtual Machine Scale Set ID diff --git a/resource-manager/network/2023-04-01/vpngateways/id_vpngateway.go b/resource-manager/network/2023-04-01/vpngateways/id_vpngateway.go index 5e23e288887..bf76c30c5da 100644 --- a/resource-manager/network/2023-04-01/vpngateways/id_vpngateway.go +++ b/resource-manager/network/2023-04-01/vpngateways/id_vpngateway.go @@ -36,19 +36,9 @@ func ParseVpnGatewayID(input string) (*VpnGatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnGatewayId{} - - 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.VpnGatewayName, ok = parsed.Parsed["vpnGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnGatewayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVpnGatewayIDInsensitively(input string) (*VpnGatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnGatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VpnGatewayId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VpnGatewayName, ok = parsed.Parsed["vpnGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnGatewayName", *parsed) + if id.VpnGatewayName, ok = input.Parsed["vpnGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vpnGatewayName", input) } - return &id, nil + return nil } // ValidateVpnGatewayID checks that 'input' can be parsed as a Vpn Gateway ID diff --git a/resource-manager/network/2023-04-01/vpnlinkconnections/id_vpnlinkconnection.go b/resource-manager/network/2023-04-01/vpnlinkconnections/id_vpnlinkconnection.go index 1fc8b77b7e9..b5191696d31 100644 --- a/resource-manager/network/2023-04-01/vpnlinkconnections/id_vpnlinkconnection.go +++ b/resource-manager/network/2023-04-01/vpnlinkconnections/id_vpnlinkconnection.go @@ -40,27 +40,9 @@ func ParseVpnLinkConnectionID(input string) (*VpnLinkConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnLinkConnectionId{} - - 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.VpnGatewayName, ok = parsed.Parsed["vpnGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnGatewayName", *parsed) - } - - if id.VpnConnectionName, ok = parsed.Parsed["vpnConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnConnectionName", *parsed) - } - - if id.VpnLinkConnectionName, ok = parsed.Parsed["vpnLinkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnLinkConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVpnLinkConnectionIDInsensitively(input string) (*VpnLinkConnectionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnLinkConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VpnLinkConnectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VpnGatewayName, ok = parsed.Parsed["vpnGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnGatewayName", *parsed) + if id.VpnGatewayName, ok = input.Parsed["vpnGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vpnGatewayName", input) } - if id.VpnConnectionName, ok = parsed.Parsed["vpnConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnConnectionName", *parsed) + if id.VpnConnectionName, ok = input.Parsed["vpnConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vpnConnectionName", input) } - if id.VpnLinkConnectionName, ok = parsed.Parsed["vpnLinkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnLinkConnectionName", *parsed) + if id.VpnLinkConnectionName, ok = input.Parsed["vpnLinkConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vpnLinkConnectionName", input) } - return &id, nil + return nil } // ValidateVpnLinkConnectionID checks that 'input' can be parsed as a Vpn Link Connection ID diff --git a/resource-manager/network/2023-04-01/vpnserverconfigurations/id_vpnserverconfiguration.go b/resource-manager/network/2023-04-01/vpnserverconfigurations/id_vpnserverconfiguration.go index 688f2431145..3371906376c 100644 --- a/resource-manager/network/2023-04-01/vpnserverconfigurations/id_vpnserverconfiguration.go +++ b/resource-manager/network/2023-04-01/vpnserverconfigurations/id_vpnserverconfiguration.go @@ -36,19 +36,9 @@ func ParseVpnServerConfigurationID(input string) (*VpnServerConfigurationId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnServerConfigurationId{} - - 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.VpnServerConfigurationName, ok = parsed.Parsed["vpnServerConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnServerConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVpnServerConfigurationIDInsensitively(input string) (*VpnServerConfigu return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnServerConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VpnServerConfigurationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VpnServerConfigurationName, ok = parsed.Parsed["vpnServerConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnServerConfigurationName", *parsed) + if id.VpnServerConfigurationName, ok = input.Parsed["vpnServerConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vpnServerConfigurationName", input) } - return &id, nil + return nil } // ValidateVpnServerConfigurationID checks that 'input' can be parsed as a Vpn Server Configuration ID diff --git a/resource-manager/network/2023-04-01/vpnsites/id_vpnsite.go b/resource-manager/network/2023-04-01/vpnsites/id_vpnsite.go index 01be85624d7..4266864fca0 100644 --- a/resource-manager/network/2023-04-01/vpnsites/id_vpnsite.go +++ b/resource-manager/network/2023-04-01/vpnsites/id_vpnsite.go @@ -36,19 +36,9 @@ func ParseVpnSiteID(input string) (*VpnSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnSiteId{} - - 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.VpnSiteName, ok = parsed.Parsed["vpnSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnSiteName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVpnSiteIDInsensitively(input string) (*VpnSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnSiteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VpnSiteId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VpnSiteName, ok = parsed.Parsed["vpnSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnSiteName", *parsed) + if id.VpnSiteName, ok = input.Parsed["vpnSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vpnSiteName", input) } - return &id, nil + return nil } // ValidateVpnSiteID checks that 'input' can be parsed as a Vpn Site ID diff --git a/resource-manager/network/2023-04-01/webapplicationfirewallpolicies/id_applicationgatewaywebapplicationfirewallpolicy.go b/resource-manager/network/2023-04-01/webapplicationfirewallpolicies/id_applicationgatewaywebapplicationfirewallpolicy.go index d15af832185..d06b36f8867 100644 --- a/resource-manager/network/2023-04-01/webapplicationfirewallpolicies/id_applicationgatewaywebapplicationfirewallpolicy.go +++ b/resource-manager/network/2023-04-01/webapplicationfirewallpolicies/id_applicationgatewaywebapplicationfirewallpolicy.go @@ -36,19 +36,9 @@ func ParseApplicationGatewayWebApplicationFirewallPolicyID(input string) (*Appli return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGatewayWebApplicationFirewallPolicyId{} - - 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.ApplicationGatewayWebApplicationFirewallPolicyName, ok = parsed.Parsed["applicationGatewayWebApplicationFirewallPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGatewayWebApplicationFirewallPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseApplicationGatewayWebApplicationFirewallPolicyIDInsensitively(input st return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGatewayWebApplicationFirewallPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ApplicationGatewayWebApplicationFirewallPolicyId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ApplicationGatewayWebApplicationFirewallPolicyName, ok = parsed.Parsed["applicationGatewayWebApplicationFirewallPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGatewayWebApplicationFirewallPolicyName", *parsed) + if id.ApplicationGatewayWebApplicationFirewallPolicyName, ok = input.Parsed["applicationGatewayWebApplicationFirewallPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationGatewayWebApplicationFirewallPolicyName", input) } - return &id, nil + return nil } // ValidateApplicationGatewayWebApplicationFirewallPolicyID checks that 'input' can be parsed as a Application Gateway Web Application Firewall Policy ID diff --git a/resource-manager/network/2023-04-01/webcategories/id_azurewebcategory.go b/resource-manager/network/2023-04-01/webcategories/id_azurewebcategory.go index 05fb4633638..acb30d2a8fa 100644 --- a/resource-manager/network/2023-04-01/webcategories/id_azurewebcategory.go +++ b/resource-manager/network/2023-04-01/webcategories/id_azurewebcategory.go @@ -34,15 +34,9 @@ func ParseAzureWebCategoryID(input string) (*AzureWebCategoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AzureWebCategoryId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.AzureWebCategoryName, ok = parsed.Parsed["azureWebCategoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "azureWebCategoryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseAzureWebCategoryIDInsensitively(input string) (*AzureWebCategoryId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AzureWebCategoryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *AzureWebCategoryId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.AzureWebCategoryName, ok = parsed.Parsed["azureWebCategoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "azureWebCategoryName", *parsed) + if id.AzureWebCategoryName, ok = input.Parsed["azureWebCategoryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "azureWebCategoryName", input) } - return &id, nil + return nil } // ValidateAzureWebCategoryID checks that 'input' can be parsed as a Azure Web Category ID diff --git a/resource-manager/network/2023-05-01/adminrulecollections/id_rulecollection.go b/resource-manager/network/2023-05-01/adminrulecollections/id_rulecollection.go index 49cb86529fd..e872007ab21 100644 --- a/resource-manager/network/2023-05-01/adminrulecollections/id_rulecollection.go +++ b/resource-manager/network/2023-05-01/adminrulecollections/id_rulecollection.go @@ -40,27 +40,9 @@ func ParseRuleCollectionID(input string) (*RuleCollectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RuleCollectionId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) - } - - if id.SecurityAdminConfigurationName, ok = parsed.Parsed["securityAdminConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityAdminConfigurationName", *parsed) - } - - if id.RuleCollectionName, ok = parsed.Parsed["ruleCollectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleCollectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseRuleCollectionIDInsensitively(input string) (*RuleCollectionId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RuleCollectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RuleCollectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - if id.SecurityAdminConfigurationName, ok = parsed.Parsed["securityAdminConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityAdminConfigurationName", *parsed) + if id.SecurityAdminConfigurationName, ok = input.Parsed["securityAdminConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "securityAdminConfigurationName", input) } - if id.RuleCollectionName, ok = parsed.Parsed["ruleCollectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleCollectionName", *parsed) + if id.RuleCollectionName, ok = input.Parsed["ruleCollectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleCollectionName", input) } - return &id, nil + return nil } // ValidateRuleCollectionID checks that 'input' can be parsed as a Rule Collection ID diff --git a/resource-manager/network/2023-05-01/adminrulecollections/id_securityadminconfiguration.go b/resource-manager/network/2023-05-01/adminrulecollections/id_securityadminconfiguration.go index 6e36b78776a..a623baf41bc 100644 --- a/resource-manager/network/2023-05-01/adminrulecollections/id_securityadminconfiguration.go +++ b/resource-manager/network/2023-05-01/adminrulecollections/id_securityadminconfiguration.go @@ -38,23 +38,9 @@ func ParseSecurityAdminConfigurationID(input string) (*SecurityAdminConfiguratio return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecurityAdminConfigurationId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) - } - - if id.SecurityAdminConfigurationName, ok = parsed.Parsed["securityAdminConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityAdminConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSecurityAdminConfigurationIDInsensitively(input string) (*SecurityAdmi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecurityAdminConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SecurityAdminConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - if id.SecurityAdminConfigurationName, ok = parsed.Parsed["securityAdminConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityAdminConfigurationName", *parsed) + if id.SecurityAdminConfigurationName, ok = input.Parsed["securityAdminConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "securityAdminConfigurationName", input) } - return &id, nil + return nil } // ValidateSecurityAdminConfigurationID checks that 'input' can be parsed as a Security Admin Configuration ID diff --git a/resource-manager/network/2023-05-01/adminrules/id_rule.go b/resource-manager/network/2023-05-01/adminrules/id_rule.go index d93cbce740e..1773ee5f02e 100644 --- a/resource-manager/network/2023-05-01/adminrules/id_rule.go +++ b/resource-manager/network/2023-05-01/adminrules/id_rule.go @@ -42,31 +42,9 @@ func ParseRuleID(input string) (*RuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RuleId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) - } - - if id.SecurityAdminConfigurationName, ok = parsed.Parsed["securityAdminConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityAdminConfigurationName", *parsed) - } - - if id.RuleCollectionName, ok = parsed.Parsed["ruleCollectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleCollectionName", *parsed) - } - - if id.RuleName, ok = parsed.Parsed["ruleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseRuleIDInsensitively(input string) (*RuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - if id.SecurityAdminConfigurationName, ok = parsed.Parsed["securityAdminConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityAdminConfigurationName", *parsed) + if id.SecurityAdminConfigurationName, ok = input.Parsed["securityAdminConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "securityAdminConfigurationName", input) } - if id.RuleCollectionName, ok = parsed.Parsed["ruleCollectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleCollectionName", *parsed) + if id.RuleCollectionName, ok = input.Parsed["ruleCollectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleCollectionName", input) } - if id.RuleName, ok = parsed.Parsed["ruleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleName", *parsed) + if id.RuleName, ok = input.Parsed["ruleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleName", input) } - return &id, nil + return nil } // ValidateRuleID checks that 'input' can be parsed as a Rule ID diff --git a/resource-manager/network/2023-05-01/adminrules/id_rulecollection.go b/resource-manager/network/2023-05-01/adminrules/id_rulecollection.go index 1cdbb320880..9755614ded3 100644 --- a/resource-manager/network/2023-05-01/adminrules/id_rulecollection.go +++ b/resource-manager/network/2023-05-01/adminrules/id_rulecollection.go @@ -40,27 +40,9 @@ func ParseRuleCollectionID(input string) (*RuleCollectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RuleCollectionId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) - } - - if id.SecurityAdminConfigurationName, ok = parsed.Parsed["securityAdminConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityAdminConfigurationName", *parsed) - } - - if id.RuleCollectionName, ok = parsed.Parsed["ruleCollectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleCollectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseRuleCollectionIDInsensitively(input string) (*RuleCollectionId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RuleCollectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RuleCollectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - if id.SecurityAdminConfigurationName, ok = parsed.Parsed["securityAdminConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityAdminConfigurationName", *parsed) + if id.SecurityAdminConfigurationName, ok = input.Parsed["securityAdminConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "securityAdminConfigurationName", input) } - if id.RuleCollectionName, ok = parsed.Parsed["ruleCollectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleCollectionName", *parsed) + if id.RuleCollectionName, ok = input.Parsed["ruleCollectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleCollectionName", input) } - return &id, nil + return nil } // ValidateRuleCollectionID checks that 'input' can be parsed as a Rule Collection ID diff --git a/resource-manager/network/2023-05-01/applicationgatewayprivateendpointconnections/id_applicationgateway.go b/resource-manager/network/2023-05-01/applicationgatewayprivateendpointconnections/id_applicationgateway.go index 58498d25a2c..cfc53ebc341 100644 --- a/resource-manager/network/2023-05-01/applicationgatewayprivateendpointconnections/id_applicationgateway.go +++ b/resource-manager/network/2023-05-01/applicationgatewayprivateendpointconnections/id_applicationgateway.go @@ -36,19 +36,9 @@ func ParseApplicationGatewayID(input string) (*ApplicationGatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGatewayId{} - - 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.ApplicationGatewayName, ok = parsed.Parsed["applicationGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGatewayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseApplicationGatewayIDInsensitively(input string) (*ApplicationGatewayId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ApplicationGatewayId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ApplicationGatewayName, ok = parsed.Parsed["applicationGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGatewayName", *parsed) + if id.ApplicationGatewayName, ok = input.Parsed["applicationGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationGatewayName", input) } - return &id, nil + return nil } // ValidateApplicationGatewayID checks that 'input' can be parsed as a Application Gateway ID diff --git a/resource-manager/network/2023-05-01/applicationgatewayprivateendpointconnections/id_applicationgatewayprivateendpointconnection.go b/resource-manager/network/2023-05-01/applicationgatewayprivateendpointconnections/id_applicationgatewayprivateendpointconnection.go index 16e2175839e..e7d21df9e97 100644 --- a/resource-manager/network/2023-05-01/applicationgatewayprivateendpointconnections/id_applicationgatewayprivateendpointconnection.go +++ b/resource-manager/network/2023-05-01/applicationgatewayprivateendpointconnections/id_applicationgatewayprivateendpointconnection.go @@ -38,23 +38,9 @@ func ParseApplicationGatewayPrivateEndpointConnectionID(input string) (*Applicat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGatewayPrivateEndpointConnectionId{} - - 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.ApplicationGatewayName, ok = parsed.Parsed["applicationGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGatewayName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApplicationGatewayPrivateEndpointConnectionIDInsensitively(input strin return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGatewayPrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApplicationGatewayPrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ApplicationGatewayName, ok = parsed.Parsed["applicationGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGatewayName", *parsed) + if id.ApplicationGatewayName, ok = input.Parsed["applicationGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationGatewayName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidateApplicationGatewayPrivateEndpointConnectionID checks that 'input' can be parsed as a Application Gateway Private Endpoint Connection ID diff --git a/resource-manager/network/2023-05-01/applicationgatewayprivatelinkresources/id_applicationgateway.go b/resource-manager/network/2023-05-01/applicationgatewayprivatelinkresources/id_applicationgateway.go index 6a994cbbf56..40c8e0927cc 100644 --- a/resource-manager/network/2023-05-01/applicationgatewayprivatelinkresources/id_applicationgateway.go +++ b/resource-manager/network/2023-05-01/applicationgatewayprivatelinkresources/id_applicationgateway.go @@ -36,19 +36,9 @@ func ParseApplicationGatewayID(input string) (*ApplicationGatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGatewayId{} - - 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.ApplicationGatewayName, ok = parsed.Parsed["applicationGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGatewayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseApplicationGatewayIDInsensitively(input string) (*ApplicationGatewayId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ApplicationGatewayId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ApplicationGatewayName, ok = parsed.Parsed["applicationGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGatewayName", *parsed) + if id.ApplicationGatewayName, ok = input.Parsed["applicationGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationGatewayName", input) } - return &id, nil + return nil } // ValidateApplicationGatewayID checks that 'input' can be parsed as a Application Gateway ID diff --git a/resource-manager/network/2023-05-01/applicationgateways/id_applicationgateway.go b/resource-manager/network/2023-05-01/applicationgateways/id_applicationgateway.go index c9e4b9d3cbb..599b534439a 100644 --- a/resource-manager/network/2023-05-01/applicationgateways/id_applicationgateway.go +++ b/resource-manager/network/2023-05-01/applicationgateways/id_applicationgateway.go @@ -36,19 +36,9 @@ func ParseApplicationGatewayID(input string) (*ApplicationGatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGatewayId{} - - 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.ApplicationGatewayName, ok = parsed.Parsed["applicationGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGatewayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseApplicationGatewayIDInsensitively(input string) (*ApplicationGatewayId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ApplicationGatewayId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ApplicationGatewayName, ok = parsed.Parsed["applicationGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGatewayName", *parsed) + if id.ApplicationGatewayName, ok = input.Parsed["applicationGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationGatewayName", input) } - return &id, nil + return nil } // ValidateApplicationGatewayID checks that 'input' can be parsed as a Application Gateway ID diff --git a/resource-manager/network/2023-05-01/applicationgateways/id_predefinedpolicy.go b/resource-manager/network/2023-05-01/applicationgateways/id_predefinedpolicy.go index b49384e166d..b5821036369 100644 --- a/resource-manager/network/2023-05-01/applicationgateways/id_predefinedpolicy.go +++ b/resource-manager/network/2023-05-01/applicationgateways/id_predefinedpolicy.go @@ -34,15 +34,9 @@ func ParsePredefinedPolicyID(input string) (*PredefinedPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PredefinedPolicyId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.PredefinedPolicyName, ok = parsed.Parsed["predefinedPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "predefinedPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParsePredefinedPolicyIDInsensitively(input string) (*PredefinedPolicyId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PredefinedPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *PredefinedPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.PredefinedPolicyName, ok = parsed.Parsed["predefinedPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "predefinedPolicyName", *parsed) + if id.PredefinedPolicyName, ok = input.Parsed["predefinedPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "predefinedPolicyName", input) } - return &id, nil + return nil } // ValidatePredefinedPolicyID checks that 'input' can be parsed as a Predefined Policy ID diff --git a/resource-manager/network/2023-05-01/applicationgatewaywafdynamicmanifests/id_location.go b/resource-manager/network/2023-05-01/applicationgatewaywafdynamicmanifests/id_location.go index d3b01a8cfce..1d6c45d8226 100644 --- a/resource-manager/network/2023-05-01/applicationgatewaywafdynamicmanifests/id_location.go +++ b/resource-manager/network/2023-05-01/applicationgatewaywafdynamicmanifests/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/network/2023-05-01/applicationsecuritygroups/id_applicationsecuritygroup.go b/resource-manager/network/2023-05-01/applicationsecuritygroups/id_applicationsecuritygroup.go index 34de777e09e..c457f791c4b 100644 --- a/resource-manager/network/2023-05-01/applicationsecuritygroups/id_applicationsecuritygroup.go +++ b/resource-manager/network/2023-05-01/applicationsecuritygroups/id_applicationsecuritygroup.go @@ -36,19 +36,9 @@ func ParseApplicationSecurityGroupID(input string) (*ApplicationSecurityGroupId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationSecurityGroupId{} - - 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.ApplicationSecurityGroupName, ok = parsed.Parsed["applicationSecurityGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationSecurityGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseApplicationSecurityGroupIDInsensitively(input string) (*ApplicationSec return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationSecurityGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ApplicationSecurityGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ApplicationSecurityGroupName, ok = parsed.Parsed["applicationSecurityGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationSecurityGroupName", *parsed) + if id.ApplicationSecurityGroupName, ok = input.Parsed["applicationSecurityGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationSecurityGroupName", input) } - return &id, nil + return nil } // ValidateApplicationSecurityGroupID checks that 'input' can be parsed as a Application Security Group ID diff --git a/resource-manager/network/2023-05-01/availabledelegations/id_location.go b/resource-manager/network/2023-05-01/availabledelegations/id_location.go index a6a158e88e6..92bfc72a62b 100644 --- a/resource-manager/network/2023-05-01/availabledelegations/id_location.go +++ b/resource-manager/network/2023-05-01/availabledelegations/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/network/2023-05-01/availabledelegations/id_providerlocation.go b/resource-manager/network/2023-05-01/availabledelegations/id_providerlocation.go index a5f5134b65c..8fdfc45fb95 100644 --- a/resource-manager/network/2023-05-01/availabledelegations/id_providerlocation.go +++ b/resource-manager/network/2023-05-01/availabledelegations/id_providerlocation.go @@ -36,19 +36,9 @@ func ParseProviderLocationID(input string) (*ProviderLocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderLocationIDInsensitively(input string) (*ProviderLocationId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderLocationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateProviderLocationID checks that 'input' can be parsed as a Provider Location ID diff --git a/resource-manager/network/2023-05-01/availableservicealiases/id_location.go b/resource-manager/network/2023-05-01/availableservicealiases/id_location.go index 7d25a1ec759..98a110bc9e5 100644 --- a/resource-manager/network/2023-05-01/availableservicealiases/id_location.go +++ b/resource-manager/network/2023-05-01/availableservicealiases/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/network/2023-05-01/availableservicealiases/id_providerlocation.go b/resource-manager/network/2023-05-01/availableservicealiases/id_providerlocation.go index 0eb12f2b132..5d51d89a821 100644 --- a/resource-manager/network/2023-05-01/availableservicealiases/id_providerlocation.go +++ b/resource-manager/network/2023-05-01/availableservicealiases/id_providerlocation.go @@ -36,19 +36,9 @@ func ParseProviderLocationID(input string) (*ProviderLocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderLocationIDInsensitively(input string) (*ProviderLocationId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderLocationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateProviderLocationID checks that 'input' can be parsed as a Provider Location ID diff --git a/resource-manager/network/2023-05-01/azurefirewalls/id_azurefirewall.go b/resource-manager/network/2023-05-01/azurefirewalls/id_azurefirewall.go index 1c8e506ab97..e1afeeca58f 100644 --- a/resource-manager/network/2023-05-01/azurefirewalls/id_azurefirewall.go +++ b/resource-manager/network/2023-05-01/azurefirewalls/id_azurefirewall.go @@ -36,19 +36,9 @@ func ParseAzureFirewallID(input string) (*AzureFirewallId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AzureFirewallId{} - - 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.AzureFirewallName, ok = parsed.Parsed["azureFirewallName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "azureFirewallName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAzureFirewallIDInsensitively(input string) (*AzureFirewallId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AzureFirewallId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AzureFirewallId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AzureFirewallName, ok = parsed.Parsed["azureFirewallName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "azureFirewallName", *parsed) + if id.AzureFirewallName, ok = input.Parsed["azureFirewallName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "azureFirewallName", input) } - return &id, nil + return nil } // ValidateAzureFirewallID checks that 'input' can be parsed as a Azure Firewall ID diff --git a/resource-manager/network/2023-05-01/bastionhosts/id_bastionhost.go b/resource-manager/network/2023-05-01/bastionhosts/id_bastionhost.go index deb83136787..b9b0bd95a9b 100644 --- a/resource-manager/network/2023-05-01/bastionhosts/id_bastionhost.go +++ b/resource-manager/network/2023-05-01/bastionhosts/id_bastionhost.go @@ -36,19 +36,9 @@ func ParseBastionHostID(input string) (*BastionHostId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BastionHostId{} - - 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.BastionHostName, ok = parsed.Parsed["bastionHostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bastionHostName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseBastionHostIDInsensitively(input string) (*BastionHostId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BastionHostId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *BastionHostId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BastionHostName, ok = parsed.Parsed["bastionHostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bastionHostName", *parsed) + if id.BastionHostName, ok = input.Parsed["bastionHostName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "bastionHostName", input) } - return &id, nil + return nil } // ValidateBastionHostID checks that 'input' can be parsed as a Bastion Host ID diff --git a/resource-manager/network/2023-05-01/bastionshareablelink/id_bastionhost.go b/resource-manager/network/2023-05-01/bastionshareablelink/id_bastionhost.go index 28c97854f8d..b000a81dd74 100644 --- a/resource-manager/network/2023-05-01/bastionshareablelink/id_bastionhost.go +++ b/resource-manager/network/2023-05-01/bastionshareablelink/id_bastionhost.go @@ -36,19 +36,9 @@ func ParseBastionHostID(input string) (*BastionHostId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BastionHostId{} - - 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.BastionHostName, ok = parsed.Parsed["bastionHostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bastionHostName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseBastionHostIDInsensitively(input string) (*BastionHostId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BastionHostId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *BastionHostId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BastionHostName, ok = parsed.Parsed["bastionHostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bastionHostName", *parsed) + if id.BastionHostName, ok = input.Parsed["bastionHostName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "bastionHostName", input) } - return &id, nil + return nil } // ValidateBastionHostID checks that 'input' can be parsed as a Bastion Host ID diff --git a/resource-manager/network/2023-05-01/checkdnsavailabilities/id_location.go b/resource-manager/network/2023-05-01/checkdnsavailabilities/id_location.go index 474bff1709b..6b84973a31b 100644 --- a/resource-manager/network/2023-05-01/checkdnsavailabilities/id_location.go +++ b/resource-manager/network/2023-05-01/checkdnsavailabilities/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/network/2023-05-01/cloudservicepublicipaddresses/id_providercloudservice.go b/resource-manager/network/2023-05-01/cloudservicepublicipaddresses/id_providercloudservice.go index 0a86336f5d8..135ae6b32ec 100644 --- a/resource-manager/network/2023-05-01/cloudservicepublicipaddresses/id_providercloudservice.go +++ b/resource-manager/network/2023-05-01/cloudservicepublicipaddresses/id_providercloudservice.go @@ -36,19 +36,9 @@ func ParseProviderCloudServiceID(input string) (*ProviderCloudServiceId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderCloudServiceId{} - - 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.CloudServiceName, ok = parsed.Parsed["cloudServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderCloudServiceIDInsensitively(input string) (*ProviderCloudServi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderCloudServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderCloudServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CloudServiceName, ok = parsed.Parsed["cloudServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", *parsed) + if id.CloudServiceName, ok = input.Parsed["cloudServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", input) } - return &id, nil + return nil } // ValidateProviderCloudServiceID checks that 'input' can be parsed as a Provider Cloud Service ID diff --git a/resource-manager/network/2023-05-01/connectionmonitors/id_connectionmonitor.go b/resource-manager/network/2023-05-01/connectionmonitors/id_connectionmonitor.go index a7922c2d666..59380596a99 100644 --- a/resource-manager/network/2023-05-01/connectionmonitors/id_connectionmonitor.go +++ b/resource-manager/network/2023-05-01/connectionmonitors/id_connectionmonitor.go @@ -38,23 +38,9 @@ func ParseConnectionMonitorID(input string) (*ConnectionMonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionMonitorId{} - - 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.NetworkWatcherName, ok = parsed.Parsed["networkWatcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", *parsed) - } - - if id.ConnectionMonitorName, ok = parsed.Parsed["connectionMonitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionMonitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConnectionMonitorIDInsensitively(input string) (*ConnectionMonitorId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionMonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConnectionMonitorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkWatcherName, ok = parsed.Parsed["networkWatcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", *parsed) + if id.NetworkWatcherName, ok = input.Parsed["networkWatcherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", input) } - if id.ConnectionMonitorName, ok = parsed.Parsed["connectionMonitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionMonitorName", *parsed) + if id.ConnectionMonitorName, ok = input.Parsed["connectionMonitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectionMonitorName", input) } - return &id, nil + return nil } // ValidateConnectionMonitorID checks that 'input' can be parsed as a Connection Monitor ID diff --git a/resource-manager/network/2023-05-01/connectionmonitors/id_networkwatcher.go b/resource-manager/network/2023-05-01/connectionmonitors/id_networkwatcher.go index 9827216a58b..363c1317ad3 100644 --- a/resource-manager/network/2023-05-01/connectionmonitors/id_networkwatcher.go +++ b/resource-manager/network/2023-05-01/connectionmonitors/id_networkwatcher.go @@ -36,19 +36,9 @@ func ParseNetworkWatcherID(input string) (*NetworkWatcherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkWatcherId{} - - 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.NetworkWatcherName, ok = parsed.Parsed["networkWatcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkWatcherIDInsensitively(input string) (*NetworkWatcherId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkWatcherId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkWatcherId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkWatcherName, ok = parsed.Parsed["networkWatcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", *parsed) + if id.NetworkWatcherName, ok = input.Parsed["networkWatcherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", input) } - return &id, nil + return nil } // ValidateNetworkWatcherID checks that 'input' can be parsed as a Network Watcher ID diff --git a/resource-manager/network/2023-05-01/connectivityconfigurations/id_connectivityconfiguration.go b/resource-manager/network/2023-05-01/connectivityconfigurations/id_connectivityconfiguration.go index 65487e1c102..5d5da37b711 100644 --- a/resource-manager/network/2023-05-01/connectivityconfigurations/id_connectivityconfiguration.go +++ b/resource-manager/network/2023-05-01/connectivityconfigurations/id_connectivityconfiguration.go @@ -38,23 +38,9 @@ func ParseConnectivityConfigurationID(input string) (*ConnectivityConfigurationI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectivityConfigurationId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) - } - - if id.ConnectivityConfigurationName, ok = parsed.Parsed["connectivityConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectivityConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConnectivityConfigurationIDInsensitively(input string) (*ConnectivityC return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectivityConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConnectivityConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - if id.ConnectivityConfigurationName, ok = parsed.Parsed["connectivityConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectivityConfigurationName", *parsed) + if id.ConnectivityConfigurationName, ok = input.Parsed["connectivityConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectivityConfigurationName", input) } - return &id, nil + return nil } // ValidateConnectivityConfigurationID checks that 'input' can be parsed as a Connectivity Configuration ID diff --git a/resource-manager/network/2023-05-01/connectivityconfigurations/id_networkmanager.go b/resource-manager/network/2023-05-01/connectivityconfigurations/id_networkmanager.go index 087c284a6d4..ec4128ee5c8 100644 --- a/resource-manager/network/2023-05-01/connectivityconfigurations/id_networkmanager.go +++ b/resource-manager/network/2023-05-01/connectivityconfigurations/id_networkmanager.go @@ -36,19 +36,9 @@ func ParseNetworkManagerID(input string) (*NetworkManagerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkManagerId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkManagerIDInsensitively(input string) (*NetworkManagerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkManagerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkManagerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - return &id, nil + return nil } // ValidateNetworkManagerID checks that 'input' can be parsed as a Network Manager ID diff --git a/resource-manager/network/2023-05-01/customipprefixes/id_customipprefix.go b/resource-manager/network/2023-05-01/customipprefixes/id_customipprefix.go index 088e2b59a9a..a409949ab9a 100644 --- a/resource-manager/network/2023-05-01/customipprefixes/id_customipprefix.go +++ b/resource-manager/network/2023-05-01/customipprefixes/id_customipprefix.go @@ -36,19 +36,9 @@ func ParseCustomIPPrefixID(input string) (*CustomIPPrefixId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CustomIPPrefixId{} - - 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.CustomIPPrefixName, ok = parsed.Parsed["customIPPrefixName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "customIPPrefixName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseCustomIPPrefixIDInsensitively(input string) (*CustomIPPrefixId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CustomIPPrefixId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CustomIPPrefixId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CustomIPPrefixName, ok = parsed.Parsed["customIPPrefixName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "customIPPrefixName", *parsed) + if id.CustomIPPrefixName, ok = input.Parsed["customIPPrefixName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "customIPPrefixName", input) } - return &id, nil + return nil } // ValidateCustomIPPrefixID checks that 'input' can be parsed as a Custom I P Prefix ID diff --git a/resource-manager/network/2023-05-01/ddoscustompolicies/id_ddoscustompolicy.go b/resource-manager/network/2023-05-01/ddoscustompolicies/id_ddoscustompolicy.go index 311930ea740..ad86631a79a 100644 --- a/resource-manager/network/2023-05-01/ddoscustompolicies/id_ddoscustompolicy.go +++ b/resource-manager/network/2023-05-01/ddoscustompolicies/id_ddoscustompolicy.go @@ -36,19 +36,9 @@ func ParseDdosCustomPolicyID(input string) (*DdosCustomPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DdosCustomPolicyId{} - - 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.DdosCustomPolicyName, ok = parsed.Parsed["ddosCustomPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ddosCustomPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDdosCustomPolicyIDInsensitively(input string) (*DdosCustomPolicyId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DdosCustomPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DdosCustomPolicyId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DdosCustomPolicyName, ok = parsed.Parsed["ddosCustomPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ddosCustomPolicyName", *parsed) + if id.DdosCustomPolicyName, ok = input.Parsed["ddosCustomPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ddosCustomPolicyName", input) } - return &id, nil + return nil } // ValidateDdosCustomPolicyID checks that 'input' can be parsed as a Ddos Custom Policy ID diff --git a/resource-manager/network/2023-05-01/ddosprotectionplans/id_ddosprotectionplan.go b/resource-manager/network/2023-05-01/ddosprotectionplans/id_ddosprotectionplan.go index 24d6a8f8f24..4dfddca2d86 100644 --- a/resource-manager/network/2023-05-01/ddosprotectionplans/id_ddosprotectionplan.go +++ b/resource-manager/network/2023-05-01/ddosprotectionplans/id_ddosprotectionplan.go @@ -36,19 +36,9 @@ func ParseDdosProtectionPlanID(input string) (*DdosProtectionPlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DdosProtectionPlanId{} - - 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.DdosProtectionPlanName, ok = parsed.Parsed["ddosProtectionPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ddosProtectionPlanName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDdosProtectionPlanIDInsensitively(input string) (*DdosProtectionPlanId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DdosProtectionPlanId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DdosProtectionPlanId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DdosProtectionPlanName, ok = parsed.Parsed["ddosProtectionPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ddosProtectionPlanName", *parsed) + if id.DdosProtectionPlanName, ok = input.Parsed["ddosProtectionPlanName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ddosProtectionPlanName", input) } - return &id, nil + return nil } // ValidateDdosProtectionPlanID checks that 'input' can be parsed as a Ddos Protection Plan ID diff --git a/resource-manager/network/2023-05-01/dscpconfiguration/id_dscpconfiguration.go b/resource-manager/network/2023-05-01/dscpconfiguration/id_dscpconfiguration.go index 4f0d024833c..6997820990c 100644 --- a/resource-manager/network/2023-05-01/dscpconfiguration/id_dscpconfiguration.go +++ b/resource-manager/network/2023-05-01/dscpconfiguration/id_dscpconfiguration.go @@ -36,19 +36,9 @@ func ParseDscpConfigurationID(input string) (*DscpConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DscpConfigurationId{} - - 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.DscpConfigurationName, ok = parsed.Parsed["dscpConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dscpConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDscpConfigurationIDInsensitively(input string) (*DscpConfigurationId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DscpConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DscpConfigurationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DscpConfigurationName, ok = parsed.Parsed["dscpConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dscpConfigurationName", *parsed) + if id.DscpConfigurationName, ok = input.Parsed["dscpConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dscpConfigurationName", input) } - return &id, nil + return nil } // ValidateDscpConfigurationID checks that 'input' can be parsed as a Dscp Configuration ID diff --git a/resource-manager/network/2023-05-01/endpointservices/id_location.go b/resource-manager/network/2023-05-01/endpointservices/id_location.go index cb3d2ffd4c8..5728b9db337 100644 --- a/resource-manager/network/2023-05-01/endpointservices/id_location.go +++ b/resource-manager/network/2023-05-01/endpointservices/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/network/2023-05-01/expressroutecircuitarptable/id_arptable.go b/resource-manager/network/2023-05-01/expressroutecircuitarptable/id_arptable.go index 0771397d6bb..4255998ba5b 100644 --- a/resource-manager/network/2023-05-01/expressroutecircuitarptable/id_arptable.go +++ b/resource-manager/network/2023-05-01/expressroutecircuitarptable/id_arptable.go @@ -40,27 +40,9 @@ func ParseArpTableID(input string) (*ArpTableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ArpTableId{} - - 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.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) - } - - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) - } - - if id.ArpTableName, ok = parsed.Parsed["arpTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "arpTableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseArpTableIDInsensitively(input string) (*ArpTableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ArpTableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ArpTableId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) + if id.ExpressRouteCircuitName, ok = input.Parsed["expressRouteCircuitName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", input) } - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) + if id.PeeringName, ok = input.Parsed["peeringName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "peeringName", input) } - if id.ArpTableName, ok = parsed.Parsed["arpTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "arpTableName", *parsed) + if id.ArpTableName, ok = input.Parsed["arpTableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "arpTableName", input) } - return &id, nil + return nil } // ValidateArpTableID checks that 'input' can be parsed as a Arp Table ID diff --git a/resource-manager/network/2023-05-01/expressroutecircuitauthorizations/id_authorization.go b/resource-manager/network/2023-05-01/expressroutecircuitauthorizations/id_authorization.go index 614f1572fa7..e0c5a60e3e6 100644 --- a/resource-manager/network/2023-05-01/expressroutecircuitauthorizations/id_authorization.go +++ b/resource-manager/network/2023-05-01/expressroutecircuitauthorizations/id_authorization.go @@ -38,23 +38,9 @@ func ParseAuthorizationID(input string) (*AuthorizationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationId{} - - 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.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) - } - - if id.AuthorizationName, ok = parsed.Parsed["authorizationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAuthorizationIDInsensitively(input string) (*AuthorizationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AuthorizationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) + if id.ExpressRouteCircuitName, ok = input.Parsed["expressRouteCircuitName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", input) } - if id.AuthorizationName, ok = parsed.Parsed["authorizationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationName", *parsed) + if id.AuthorizationName, ok = input.Parsed["authorizationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationName", input) } - return &id, nil + return nil } // ValidateAuthorizationID checks that 'input' can be parsed as a Authorization ID diff --git a/resource-manager/network/2023-05-01/expressroutecircuitauthorizations/id_expressroutecircuit.go b/resource-manager/network/2023-05-01/expressroutecircuitauthorizations/id_expressroutecircuit.go index 502b311d236..29b136159f3 100644 --- a/resource-manager/network/2023-05-01/expressroutecircuitauthorizations/id_expressroutecircuit.go +++ b/resource-manager/network/2023-05-01/expressroutecircuitauthorizations/id_expressroutecircuit.go @@ -36,19 +36,9 @@ func ParseExpressRouteCircuitID(input string) (*ExpressRouteCircuitId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteCircuitId{} - - 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.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseExpressRouteCircuitIDInsensitively(input string) (*ExpressRouteCircuit return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteCircuitId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ExpressRouteCircuitId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) + if id.ExpressRouteCircuitName, ok = input.Parsed["expressRouteCircuitName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", input) } - return &id, nil + return nil } // ValidateExpressRouteCircuitID checks that 'input' can be parsed as a Express Route Circuit ID diff --git a/resource-manager/network/2023-05-01/expressroutecircuitconnections/id_peeringconnection.go b/resource-manager/network/2023-05-01/expressroutecircuitconnections/id_peeringconnection.go index 4bdac2a095a..eba1c63329b 100644 --- a/resource-manager/network/2023-05-01/expressroutecircuitconnections/id_peeringconnection.go +++ b/resource-manager/network/2023-05-01/expressroutecircuitconnections/id_peeringconnection.go @@ -40,27 +40,9 @@ func ParsePeeringConnectionID(input string) (*PeeringConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PeeringConnectionId{} - - 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.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) - } - - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) - } - - if id.ConnectionName, ok = parsed.Parsed["connectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParsePeeringConnectionIDInsensitively(input string) (*PeeringConnectionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PeeringConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *PeeringConnectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) + if id.ExpressRouteCircuitName, ok = input.Parsed["expressRouteCircuitName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", input) } - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) + if id.PeeringName, ok = input.Parsed["peeringName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "peeringName", input) } - if id.ConnectionName, ok = parsed.Parsed["connectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionName", *parsed) + if id.ConnectionName, ok = input.Parsed["connectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectionName", input) } - return &id, nil + return nil } // ValidatePeeringConnectionID checks that 'input' can be parsed as a Peering Connection ID diff --git a/resource-manager/network/2023-05-01/expressroutecircuitpeerings/id_expressroutecircuit.go b/resource-manager/network/2023-05-01/expressroutecircuitpeerings/id_expressroutecircuit.go index 80bd7e639d7..b36253f5c4a 100644 --- a/resource-manager/network/2023-05-01/expressroutecircuitpeerings/id_expressroutecircuit.go +++ b/resource-manager/network/2023-05-01/expressroutecircuitpeerings/id_expressroutecircuit.go @@ -36,19 +36,9 @@ func ParseExpressRouteCircuitID(input string) (*ExpressRouteCircuitId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteCircuitId{} - - 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.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseExpressRouteCircuitIDInsensitively(input string) (*ExpressRouteCircuit return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteCircuitId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ExpressRouteCircuitId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) + if id.ExpressRouteCircuitName, ok = input.Parsed["expressRouteCircuitName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", input) } - return &id, nil + return nil } // ValidateExpressRouteCircuitID checks that 'input' can be parsed as a Express Route Circuit ID diff --git a/resource-manager/network/2023-05-01/expressroutecircuitroutestable/id_peeringroutetable.go b/resource-manager/network/2023-05-01/expressroutecircuitroutestable/id_peeringroutetable.go index b383a1c57d2..2aa9e827b69 100644 --- a/resource-manager/network/2023-05-01/expressroutecircuitroutestable/id_peeringroutetable.go +++ b/resource-manager/network/2023-05-01/expressroutecircuitroutestable/id_peeringroutetable.go @@ -40,27 +40,9 @@ func ParsePeeringRouteTableID(input string) (*PeeringRouteTableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PeeringRouteTableId{} - - 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.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) - } - - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) - } - - if id.RouteTableName, ok = parsed.Parsed["routeTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParsePeeringRouteTableIDInsensitively(input string) (*PeeringRouteTableId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PeeringRouteTableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *PeeringRouteTableId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) + if id.ExpressRouteCircuitName, ok = input.Parsed["expressRouteCircuitName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", input) } - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) + if id.PeeringName, ok = input.Parsed["peeringName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "peeringName", input) } - if id.RouteTableName, ok = parsed.Parsed["routeTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", *parsed) + if id.RouteTableName, ok = input.Parsed["routeTableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", input) } - return &id, nil + return nil } // ValidatePeeringRouteTableID checks that 'input' can be parsed as a Peering Route Table ID diff --git a/resource-manager/network/2023-05-01/expressroutecircuitroutestablesummary/id_routetablessummary.go b/resource-manager/network/2023-05-01/expressroutecircuitroutestablesummary/id_routetablessummary.go index 1cbf9698584..8f8c7f0a726 100644 --- a/resource-manager/network/2023-05-01/expressroutecircuitroutestablesummary/id_routetablessummary.go +++ b/resource-manager/network/2023-05-01/expressroutecircuitroutestablesummary/id_routetablessummary.go @@ -40,27 +40,9 @@ func ParseRouteTablesSummaryID(input string) (*RouteTablesSummaryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteTablesSummaryId{} - - 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.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) - } - - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) - } - - if id.RouteTablesSummaryName, ok = parsed.Parsed["routeTablesSummaryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeTablesSummaryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseRouteTablesSummaryIDInsensitively(input string) (*RouteTablesSummaryId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteTablesSummaryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RouteTablesSummaryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) + if id.ExpressRouteCircuitName, ok = input.Parsed["expressRouteCircuitName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", input) } - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) + if id.PeeringName, ok = input.Parsed["peeringName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "peeringName", input) } - if id.RouteTablesSummaryName, ok = parsed.Parsed["routeTablesSummaryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeTablesSummaryName", *parsed) + if id.RouteTablesSummaryName, ok = input.Parsed["routeTablesSummaryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routeTablesSummaryName", input) } - return &id, nil + return nil } // ValidateRouteTablesSummaryID checks that 'input' can be parsed as a Route Tables Summary ID diff --git a/resource-manager/network/2023-05-01/expressroutecircuits/id_expressroutecircuit.go b/resource-manager/network/2023-05-01/expressroutecircuits/id_expressroutecircuit.go index 76f0cad7940..386f2129eb8 100644 --- a/resource-manager/network/2023-05-01/expressroutecircuits/id_expressroutecircuit.go +++ b/resource-manager/network/2023-05-01/expressroutecircuits/id_expressroutecircuit.go @@ -36,19 +36,9 @@ func ParseExpressRouteCircuitID(input string) (*ExpressRouteCircuitId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteCircuitId{} - - 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.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseExpressRouteCircuitIDInsensitively(input string) (*ExpressRouteCircuit return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteCircuitId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ExpressRouteCircuitId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) + if id.ExpressRouteCircuitName, ok = input.Parsed["expressRouteCircuitName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", input) } - return &id, nil + return nil } // ValidateExpressRouteCircuitID checks that 'input' can be parsed as a Express Route Circuit ID diff --git a/resource-manager/network/2023-05-01/expressroutecircuitstats/id_expressroutecircuit.go b/resource-manager/network/2023-05-01/expressroutecircuitstats/id_expressroutecircuit.go index 8f5bdbd93bb..defd9b84aac 100644 --- a/resource-manager/network/2023-05-01/expressroutecircuitstats/id_expressroutecircuit.go +++ b/resource-manager/network/2023-05-01/expressroutecircuitstats/id_expressroutecircuit.go @@ -36,19 +36,9 @@ func ParseExpressRouteCircuitID(input string) (*ExpressRouteCircuitId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteCircuitId{} - - 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.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseExpressRouteCircuitIDInsensitively(input string) (*ExpressRouteCircuit return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteCircuitId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ExpressRouteCircuitId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) + if id.ExpressRouteCircuitName, ok = input.Parsed["expressRouteCircuitName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", input) } - return &id, nil + return nil } // ValidateExpressRouteCircuitID checks that 'input' can be parsed as a Express Route Circuit ID diff --git a/resource-manager/network/2023-05-01/expressrouteconnections/id_expressrouteconnection.go b/resource-manager/network/2023-05-01/expressrouteconnections/id_expressrouteconnection.go index 9df4b46202b..b43720635d6 100644 --- a/resource-manager/network/2023-05-01/expressrouteconnections/id_expressrouteconnection.go +++ b/resource-manager/network/2023-05-01/expressrouteconnections/id_expressrouteconnection.go @@ -38,23 +38,9 @@ func ParseExpressRouteConnectionID(input string) (*ExpressRouteConnectionId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteConnectionId{} - - 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.ExpressRouteGatewayName, ok = parsed.Parsed["expressRouteGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteGatewayName", *parsed) - } - - if id.ExpressRouteConnectionName, ok = parsed.Parsed["expressRouteConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseExpressRouteConnectionIDInsensitively(input string) (*ExpressRouteConn return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ExpressRouteConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteGatewayName, ok = parsed.Parsed["expressRouteGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteGatewayName", *parsed) + if id.ExpressRouteGatewayName, ok = input.Parsed["expressRouteGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteGatewayName", input) } - if id.ExpressRouteConnectionName, ok = parsed.Parsed["expressRouteConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteConnectionName", *parsed) + if id.ExpressRouteConnectionName, ok = input.Parsed["expressRouteConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteConnectionName", input) } - return &id, nil + return nil } // ValidateExpressRouteConnectionID checks that 'input' can be parsed as a Express Route Connection ID diff --git a/resource-manager/network/2023-05-01/expressrouteconnections/id_expressroutegateway.go b/resource-manager/network/2023-05-01/expressrouteconnections/id_expressroutegateway.go index a697ea8a7e4..25fd28d50f5 100644 --- a/resource-manager/network/2023-05-01/expressrouteconnections/id_expressroutegateway.go +++ b/resource-manager/network/2023-05-01/expressrouteconnections/id_expressroutegateway.go @@ -36,19 +36,9 @@ func ParseExpressRouteGatewayID(input string) (*ExpressRouteGatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteGatewayId{} - - 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.ExpressRouteGatewayName, ok = parsed.Parsed["expressRouteGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteGatewayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseExpressRouteGatewayIDInsensitively(input string) (*ExpressRouteGateway return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteGatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ExpressRouteGatewayId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteGatewayName, ok = parsed.Parsed["expressRouteGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteGatewayName", *parsed) + if id.ExpressRouteGatewayName, ok = input.Parsed["expressRouteGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteGatewayName", input) } - return &id, nil + return nil } // ValidateExpressRouteGatewayID checks that 'input' can be parsed as a Express Route Gateway ID diff --git a/resource-manager/network/2023-05-01/expressroutecrossconnectionarptable/id_peeringarptable.go b/resource-manager/network/2023-05-01/expressroutecrossconnectionarptable/id_peeringarptable.go index c7d0e4d6c08..1fa7715c5c3 100644 --- a/resource-manager/network/2023-05-01/expressroutecrossconnectionarptable/id_peeringarptable.go +++ b/resource-manager/network/2023-05-01/expressroutecrossconnectionarptable/id_peeringarptable.go @@ -40,27 +40,9 @@ func ParsePeeringArpTableID(input string) (*PeeringArpTableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PeeringArpTableId{} - - 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.ExpressRouteCrossConnectionName, ok = parsed.Parsed["expressRouteCrossConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", *parsed) - } - - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) - } - - if id.ArpTableName, ok = parsed.Parsed["arpTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "arpTableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParsePeeringArpTableIDInsensitively(input string) (*PeeringArpTableId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PeeringArpTableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *PeeringArpTableId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteCrossConnectionName, ok = parsed.Parsed["expressRouteCrossConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", *parsed) + if id.ExpressRouteCrossConnectionName, ok = input.Parsed["expressRouteCrossConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", input) } - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) + if id.PeeringName, ok = input.Parsed["peeringName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "peeringName", input) } - if id.ArpTableName, ok = parsed.Parsed["arpTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "arpTableName", *parsed) + if id.ArpTableName, ok = input.Parsed["arpTableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "arpTableName", input) } - return &id, nil + return nil } // ValidatePeeringArpTableID checks that 'input' can be parsed as a Peering Arp Table ID diff --git a/resource-manager/network/2023-05-01/expressroutecrossconnectionpeerings/id_expressroutecrossconnection.go b/resource-manager/network/2023-05-01/expressroutecrossconnectionpeerings/id_expressroutecrossconnection.go index c2abc2bcb6e..79fdcaa3b4a 100644 --- a/resource-manager/network/2023-05-01/expressroutecrossconnectionpeerings/id_expressroutecrossconnection.go +++ b/resource-manager/network/2023-05-01/expressroutecrossconnectionpeerings/id_expressroutecrossconnection.go @@ -36,19 +36,9 @@ func ParseExpressRouteCrossConnectionID(input string) (*ExpressRouteCrossConnect return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteCrossConnectionId{} - - 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.ExpressRouteCrossConnectionName, ok = parsed.Parsed["expressRouteCrossConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseExpressRouteCrossConnectionIDInsensitively(input string) (*ExpressRout return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteCrossConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ExpressRouteCrossConnectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteCrossConnectionName, ok = parsed.Parsed["expressRouteCrossConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", *parsed) + if id.ExpressRouteCrossConnectionName, ok = input.Parsed["expressRouteCrossConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", input) } - return &id, nil + return nil } // ValidateExpressRouteCrossConnectionID checks that 'input' can be parsed as a Express Route Cross Connection ID diff --git a/resource-manager/network/2023-05-01/expressroutecrossconnectionpeerings/id_peering.go b/resource-manager/network/2023-05-01/expressroutecrossconnectionpeerings/id_peering.go index 8ff1861f76d..c01ecaf33ae 100644 --- a/resource-manager/network/2023-05-01/expressroutecrossconnectionpeerings/id_peering.go +++ b/resource-manager/network/2023-05-01/expressroutecrossconnectionpeerings/id_peering.go @@ -38,23 +38,9 @@ func ParsePeeringID(input string) (*PeeringId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PeeringId{} - - 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.ExpressRouteCrossConnectionName, ok = parsed.Parsed["expressRouteCrossConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", *parsed) - } - - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePeeringIDInsensitively(input string) (*PeeringId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PeeringId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PeeringId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteCrossConnectionName, ok = parsed.Parsed["expressRouteCrossConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", *parsed) + if id.ExpressRouteCrossConnectionName, ok = input.Parsed["expressRouteCrossConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", input) } - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) + if id.PeeringName, ok = input.Parsed["peeringName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "peeringName", input) } - return &id, nil + return nil } // ValidatePeeringID checks that 'input' can be parsed as a Peering ID diff --git a/resource-manager/network/2023-05-01/expressroutecrossconnectionroutetable/id_expressroutecrossconnectionpeeringroutetable.go b/resource-manager/network/2023-05-01/expressroutecrossconnectionroutetable/id_expressroutecrossconnectionpeeringroutetable.go index 5c0a0ea5302..8b8c3b8bcb7 100644 --- a/resource-manager/network/2023-05-01/expressroutecrossconnectionroutetable/id_expressroutecrossconnectionpeeringroutetable.go +++ b/resource-manager/network/2023-05-01/expressroutecrossconnectionroutetable/id_expressroutecrossconnectionpeeringroutetable.go @@ -40,27 +40,9 @@ func ParseExpressRouteCrossConnectionPeeringRouteTableID(input string) (*Express return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteCrossConnectionPeeringRouteTableId{} - - 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.ExpressRouteCrossConnectionName, ok = parsed.Parsed["expressRouteCrossConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", *parsed) - } - - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) - } - - if id.RouteTableName, ok = parsed.Parsed["routeTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseExpressRouteCrossConnectionPeeringRouteTableIDInsensitively(input stri return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteCrossConnectionPeeringRouteTableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ExpressRouteCrossConnectionPeeringRouteTableId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteCrossConnectionName, ok = parsed.Parsed["expressRouteCrossConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", *parsed) + if id.ExpressRouteCrossConnectionName, ok = input.Parsed["expressRouteCrossConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", input) } - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) + if id.PeeringName, ok = input.Parsed["peeringName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "peeringName", input) } - if id.RouteTableName, ok = parsed.Parsed["routeTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", *parsed) + if id.RouteTableName, ok = input.Parsed["routeTableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", input) } - return &id, nil + return nil } // ValidateExpressRouteCrossConnectionPeeringRouteTableID checks that 'input' can be parsed as a Express Route Cross Connection Peering Route Table ID diff --git a/resource-manager/network/2023-05-01/expressroutecrossconnectionroutetablesummary/id_peeringroutetablessummary.go b/resource-manager/network/2023-05-01/expressroutecrossconnectionroutetablesummary/id_peeringroutetablessummary.go index d679350bf9b..cb2b91c3cb9 100644 --- a/resource-manager/network/2023-05-01/expressroutecrossconnectionroutetablesummary/id_peeringroutetablessummary.go +++ b/resource-manager/network/2023-05-01/expressroutecrossconnectionroutetablesummary/id_peeringroutetablessummary.go @@ -40,27 +40,9 @@ func ParsePeeringRouteTablesSummaryID(input string) (*PeeringRouteTablesSummaryI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PeeringRouteTablesSummaryId{} - - 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.ExpressRouteCrossConnectionName, ok = parsed.Parsed["expressRouteCrossConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", *parsed) - } - - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) - } - - if id.RouteTablesSummaryName, ok = parsed.Parsed["routeTablesSummaryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeTablesSummaryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParsePeeringRouteTablesSummaryIDInsensitively(input string) (*PeeringRouteT return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PeeringRouteTablesSummaryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *PeeringRouteTablesSummaryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteCrossConnectionName, ok = parsed.Parsed["expressRouteCrossConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", *parsed) + if id.ExpressRouteCrossConnectionName, ok = input.Parsed["expressRouteCrossConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", input) } - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) + if id.PeeringName, ok = input.Parsed["peeringName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "peeringName", input) } - if id.RouteTablesSummaryName, ok = parsed.Parsed["routeTablesSummaryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeTablesSummaryName", *parsed) + if id.RouteTablesSummaryName, ok = input.Parsed["routeTablesSummaryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routeTablesSummaryName", input) } - return &id, nil + return nil } // ValidatePeeringRouteTablesSummaryID checks that 'input' can be parsed as a Peering Route Tables Summary ID diff --git a/resource-manager/network/2023-05-01/expressroutecrossconnections/id_expressroutecrossconnection.go b/resource-manager/network/2023-05-01/expressroutecrossconnections/id_expressroutecrossconnection.go index a8eb6b95127..1007905256c 100644 --- a/resource-manager/network/2023-05-01/expressroutecrossconnections/id_expressroutecrossconnection.go +++ b/resource-manager/network/2023-05-01/expressroutecrossconnections/id_expressroutecrossconnection.go @@ -36,19 +36,9 @@ func ParseExpressRouteCrossConnectionID(input string) (*ExpressRouteCrossConnect return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteCrossConnectionId{} - - 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.ExpressRouteCrossConnectionName, ok = parsed.Parsed["expressRouteCrossConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseExpressRouteCrossConnectionIDInsensitively(input string) (*ExpressRout return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteCrossConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ExpressRouteCrossConnectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteCrossConnectionName, ok = parsed.Parsed["expressRouteCrossConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", *parsed) + if id.ExpressRouteCrossConnectionName, ok = input.Parsed["expressRouteCrossConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", input) } - return &id, nil + return nil } // ValidateExpressRouteCrossConnectionID checks that 'input' can be parsed as a Express Route Cross Connection ID diff --git a/resource-manager/network/2023-05-01/expressroutegateways/id_expressroutegateway.go b/resource-manager/network/2023-05-01/expressroutegateways/id_expressroutegateway.go index 4e9f6ccc25f..0e940d12bdf 100644 --- a/resource-manager/network/2023-05-01/expressroutegateways/id_expressroutegateway.go +++ b/resource-manager/network/2023-05-01/expressroutegateways/id_expressroutegateway.go @@ -36,19 +36,9 @@ func ParseExpressRouteGatewayID(input string) (*ExpressRouteGatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteGatewayId{} - - 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.ExpressRouteGatewayName, ok = parsed.Parsed["expressRouteGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteGatewayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseExpressRouteGatewayIDInsensitively(input string) (*ExpressRouteGateway return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteGatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ExpressRouteGatewayId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteGatewayName, ok = parsed.Parsed["expressRouteGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteGatewayName", *parsed) + if id.ExpressRouteGatewayName, ok = input.Parsed["expressRouteGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteGatewayName", input) } - return &id, nil + return nil } // ValidateExpressRouteGatewayID checks that 'input' can be parsed as a Express Route Gateway ID diff --git a/resource-manager/network/2023-05-01/expressroutelinks/id_expressrouteport.go b/resource-manager/network/2023-05-01/expressroutelinks/id_expressrouteport.go index 4c0b60ea457..1ddfc494185 100644 --- a/resource-manager/network/2023-05-01/expressroutelinks/id_expressrouteport.go +++ b/resource-manager/network/2023-05-01/expressroutelinks/id_expressrouteport.go @@ -36,19 +36,9 @@ func ParseExpressRoutePortID(input string) (*ExpressRoutePortId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRoutePortId{} - - 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.ExpressRoutePortName, ok = parsed.Parsed["expressRoutePortName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseExpressRoutePortIDInsensitively(input string) (*ExpressRoutePortId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRoutePortId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ExpressRoutePortId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRoutePortName, ok = parsed.Parsed["expressRoutePortName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortName", *parsed) + if id.ExpressRoutePortName, ok = input.Parsed["expressRoutePortName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortName", input) } - return &id, nil + return nil } // ValidateExpressRoutePortID checks that 'input' can be parsed as a Express Route Port ID diff --git a/resource-manager/network/2023-05-01/expressroutelinks/id_link.go b/resource-manager/network/2023-05-01/expressroutelinks/id_link.go index 39a80538a62..3e4266036c2 100644 --- a/resource-manager/network/2023-05-01/expressroutelinks/id_link.go +++ b/resource-manager/network/2023-05-01/expressroutelinks/id_link.go @@ -38,23 +38,9 @@ func ParseLinkID(input string) (*LinkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LinkId{} - - 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.ExpressRoutePortName, ok = parsed.Parsed["expressRoutePortName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortName", *parsed) - } - - if id.LinkName, ok = parsed.Parsed["linkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "linkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLinkIDInsensitively(input string) (*LinkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LinkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LinkId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRoutePortName, ok = parsed.Parsed["expressRoutePortName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortName", *parsed) + if id.ExpressRoutePortName, ok = input.Parsed["expressRoutePortName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortName", input) } - if id.LinkName, ok = parsed.Parsed["linkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "linkName", *parsed) + if id.LinkName, ok = input.Parsed["linkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "linkName", input) } - return &id, nil + return nil } // ValidateLinkID checks that 'input' can be parsed as a Link ID diff --git a/resource-manager/network/2023-05-01/expressrouteportauthorizations/id_expressrouteport.go b/resource-manager/network/2023-05-01/expressrouteportauthorizations/id_expressrouteport.go index be98e366b7f..a2222ad6d45 100644 --- a/resource-manager/network/2023-05-01/expressrouteportauthorizations/id_expressrouteport.go +++ b/resource-manager/network/2023-05-01/expressrouteportauthorizations/id_expressrouteport.go @@ -36,19 +36,9 @@ func ParseExpressRoutePortID(input string) (*ExpressRoutePortId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRoutePortId{} - - 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.ExpressRoutePortName, ok = parsed.Parsed["expressRoutePortName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseExpressRoutePortIDInsensitively(input string) (*ExpressRoutePortId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRoutePortId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ExpressRoutePortId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRoutePortName, ok = parsed.Parsed["expressRoutePortName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortName", *parsed) + if id.ExpressRoutePortName, ok = input.Parsed["expressRoutePortName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortName", input) } - return &id, nil + return nil } // ValidateExpressRoutePortID checks that 'input' can be parsed as a Express Route Port ID diff --git a/resource-manager/network/2023-05-01/expressrouteportauthorizations/id_expressrouteportauthorization.go b/resource-manager/network/2023-05-01/expressrouteportauthorizations/id_expressrouteportauthorization.go index 5b7042091d0..8af9ba18bf6 100644 --- a/resource-manager/network/2023-05-01/expressrouteportauthorizations/id_expressrouteportauthorization.go +++ b/resource-manager/network/2023-05-01/expressrouteportauthorizations/id_expressrouteportauthorization.go @@ -38,23 +38,9 @@ func ParseExpressRoutePortAuthorizationID(input string) (*ExpressRoutePortAuthor return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRoutePortAuthorizationId{} - - 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.ExpressRoutePortName, ok = parsed.Parsed["expressRoutePortName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortName", *parsed) - } - - if id.AuthorizationName, ok = parsed.Parsed["authorizationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseExpressRoutePortAuthorizationIDInsensitively(input string) (*ExpressRo return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRoutePortAuthorizationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ExpressRoutePortAuthorizationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRoutePortName, ok = parsed.Parsed["expressRoutePortName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortName", *parsed) + if id.ExpressRoutePortName, ok = input.Parsed["expressRoutePortName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortName", input) } - if id.AuthorizationName, ok = parsed.Parsed["authorizationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationName", *parsed) + if id.AuthorizationName, ok = input.Parsed["authorizationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationName", input) } - return &id, nil + return nil } // ValidateExpressRoutePortAuthorizationID checks that 'input' can be parsed as a Express Route Port Authorization ID diff --git a/resource-manager/network/2023-05-01/expressrouteports/id_expressrouteport.go b/resource-manager/network/2023-05-01/expressrouteports/id_expressrouteport.go index 2d3ef3fed81..ee7a7081bcc 100644 --- a/resource-manager/network/2023-05-01/expressrouteports/id_expressrouteport.go +++ b/resource-manager/network/2023-05-01/expressrouteports/id_expressrouteport.go @@ -36,19 +36,9 @@ func ParseExpressRoutePortID(input string) (*ExpressRoutePortId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRoutePortId{} - - 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.ExpressRoutePortName, ok = parsed.Parsed["expressRoutePortName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseExpressRoutePortIDInsensitively(input string) (*ExpressRoutePortId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRoutePortId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ExpressRoutePortId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRoutePortName, ok = parsed.Parsed["expressRoutePortName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortName", *parsed) + if id.ExpressRoutePortName, ok = input.Parsed["expressRoutePortName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortName", input) } - return &id, nil + return nil } // ValidateExpressRoutePortID checks that 'input' can be parsed as a Express Route Port ID diff --git a/resource-manager/network/2023-05-01/expressrouteportslocations/id_expressrouteportslocation.go b/resource-manager/network/2023-05-01/expressrouteportslocations/id_expressrouteportslocation.go index 096c43de667..bde80a447d3 100644 --- a/resource-manager/network/2023-05-01/expressrouteportslocations/id_expressrouteportslocation.go +++ b/resource-manager/network/2023-05-01/expressrouteportslocations/id_expressrouteportslocation.go @@ -34,15 +34,9 @@ func ParseExpressRoutePortsLocationID(input string) (*ExpressRoutePortsLocationI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRoutePortsLocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.ExpressRoutePortsLocationName, ok = parsed.Parsed["expressRoutePortsLocationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortsLocationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseExpressRoutePortsLocationIDInsensitively(input string) (*ExpressRouteP return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRoutePortsLocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ExpressRoutePortsLocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ExpressRoutePortsLocationName, ok = parsed.Parsed["expressRoutePortsLocationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortsLocationName", *parsed) + if id.ExpressRoutePortsLocationName, ok = input.Parsed["expressRoutePortsLocationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortsLocationName", input) } - return &id, nil + return nil } // ValidateExpressRoutePortsLocationID checks that 'input' can be parsed as a Express Route Ports Location ID diff --git a/resource-manager/network/2023-05-01/expressrouteproviderports/id_expressrouteproviderport.go b/resource-manager/network/2023-05-01/expressrouteproviderports/id_expressrouteproviderport.go index e7df5d969e9..c331d574152 100644 --- a/resource-manager/network/2023-05-01/expressrouteproviderports/id_expressrouteproviderport.go +++ b/resource-manager/network/2023-05-01/expressrouteproviderports/id_expressrouteproviderport.go @@ -34,15 +34,9 @@ func ParseExpressRouteProviderPortID(input string) (*ExpressRouteProviderPortId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteProviderPortId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.ExpressRouteProviderPortName, ok = parsed.Parsed["expressRouteProviderPortName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteProviderPortName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseExpressRouteProviderPortIDInsensitively(input string) (*ExpressRoutePr return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteProviderPortId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ExpressRouteProviderPortId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ExpressRouteProviderPortName, ok = parsed.Parsed["expressRouteProviderPortName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteProviderPortName", *parsed) + if id.ExpressRouteProviderPortName, ok = input.Parsed["expressRouteProviderPortName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteProviderPortName", input) } - return &id, nil + return nil } // ValidateExpressRouteProviderPortID checks that 'input' can be parsed as a Express Route Provider Port ID diff --git a/resource-manager/network/2023-05-01/firewallpolicies/id_firewallpolicy.go b/resource-manager/network/2023-05-01/firewallpolicies/id_firewallpolicy.go index 7b760ef341f..6cbb1ce8493 100644 --- a/resource-manager/network/2023-05-01/firewallpolicies/id_firewallpolicy.go +++ b/resource-manager/network/2023-05-01/firewallpolicies/id_firewallpolicy.go @@ -36,19 +36,9 @@ func ParseFirewallPolicyID(input string) (*FirewallPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallPolicyId{} - - 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.FirewallPolicyName, ok = parsed.Parsed["firewallPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFirewallPolicyIDInsensitively(input string) (*FirewallPolicyId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FirewallPolicyId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FirewallPolicyName, ok = parsed.Parsed["firewallPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallPolicyName", *parsed) + if id.FirewallPolicyName, ok = input.Parsed["firewallPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "firewallPolicyName", input) } - return &id, nil + return nil } // ValidateFirewallPolicyID checks that 'input' can be parsed as a Firewall Policy ID diff --git a/resource-manager/network/2023-05-01/firewallpolicyrulecollectiongroups/id_firewallpolicy.go b/resource-manager/network/2023-05-01/firewallpolicyrulecollectiongroups/id_firewallpolicy.go index 0ab64308936..2082c31895f 100644 --- a/resource-manager/network/2023-05-01/firewallpolicyrulecollectiongroups/id_firewallpolicy.go +++ b/resource-manager/network/2023-05-01/firewallpolicyrulecollectiongroups/id_firewallpolicy.go @@ -36,19 +36,9 @@ func ParseFirewallPolicyID(input string) (*FirewallPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallPolicyId{} - - 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.FirewallPolicyName, ok = parsed.Parsed["firewallPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFirewallPolicyIDInsensitively(input string) (*FirewallPolicyId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FirewallPolicyId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FirewallPolicyName, ok = parsed.Parsed["firewallPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallPolicyName", *parsed) + if id.FirewallPolicyName, ok = input.Parsed["firewallPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "firewallPolicyName", input) } - return &id, nil + return nil } // ValidateFirewallPolicyID checks that 'input' can be parsed as a Firewall Policy ID diff --git a/resource-manager/network/2023-05-01/firewallpolicyrulecollectiongroups/id_rulecollectiongroup.go b/resource-manager/network/2023-05-01/firewallpolicyrulecollectiongroups/id_rulecollectiongroup.go index 8ab322f77ac..a53efd19810 100644 --- a/resource-manager/network/2023-05-01/firewallpolicyrulecollectiongroups/id_rulecollectiongroup.go +++ b/resource-manager/network/2023-05-01/firewallpolicyrulecollectiongroups/id_rulecollectiongroup.go @@ -38,23 +38,9 @@ func ParseRuleCollectionGroupID(input string) (*RuleCollectionGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RuleCollectionGroupId{} - - 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.FirewallPolicyName, ok = parsed.Parsed["firewallPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallPolicyName", *parsed) - } - - if id.RuleCollectionGroupName, ok = parsed.Parsed["ruleCollectionGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleCollectionGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRuleCollectionGroupIDInsensitively(input string) (*RuleCollectionGroup return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RuleCollectionGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RuleCollectionGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FirewallPolicyName, ok = parsed.Parsed["firewallPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallPolicyName", *parsed) + if id.FirewallPolicyName, ok = input.Parsed["firewallPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "firewallPolicyName", input) } - if id.RuleCollectionGroupName, ok = parsed.Parsed["ruleCollectionGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleCollectionGroupName", *parsed) + if id.RuleCollectionGroupName, ok = input.Parsed["ruleCollectionGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleCollectionGroupName", input) } - return &id, nil + return nil } // ValidateRuleCollectionGroupID checks that 'input' can be parsed as a Rule Collection Group ID diff --git a/resource-manager/network/2023-05-01/flowlogs/id_flowlog.go b/resource-manager/network/2023-05-01/flowlogs/id_flowlog.go index 531b76451d0..aa2aae5403e 100644 --- a/resource-manager/network/2023-05-01/flowlogs/id_flowlog.go +++ b/resource-manager/network/2023-05-01/flowlogs/id_flowlog.go @@ -38,23 +38,9 @@ func ParseFlowLogID(input string) (*FlowLogId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlowLogId{} - - 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.NetworkWatcherName, ok = parsed.Parsed["networkWatcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", *parsed) - } - - if id.FlowLogName, ok = parsed.Parsed["flowLogName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flowLogName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFlowLogIDInsensitively(input string) (*FlowLogId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlowLogId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FlowLogId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkWatcherName, ok = parsed.Parsed["networkWatcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", *parsed) + if id.NetworkWatcherName, ok = input.Parsed["networkWatcherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", input) } - if id.FlowLogName, ok = parsed.Parsed["flowLogName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flowLogName", *parsed) + if id.FlowLogName, ok = input.Parsed["flowLogName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flowLogName", input) } - return &id, nil + return nil } // ValidateFlowLogID checks that 'input' can be parsed as a Flow Log ID diff --git a/resource-manager/network/2023-05-01/flowlogs/id_networkwatcher.go b/resource-manager/network/2023-05-01/flowlogs/id_networkwatcher.go index 5fc6d966ffe..3bbc6a1f659 100644 --- a/resource-manager/network/2023-05-01/flowlogs/id_networkwatcher.go +++ b/resource-manager/network/2023-05-01/flowlogs/id_networkwatcher.go @@ -36,19 +36,9 @@ func ParseNetworkWatcherID(input string) (*NetworkWatcherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkWatcherId{} - - 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.NetworkWatcherName, ok = parsed.Parsed["networkWatcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkWatcherIDInsensitively(input string) (*NetworkWatcherId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkWatcherId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkWatcherId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkWatcherName, ok = parsed.Parsed["networkWatcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", *parsed) + if id.NetworkWatcherName, ok = input.Parsed["networkWatcherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", input) } - return &id, nil + return nil } // ValidateNetworkWatcherID checks that 'input' can be parsed as a Network Watcher ID diff --git a/resource-manager/network/2023-05-01/ipallocations/id_ipallocation.go b/resource-manager/network/2023-05-01/ipallocations/id_ipallocation.go index 6e8aa2517f8..2a747377218 100644 --- a/resource-manager/network/2023-05-01/ipallocations/id_ipallocation.go +++ b/resource-manager/network/2023-05-01/ipallocations/id_ipallocation.go @@ -36,19 +36,9 @@ func ParseIPAllocationID(input string) (*IPAllocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IPAllocationId{} - - 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.IpAllocationName, ok = parsed.Parsed["ipAllocationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ipAllocationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseIPAllocationIDInsensitively(input string) (*IPAllocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IPAllocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *IPAllocationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.IpAllocationName, ok = parsed.Parsed["ipAllocationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ipAllocationName", *parsed) + if id.IpAllocationName, ok = input.Parsed["ipAllocationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ipAllocationName", input) } - return &id, nil + return nil } // ValidateIPAllocationID checks that 'input' can be parsed as a I P Allocation ID diff --git a/resource-manager/network/2023-05-01/ipgroups/id_ipgroup.go b/resource-manager/network/2023-05-01/ipgroups/id_ipgroup.go index 8ca4249bbd4..45902765d86 100644 --- a/resource-manager/network/2023-05-01/ipgroups/id_ipgroup.go +++ b/resource-manager/network/2023-05-01/ipgroups/id_ipgroup.go @@ -36,19 +36,9 @@ func ParseIPGroupID(input string) (*IPGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IPGroupId{} - - 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.IpGroupName, ok = parsed.Parsed["ipGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ipGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseIPGroupIDInsensitively(input string) (*IPGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IPGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *IPGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.IpGroupName, ok = parsed.Parsed["ipGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ipGroupName", *parsed) + if id.IpGroupName, ok = input.Parsed["ipGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ipGroupName", input) } - return &id, nil + return nil } // ValidateIPGroupID checks that 'input' can be parsed as a I P Group ID diff --git a/resource-manager/network/2023-05-01/loadbalancers/id_backendaddresspool.go b/resource-manager/network/2023-05-01/loadbalancers/id_backendaddresspool.go index 39e1f9356f9..8f5a557e2b8 100644 --- a/resource-manager/network/2023-05-01/loadbalancers/id_backendaddresspool.go +++ b/resource-manager/network/2023-05-01/loadbalancers/id_backendaddresspool.go @@ -38,23 +38,9 @@ func ParseBackendAddressPoolID(input string) (*BackendAddressPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackendAddressPoolId{} - - 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.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) - } - - if id.BackendAddressPoolName, ok = parsed.Parsed["backendAddressPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backendAddressPoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackendAddressPoolIDInsensitively(input string) (*BackendAddressPoolId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackendAddressPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackendAddressPoolId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) + if id.LoadBalancerName, ok = input.Parsed["loadBalancerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", input) } - if id.BackendAddressPoolName, ok = parsed.Parsed["backendAddressPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backendAddressPoolName", *parsed) + if id.BackendAddressPoolName, ok = input.Parsed["backendAddressPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backendAddressPoolName", input) } - return &id, nil + return nil } // ValidateBackendAddressPoolID checks that 'input' can be parsed as a Backend Address Pool ID diff --git a/resource-manager/network/2023-05-01/loadbalancers/id_frontendipconfiguration.go b/resource-manager/network/2023-05-01/loadbalancers/id_frontendipconfiguration.go index 9f6c3f96a03..aafe02ffabc 100644 --- a/resource-manager/network/2023-05-01/loadbalancers/id_frontendipconfiguration.go +++ b/resource-manager/network/2023-05-01/loadbalancers/id_frontendipconfiguration.go @@ -38,23 +38,9 @@ func ParseFrontendIPConfigurationID(input string) (*FrontendIPConfigurationId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FrontendIPConfigurationId{} - - 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.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) - } - - if id.FrontendIPConfigurationName, ok = parsed.Parsed["frontendIPConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "frontendIPConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFrontendIPConfigurationIDInsensitively(input string) (*FrontendIPConfi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FrontendIPConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FrontendIPConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) + if id.LoadBalancerName, ok = input.Parsed["loadBalancerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", input) } - if id.FrontendIPConfigurationName, ok = parsed.Parsed["frontendIPConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "frontendIPConfigurationName", *parsed) + if id.FrontendIPConfigurationName, ok = input.Parsed["frontendIPConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "frontendIPConfigurationName", input) } - return &id, nil + return nil } // ValidateFrontendIPConfigurationID checks that 'input' can be parsed as a Frontend I P Configuration ID diff --git a/resource-manager/network/2023-05-01/loadbalancers/id_inboundnatrule.go b/resource-manager/network/2023-05-01/loadbalancers/id_inboundnatrule.go index 8a803ad6788..6bd76e31f88 100644 --- a/resource-manager/network/2023-05-01/loadbalancers/id_inboundnatrule.go +++ b/resource-manager/network/2023-05-01/loadbalancers/id_inboundnatrule.go @@ -38,23 +38,9 @@ func ParseInboundNatRuleID(input string) (*InboundNatRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InboundNatRuleId{} - - 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.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) - } - - if id.InboundNatRuleName, ok = parsed.Parsed["inboundNatRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "inboundNatRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseInboundNatRuleIDInsensitively(input string) (*InboundNatRuleId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InboundNatRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *InboundNatRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) + if id.LoadBalancerName, ok = input.Parsed["loadBalancerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", input) } - if id.InboundNatRuleName, ok = parsed.Parsed["inboundNatRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "inboundNatRuleName", *parsed) + if id.InboundNatRuleName, ok = input.Parsed["inboundNatRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "inboundNatRuleName", input) } - return &id, nil + return nil } // ValidateInboundNatRuleID checks that 'input' can be parsed as a Inbound Nat Rule ID diff --git a/resource-manager/network/2023-05-01/loadbalancers/id_loadbalancer.go b/resource-manager/network/2023-05-01/loadbalancers/id_loadbalancer.go index 28f94e2cf3f..7bdb2e468e1 100644 --- a/resource-manager/network/2023-05-01/loadbalancers/id_loadbalancer.go +++ b/resource-manager/network/2023-05-01/loadbalancers/id_loadbalancer.go @@ -36,19 +36,9 @@ func ParseLoadBalancerID(input string) (*LoadBalancerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LoadBalancerId{} - - 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.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLoadBalancerIDInsensitively(input string) (*LoadBalancerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LoadBalancerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LoadBalancerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) + if id.LoadBalancerName, ok = input.Parsed["loadBalancerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", input) } - return &id, nil + return nil } // ValidateLoadBalancerID checks that 'input' can be parsed as a Load Balancer ID diff --git a/resource-manager/network/2023-05-01/loadbalancers/id_loadbalancerbackendaddresspool.go b/resource-manager/network/2023-05-01/loadbalancers/id_loadbalancerbackendaddresspool.go index 98ac08abc20..8698d328a33 100644 --- a/resource-manager/network/2023-05-01/loadbalancers/id_loadbalancerbackendaddresspool.go +++ b/resource-manager/network/2023-05-01/loadbalancers/id_loadbalancerbackendaddresspool.go @@ -38,23 +38,9 @@ func ParseLoadBalancerBackendAddressPoolID(input string) (*LoadBalancerBackendAd return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LoadBalancerBackendAddressPoolId{} - - 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.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) - } - - if id.BackendAddressPoolName, ok = parsed.Parsed["backendAddressPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backendAddressPoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLoadBalancerBackendAddressPoolIDInsensitively(input string) (*LoadBala return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LoadBalancerBackendAddressPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LoadBalancerBackendAddressPoolId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) + if id.LoadBalancerName, ok = input.Parsed["loadBalancerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", input) } - if id.BackendAddressPoolName, ok = parsed.Parsed["backendAddressPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backendAddressPoolName", *parsed) + if id.BackendAddressPoolName, ok = input.Parsed["backendAddressPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backendAddressPoolName", input) } - return &id, nil + return nil } // ValidateLoadBalancerBackendAddressPoolID checks that 'input' can be parsed as a Load Balancer Backend Address Pool ID diff --git a/resource-manager/network/2023-05-01/loadbalancers/id_loadbalancingrule.go b/resource-manager/network/2023-05-01/loadbalancers/id_loadbalancingrule.go index 4b3bb48b397..e5622c56f46 100644 --- a/resource-manager/network/2023-05-01/loadbalancers/id_loadbalancingrule.go +++ b/resource-manager/network/2023-05-01/loadbalancers/id_loadbalancingrule.go @@ -38,23 +38,9 @@ func ParseLoadBalancingRuleID(input string) (*LoadBalancingRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LoadBalancingRuleId{} - - 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.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) - } - - if id.LoadBalancingRuleName, ok = parsed.Parsed["loadBalancingRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancingRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLoadBalancingRuleIDInsensitively(input string) (*LoadBalancingRuleId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LoadBalancingRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LoadBalancingRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) + if id.LoadBalancerName, ok = input.Parsed["loadBalancerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", input) } - if id.LoadBalancingRuleName, ok = parsed.Parsed["loadBalancingRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancingRuleName", *parsed) + if id.LoadBalancingRuleName, ok = input.Parsed["loadBalancingRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "loadBalancingRuleName", input) } - return &id, nil + return nil } // ValidateLoadBalancingRuleID checks that 'input' can be parsed as a Load Balancing Rule ID diff --git a/resource-manager/network/2023-05-01/loadbalancers/id_location.go b/resource-manager/network/2023-05-01/loadbalancers/id_location.go index 3a2efc6db17..7a45a89e1ae 100644 --- a/resource-manager/network/2023-05-01/loadbalancers/id_location.go +++ b/resource-manager/network/2023-05-01/loadbalancers/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/network/2023-05-01/loadbalancers/id_outboundrule.go b/resource-manager/network/2023-05-01/loadbalancers/id_outboundrule.go index b2c3cafa61b..651a601a0f4 100644 --- a/resource-manager/network/2023-05-01/loadbalancers/id_outboundrule.go +++ b/resource-manager/network/2023-05-01/loadbalancers/id_outboundrule.go @@ -38,23 +38,9 @@ func ParseOutboundRuleID(input string) (*OutboundRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OutboundRuleId{} - - 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.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) - } - - if id.OutboundRuleName, ok = parsed.Parsed["outboundRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "outboundRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseOutboundRuleIDInsensitively(input string) (*OutboundRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OutboundRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OutboundRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) + if id.LoadBalancerName, ok = input.Parsed["loadBalancerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", input) } - if id.OutboundRuleName, ok = parsed.Parsed["outboundRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "outboundRuleName", *parsed) + if id.OutboundRuleName, ok = input.Parsed["outboundRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "outboundRuleName", input) } - return &id, nil + return nil } // ValidateOutboundRuleID checks that 'input' can be parsed as a Outbound Rule ID diff --git a/resource-manager/network/2023-05-01/loadbalancers/id_probe.go b/resource-manager/network/2023-05-01/loadbalancers/id_probe.go index 6307740b0b8..a6df1c3f1b1 100644 --- a/resource-manager/network/2023-05-01/loadbalancers/id_probe.go +++ b/resource-manager/network/2023-05-01/loadbalancers/id_probe.go @@ -38,23 +38,9 @@ func ParseProbeID(input string) (*ProbeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProbeId{} - - 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.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) - } - - if id.ProbeName, ok = parsed.Parsed["probeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "probeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProbeIDInsensitively(input string) (*ProbeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProbeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProbeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) + if id.LoadBalancerName, ok = input.Parsed["loadBalancerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", input) } - if id.ProbeName, ok = parsed.Parsed["probeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "probeName", *parsed) + if id.ProbeName, ok = input.Parsed["probeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "probeName", input) } - return &id, nil + return nil } // ValidateProbeID checks that 'input' can be parsed as a Probe ID diff --git a/resource-manager/network/2023-05-01/loadbalancers/id_providerloadbalancer.go b/resource-manager/network/2023-05-01/loadbalancers/id_providerloadbalancer.go index d93844028b6..c66a2652fd8 100644 --- a/resource-manager/network/2023-05-01/loadbalancers/id_providerloadbalancer.go +++ b/resource-manager/network/2023-05-01/loadbalancers/id_providerloadbalancer.go @@ -36,19 +36,9 @@ func ParseProviderLoadBalancerID(input string) (*ProviderLoadBalancerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLoadBalancerId{} - - 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.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderLoadBalancerIDInsensitively(input string) (*ProviderLoadBalanc return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLoadBalancerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderLoadBalancerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) + if id.LoadBalancerName, ok = input.Parsed["loadBalancerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", input) } - return &id, nil + return nil } // ValidateProviderLoadBalancerID checks that 'input' can be parsed as a Provider Load Balancer ID diff --git a/resource-manager/network/2023-05-01/localnetworkgateways/id_localnetworkgateway.go b/resource-manager/network/2023-05-01/localnetworkgateways/id_localnetworkgateway.go index 9e5a1b39e8c..6242e60495d 100644 --- a/resource-manager/network/2023-05-01/localnetworkgateways/id_localnetworkgateway.go +++ b/resource-manager/network/2023-05-01/localnetworkgateways/id_localnetworkgateway.go @@ -36,19 +36,9 @@ func ParseLocalNetworkGatewayID(input string) (*LocalNetworkGatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocalNetworkGatewayId{} - - 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.LocalNetworkGatewayName, ok = parsed.Parsed["localNetworkGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localNetworkGatewayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLocalNetworkGatewayIDInsensitively(input string) (*LocalNetworkGateway return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocalNetworkGatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LocalNetworkGatewayId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocalNetworkGatewayName, ok = parsed.Parsed["localNetworkGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localNetworkGatewayName", *parsed) + if id.LocalNetworkGatewayName, ok = input.Parsed["localNetworkGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "localNetworkGatewayName", input) } - return &id, nil + return nil } // ValidateLocalNetworkGatewayID checks that 'input' can be parsed as a Local Network Gateway ID diff --git a/resource-manager/network/2023-05-01/natgateways/id_natgateway.go b/resource-manager/network/2023-05-01/natgateways/id_natgateway.go index 2ce4673298f..2d35c738748 100644 --- a/resource-manager/network/2023-05-01/natgateways/id_natgateway.go +++ b/resource-manager/network/2023-05-01/natgateways/id_natgateway.go @@ -36,19 +36,9 @@ func ParseNatGatewayID(input string) (*NatGatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NatGatewayId{} - - 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.NatGatewayName, ok = parsed.Parsed["natGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "natGatewayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNatGatewayIDInsensitively(input string) (*NatGatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NatGatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NatGatewayId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NatGatewayName, ok = parsed.Parsed["natGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "natGatewayName", *parsed) + if id.NatGatewayName, ok = input.Parsed["natGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "natGatewayName", input) } - return &id, nil + return nil } // ValidateNatGatewayID checks that 'input' can be parsed as a Nat Gateway ID diff --git a/resource-manager/network/2023-05-01/networkgroups/id_networkgroup.go b/resource-manager/network/2023-05-01/networkgroups/id_networkgroup.go index e96f87ea6b4..186c7965e71 100644 --- a/resource-manager/network/2023-05-01/networkgroups/id_networkgroup.go +++ b/resource-manager/network/2023-05-01/networkgroups/id_networkgroup.go @@ -38,23 +38,9 @@ func ParseNetworkGroupID(input string) (*NetworkGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkGroupId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) - } - - if id.NetworkGroupName, ok = parsed.Parsed["networkGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseNetworkGroupIDInsensitively(input string) (*NetworkGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *NetworkGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - if id.NetworkGroupName, ok = parsed.Parsed["networkGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkGroupName", *parsed) + if id.NetworkGroupName, ok = input.Parsed["networkGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkGroupName", input) } - return &id, nil + return nil } // ValidateNetworkGroupID checks that 'input' can be parsed as a Network Group ID diff --git a/resource-manager/network/2023-05-01/networkgroups/id_networkmanager.go b/resource-manager/network/2023-05-01/networkgroups/id_networkmanager.go index 0524156947b..bcdb5221bdd 100644 --- a/resource-manager/network/2023-05-01/networkgroups/id_networkmanager.go +++ b/resource-manager/network/2023-05-01/networkgroups/id_networkmanager.go @@ -36,19 +36,9 @@ func ParseNetworkManagerID(input string) (*NetworkManagerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkManagerId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkManagerIDInsensitively(input string) (*NetworkManagerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkManagerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkManagerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - return &id, nil + return nil } // ValidateNetworkManagerID checks that 'input' can be parsed as a Network Manager ID diff --git a/resource-manager/network/2023-05-01/networkinterfaces/id_providercloudservice.go b/resource-manager/network/2023-05-01/networkinterfaces/id_providercloudservice.go index 3fcfcb53fc7..6493dd6d4f7 100644 --- a/resource-manager/network/2023-05-01/networkinterfaces/id_providercloudservice.go +++ b/resource-manager/network/2023-05-01/networkinterfaces/id_providercloudservice.go @@ -36,19 +36,9 @@ func ParseProviderCloudServiceID(input string) (*ProviderCloudServiceId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderCloudServiceId{} - - 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.CloudServiceName, ok = parsed.Parsed["cloudServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderCloudServiceIDInsensitively(input string) (*ProviderCloudServi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderCloudServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderCloudServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CloudServiceName, ok = parsed.Parsed["cloudServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", *parsed) + if id.CloudServiceName, ok = input.Parsed["cloudServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", input) } - return &id, nil + return nil } // ValidateProviderCloudServiceID checks that 'input' can be parsed as a Provider Cloud Service ID diff --git a/resource-manager/network/2023-05-01/networkinterfaces/id_roleinstance.go b/resource-manager/network/2023-05-01/networkinterfaces/id_roleinstance.go index 5c916d65fd8..8f24317428a 100644 --- a/resource-manager/network/2023-05-01/networkinterfaces/id_roleinstance.go +++ b/resource-manager/network/2023-05-01/networkinterfaces/id_roleinstance.go @@ -38,23 +38,9 @@ func ParseRoleInstanceID(input string) (*RoleInstanceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RoleInstanceId{} - - 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.CloudServiceName, ok = parsed.Parsed["cloudServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", *parsed) - } - - if id.RoleInstanceName, ok = parsed.Parsed["roleInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleInstanceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRoleInstanceIDInsensitively(input string) (*RoleInstanceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RoleInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RoleInstanceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CloudServiceName, ok = parsed.Parsed["cloudServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", *parsed) + if id.CloudServiceName, ok = input.Parsed["cloudServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", input) } - if id.RoleInstanceName, ok = parsed.Parsed["roleInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleInstanceName", *parsed) + if id.RoleInstanceName, ok = input.Parsed["roleInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "roleInstanceName", input) } - return &id, nil + return nil } // ValidateRoleInstanceID checks that 'input' can be parsed as a Role Instance ID diff --git a/resource-manager/network/2023-05-01/networkinterfaces/id_roleinstancenetworkinterface.go b/resource-manager/network/2023-05-01/networkinterfaces/id_roleinstancenetworkinterface.go index b0f618d319e..39a088a38c0 100644 --- a/resource-manager/network/2023-05-01/networkinterfaces/id_roleinstancenetworkinterface.go +++ b/resource-manager/network/2023-05-01/networkinterfaces/id_roleinstancenetworkinterface.go @@ -40,27 +40,9 @@ func ParseRoleInstanceNetworkInterfaceID(input string) (*RoleInstanceNetworkInte return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RoleInstanceNetworkInterfaceId{} - - 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.CloudServiceName, ok = parsed.Parsed["cloudServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", *parsed) - } - - if id.RoleInstanceName, ok = parsed.Parsed["roleInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleInstanceName", *parsed) - } - - if id.NetworkInterfaceName, ok = parsed.Parsed["networkInterfaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkInterfaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseRoleInstanceNetworkInterfaceIDInsensitively(input string) (*RoleInstan return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RoleInstanceNetworkInterfaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RoleInstanceNetworkInterfaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CloudServiceName, ok = parsed.Parsed["cloudServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", *parsed) + if id.CloudServiceName, ok = input.Parsed["cloudServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", input) } - if id.RoleInstanceName, ok = parsed.Parsed["roleInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleInstanceName", *parsed) + if id.RoleInstanceName, ok = input.Parsed["roleInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "roleInstanceName", input) } - if id.NetworkInterfaceName, ok = parsed.Parsed["networkInterfaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkInterfaceName", *parsed) + if id.NetworkInterfaceName, ok = input.Parsed["networkInterfaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkInterfaceName", input) } - return &id, nil + return nil } // ValidateRoleInstanceNetworkInterfaceID checks that 'input' can be parsed as a Role Instance Network Interface ID diff --git a/resource-manager/network/2023-05-01/networkinterfaces/id_tapconfiguration.go b/resource-manager/network/2023-05-01/networkinterfaces/id_tapconfiguration.go index c7879c40c1f..846e65a80a8 100644 --- a/resource-manager/network/2023-05-01/networkinterfaces/id_tapconfiguration.go +++ b/resource-manager/network/2023-05-01/networkinterfaces/id_tapconfiguration.go @@ -38,23 +38,9 @@ func ParseTapConfigurationID(input string) (*TapConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TapConfigurationId{} - - 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.NetworkInterfaceName, ok = parsed.Parsed["networkInterfaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkInterfaceName", *parsed) - } - - if id.TapConfigurationName, ok = parsed.Parsed["tapConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tapConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTapConfigurationIDInsensitively(input string) (*TapConfigurationId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TapConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TapConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkInterfaceName, ok = parsed.Parsed["networkInterfaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkInterfaceName", *parsed) + if id.NetworkInterfaceName, ok = input.Parsed["networkInterfaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkInterfaceName", input) } - if id.TapConfigurationName, ok = parsed.Parsed["tapConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tapConfigurationName", *parsed) + if id.TapConfigurationName, ok = input.Parsed["tapConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tapConfigurationName", input) } - return &id, nil + return nil } // ValidateTapConfigurationID checks that 'input' can be parsed as a Tap Configuration ID diff --git a/resource-manager/network/2023-05-01/networkinterfaces/id_virtualmachine.go b/resource-manager/network/2023-05-01/networkinterfaces/id_virtualmachine.go index c0c1dd29a1b..263ea367221 100644 --- a/resource-manager/network/2023-05-01/networkinterfaces/id_virtualmachine.go +++ b/resource-manager/network/2023-05-01/networkinterfaces/id_virtualmachine.go @@ -38,23 +38,9 @@ func ParseVirtualMachineID(input string) (*VirtualMachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) - } - - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualMachineIDInsensitively(input string) (*VirtualMachineId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - return &id, nil + return nil } // ValidateVirtualMachineID checks that 'input' can be parsed as a Virtual Machine ID diff --git a/resource-manager/network/2023-05-01/networkinterfaces/id_virtualmachinescaleset.go b/resource-manager/network/2023-05-01/networkinterfaces/id_virtualmachinescaleset.go index 8435bb247a2..04a66737ce3 100644 --- a/resource-manager/network/2023-05-01/networkinterfaces/id_virtualmachinescaleset.go +++ b/resource-manager/network/2023-05-01/networkinterfaces/id_virtualmachinescaleset.go @@ -36,19 +36,9 @@ func ParseVirtualMachineScaleSetID(input string) (*VirtualMachineScaleSetId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineScaleSetIDInsensitively(input string) (*VirtualMachineSc return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineScaleSetId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - return &id, nil + return nil } // ValidateVirtualMachineScaleSetID checks that 'input' can be parsed as a Virtual Machine Scale Set ID diff --git a/resource-manager/network/2023-05-01/networkmanageractiveconfigurations/id_networkmanager.go b/resource-manager/network/2023-05-01/networkmanageractiveconfigurations/id_networkmanager.go index eb40c45d568..1188c8c4e05 100644 --- a/resource-manager/network/2023-05-01/networkmanageractiveconfigurations/id_networkmanager.go +++ b/resource-manager/network/2023-05-01/networkmanageractiveconfigurations/id_networkmanager.go @@ -36,19 +36,9 @@ func ParseNetworkManagerID(input string) (*NetworkManagerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkManagerId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkManagerIDInsensitively(input string) (*NetworkManagerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkManagerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkManagerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - return &id, nil + return nil } // ValidateNetworkManagerID checks that 'input' can be parsed as a Network Manager ID diff --git a/resource-manager/network/2023-05-01/networkmanageractiveconnectivityconfigurations/id_networkmanager.go b/resource-manager/network/2023-05-01/networkmanageractiveconnectivityconfigurations/id_networkmanager.go index 6f686aaaba2..1bda39b2b1e 100644 --- a/resource-manager/network/2023-05-01/networkmanageractiveconnectivityconfigurations/id_networkmanager.go +++ b/resource-manager/network/2023-05-01/networkmanageractiveconnectivityconfigurations/id_networkmanager.go @@ -36,19 +36,9 @@ func ParseNetworkManagerID(input string) (*NetworkManagerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkManagerId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkManagerIDInsensitively(input string) (*NetworkManagerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkManagerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkManagerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - return &id, nil + return nil } // ValidateNetworkManagerID checks that 'input' can be parsed as a Network Manager ID diff --git a/resource-manager/network/2023-05-01/networkmanagerconnections/id_networkmanagerconnection.go b/resource-manager/network/2023-05-01/networkmanagerconnections/id_networkmanagerconnection.go index 257d0dbb580..0cee14099cf 100644 --- a/resource-manager/network/2023-05-01/networkmanagerconnections/id_networkmanagerconnection.go +++ b/resource-manager/network/2023-05-01/networkmanagerconnections/id_networkmanagerconnection.go @@ -34,15 +34,9 @@ func ParseNetworkManagerConnectionID(input string) (*NetworkManagerConnectionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkManagerConnectionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.NetworkManagerConnectionName, ok = parsed.Parsed["networkManagerConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseNetworkManagerConnectionIDInsensitively(input string) (*NetworkManager return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkManagerConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *NetworkManagerConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.NetworkManagerConnectionName, ok = parsed.Parsed["networkManagerConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerConnectionName", *parsed) + if id.NetworkManagerConnectionName, ok = input.Parsed["networkManagerConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerConnectionName", input) } - return &id, nil + return nil } // ValidateNetworkManagerConnectionID checks that 'input' can be parsed as a Network Manager Connection ID diff --git a/resource-manager/network/2023-05-01/networkmanagerconnections/id_providers2networkmanagerconnection.go b/resource-manager/network/2023-05-01/networkmanagerconnections/id_providers2networkmanagerconnection.go index eb0ead3de30..a6fa4fd9225 100644 --- a/resource-manager/network/2023-05-01/networkmanagerconnections/id_providers2networkmanagerconnection.go +++ b/resource-manager/network/2023-05-01/networkmanagerconnections/id_providers2networkmanagerconnection.go @@ -34,15 +34,9 @@ func ParseProviders2NetworkManagerConnectionID(input string) (*Providers2Network return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2NetworkManagerConnectionId{} - - if id.ManagementGroupId, ok = parsed.Parsed["managementGroupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managementGroupId", *parsed) - } - - if id.NetworkManagerConnectionName, ok = parsed.Parsed["networkManagerConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviders2NetworkManagerConnectionIDInsensitively(input string) (*Prov return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2NetworkManagerConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ManagementGroupId, ok = parsed.Parsed["managementGroupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managementGroupId", *parsed) + return &id, nil +} + +func (id *Providers2NetworkManagerConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ManagementGroupId, ok = input.Parsed["managementGroupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managementGroupId", input) } - if id.NetworkManagerConnectionName, ok = parsed.Parsed["networkManagerConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerConnectionName", *parsed) + if id.NetworkManagerConnectionName, ok = input.Parsed["networkManagerConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerConnectionName", input) } - return &id, nil + return nil } // ValidateProviders2NetworkManagerConnectionID checks that 'input' can be parsed as a Providers 2 Network Manager Connection ID diff --git a/resource-manager/network/2023-05-01/networkmanagers/id_networkmanager.go b/resource-manager/network/2023-05-01/networkmanagers/id_networkmanager.go index fa90a755a35..6ab905990a9 100644 --- a/resource-manager/network/2023-05-01/networkmanagers/id_networkmanager.go +++ b/resource-manager/network/2023-05-01/networkmanagers/id_networkmanager.go @@ -36,19 +36,9 @@ func ParseNetworkManagerID(input string) (*NetworkManagerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkManagerId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkManagerIDInsensitively(input string) (*NetworkManagerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkManagerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkManagerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - return &id, nil + return nil } // ValidateNetworkManagerID checks that 'input' can be parsed as a Network Manager ID diff --git a/resource-manager/network/2023-05-01/networkprofiles/id_networkprofile.go b/resource-manager/network/2023-05-01/networkprofiles/id_networkprofile.go index 0cacfb77d6a..75ac2822b5d 100644 --- a/resource-manager/network/2023-05-01/networkprofiles/id_networkprofile.go +++ b/resource-manager/network/2023-05-01/networkprofiles/id_networkprofile.go @@ -36,19 +36,9 @@ func ParseNetworkProfileID(input string) (*NetworkProfileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkProfileId{} - - 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.NetworkProfileName, ok = parsed.Parsed["networkProfileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkProfileName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkProfileIDInsensitively(input string) (*NetworkProfileId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkProfileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkProfileId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkProfileName, ok = parsed.Parsed["networkProfileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkProfileName", *parsed) + if id.NetworkProfileName, ok = input.Parsed["networkProfileName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkProfileName", input) } - return &id, nil + return nil } // ValidateNetworkProfileID checks that 'input' can be parsed as a Network Profile ID diff --git a/resource-manager/network/2023-05-01/networksecuritygroups/id_networksecuritygroup.go b/resource-manager/network/2023-05-01/networksecuritygroups/id_networksecuritygroup.go index 976358d972c..4714b6b6f8b 100644 --- a/resource-manager/network/2023-05-01/networksecuritygroups/id_networksecuritygroup.go +++ b/resource-manager/network/2023-05-01/networksecuritygroups/id_networksecuritygroup.go @@ -36,19 +36,9 @@ func ParseNetworkSecurityGroupID(input string) (*NetworkSecurityGroupId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkSecurityGroupId{} - - 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.NetworkSecurityGroupName, ok = parsed.Parsed["networkSecurityGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkSecurityGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkSecurityGroupIDInsensitively(input string) (*NetworkSecurityGro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkSecurityGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkSecurityGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkSecurityGroupName, ok = parsed.Parsed["networkSecurityGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkSecurityGroupName", *parsed) + if id.NetworkSecurityGroupName, ok = input.Parsed["networkSecurityGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkSecurityGroupName", input) } - return &id, nil + return nil } // ValidateNetworkSecurityGroupID checks that 'input' can be parsed as a Network Security Group ID diff --git a/resource-manager/network/2023-05-01/networkvirtualappliances/id_inboundsecurityrule.go b/resource-manager/network/2023-05-01/networkvirtualappliances/id_inboundsecurityrule.go index 57ed3f89cae..55aff9179bf 100644 --- a/resource-manager/network/2023-05-01/networkvirtualappliances/id_inboundsecurityrule.go +++ b/resource-manager/network/2023-05-01/networkvirtualappliances/id_inboundsecurityrule.go @@ -38,23 +38,9 @@ func ParseInboundSecurityRuleID(input string) (*InboundSecurityRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InboundSecurityRuleId{} - - 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.NetworkVirtualApplianceName, ok = parsed.Parsed["networkVirtualApplianceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceName", *parsed) - } - - if id.InboundSecurityRuleName, ok = parsed.Parsed["inboundSecurityRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "inboundSecurityRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseInboundSecurityRuleIDInsensitively(input string) (*InboundSecurityRule return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InboundSecurityRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *InboundSecurityRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkVirtualApplianceName, ok = parsed.Parsed["networkVirtualApplianceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceName", *parsed) + if id.NetworkVirtualApplianceName, ok = input.Parsed["networkVirtualApplianceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceName", input) } - if id.InboundSecurityRuleName, ok = parsed.Parsed["inboundSecurityRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "inboundSecurityRuleName", *parsed) + if id.InboundSecurityRuleName, ok = input.Parsed["inboundSecurityRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "inboundSecurityRuleName", input) } - return &id, nil + return nil } // ValidateInboundSecurityRuleID checks that 'input' can be parsed as a Inbound Security Rule ID diff --git a/resource-manager/network/2023-05-01/networkvirtualappliances/id_networkvirtualappliance.go b/resource-manager/network/2023-05-01/networkvirtualappliances/id_networkvirtualappliance.go index c4feaf36235..58a3908e643 100644 --- a/resource-manager/network/2023-05-01/networkvirtualappliances/id_networkvirtualappliance.go +++ b/resource-manager/network/2023-05-01/networkvirtualappliances/id_networkvirtualappliance.go @@ -36,19 +36,9 @@ func ParseNetworkVirtualApplianceID(input string) (*NetworkVirtualApplianceId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkVirtualApplianceId{} - - 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.NetworkVirtualApplianceName, ok = parsed.Parsed["networkVirtualApplianceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkVirtualApplianceIDInsensitively(input string) (*NetworkVirtualA return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkVirtualApplianceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkVirtualApplianceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkVirtualApplianceName, ok = parsed.Parsed["networkVirtualApplianceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceName", *parsed) + if id.NetworkVirtualApplianceName, ok = input.Parsed["networkVirtualApplianceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceName", input) } - return &id, nil + return nil } // ValidateNetworkVirtualApplianceID checks that 'input' can be parsed as a Network Virtual Appliance ID diff --git a/resource-manager/network/2023-05-01/networkwatchers/id_networkwatcher.go b/resource-manager/network/2023-05-01/networkwatchers/id_networkwatcher.go index 2cb57313a16..88102cbe0ba 100644 --- a/resource-manager/network/2023-05-01/networkwatchers/id_networkwatcher.go +++ b/resource-manager/network/2023-05-01/networkwatchers/id_networkwatcher.go @@ -36,19 +36,9 @@ func ParseNetworkWatcherID(input string) (*NetworkWatcherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkWatcherId{} - - 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.NetworkWatcherName, ok = parsed.Parsed["networkWatcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkWatcherIDInsensitively(input string) (*NetworkWatcherId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkWatcherId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkWatcherId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkWatcherName, ok = parsed.Parsed["networkWatcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", *parsed) + if id.NetworkWatcherName, ok = input.Parsed["networkWatcherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", input) } - return &id, nil + return nil } // ValidateNetworkWatcherID checks that 'input' can be parsed as a Network Watcher ID diff --git a/resource-manager/network/2023-05-01/packetcaptures/id_networkwatcher.go b/resource-manager/network/2023-05-01/packetcaptures/id_networkwatcher.go index b5478e241e2..05a87434be6 100644 --- a/resource-manager/network/2023-05-01/packetcaptures/id_networkwatcher.go +++ b/resource-manager/network/2023-05-01/packetcaptures/id_networkwatcher.go @@ -36,19 +36,9 @@ func ParseNetworkWatcherID(input string) (*NetworkWatcherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkWatcherId{} - - 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.NetworkWatcherName, ok = parsed.Parsed["networkWatcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkWatcherIDInsensitively(input string) (*NetworkWatcherId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkWatcherId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkWatcherId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkWatcherName, ok = parsed.Parsed["networkWatcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", *parsed) + if id.NetworkWatcherName, ok = input.Parsed["networkWatcherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", input) } - return &id, nil + return nil } // ValidateNetworkWatcherID checks that 'input' can be parsed as a Network Watcher ID diff --git a/resource-manager/network/2023-05-01/packetcaptures/id_packetcapture.go b/resource-manager/network/2023-05-01/packetcaptures/id_packetcapture.go index 57e35d5f1f2..e56233f86a2 100644 --- a/resource-manager/network/2023-05-01/packetcaptures/id_packetcapture.go +++ b/resource-manager/network/2023-05-01/packetcaptures/id_packetcapture.go @@ -38,23 +38,9 @@ func ParsePacketCaptureID(input string) (*PacketCaptureId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCaptureId{} - - 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.NetworkWatcherName, ok = parsed.Parsed["networkWatcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", *parsed) - } - - if id.PacketCaptureName, ok = parsed.Parsed["packetCaptureName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCaptureName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePacketCaptureIDInsensitively(input string) (*PacketCaptureId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCaptureId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PacketCaptureId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkWatcherName, ok = parsed.Parsed["networkWatcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", *parsed) + if id.NetworkWatcherName, ok = input.Parsed["networkWatcherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", input) } - if id.PacketCaptureName, ok = parsed.Parsed["packetCaptureName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCaptureName", *parsed) + if id.PacketCaptureName, ok = input.Parsed["packetCaptureName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCaptureName", input) } - return &id, nil + return nil } // ValidatePacketCaptureID checks that 'input' can be parsed as a Packet Capture ID diff --git a/resource-manager/network/2023-05-01/peerexpressroutecircuitconnections/id_peerconnection.go b/resource-manager/network/2023-05-01/peerexpressroutecircuitconnections/id_peerconnection.go index 9e974b3fad5..13e4d8f3184 100644 --- a/resource-manager/network/2023-05-01/peerexpressroutecircuitconnections/id_peerconnection.go +++ b/resource-manager/network/2023-05-01/peerexpressroutecircuitconnections/id_peerconnection.go @@ -40,27 +40,9 @@ func ParsePeerConnectionID(input string) (*PeerConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PeerConnectionId{} - - 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.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) - } - - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) - } - - if id.PeerConnectionName, ok = parsed.Parsed["peerConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peerConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParsePeerConnectionIDInsensitively(input string) (*PeerConnectionId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PeerConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *PeerConnectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) + if id.ExpressRouteCircuitName, ok = input.Parsed["expressRouteCircuitName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", input) } - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) + if id.PeeringName, ok = input.Parsed["peeringName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "peeringName", input) } - if id.PeerConnectionName, ok = parsed.Parsed["peerConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peerConnectionName", *parsed) + if id.PeerConnectionName, ok = input.Parsed["peerConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "peerConnectionName", input) } - return &id, nil + return nil } // ValidatePeerConnectionID checks that 'input' can be parsed as a Peer Connection ID diff --git a/resource-manager/network/2023-05-01/privatednszonegroups/id_privatednszonegroup.go b/resource-manager/network/2023-05-01/privatednszonegroups/id_privatednszonegroup.go index 532e498e159..c4cd41f32d5 100644 --- a/resource-manager/network/2023-05-01/privatednszonegroups/id_privatednszonegroup.go +++ b/resource-manager/network/2023-05-01/privatednszonegroups/id_privatednszonegroup.go @@ -38,23 +38,9 @@ func ParsePrivateDnsZoneGroupID(input string) (*PrivateDnsZoneGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateDnsZoneGroupId{} - - 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.PrivateEndpointName, ok = parsed.Parsed["privateEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointName", *parsed) - } - - if id.PrivateDnsZoneGroupName, ok = parsed.Parsed["privateDnsZoneGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateDnsZoneGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateDnsZoneGroupIDInsensitively(input string) (*PrivateDnsZoneGroup return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateDnsZoneGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateDnsZoneGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateEndpointName, ok = parsed.Parsed["privateEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointName", *parsed) + if id.PrivateEndpointName, ok = input.Parsed["privateEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointName", input) } - if id.PrivateDnsZoneGroupName, ok = parsed.Parsed["privateDnsZoneGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateDnsZoneGroupName", *parsed) + if id.PrivateDnsZoneGroupName, ok = input.Parsed["privateDnsZoneGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateDnsZoneGroupName", input) } - return &id, nil + return nil } // ValidatePrivateDnsZoneGroupID checks that 'input' can be parsed as a Private Dns Zone Group ID diff --git a/resource-manager/network/2023-05-01/privatednszonegroups/id_privateendpoint.go b/resource-manager/network/2023-05-01/privatednszonegroups/id_privateendpoint.go index a547392c0f3..16a2e56d16c 100644 --- a/resource-manager/network/2023-05-01/privatednszonegroups/id_privateendpoint.go +++ b/resource-manager/network/2023-05-01/privatednszonegroups/id_privateendpoint.go @@ -36,19 +36,9 @@ func ParsePrivateEndpointID(input string) (*PrivateEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointId{} - - 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.PrivateEndpointName, ok = parsed.Parsed["privateEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePrivateEndpointIDInsensitively(input string) (*PrivateEndpointId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PrivateEndpointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateEndpointName, ok = parsed.Parsed["privateEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointName", *parsed) + if id.PrivateEndpointName, ok = input.Parsed["privateEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointID checks that 'input' can be parsed as a Private Endpoint ID diff --git a/resource-manager/network/2023-05-01/privateendpoints/id_location.go b/resource-manager/network/2023-05-01/privateendpoints/id_location.go index 146a6110738..f2d86134426 100644 --- a/resource-manager/network/2023-05-01/privateendpoints/id_location.go +++ b/resource-manager/network/2023-05-01/privateendpoints/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/network/2023-05-01/privateendpoints/id_privateendpoint.go b/resource-manager/network/2023-05-01/privateendpoints/id_privateendpoint.go index 219fe0f7906..2122ecbbc30 100644 --- a/resource-manager/network/2023-05-01/privateendpoints/id_privateendpoint.go +++ b/resource-manager/network/2023-05-01/privateendpoints/id_privateendpoint.go @@ -36,19 +36,9 @@ func ParsePrivateEndpointID(input string) (*PrivateEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointId{} - - 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.PrivateEndpointName, ok = parsed.Parsed["privateEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePrivateEndpointIDInsensitively(input string) (*PrivateEndpointId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PrivateEndpointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateEndpointName, ok = parsed.Parsed["privateEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointName", *parsed) + if id.PrivateEndpointName, ok = input.Parsed["privateEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointID checks that 'input' can be parsed as a Private Endpoint ID diff --git a/resource-manager/network/2023-05-01/privateendpoints/id_providerlocation.go b/resource-manager/network/2023-05-01/privateendpoints/id_providerlocation.go index bdc082c0530..e412f544122 100644 --- a/resource-manager/network/2023-05-01/privateendpoints/id_providerlocation.go +++ b/resource-manager/network/2023-05-01/privateendpoints/id_providerlocation.go @@ -36,19 +36,9 @@ func ParseProviderLocationID(input string) (*ProviderLocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderLocationIDInsensitively(input string) (*ProviderLocationId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderLocationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateProviderLocationID checks that 'input' can be parsed as a Provider Location ID diff --git a/resource-manager/network/2023-05-01/privatelinkservice/id_privatelinkservice.go b/resource-manager/network/2023-05-01/privatelinkservice/id_privatelinkservice.go index 1565b227dbd..8eae2881181 100644 --- a/resource-manager/network/2023-05-01/privatelinkservice/id_privatelinkservice.go +++ b/resource-manager/network/2023-05-01/privatelinkservice/id_privatelinkservice.go @@ -36,19 +36,9 @@ func ParsePrivateLinkServiceID(input string) (*PrivateLinkServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkServiceId{} - - 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.PrivateLinkServiceName, ok = parsed.Parsed["privateLinkServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePrivateLinkServiceIDInsensitively(input string) (*PrivateLinkServiceId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PrivateLinkServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateLinkServiceName, ok = parsed.Parsed["privateLinkServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkServiceName", *parsed) + if id.PrivateLinkServiceName, ok = input.Parsed["privateLinkServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkServiceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkServiceID checks that 'input' can be parsed as a Private Link Service ID diff --git a/resource-manager/network/2023-05-01/privatelinkservices/id_location.go b/resource-manager/network/2023-05-01/privatelinkservices/id_location.go index 24e86662059..95e950e7e64 100644 --- a/resource-manager/network/2023-05-01/privatelinkservices/id_location.go +++ b/resource-manager/network/2023-05-01/privatelinkservices/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/network/2023-05-01/privatelinkservices/id_privateendpointconnection.go b/resource-manager/network/2023-05-01/privatelinkservices/id_privateendpointconnection.go index d6a66965d1b..d9cd7306b2c 100644 --- a/resource-manager/network/2023-05-01/privatelinkservices/id_privateendpointconnection.go +++ b/resource-manager/network/2023-05-01/privatelinkservices/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.PrivateLinkServiceName, ok = parsed.Parsed["privateLinkServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkServiceName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateLinkServiceName, ok = parsed.Parsed["privateLinkServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkServiceName", *parsed) + if id.PrivateLinkServiceName, ok = input.Parsed["privateLinkServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkServiceName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/network/2023-05-01/privatelinkservices/id_privatelinkservice.go b/resource-manager/network/2023-05-01/privatelinkservices/id_privatelinkservice.go index 94f3432277b..45249de5a73 100644 --- a/resource-manager/network/2023-05-01/privatelinkservices/id_privatelinkservice.go +++ b/resource-manager/network/2023-05-01/privatelinkservices/id_privatelinkservice.go @@ -36,19 +36,9 @@ func ParsePrivateLinkServiceID(input string) (*PrivateLinkServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkServiceId{} - - 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.PrivateLinkServiceName, ok = parsed.Parsed["privateLinkServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePrivateLinkServiceIDInsensitively(input string) (*PrivateLinkServiceId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PrivateLinkServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateLinkServiceName, ok = parsed.Parsed["privateLinkServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkServiceName", *parsed) + if id.PrivateLinkServiceName, ok = input.Parsed["privateLinkServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkServiceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkServiceID checks that 'input' can be parsed as a Private Link Service ID diff --git a/resource-manager/network/2023-05-01/privatelinkservices/id_providerlocation.go b/resource-manager/network/2023-05-01/privatelinkservices/id_providerlocation.go index 2b075dec749..16521a221cb 100644 --- a/resource-manager/network/2023-05-01/privatelinkservices/id_providerlocation.go +++ b/resource-manager/network/2023-05-01/privatelinkservices/id_providerlocation.go @@ -36,19 +36,9 @@ func ParseProviderLocationID(input string) (*ProviderLocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderLocationIDInsensitively(input string) (*ProviderLocationId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderLocationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateProviderLocationID checks that 'input' can be parsed as a Provider Location ID diff --git a/resource-manager/network/2023-05-01/publicipprefixes/id_publicipprefix.go b/resource-manager/network/2023-05-01/publicipprefixes/id_publicipprefix.go index 545d5140e51..8a54fd6b51e 100644 --- a/resource-manager/network/2023-05-01/publicipprefixes/id_publicipprefix.go +++ b/resource-manager/network/2023-05-01/publicipprefixes/id_publicipprefix.go @@ -36,19 +36,9 @@ func ParsePublicIPPrefixID(input string) (*PublicIPPrefixId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PublicIPPrefixId{} - - 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.PublicIPPrefixName, ok = parsed.Parsed["publicIPPrefixName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publicIPPrefixName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePublicIPPrefixIDInsensitively(input string) (*PublicIPPrefixId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PublicIPPrefixId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PublicIPPrefixId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PublicIPPrefixName, ok = parsed.Parsed["publicIPPrefixName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publicIPPrefixName", *parsed) + if id.PublicIPPrefixName, ok = input.Parsed["publicIPPrefixName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publicIPPrefixName", input) } - return &id, nil + return nil } // ValidatePublicIPPrefixID checks that 'input' can be parsed as a Public I P Prefix ID diff --git a/resource-manager/network/2023-05-01/routefilterrules/id_routefilter.go b/resource-manager/network/2023-05-01/routefilterrules/id_routefilter.go index 6ada8a037fc..20669cb3c9f 100644 --- a/resource-manager/network/2023-05-01/routefilterrules/id_routefilter.go +++ b/resource-manager/network/2023-05-01/routefilterrules/id_routefilter.go @@ -36,19 +36,9 @@ func ParseRouteFilterID(input string) (*RouteFilterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteFilterId{} - - 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.RouteFilterName, ok = parsed.Parsed["routeFilterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeFilterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRouteFilterIDInsensitively(input string) (*RouteFilterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteFilterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RouteFilterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RouteFilterName, ok = parsed.Parsed["routeFilterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeFilterName", *parsed) + if id.RouteFilterName, ok = input.Parsed["routeFilterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routeFilterName", input) } - return &id, nil + return nil } // ValidateRouteFilterID checks that 'input' can be parsed as a Route Filter ID diff --git a/resource-manager/network/2023-05-01/routefilterrules/id_routefilterrule.go b/resource-manager/network/2023-05-01/routefilterrules/id_routefilterrule.go index e4cf470acdc..fffc56ea557 100644 --- a/resource-manager/network/2023-05-01/routefilterrules/id_routefilterrule.go +++ b/resource-manager/network/2023-05-01/routefilterrules/id_routefilterrule.go @@ -38,23 +38,9 @@ func ParseRouteFilterRuleID(input string) (*RouteFilterRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteFilterRuleId{} - - 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.RouteFilterName, ok = parsed.Parsed["routeFilterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeFilterName", *parsed) - } - - if id.RouteFilterRuleName, ok = parsed.Parsed["routeFilterRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeFilterRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRouteFilterRuleIDInsensitively(input string) (*RouteFilterRuleId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteFilterRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RouteFilterRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RouteFilterName, ok = parsed.Parsed["routeFilterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeFilterName", *parsed) + if id.RouteFilterName, ok = input.Parsed["routeFilterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routeFilterName", input) } - if id.RouteFilterRuleName, ok = parsed.Parsed["routeFilterRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeFilterRuleName", *parsed) + if id.RouteFilterRuleName, ok = input.Parsed["routeFilterRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routeFilterRuleName", input) } - return &id, nil + return nil } // ValidateRouteFilterRuleID checks that 'input' can be parsed as a Route Filter Rule ID diff --git a/resource-manager/network/2023-05-01/routefilters/id_routefilter.go b/resource-manager/network/2023-05-01/routefilters/id_routefilter.go index 0d539e18cc3..4104bf0d154 100644 --- a/resource-manager/network/2023-05-01/routefilters/id_routefilter.go +++ b/resource-manager/network/2023-05-01/routefilters/id_routefilter.go @@ -36,19 +36,9 @@ func ParseRouteFilterID(input string) (*RouteFilterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteFilterId{} - - 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.RouteFilterName, ok = parsed.Parsed["routeFilterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeFilterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRouteFilterIDInsensitively(input string) (*RouteFilterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteFilterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RouteFilterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RouteFilterName, ok = parsed.Parsed["routeFilterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeFilterName", *parsed) + if id.RouteFilterName, ok = input.Parsed["routeFilterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routeFilterName", input) } - return &id, nil + return nil } // ValidateRouteFilterID checks that 'input' can be parsed as a Route Filter ID diff --git a/resource-manager/network/2023-05-01/routes/id_route.go b/resource-manager/network/2023-05-01/routes/id_route.go index f2bbb0efdb5..aa8060fb8f7 100644 --- a/resource-manager/network/2023-05-01/routes/id_route.go +++ b/resource-manager/network/2023-05-01/routes/id_route.go @@ -38,23 +38,9 @@ func ParseRouteID(input string) (*RouteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteId{} - - 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.RouteTableName, ok = parsed.Parsed["routeTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", *parsed) - } - - if id.RouteName, ok = parsed.Parsed["routeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRouteIDInsensitively(input string) (*RouteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RouteId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RouteTableName, ok = parsed.Parsed["routeTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", *parsed) + if id.RouteTableName, ok = input.Parsed["routeTableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", input) } - if id.RouteName, ok = parsed.Parsed["routeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeName", *parsed) + if id.RouteName, ok = input.Parsed["routeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routeName", input) } - return &id, nil + return nil } // ValidateRouteID checks that 'input' can be parsed as a Route ID diff --git a/resource-manager/network/2023-05-01/routes/id_routetable.go b/resource-manager/network/2023-05-01/routes/id_routetable.go index c8aadc85160..2aaab7c00d7 100644 --- a/resource-manager/network/2023-05-01/routes/id_routetable.go +++ b/resource-manager/network/2023-05-01/routes/id_routetable.go @@ -36,19 +36,9 @@ func ParseRouteTableID(input string) (*RouteTableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteTableId{} - - 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.RouteTableName, ok = parsed.Parsed["routeTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRouteTableIDInsensitively(input string) (*RouteTableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteTableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RouteTableId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RouteTableName, ok = parsed.Parsed["routeTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", *parsed) + if id.RouteTableName, ok = input.Parsed["routeTableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", input) } - return &id, nil + return nil } // ValidateRouteTableID checks that 'input' can be parsed as a Route Table ID diff --git a/resource-manager/network/2023-05-01/routetables/id_routetable.go b/resource-manager/network/2023-05-01/routetables/id_routetable.go index 15838ef16b1..8fe456d11cd 100644 --- a/resource-manager/network/2023-05-01/routetables/id_routetable.go +++ b/resource-manager/network/2023-05-01/routetables/id_routetable.go @@ -36,19 +36,9 @@ func ParseRouteTableID(input string) (*RouteTableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteTableId{} - - 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.RouteTableName, ok = parsed.Parsed["routeTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRouteTableIDInsensitively(input string) (*RouteTableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteTableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RouteTableId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RouteTableName, ok = parsed.Parsed["routeTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", *parsed) + if id.RouteTableName, ok = input.Parsed["routeTableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", input) } - return &id, nil + return nil } // ValidateRouteTableID checks that 'input' can be parsed as a Route Table ID diff --git a/resource-manager/network/2023-05-01/scopeconnections/id_networkmanager.go b/resource-manager/network/2023-05-01/scopeconnections/id_networkmanager.go index 8e518126e3d..168e6173785 100644 --- a/resource-manager/network/2023-05-01/scopeconnections/id_networkmanager.go +++ b/resource-manager/network/2023-05-01/scopeconnections/id_networkmanager.go @@ -36,19 +36,9 @@ func ParseNetworkManagerID(input string) (*NetworkManagerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkManagerId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkManagerIDInsensitively(input string) (*NetworkManagerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkManagerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkManagerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - return &id, nil + return nil } // ValidateNetworkManagerID checks that 'input' can be parsed as a Network Manager ID diff --git a/resource-manager/network/2023-05-01/scopeconnections/id_scopeconnection.go b/resource-manager/network/2023-05-01/scopeconnections/id_scopeconnection.go index dbc1fb7a7a7..bafad6ca7ab 100644 --- a/resource-manager/network/2023-05-01/scopeconnections/id_scopeconnection.go +++ b/resource-manager/network/2023-05-01/scopeconnections/id_scopeconnection.go @@ -38,23 +38,9 @@ func ParseScopeConnectionID(input string) (*ScopeConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopeConnectionId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) - } - - if id.ScopeConnectionName, ok = parsed.Parsed["scopeConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scopeConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseScopeConnectionIDInsensitively(input string) (*ScopeConnectionId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopeConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ScopeConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - if id.ScopeConnectionName, ok = parsed.Parsed["scopeConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scopeConnectionName", *parsed) + if id.ScopeConnectionName, ok = input.Parsed["scopeConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scopeConnectionName", input) } - return &id, nil + return nil } // ValidateScopeConnectionID checks that 'input' can be parsed as a Scope Connection ID diff --git a/resource-manager/network/2023-05-01/securityadminconfigurations/id_networkmanager.go b/resource-manager/network/2023-05-01/securityadminconfigurations/id_networkmanager.go index aec8d0fdd53..89b28c6005a 100644 --- a/resource-manager/network/2023-05-01/securityadminconfigurations/id_networkmanager.go +++ b/resource-manager/network/2023-05-01/securityadminconfigurations/id_networkmanager.go @@ -36,19 +36,9 @@ func ParseNetworkManagerID(input string) (*NetworkManagerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkManagerId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkManagerIDInsensitively(input string) (*NetworkManagerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkManagerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkManagerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - return &id, nil + return nil } // ValidateNetworkManagerID checks that 'input' can be parsed as a Network Manager ID diff --git a/resource-manager/network/2023-05-01/securityadminconfigurations/id_securityadminconfiguration.go b/resource-manager/network/2023-05-01/securityadminconfigurations/id_securityadminconfiguration.go index 3c2a8543126..5876385de21 100644 --- a/resource-manager/network/2023-05-01/securityadminconfigurations/id_securityadminconfiguration.go +++ b/resource-manager/network/2023-05-01/securityadminconfigurations/id_securityadminconfiguration.go @@ -38,23 +38,9 @@ func ParseSecurityAdminConfigurationID(input string) (*SecurityAdminConfiguratio return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecurityAdminConfigurationId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) - } - - if id.SecurityAdminConfigurationName, ok = parsed.Parsed["securityAdminConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityAdminConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSecurityAdminConfigurationIDInsensitively(input string) (*SecurityAdmi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecurityAdminConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SecurityAdminConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - if id.SecurityAdminConfigurationName, ok = parsed.Parsed["securityAdminConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityAdminConfigurationName", *parsed) + if id.SecurityAdminConfigurationName, ok = input.Parsed["securityAdminConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "securityAdminConfigurationName", input) } - return &id, nil + return nil } // ValidateSecurityAdminConfigurationID checks that 'input' can be parsed as a Security Admin Configuration ID diff --git a/resource-manager/network/2023-05-01/securitypartnerproviders/id_securitypartnerprovider.go b/resource-manager/network/2023-05-01/securitypartnerproviders/id_securitypartnerprovider.go index 3ebe53eb67a..91f369b0d33 100644 --- a/resource-manager/network/2023-05-01/securitypartnerproviders/id_securitypartnerprovider.go +++ b/resource-manager/network/2023-05-01/securitypartnerproviders/id_securitypartnerprovider.go @@ -36,19 +36,9 @@ func ParseSecurityPartnerProviderID(input string) (*SecurityPartnerProviderId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecurityPartnerProviderId{} - - 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.SecurityPartnerProviderName, ok = parsed.Parsed["securityPartnerProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityPartnerProviderName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSecurityPartnerProviderIDInsensitively(input string) (*SecurityPartner return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecurityPartnerProviderId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SecurityPartnerProviderId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SecurityPartnerProviderName, ok = parsed.Parsed["securityPartnerProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityPartnerProviderName", *parsed) + if id.SecurityPartnerProviderName, ok = input.Parsed["securityPartnerProviderName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "securityPartnerProviderName", input) } - return &id, nil + return nil } // ValidateSecurityPartnerProviderID checks that 'input' can be parsed as a Security Partner Provider ID diff --git a/resource-manager/network/2023-05-01/securityrules/id_defaultsecurityrule.go b/resource-manager/network/2023-05-01/securityrules/id_defaultsecurityrule.go index e4a89e02f98..6c7a0c23433 100644 --- a/resource-manager/network/2023-05-01/securityrules/id_defaultsecurityrule.go +++ b/resource-manager/network/2023-05-01/securityrules/id_defaultsecurityrule.go @@ -38,23 +38,9 @@ func ParseDefaultSecurityRuleID(input string) (*DefaultSecurityRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DefaultSecurityRuleId{} - - 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.NetworkSecurityGroupName, ok = parsed.Parsed["networkSecurityGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkSecurityGroupName", *parsed) - } - - if id.DefaultSecurityRuleName, ok = parsed.Parsed["defaultSecurityRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "defaultSecurityRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDefaultSecurityRuleIDInsensitively(input string) (*DefaultSecurityRule return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DefaultSecurityRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DefaultSecurityRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkSecurityGroupName, ok = parsed.Parsed["networkSecurityGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkSecurityGroupName", *parsed) + if id.NetworkSecurityGroupName, ok = input.Parsed["networkSecurityGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkSecurityGroupName", input) } - if id.DefaultSecurityRuleName, ok = parsed.Parsed["defaultSecurityRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "defaultSecurityRuleName", *parsed) + if id.DefaultSecurityRuleName, ok = input.Parsed["defaultSecurityRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "defaultSecurityRuleName", input) } - return &id, nil + return nil } // ValidateDefaultSecurityRuleID checks that 'input' can be parsed as a Default Security Rule ID diff --git a/resource-manager/network/2023-05-01/securityrules/id_networksecuritygroup.go b/resource-manager/network/2023-05-01/securityrules/id_networksecuritygroup.go index 07dda76386b..2a508ada09a 100644 --- a/resource-manager/network/2023-05-01/securityrules/id_networksecuritygroup.go +++ b/resource-manager/network/2023-05-01/securityrules/id_networksecuritygroup.go @@ -36,19 +36,9 @@ func ParseNetworkSecurityGroupID(input string) (*NetworkSecurityGroupId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkSecurityGroupId{} - - 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.NetworkSecurityGroupName, ok = parsed.Parsed["networkSecurityGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkSecurityGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkSecurityGroupIDInsensitively(input string) (*NetworkSecurityGro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkSecurityGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkSecurityGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkSecurityGroupName, ok = parsed.Parsed["networkSecurityGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkSecurityGroupName", *parsed) + if id.NetworkSecurityGroupName, ok = input.Parsed["networkSecurityGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkSecurityGroupName", input) } - return &id, nil + return nil } // ValidateNetworkSecurityGroupID checks that 'input' can be parsed as a Network Security Group ID diff --git a/resource-manager/network/2023-05-01/securityrules/id_securityrule.go b/resource-manager/network/2023-05-01/securityrules/id_securityrule.go index 32ca98be479..3c3391537ed 100644 --- a/resource-manager/network/2023-05-01/securityrules/id_securityrule.go +++ b/resource-manager/network/2023-05-01/securityrules/id_securityrule.go @@ -38,23 +38,9 @@ func ParseSecurityRuleID(input string) (*SecurityRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecurityRuleId{} - - 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.NetworkSecurityGroupName, ok = parsed.Parsed["networkSecurityGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkSecurityGroupName", *parsed) - } - - if id.SecurityRuleName, ok = parsed.Parsed["securityRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSecurityRuleIDInsensitively(input string) (*SecurityRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecurityRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SecurityRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkSecurityGroupName, ok = parsed.Parsed["networkSecurityGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkSecurityGroupName", *parsed) + if id.NetworkSecurityGroupName, ok = input.Parsed["networkSecurityGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkSecurityGroupName", input) } - if id.SecurityRuleName, ok = parsed.Parsed["securityRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityRuleName", *parsed) + if id.SecurityRuleName, ok = input.Parsed["securityRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "securityRuleName", input) } - return &id, nil + return nil } // ValidateSecurityRuleID checks that 'input' can be parsed as a Security Rule ID diff --git a/resource-manager/network/2023-05-01/serviceendpointpolicies/id_serviceendpointpolicy.go b/resource-manager/network/2023-05-01/serviceendpointpolicies/id_serviceendpointpolicy.go index 1df0f6e4676..2b791b53a7e 100644 --- a/resource-manager/network/2023-05-01/serviceendpointpolicies/id_serviceendpointpolicy.go +++ b/resource-manager/network/2023-05-01/serviceendpointpolicies/id_serviceendpointpolicy.go @@ -36,19 +36,9 @@ func ParseServiceEndpointPolicyID(input string) (*ServiceEndpointPolicyId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceEndpointPolicyId{} - - 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.ServiceEndpointPolicyName, ok = parsed.Parsed["serviceEndpointPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceEndpointPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceEndpointPolicyIDInsensitively(input string) (*ServiceEndpointPo return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceEndpointPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceEndpointPolicyId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceEndpointPolicyName, ok = parsed.Parsed["serviceEndpointPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceEndpointPolicyName", *parsed) + if id.ServiceEndpointPolicyName, ok = input.Parsed["serviceEndpointPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceEndpointPolicyName", input) } - return &id, nil + return nil } // ValidateServiceEndpointPolicyID checks that 'input' can be parsed as a Service Endpoint Policy ID diff --git a/resource-manager/network/2023-05-01/serviceendpointpolicydefinitions/id_serviceendpointpolicy.go b/resource-manager/network/2023-05-01/serviceendpointpolicydefinitions/id_serviceendpointpolicy.go index 979cf4f022e..83015de951d 100644 --- a/resource-manager/network/2023-05-01/serviceendpointpolicydefinitions/id_serviceendpointpolicy.go +++ b/resource-manager/network/2023-05-01/serviceendpointpolicydefinitions/id_serviceendpointpolicy.go @@ -36,19 +36,9 @@ func ParseServiceEndpointPolicyID(input string) (*ServiceEndpointPolicyId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceEndpointPolicyId{} - - 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.ServiceEndpointPolicyName, ok = parsed.Parsed["serviceEndpointPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceEndpointPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceEndpointPolicyIDInsensitively(input string) (*ServiceEndpointPo return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceEndpointPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceEndpointPolicyId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceEndpointPolicyName, ok = parsed.Parsed["serviceEndpointPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceEndpointPolicyName", *parsed) + if id.ServiceEndpointPolicyName, ok = input.Parsed["serviceEndpointPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceEndpointPolicyName", input) } - return &id, nil + return nil } // ValidateServiceEndpointPolicyID checks that 'input' can be parsed as a Service Endpoint Policy ID diff --git a/resource-manager/network/2023-05-01/serviceendpointpolicydefinitions/id_serviceendpointpolicydefinition.go b/resource-manager/network/2023-05-01/serviceendpointpolicydefinitions/id_serviceendpointpolicydefinition.go index f8fabb5925a..f64efcf7090 100644 --- a/resource-manager/network/2023-05-01/serviceendpointpolicydefinitions/id_serviceendpointpolicydefinition.go +++ b/resource-manager/network/2023-05-01/serviceendpointpolicydefinitions/id_serviceendpointpolicydefinition.go @@ -38,23 +38,9 @@ func ParseServiceEndpointPolicyDefinitionID(input string) (*ServiceEndpointPolic return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceEndpointPolicyDefinitionId{} - - 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.ServiceEndpointPolicyName, ok = parsed.Parsed["serviceEndpointPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceEndpointPolicyName", *parsed) - } - - if id.ServiceEndpointPolicyDefinitionName, ok = parsed.Parsed["serviceEndpointPolicyDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceEndpointPolicyDefinitionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseServiceEndpointPolicyDefinitionIDInsensitively(input string) (*Service return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceEndpointPolicyDefinitionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ServiceEndpointPolicyDefinitionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceEndpointPolicyName, ok = parsed.Parsed["serviceEndpointPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceEndpointPolicyName", *parsed) + if id.ServiceEndpointPolicyName, ok = input.Parsed["serviceEndpointPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceEndpointPolicyName", input) } - if id.ServiceEndpointPolicyDefinitionName, ok = parsed.Parsed["serviceEndpointPolicyDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceEndpointPolicyDefinitionName", *parsed) + if id.ServiceEndpointPolicyDefinitionName, ok = input.Parsed["serviceEndpointPolicyDefinitionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceEndpointPolicyDefinitionName", input) } - return &id, nil + return nil } // ValidateServiceEndpointPolicyDefinitionID checks that 'input' can be parsed as a Service Endpoint Policy Definition ID diff --git a/resource-manager/network/2023-05-01/servicetags/id_location.go b/resource-manager/network/2023-05-01/servicetags/id_location.go index 2d8a29c22d9..768bb04fc55 100644 --- a/resource-manager/network/2023-05-01/servicetags/id_location.go +++ b/resource-manager/network/2023-05-01/servicetags/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/network/2023-05-01/staticmembers/id_networkgroup.go b/resource-manager/network/2023-05-01/staticmembers/id_networkgroup.go index 67b3fd5daf1..85f6e10e5ea 100644 --- a/resource-manager/network/2023-05-01/staticmembers/id_networkgroup.go +++ b/resource-manager/network/2023-05-01/staticmembers/id_networkgroup.go @@ -38,23 +38,9 @@ func ParseNetworkGroupID(input string) (*NetworkGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkGroupId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) - } - - if id.NetworkGroupName, ok = parsed.Parsed["networkGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseNetworkGroupIDInsensitively(input string) (*NetworkGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *NetworkGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - if id.NetworkGroupName, ok = parsed.Parsed["networkGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkGroupName", *parsed) + if id.NetworkGroupName, ok = input.Parsed["networkGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkGroupName", input) } - return &id, nil + return nil } // ValidateNetworkGroupID checks that 'input' can be parsed as a Network Group ID diff --git a/resource-manager/network/2023-05-01/staticmembers/id_staticmember.go b/resource-manager/network/2023-05-01/staticmembers/id_staticmember.go index c42f4e8bd27..92cd458d75c 100644 --- a/resource-manager/network/2023-05-01/staticmembers/id_staticmember.go +++ b/resource-manager/network/2023-05-01/staticmembers/id_staticmember.go @@ -40,27 +40,9 @@ func ParseStaticMemberID(input string) (*StaticMemberId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StaticMemberId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) - } - - if id.NetworkGroupName, ok = parsed.Parsed["networkGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkGroupName", *parsed) - } - - if id.StaticMemberName, ok = parsed.Parsed["staticMemberName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticMemberName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseStaticMemberIDInsensitively(input string) (*StaticMemberId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StaticMemberId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *StaticMemberId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - if id.NetworkGroupName, ok = parsed.Parsed["networkGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkGroupName", *parsed) + if id.NetworkGroupName, ok = input.Parsed["networkGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkGroupName", input) } - if id.StaticMemberName, ok = parsed.Parsed["staticMemberName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticMemberName", *parsed) + if id.StaticMemberName, ok = input.Parsed["staticMemberName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "staticMemberName", input) } - return &id, nil + return nil } // ValidateStaticMemberID checks that 'input' can be parsed as a Static Member ID diff --git a/resource-manager/network/2023-05-01/trafficanalytics/id_networkwatcher.go b/resource-manager/network/2023-05-01/trafficanalytics/id_networkwatcher.go index 28df98e2c49..cf23d7e1b6b 100644 --- a/resource-manager/network/2023-05-01/trafficanalytics/id_networkwatcher.go +++ b/resource-manager/network/2023-05-01/trafficanalytics/id_networkwatcher.go @@ -36,19 +36,9 @@ func ParseNetworkWatcherID(input string) (*NetworkWatcherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkWatcherId{} - - 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.NetworkWatcherName, ok = parsed.Parsed["networkWatcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkWatcherIDInsensitively(input string) (*NetworkWatcherId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkWatcherId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkWatcherId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkWatcherName, ok = parsed.Parsed["networkWatcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", *parsed) + if id.NetworkWatcherName, ok = input.Parsed["networkWatcherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", input) } - return &id, nil + return nil } // ValidateNetworkWatcherID checks that 'input' can be parsed as a Network Watcher ID diff --git a/resource-manager/network/2023-05-01/usages/id_location.go b/resource-manager/network/2023-05-01/usages/id_location.go index ef70b32225b..0ea1a3015ad 100644 --- a/resource-manager/network/2023-05-01/usages/id_location.go +++ b/resource-manager/network/2023-05-01/usages/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/network/2023-05-01/vipswap/id_cloudservice.go b/resource-manager/network/2023-05-01/vipswap/id_cloudservice.go index 9544661fbc5..aab8095b940 100644 --- a/resource-manager/network/2023-05-01/vipswap/id_cloudservice.go +++ b/resource-manager/network/2023-05-01/vipswap/id_cloudservice.go @@ -36,19 +36,9 @@ func ParseCloudServiceID(input string) (*CloudServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CloudServiceId{} - - 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.CloudServiceName, ok = parsed.Parsed["cloudServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseCloudServiceIDInsensitively(input string) (*CloudServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CloudServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CloudServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CloudServiceName, ok = parsed.Parsed["cloudServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", *parsed) + if id.CloudServiceName, ok = input.Parsed["cloudServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", input) } - return &id, nil + return nil } // ValidateCloudServiceID checks that 'input' can be parsed as a Cloud Service ID diff --git a/resource-manager/network/2023-05-01/virtualappliancesites/id_networkvirtualappliance.go b/resource-manager/network/2023-05-01/virtualappliancesites/id_networkvirtualappliance.go index 2ae3ddeb528..3a98094ce5f 100644 --- a/resource-manager/network/2023-05-01/virtualappliancesites/id_networkvirtualappliance.go +++ b/resource-manager/network/2023-05-01/virtualappliancesites/id_networkvirtualappliance.go @@ -36,19 +36,9 @@ func ParseNetworkVirtualApplianceID(input string) (*NetworkVirtualApplianceId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkVirtualApplianceId{} - - 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.NetworkVirtualApplianceName, ok = parsed.Parsed["networkVirtualApplianceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkVirtualApplianceIDInsensitively(input string) (*NetworkVirtualA return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkVirtualApplianceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkVirtualApplianceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkVirtualApplianceName, ok = parsed.Parsed["networkVirtualApplianceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceName", *parsed) + if id.NetworkVirtualApplianceName, ok = input.Parsed["networkVirtualApplianceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceName", input) } - return &id, nil + return nil } // ValidateNetworkVirtualApplianceID checks that 'input' can be parsed as a Network Virtual Appliance ID diff --git a/resource-manager/network/2023-05-01/virtualappliancesites/id_virtualappliancesite.go b/resource-manager/network/2023-05-01/virtualappliancesites/id_virtualappliancesite.go index 62bcc9817bf..64fcaa60c67 100644 --- a/resource-manager/network/2023-05-01/virtualappliancesites/id_virtualappliancesite.go +++ b/resource-manager/network/2023-05-01/virtualappliancesites/id_virtualappliancesite.go @@ -38,23 +38,9 @@ func ParseVirtualApplianceSiteID(input string) (*VirtualApplianceSiteId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualApplianceSiteId{} - - 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.NetworkVirtualApplianceName, ok = parsed.Parsed["networkVirtualApplianceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceName", *parsed) - } - - if id.VirtualApplianceSiteName, ok = parsed.Parsed["virtualApplianceSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualApplianceSiteName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualApplianceSiteIDInsensitively(input string) (*VirtualApplianceSi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualApplianceSiteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualApplianceSiteId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkVirtualApplianceName, ok = parsed.Parsed["networkVirtualApplianceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceName", *parsed) + if id.NetworkVirtualApplianceName, ok = input.Parsed["networkVirtualApplianceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceName", input) } - if id.VirtualApplianceSiteName, ok = parsed.Parsed["virtualApplianceSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualApplianceSiteName", *parsed) + if id.VirtualApplianceSiteName, ok = input.Parsed["virtualApplianceSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualApplianceSiteName", input) } - return &id, nil + return nil } // ValidateVirtualApplianceSiteID checks that 'input' can be parsed as a Virtual Appliance Site ID diff --git a/resource-manager/network/2023-05-01/virtualapplianceskus/id_networkvirtualappliancesku.go b/resource-manager/network/2023-05-01/virtualapplianceskus/id_networkvirtualappliancesku.go index 7558f22904e..9a208383365 100644 --- a/resource-manager/network/2023-05-01/virtualapplianceskus/id_networkvirtualappliancesku.go +++ b/resource-manager/network/2023-05-01/virtualapplianceskus/id_networkvirtualappliancesku.go @@ -34,15 +34,9 @@ func ParseNetworkVirtualApplianceSkuID(input string) (*NetworkVirtualApplianceSk return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkVirtualApplianceSkuId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.NetworkVirtualApplianceSkuName, ok = parsed.Parsed["networkVirtualApplianceSkuName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceSkuName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseNetworkVirtualApplianceSkuIDInsensitively(input string) (*NetworkVirtu return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkVirtualApplianceSkuId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *NetworkVirtualApplianceSkuId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.NetworkVirtualApplianceSkuName, ok = parsed.Parsed["networkVirtualApplianceSkuName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceSkuName", *parsed) + if id.NetworkVirtualApplianceSkuName, ok = input.Parsed["networkVirtualApplianceSkuName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceSkuName", input) } - return &id, nil + return nil } // ValidateNetworkVirtualApplianceSkuID checks that 'input' can be parsed as a Network Virtual Appliance Sku ID diff --git a/resource-manager/network/2023-05-01/virtualnetworkgatewayconnections/id_connection.go b/resource-manager/network/2023-05-01/virtualnetworkgatewayconnections/id_connection.go index 20cd2e94077..d894548ccde 100644 --- a/resource-manager/network/2023-05-01/virtualnetworkgatewayconnections/id_connection.go +++ b/resource-manager/network/2023-05-01/virtualnetworkgatewayconnections/id_connection.go @@ -36,19 +36,9 @@ func ParseConnectionID(input string) (*ConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionId{} - - 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.ConnectionName, ok = parsed.Parsed["connectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseConnectionIDInsensitively(input string) (*ConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ConnectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ConnectionName, ok = parsed.Parsed["connectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionName", *parsed) + if id.ConnectionName, ok = input.Parsed["connectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectionName", input) } - return &id, nil + return nil } // ValidateConnectionID checks that 'input' can be parsed as a Connection ID diff --git a/resource-manager/network/2023-05-01/virtualnetworkgateways/id_connection.go b/resource-manager/network/2023-05-01/virtualnetworkgateways/id_connection.go index 0474f12724b..bdc065e680c 100644 --- a/resource-manager/network/2023-05-01/virtualnetworkgateways/id_connection.go +++ b/resource-manager/network/2023-05-01/virtualnetworkgateways/id_connection.go @@ -36,19 +36,9 @@ func ParseConnectionID(input string) (*ConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionId{} - - 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.ConnectionName, ok = parsed.Parsed["connectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseConnectionIDInsensitively(input string) (*ConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ConnectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ConnectionName, ok = parsed.Parsed["connectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionName", *parsed) + if id.ConnectionName, ok = input.Parsed["connectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectionName", input) } - return &id, nil + return nil } // ValidateConnectionID checks that 'input' can be parsed as a Connection ID diff --git a/resource-manager/network/2023-05-01/virtualnetworkgateways/id_virtualnetworkgateway.go b/resource-manager/network/2023-05-01/virtualnetworkgateways/id_virtualnetworkgateway.go index f405ee0a07d..30e96c0b114 100644 --- a/resource-manager/network/2023-05-01/virtualnetworkgateways/id_virtualnetworkgateway.go +++ b/resource-manager/network/2023-05-01/virtualnetworkgateways/id_virtualnetworkgateway.go @@ -36,19 +36,9 @@ func ParseVirtualNetworkGatewayID(input string) (*VirtualNetworkGatewayId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkGatewayId{} - - 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.VirtualNetworkGatewayName, ok = parsed.Parsed["virtualNetworkGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkGatewayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualNetworkGatewayIDInsensitively(input string) (*VirtualNetworkGat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkGatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualNetworkGatewayId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualNetworkGatewayName, ok = parsed.Parsed["virtualNetworkGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkGatewayName", *parsed) + if id.VirtualNetworkGatewayName, ok = input.Parsed["virtualNetworkGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkGatewayName", input) } - return &id, nil + return nil } // ValidateVirtualNetworkGatewayID checks that 'input' can be parsed as a Virtual Network Gateway ID diff --git a/resource-manager/network/2023-05-01/virtualnetworkgateways/id_virtualnetworkgatewaynatrule.go b/resource-manager/network/2023-05-01/virtualnetworkgateways/id_virtualnetworkgatewaynatrule.go index 76631d94563..d261f426c85 100644 --- a/resource-manager/network/2023-05-01/virtualnetworkgateways/id_virtualnetworkgatewaynatrule.go +++ b/resource-manager/network/2023-05-01/virtualnetworkgateways/id_virtualnetworkgatewaynatrule.go @@ -38,23 +38,9 @@ func ParseVirtualNetworkGatewayNatRuleID(input string) (*VirtualNetworkGatewayNa return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkGatewayNatRuleId{} - - 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.VirtualNetworkGatewayName, ok = parsed.Parsed["virtualNetworkGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkGatewayName", *parsed) - } - - if id.NatRuleName, ok = parsed.Parsed["natRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "natRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualNetworkGatewayNatRuleIDInsensitively(input string) (*VirtualNet return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkGatewayNatRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualNetworkGatewayNatRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualNetworkGatewayName, ok = parsed.Parsed["virtualNetworkGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkGatewayName", *parsed) + if id.VirtualNetworkGatewayName, ok = input.Parsed["virtualNetworkGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkGatewayName", input) } - if id.NatRuleName, ok = parsed.Parsed["natRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "natRuleName", *parsed) + if id.NatRuleName, ok = input.Parsed["natRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "natRuleName", input) } - return &id, nil + return nil } // ValidateVirtualNetworkGatewayNatRuleID checks that 'input' can be parsed as a Virtual Network Gateway Nat Rule ID diff --git a/resource-manager/network/2023-05-01/virtualnetworkpeerings/id_virtualnetworkpeering.go b/resource-manager/network/2023-05-01/virtualnetworkpeerings/id_virtualnetworkpeering.go index aaaf017cf07..de01f35aeb8 100644 --- a/resource-manager/network/2023-05-01/virtualnetworkpeerings/id_virtualnetworkpeering.go +++ b/resource-manager/network/2023-05-01/virtualnetworkpeerings/id_virtualnetworkpeering.go @@ -38,23 +38,9 @@ func ParseVirtualNetworkPeeringID(input string) (*VirtualNetworkPeeringId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkPeeringId{} - - 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.VirtualNetworkName, ok = parsed.Parsed["virtualNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkName", *parsed) - } - - if id.VirtualNetworkPeeringName, ok = parsed.Parsed["virtualNetworkPeeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkPeeringName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualNetworkPeeringIDInsensitively(input string) (*VirtualNetworkPee return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkPeeringId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualNetworkPeeringId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualNetworkName, ok = parsed.Parsed["virtualNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkName", *parsed) + if id.VirtualNetworkName, ok = input.Parsed["virtualNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkName", input) } - if id.VirtualNetworkPeeringName, ok = parsed.Parsed["virtualNetworkPeeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkPeeringName", *parsed) + if id.VirtualNetworkPeeringName, ok = input.Parsed["virtualNetworkPeeringName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkPeeringName", input) } - return &id, nil + return nil } // ValidateVirtualNetworkPeeringID checks that 'input' can be parsed as a Virtual Network Peering ID diff --git a/resource-manager/network/2023-05-01/virtualnetworktap/id_virtualnetworktap.go b/resource-manager/network/2023-05-01/virtualnetworktap/id_virtualnetworktap.go index 7e7e843e4d1..1264701d515 100644 --- a/resource-manager/network/2023-05-01/virtualnetworktap/id_virtualnetworktap.go +++ b/resource-manager/network/2023-05-01/virtualnetworktap/id_virtualnetworktap.go @@ -36,19 +36,9 @@ func ParseVirtualNetworkTapID(input string) (*VirtualNetworkTapId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkTapId{} - - 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.VirtualNetworkTapName, ok = parsed.Parsed["virtualNetworkTapName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkTapName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualNetworkTapIDInsensitively(input string) (*VirtualNetworkTapId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkTapId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualNetworkTapId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualNetworkTapName, ok = parsed.Parsed["virtualNetworkTapName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkTapName", *parsed) + if id.VirtualNetworkTapName, ok = input.Parsed["virtualNetworkTapName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkTapName", input) } - return &id, nil + return nil } // ValidateVirtualNetworkTapID checks that 'input' can be parsed as a Virtual Network Tap ID diff --git a/resource-manager/network/2023-05-01/virtualrouterpeerings/id_virtualrouter.go b/resource-manager/network/2023-05-01/virtualrouterpeerings/id_virtualrouter.go index 885ce3a276a..0cfcf59d124 100644 --- a/resource-manager/network/2023-05-01/virtualrouterpeerings/id_virtualrouter.go +++ b/resource-manager/network/2023-05-01/virtualrouterpeerings/id_virtualrouter.go @@ -36,19 +36,9 @@ func ParseVirtualRouterID(input string) (*VirtualRouterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualRouterId{} - - 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.VirtualRouterName, ok = parsed.Parsed["virtualRouterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualRouterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualRouterIDInsensitively(input string) (*VirtualRouterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualRouterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualRouterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualRouterName, ok = parsed.Parsed["virtualRouterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualRouterName", *parsed) + if id.VirtualRouterName, ok = input.Parsed["virtualRouterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualRouterName", input) } - return &id, nil + return nil } // ValidateVirtualRouterID checks that 'input' can be parsed as a Virtual Router ID diff --git a/resource-manager/network/2023-05-01/virtualrouters/id_virtualrouter.go b/resource-manager/network/2023-05-01/virtualrouters/id_virtualrouter.go index ecb01bd99e5..5832396424b 100644 --- a/resource-manager/network/2023-05-01/virtualrouters/id_virtualrouter.go +++ b/resource-manager/network/2023-05-01/virtualrouters/id_virtualrouter.go @@ -36,19 +36,9 @@ func ParseVirtualRouterID(input string) (*VirtualRouterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualRouterId{} - - 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.VirtualRouterName, ok = parsed.Parsed["virtualRouterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualRouterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualRouterIDInsensitively(input string) (*VirtualRouterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualRouterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualRouterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualRouterName, ok = parsed.Parsed["virtualRouterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualRouterName", *parsed) + if id.VirtualRouterName, ok = input.Parsed["virtualRouterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualRouterName", input) } - return &id, nil + return nil } // ValidateVirtualRouterID checks that 'input' can be parsed as a Virtual Router ID diff --git a/resource-manager/network/2023-05-01/virtualwans/id_configurationpolicygroup.go b/resource-manager/network/2023-05-01/virtualwans/id_configurationpolicygroup.go index d6c7f2eaff8..dff384d30ca 100644 --- a/resource-manager/network/2023-05-01/virtualwans/id_configurationpolicygroup.go +++ b/resource-manager/network/2023-05-01/virtualwans/id_configurationpolicygroup.go @@ -38,23 +38,9 @@ func ParseConfigurationPolicyGroupID(input string) (*ConfigurationPolicyGroupId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationPolicyGroupId{} - - 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.VpnServerConfigurationName, ok = parsed.Parsed["vpnServerConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnServerConfigurationName", *parsed) - } - - if id.ConfigurationPolicyGroupName, ok = parsed.Parsed["configurationPolicyGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationPolicyGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConfigurationPolicyGroupIDInsensitively(input string) (*ConfigurationP return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationPolicyGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConfigurationPolicyGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VpnServerConfigurationName, ok = parsed.Parsed["vpnServerConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnServerConfigurationName", *parsed) + if id.VpnServerConfigurationName, ok = input.Parsed["vpnServerConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vpnServerConfigurationName", input) } - if id.ConfigurationPolicyGroupName, ok = parsed.Parsed["configurationPolicyGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationPolicyGroupName", *parsed) + if id.ConfigurationPolicyGroupName, ok = input.Parsed["configurationPolicyGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationPolicyGroupName", input) } - return &id, nil + return nil } // ValidateConfigurationPolicyGroupID checks that 'input' can be parsed as a Configuration Policy Group ID diff --git a/resource-manager/network/2023-05-01/virtualwans/id_hubroutetable.go b/resource-manager/network/2023-05-01/virtualwans/id_hubroutetable.go index 0297471a681..72310881bba 100644 --- a/resource-manager/network/2023-05-01/virtualwans/id_hubroutetable.go +++ b/resource-manager/network/2023-05-01/virtualwans/id_hubroutetable.go @@ -38,23 +38,9 @@ func ParseHubRouteTableID(input string) (*HubRouteTableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HubRouteTableId{} - - 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.VirtualHubName, ok = parsed.Parsed["virtualHubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", *parsed) - } - - if id.HubRouteTableName, ok = parsed.Parsed["hubRouteTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hubRouteTableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseHubRouteTableIDInsensitively(input string) (*HubRouteTableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HubRouteTableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *HubRouteTableId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualHubName, ok = parsed.Parsed["virtualHubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", *parsed) + if id.VirtualHubName, ok = input.Parsed["virtualHubName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", input) } - if id.HubRouteTableName, ok = parsed.Parsed["hubRouteTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hubRouteTableName", *parsed) + if id.HubRouteTableName, ok = input.Parsed["hubRouteTableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hubRouteTableName", input) } - return &id, nil + return nil } // ValidateHubRouteTableID checks that 'input' can be parsed as a Hub Route Table ID diff --git a/resource-manager/network/2023-05-01/virtualwans/id_hubvirtualnetworkconnection.go b/resource-manager/network/2023-05-01/virtualwans/id_hubvirtualnetworkconnection.go index e5bc46da4b4..116cf5cd477 100644 --- a/resource-manager/network/2023-05-01/virtualwans/id_hubvirtualnetworkconnection.go +++ b/resource-manager/network/2023-05-01/virtualwans/id_hubvirtualnetworkconnection.go @@ -38,23 +38,9 @@ func ParseHubVirtualNetworkConnectionID(input string) (*HubVirtualNetworkConnect return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HubVirtualNetworkConnectionId{} - - 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.VirtualHubName, ok = parsed.Parsed["virtualHubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", *parsed) - } - - if id.HubVirtualNetworkConnectionName, ok = parsed.Parsed["hubVirtualNetworkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hubVirtualNetworkConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseHubVirtualNetworkConnectionIDInsensitively(input string) (*HubVirtualN return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HubVirtualNetworkConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *HubVirtualNetworkConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualHubName, ok = parsed.Parsed["virtualHubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", *parsed) + if id.VirtualHubName, ok = input.Parsed["virtualHubName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", input) } - if id.HubVirtualNetworkConnectionName, ok = parsed.Parsed["hubVirtualNetworkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hubVirtualNetworkConnectionName", *parsed) + if id.HubVirtualNetworkConnectionName, ok = input.Parsed["hubVirtualNetworkConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hubVirtualNetworkConnectionName", input) } - return &id, nil + return nil } // ValidateHubVirtualNetworkConnectionID checks that 'input' can be parsed as a Hub Virtual Network Connection ID diff --git a/resource-manager/network/2023-05-01/virtualwans/id_natrule.go b/resource-manager/network/2023-05-01/virtualwans/id_natrule.go index 2563c42130d..93cab37e7c6 100644 --- a/resource-manager/network/2023-05-01/virtualwans/id_natrule.go +++ b/resource-manager/network/2023-05-01/virtualwans/id_natrule.go @@ -38,23 +38,9 @@ func ParseNatRuleID(input string) (*NatRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NatRuleId{} - - 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.VpnGatewayName, ok = parsed.Parsed["vpnGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnGatewayName", *parsed) - } - - if id.NatRuleName, ok = parsed.Parsed["natRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "natRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseNatRuleIDInsensitively(input string) (*NatRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NatRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *NatRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VpnGatewayName, ok = parsed.Parsed["vpnGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnGatewayName", *parsed) + if id.VpnGatewayName, ok = input.Parsed["vpnGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vpnGatewayName", input) } - if id.NatRuleName, ok = parsed.Parsed["natRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "natRuleName", *parsed) + if id.NatRuleName, ok = input.Parsed["natRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "natRuleName", input) } - return &id, nil + return nil } // ValidateNatRuleID checks that 'input' can be parsed as a Nat Rule ID diff --git a/resource-manager/network/2023-05-01/virtualwans/id_routemap.go b/resource-manager/network/2023-05-01/virtualwans/id_routemap.go index a7eb1850cb8..ff3a75a5126 100644 --- a/resource-manager/network/2023-05-01/virtualwans/id_routemap.go +++ b/resource-manager/network/2023-05-01/virtualwans/id_routemap.go @@ -38,23 +38,9 @@ func ParseRouteMapID(input string) (*RouteMapId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteMapId{} - - 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.VirtualHubName, ok = parsed.Parsed["virtualHubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", *parsed) - } - - if id.RouteMapName, ok = parsed.Parsed["routeMapName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeMapName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRouteMapIDInsensitively(input string) (*RouteMapId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteMapId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RouteMapId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualHubName, ok = parsed.Parsed["virtualHubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", *parsed) + if id.VirtualHubName, ok = input.Parsed["virtualHubName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", input) } - if id.RouteMapName, ok = parsed.Parsed["routeMapName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeMapName", *parsed) + if id.RouteMapName, ok = input.Parsed["routeMapName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routeMapName", input) } - return &id, nil + return nil } // ValidateRouteMapID checks that 'input' can be parsed as a Route Map ID diff --git a/resource-manager/network/2023-05-01/virtualwans/id_routingintent.go b/resource-manager/network/2023-05-01/virtualwans/id_routingintent.go index 9a8b1a5cc31..dbc58606bae 100644 --- a/resource-manager/network/2023-05-01/virtualwans/id_routingintent.go +++ b/resource-manager/network/2023-05-01/virtualwans/id_routingintent.go @@ -38,23 +38,9 @@ func ParseRoutingIntentID(input string) (*RoutingIntentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RoutingIntentId{} - - 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.VirtualHubName, ok = parsed.Parsed["virtualHubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", *parsed) - } - - if id.RoutingIntentName, ok = parsed.Parsed["routingIntentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routingIntentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRoutingIntentIDInsensitively(input string) (*RoutingIntentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RoutingIntentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RoutingIntentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualHubName, ok = parsed.Parsed["virtualHubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", *parsed) + if id.VirtualHubName, ok = input.Parsed["virtualHubName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", input) } - if id.RoutingIntentName, ok = parsed.Parsed["routingIntentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routingIntentName", *parsed) + if id.RoutingIntentName, ok = input.Parsed["routingIntentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routingIntentName", input) } - return &id, nil + return nil } // ValidateRoutingIntentID checks that 'input' can be parsed as a Routing Intent ID diff --git a/resource-manager/network/2023-05-01/virtualwans/id_virtualhub.go b/resource-manager/network/2023-05-01/virtualwans/id_virtualhub.go index 3f42afd7fc5..7b6723ff9e3 100644 --- a/resource-manager/network/2023-05-01/virtualwans/id_virtualhub.go +++ b/resource-manager/network/2023-05-01/virtualwans/id_virtualhub.go @@ -36,19 +36,9 @@ func ParseVirtualHubID(input string) (*VirtualHubId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualHubId{} - - 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.VirtualHubName, ok = parsed.Parsed["virtualHubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualHubIDInsensitively(input string) (*VirtualHubId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualHubId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualHubId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualHubName, ok = parsed.Parsed["virtualHubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", *parsed) + if id.VirtualHubName, ok = input.Parsed["virtualHubName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", input) } - return &id, nil + return nil } // ValidateVirtualHubID checks that 'input' can be parsed as a Virtual Hub ID diff --git a/resource-manager/network/2023-05-01/virtualwans/id_virtualhubroutetable.go b/resource-manager/network/2023-05-01/virtualwans/id_virtualhubroutetable.go index ccb706e1460..c62be8a98a8 100644 --- a/resource-manager/network/2023-05-01/virtualwans/id_virtualhubroutetable.go +++ b/resource-manager/network/2023-05-01/virtualwans/id_virtualhubroutetable.go @@ -38,23 +38,9 @@ func ParseVirtualHubRouteTableID(input string) (*VirtualHubRouteTableId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualHubRouteTableId{} - - 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.VirtualHubName, ok = parsed.Parsed["virtualHubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", *parsed) - } - - if id.RouteTableName, ok = parsed.Parsed["routeTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualHubRouteTableIDInsensitively(input string) (*VirtualHubRouteTab return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualHubRouteTableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualHubRouteTableId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualHubName, ok = parsed.Parsed["virtualHubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", *parsed) + if id.VirtualHubName, ok = input.Parsed["virtualHubName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", input) } - if id.RouteTableName, ok = parsed.Parsed["routeTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", *parsed) + if id.RouteTableName, ok = input.Parsed["routeTableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", input) } - return &id, nil + return nil } // ValidateVirtualHubRouteTableID checks that 'input' can be parsed as a Virtual Hub Route Table ID diff --git a/resource-manager/network/2023-05-01/virtualwans/id_virtualwan.go b/resource-manager/network/2023-05-01/virtualwans/id_virtualwan.go index 590264a9ee1..db457c86102 100644 --- a/resource-manager/network/2023-05-01/virtualwans/id_virtualwan.go +++ b/resource-manager/network/2023-05-01/virtualwans/id_virtualwan.go @@ -36,19 +36,9 @@ func ParseVirtualWANID(input string) (*VirtualWANId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualWANId{} - - 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.VirtualWanName, ok = parsed.Parsed["virtualWanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualWanName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualWANIDInsensitively(input string) (*VirtualWANId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualWANId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualWANId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualWanName, ok = parsed.Parsed["virtualWanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualWanName", *parsed) + if id.VirtualWanName, ok = input.Parsed["virtualWanName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualWanName", input) } - return &id, nil + return nil } // ValidateVirtualWANID checks that 'input' can be parsed as a Virtual W A N ID diff --git a/resource-manager/network/2023-05-01/virtualwans/id_vpngateway.go b/resource-manager/network/2023-05-01/virtualwans/id_vpngateway.go index a438d896289..cf7683ac9e3 100644 --- a/resource-manager/network/2023-05-01/virtualwans/id_vpngateway.go +++ b/resource-manager/network/2023-05-01/virtualwans/id_vpngateway.go @@ -36,19 +36,9 @@ func ParseVpnGatewayID(input string) (*VpnGatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnGatewayId{} - - 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.VpnGatewayName, ok = parsed.Parsed["vpnGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnGatewayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVpnGatewayIDInsensitively(input string) (*VpnGatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnGatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VpnGatewayId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VpnGatewayName, ok = parsed.Parsed["vpnGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnGatewayName", *parsed) + if id.VpnGatewayName, ok = input.Parsed["vpnGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vpnGatewayName", input) } - return &id, nil + return nil } // ValidateVpnGatewayID checks that 'input' can be parsed as a Vpn Gateway ID diff --git a/resource-manager/network/2023-05-01/virtualwans/id_vpnlinkconnection.go b/resource-manager/network/2023-05-01/virtualwans/id_vpnlinkconnection.go index f8c398dc7ac..dfeff21ccfc 100644 --- a/resource-manager/network/2023-05-01/virtualwans/id_vpnlinkconnection.go +++ b/resource-manager/network/2023-05-01/virtualwans/id_vpnlinkconnection.go @@ -40,27 +40,9 @@ func ParseVpnLinkConnectionID(input string) (*VpnLinkConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnLinkConnectionId{} - - 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.VpnGatewayName, ok = parsed.Parsed["vpnGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnGatewayName", *parsed) - } - - if id.VpnConnectionName, ok = parsed.Parsed["vpnConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnConnectionName", *parsed) - } - - if id.VpnLinkConnectionName, ok = parsed.Parsed["vpnLinkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnLinkConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVpnLinkConnectionIDInsensitively(input string) (*VpnLinkConnectionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnLinkConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VpnLinkConnectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VpnGatewayName, ok = parsed.Parsed["vpnGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnGatewayName", *parsed) + if id.VpnGatewayName, ok = input.Parsed["vpnGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vpnGatewayName", input) } - if id.VpnConnectionName, ok = parsed.Parsed["vpnConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnConnectionName", *parsed) + if id.VpnConnectionName, ok = input.Parsed["vpnConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vpnConnectionName", input) } - if id.VpnLinkConnectionName, ok = parsed.Parsed["vpnLinkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnLinkConnectionName", *parsed) + if id.VpnLinkConnectionName, ok = input.Parsed["vpnLinkConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vpnLinkConnectionName", input) } - return &id, nil + return nil } // ValidateVpnLinkConnectionID checks that 'input' can be parsed as a Vpn Link Connection ID diff --git a/resource-manager/network/2023-05-01/virtualwans/id_vpnserverconfiguration.go b/resource-manager/network/2023-05-01/virtualwans/id_vpnserverconfiguration.go index 194ee0e58a3..9bd02160920 100644 --- a/resource-manager/network/2023-05-01/virtualwans/id_vpnserverconfiguration.go +++ b/resource-manager/network/2023-05-01/virtualwans/id_vpnserverconfiguration.go @@ -36,19 +36,9 @@ func ParseVpnServerConfigurationID(input string) (*VpnServerConfigurationId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnServerConfigurationId{} - - 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.VpnServerConfigurationName, ok = parsed.Parsed["vpnServerConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnServerConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVpnServerConfigurationIDInsensitively(input string) (*VpnServerConfigu return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnServerConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VpnServerConfigurationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VpnServerConfigurationName, ok = parsed.Parsed["vpnServerConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnServerConfigurationName", *parsed) + if id.VpnServerConfigurationName, ok = input.Parsed["vpnServerConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vpnServerConfigurationName", input) } - return &id, nil + return nil } // ValidateVpnServerConfigurationID checks that 'input' can be parsed as a Vpn Server Configuration ID diff --git a/resource-manager/network/2023-05-01/virtualwans/id_vpnsite.go b/resource-manager/network/2023-05-01/virtualwans/id_vpnsite.go index d32b6f6dba4..4c1e5f7deec 100644 --- a/resource-manager/network/2023-05-01/virtualwans/id_vpnsite.go +++ b/resource-manager/network/2023-05-01/virtualwans/id_vpnsite.go @@ -36,19 +36,9 @@ func ParseVpnSiteID(input string) (*VpnSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnSiteId{} - - 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.VpnSiteName, ok = parsed.Parsed["vpnSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnSiteName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVpnSiteIDInsensitively(input string) (*VpnSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnSiteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VpnSiteId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VpnSiteName, ok = parsed.Parsed["vpnSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnSiteName", *parsed) + if id.VpnSiteName, ok = input.Parsed["vpnSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vpnSiteName", input) } - return &id, nil + return nil } // ValidateVpnSiteID checks that 'input' can be parsed as a Vpn Site ID diff --git a/resource-manager/network/2023-05-01/virtualwans/id_vpnsitelink.go b/resource-manager/network/2023-05-01/virtualwans/id_vpnsitelink.go index e43deb2be92..aebb2d3d5d6 100644 --- a/resource-manager/network/2023-05-01/virtualwans/id_vpnsitelink.go +++ b/resource-manager/network/2023-05-01/virtualwans/id_vpnsitelink.go @@ -38,23 +38,9 @@ func ParseVpnSiteLinkID(input string) (*VpnSiteLinkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnSiteLinkId{} - - 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.VpnSiteName, ok = parsed.Parsed["vpnSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnSiteName", *parsed) - } - - if id.VpnSiteLinkName, ok = parsed.Parsed["vpnSiteLinkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnSiteLinkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVpnSiteLinkIDInsensitively(input string) (*VpnSiteLinkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnSiteLinkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VpnSiteLinkId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VpnSiteName, ok = parsed.Parsed["vpnSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnSiteName", *parsed) + if id.VpnSiteName, ok = input.Parsed["vpnSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vpnSiteName", input) } - if id.VpnSiteLinkName, ok = parsed.Parsed["vpnSiteLinkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnSiteLinkName", *parsed) + if id.VpnSiteLinkName, ok = input.Parsed["vpnSiteLinkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vpnSiteLinkName", input) } - return &id, nil + return nil } // ValidateVpnSiteLinkID checks that 'input' can be parsed as a Vpn Site Link ID diff --git a/resource-manager/network/2023-05-01/vmsspublicipaddresses/id_virtualmachinescaleset.go b/resource-manager/network/2023-05-01/vmsspublicipaddresses/id_virtualmachinescaleset.go index b798e513d2e..7f2795675f6 100644 --- a/resource-manager/network/2023-05-01/vmsspublicipaddresses/id_virtualmachinescaleset.go +++ b/resource-manager/network/2023-05-01/vmsspublicipaddresses/id_virtualmachinescaleset.go @@ -36,19 +36,9 @@ func ParseVirtualMachineScaleSetID(input string) (*VirtualMachineScaleSetId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineScaleSetIDInsensitively(input string) (*VirtualMachineSc return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineScaleSetId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - return &id, nil + return nil } // ValidateVirtualMachineScaleSetID checks that 'input' can be parsed as a Virtual Machine Scale Set ID diff --git a/resource-manager/network/2023-05-01/vpngateways/id_vpngateway.go b/resource-manager/network/2023-05-01/vpngateways/id_vpngateway.go index 5e23e288887..bf76c30c5da 100644 --- a/resource-manager/network/2023-05-01/vpngateways/id_vpngateway.go +++ b/resource-manager/network/2023-05-01/vpngateways/id_vpngateway.go @@ -36,19 +36,9 @@ func ParseVpnGatewayID(input string) (*VpnGatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnGatewayId{} - - 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.VpnGatewayName, ok = parsed.Parsed["vpnGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnGatewayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVpnGatewayIDInsensitively(input string) (*VpnGatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnGatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VpnGatewayId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VpnGatewayName, ok = parsed.Parsed["vpnGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnGatewayName", *parsed) + if id.VpnGatewayName, ok = input.Parsed["vpnGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vpnGatewayName", input) } - return &id, nil + return nil } // ValidateVpnGatewayID checks that 'input' can be parsed as a Vpn Gateway ID diff --git a/resource-manager/network/2023-05-01/vpnlinkconnections/id_vpnlinkconnection.go b/resource-manager/network/2023-05-01/vpnlinkconnections/id_vpnlinkconnection.go index 1fc8b77b7e9..b5191696d31 100644 --- a/resource-manager/network/2023-05-01/vpnlinkconnections/id_vpnlinkconnection.go +++ b/resource-manager/network/2023-05-01/vpnlinkconnections/id_vpnlinkconnection.go @@ -40,27 +40,9 @@ func ParseVpnLinkConnectionID(input string) (*VpnLinkConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnLinkConnectionId{} - - 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.VpnGatewayName, ok = parsed.Parsed["vpnGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnGatewayName", *parsed) - } - - if id.VpnConnectionName, ok = parsed.Parsed["vpnConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnConnectionName", *parsed) - } - - if id.VpnLinkConnectionName, ok = parsed.Parsed["vpnLinkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnLinkConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVpnLinkConnectionIDInsensitively(input string) (*VpnLinkConnectionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnLinkConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VpnLinkConnectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VpnGatewayName, ok = parsed.Parsed["vpnGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnGatewayName", *parsed) + if id.VpnGatewayName, ok = input.Parsed["vpnGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vpnGatewayName", input) } - if id.VpnConnectionName, ok = parsed.Parsed["vpnConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnConnectionName", *parsed) + if id.VpnConnectionName, ok = input.Parsed["vpnConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vpnConnectionName", input) } - if id.VpnLinkConnectionName, ok = parsed.Parsed["vpnLinkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnLinkConnectionName", *parsed) + if id.VpnLinkConnectionName, ok = input.Parsed["vpnLinkConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vpnLinkConnectionName", input) } - return &id, nil + return nil } // ValidateVpnLinkConnectionID checks that 'input' can be parsed as a Vpn Link Connection ID diff --git a/resource-manager/network/2023-05-01/vpnserverconfigurations/id_vpnserverconfiguration.go b/resource-manager/network/2023-05-01/vpnserverconfigurations/id_vpnserverconfiguration.go index 688f2431145..3371906376c 100644 --- a/resource-manager/network/2023-05-01/vpnserverconfigurations/id_vpnserverconfiguration.go +++ b/resource-manager/network/2023-05-01/vpnserverconfigurations/id_vpnserverconfiguration.go @@ -36,19 +36,9 @@ func ParseVpnServerConfigurationID(input string) (*VpnServerConfigurationId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnServerConfigurationId{} - - 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.VpnServerConfigurationName, ok = parsed.Parsed["vpnServerConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnServerConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVpnServerConfigurationIDInsensitively(input string) (*VpnServerConfigu return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnServerConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VpnServerConfigurationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VpnServerConfigurationName, ok = parsed.Parsed["vpnServerConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnServerConfigurationName", *parsed) + if id.VpnServerConfigurationName, ok = input.Parsed["vpnServerConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vpnServerConfigurationName", input) } - return &id, nil + return nil } // ValidateVpnServerConfigurationID checks that 'input' can be parsed as a Vpn Server Configuration ID diff --git a/resource-manager/network/2023-05-01/vpnsites/id_vpnsite.go b/resource-manager/network/2023-05-01/vpnsites/id_vpnsite.go index 01be85624d7..4266864fca0 100644 --- a/resource-manager/network/2023-05-01/vpnsites/id_vpnsite.go +++ b/resource-manager/network/2023-05-01/vpnsites/id_vpnsite.go @@ -36,19 +36,9 @@ func ParseVpnSiteID(input string) (*VpnSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnSiteId{} - - 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.VpnSiteName, ok = parsed.Parsed["vpnSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnSiteName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVpnSiteIDInsensitively(input string) (*VpnSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnSiteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VpnSiteId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VpnSiteName, ok = parsed.Parsed["vpnSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnSiteName", *parsed) + if id.VpnSiteName, ok = input.Parsed["vpnSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vpnSiteName", input) } - return &id, nil + return nil } // ValidateVpnSiteID checks that 'input' can be parsed as a Vpn Site ID diff --git a/resource-manager/network/2023-05-01/webapplicationfirewallpolicies/id_applicationgatewaywebapplicationfirewallpolicy.go b/resource-manager/network/2023-05-01/webapplicationfirewallpolicies/id_applicationgatewaywebapplicationfirewallpolicy.go index d15af832185..d06b36f8867 100644 --- a/resource-manager/network/2023-05-01/webapplicationfirewallpolicies/id_applicationgatewaywebapplicationfirewallpolicy.go +++ b/resource-manager/network/2023-05-01/webapplicationfirewallpolicies/id_applicationgatewaywebapplicationfirewallpolicy.go @@ -36,19 +36,9 @@ func ParseApplicationGatewayWebApplicationFirewallPolicyID(input string) (*Appli return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGatewayWebApplicationFirewallPolicyId{} - - 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.ApplicationGatewayWebApplicationFirewallPolicyName, ok = parsed.Parsed["applicationGatewayWebApplicationFirewallPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGatewayWebApplicationFirewallPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseApplicationGatewayWebApplicationFirewallPolicyIDInsensitively(input st return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGatewayWebApplicationFirewallPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ApplicationGatewayWebApplicationFirewallPolicyId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ApplicationGatewayWebApplicationFirewallPolicyName, ok = parsed.Parsed["applicationGatewayWebApplicationFirewallPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGatewayWebApplicationFirewallPolicyName", *parsed) + if id.ApplicationGatewayWebApplicationFirewallPolicyName, ok = input.Parsed["applicationGatewayWebApplicationFirewallPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationGatewayWebApplicationFirewallPolicyName", input) } - return &id, nil + return nil } // ValidateApplicationGatewayWebApplicationFirewallPolicyID checks that 'input' can be parsed as a Application Gateway Web Application Firewall Policy ID diff --git a/resource-manager/network/2023-05-01/webcategories/id_azurewebcategory.go b/resource-manager/network/2023-05-01/webcategories/id_azurewebcategory.go index 05fb4633638..acb30d2a8fa 100644 --- a/resource-manager/network/2023-05-01/webcategories/id_azurewebcategory.go +++ b/resource-manager/network/2023-05-01/webcategories/id_azurewebcategory.go @@ -34,15 +34,9 @@ func ParseAzureWebCategoryID(input string) (*AzureWebCategoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AzureWebCategoryId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.AzureWebCategoryName, ok = parsed.Parsed["azureWebCategoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "azureWebCategoryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseAzureWebCategoryIDInsensitively(input string) (*AzureWebCategoryId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AzureWebCategoryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *AzureWebCategoryId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.AzureWebCategoryName, ok = parsed.Parsed["azureWebCategoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "azureWebCategoryName", *parsed) + if id.AzureWebCategoryName, ok = input.Parsed["azureWebCategoryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "azureWebCategoryName", input) } - return &id, nil + return nil } // ValidateAzureWebCategoryID checks that 'input' can be parsed as a Azure Web Category ID diff --git a/resource-manager/network/2023-06-01/adminrulecollections/id_rulecollection.go b/resource-manager/network/2023-06-01/adminrulecollections/id_rulecollection.go index 49cb86529fd..e872007ab21 100644 --- a/resource-manager/network/2023-06-01/adminrulecollections/id_rulecollection.go +++ b/resource-manager/network/2023-06-01/adminrulecollections/id_rulecollection.go @@ -40,27 +40,9 @@ func ParseRuleCollectionID(input string) (*RuleCollectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RuleCollectionId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) - } - - if id.SecurityAdminConfigurationName, ok = parsed.Parsed["securityAdminConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityAdminConfigurationName", *parsed) - } - - if id.RuleCollectionName, ok = parsed.Parsed["ruleCollectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleCollectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseRuleCollectionIDInsensitively(input string) (*RuleCollectionId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RuleCollectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RuleCollectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - if id.SecurityAdminConfigurationName, ok = parsed.Parsed["securityAdminConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityAdminConfigurationName", *parsed) + if id.SecurityAdminConfigurationName, ok = input.Parsed["securityAdminConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "securityAdminConfigurationName", input) } - if id.RuleCollectionName, ok = parsed.Parsed["ruleCollectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleCollectionName", *parsed) + if id.RuleCollectionName, ok = input.Parsed["ruleCollectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleCollectionName", input) } - return &id, nil + return nil } // ValidateRuleCollectionID checks that 'input' can be parsed as a Rule Collection ID diff --git a/resource-manager/network/2023-06-01/adminrulecollections/id_securityadminconfiguration.go b/resource-manager/network/2023-06-01/adminrulecollections/id_securityadminconfiguration.go index 6e36b78776a..a623baf41bc 100644 --- a/resource-manager/network/2023-06-01/adminrulecollections/id_securityadminconfiguration.go +++ b/resource-manager/network/2023-06-01/adminrulecollections/id_securityadminconfiguration.go @@ -38,23 +38,9 @@ func ParseSecurityAdminConfigurationID(input string) (*SecurityAdminConfiguratio return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecurityAdminConfigurationId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) - } - - if id.SecurityAdminConfigurationName, ok = parsed.Parsed["securityAdminConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityAdminConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSecurityAdminConfigurationIDInsensitively(input string) (*SecurityAdmi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecurityAdminConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SecurityAdminConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - if id.SecurityAdminConfigurationName, ok = parsed.Parsed["securityAdminConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityAdminConfigurationName", *parsed) + if id.SecurityAdminConfigurationName, ok = input.Parsed["securityAdminConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "securityAdminConfigurationName", input) } - return &id, nil + return nil } // ValidateSecurityAdminConfigurationID checks that 'input' can be parsed as a Security Admin Configuration ID diff --git a/resource-manager/network/2023-06-01/adminrules/id_rule.go b/resource-manager/network/2023-06-01/adminrules/id_rule.go index d93cbce740e..1773ee5f02e 100644 --- a/resource-manager/network/2023-06-01/adminrules/id_rule.go +++ b/resource-manager/network/2023-06-01/adminrules/id_rule.go @@ -42,31 +42,9 @@ func ParseRuleID(input string) (*RuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RuleId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) - } - - if id.SecurityAdminConfigurationName, ok = parsed.Parsed["securityAdminConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityAdminConfigurationName", *parsed) - } - - if id.RuleCollectionName, ok = parsed.Parsed["ruleCollectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleCollectionName", *parsed) - } - - if id.RuleName, ok = parsed.Parsed["ruleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseRuleIDInsensitively(input string) (*RuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - if id.SecurityAdminConfigurationName, ok = parsed.Parsed["securityAdminConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityAdminConfigurationName", *parsed) + if id.SecurityAdminConfigurationName, ok = input.Parsed["securityAdminConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "securityAdminConfigurationName", input) } - if id.RuleCollectionName, ok = parsed.Parsed["ruleCollectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleCollectionName", *parsed) + if id.RuleCollectionName, ok = input.Parsed["ruleCollectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleCollectionName", input) } - if id.RuleName, ok = parsed.Parsed["ruleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleName", *parsed) + if id.RuleName, ok = input.Parsed["ruleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleName", input) } - return &id, nil + return nil } // ValidateRuleID checks that 'input' can be parsed as a Rule ID diff --git a/resource-manager/network/2023-06-01/adminrules/id_rulecollection.go b/resource-manager/network/2023-06-01/adminrules/id_rulecollection.go index 1cdbb320880..9755614ded3 100644 --- a/resource-manager/network/2023-06-01/adminrules/id_rulecollection.go +++ b/resource-manager/network/2023-06-01/adminrules/id_rulecollection.go @@ -40,27 +40,9 @@ func ParseRuleCollectionID(input string) (*RuleCollectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RuleCollectionId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) - } - - if id.SecurityAdminConfigurationName, ok = parsed.Parsed["securityAdminConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityAdminConfigurationName", *parsed) - } - - if id.RuleCollectionName, ok = parsed.Parsed["ruleCollectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleCollectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseRuleCollectionIDInsensitively(input string) (*RuleCollectionId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RuleCollectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RuleCollectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - if id.SecurityAdminConfigurationName, ok = parsed.Parsed["securityAdminConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityAdminConfigurationName", *parsed) + if id.SecurityAdminConfigurationName, ok = input.Parsed["securityAdminConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "securityAdminConfigurationName", input) } - if id.RuleCollectionName, ok = parsed.Parsed["ruleCollectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleCollectionName", *parsed) + if id.RuleCollectionName, ok = input.Parsed["ruleCollectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleCollectionName", input) } - return &id, nil + return nil } // ValidateRuleCollectionID checks that 'input' can be parsed as a Rule Collection ID diff --git a/resource-manager/network/2023-06-01/applicationgatewayprivateendpointconnections/id_applicationgateway.go b/resource-manager/network/2023-06-01/applicationgatewayprivateendpointconnections/id_applicationgateway.go index 58498d25a2c..cfc53ebc341 100644 --- a/resource-manager/network/2023-06-01/applicationgatewayprivateendpointconnections/id_applicationgateway.go +++ b/resource-manager/network/2023-06-01/applicationgatewayprivateendpointconnections/id_applicationgateway.go @@ -36,19 +36,9 @@ func ParseApplicationGatewayID(input string) (*ApplicationGatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGatewayId{} - - 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.ApplicationGatewayName, ok = parsed.Parsed["applicationGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGatewayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseApplicationGatewayIDInsensitively(input string) (*ApplicationGatewayId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ApplicationGatewayId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ApplicationGatewayName, ok = parsed.Parsed["applicationGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGatewayName", *parsed) + if id.ApplicationGatewayName, ok = input.Parsed["applicationGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationGatewayName", input) } - return &id, nil + return nil } // ValidateApplicationGatewayID checks that 'input' can be parsed as a Application Gateway ID diff --git a/resource-manager/network/2023-06-01/applicationgatewayprivateendpointconnections/id_applicationgatewayprivateendpointconnection.go b/resource-manager/network/2023-06-01/applicationgatewayprivateendpointconnections/id_applicationgatewayprivateendpointconnection.go index 16e2175839e..e7d21df9e97 100644 --- a/resource-manager/network/2023-06-01/applicationgatewayprivateendpointconnections/id_applicationgatewayprivateendpointconnection.go +++ b/resource-manager/network/2023-06-01/applicationgatewayprivateendpointconnections/id_applicationgatewayprivateendpointconnection.go @@ -38,23 +38,9 @@ func ParseApplicationGatewayPrivateEndpointConnectionID(input string) (*Applicat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGatewayPrivateEndpointConnectionId{} - - 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.ApplicationGatewayName, ok = parsed.Parsed["applicationGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGatewayName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApplicationGatewayPrivateEndpointConnectionIDInsensitively(input strin return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGatewayPrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApplicationGatewayPrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ApplicationGatewayName, ok = parsed.Parsed["applicationGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGatewayName", *parsed) + if id.ApplicationGatewayName, ok = input.Parsed["applicationGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationGatewayName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidateApplicationGatewayPrivateEndpointConnectionID checks that 'input' can be parsed as a Application Gateway Private Endpoint Connection ID diff --git a/resource-manager/network/2023-06-01/applicationgatewayprivatelinkresources/id_applicationgateway.go b/resource-manager/network/2023-06-01/applicationgatewayprivatelinkresources/id_applicationgateway.go index 6a994cbbf56..40c8e0927cc 100644 --- a/resource-manager/network/2023-06-01/applicationgatewayprivatelinkresources/id_applicationgateway.go +++ b/resource-manager/network/2023-06-01/applicationgatewayprivatelinkresources/id_applicationgateway.go @@ -36,19 +36,9 @@ func ParseApplicationGatewayID(input string) (*ApplicationGatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGatewayId{} - - 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.ApplicationGatewayName, ok = parsed.Parsed["applicationGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGatewayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseApplicationGatewayIDInsensitively(input string) (*ApplicationGatewayId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ApplicationGatewayId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ApplicationGatewayName, ok = parsed.Parsed["applicationGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGatewayName", *parsed) + if id.ApplicationGatewayName, ok = input.Parsed["applicationGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationGatewayName", input) } - return &id, nil + return nil } // ValidateApplicationGatewayID checks that 'input' can be parsed as a Application Gateway ID diff --git a/resource-manager/network/2023-06-01/applicationgateways/id_applicationgateway.go b/resource-manager/network/2023-06-01/applicationgateways/id_applicationgateway.go index c9e4b9d3cbb..599b534439a 100644 --- a/resource-manager/network/2023-06-01/applicationgateways/id_applicationgateway.go +++ b/resource-manager/network/2023-06-01/applicationgateways/id_applicationgateway.go @@ -36,19 +36,9 @@ func ParseApplicationGatewayID(input string) (*ApplicationGatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGatewayId{} - - 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.ApplicationGatewayName, ok = parsed.Parsed["applicationGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGatewayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseApplicationGatewayIDInsensitively(input string) (*ApplicationGatewayId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ApplicationGatewayId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ApplicationGatewayName, ok = parsed.Parsed["applicationGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGatewayName", *parsed) + if id.ApplicationGatewayName, ok = input.Parsed["applicationGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationGatewayName", input) } - return &id, nil + return nil } // ValidateApplicationGatewayID checks that 'input' can be parsed as a Application Gateway ID diff --git a/resource-manager/network/2023-06-01/applicationgateways/id_predefinedpolicy.go b/resource-manager/network/2023-06-01/applicationgateways/id_predefinedpolicy.go index b49384e166d..b5821036369 100644 --- a/resource-manager/network/2023-06-01/applicationgateways/id_predefinedpolicy.go +++ b/resource-manager/network/2023-06-01/applicationgateways/id_predefinedpolicy.go @@ -34,15 +34,9 @@ func ParsePredefinedPolicyID(input string) (*PredefinedPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PredefinedPolicyId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.PredefinedPolicyName, ok = parsed.Parsed["predefinedPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "predefinedPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParsePredefinedPolicyIDInsensitively(input string) (*PredefinedPolicyId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PredefinedPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *PredefinedPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.PredefinedPolicyName, ok = parsed.Parsed["predefinedPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "predefinedPolicyName", *parsed) + if id.PredefinedPolicyName, ok = input.Parsed["predefinedPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "predefinedPolicyName", input) } - return &id, nil + return nil } // ValidatePredefinedPolicyID checks that 'input' can be parsed as a Predefined Policy ID diff --git a/resource-manager/network/2023-06-01/applicationgatewaywafdynamicmanifests/id_location.go b/resource-manager/network/2023-06-01/applicationgatewaywafdynamicmanifests/id_location.go index d3b01a8cfce..1d6c45d8226 100644 --- a/resource-manager/network/2023-06-01/applicationgatewaywafdynamicmanifests/id_location.go +++ b/resource-manager/network/2023-06-01/applicationgatewaywafdynamicmanifests/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/network/2023-06-01/applicationsecuritygroups/id_applicationsecuritygroup.go b/resource-manager/network/2023-06-01/applicationsecuritygroups/id_applicationsecuritygroup.go index 34de777e09e..c457f791c4b 100644 --- a/resource-manager/network/2023-06-01/applicationsecuritygroups/id_applicationsecuritygroup.go +++ b/resource-manager/network/2023-06-01/applicationsecuritygroups/id_applicationsecuritygroup.go @@ -36,19 +36,9 @@ func ParseApplicationSecurityGroupID(input string) (*ApplicationSecurityGroupId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationSecurityGroupId{} - - 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.ApplicationSecurityGroupName, ok = parsed.Parsed["applicationSecurityGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationSecurityGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseApplicationSecurityGroupIDInsensitively(input string) (*ApplicationSec return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationSecurityGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ApplicationSecurityGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ApplicationSecurityGroupName, ok = parsed.Parsed["applicationSecurityGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationSecurityGroupName", *parsed) + if id.ApplicationSecurityGroupName, ok = input.Parsed["applicationSecurityGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationSecurityGroupName", input) } - return &id, nil + return nil } // ValidateApplicationSecurityGroupID checks that 'input' can be parsed as a Application Security Group ID diff --git a/resource-manager/network/2023-06-01/availabledelegations/id_location.go b/resource-manager/network/2023-06-01/availabledelegations/id_location.go index a6a158e88e6..92bfc72a62b 100644 --- a/resource-manager/network/2023-06-01/availabledelegations/id_location.go +++ b/resource-manager/network/2023-06-01/availabledelegations/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/network/2023-06-01/availabledelegations/id_providerlocation.go b/resource-manager/network/2023-06-01/availabledelegations/id_providerlocation.go index a5f5134b65c..8fdfc45fb95 100644 --- a/resource-manager/network/2023-06-01/availabledelegations/id_providerlocation.go +++ b/resource-manager/network/2023-06-01/availabledelegations/id_providerlocation.go @@ -36,19 +36,9 @@ func ParseProviderLocationID(input string) (*ProviderLocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderLocationIDInsensitively(input string) (*ProviderLocationId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderLocationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateProviderLocationID checks that 'input' can be parsed as a Provider Location ID diff --git a/resource-manager/network/2023-06-01/availableservicealiases/id_location.go b/resource-manager/network/2023-06-01/availableservicealiases/id_location.go index 7d25a1ec759..98a110bc9e5 100644 --- a/resource-manager/network/2023-06-01/availableservicealiases/id_location.go +++ b/resource-manager/network/2023-06-01/availableservicealiases/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/network/2023-06-01/availableservicealiases/id_providerlocation.go b/resource-manager/network/2023-06-01/availableservicealiases/id_providerlocation.go index 0eb12f2b132..5d51d89a821 100644 --- a/resource-manager/network/2023-06-01/availableservicealiases/id_providerlocation.go +++ b/resource-manager/network/2023-06-01/availableservicealiases/id_providerlocation.go @@ -36,19 +36,9 @@ func ParseProviderLocationID(input string) (*ProviderLocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderLocationIDInsensitively(input string) (*ProviderLocationId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderLocationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateProviderLocationID checks that 'input' can be parsed as a Provider Location ID diff --git a/resource-manager/network/2023-06-01/azurefirewalls/id_azurefirewall.go b/resource-manager/network/2023-06-01/azurefirewalls/id_azurefirewall.go index 1c8e506ab97..e1afeeca58f 100644 --- a/resource-manager/network/2023-06-01/azurefirewalls/id_azurefirewall.go +++ b/resource-manager/network/2023-06-01/azurefirewalls/id_azurefirewall.go @@ -36,19 +36,9 @@ func ParseAzureFirewallID(input string) (*AzureFirewallId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AzureFirewallId{} - - 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.AzureFirewallName, ok = parsed.Parsed["azureFirewallName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "azureFirewallName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAzureFirewallIDInsensitively(input string) (*AzureFirewallId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AzureFirewallId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AzureFirewallId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AzureFirewallName, ok = parsed.Parsed["azureFirewallName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "azureFirewallName", *parsed) + if id.AzureFirewallName, ok = input.Parsed["azureFirewallName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "azureFirewallName", input) } - return &id, nil + return nil } // ValidateAzureFirewallID checks that 'input' can be parsed as a Azure Firewall ID diff --git a/resource-manager/network/2023-06-01/bastionhosts/id_bastionhost.go b/resource-manager/network/2023-06-01/bastionhosts/id_bastionhost.go index deb83136787..b9b0bd95a9b 100644 --- a/resource-manager/network/2023-06-01/bastionhosts/id_bastionhost.go +++ b/resource-manager/network/2023-06-01/bastionhosts/id_bastionhost.go @@ -36,19 +36,9 @@ func ParseBastionHostID(input string) (*BastionHostId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BastionHostId{} - - 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.BastionHostName, ok = parsed.Parsed["bastionHostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bastionHostName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseBastionHostIDInsensitively(input string) (*BastionHostId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BastionHostId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *BastionHostId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BastionHostName, ok = parsed.Parsed["bastionHostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bastionHostName", *parsed) + if id.BastionHostName, ok = input.Parsed["bastionHostName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "bastionHostName", input) } - return &id, nil + return nil } // ValidateBastionHostID checks that 'input' can be parsed as a Bastion Host ID diff --git a/resource-manager/network/2023-06-01/bastionshareablelink/id_bastionhost.go b/resource-manager/network/2023-06-01/bastionshareablelink/id_bastionhost.go index 28c97854f8d..b000a81dd74 100644 --- a/resource-manager/network/2023-06-01/bastionshareablelink/id_bastionhost.go +++ b/resource-manager/network/2023-06-01/bastionshareablelink/id_bastionhost.go @@ -36,19 +36,9 @@ func ParseBastionHostID(input string) (*BastionHostId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BastionHostId{} - - 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.BastionHostName, ok = parsed.Parsed["bastionHostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bastionHostName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseBastionHostIDInsensitively(input string) (*BastionHostId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BastionHostId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *BastionHostId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BastionHostName, ok = parsed.Parsed["bastionHostName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bastionHostName", *parsed) + if id.BastionHostName, ok = input.Parsed["bastionHostName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "bastionHostName", input) } - return &id, nil + return nil } // ValidateBastionHostID checks that 'input' can be parsed as a Bastion Host ID diff --git a/resource-manager/network/2023-06-01/checkdnsavailabilities/id_location.go b/resource-manager/network/2023-06-01/checkdnsavailabilities/id_location.go index 474bff1709b..6b84973a31b 100644 --- a/resource-manager/network/2023-06-01/checkdnsavailabilities/id_location.go +++ b/resource-manager/network/2023-06-01/checkdnsavailabilities/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/network/2023-06-01/cloudservicepublicipaddresses/id_providercloudservice.go b/resource-manager/network/2023-06-01/cloudservicepublicipaddresses/id_providercloudservice.go index 0a86336f5d8..135ae6b32ec 100644 --- a/resource-manager/network/2023-06-01/cloudservicepublicipaddresses/id_providercloudservice.go +++ b/resource-manager/network/2023-06-01/cloudservicepublicipaddresses/id_providercloudservice.go @@ -36,19 +36,9 @@ func ParseProviderCloudServiceID(input string) (*ProviderCloudServiceId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderCloudServiceId{} - - 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.CloudServiceName, ok = parsed.Parsed["cloudServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderCloudServiceIDInsensitively(input string) (*ProviderCloudServi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderCloudServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderCloudServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CloudServiceName, ok = parsed.Parsed["cloudServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", *parsed) + if id.CloudServiceName, ok = input.Parsed["cloudServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", input) } - return &id, nil + return nil } // ValidateProviderCloudServiceID checks that 'input' can be parsed as a Provider Cloud Service ID diff --git a/resource-manager/network/2023-06-01/connectionmonitors/id_connectionmonitor.go b/resource-manager/network/2023-06-01/connectionmonitors/id_connectionmonitor.go index a7922c2d666..59380596a99 100644 --- a/resource-manager/network/2023-06-01/connectionmonitors/id_connectionmonitor.go +++ b/resource-manager/network/2023-06-01/connectionmonitors/id_connectionmonitor.go @@ -38,23 +38,9 @@ func ParseConnectionMonitorID(input string) (*ConnectionMonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionMonitorId{} - - 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.NetworkWatcherName, ok = parsed.Parsed["networkWatcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", *parsed) - } - - if id.ConnectionMonitorName, ok = parsed.Parsed["connectionMonitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionMonitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConnectionMonitorIDInsensitively(input string) (*ConnectionMonitorId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionMonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConnectionMonitorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkWatcherName, ok = parsed.Parsed["networkWatcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", *parsed) + if id.NetworkWatcherName, ok = input.Parsed["networkWatcherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", input) } - if id.ConnectionMonitorName, ok = parsed.Parsed["connectionMonitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionMonitorName", *parsed) + if id.ConnectionMonitorName, ok = input.Parsed["connectionMonitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectionMonitorName", input) } - return &id, nil + return nil } // ValidateConnectionMonitorID checks that 'input' can be parsed as a Connection Monitor ID diff --git a/resource-manager/network/2023-06-01/connectionmonitors/id_networkwatcher.go b/resource-manager/network/2023-06-01/connectionmonitors/id_networkwatcher.go index 9827216a58b..363c1317ad3 100644 --- a/resource-manager/network/2023-06-01/connectionmonitors/id_networkwatcher.go +++ b/resource-manager/network/2023-06-01/connectionmonitors/id_networkwatcher.go @@ -36,19 +36,9 @@ func ParseNetworkWatcherID(input string) (*NetworkWatcherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkWatcherId{} - - 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.NetworkWatcherName, ok = parsed.Parsed["networkWatcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkWatcherIDInsensitively(input string) (*NetworkWatcherId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkWatcherId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkWatcherId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkWatcherName, ok = parsed.Parsed["networkWatcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", *parsed) + if id.NetworkWatcherName, ok = input.Parsed["networkWatcherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", input) } - return &id, nil + return nil } // ValidateNetworkWatcherID checks that 'input' can be parsed as a Network Watcher ID diff --git a/resource-manager/network/2023-06-01/connectivityconfigurations/id_connectivityconfiguration.go b/resource-manager/network/2023-06-01/connectivityconfigurations/id_connectivityconfiguration.go index 65487e1c102..5d5da37b711 100644 --- a/resource-manager/network/2023-06-01/connectivityconfigurations/id_connectivityconfiguration.go +++ b/resource-manager/network/2023-06-01/connectivityconfigurations/id_connectivityconfiguration.go @@ -38,23 +38,9 @@ func ParseConnectivityConfigurationID(input string) (*ConnectivityConfigurationI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectivityConfigurationId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) - } - - if id.ConnectivityConfigurationName, ok = parsed.Parsed["connectivityConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectivityConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConnectivityConfigurationIDInsensitively(input string) (*ConnectivityC return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectivityConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConnectivityConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - if id.ConnectivityConfigurationName, ok = parsed.Parsed["connectivityConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectivityConfigurationName", *parsed) + if id.ConnectivityConfigurationName, ok = input.Parsed["connectivityConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectivityConfigurationName", input) } - return &id, nil + return nil } // ValidateConnectivityConfigurationID checks that 'input' can be parsed as a Connectivity Configuration ID diff --git a/resource-manager/network/2023-06-01/connectivityconfigurations/id_networkmanager.go b/resource-manager/network/2023-06-01/connectivityconfigurations/id_networkmanager.go index 087c284a6d4..ec4128ee5c8 100644 --- a/resource-manager/network/2023-06-01/connectivityconfigurations/id_networkmanager.go +++ b/resource-manager/network/2023-06-01/connectivityconfigurations/id_networkmanager.go @@ -36,19 +36,9 @@ func ParseNetworkManagerID(input string) (*NetworkManagerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkManagerId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkManagerIDInsensitively(input string) (*NetworkManagerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkManagerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkManagerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - return &id, nil + return nil } // ValidateNetworkManagerID checks that 'input' can be parsed as a Network Manager ID diff --git a/resource-manager/network/2023-06-01/customipprefixes/id_customipprefix.go b/resource-manager/network/2023-06-01/customipprefixes/id_customipprefix.go index 088e2b59a9a..a409949ab9a 100644 --- a/resource-manager/network/2023-06-01/customipprefixes/id_customipprefix.go +++ b/resource-manager/network/2023-06-01/customipprefixes/id_customipprefix.go @@ -36,19 +36,9 @@ func ParseCustomIPPrefixID(input string) (*CustomIPPrefixId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CustomIPPrefixId{} - - 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.CustomIPPrefixName, ok = parsed.Parsed["customIPPrefixName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "customIPPrefixName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseCustomIPPrefixIDInsensitively(input string) (*CustomIPPrefixId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CustomIPPrefixId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CustomIPPrefixId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CustomIPPrefixName, ok = parsed.Parsed["customIPPrefixName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "customIPPrefixName", *parsed) + if id.CustomIPPrefixName, ok = input.Parsed["customIPPrefixName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "customIPPrefixName", input) } - return &id, nil + return nil } // ValidateCustomIPPrefixID checks that 'input' can be parsed as a Custom I P Prefix ID diff --git a/resource-manager/network/2023-06-01/ddoscustompolicies/id_ddoscustompolicy.go b/resource-manager/network/2023-06-01/ddoscustompolicies/id_ddoscustompolicy.go index 311930ea740..ad86631a79a 100644 --- a/resource-manager/network/2023-06-01/ddoscustompolicies/id_ddoscustompolicy.go +++ b/resource-manager/network/2023-06-01/ddoscustompolicies/id_ddoscustompolicy.go @@ -36,19 +36,9 @@ func ParseDdosCustomPolicyID(input string) (*DdosCustomPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DdosCustomPolicyId{} - - 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.DdosCustomPolicyName, ok = parsed.Parsed["ddosCustomPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ddosCustomPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDdosCustomPolicyIDInsensitively(input string) (*DdosCustomPolicyId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DdosCustomPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DdosCustomPolicyId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DdosCustomPolicyName, ok = parsed.Parsed["ddosCustomPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ddosCustomPolicyName", *parsed) + if id.DdosCustomPolicyName, ok = input.Parsed["ddosCustomPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ddosCustomPolicyName", input) } - return &id, nil + return nil } // ValidateDdosCustomPolicyID checks that 'input' can be parsed as a Ddos Custom Policy ID diff --git a/resource-manager/network/2023-06-01/ddosprotectionplans/id_ddosprotectionplan.go b/resource-manager/network/2023-06-01/ddosprotectionplans/id_ddosprotectionplan.go index 24d6a8f8f24..4dfddca2d86 100644 --- a/resource-manager/network/2023-06-01/ddosprotectionplans/id_ddosprotectionplan.go +++ b/resource-manager/network/2023-06-01/ddosprotectionplans/id_ddosprotectionplan.go @@ -36,19 +36,9 @@ func ParseDdosProtectionPlanID(input string) (*DdosProtectionPlanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DdosProtectionPlanId{} - - 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.DdosProtectionPlanName, ok = parsed.Parsed["ddosProtectionPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ddosProtectionPlanName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDdosProtectionPlanIDInsensitively(input string) (*DdosProtectionPlanId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DdosProtectionPlanId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DdosProtectionPlanId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DdosProtectionPlanName, ok = parsed.Parsed["ddosProtectionPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ddosProtectionPlanName", *parsed) + if id.DdosProtectionPlanName, ok = input.Parsed["ddosProtectionPlanName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ddosProtectionPlanName", input) } - return &id, nil + return nil } // ValidateDdosProtectionPlanID checks that 'input' can be parsed as a Ddos Protection Plan ID diff --git a/resource-manager/network/2023-06-01/dscpconfiguration/id_dscpconfiguration.go b/resource-manager/network/2023-06-01/dscpconfiguration/id_dscpconfiguration.go index 4f0d024833c..6997820990c 100644 --- a/resource-manager/network/2023-06-01/dscpconfiguration/id_dscpconfiguration.go +++ b/resource-manager/network/2023-06-01/dscpconfiguration/id_dscpconfiguration.go @@ -36,19 +36,9 @@ func ParseDscpConfigurationID(input string) (*DscpConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DscpConfigurationId{} - - 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.DscpConfigurationName, ok = parsed.Parsed["dscpConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dscpConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDscpConfigurationIDInsensitively(input string) (*DscpConfigurationId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DscpConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DscpConfigurationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DscpConfigurationName, ok = parsed.Parsed["dscpConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dscpConfigurationName", *parsed) + if id.DscpConfigurationName, ok = input.Parsed["dscpConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dscpConfigurationName", input) } - return &id, nil + return nil } // ValidateDscpConfigurationID checks that 'input' can be parsed as a Dscp Configuration ID diff --git a/resource-manager/network/2023-06-01/endpointservices/id_location.go b/resource-manager/network/2023-06-01/endpointservices/id_location.go index cb3d2ffd4c8..5728b9db337 100644 --- a/resource-manager/network/2023-06-01/endpointservices/id_location.go +++ b/resource-manager/network/2023-06-01/endpointservices/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/network/2023-06-01/expressroutecircuitarptable/id_arptable.go b/resource-manager/network/2023-06-01/expressroutecircuitarptable/id_arptable.go index 0771397d6bb..4255998ba5b 100644 --- a/resource-manager/network/2023-06-01/expressroutecircuitarptable/id_arptable.go +++ b/resource-manager/network/2023-06-01/expressroutecircuitarptable/id_arptable.go @@ -40,27 +40,9 @@ func ParseArpTableID(input string) (*ArpTableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ArpTableId{} - - 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.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) - } - - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) - } - - if id.ArpTableName, ok = parsed.Parsed["arpTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "arpTableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseArpTableIDInsensitively(input string) (*ArpTableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ArpTableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ArpTableId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) + if id.ExpressRouteCircuitName, ok = input.Parsed["expressRouteCircuitName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", input) } - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) + if id.PeeringName, ok = input.Parsed["peeringName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "peeringName", input) } - if id.ArpTableName, ok = parsed.Parsed["arpTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "arpTableName", *parsed) + if id.ArpTableName, ok = input.Parsed["arpTableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "arpTableName", input) } - return &id, nil + return nil } // ValidateArpTableID checks that 'input' can be parsed as a Arp Table ID diff --git a/resource-manager/network/2023-06-01/expressroutecircuitauthorizations/id_authorization.go b/resource-manager/network/2023-06-01/expressroutecircuitauthorizations/id_authorization.go index 614f1572fa7..e0c5a60e3e6 100644 --- a/resource-manager/network/2023-06-01/expressroutecircuitauthorizations/id_authorization.go +++ b/resource-manager/network/2023-06-01/expressroutecircuitauthorizations/id_authorization.go @@ -38,23 +38,9 @@ func ParseAuthorizationID(input string) (*AuthorizationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationId{} - - 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.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) - } - - if id.AuthorizationName, ok = parsed.Parsed["authorizationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAuthorizationIDInsensitively(input string) (*AuthorizationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AuthorizationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) + if id.ExpressRouteCircuitName, ok = input.Parsed["expressRouteCircuitName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", input) } - if id.AuthorizationName, ok = parsed.Parsed["authorizationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationName", *parsed) + if id.AuthorizationName, ok = input.Parsed["authorizationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationName", input) } - return &id, nil + return nil } // ValidateAuthorizationID checks that 'input' can be parsed as a Authorization ID diff --git a/resource-manager/network/2023-06-01/expressroutecircuitauthorizations/id_expressroutecircuit.go b/resource-manager/network/2023-06-01/expressroutecircuitauthorizations/id_expressroutecircuit.go index 502b311d236..29b136159f3 100644 --- a/resource-manager/network/2023-06-01/expressroutecircuitauthorizations/id_expressroutecircuit.go +++ b/resource-manager/network/2023-06-01/expressroutecircuitauthorizations/id_expressroutecircuit.go @@ -36,19 +36,9 @@ func ParseExpressRouteCircuitID(input string) (*ExpressRouteCircuitId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteCircuitId{} - - 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.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseExpressRouteCircuitIDInsensitively(input string) (*ExpressRouteCircuit return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteCircuitId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ExpressRouteCircuitId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) + if id.ExpressRouteCircuitName, ok = input.Parsed["expressRouteCircuitName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", input) } - return &id, nil + return nil } // ValidateExpressRouteCircuitID checks that 'input' can be parsed as a Express Route Circuit ID diff --git a/resource-manager/network/2023-06-01/expressroutecircuitconnections/id_peeringconnection.go b/resource-manager/network/2023-06-01/expressroutecircuitconnections/id_peeringconnection.go index 4bdac2a095a..eba1c63329b 100644 --- a/resource-manager/network/2023-06-01/expressroutecircuitconnections/id_peeringconnection.go +++ b/resource-manager/network/2023-06-01/expressroutecircuitconnections/id_peeringconnection.go @@ -40,27 +40,9 @@ func ParsePeeringConnectionID(input string) (*PeeringConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PeeringConnectionId{} - - 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.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) - } - - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) - } - - if id.ConnectionName, ok = parsed.Parsed["connectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParsePeeringConnectionIDInsensitively(input string) (*PeeringConnectionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PeeringConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *PeeringConnectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) + if id.ExpressRouteCircuitName, ok = input.Parsed["expressRouteCircuitName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", input) } - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) + if id.PeeringName, ok = input.Parsed["peeringName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "peeringName", input) } - if id.ConnectionName, ok = parsed.Parsed["connectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionName", *parsed) + if id.ConnectionName, ok = input.Parsed["connectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectionName", input) } - return &id, nil + return nil } // ValidatePeeringConnectionID checks that 'input' can be parsed as a Peering Connection ID diff --git a/resource-manager/network/2023-06-01/expressroutecircuitpeerings/id_expressroutecircuit.go b/resource-manager/network/2023-06-01/expressroutecircuitpeerings/id_expressroutecircuit.go index 80bd7e639d7..b36253f5c4a 100644 --- a/resource-manager/network/2023-06-01/expressroutecircuitpeerings/id_expressroutecircuit.go +++ b/resource-manager/network/2023-06-01/expressroutecircuitpeerings/id_expressroutecircuit.go @@ -36,19 +36,9 @@ func ParseExpressRouteCircuitID(input string) (*ExpressRouteCircuitId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteCircuitId{} - - 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.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseExpressRouteCircuitIDInsensitively(input string) (*ExpressRouteCircuit return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteCircuitId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ExpressRouteCircuitId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) + if id.ExpressRouteCircuitName, ok = input.Parsed["expressRouteCircuitName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", input) } - return &id, nil + return nil } // ValidateExpressRouteCircuitID checks that 'input' can be parsed as a Express Route Circuit ID diff --git a/resource-manager/network/2023-06-01/expressroutecircuitroutestable/id_peeringroutetable.go b/resource-manager/network/2023-06-01/expressroutecircuitroutestable/id_peeringroutetable.go index b383a1c57d2..2aa9e827b69 100644 --- a/resource-manager/network/2023-06-01/expressroutecircuitroutestable/id_peeringroutetable.go +++ b/resource-manager/network/2023-06-01/expressroutecircuitroutestable/id_peeringroutetable.go @@ -40,27 +40,9 @@ func ParsePeeringRouteTableID(input string) (*PeeringRouteTableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PeeringRouteTableId{} - - 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.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) - } - - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) - } - - if id.RouteTableName, ok = parsed.Parsed["routeTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParsePeeringRouteTableIDInsensitively(input string) (*PeeringRouteTableId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PeeringRouteTableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *PeeringRouteTableId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) + if id.ExpressRouteCircuitName, ok = input.Parsed["expressRouteCircuitName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", input) } - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) + if id.PeeringName, ok = input.Parsed["peeringName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "peeringName", input) } - if id.RouteTableName, ok = parsed.Parsed["routeTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", *parsed) + if id.RouteTableName, ok = input.Parsed["routeTableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", input) } - return &id, nil + return nil } // ValidatePeeringRouteTableID checks that 'input' can be parsed as a Peering Route Table ID diff --git a/resource-manager/network/2023-06-01/expressroutecircuitroutestablesummary/id_routetablessummary.go b/resource-manager/network/2023-06-01/expressroutecircuitroutestablesummary/id_routetablessummary.go index 1cbf9698584..8f8c7f0a726 100644 --- a/resource-manager/network/2023-06-01/expressroutecircuitroutestablesummary/id_routetablessummary.go +++ b/resource-manager/network/2023-06-01/expressroutecircuitroutestablesummary/id_routetablessummary.go @@ -40,27 +40,9 @@ func ParseRouteTablesSummaryID(input string) (*RouteTablesSummaryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteTablesSummaryId{} - - 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.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) - } - - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) - } - - if id.RouteTablesSummaryName, ok = parsed.Parsed["routeTablesSummaryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeTablesSummaryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseRouteTablesSummaryIDInsensitively(input string) (*RouteTablesSummaryId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteTablesSummaryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RouteTablesSummaryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) + if id.ExpressRouteCircuitName, ok = input.Parsed["expressRouteCircuitName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", input) } - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) + if id.PeeringName, ok = input.Parsed["peeringName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "peeringName", input) } - if id.RouteTablesSummaryName, ok = parsed.Parsed["routeTablesSummaryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeTablesSummaryName", *parsed) + if id.RouteTablesSummaryName, ok = input.Parsed["routeTablesSummaryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routeTablesSummaryName", input) } - return &id, nil + return nil } // ValidateRouteTablesSummaryID checks that 'input' can be parsed as a Route Tables Summary ID diff --git a/resource-manager/network/2023-06-01/expressroutecircuits/id_expressroutecircuit.go b/resource-manager/network/2023-06-01/expressroutecircuits/id_expressroutecircuit.go index 76f0cad7940..386f2129eb8 100644 --- a/resource-manager/network/2023-06-01/expressroutecircuits/id_expressroutecircuit.go +++ b/resource-manager/network/2023-06-01/expressroutecircuits/id_expressroutecircuit.go @@ -36,19 +36,9 @@ func ParseExpressRouteCircuitID(input string) (*ExpressRouteCircuitId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteCircuitId{} - - 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.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseExpressRouteCircuitIDInsensitively(input string) (*ExpressRouteCircuit return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteCircuitId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ExpressRouteCircuitId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) + if id.ExpressRouteCircuitName, ok = input.Parsed["expressRouteCircuitName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", input) } - return &id, nil + return nil } // ValidateExpressRouteCircuitID checks that 'input' can be parsed as a Express Route Circuit ID diff --git a/resource-manager/network/2023-06-01/expressroutecircuitstats/id_expressroutecircuit.go b/resource-manager/network/2023-06-01/expressroutecircuitstats/id_expressroutecircuit.go index 8f5bdbd93bb..defd9b84aac 100644 --- a/resource-manager/network/2023-06-01/expressroutecircuitstats/id_expressroutecircuit.go +++ b/resource-manager/network/2023-06-01/expressroutecircuitstats/id_expressroutecircuit.go @@ -36,19 +36,9 @@ func ParseExpressRouteCircuitID(input string) (*ExpressRouteCircuitId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteCircuitId{} - - 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.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseExpressRouteCircuitIDInsensitively(input string) (*ExpressRouteCircuit return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteCircuitId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ExpressRouteCircuitId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) + if id.ExpressRouteCircuitName, ok = input.Parsed["expressRouteCircuitName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", input) } - return &id, nil + return nil } // ValidateExpressRouteCircuitID checks that 'input' can be parsed as a Express Route Circuit ID diff --git a/resource-manager/network/2023-06-01/expressrouteconnections/id_expressrouteconnection.go b/resource-manager/network/2023-06-01/expressrouteconnections/id_expressrouteconnection.go index 9df4b46202b..b43720635d6 100644 --- a/resource-manager/network/2023-06-01/expressrouteconnections/id_expressrouteconnection.go +++ b/resource-manager/network/2023-06-01/expressrouteconnections/id_expressrouteconnection.go @@ -38,23 +38,9 @@ func ParseExpressRouteConnectionID(input string) (*ExpressRouteConnectionId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteConnectionId{} - - 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.ExpressRouteGatewayName, ok = parsed.Parsed["expressRouteGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteGatewayName", *parsed) - } - - if id.ExpressRouteConnectionName, ok = parsed.Parsed["expressRouteConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseExpressRouteConnectionIDInsensitively(input string) (*ExpressRouteConn return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ExpressRouteConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteGatewayName, ok = parsed.Parsed["expressRouteGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteGatewayName", *parsed) + if id.ExpressRouteGatewayName, ok = input.Parsed["expressRouteGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteGatewayName", input) } - if id.ExpressRouteConnectionName, ok = parsed.Parsed["expressRouteConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteConnectionName", *parsed) + if id.ExpressRouteConnectionName, ok = input.Parsed["expressRouteConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteConnectionName", input) } - return &id, nil + return nil } // ValidateExpressRouteConnectionID checks that 'input' can be parsed as a Express Route Connection ID diff --git a/resource-manager/network/2023-06-01/expressrouteconnections/id_expressroutegateway.go b/resource-manager/network/2023-06-01/expressrouteconnections/id_expressroutegateway.go index a697ea8a7e4..25fd28d50f5 100644 --- a/resource-manager/network/2023-06-01/expressrouteconnections/id_expressroutegateway.go +++ b/resource-manager/network/2023-06-01/expressrouteconnections/id_expressroutegateway.go @@ -36,19 +36,9 @@ func ParseExpressRouteGatewayID(input string) (*ExpressRouteGatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteGatewayId{} - - 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.ExpressRouteGatewayName, ok = parsed.Parsed["expressRouteGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteGatewayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseExpressRouteGatewayIDInsensitively(input string) (*ExpressRouteGateway return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteGatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ExpressRouteGatewayId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteGatewayName, ok = parsed.Parsed["expressRouteGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteGatewayName", *parsed) + if id.ExpressRouteGatewayName, ok = input.Parsed["expressRouteGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteGatewayName", input) } - return &id, nil + return nil } // ValidateExpressRouteGatewayID checks that 'input' can be parsed as a Express Route Gateway ID diff --git a/resource-manager/network/2023-06-01/expressroutecrossconnectionarptable/id_peeringarptable.go b/resource-manager/network/2023-06-01/expressroutecrossconnectionarptable/id_peeringarptable.go index c7d0e4d6c08..1fa7715c5c3 100644 --- a/resource-manager/network/2023-06-01/expressroutecrossconnectionarptable/id_peeringarptable.go +++ b/resource-manager/network/2023-06-01/expressroutecrossconnectionarptable/id_peeringarptable.go @@ -40,27 +40,9 @@ func ParsePeeringArpTableID(input string) (*PeeringArpTableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PeeringArpTableId{} - - 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.ExpressRouteCrossConnectionName, ok = parsed.Parsed["expressRouteCrossConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", *parsed) - } - - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) - } - - if id.ArpTableName, ok = parsed.Parsed["arpTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "arpTableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParsePeeringArpTableIDInsensitively(input string) (*PeeringArpTableId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PeeringArpTableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *PeeringArpTableId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteCrossConnectionName, ok = parsed.Parsed["expressRouteCrossConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", *parsed) + if id.ExpressRouteCrossConnectionName, ok = input.Parsed["expressRouteCrossConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", input) } - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) + if id.PeeringName, ok = input.Parsed["peeringName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "peeringName", input) } - if id.ArpTableName, ok = parsed.Parsed["arpTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "arpTableName", *parsed) + if id.ArpTableName, ok = input.Parsed["arpTableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "arpTableName", input) } - return &id, nil + return nil } // ValidatePeeringArpTableID checks that 'input' can be parsed as a Peering Arp Table ID diff --git a/resource-manager/network/2023-06-01/expressroutecrossconnectionpeerings/id_expressroutecrossconnection.go b/resource-manager/network/2023-06-01/expressroutecrossconnectionpeerings/id_expressroutecrossconnection.go index c2abc2bcb6e..79fdcaa3b4a 100644 --- a/resource-manager/network/2023-06-01/expressroutecrossconnectionpeerings/id_expressroutecrossconnection.go +++ b/resource-manager/network/2023-06-01/expressroutecrossconnectionpeerings/id_expressroutecrossconnection.go @@ -36,19 +36,9 @@ func ParseExpressRouteCrossConnectionID(input string) (*ExpressRouteCrossConnect return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteCrossConnectionId{} - - 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.ExpressRouteCrossConnectionName, ok = parsed.Parsed["expressRouteCrossConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseExpressRouteCrossConnectionIDInsensitively(input string) (*ExpressRout return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteCrossConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ExpressRouteCrossConnectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteCrossConnectionName, ok = parsed.Parsed["expressRouteCrossConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", *parsed) + if id.ExpressRouteCrossConnectionName, ok = input.Parsed["expressRouteCrossConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", input) } - return &id, nil + return nil } // ValidateExpressRouteCrossConnectionID checks that 'input' can be parsed as a Express Route Cross Connection ID diff --git a/resource-manager/network/2023-06-01/expressroutecrossconnectionpeerings/id_peering.go b/resource-manager/network/2023-06-01/expressroutecrossconnectionpeerings/id_peering.go index 8ff1861f76d..c01ecaf33ae 100644 --- a/resource-manager/network/2023-06-01/expressroutecrossconnectionpeerings/id_peering.go +++ b/resource-manager/network/2023-06-01/expressroutecrossconnectionpeerings/id_peering.go @@ -38,23 +38,9 @@ func ParsePeeringID(input string) (*PeeringId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PeeringId{} - - 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.ExpressRouteCrossConnectionName, ok = parsed.Parsed["expressRouteCrossConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", *parsed) - } - - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePeeringIDInsensitively(input string) (*PeeringId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PeeringId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PeeringId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteCrossConnectionName, ok = parsed.Parsed["expressRouteCrossConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", *parsed) + if id.ExpressRouteCrossConnectionName, ok = input.Parsed["expressRouteCrossConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", input) } - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) + if id.PeeringName, ok = input.Parsed["peeringName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "peeringName", input) } - return &id, nil + return nil } // ValidatePeeringID checks that 'input' can be parsed as a Peering ID diff --git a/resource-manager/network/2023-06-01/expressroutecrossconnectionroutetable/id_expressroutecrossconnectionpeeringroutetable.go b/resource-manager/network/2023-06-01/expressroutecrossconnectionroutetable/id_expressroutecrossconnectionpeeringroutetable.go index 5c0a0ea5302..8b8c3b8bcb7 100644 --- a/resource-manager/network/2023-06-01/expressroutecrossconnectionroutetable/id_expressroutecrossconnectionpeeringroutetable.go +++ b/resource-manager/network/2023-06-01/expressroutecrossconnectionroutetable/id_expressroutecrossconnectionpeeringroutetable.go @@ -40,27 +40,9 @@ func ParseExpressRouteCrossConnectionPeeringRouteTableID(input string) (*Express return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteCrossConnectionPeeringRouteTableId{} - - 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.ExpressRouteCrossConnectionName, ok = parsed.Parsed["expressRouteCrossConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", *parsed) - } - - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) - } - - if id.RouteTableName, ok = parsed.Parsed["routeTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseExpressRouteCrossConnectionPeeringRouteTableIDInsensitively(input stri return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteCrossConnectionPeeringRouteTableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ExpressRouteCrossConnectionPeeringRouteTableId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteCrossConnectionName, ok = parsed.Parsed["expressRouteCrossConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", *parsed) + if id.ExpressRouteCrossConnectionName, ok = input.Parsed["expressRouteCrossConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", input) } - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) + if id.PeeringName, ok = input.Parsed["peeringName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "peeringName", input) } - if id.RouteTableName, ok = parsed.Parsed["routeTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", *parsed) + if id.RouteTableName, ok = input.Parsed["routeTableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", input) } - return &id, nil + return nil } // ValidateExpressRouteCrossConnectionPeeringRouteTableID checks that 'input' can be parsed as a Express Route Cross Connection Peering Route Table ID diff --git a/resource-manager/network/2023-06-01/expressroutecrossconnectionroutetablesummary/id_peeringroutetablessummary.go b/resource-manager/network/2023-06-01/expressroutecrossconnectionroutetablesummary/id_peeringroutetablessummary.go index d679350bf9b..cb2b91c3cb9 100644 --- a/resource-manager/network/2023-06-01/expressroutecrossconnectionroutetablesummary/id_peeringroutetablessummary.go +++ b/resource-manager/network/2023-06-01/expressroutecrossconnectionroutetablesummary/id_peeringroutetablessummary.go @@ -40,27 +40,9 @@ func ParsePeeringRouteTablesSummaryID(input string) (*PeeringRouteTablesSummaryI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PeeringRouteTablesSummaryId{} - - 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.ExpressRouteCrossConnectionName, ok = parsed.Parsed["expressRouteCrossConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", *parsed) - } - - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) - } - - if id.RouteTablesSummaryName, ok = parsed.Parsed["routeTablesSummaryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeTablesSummaryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParsePeeringRouteTablesSummaryIDInsensitively(input string) (*PeeringRouteT return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PeeringRouteTablesSummaryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *PeeringRouteTablesSummaryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteCrossConnectionName, ok = parsed.Parsed["expressRouteCrossConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", *parsed) + if id.ExpressRouteCrossConnectionName, ok = input.Parsed["expressRouteCrossConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", input) } - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) + if id.PeeringName, ok = input.Parsed["peeringName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "peeringName", input) } - if id.RouteTablesSummaryName, ok = parsed.Parsed["routeTablesSummaryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeTablesSummaryName", *parsed) + if id.RouteTablesSummaryName, ok = input.Parsed["routeTablesSummaryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routeTablesSummaryName", input) } - return &id, nil + return nil } // ValidatePeeringRouteTablesSummaryID checks that 'input' can be parsed as a Peering Route Tables Summary ID diff --git a/resource-manager/network/2023-06-01/expressroutecrossconnections/id_expressroutecrossconnection.go b/resource-manager/network/2023-06-01/expressroutecrossconnections/id_expressroutecrossconnection.go index a8eb6b95127..1007905256c 100644 --- a/resource-manager/network/2023-06-01/expressroutecrossconnections/id_expressroutecrossconnection.go +++ b/resource-manager/network/2023-06-01/expressroutecrossconnections/id_expressroutecrossconnection.go @@ -36,19 +36,9 @@ func ParseExpressRouteCrossConnectionID(input string) (*ExpressRouteCrossConnect return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteCrossConnectionId{} - - 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.ExpressRouteCrossConnectionName, ok = parsed.Parsed["expressRouteCrossConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseExpressRouteCrossConnectionIDInsensitively(input string) (*ExpressRout return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteCrossConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ExpressRouteCrossConnectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteCrossConnectionName, ok = parsed.Parsed["expressRouteCrossConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", *parsed) + if id.ExpressRouteCrossConnectionName, ok = input.Parsed["expressRouteCrossConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCrossConnectionName", input) } - return &id, nil + return nil } // ValidateExpressRouteCrossConnectionID checks that 'input' can be parsed as a Express Route Cross Connection ID diff --git a/resource-manager/network/2023-06-01/expressroutegateways/id_expressroutegateway.go b/resource-manager/network/2023-06-01/expressroutegateways/id_expressroutegateway.go index 4e9f6ccc25f..0e940d12bdf 100644 --- a/resource-manager/network/2023-06-01/expressroutegateways/id_expressroutegateway.go +++ b/resource-manager/network/2023-06-01/expressroutegateways/id_expressroutegateway.go @@ -36,19 +36,9 @@ func ParseExpressRouteGatewayID(input string) (*ExpressRouteGatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteGatewayId{} - - 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.ExpressRouteGatewayName, ok = parsed.Parsed["expressRouteGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteGatewayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseExpressRouteGatewayIDInsensitively(input string) (*ExpressRouteGateway return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteGatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ExpressRouteGatewayId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteGatewayName, ok = parsed.Parsed["expressRouteGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteGatewayName", *parsed) + if id.ExpressRouteGatewayName, ok = input.Parsed["expressRouteGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteGatewayName", input) } - return &id, nil + return nil } // ValidateExpressRouteGatewayID checks that 'input' can be parsed as a Express Route Gateway ID diff --git a/resource-manager/network/2023-06-01/expressroutelinks/id_expressrouteport.go b/resource-manager/network/2023-06-01/expressroutelinks/id_expressrouteport.go index 4c0b60ea457..1ddfc494185 100644 --- a/resource-manager/network/2023-06-01/expressroutelinks/id_expressrouteport.go +++ b/resource-manager/network/2023-06-01/expressroutelinks/id_expressrouteport.go @@ -36,19 +36,9 @@ func ParseExpressRoutePortID(input string) (*ExpressRoutePortId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRoutePortId{} - - 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.ExpressRoutePortName, ok = parsed.Parsed["expressRoutePortName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseExpressRoutePortIDInsensitively(input string) (*ExpressRoutePortId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRoutePortId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ExpressRoutePortId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRoutePortName, ok = parsed.Parsed["expressRoutePortName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortName", *parsed) + if id.ExpressRoutePortName, ok = input.Parsed["expressRoutePortName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortName", input) } - return &id, nil + return nil } // ValidateExpressRoutePortID checks that 'input' can be parsed as a Express Route Port ID diff --git a/resource-manager/network/2023-06-01/expressroutelinks/id_link.go b/resource-manager/network/2023-06-01/expressroutelinks/id_link.go index 39a80538a62..3e4266036c2 100644 --- a/resource-manager/network/2023-06-01/expressroutelinks/id_link.go +++ b/resource-manager/network/2023-06-01/expressroutelinks/id_link.go @@ -38,23 +38,9 @@ func ParseLinkID(input string) (*LinkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LinkId{} - - 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.ExpressRoutePortName, ok = parsed.Parsed["expressRoutePortName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortName", *parsed) - } - - if id.LinkName, ok = parsed.Parsed["linkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "linkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLinkIDInsensitively(input string) (*LinkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LinkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LinkId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRoutePortName, ok = parsed.Parsed["expressRoutePortName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortName", *parsed) + if id.ExpressRoutePortName, ok = input.Parsed["expressRoutePortName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortName", input) } - if id.LinkName, ok = parsed.Parsed["linkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "linkName", *parsed) + if id.LinkName, ok = input.Parsed["linkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "linkName", input) } - return &id, nil + return nil } // ValidateLinkID checks that 'input' can be parsed as a Link ID diff --git a/resource-manager/network/2023-06-01/expressrouteportauthorizations/id_expressrouteport.go b/resource-manager/network/2023-06-01/expressrouteportauthorizations/id_expressrouteport.go index be98e366b7f..a2222ad6d45 100644 --- a/resource-manager/network/2023-06-01/expressrouteportauthorizations/id_expressrouteport.go +++ b/resource-manager/network/2023-06-01/expressrouteportauthorizations/id_expressrouteport.go @@ -36,19 +36,9 @@ func ParseExpressRoutePortID(input string) (*ExpressRoutePortId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRoutePortId{} - - 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.ExpressRoutePortName, ok = parsed.Parsed["expressRoutePortName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseExpressRoutePortIDInsensitively(input string) (*ExpressRoutePortId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRoutePortId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ExpressRoutePortId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRoutePortName, ok = parsed.Parsed["expressRoutePortName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortName", *parsed) + if id.ExpressRoutePortName, ok = input.Parsed["expressRoutePortName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortName", input) } - return &id, nil + return nil } // ValidateExpressRoutePortID checks that 'input' can be parsed as a Express Route Port ID diff --git a/resource-manager/network/2023-06-01/expressrouteportauthorizations/id_expressrouteportauthorization.go b/resource-manager/network/2023-06-01/expressrouteportauthorizations/id_expressrouteportauthorization.go index 5b7042091d0..8af9ba18bf6 100644 --- a/resource-manager/network/2023-06-01/expressrouteportauthorizations/id_expressrouteportauthorization.go +++ b/resource-manager/network/2023-06-01/expressrouteportauthorizations/id_expressrouteportauthorization.go @@ -38,23 +38,9 @@ func ParseExpressRoutePortAuthorizationID(input string) (*ExpressRoutePortAuthor return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRoutePortAuthorizationId{} - - 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.ExpressRoutePortName, ok = parsed.Parsed["expressRoutePortName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortName", *parsed) - } - - if id.AuthorizationName, ok = parsed.Parsed["authorizationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseExpressRoutePortAuthorizationIDInsensitively(input string) (*ExpressRo return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRoutePortAuthorizationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ExpressRoutePortAuthorizationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRoutePortName, ok = parsed.Parsed["expressRoutePortName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortName", *parsed) + if id.ExpressRoutePortName, ok = input.Parsed["expressRoutePortName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortName", input) } - if id.AuthorizationName, ok = parsed.Parsed["authorizationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationName", *parsed) + if id.AuthorizationName, ok = input.Parsed["authorizationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationName", input) } - return &id, nil + return nil } // ValidateExpressRoutePortAuthorizationID checks that 'input' can be parsed as a Express Route Port Authorization ID diff --git a/resource-manager/network/2023-06-01/expressrouteports/id_expressrouteport.go b/resource-manager/network/2023-06-01/expressrouteports/id_expressrouteport.go index 2d3ef3fed81..ee7a7081bcc 100644 --- a/resource-manager/network/2023-06-01/expressrouteports/id_expressrouteport.go +++ b/resource-manager/network/2023-06-01/expressrouteports/id_expressrouteport.go @@ -36,19 +36,9 @@ func ParseExpressRoutePortID(input string) (*ExpressRoutePortId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRoutePortId{} - - 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.ExpressRoutePortName, ok = parsed.Parsed["expressRoutePortName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseExpressRoutePortIDInsensitively(input string) (*ExpressRoutePortId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRoutePortId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ExpressRoutePortId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRoutePortName, ok = parsed.Parsed["expressRoutePortName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortName", *parsed) + if id.ExpressRoutePortName, ok = input.Parsed["expressRoutePortName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortName", input) } - return &id, nil + return nil } // ValidateExpressRoutePortID checks that 'input' can be parsed as a Express Route Port ID diff --git a/resource-manager/network/2023-06-01/expressrouteportslocations/id_expressrouteportslocation.go b/resource-manager/network/2023-06-01/expressrouteportslocations/id_expressrouteportslocation.go index 096c43de667..bde80a447d3 100644 --- a/resource-manager/network/2023-06-01/expressrouteportslocations/id_expressrouteportslocation.go +++ b/resource-manager/network/2023-06-01/expressrouteportslocations/id_expressrouteportslocation.go @@ -34,15 +34,9 @@ func ParseExpressRoutePortsLocationID(input string) (*ExpressRoutePortsLocationI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRoutePortsLocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.ExpressRoutePortsLocationName, ok = parsed.Parsed["expressRoutePortsLocationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortsLocationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseExpressRoutePortsLocationIDInsensitively(input string) (*ExpressRouteP return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRoutePortsLocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ExpressRoutePortsLocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ExpressRoutePortsLocationName, ok = parsed.Parsed["expressRoutePortsLocationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortsLocationName", *parsed) + if id.ExpressRoutePortsLocationName, ok = input.Parsed["expressRoutePortsLocationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRoutePortsLocationName", input) } - return &id, nil + return nil } // ValidateExpressRoutePortsLocationID checks that 'input' can be parsed as a Express Route Ports Location ID diff --git a/resource-manager/network/2023-06-01/expressrouteproviderports/id_expressrouteproviderport.go b/resource-manager/network/2023-06-01/expressrouteproviderports/id_expressrouteproviderport.go index e7df5d969e9..c331d574152 100644 --- a/resource-manager/network/2023-06-01/expressrouteproviderports/id_expressrouteproviderport.go +++ b/resource-manager/network/2023-06-01/expressrouteproviderports/id_expressrouteproviderport.go @@ -34,15 +34,9 @@ func ParseExpressRouteProviderPortID(input string) (*ExpressRouteProviderPortId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteProviderPortId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.ExpressRouteProviderPortName, ok = parsed.Parsed["expressRouteProviderPortName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteProviderPortName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseExpressRouteProviderPortIDInsensitively(input string) (*ExpressRoutePr return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExpressRouteProviderPortId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ExpressRouteProviderPortId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ExpressRouteProviderPortName, ok = parsed.Parsed["expressRouteProviderPortName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteProviderPortName", *parsed) + if id.ExpressRouteProviderPortName, ok = input.Parsed["expressRouteProviderPortName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteProviderPortName", input) } - return &id, nil + return nil } // ValidateExpressRouteProviderPortID checks that 'input' can be parsed as a Express Route Provider Port ID diff --git a/resource-manager/network/2023-06-01/firewallpolicies/id_firewallpolicy.go b/resource-manager/network/2023-06-01/firewallpolicies/id_firewallpolicy.go index 7b760ef341f..6cbb1ce8493 100644 --- a/resource-manager/network/2023-06-01/firewallpolicies/id_firewallpolicy.go +++ b/resource-manager/network/2023-06-01/firewallpolicies/id_firewallpolicy.go @@ -36,19 +36,9 @@ func ParseFirewallPolicyID(input string) (*FirewallPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallPolicyId{} - - 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.FirewallPolicyName, ok = parsed.Parsed["firewallPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFirewallPolicyIDInsensitively(input string) (*FirewallPolicyId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FirewallPolicyId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FirewallPolicyName, ok = parsed.Parsed["firewallPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallPolicyName", *parsed) + if id.FirewallPolicyName, ok = input.Parsed["firewallPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "firewallPolicyName", input) } - return &id, nil + return nil } // ValidateFirewallPolicyID checks that 'input' can be parsed as a Firewall Policy ID diff --git a/resource-manager/network/2023-06-01/firewallpolicyrulecollectiongroups/id_firewallpolicy.go b/resource-manager/network/2023-06-01/firewallpolicyrulecollectiongroups/id_firewallpolicy.go index 0ab64308936..2082c31895f 100644 --- a/resource-manager/network/2023-06-01/firewallpolicyrulecollectiongroups/id_firewallpolicy.go +++ b/resource-manager/network/2023-06-01/firewallpolicyrulecollectiongroups/id_firewallpolicy.go @@ -36,19 +36,9 @@ func ParseFirewallPolicyID(input string) (*FirewallPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallPolicyId{} - - 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.FirewallPolicyName, ok = parsed.Parsed["firewallPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFirewallPolicyIDInsensitively(input string) (*FirewallPolicyId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FirewallPolicyId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FirewallPolicyName, ok = parsed.Parsed["firewallPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallPolicyName", *parsed) + if id.FirewallPolicyName, ok = input.Parsed["firewallPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "firewallPolicyName", input) } - return &id, nil + return nil } // ValidateFirewallPolicyID checks that 'input' can be parsed as a Firewall Policy ID diff --git a/resource-manager/network/2023-06-01/firewallpolicyrulecollectiongroups/id_rulecollectiongroup.go b/resource-manager/network/2023-06-01/firewallpolicyrulecollectiongroups/id_rulecollectiongroup.go index 8ab322f77ac..a53efd19810 100644 --- a/resource-manager/network/2023-06-01/firewallpolicyrulecollectiongroups/id_rulecollectiongroup.go +++ b/resource-manager/network/2023-06-01/firewallpolicyrulecollectiongroups/id_rulecollectiongroup.go @@ -38,23 +38,9 @@ func ParseRuleCollectionGroupID(input string) (*RuleCollectionGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RuleCollectionGroupId{} - - 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.FirewallPolicyName, ok = parsed.Parsed["firewallPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallPolicyName", *parsed) - } - - if id.RuleCollectionGroupName, ok = parsed.Parsed["ruleCollectionGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleCollectionGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRuleCollectionGroupIDInsensitively(input string) (*RuleCollectionGroup return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RuleCollectionGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RuleCollectionGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FirewallPolicyName, ok = parsed.Parsed["firewallPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallPolicyName", *parsed) + if id.FirewallPolicyName, ok = input.Parsed["firewallPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "firewallPolicyName", input) } - if id.RuleCollectionGroupName, ok = parsed.Parsed["ruleCollectionGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleCollectionGroupName", *parsed) + if id.RuleCollectionGroupName, ok = input.Parsed["ruleCollectionGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleCollectionGroupName", input) } - return &id, nil + return nil } // ValidateRuleCollectionGroupID checks that 'input' can be parsed as a Rule Collection Group ID diff --git a/resource-manager/network/2023-06-01/flowlogs/id_flowlog.go b/resource-manager/network/2023-06-01/flowlogs/id_flowlog.go index 531b76451d0..aa2aae5403e 100644 --- a/resource-manager/network/2023-06-01/flowlogs/id_flowlog.go +++ b/resource-manager/network/2023-06-01/flowlogs/id_flowlog.go @@ -38,23 +38,9 @@ func ParseFlowLogID(input string) (*FlowLogId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlowLogId{} - - 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.NetworkWatcherName, ok = parsed.Parsed["networkWatcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", *parsed) - } - - if id.FlowLogName, ok = parsed.Parsed["flowLogName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flowLogName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFlowLogIDInsensitively(input string) (*FlowLogId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlowLogId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FlowLogId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkWatcherName, ok = parsed.Parsed["networkWatcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", *parsed) + if id.NetworkWatcherName, ok = input.Parsed["networkWatcherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", input) } - if id.FlowLogName, ok = parsed.Parsed["flowLogName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flowLogName", *parsed) + if id.FlowLogName, ok = input.Parsed["flowLogName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flowLogName", input) } - return &id, nil + return nil } // ValidateFlowLogID checks that 'input' can be parsed as a Flow Log ID diff --git a/resource-manager/network/2023-06-01/flowlogs/id_networkwatcher.go b/resource-manager/network/2023-06-01/flowlogs/id_networkwatcher.go index 5fc6d966ffe..3bbc6a1f659 100644 --- a/resource-manager/network/2023-06-01/flowlogs/id_networkwatcher.go +++ b/resource-manager/network/2023-06-01/flowlogs/id_networkwatcher.go @@ -36,19 +36,9 @@ func ParseNetworkWatcherID(input string) (*NetworkWatcherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkWatcherId{} - - 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.NetworkWatcherName, ok = parsed.Parsed["networkWatcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkWatcherIDInsensitively(input string) (*NetworkWatcherId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkWatcherId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkWatcherId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkWatcherName, ok = parsed.Parsed["networkWatcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", *parsed) + if id.NetworkWatcherName, ok = input.Parsed["networkWatcherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", input) } - return &id, nil + return nil } // ValidateNetworkWatcherID checks that 'input' can be parsed as a Network Watcher ID diff --git a/resource-manager/network/2023-06-01/ipallocations/id_ipallocation.go b/resource-manager/network/2023-06-01/ipallocations/id_ipallocation.go index 6e8aa2517f8..2a747377218 100644 --- a/resource-manager/network/2023-06-01/ipallocations/id_ipallocation.go +++ b/resource-manager/network/2023-06-01/ipallocations/id_ipallocation.go @@ -36,19 +36,9 @@ func ParseIPAllocationID(input string) (*IPAllocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IPAllocationId{} - - 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.IpAllocationName, ok = parsed.Parsed["ipAllocationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ipAllocationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseIPAllocationIDInsensitively(input string) (*IPAllocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IPAllocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *IPAllocationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.IpAllocationName, ok = parsed.Parsed["ipAllocationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ipAllocationName", *parsed) + if id.IpAllocationName, ok = input.Parsed["ipAllocationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ipAllocationName", input) } - return &id, nil + return nil } // ValidateIPAllocationID checks that 'input' can be parsed as a I P Allocation ID diff --git a/resource-manager/network/2023-06-01/ipgroups/id_ipgroup.go b/resource-manager/network/2023-06-01/ipgroups/id_ipgroup.go index 8ca4249bbd4..45902765d86 100644 --- a/resource-manager/network/2023-06-01/ipgroups/id_ipgroup.go +++ b/resource-manager/network/2023-06-01/ipgroups/id_ipgroup.go @@ -36,19 +36,9 @@ func ParseIPGroupID(input string) (*IPGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IPGroupId{} - - 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.IpGroupName, ok = parsed.Parsed["ipGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ipGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseIPGroupIDInsensitively(input string) (*IPGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IPGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *IPGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.IpGroupName, ok = parsed.Parsed["ipGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ipGroupName", *parsed) + if id.IpGroupName, ok = input.Parsed["ipGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ipGroupName", input) } - return &id, nil + return nil } // ValidateIPGroupID checks that 'input' can be parsed as a I P Group ID diff --git a/resource-manager/network/2023-06-01/loadbalancers/id_backendaddresspool.go b/resource-manager/network/2023-06-01/loadbalancers/id_backendaddresspool.go index 39e1f9356f9..8f5a557e2b8 100644 --- a/resource-manager/network/2023-06-01/loadbalancers/id_backendaddresspool.go +++ b/resource-manager/network/2023-06-01/loadbalancers/id_backendaddresspool.go @@ -38,23 +38,9 @@ func ParseBackendAddressPoolID(input string) (*BackendAddressPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackendAddressPoolId{} - - 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.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) - } - - if id.BackendAddressPoolName, ok = parsed.Parsed["backendAddressPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backendAddressPoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackendAddressPoolIDInsensitively(input string) (*BackendAddressPoolId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackendAddressPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackendAddressPoolId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) + if id.LoadBalancerName, ok = input.Parsed["loadBalancerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", input) } - if id.BackendAddressPoolName, ok = parsed.Parsed["backendAddressPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backendAddressPoolName", *parsed) + if id.BackendAddressPoolName, ok = input.Parsed["backendAddressPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backendAddressPoolName", input) } - return &id, nil + return nil } // ValidateBackendAddressPoolID checks that 'input' can be parsed as a Backend Address Pool ID diff --git a/resource-manager/network/2023-06-01/loadbalancers/id_frontendipconfiguration.go b/resource-manager/network/2023-06-01/loadbalancers/id_frontendipconfiguration.go index 9f6c3f96a03..aafe02ffabc 100644 --- a/resource-manager/network/2023-06-01/loadbalancers/id_frontendipconfiguration.go +++ b/resource-manager/network/2023-06-01/loadbalancers/id_frontendipconfiguration.go @@ -38,23 +38,9 @@ func ParseFrontendIPConfigurationID(input string) (*FrontendIPConfigurationId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FrontendIPConfigurationId{} - - 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.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) - } - - if id.FrontendIPConfigurationName, ok = parsed.Parsed["frontendIPConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "frontendIPConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFrontendIPConfigurationIDInsensitively(input string) (*FrontendIPConfi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FrontendIPConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FrontendIPConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) + if id.LoadBalancerName, ok = input.Parsed["loadBalancerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", input) } - if id.FrontendIPConfigurationName, ok = parsed.Parsed["frontendIPConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "frontendIPConfigurationName", *parsed) + if id.FrontendIPConfigurationName, ok = input.Parsed["frontendIPConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "frontendIPConfigurationName", input) } - return &id, nil + return nil } // ValidateFrontendIPConfigurationID checks that 'input' can be parsed as a Frontend I P Configuration ID diff --git a/resource-manager/network/2023-06-01/loadbalancers/id_inboundnatrule.go b/resource-manager/network/2023-06-01/loadbalancers/id_inboundnatrule.go index 8a803ad6788..6bd76e31f88 100644 --- a/resource-manager/network/2023-06-01/loadbalancers/id_inboundnatrule.go +++ b/resource-manager/network/2023-06-01/loadbalancers/id_inboundnatrule.go @@ -38,23 +38,9 @@ func ParseInboundNatRuleID(input string) (*InboundNatRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InboundNatRuleId{} - - 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.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) - } - - if id.InboundNatRuleName, ok = parsed.Parsed["inboundNatRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "inboundNatRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseInboundNatRuleIDInsensitively(input string) (*InboundNatRuleId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InboundNatRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *InboundNatRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) + if id.LoadBalancerName, ok = input.Parsed["loadBalancerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", input) } - if id.InboundNatRuleName, ok = parsed.Parsed["inboundNatRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "inboundNatRuleName", *parsed) + if id.InboundNatRuleName, ok = input.Parsed["inboundNatRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "inboundNatRuleName", input) } - return &id, nil + return nil } // ValidateInboundNatRuleID checks that 'input' can be parsed as a Inbound Nat Rule ID diff --git a/resource-manager/network/2023-06-01/loadbalancers/id_loadbalancer.go b/resource-manager/network/2023-06-01/loadbalancers/id_loadbalancer.go index 28f94e2cf3f..7bdb2e468e1 100644 --- a/resource-manager/network/2023-06-01/loadbalancers/id_loadbalancer.go +++ b/resource-manager/network/2023-06-01/loadbalancers/id_loadbalancer.go @@ -36,19 +36,9 @@ func ParseLoadBalancerID(input string) (*LoadBalancerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LoadBalancerId{} - - 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.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLoadBalancerIDInsensitively(input string) (*LoadBalancerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LoadBalancerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LoadBalancerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) + if id.LoadBalancerName, ok = input.Parsed["loadBalancerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", input) } - return &id, nil + return nil } // ValidateLoadBalancerID checks that 'input' can be parsed as a Load Balancer ID diff --git a/resource-manager/network/2023-06-01/loadbalancers/id_loadbalancerbackendaddresspool.go b/resource-manager/network/2023-06-01/loadbalancers/id_loadbalancerbackendaddresspool.go index 98ac08abc20..8698d328a33 100644 --- a/resource-manager/network/2023-06-01/loadbalancers/id_loadbalancerbackendaddresspool.go +++ b/resource-manager/network/2023-06-01/loadbalancers/id_loadbalancerbackendaddresspool.go @@ -38,23 +38,9 @@ func ParseLoadBalancerBackendAddressPoolID(input string) (*LoadBalancerBackendAd return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LoadBalancerBackendAddressPoolId{} - - 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.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) - } - - if id.BackendAddressPoolName, ok = parsed.Parsed["backendAddressPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backendAddressPoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLoadBalancerBackendAddressPoolIDInsensitively(input string) (*LoadBala return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LoadBalancerBackendAddressPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LoadBalancerBackendAddressPoolId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) + if id.LoadBalancerName, ok = input.Parsed["loadBalancerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", input) } - if id.BackendAddressPoolName, ok = parsed.Parsed["backendAddressPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backendAddressPoolName", *parsed) + if id.BackendAddressPoolName, ok = input.Parsed["backendAddressPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backendAddressPoolName", input) } - return &id, nil + return nil } // ValidateLoadBalancerBackendAddressPoolID checks that 'input' can be parsed as a Load Balancer Backend Address Pool ID diff --git a/resource-manager/network/2023-06-01/loadbalancers/id_loadbalancingrule.go b/resource-manager/network/2023-06-01/loadbalancers/id_loadbalancingrule.go index 4b3bb48b397..e5622c56f46 100644 --- a/resource-manager/network/2023-06-01/loadbalancers/id_loadbalancingrule.go +++ b/resource-manager/network/2023-06-01/loadbalancers/id_loadbalancingrule.go @@ -38,23 +38,9 @@ func ParseLoadBalancingRuleID(input string) (*LoadBalancingRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LoadBalancingRuleId{} - - 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.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) - } - - if id.LoadBalancingRuleName, ok = parsed.Parsed["loadBalancingRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancingRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLoadBalancingRuleIDInsensitively(input string) (*LoadBalancingRuleId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LoadBalancingRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LoadBalancingRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) + if id.LoadBalancerName, ok = input.Parsed["loadBalancerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", input) } - if id.LoadBalancingRuleName, ok = parsed.Parsed["loadBalancingRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancingRuleName", *parsed) + if id.LoadBalancingRuleName, ok = input.Parsed["loadBalancingRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "loadBalancingRuleName", input) } - return &id, nil + return nil } // ValidateLoadBalancingRuleID checks that 'input' can be parsed as a Load Balancing Rule ID diff --git a/resource-manager/network/2023-06-01/loadbalancers/id_location.go b/resource-manager/network/2023-06-01/loadbalancers/id_location.go index 3a2efc6db17..7a45a89e1ae 100644 --- a/resource-manager/network/2023-06-01/loadbalancers/id_location.go +++ b/resource-manager/network/2023-06-01/loadbalancers/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/network/2023-06-01/loadbalancers/id_outboundrule.go b/resource-manager/network/2023-06-01/loadbalancers/id_outboundrule.go index b2c3cafa61b..651a601a0f4 100644 --- a/resource-manager/network/2023-06-01/loadbalancers/id_outboundrule.go +++ b/resource-manager/network/2023-06-01/loadbalancers/id_outboundrule.go @@ -38,23 +38,9 @@ func ParseOutboundRuleID(input string) (*OutboundRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OutboundRuleId{} - - 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.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) - } - - if id.OutboundRuleName, ok = parsed.Parsed["outboundRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "outboundRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseOutboundRuleIDInsensitively(input string) (*OutboundRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OutboundRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OutboundRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) + if id.LoadBalancerName, ok = input.Parsed["loadBalancerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", input) } - if id.OutboundRuleName, ok = parsed.Parsed["outboundRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "outboundRuleName", *parsed) + if id.OutboundRuleName, ok = input.Parsed["outboundRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "outboundRuleName", input) } - return &id, nil + return nil } // ValidateOutboundRuleID checks that 'input' can be parsed as a Outbound Rule ID diff --git a/resource-manager/network/2023-06-01/loadbalancers/id_probe.go b/resource-manager/network/2023-06-01/loadbalancers/id_probe.go index 6307740b0b8..a6df1c3f1b1 100644 --- a/resource-manager/network/2023-06-01/loadbalancers/id_probe.go +++ b/resource-manager/network/2023-06-01/loadbalancers/id_probe.go @@ -38,23 +38,9 @@ func ParseProbeID(input string) (*ProbeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProbeId{} - - 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.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) - } - - if id.ProbeName, ok = parsed.Parsed["probeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "probeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProbeIDInsensitively(input string) (*ProbeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProbeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProbeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) + if id.LoadBalancerName, ok = input.Parsed["loadBalancerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", input) } - if id.ProbeName, ok = parsed.Parsed["probeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "probeName", *parsed) + if id.ProbeName, ok = input.Parsed["probeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "probeName", input) } - return &id, nil + return nil } // ValidateProbeID checks that 'input' can be parsed as a Probe ID diff --git a/resource-manager/network/2023-06-01/loadbalancers/id_providerloadbalancer.go b/resource-manager/network/2023-06-01/loadbalancers/id_providerloadbalancer.go index d93844028b6..c66a2652fd8 100644 --- a/resource-manager/network/2023-06-01/loadbalancers/id_providerloadbalancer.go +++ b/resource-manager/network/2023-06-01/loadbalancers/id_providerloadbalancer.go @@ -36,19 +36,9 @@ func ParseProviderLoadBalancerID(input string) (*ProviderLoadBalancerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLoadBalancerId{} - - 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.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderLoadBalancerIDInsensitively(input string) (*ProviderLoadBalanc return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLoadBalancerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderLoadBalancerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LoadBalancerName, ok = parsed.Parsed["loadBalancerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", *parsed) + if id.LoadBalancerName, ok = input.Parsed["loadBalancerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "loadBalancerName", input) } - return &id, nil + return nil } // ValidateProviderLoadBalancerID checks that 'input' can be parsed as a Provider Load Balancer ID diff --git a/resource-manager/network/2023-06-01/localnetworkgateways/id_localnetworkgateway.go b/resource-manager/network/2023-06-01/localnetworkgateways/id_localnetworkgateway.go index 9e5a1b39e8c..6242e60495d 100644 --- a/resource-manager/network/2023-06-01/localnetworkgateways/id_localnetworkgateway.go +++ b/resource-manager/network/2023-06-01/localnetworkgateways/id_localnetworkgateway.go @@ -36,19 +36,9 @@ func ParseLocalNetworkGatewayID(input string) (*LocalNetworkGatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocalNetworkGatewayId{} - - 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.LocalNetworkGatewayName, ok = parsed.Parsed["localNetworkGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localNetworkGatewayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLocalNetworkGatewayIDInsensitively(input string) (*LocalNetworkGateway return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocalNetworkGatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LocalNetworkGatewayId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocalNetworkGatewayName, ok = parsed.Parsed["localNetworkGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localNetworkGatewayName", *parsed) + if id.LocalNetworkGatewayName, ok = input.Parsed["localNetworkGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "localNetworkGatewayName", input) } - return &id, nil + return nil } // ValidateLocalNetworkGatewayID checks that 'input' can be parsed as a Local Network Gateway ID diff --git a/resource-manager/network/2023-06-01/natgateways/id_natgateway.go b/resource-manager/network/2023-06-01/natgateways/id_natgateway.go index 2ce4673298f..2d35c738748 100644 --- a/resource-manager/network/2023-06-01/natgateways/id_natgateway.go +++ b/resource-manager/network/2023-06-01/natgateways/id_natgateway.go @@ -36,19 +36,9 @@ func ParseNatGatewayID(input string) (*NatGatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NatGatewayId{} - - 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.NatGatewayName, ok = parsed.Parsed["natGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "natGatewayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNatGatewayIDInsensitively(input string) (*NatGatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NatGatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NatGatewayId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NatGatewayName, ok = parsed.Parsed["natGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "natGatewayName", *parsed) + if id.NatGatewayName, ok = input.Parsed["natGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "natGatewayName", input) } - return &id, nil + return nil } // ValidateNatGatewayID checks that 'input' can be parsed as a Nat Gateway ID diff --git a/resource-manager/network/2023-06-01/networkgroups/id_networkgroup.go b/resource-manager/network/2023-06-01/networkgroups/id_networkgroup.go index e96f87ea6b4..186c7965e71 100644 --- a/resource-manager/network/2023-06-01/networkgroups/id_networkgroup.go +++ b/resource-manager/network/2023-06-01/networkgroups/id_networkgroup.go @@ -38,23 +38,9 @@ func ParseNetworkGroupID(input string) (*NetworkGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkGroupId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) - } - - if id.NetworkGroupName, ok = parsed.Parsed["networkGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseNetworkGroupIDInsensitively(input string) (*NetworkGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *NetworkGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - if id.NetworkGroupName, ok = parsed.Parsed["networkGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkGroupName", *parsed) + if id.NetworkGroupName, ok = input.Parsed["networkGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkGroupName", input) } - return &id, nil + return nil } // ValidateNetworkGroupID checks that 'input' can be parsed as a Network Group ID diff --git a/resource-manager/network/2023-06-01/networkgroups/id_networkmanager.go b/resource-manager/network/2023-06-01/networkgroups/id_networkmanager.go index 0524156947b..bcdb5221bdd 100644 --- a/resource-manager/network/2023-06-01/networkgroups/id_networkmanager.go +++ b/resource-manager/network/2023-06-01/networkgroups/id_networkmanager.go @@ -36,19 +36,9 @@ func ParseNetworkManagerID(input string) (*NetworkManagerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkManagerId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkManagerIDInsensitively(input string) (*NetworkManagerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkManagerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkManagerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - return &id, nil + return nil } // ValidateNetworkManagerID checks that 'input' can be parsed as a Network Manager ID diff --git a/resource-manager/network/2023-06-01/networkinterfaces/id_providercloudservice.go b/resource-manager/network/2023-06-01/networkinterfaces/id_providercloudservice.go index 3fcfcb53fc7..6493dd6d4f7 100644 --- a/resource-manager/network/2023-06-01/networkinterfaces/id_providercloudservice.go +++ b/resource-manager/network/2023-06-01/networkinterfaces/id_providercloudservice.go @@ -36,19 +36,9 @@ func ParseProviderCloudServiceID(input string) (*ProviderCloudServiceId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderCloudServiceId{} - - 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.CloudServiceName, ok = parsed.Parsed["cloudServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderCloudServiceIDInsensitively(input string) (*ProviderCloudServi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderCloudServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderCloudServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CloudServiceName, ok = parsed.Parsed["cloudServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", *parsed) + if id.CloudServiceName, ok = input.Parsed["cloudServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", input) } - return &id, nil + return nil } // ValidateProviderCloudServiceID checks that 'input' can be parsed as a Provider Cloud Service ID diff --git a/resource-manager/network/2023-06-01/networkinterfaces/id_roleinstance.go b/resource-manager/network/2023-06-01/networkinterfaces/id_roleinstance.go index 5c916d65fd8..8f24317428a 100644 --- a/resource-manager/network/2023-06-01/networkinterfaces/id_roleinstance.go +++ b/resource-manager/network/2023-06-01/networkinterfaces/id_roleinstance.go @@ -38,23 +38,9 @@ func ParseRoleInstanceID(input string) (*RoleInstanceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RoleInstanceId{} - - 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.CloudServiceName, ok = parsed.Parsed["cloudServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", *parsed) - } - - if id.RoleInstanceName, ok = parsed.Parsed["roleInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleInstanceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRoleInstanceIDInsensitively(input string) (*RoleInstanceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RoleInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RoleInstanceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CloudServiceName, ok = parsed.Parsed["cloudServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", *parsed) + if id.CloudServiceName, ok = input.Parsed["cloudServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", input) } - if id.RoleInstanceName, ok = parsed.Parsed["roleInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleInstanceName", *parsed) + if id.RoleInstanceName, ok = input.Parsed["roleInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "roleInstanceName", input) } - return &id, nil + return nil } // ValidateRoleInstanceID checks that 'input' can be parsed as a Role Instance ID diff --git a/resource-manager/network/2023-06-01/networkinterfaces/id_roleinstancenetworkinterface.go b/resource-manager/network/2023-06-01/networkinterfaces/id_roleinstancenetworkinterface.go index b0f618d319e..39a088a38c0 100644 --- a/resource-manager/network/2023-06-01/networkinterfaces/id_roleinstancenetworkinterface.go +++ b/resource-manager/network/2023-06-01/networkinterfaces/id_roleinstancenetworkinterface.go @@ -40,27 +40,9 @@ func ParseRoleInstanceNetworkInterfaceID(input string) (*RoleInstanceNetworkInte return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RoleInstanceNetworkInterfaceId{} - - 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.CloudServiceName, ok = parsed.Parsed["cloudServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", *parsed) - } - - if id.RoleInstanceName, ok = parsed.Parsed["roleInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleInstanceName", *parsed) - } - - if id.NetworkInterfaceName, ok = parsed.Parsed["networkInterfaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkInterfaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseRoleInstanceNetworkInterfaceIDInsensitively(input string) (*RoleInstan return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RoleInstanceNetworkInterfaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RoleInstanceNetworkInterfaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CloudServiceName, ok = parsed.Parsed["cloudServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", *parsed) + if id.CloudServiceName, ok = input.Parsed["cloudServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", input) } - if id.RoleInstanceName, ok = parsed.Parsed["roleInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleInstanceName", *parsed) + if id.RoleInstanceName, ok = input.Parsed["roleInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "roleInstanceName", input) } - if id.NetworkInterfaceName, ok = parsed.Parsed["networkInterfaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkInterfaceName", *parsed) + if id.NetworkInterfaceName, ok = input.Parsed["networkInterfaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkInterfaceName", input) } - return &id, nil + return nil } // ValidateRoleInstanceNetworkInterfaceID checks that 'input' can be parsed as a Role Instance Network Interface ID diff --git a/resource-manager/network/2023-06-01/networkinterfaces/id_tapconfiguration.go b/resource-manager/network/2023-06-01/networkinterfaces/id_tapconfiguration.go index c7879c40c1f..846e65a80a8 100644 --- a/resource-manager/network/2023-06-01/networkinterfaces/id_tapconfiguration.go +++ b/resource-manager/network/2023-06-01/networkinterfaces/id_tapconfiguration.go @@ -38,23 +38,9 @@ func ParseTapConfigurationID(input string) (*TapConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TapConfigurationId{} - - 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.NetworkInterfaceName, ok = parsed.Parsed["networkInterfaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkInterfaceName", *parsed) - } - - if id.TapConfigurationName, ok = parsed.Parsed["tapConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tapConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTapConfigurationIDInsensitively(input string) (*TapConfigurationId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TapConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TapConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkInterfaceName, ok = parsed.Parsed["networkInterfaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkInterfaceName", *parsed) + if id.NetworkInterfaceName, ok = input.Parsed["networkInterfaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkInterfaceName", input) } - if id.TapConfigurationName, ok = parsed.Parsed["tapConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tapConfigurationName", *parsed) + if id.TapConfigurationName, ok = input.Parsed["tapConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tapConfigurationName", input) } - return &id, nil + return nil } // ValidateTapConfigurationID checks that 'input' can be parsed as a Tap Configuration ID diff --git a/resource-manager/network/2023-06-01/networkinterfaces/id_virtualmachine.go b/resource-manager/network/2023-06-01/networkinterfaces/id_virtualmachine.go index c0c1dd29a1b..263ea367221 100644 --- a/resource-manager/network/2023-06-01/networkinterfaces/id_virtualmachine.go +++ b/resource-manager/network/2023-06-01/networkinterfaces/id_virtualmachine.go @@ -38,23 +38,9 @@ func ParseVirtualMachineID(input string) (*VirtualMachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) - } - - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualMachineIDInsensitively(input string) (*VirtualMachineId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - return &id, nil + return nil } // ValidateVirtualMachineID checks that 'input' can be parsed as a Virtual Machine ID diff --git a/resource-manager/network/2023-06-01/networkinterfaces/id_virtualmachinescaleset.go b/resource-manager/network/2023-06-01/networkinterfaces/id_virtualmachinescaleset.go index 8435bb247a2..04a66737ce3 100644 --- a/resource-manager/network/2023-06-01/networkinterfaces/id_virtualmachinescaleset.go +++ b/resource-manager/network/2023-06-01/networkinterfaces/id_virtualmachinescaleset.go @@ -36,19 +36,9 @@ func ParseVirtualMachineScaleSetID(input string) (*VirtualMachineScaleSetId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineScaleSetIDInsensitively(input string) (*VirtualMachineSc return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineScaleSetId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - return &id, nil + return nil } // ValidateVirtualMachineScaleSetID checks that 'input' can be parsed as a Virtual Machine Scale Set ID diff --git a/resource-manager/network/2023-06-01/networkmanageractiveconfigurations/id_networkmanager.go b/resource-manager/network/2023-06-01/networkmanageractiveconfigurations/id_networkmanager.go index eb40c45d568..1188c8c4e05 100644 --- a/resource-manager/network/2023-06-01/networkmanageractiveconfigurations/id_networkmanager.go +++ b/resource-manager/network/2023-06-01/networkmanageractiveconfigurations/id_networkmanager.go @@ -36,19 +36,9 @@ func ParseNetworkManagerID(input string) (*NetworkManagerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkManagerId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkManagerIDInsensitively(input string) (*NetworkManagerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkManagerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkManagerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - return &id, nil + return nil } // ValidateNetworkManagerID checks that 'input' can be parsed as a Network Manager ID diff --git a/resource-manager/network/2023-06-01/networkmanageractiveconnectivityconfigurations/id_networkmanager.go b/resource-manager/network/2023-06-01/networkmanageractiveconnectivityconfigurations/id_networkmanager.go index 6f686aaaba2..1bda39b2b1e 100644 --- a/resource-manager/network/2023-06-01/networkmanageractiveconnectivityconfigurations/id_networkmanager.go +++ b/resource-manager/network/2023-06-01/networkmanageractiveconnectivityconfigurations/id_networkmanager.go @@ -36,19 +36,9 @@ func ParseNetworkManagerID(input string) (*NetworkManagerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkManagerId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkManagerIDInsensitively(input string) (*NetworkManagerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkManagerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkManagerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - return &id, nil + return nil } // ValidateNetworkManagerID checks that 'input' can be parsed as a Network Manager ID diff --git a/resource-manager/network/2023-06-01/networkmanagerconnections/id_networkmanagerconnection.go b/resource-manager/network/2023-06-01/networkmanagerconnections/id_networkmanagerconnection.go index 257d0dbb580..0cee14099cf 100644 --- a/resource-manager/network/2023-06-01/networkmanagerconnections/id_networkmanagerconnection.go +++ b/resource-manager/network/2023-06-01/networkmanagerconnections/id_networkmanagerconnection.go @@ -34,15 +34,9 @@ func ParseNetworkManagerConnectionID(input string) (*NetworkManagerConnectionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkManagerConnectionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.NetworkManagerConnectionName, ok = parsed.Parsed["networkManagerConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseNetworkManagerConnectionIDInsensitively(input string) (*NetworkManager return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkManagerConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *NetworkManagerConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.NetworkManagerConnectionName, ok = parsed.Parsed["networkManagerConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerConnectionName", *parsed) + if id.NetworkManagerConnectionName, ok = input.Parsed["networkManagerConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerConnectionName", input) } - return &id, nil + return nil } // ValidateNetworkManagerConnectionID checks that 'input' can be parsed as a Network Manager Connection ID diff --git a/resource-manager/network/2023-06-01/networkmanagerconnections/id_providers2networkmanagerconnection.go b/resource-manager/network/2023-06-01/networkmanagerconnections/id_providers2networkmanagerconnection.go index eb0ead3de30..a6fa4fd9225 100644 --- a/resource-manager/network/2023-06-01/networkmanagerconnections/id_providers2networkmanagerconnection.go +++ b/resource-manager/network/2023-06-01/networkmanagerconnections/id_providers2networkmanagerconnection.go @@ -34,15 +34,9 @@ func ParseProviders2NetworkManagerConnectionID(input string) (*Providers2Network return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2NetworkManagerConnectionId{} - - if id.ManagementGroupId, ok = parsed.Parsed["managementGroupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managementGroupId", *parsed) - } - - if id.NetworkManagerConnectionName, ok = parsed.Parsed["networkManagerConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviders2NetworkManagerConnectionIDInsensitively(input string) (*Prov return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2NetworkManagerConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ManagementGroupId, ok = parsed.Parsed["managementGroupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managementGroupId", *parsed) + return &id, nil +} + +func (id *Providers2NetworkManagerConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ManagementGroupId, ok = input.Parsed["managementGroupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managementGroupId", input) } - if id.NetworkManagerConnectionName, ok = parsed.Parsed["networkManagerConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerConnectionName", *parsed) + if id.NetworkManagerConnectionName, ok = input.Parsed["networkManagerConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerConnectionName", input) } - return &id, nil + return nil } // ValidateProviders2NetworkManagerConnectionID checks that 'input' can be parsed as a Providers 2 Network Manager Connection ID diff --git a/resource-manager/network/2023-06-01/networkmanagers/id_networkmanager.go b/resource-manager/network/2023-06-01/networkmanagers/id_networkmanager.go index fa90a755a35..6ab905990a9 100644 --- a/resource-manager/network/2023-06-01/networkmanagers/id_networkmanager.go +++ b/resource-manager/network/2023-06-01/networkmanagers/id_networkmanager.go @@ -36,19 +36,9 @@ func ParseNetworkManagerID(input string) (*NetworkManagerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkManagerId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkManagerIDInsensitively(input string) (*NetworkManagerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkManagerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkManagerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - return &id, nil + return nil } // ValidateNetworkManagerID checks that 'input' can be parsed as a Network Manager ID diff --git a/resource-manager/network/2023-06-01/networkprofiles/id_networkprofile.go b/resource-manager/network/2023-06-01/networkprofiles/id_networkprofile.go index 0cacfb77d6a..75ac2822b5d 100644 --- a/resource-manager/network/2023-06-01/networkprofiles/id_networkprofile.go +++ b/resource-manager/network/2023-06-01/networkprofiles/id_networkprofile.go @@ -36,19 +36,9 @@ func ParseNetworkProfileID(input string) (*NetworkProfileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkProfileId{} - - 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.NetworkProfileName, ok = parsed.Parsed["networkProfileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkProfileName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkProfileIDInsensitively(input string) (*NetworkProfileId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkProfileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkProfileId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkProfileName, ok = parsed.Parsed["networkProfileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkProfileName", *parsed) + if id.NetworkProfileName, ok = input.Parsed["networkProfileName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkProfileName", input) } - return &id, nil + return nil } // ValidateNetworkProfileID checks that 'input' can be parsed as a Network Profile ID diff --git a/resource-manager/network/2023-06-01/networksecuritygroups/id_networksecuritygroup.go b/resource-manager/network/2023-06-01/networksecuritygroups/id_networksecuritygroup.go index 976358d972c..4714b6b6f8b 100644 --- a/resource-manager/network/2023-06-01/networksecuritygroups/id_networksecuritygroup.go +++ b/resource-manager/network/2023-06-01/networksecuritygroups/id_networksecuritygroup.go @@ -36,19 +36,9 @@ func ParseNetworkSecurityGroupID(input string) (*NetworkSecurityGroupId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkSecurityGroupId{} - - 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.NetworkSecurityGroupName, ok = parsed.Parsed["networkSecurityGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkSecurityGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkSecurityGroupIDInsensitively(input string) (*NetworkSecurityGro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkSecurityGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkSecurityGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkSecurityGroupName, ok = parsed.Parsed["networkSecurityGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkSecurityGroupName", *parsed) + if id.NetworkSecurityGroupName, ok = input.Parsed["networkSecurityGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkSecurityGroupName", input) } - return &id, nil + return nil } // ValidateNetworkSecurityGroupID checks that 'input' can be parsed as a Network Security Group ID diff --git a/resource-manager/network/2023-06-01/networkvirtualappliances/id_inboundsecurityrule.go b/resource-manager/network/2023-06-01/networkvirtualappliances/id_inboundsecurityrule.go index 57ed3f89cae..55aff9179bf 100644 --- a/resource-manager/network/2023-06-01/networkvirtualappliances/id_inboundsecurityrule.go +++ b/resource-manager/network/2023-06-01/networkvirtualappliances/id_inboundsecurityrule.go @@ -38,23 +38,9 @@ func ParseInboundSecurityRuleID(input string) (*InboundSecurityRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InboundSecurityRuleId{} - - 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.NetworkVirtualApplianceName, ok = parsed.Parsed["networkVirtualApplianceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceName", *parsed) - } - - if id.InboundSecurityRuleName, ok = parsed.Parsed["inboundSecurityRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "inboundSecurityRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseInboundSecurityRuleIDInsensitively(input string) (*InboundSecurityRule return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InboundSecurityRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *InboundSecurityRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkVirtualApplianceName, ok = parsed.Parsed["networkVirtualApplianceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceName", *parsed) + if id.NetworkVirtualApplianceName, ok = input.Parsed["networkVirtualApplianceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceName", input) } - if id.InboundSecurityRuleName, ok = parsed.Parsed["inboundSecurityRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "inboundSecurityRuleName", *parsed) + if id.InboundSecurityRuleName, ok = input.Parsed["inboundSecurityRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "inboundSecurityRuleName", input) } - return &id, nil + return nil } // ValidateInboundSecurityRuleID checks that 'input' can be parsed as a Inbound Security Rule ID diff --git a/resource-manager/network/2023-06-01/networkvirtualappliances/id_networkvirtualappliance.go b/resource-manager/network/2023-06-01/networkvirtualappliances/id_networkvirtualappliance.go index c4feaf36235..58a3908e643 100644 --- a/resource-manager/network/2023-06-01/networkvirtualappliances/id_networkvirtualappliance.go +++ b/resource-manager/network/2023-06-01/networkvirtualappliances/id_networkvirtualappliance.go @@ -36,19 +36,9 @@ func ParseNetworkVirtualApplianceID(input string) (*NetworkVirtualApplianceId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkVirtualApplianceId{} - - 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.NetworkVirtualApplianceName, ok = parsed.Parsed["networkVirtualApplianceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkVirtualApplianceIDInsensitively(input string) (*NetworkVirtualA return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkVirtualApplianceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkVirtualApplianceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkVirtualApplianceName, ok = parsed.Parsed["networkVirtualApplianceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceName", *parsed) + if id.NetworkVirtualApplianceName, ok = input.Parsed["networkVirtualApplianceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceName", input) } - return &id, nil + return nil } // ValidateNetworkVirtualApplianceID checks that 'input' can be parsed as a Network Virtual Appliance ID diff --git a/resource-manager/network/2023-06-01/networkwatchers/id_networkwatcher.go b/resource-manager/network/2023-06-01/networkwatchers/id_networkwatcher.go index 2cb57313a16..88102cbe0ba 100644 --- a/resource-manager/network/2023-06-01/networkwatchers/id_networkwatcher.go +++ b/resource-manager/network/2023-06-01/networkwatchers/id_networkwatcher.go @@ -36,19 +36,9 @@ func ParseNetworkWatcherID(input string) (*NetworkWatcherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkWatcherId{} - - 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.NetworkWatcherName, ok = parsed.Parsed["networkWatcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkWatcherIDInsensitively(input string) (*NetworkWatcherId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkWatcherId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkWatcherId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkWatcherName, ok = parsed.Parsed["networkWatcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", *parsed) + if id.NetworkWatcherName, ok = input.Parsed["networkWatcherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", input) } - return &id, nil + return nil } // ValidateNetworkWatcherID checks that 'input' can be parsed as a Network Watcher ID diff --git a/resource-manager/network/2023-06-01/packetcaptures/id_networkwatcher.go b/resource-manager/network/2023-06-01/packetcaptures/id_networkwatcher.go index b5478e241e2..05a87434be6 100644 --- a/resource-manager/network/2023-06-01/packetcaptures/id_networkwatcher.go +++ b/resource-manager/network/2023-06-01/packetcaptures/id_networkwatcher.go @@ -36,19 +36,9 @@ func ParseNetworkWatcherID(input string) (*NetworkWatcherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkWatcherId{} - - 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.NetworkWatcherName, ok = parsed.Parsed["networkWatcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkWatcherIDInsensitively(input string) (*NetworkWatcherId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkWatcherId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkWatcherId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkWatcherName, ok = parsed.Parsed["networkWatcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", *parsed) + if id.NetworkWatcherName, ok = input.Parsed["networkWatcherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", input) } - return &id, nil + return nil } // ValidateNetworkWatcherID checks that 'input' can be parsed as a Network Watcher ID diff --git a/resource-manager/network/2023-06-01/packetcaptures/id_packetcapture.go b/resource-manager/network/2023-06-01/packetcaptures/id_packetcapture.go index 57e35d5f1f2..e56233f86a2 100644 --- a/resource-manager/network/2023-06-01/packetcaptures/id_packetcapture.go +++ b/resource-manager/network/2023-06-01/packetcaptures/id_packetcapture.go @@ -38,23 +38,9 @@ func ParsePacketCaptureID(input string) (*PacketCaptureId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCaptureId{} - - 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.NetworkWatcherName, ok = parsed.Parsed["networkWatcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", *parsed) - } - - if id.PacketCaptureName, ok = parsed.Parsed["packetCaptureName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCaptureName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePacketCaptureIDInsensitively(input string) (*PacketCaptureId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PacketCaptureId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PacketCaptureId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkWatcherName, ok = parsed.Parsed["networkWatcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", *parsed) + if id.NetworkWatcherName, ok = input.Parsed["networkWatcherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", input) } - if id.PacketCaptureName, ok = parsed.Parsed["packetCaptureName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "packetCaptureName", *parsed) + if id.PacketCaptureName, ok = input.Parsed["packetCaptureName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "packetCaptureName", input) } - return &id, nil + return nil } // ValidatePacketCaptureID checks that 'input' can be parsed as a Packet Capture ID diff --git a/resource-manager/network/2023-06-01/peerexpressroutecircuitconnections/id_peerconnection.go b/resource-manager/network/2023-06-01/peerexpressroutecircuitconnections/id_peerconnection.go index 9e974b3fad5..13e4d8f3184 100644 --- a/resource-manager/network/2023-06-01/peerexpressroutecircuitconnections/id_peerconnection.go +++ b/resource-manager/network/2023-06-01/peerexpressroutecircuitconnections/id_peerconnection.go @@ -40,27 +40,9 @@ func ParsePeerConnectionID(input string) (*PeerConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PeerConnectionId{} - - 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.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) - } - - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) - } - - if id.PeerConnectionName, ok = parsed.Parsed["peerConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peerConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParsePeerConnectionIDInsensitively(input string) (*PeerConnectionId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PeerConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *PeerConnectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ExpressRouteCircuitName, ok = parsed.Parsed["expressRouteCircuitName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", *parsed) + if id.ExpressRouteCircuitName, ok = input.Parsed["expressRouteCircuitName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "expressRouteCircuitName", input) } - if id.PeeringName, ok = parsed.Parsed["peeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peeringName", *parsed) + if id.PeeringName, ok = input.Parsed["peeringName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "peeringName", input) } - if id.PeerConnectionName, ok = parsed.Parsed["peerConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "peerConnectionName", *parsed) + if id.PeerConnectionName, ok = input.Parsed["peerConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "peerConnectionName", input) } - return &id, nil + return nil } // ValidatePeerConnectionID checks that 'input' can be parsed as a Peer Connection ID diff --git a/resource-manager/network/2023-06-01/privatednszonegroups/id_privatednszonegroup.go b/resource-manager/network/2023-06-01/privatednszonegroups/id_privatednszonegroup.go index 532e498e159..c4cd41f32d5 100644 --- a/resource-manager/network/2023-06-01/privatednszonegroups/id_privatednszonegroup.go +++ b/resource-manager/network/2023-06-01/privatednszonegroups/id_privatednszonegroup.go @@ -38,23 +38,9 @@ func ParsePrivateDnsZoneGroupID(input string) (*PrivateDnsZoneGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateDnsZoneGroupId{} - - 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.PrivateEndpointName, ok = parsed.Parsed["privateEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointName", *parsed) - } - - if id.PrivateDnsZoneGroupName, ok = parsed.Parsed["privateDnsZoneGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateDnsZoneGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateDnsZoneGroupIDInsensitively(input string) (*PrivateDnsZoneGroup return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateDnsZoneGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateDnsZoneGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateEndpointName, ok = parsed.Parsed["privateEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointName", *parsed) + if id.PrivateEndpointName, ok = input.Parsed["privateEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointName", input) } - if id.PrivateDnsZoneGroupName, ok = parsed.Parsed["privateDnsZoneGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateDnsZoneGroupName", *parsed) + if id.PrivateDnsZoneGroupName, ok = input.Parsed["privateDnsZoneGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateDnsZoneGroupName", input) } - return &id, nil + return nil } // ValidatePrivateDnsZoneGroupID checks that 'input' can be parsed as a Private Dns Zone Group ID diff --git a/resource-manager/network/2023-06-01/privatednszonegroups/id_privateendpoint.go b/resource-manager/network/2023-06-01/privatednszonegroups/id_privateendpoint.go index a547392c0f3..16a2e56d16c 100644 --- a/resource-manager/network/2023-06-01/privatednszonegroups/id_privateendpoint.go +++ b/resource-manager/network/2023-06-01/privatednszonegroups/id_privateendpoint.go @@ -36,19 +36,9 @@ func ParsePrivateEndpointID(input string) (*PrivateEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointId{} - - 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.PrivateEndpointName, ok = parsed.Parsed["privateEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePrivateEndpointIDInsensitively(input string) (*PrivateEndpointId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PrivateEndpointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateEndpointName, ok = parsed.Parsed["privateEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointName", *parsed) + if id.PrivateEndpointName, ok = input.Parsed["privateEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointID checks that 'input' can be parsed as a Private Endpoint ID diff --git a/resource-manager/network/2023-06-01/privateendpoints/id_location.go b/resource-manager/network/2023-06-01/privateendpoints/id_location.go index 146a6110738..f2d86134426 100644 --- a/resource-manager/network/2023-06-01/privateendpoints/id_location.go +++ b/resource-manager/network/2023-06-01/privateendpoints/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/network/2023-06-01/privateendpoints/id_privateendpoint.go b/resource-manager/network/2023-06-01/privateendpoints/id_privateendpoint.go index 219fe0f7906..2122ecbbc30 100644 --- a/resource-manager/network/2023-06-01/privateendpoints/id_privateendpoint.go +++ b/resource-manager/network/2023-06-01/privateendpoints/id_privateendpoint.go @@ -36,19 +36,9 @@ func ParsePrivateEndpointID(input string) (*PrivateEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointId{} - - 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.PrivateEndpointName, ok = parsed.Parsed["privateEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePrivateEndpointIDInsensitively(input string) (*PrivateEndpointId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PrivateEndpointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateEndpointName, ok = parsed.Parsed["privateEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointName", *parsed) + if id.PrivateEndpointName, ok = input.Parsed["privateEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointID checks that 'input' can be parsed as a Private Endpoint ID diff --git a/resource-manager/network/2023-06-01/privateendpoints/id_providerlocation.go b/resource-manager/network/2023-06-01/privateendpoints/id_providerlocation.go index bdc082c0530..e412f544122 100644 --- a/resource-manager/network/2023-06-01/privateendpoints/id_providerlocation.go +++ b/resource-manager/network/2023-06-01/privateendpoints/id_providerlocation.go @@ -36,19 +36,9 @@ func ParseProviderLocationID(input string) (*ProviderLocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderLocationIDInsensitively(input string) (*ProviderLocationId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderLocationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateProviderLocationID checks that 'input' can be parsed as a Provider Location ID diff --git a/resource-manager/network/2023-06-01/privatelinkservice/id_privatelinkservice.go b/resource-manager/network/2023-06-01/privatelinkservice/id_privatelinkservice.go index 1565b227dbd..8eae2881181 100644 --- a/resource-manager/network/2023-06-01/privatelinkservice/id_privatelinkservice.go +++ b/resource-manager/network/2023-06-01/privatelinkservice/id_privatelinkservice.go @@ -36,19 +36,9 @@ func ParsePrivateLinkServiceID(input string) (*PrivateLinkServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkServiceId{} - - 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.PrivateLinkServiceName, ok = parsed.Parsed["privateLinkServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePrivateLinkServiceIDInsensitively(input string) (*PrivateLinkServiceId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PrivateLinkServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateLinkServiceName, ok = parsed.Parsed["privateLinkServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkServiceName", *parsed) + if id.PrivateLinkServiceName, ok = input.Parsed["privateLinkServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkServiceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkServiceID checks that 'input' can be parsed as a Private Link Service ID diff --git a/resource-manager/network/2023-06-01/privatelinkservices/id_location.go b/resource-manager/network/2023-06-01/privatelinkservices/id_location.go index 24e86662059..95e950e7e64 100644 --- a/resource-manager/network/2023-06-01/privatelinkservices/id_location.go +++ b/resource-manager/network/2023-06-01/privatelinkservices/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/network/2023-06-01/privatelinkservices/id_privateendpointconnection.go b/resource-manager/network/2023-06-01/privatelinkservices/id_privateendpointconnection.go index d6a66965d1b..d9cd7306b2c 100644 --- a/resource-manager/network/2023-06-01/privatelinkservices/id_privateendpointconnection.go +++ b/resource-manager/network/2023-06-01/privatelinkservices/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.PrivateLinkServiceName, ok = parsed.Parsed["privateLinkServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkServiceName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateLinkServiceName, ok = parsed.Parsed["privateLinkServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkServiceName", *parsed) + if id.PrivateLinkServiceName, ok = input.Parsed["privateLinkServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkServiceName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/network/2023-06-01/privatelinkservices/id_privatelinkservice.go b/resource-manager/network/2023-06-01/privatelinkservices/id_privatelinkservice.go index 94f3432277b..45249de5a73 100644 --- a/resource-manager/network/2023-06-01/privatelinkservices/id_privatelinkservice.go +++ b/resource-manager/network/2023-06-01/privatelinkservices/id_privatelinkservice.go @@ -36,19 +36,9 @@ func ParsePrivateLinkServiceID(input string) (*PrivateLinkServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkServiceId{} - - 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.PrivateLinkServiceName, ok = parsed.Parsed["privateLinkServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePrivateLinkServiceIDInsensitively(input string) (*PrivateLinkServiceId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PrivateLinkServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateLinkServiceName, ok = parsed.Parsed["privateLinkServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkServiceName", *parsed) + if id.PrivateLinkServiceName, ok = input.Parsed["privateLinkServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkServiceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkServiceID checks that 'input' can be parsed as a Private Link Service ID diff --git a/resource-manager/network/2023-06-01/privatelinkservices/id_providerlocation.go b/resource-manager/network/2023-06-01/privatelinkservices/id_providerlocation.go index 2b075dec749..16521a221cb 100644 --- a/resource-manager/network/2023-06-01/privatelinkservices/id_providerlocation.go +++ b/resource-manager/network/2023-06-01/privatelinkservices/id_providerlocation.go @@ -36,19 +36,9 @@ func ParseProviderLocationID(input string) (*ProviderLocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderLocationIDInsensitively(input string) (*ProviderLocationId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderLocationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateProviderLocationID checks that 'input' can be parsed as a Provider Location ID diff --git a/resource-manager/network/2023-06-01/publicipprefixes/id_publicipprefix.go b/resource-manager/network/2023-06-01/publicipprefixes/id_publicipprefix.go index 545d5140e51..8a54fd6b51e 100644 --- a/resource-manager/network/2023-06-01/publicipprefixes/id_publicipprefix.go +++ b/resource-manager/network/2023-06-01/publicipprefixes/id_publicipprefix.go @@ -36,19 +36,9 @@ func ParsePublicIPPrefixID(input string) (*PublicIPPrefixId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PublicIPPrefixId{} - - 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.PublicIPPrefixName, ok = parsed.Parsed["publicIPPrefixName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publicIPPrefixName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePublicIPPrefixIDInsensitively(input string) (*PublicIPPrefixId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PublicIPPrefixId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PublicIPPrefixId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PublicIPPrefixName, ok = parsed.Parsed["publicIPPrefixName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publicIPPrefixName", *parsed) + if id.PublicIPPrefixName, ok = input.Parsed["publicIPPrefixName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publicIPPrefixName", input) } - return &id, nil + return nil } // ValidatePublicIPPrefixID checks that 'input' can be parsed as a Public I P Prefix ID diff --git a/resource-manager/network/2023-06-01/routefilterrules/id_routefilter.go b/resource-manager/network/2023-06-01/routefilterrules/id_routefilter.go index 6ada8a037fc..20669cb3c9f 100644 --- a/resource-manager/network/2023-06-01/routefilterrules/id_routefilter.go +++ b/resource-manager/network/2023-06-01/routefilterrules/id_routefilter.go @@ -36,19 +36,9 @@ func ParseRouteFilterID(input string) (*RouteFilterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteFilterId{} - - 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.RouteFilterName, ok = parsed.Parsed["routeFilterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeFilterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRouteFilterIDInsensitively(input string) (*RouteFilterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteFilterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RouteFilterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RouteFilterName, ok = parsed.Parsed["routeFilterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeFilterName", *parsed) + if id.RouteFilterName, ok = input.Parsed["routeFilterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routeFilterName", input) } - return &id, nil + return nil } // ValidateRouteFilterID checks that 'input' can be parsed as a Route Filter ID diff --git a/resource-manager/network/2023-06-01/routefilterrules/id_routefilterrule.go b/resource-manager/network/2023-06-01/routefilterrules/id_routefilterrule.go index e4cf470acdc..fffc56ea557 100644 --- a/resource-manager/network/2023-06-01/routefilterrules/id_routefilterrule.go +++ b/resource-manager/network/2023-06-01/routefilterrules/id_routefilterrule.go @@ -38,23 +38,9 @@ func ParseRouteFilterRuleID(input string) (*RouteFilterRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteFilterRuleId{} - - 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.RouteFilterName, ok = parsed.Parsed["routeFilterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeFilterName", *parsed) - } - - if id.RouteFilterRuleName, ok = parsed.Parsed["routeFilterRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeFilterRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRouteFilterRuleIDInsensitively(input string) (*RouteFilterRuleId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteFilterRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RouteFilterRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RouteFilterName, ok = parsed.Parsed["routeFilterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeFilterName", *parsed) + if id.RouteFilterName, ok = input.Parsed["routeFilterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routeFilterName", input) } - if id.RouteFilterRuleName, ok = parsed.Parsed["routeFilterRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeFilterRuleName", *parsed) + if id.RouteFilterRuleName, ok = input.Parsed["routeFilterRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routeFilterRuleName", input) } - return &id, nil + return nil } // ValidateRouteFilterRuleID checks that 'input' can be parsed as a Route Filter Rule ID diff --git a/resource-manager/network/2023-06-01/routefilters/id_routefilter.go b/resource-manager/network/2023-06-01/routefilters/id_routefilter.go index 0d539e18cc3..4104bf0d154 100644 --- a/resource-manager/network/2023-06-01/routefilters/id_routefilter.go +++ b/resource-manager/network/2023-06-01/routefilters/id_routefilter.go @@ -36,19 +36,9 @@ func ParseRouteFilterID(input string) (*RouteFilterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteFilterId{} - - 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.RouteFilterName, ok = parsed.Parsed["routeFilterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeFilterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRouteFilterIDInsensitively(input string) (*RouteFilterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteFilterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RouteFilterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RouteFilterName, ok = parsed.Parsed["routeFilterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeFilterName", *parsed) + if id.RouteFilterName, ok = input.Parsed["routeFilterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routeFilterName", input) } - return &id, nil + return nil } // ValidateRouteFilterID checks that 'input' can be parsed as a Route Filter ID diff --git a/resource-manager/network/2023-06-01/routes/id_route.go b/resource-manager/network/2023-06-01/routes/id_route.go index f2bbb0efdb5..aa8060fb8f7 100644 --- a/resource-manager/network/2023-06-01/routes/id_route.go +++ b/resource-manager/network/2023-06-01/routes/id_route.go @@ -38,23 +38,9 @@ func ParseRouteID(input string) (*RouteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteId{} - - 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.RouteTableName, ok = parsed.Parsed["routeTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", *parsed) - } - - if id.RouteName, ok = parsed.Parsed["routeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRouteIDInsensitively(input string) (*RouteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RouteId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RouteTableName, ok = parsed.Parsed["routeTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", *parsed) + if id.RouteTableName, ok = input.Parsed["routeTableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", input) } - if id.RouteName, ok = parsed.Parsed["routeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeName", *parsed) + if id.RouteName, ok = input.Parsed["routeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routeName", input) } - return &id, nil + return nil } // ValidateRouteID checks that 'input' can be parsed as a Route ID diff --git a/resource-manager/network/2023-06-01/routes/id_routetable.go b/resource-manager/network/2023-06-01/routes/id_routetable.go index c8aadc85160..2aaab7c00d7 100644 --- a/resource-manager/network/2023-06-01/routes/id_routetable.go +++ b/resource-manager/network/2023-06-01/routes/id_routetable.go @@ -36,19 +36,9 @@ func ParseRouteTableID(input string) (*RouteTableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteTableId{} - - 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.RouteTableName, ok = parsed.Parsed["routeTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRouteTableIDInsensitively(input string) (*RouteTableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteTableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RouteTableId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RouteTableName, ok = parsed.Parsed["routeTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", *parsed) + if id.RouteTableName, ok = input.Parsed["routeTableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", input) } - return &id, nil + return nil } // ValidateRouteTableID checks that 'input' can be parsed as a Route Table ID diff --git a/resource-manager/network/2023-06-01/routetables/id_routetable.go b/resource-manager/network/2023-06-01/routetables/id_routetable.go index 15838ef16b1..8fe456d11cd 100644 --- a/resource-manager/network/2023-06-01/routetables/id_routetable.go +++ b/resource-manager/network/2023-06-01/routetables/id_routetable.go @@ -36,19 +36,9 @@ func ParseRouteTableID(input string) (*RouteTableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteTableId{} - - 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.RouteTableName, ok = parsed.Parsed["routeTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRouteTableIDInsensitively(input string) (*RouteTableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteTableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RouteTableId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RouteTableName, ok = parsed.Parsed["routeTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", *parsed) + if id.RouteTableName, ok = input.Parsed["routeTableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", input) } - return &id, nil + return nil } // ValidateRouteTableID checks that 'input' can be parsed as a Route Table ID diff --git a/resource-manager/network/2023-06-01/scopeconnections/id_networkmanager.go b/resource-manager/network/2023-06-01/scopeconnections/id_networkmanager.go index 8e518126e3d..168e6173785 100644 --- a/resource-manager/network/2023-06-01/scopeconnections/id_networkmanager.go +++ b/resource-manager/network/2023-06-01/scopeconnections/id_networkmanager.go @@ -36,19 +36,9 @@ func ParseNetworkManagerID(input string) (*NetworkManagerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkManagerId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkManagerIDInsensitively(input string) (*NetworkManagerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkManagerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkManagerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - return &id, nil + return nil } // ValidateNetworkManagerID checks that 'input' can be parsed as a Network Manager ID diff --git a/resource-manager/network/2023-06-01/scopeconnections/id_scopeconnection.go b/resource-manager/network/2023-06-01/scopeconnections/id_scopeconnection.go index dbc1fb7a7a7..bafad6ca7ab 100644 --- a/resource-manager/network/2023-06-01/scopeconnections/id_scopeconnection.go +++ b/resource-manager/network/2023-06-01/scopeconnections/id_scopeconnection.go @@ -38,23 +38,9 @@ func ParseScopeConnectionID(input string) (*ScopeConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopeConnectionId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) - } - - if id.ScopeConnectionName, ok = parsed.Parsed["scopeConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scopeConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseScopeConnectionIDInsensitively(input string) (*ScopeConnectionId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopeConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ScopeConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - if id.ScopeConnectionName, ok = parsed.Parsed["scopeConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scopeConnectionName", *parsed) + if id.ScopeConnectionName, ok = input.Parsed["scopeConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scopeConnectionName", input) } - return &id, nil + return nil } // ValidateScopeConnectionID checks that 'input' can be parsed as a Scope Connection ID diff --git a/resource-manager/network/2023-06-01/securityadminconfigurations/id_networkmanager.go b/resource-manager/network/2023-06-01/securityadminconfigurations/id_networkmanager.go index aec8d0fdd53..89b28c6005a 100644 --- a/resource-manager/network/2023-06-01/securityadminconfigurations/id_networkmanager.go +++ b/resource-manager/network/2023-06-01/securityadminconfigurations/id_networkmanager.go @@ -36,19 +36,9 @@ func ParseNetworkManagerID(input string) (*NetworkManagerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkManagerId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkManagerIDInsensitively(input string) (*NetworkManagerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkManagerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkManagerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - return &id, nil + return nil } // ValidateNetworkManagerID checks that 'input' can be parsed as a Network Manager ID diff --git a/resource-manager/network/2023-06-01/securityadminconfigurations/id_securityadminconfiguration.go b/resource-manager/network/2023-06-01/securityadminconfigurations/id_securityadminconfiguration.go index 3c2a8543126..5876385de21 100644 --- a/resource-manager/network/2023-06-01/securityadminconfigurations/id_securityadminconfiguration.go +++ b/resource-manager/network/2023-06-01/securityadminconfigurations/id_securityadminconfiguration.go @@ -38,23 +38,9 @@ func ParseSecurityAdminConfigurationID(input string) (*SecurityAdminConfiguratio return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecurityAdminConfigurationId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) - } - - if id.SecurityAdminConfigurationName, ok = parsed.Parsed["securityAdminConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityAdminConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSecurityAdminConfigurationIDInsensitively(input string) (*SecurityAdmi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecurityAdminConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SecurityAdminConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - if id.SecurityAdminConfigurationName, ok = parsed.Parsed["securityAdminConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityAdminConfigurationName", *parsed) + if id.SecurityAdminConfigurationName, ok = input.Parsed["securityAdminConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "securityAdminConfigurationName", input) } - return &id, nil + return nil } // ValidateSecurityAdminConfigurationID checks that 'input' can be parsed as a Security Admin Configuration ID diff --git a/resource-manager/network/2023-06-01/securitypartnerproviders/id_securitypartnerprovider.go b/resource-manager/network/2023-06-01/securitypartnerproviders/id_securitypartnerprovider.go index 3ebe53eb67a..91f369b0d33 100644 --- a/resource-manager/network/2023-06-01/securitypartnerproviders/id_securitypartnerprovider.go +++ b/resource-manager/network/2023-06-01/securitypartnerproviders/id_securitypartnerprovider.go @@ -36,19 +36,9 @@ func ParseSecurityPartnerProviderID(input string) (*SecurityPartnerProviderId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecurityPartnerProviderId{} - - 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.SecurityPartnerProviderName, ok = parsed.Parsed["securityPartnerProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityPartnerProviderName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSecurityPartnerProviderIDInsensitively(input string) (*SecurityPartner return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecurityPartnerProviderId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SecurityPartnerProviderId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SecurityPartnerProviderName, ok = parsed.Parsed["securityPartnerProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityPartnerProviderName", *parsed) + if id.SecurityPartnerProviderName, ok = input.Parsed["securityPartnerProviderName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "securityPartnerProviderName", input) } - return &id, nil + return nil } // ValidateSecurityPartnerProviderID checks that 'input' can be parsed as a Security Partner Provider ID diff --git a/resource-manager/network/2023-06-01/securityrules/id_defaultsecurityrule.go b/resource-manager/network/2023-06-01/securityrules/id_defaultsecurityrule.go index e4a89e02f98..6c7a0c23433 100644 --- a/resource-manager/network/2023-06-01/securityrules/id_defaultsecurityrule.go +++ b/resource-manager/network/2023-06-01/securityrules/id_defaultsecurityrule.go @@ -38,23 +38,9 @@ func ParseDefaultSecurityRuleID(input string) (*DefaultSecurityRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DefaultSecurityRuleId{} - - 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.NetworkSecurityGroupName, ok = parsed.Parsed["networkSecurityGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkSecurityGroupName", *parsed) - } - - if id.DefaultSecurityRuleName, ok = parsed.Parsed["defaultSecurityRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "defaultSecurityRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDefaultSecurityRuleIDInsensitively(input string) (*DefaultSecurityRule return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DefaultSecurityRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DefaultSecurityRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkSecurityGroupName, ok = parsed.Parsed["networkSecurityGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkSecurityGroupName", *parsed) + if id.NetworkSecurityGroupName, ok = input.Parsed["networkSecurityGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkSecurityGroupName", input) } - if id.DefaultSecurityRuleName, ok = parsed.Parsed["defaultSecurityRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "defaultSecurityRuleName", *parsed) + if id.DefaultSecurityRuleName, ok = input.Parsed["defaultSecurityRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "defaultSecurityRuleName", input) } - return &id, nil + return nil } // ValidateDefaultSecurityRuleID checks that 'input' can be parsed as a Default Security Rule ID diff --git a/resource-manager/network/2023-06-01/securityrules/id_networksecuritygroup.go b/resource-manager/network/2023-06-01/securityrules/id_networksecuritygroup.go index 07dda76386b..2a508ada09a 100644 --- a/resource-manager/network/2023-06-01/securityrules/id_networksecuritygroup.go +++ b/resource-manager/network/2023-06-01/securityrules/id_networksecuritygroup.go @@ -36,19 +36,9 @@ func ParseNetworkSecurityGroupID(input string) (*NetworkSecurityGroupId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkSecurityGroupId{} - - 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.NetworkSecurityGroupName, ok = parsed.Parsed["networkSecurityGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkSecurityGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkSecurityGroupIDInsensitively(input string) (*NetworkSecurityGro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkSecurityGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkSecurityGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkSecurityGroupName, ok = parsed.Parsed["networkSecurityGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkSecurityGroupName", *parsed) + if id.NetworkSecurityGroupName, ok = input.Parsed["networkSecurityGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkSecurityGroupName", input) } - return &id, nil + return nil } // ValidateNetworkSecurityGroupID checks that 'input' can be parsed as a Network Security Group ID diff --git a/resource-manager/network/2023-06-01/securityrules/id_securityrule.go b/resource-manager/network/2023-06-01/securityrules/id_securityrule.go index 32ca98be479..3c3391537ed 100644 --- a/resource-manager/network/2023-06-01/securityrules/id_securityrule.go +++ b/resource-manager/network/2023-06-01/securityrules/id_securityrule.go @@ -38,23 +38,9 @@ func ParseSecurityRuleID(input string) (*SecurityRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecurityRuleId{} - - 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.NetworkSecurityGroupName, ok = parsed.Parsed["networkSecurityGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkSecurityGroupName", *parsed) - } - - if id.SecurityRuleName, ok = parsed.Parsed["securityRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSecurityRuleIDInsensitively(input string) (*SecurityRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecurityRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SecurityRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkSecurityGroupName, ok = parsed.Parsed["networkSecurityGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkSecurityGroupName", *parsed) + if id.NetworkSecurityGroupName, ok = input.Parsed["networkSecurityGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkSecurityGroupName", input) } - if id.SecurityRuleName, ok = parsed.Parsed["securityRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityRuleName", *parsed) + if id.SecurityRuleName, ok = input.Parsed["securityRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "securityRuleName", input) } - return &id, nil + return nil } // ValidateSecurityRuleID checks that 'input' can be parsed as a Security Rule ID diff --git a/resource-manager/network/2023-06-01/serviceendpointpolicies/id_serviceendpointpolicy.go b/resource-manager/network/2023-06-01/serviceendpointpolicies/id_serviceendpointpolicy.go index 1df0f6e4676..2b791b53a7e 100644 --- a/resource-manager/network/2023-06-01/serviceendpointpolicies/id_serviceendpointpolicy.go +++ b/resource-manager/network/2023-06-01/serviceendpointpolicies/id_serviceendpointpolicy.go @@ -36,19 +36,9 @@ func ParseServiceEndpointPolicyID(input string) (*ServiceEndpointPolicyId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceEndpointPolicyId{} - - 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.ServiceEndpointPolicyName, ok = parsed.Parsed["serviceEndpointPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceEndpointPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceEndpointPolicyIDInsensitively(input string) (*ServiceEndpointPo return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceEndpointPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceEndpointPolicyId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceEndpointPolicyName, ok = parsed.Parsed["serviceEndpointPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceEndpointPolicyName", *parsed) + if id.ServiceEndpointPolicyName, ok = input.Parsed["serviceEndpointPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceEndpointPolicyName", input) } - return &id, nil + return nil } // ValidateServiceEndpointPolicyID checks that 'input' can be parsed as a Service Endpoint Policy ID diff --git a/resource-manager/network/2023-06-01/serviceendpointpolicydefinitions/id_serviceendpointpolicy.go b/resource-manager/network/2023-06-01/serviceendpointpolicydefinitions/id_serviceendpointpolicy.go index 979cf4f022e..83015de951d 100644 --- a/resource-manager/network/2023-06-01/serviceendpointpolicydefinitions/id_serviceendpointpolicy.go +++ b/resource-manager/network/2023-06-01/serviceendpointpolicydefinitions/id_serviceendpointpolicy.go @@ -36,19 +36,9 @@ func ParseServiceEndpointPolicyID(input string) (*ServiceEndpointPolicyId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceEndpointPolicyId{} - - 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.ServiceEndpointPolicyName, ok = parsed.Parsed["serviceEndpointPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceEndpointPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceEndpointPolicyIDInsensitively(input string) (*ServiceEndpointPo return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceEndpointPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceEndpointPolicyId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceEndpointPolicyName, ok = parsed.Parsed["serviceEndpointPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceEndpointPolicyName", *parsed) + if id.ServiceEndpointPolicyName, ok = input.Parsed["serviceEndpointPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceEndpointPolicyName", input) } - return &id, nil + return nil } // ValidateServiceEndpointPolicyID checks that 'input' can be parsed as a Service Endpoint Policy ID diff --git a/resource-manager/network/2023-06-01/serviceendpointpolicydefinitions/id_serviceendpointpolicydefinition.go b/resource-manager/network/2023-06-01/serviceendpointpolicydefinitions/id_serviceendpointpolicydefinition.go index f8fabb5925a..f64efcf7090 100644 --- a/resource-manager/network/2023-06-01/serviceendpointpolicydefinitions/id_serviceendpointpolicydefinition.go +++ b/resource-manager/network/2023-06-01/serviceendpointpolicydefinitions/id_serviceendpointpolicydefinition.go @@ -38,23 +38,9 @@ func ParseServiceEndpointPolicyDefinitionID(input string) (*ServiceEndpointPolic return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceEndpointPolicyDefinitionId{} - - 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.ServiceEndpointPolicyName, ok = parsed.Parsed["serviceEndpointPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceEndpointPolicyName", *parsed) - } - - if id.ServiceEndpointPolicyDefinitionName, ok = parsed.Parsed["serviceEndpointPolicyDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceEndpointPolicyDefinitionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseServiceEndpointPolicyDefinitionIDInsensitively(input string) (*Service return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceEndpointPolicyDefinitionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ServiceEndpointPolicyDefinitionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceEndpointPolicyName, ok = parsed.Parsed["serviceEndpointPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceEndpointPolicyName", *parsed) + if id.ServiceEndpointPolicyName, ok = input.Parsed["serviceEndpointPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceEndpointPolicyName", input) } - if id.ServiceEndpointPolicyDefinitionName, ok = parsed.Parsed["serviceEndpointPolicyDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceEndpointPolicyDefinitionName", *parsed) + if id.ServiceEndpointPolicyDefinitionName, ok = input.Parsed["serviceEndpointPolicyDefinitionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceEndpointPolicyDefinitionName", input) } - return &id, nil + return nil } // ValidateServiceEndpointPolicyDefinitionID checks that 'input' can be parsed as a Service Endpoint Policy Definition ID diff --git a/resource-manager/network/2023-06-01/servicetags/id_location.go b/resource-manager/network/2023-06-01/servicetags/id_location.go index 2d8a29c22d9..768bb04fc55 100644 --- a/resource-manager/network/2023-06-01/servicetags/id_location.go +++ b/resource-manager/network/2023-06-01/servicetags/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/network/2023-06-01/staticmembers/id_networkgroup.go b/resource-manager/network/2023-06-01/staticmembers/id_networkgroup.go index 67b3fd5daf1..85f6e10e5ea 100644 --- a/resource-manager/network/2023-06-01/staticmembers/id_networkgroup.go +++ b/resource-manager/network/2023-06-01/staticmembers/id_networkgroup.go @@ -38,23 +38,9 @@ func ParseNetworkGroupID(input string) (*NetworkGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkGroupId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) - } - - if id.NetworkGroupName, ok = parsed.Parsed["networkGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseNetworkGroupIDInsensitively(input string) (*NetworkGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *NetworkGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - if id.NetworkGroupName, ok = parsed.Parsed["networkGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkGroupName", *parsed) + if id.NetworkGroupName, ok = input.Parsed["networkGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkGroupName", input) } - return &id, nil + return nil } // ValidateNetworkGroupID checks that 'input' can be parsed as a Network Group ID diff --git a/resource-manager/network/2023-06-01/staticmembers/id_staticmember.go b/resource-manager/network/2023-06-01/staticmembers/id_staticmember.go index c42f4e8bd27..92cd458d75c 100644 --- a/resource-manager/network/2023-06-01/staticmembers/id_staticmember.go +++ b/resource-manager/network/2023-06-01/staticmembers/id_staticmember.go @@ -40,27 +40,9 @@ func ParseStaticMemberID(input string) (*StaticMemberId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StaticMemberId{} - - 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.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) - } - - if id.NetworkGroupName, ok = parsed.Parsed["networkGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkGroupName", *parsed) - } - - if id.StaticMemberName, ok = parsed.Parsed["staticMemberName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticMemberName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseStaticMemberIDInsensitively(input string) (*StaticMemberId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StaticMemberId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *StaticMemberId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkManagerName, ok = parsed.Parsed["networkManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", *parsed) + if id.NetworkManagerName, ok = input.Parsed["networkManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkManagerName", input) } - if id.NetworkGroupName, ok = parsed.Parsed["networkGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkGroupName", *parsed) + if id.NetworkGroupName, ok = input.Parsed["networkGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkGroupName", input) } - if id.StaticMemberName, ok = parsed.Parsed["staticMemberName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticMemberName", *parsed) + if id.StaticMemberName, ok = input.Parsed["staticMemberName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "staticMemberName", input) } - return &id, nil + return nil } // ValidateStaticMemberID checks that 'input' can be parsed as a Static Member ID diff --git a/resource-manager/network/2023-06-01/trafficanalytics/id_networkwatcher.go b/resource-manager/network/2023-06-01/trafficanalytics/id_networkwatcher.go index 28df98e2c49..cf23d7e1b6b 100644 --- a/resource-manager/network/2023-06-01/trafficanalytics/id_networkwatcher.go +++ b/resource-manager/network/2023-06-01/trafficanalytics/id_networkwatcher.go @@ -36,19 +36,9 @@ func ParseNetworkWatcherID(input string) (*NetworkWatcherId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkWatcherId{} - - 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.NetworkWatcherName, ok = parsed.Parsed["networkWatcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkWatcherIDInsensitively(input string) (*NetworkWatcherId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkWatcherId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkWatcherId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkWatcherName, ok = parsed.Parsed["networkWatcherName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", *parsed) + if id.NetworkWatcherName, ok = input.Parsed["networkWatcherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkWatcherName", input) } - return &id, nil + return nil } // ValidateNetworkWatcherID checks that 'input' can be parsed as a Network Watcher ID diff --git a/resource-manager/network/2023-06-01/usages/id_location.go b/resource-manager/network/2023-06-01/usages/id_location.go index ef70b32225b..0ea1a3015ad 100644 --- a/resource-manager/network/2023-06-01/usages/id_location.go +++ b/resource-manager/network/2023-06-01/usages/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/network/2023-06-01/vipswap/id_cloudservice.go b/resource-manager/network/2023-06-01/vipswap/id_cloudservice.go index 9544661fbc5..aab8095b940 100644 --- a/resource-manager/network/2023-06-01/vipswap/id_cloudservice.go +++ b/resource-manager/network/2023-06-01/vipswap/id_cloudservice.go @@ -36,19 +36,9 @@ func ParseCloudServiceID(input string) (*CloudServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CloudServiceId{} - - 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.CloudServiceName, ok = parsed.Parsed["cloudServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseCloudServiceIDInsensitively(input string) (*CloudServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CloudServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CloudServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CloudServiceName, ok = parsed.Parsed["cloudServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", *parsed) + if id.CloudServiceName, ok = input.Parsed["cloudServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cloudServiceName", input) } - return &id, nil + return nil } // ValidateCloudServiceID checks that 'input' can be parsed as a Cloud Service ID diff --git a/resource-manager/network/2023-06-01/virtualappliancesites/id_networkvirtualappliance.go b/resource-manager/network/2023-06-01/virtualappliancesites/id_networkvirtualappliance.go index 2ae3ddeb528..3a98094ce5f 100644 --- a/resource-manager/network/2023-06-01/virtualappliancesites/id_networkvirtualappliance.go +++ b/resource-manager/network/2023-06-01/virtualappliancesites/id_networkvirtualappliance.go @@ -36,19 +36,9 @@ func ParseNetworkVirtualApplianceID(input string) (*NetworkVirtualApplianceId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkVirtualApplianceId{} - - 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.NetworkVirtualApplianceName, ok = parsed.Parsed["networkVirtualApplianceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkVirtualApplianceIDInsensitively(input string) (*NetworkVirtualA return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkVirtualApplianceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkVirtualApplianceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkVirtualApplianceName, ok = parsed.Parsed["networkVirtualApplianceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceName", *parsed) + if id.NetworkVirtualApplianceName, ok = input.Parsed["networkVirtualApplianceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceName", input) } - return &id, nil + return nil } // ValidateNetworkVirtualApplianceID checks that 'input' can be parsed as a Network Virtual Appliance ID diff --git a/resource-manager/network/2023-06-01/virtualappliancesites/id_virtualappliancesite.go b/resource-manager/network/2023-06-01/virtualappliancesites/id_virtualappliancesite.go index 62bcc9817bf..64fcaa60c67 100644 --- a/resource-manager/network/2023-06-01/virtualappliancesites/id_virtualappliancesite.go +++ b/resource-manager/network/2023-06-01/virtualappliancesites/id_virtualappliancesite.go @@ -38,23 +38,9 @@ func ParseVirtualApplianceSiteID(input string) (*VirtualApplianceSiteId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualApplianceSiteId{} - - 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.NetworkVirtualApplianceName, ok = parsed.Parsed["networkVirtualApplianceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceName", *parsed) - } - - if id.VirtualApplianceSiteName, ok = parsed.Parsed["virtualApplianceSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualApplianceSiteName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualApplianceSiteIDInsensitively(input string) (*VirtualApplianceSi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualApplianceSiteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualApplianceSiteId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkVirtualApplianceName, ok = parsed.Parsed["networkVirtualApplianceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceName", *parsed) + if id.NetworkVirtualApplianceName, ok = input.Parsed["networkVirtualApplianceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceName", input) } - if id.VirtualApplianceSiteName, ok = parsed.Parsed["virtualApplianceSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualApplianceSiteName", *parsed) + if id.VirtualApplianceSiteName, ok = input.Parsed["virtualApplianceSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualApplianceSiteName", input) } - return &id, nil + return nil } // ValidateVirtualApplianceSiteID checks that 'input' can be parsed as a Virtual Appliance Site ID diff --git a/resource-manager/network/2023-06-01/virtualapplianceskus/id_networkvirtualappliancesku.go b/resource-manager/network/2023-06-01/virtualapplianceskus/id_networkvirtualappliancesku.go index 7558f22904e..9a208383365 100644 --- a/resource-manager/network/2023-06-01/virtualapplianceskus/id_networkvirtualappliancesku.go +++ b/resource-manager/network/2023-06-01/virtualapplianceskus/id_networkvirtualappliancesku.go @@ -34,15 +34,9 @@ func ParseNetworkVirtualApplianceSkuID(input string) (*NetworkVirtualApplianceSk return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkVirtualApplianceSkuId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.NetworkVirtualApplianceSkuName, ok = parsed.Parsed["networkVirtualApplianceSkuName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceSkuName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseNetworkVirtualApplianceSkuIDInsensitively(input string) (*NetworkVirtu return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkVirtualApplianceSkuId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *NetworkVirtualApplianceSkuId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.NetworkVirtualApplianceSkuName, ok = parsed.Parsed["networkVirtualApplianceSkuName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceSkuName", *parsed) + if id.NetworkVirtualApplianceSkuName, ok = input.Parsed["networkVirtualApplianceSkuName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceSkuName", input) } - return &id, nil + return nil } // ValidateNetworkVirtualApplianceSkuID checks that 'input' can be parsed as a Network Virtual Appliance Sku ID diff --git a/resource-manager/network/2023-06-01/virtualnetworkgatewayconnections/id_connection.go b/resource-manager/network/2023-06-01/virtualnetworkgatewayconnections/id_connection.go index 20cd2e94077..d894548ccde 100644 --- a/resource-manager/network/2023-06-01/virtualnetworkgatewayconnections/id_connection.go +++ b/resource-manager/network/2023-06-01/virtualnetworkgatewayconnections/id_connection.go @@ -36,19 +36,9 @@ func ParseConnectionID(input string) (*ConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionId{} - - 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.ConnectionName, ok = parsed.Parsed["connectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseConnectionIDInsensitively(input string) (*ConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ConnectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ConnectionName, ok = parsed.Parsed["connectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionName", *parsed) + if id.ConnectionName, ok = input.Parsed["connectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectionName", input) } - return &id, nil + return nil } // ValidateConnectionID checks that 'input' can be parsed as a Connection ID diff --git a/resource-manager/network/2023-06-01/virtualnetworkgateways/id_connection.go b/resource-manager/network/2023-06-01/virtualnetworkgateways/id_connection.go index 0474f12724b..bdc065e680c 100644 --- a/resource-manager/network/2023-06-01/virtualnetworkgateways/id_connection.go +++ b/resource-manager/network/2023-06-01/virtualnetworkgateways/id_connection.go @@ -36,19 +36,9 @@ func ParseConnectionID(input string) (*ConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionId{} - - 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.ConnectionName, ok = parsed.Parsed["connectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseConnectionIDInsensitively(input string) (*ConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ConnectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ConnectionName, ok = parsed.Parsed["connectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionName", *parsed) + if id.ConnectionName, ok = input.Parsed["connectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectionName", input) } - return &id, nil + return nil } // ValidateConnectionID checks that 'input' can be parsed as a Connection ID diff --git a/resource-manager/network/2023-06-01/virtualnetworkgateways/id_virtualnetworkgateway.go b/resource-manager/network/2023-06-01/virtualnetworkgateways/id_virtualnetworkgateway.go index f405ee0a07d..30e96c0b114 100644 --- a/resource-manager/network/2023-06-01/virtualnetworkgateways/id_virtualnetworkgateway.go +++ b/resource-manager/network/2023-06-01/virtualnetworkgateways/id_virtualnetworkgateway.go @@ -36,19 +36,9 @@ func ParseVirtualNetworkGatewayID(input string) (*VirtualNetworkGatewayId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkGatewayId{} - - 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.VirtualNetworkGatewayName, ok = parsed.Parsed["virtualNetworkGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkGatewayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualNetworkGatewayIDInsensitively(input string) (*VirtualNetworkGat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkGatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualNetworkGatewayId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualNetworkGatewayName, ok = parsed.Parsed["virtualNetworkGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkGatewayName", *parsed) + if id.VirtualNetworkGatewayName, ok = input.Parsed["virtualNetworkGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkGatewayName", input) } - return &id, nil + return nil } // ValidateVirtualNetworkGatewayID checks that 'input' can be parsed as a Virtual Network Gateway ID diff --git a/resource-manager/network/2023-06-01/virtualnetworkgateways/id_virtualnetworkgatewaynatrule.go b/resource-manager/network/2023-06-01/virtualnetworkgateways/id_virtualnetworkgatewaynatrule.go index 76631d94563..d261f426c85 100644 --- a/resource-manager/network/2023-06-01/virtualnetworkgateways/id_virtualnetworkgatewaynatrule.go +++ b/resource-manager/network/2023-06-01/virtualnetworkgateways/id_virtualnetworkgatewaynatrule.go @@ -38,23 +38,9 @@ func ParseVirtualNetworkGatewayNatRuleID(input string) (*VirtualNetworkGatewayNa return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkGatewayNatRuleId{} - - 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.VirtualNetworkGatewayName, ok = parsed.Parsed["virtualNetworkGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkGatewayName", *parsed) - } - - if id.NatRuleName, ok = parsed.Parsed["natRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "natRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualNetworkGatewayNatRuleIDInsensitively(input string) (*VirtualNet return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkGatewayNatRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualNetworkGatewayNatRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualNetworkGatewayName, ok = parsed.Parsed["virtualNetworkGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkGatewayName", *parsed) + if id.VirtualNetworkGatewayName, ok = input.Parsed["virtualNetworkGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkGatewayName", input) } - if id.NatRuleName, ok = parsed.Parsed["natRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "natRuleName", *parsed) + if id.NatRuleName, ok = input.Parsed["natRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "natRuleName", input) } - return &id, nil + return nil } // ValidateVirtualNetworkGatewayNatRuleID checks that 'input' can be parsed as a Virtual Network Gateway Nat Rule ID diff --git a/resource-manager/network/2023-06-01/virtualnetworkpeerings/id_virtualnetworkpeering.go b/resource-manager/network/2023-06-01/virtualnetworkpeerings/id_virtualnetworkpeering.go index aaaf017cf07..de01f35aeb8 100644 --- a/resource-manager/network/2023-06-01/virtualnetworkpeerings/id_virtualnetworkpeering.go +++ b/resource-manager/network/2023-06-01/virtualnetworkpeerings/id_virtualnetworkpeering.go @@ -38,23 +38,9 @@ func ParseVirtualNetworkPeeringID(input string) (*VirtualNetworkPeeringId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkPeeringId{} - - 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.VirtualNetworkName, ok = parsed.Parsed["virtualNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkName", *parsed) - } - - if id.VirtualNetworkPeeringName, ok = parsed.Parsed["virtualNetworkPeeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkPeeringName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualNetworkPeeringIDInsensitively(input string) (*VirtualNetworkPee return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkPeeringId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualNetworkPeeringId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualNetworkName, ok = parsed.Parsed["virtualNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkName", *parsed) + if id.VirtualNetworkName, ok = input.Parsed["virtualNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkName", input) } - if id.VirtualNetworkPeeringName, ok = parsed.Parsed["virtualNetworkPeeringName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkPeeringName", *parsed) + if id.VirtualNetworkPeeringName, ok = input.Parsed["virtualNetworkPeeringName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkPeeringName", input) } - return &id, nil + return nil } // ValidateVirtualNetworkPeeringID checks that 'input' can be parsed as a Virtual Network Peering ID diff --git a/resource-manager/network/2023-06-01/virtualnetworktap/id_virtualnetworktap.go b/resource-manager/network/2023-06-01/virtualnetworktap/id_virtualnetworktap.go index 7e7e843e4d1..1264701d515 100644 --- a/resource-manager/network/2023-06-01/virtualnetworktap/id_virtualnetworktap.go +++ b/resource-manager/network/2023-06-01/virtualnetworktap/id_virtualnetworktap.go @@ -36,19 +36,9 @@ func ParseVirtualNetworkTapID(input string) (*VirtualNetworkTapId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkTapId{} - - 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.VirtualNetworkTapName, ok = parsed.Parsed["virtualNetworkTapName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkTapName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualNetworkTapIDInsensitively(input string) (*VirtualNetworkTapId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkTapId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualNetworkTapId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualNetworkTapName, ok = parsed.Parsed["virtualNetworkTapName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkTapName", *parsed) + if id.VirtualNetworkTapName, ok = input.Parsed["virtualNetworkTapName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkTapName", input) } - return &id, nil + return nil } // ValidateVirtualNetworkTapID checks that 'input' can be parsed as a Virtual Network Tap ID diff --git a/resource-manager/network/2023-06-01/virtualrouterpeerings/id_virtualrouter.go b/resource-manager/network/2023-06-01/virtualrouterpeerings/id_virtualrouter.go index 885ce3a276a..0cfcf59d124 100644 --- a/resource-manager/network/2023-06-01/virtualrouterpeerings/id_virtualrouter.go +++ b/resource-manager/network/2023-06-01/virtualrouterpeerings/id_virtualrouter.go @@ -36,19 +36,9 @@ func ParseVirtualRouterID(input string) (*VirtualRouterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualRouterId{} - - 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.VirtualRouterName, ok = parsed.Parsed["virtualRouterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualRouterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualRouterIDInsensitively(input string) (*VirtualRouterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualRouterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualRouterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualRouterName, ok = parsed.Parsed["virtualRouterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualRouterName", *parsed) + if id.VirtualRouterName, ok = input.Parsed["virtualRouterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualRouterName", input) } - return &id, nil + return nil } // ValidateVirtualRouterID checks that 'input' can be parsed as a Virtual Router ID diff --git a/resource-manager/network/2023-06-01/virtualrouters/id_virtualrouter.go b/resource-manager/network/2023-06-01/virtualrouters/id_virtualrouter.go index ecb01bd99e5..5832396424b 100644 --- a/resource-manager/network/2023-06-01/virtualrouters/id_virtualrouter.go +++ b/resource-manager/network/2023-06-01/virtualrouters/id_virtualrouter.go @@ -36,19 +36,9 @@ func ParseVirtualRouterID(input string) (*VirtualRouterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualRouterId{} - - 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.VirtualRouterName, ok = parsed.Parsed["virtualRouterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualRouterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualRouterIDInsensitively(input string) (*VirtualRouterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualRouterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualRouterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualRouterName, ok = parsed.Parsed["virtualRouterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualRouterName", *parsed) + if id.VirtualRouterName, ok = input.Parsed["virtualRouterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualRouterName", input) } - return &id, nil + return nil } // ValidateVirtualRouterID checks that 'input' can be parsed as a Virtual Router ID diff --git a/resource-manager/network/2023-06-01/virtualwans/id_configurationpolicygroup.go b/resource-manager/network/2023-06-01/virtualwans/id_configurationpolicygroup.go index d6c7f2eaff8..dff384d30ca 100644 --- a/resource-manager/network/2023-06-01/virtualwans/id_configurationpolicygroup.go +++ b/resource-manager/network/2023-06-01/virtualwans/id_configurationpolicygroup.go @@ -38,23 +38,9 @@ func ParseConfigurationPolicyGroupID(input string) (*ConfigurationPolicyGroupId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationPolicyGroupId{} - - 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.VpnServerConfigurationName, ok = parsed.Parsed["vpnServerConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnServerConfigurationName", *parsed) - } - - if id.ConfigurationPolicyGroupName, ok = parsed.Parsed["configurationPolicyGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationPolicyGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConfigurationPolicyGroupIDInsensitively(input string) (*ConfigurationP return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationPolicyGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConfigurationPolicyGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VpnServerConfigurationName, ok = parsed.Parsed["vpnServerConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnServerConfigurationName", *parsed) + if id.VpnServerConfigurationName, ok = input.Parsed["vpnServerConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vpnServerConfigurationName", input) } - if id.ConfigurationPolicyGroupName, ok = parsed.Parsed["configurationPolicyGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationPolicyGroupName", *parsed) + if id.ConfigurationPolicyGroupName, ok = input.Parsed["configurationPolicyGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationPolicyGroupName", input) } - return &id, nil + return nil } // ValidateConfigurationPolicyGroupID checks that 'input' can be parsed as a Configuration Policy Group ID diff --git a/resource-manager/network/2023-06-01/virtualwans/id_hubroutetable.go b/resource-manager/network/2023-06-01/virtualwans/id_hubroutetable.go index 0297471a681..72310881bba 100644 --- a/resource-manager/network/2023-06-01/virtualwans/id_hubroutetable.go +++ b/resource-manager/network/2023-06-01/virtualwans/id_hubroutetable.go @@ -38,23 +38,9 @@ func ParseHubRouteTableID(input string) (*HubRouteTableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HubRouteTableId{} - - 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.VirtualHubName, ok = parsed.Parsed["virtualHubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", *parsed) - } - - if id.HubRouteTableName, ok = parsed.Parsed["hubRouteTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hubRouteTableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseHubRouteTableIDInsensitively(input string) (*HubRouteTableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HubRouteTableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *HubRouteTableId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualHubName, ok = parsed.Parsed["virtualHubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", *parsed) + if id.VirtualHubName, ok = input.Parsed["virtualHubName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", input) } - if id.HubRouteTableName, ok = parsed.Parsed["hubRouteTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hubRouteTableName", *parsed) + if id.HubRouteTableName, ok = input.Parsed["hubRouteTableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hubRouteTableName", input) } - return &id, nil + return nil } // ValidateHubRouteTableID checks that 'input' can be parsed as a Hub Route Table ID diff --git a/resource-manager/network/2023-06-01/virtualwans/id_hubvirtualnetworkconnection.go b/resource-manager/network/2023-06-01/virtualwans/id_hubvirtualnetworkconnection.go index e5bc46da4b4..116cf5cd477 100644 --- a/resource-manager/network/2023-06-01/virtualwans/id_hubvirtualnetworkconnection.go +++ b/resource-manager/network/2023-06-01/virtualwans/id_hubvirtualnetworkconnection.go @@ -38,23 +38,9 @@ func ParseHubVirtualNetworkConnectionID(input string) (*HubVirtualNetworkConnect return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HubVirtualNetworkConnectionId{} - - 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.VirtualHubName, ok = parsed.Parsed["virtualHubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", *parsed) - } - - if id.HubVirtualNetworkConnectionName, ok = parsed.Parsed["hubVirtualNetworkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hubVirtualNetworkConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseHubVirtualNetworkConnectionIDInsensitively(input string) (*HubVirtualN return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HubVirtualNetworkConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *HubVirtualNetworkConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualHubName, ok = parsed.Parsed["virtualHubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", *parsed) + if id.VirtualHubName, ok = input.Parsed["virtualHubName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", input) } - if id.HubVirtualNetworkConnectionName, ok = parsed.Parsed["hubVirtualNetworkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hubVirtualNetworkConnectionName", *parsed) + if id.HubVirtualNetworkConnectionName, ok = input.Parsed["hubVirtualNetworkConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hubVirtualNetworkConnectionName", input) } - return &id, nil + return nil } // ValidateHubVirtualNetworkConnectionID checks that 'input' can be parsed as a Hub Virtual Network Connection ID diff --git a/resource-manager/network/2023-06-01/virtualwans/id_natrule.go b/resource-manager/network/2023-06-01/virtualwans/id_natrule.go index 2563c42130d..93cab37e7c6 100644 --- a/resource-manager/network/2023-06-01/virtualwans/id_natrule.go +++ b/resource-manager/network/2023-06-01/virtualwans/id_natrule.go @@ -38,23 +38,9 @@ func ParseNatRuleID(input string) (*NatRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NatRuleId{} - - 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.VpnGatewayName, ok = parsed.Parsed["vpnGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnGatewayName", *parsed) - } - - if id.NatRuleName, ok = parsed.Parsed["natRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "natRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseNatRuleIDInsensitively(input string) (*NatRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NatRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *NatRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VpnGatewayName, ok = parsed.Parsed["vpnGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnGatewayName", *parsed) + if id.VpnGatewayName, ok = input.Parsed["vpnGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vpnGatewayName", input) } - if id.NatRuleName, ok = parsed.Parsed["natRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "natRuleName", *parsed) + if id.NatRuleName, ok = input.Parsed["natRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "natRuleName", input) } - return &id, nil + return nil } // ValidateNatRuleID checks that 'input' can be parsed as a Nat Rule ID diff --git a/resource-manager/network/2023-06-01/virtualwans/id_networkvirtualappliance.go b/resource-manager/network/2023-06-01/virtualwans/id_networkvirtualappliance.go index 4f44479d9b9..a0e0ef31796 100644 --- a/resource-manager/network/2023-06-01/virtualwans/id_networkvirtualappliance.go +++ b/resource-manager/network/2023-06-01/virtualwans/id_networkvirtualappliance.go @@ -36,19 +36,9 @@ func ParseNetworkVirtualApplianceID(input string) (*NetworkVirtualApplianceId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkVirtualApplianceId{} - - 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.NetworkVirtualApplianceName, ok = parsed.Parsed["networkVirtualApplianceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNetworkVirtualApplianceIDInsensitively(input string) (*NetworkVirtualA return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkVirtualApplianceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NetworkVirtualApplianceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkVirtualApplianceName, ok = parsed.Parsed["networkVirtualApplianceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceName", *parsed) + if id.NetworkVirtualApplianceName, ok = input.Parsed["networkVirtualApplianceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceName", input) } - return &id, nil + return nil } // ValidateNetworkVirtualApplianceID checks that 'input' can be parsed as a Network Virtual Appliance ID diff --git a/resource-manager/network/2023-06-01/virtualwans/id_networkvirtualapplianceconnection.go b/resource-manager/network/2023-06-01/virtualwans/id_networkvirtualapplianceconnection.go index 13800d99e63..de54637c1bc 100644 --- a/resource-manager/network/2023-06-01/virtualwans/id_networkvirtualapplianceconnection.go +++ b/resource-manager/network/2023-06-01/virtualwans/id_networkvirtualapplianceconnection.go @@ -38,23 +38,9 @@ func ParseNetworkVirtualApplianceConnectionID(input string) (*NetworkVirtualAppl return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkVirtualApplianceConnectionId{} - - 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.NetworkVirtualApplianceName, ok = parsed.Parsed["networkVirtualApplianceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceName", *parsed) - } - - if id.NetworkVirtualApplianceConnectionName, ok = parsed.Parsed["networkVirtualApplianceConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseNetworkVirtualApplianceConnectionIDInsensitively(input string) (*Netwo return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkVirtualApplianceConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *NetworkVirtualApplianceConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NetworkVirtualApplianceName, ok = parsed.Parsed["networkVirtualApplianceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceName", *parsed) + if id.NetworkVirtualApplianceName, ok = input.Parsed["networkVirtualApplianceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceName", input) } - if id.NetworkVirtualApplianceConnectionName, ok = parsed.Parsed["networkVirtualApplianceConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceConnectionName", *parsed) + if id.NetworkVirtualApplianceConnectionName, ok = input.Parsed["networkVirtualApplianceConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkVirtualApplianceConnectionName", input) } - return &id, nil + return nil } // ValidateNetworkVirtualApplianceConnectionID checks that 'input' can be parsed as a Network Virtual Appliance Connection ID diff --git a/resource-manager/network/2023-06-01/virtualwans/id_routemap.go b/resource-manager/network/2023-06-01/virtualwans/id_routemap.go index a7eb1850cb8..ff3a75a5126 100644 --- a/resource-manager/network/2023-06-01/virtualwans/id_routemap.go +++ b/resource-manager/network/2023-06-01/virtualwans/id_routemap.go @@ -38,23 +38,9 @@ func ParseRouteMapID(input string) (*RouteMapId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteMapId{} - - 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.VirtualHubName, ok = parsed.Parsed["virtualHubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", *parsed) - } - - if id.RouteMapName, ok = parsed.Parsed["routeMapName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeMapName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRouteMapIDInsensitively(input string) (*RouteMapId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteMapId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RouteMapId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualHubName, ok = parsed.Parsed["virtualHubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", *parsed) + if id.VirtualHubName, ok = input.Parsed["virtualHubName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", input) } - if id.RouteMapName, ok = parsed.Parsed["routeMapName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeMapName", *parsed) + if id.RouteMapName, ok = input.Parsed["routeMapName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routeMapName", input) } - return &id, nil + return nil } // ValidateRouteMapID checks that 'input' can be parsed as a Route Map ID diff --git a/resource-manager/network/2023-06-01/virtualwans/id_routingintent.go b/resource-manager/network/2023-06-01/virtualwans/id_routingintent.go index 9a8b1a5cc31..dbc58606bae 100644 --- a/resource-manager/network/2023-06-01/virtualwans/id_routingintent.go +++ b/resource-manager/network/2023-06-01/virtualwans/id_routingintent.go @@ -38,23 +38,9 @@ func ParseRoutingIntentID(input string) (*RoutingIntentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RoutingIntentId{} - - 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.VirtualHubName, ok = parsed.Parsed["virtualHubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", *parsed) - } - - if id.RoutingIntentName, ok = parsed.Parsed["routingIntentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routingIntentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRoutingIntentIDInsensitively(input string) (*RoutingIntentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RoutingIntentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RoutingIntentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualHubName, ok = parsed.Parsed["virtualHubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", *parsed) + if id.VirtualHubName, ok = input.Parsed["virtualHubName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", input) } - if id.RoutingIntentName, ok = parsed.Parsed["routingIntentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routingIntentName", *parsed) + if id.RoutingIntentName, ok = input.Parsed["routingIntentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routingIntentName", input) } - return &id, nil + return nil } // ValidateRoutingIntentID checks that 'input' can be parsed as a Routing Intent ID diff --git a/resource-manager/network/2023-06-01/virtualwans/id_virtualhub.go b/resource-manager/network/2023-06-01/virtualwans/id_virtualhub.go index 3f42afd7fc5..7b6723ff9e3 100644 --- a/resource-manager/network/2023-06-01/virtualwans/id_virtualhub.go +++ b/resource-manager/network/2023-06-01/virtualwans/id_virtualhub.go @@ -36,19 +36,9 @@ func ParseVirtualHubID(input string) (*VirtualHubId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualHubId{} - - 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.VirtualHubName, ok = parsed.Parsed["virtualHubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualHubIDInsensitively(input string) (*VirtualHubId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualHubId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualHubId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualHubName, ok = parsed.Parsed["virtualHubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", *parsed) + if id.VirtualHubName, ok = input.Parsed["virtualHubName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", input) } - return &id, nil + return nil } // ValidateVirtualHubID checks that 'input' can be parsed as a Virtual Hub ID diff --git a/resource-manager/network/2023-06-01/virtualwans/id_virtualhubroutetable.go b/resource-manager/network/2023-06-01/virtualwans/id_virtualhubroutetable.go index ccb706e1460..c62be8a98a8 100644 --- a/resource-manager/network/2023-06-01/virtualwans/id_virtualhubroutetable.go +++ b/resource-manager/network/2023-06-01/virtualwans/id_virtualhubroutetable.go @@ -38,23 +38,9 @@ func ParseVirtualHubRouteTableID(input string) (*VirtualHubRouteTableId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualHubRouteTableId{} - - 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.VirtualHubName, ok = parsed.Parsed["virtualHubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", *parsed) - } - - if id.RouteTableName, ok = parsed.Parsed["routeTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualHubRouteTableIDInsensitively(input string) (*VirtualHubRouteTab return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualHubRouteTableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualHubRouteTableId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualHubName, ok = parsed.Parsed["virtualHubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", *parsed) + if id.VirtualHubName, ok = input.Parsed["virtualHubName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualHubName", input) } - if id.RouteTableName, ok = parsed.Parsed["routeTableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", *parsed) + if id.RouteTableName, ok = input.Parsed["routeTableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routeTableName", input) } - return &id, nil + return nil } // ValidateVirtualHubRouteTableID checks that 'input' can be parsed as a Virtual Hub Route Table ID diff --git a/resource-manager/network/2023-06-01/virtualwans/id_virtualwan.go b/resource-manager/network/2023-06-01/virtualwans/id_virtualwan.go index 590264a9ee1..db457c86102 100644 --- a/resource-manager/network/2023-06-01/virtualwans/id_virtualwan.go +++ b/resource-manager/network/2023-06-01/virtualwans/id_virtualwan.go @@ -36,19 +36,9 @@ func ParseVirtualWANID(input string) (*VirtualWANId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualWANId{} - - 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.VirtualWanName, ok = parsed.Parsed["virtualWanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualWanName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualWANIDInsensitively(input string) (*VirtualWANId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualWANId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualWANId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualWanName, ok = parsed.Parsed["virtualWanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualWanName", *parsed) + if id.VirtualWanName, ok = input.Parsed["virtualWanName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualWanName", input) } - return &id, nil + return nil } // ValidateVirtualWANID checks that 'input' can be parsed as a Virtual W A N ID diff --git a/resource-manager/network/2023-06-01/virtualwans/id_vpngateway.go b/resource-manager/network/2023-06-01/virtualwans/id_vpngateway.go index a438d896289..cf7683ac9e3 100644 --- a/resource-manager/network/2023-06-01/virtualwans/id_vpngateway.go +++ b/resource-manager/network/2023-06-01/virtualwans/id_vpngateway.go @@ -36,19 +36,9 @@ func ParseVpnGatewayID(input string) (*VpnGatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnGatewayId{} - - 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.VpnGatewayName, ok = parsed.Parsed["vpnGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnGatewayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVpnGatewayIDInsensitively(input string) (*VpnGatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnGatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VpnGatewayId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VpnGatewayName, ok = parsed.Parsed["vpnGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnGatewayName", *parsed) + if id.VpnGatewayName, ok = input.Parsed["vpnGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vpnGatewayName", input) } - return &id, nil + return nil } // ValidateVpnGatewayID checks that 'input' can be parsed as a Vpn Gateway ID diff --git a/resource-manager/network/2023-06-01/virtualwans/id_vpnlinkconnection.go b/resource-manager/network/2023-06-01/virtualwans/id_vpnlinkconnection.go index f8c398dc7ac..dfeff21ccfc 100644 --- a/resource-manager/network/2023-06-01/virtualwans/id_vpnlinkconnection.go +++ b/resource-manager/network/2023-06-01/virtualwans/id_vpnlinkconnection.go @@ -40,27 +40,9 @@ func ParseVpnLinkConnectionID(input string) (*VpnLinkConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnLinkConnectionId{} - - 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.VpnGatewayName, ok = parsed.Parsed["vpnGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnGatewayName", *parsed) - } - - if id.VpnConnectionName, ok = parsed.Parsed["vpnConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnConnectionName", *parsed) - } - - if id.VpnLinkConnectionName, ok = parsed.Parsed["vpnLinkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnLinkConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVpnLinkConnectionIDInsensitively(input string) (*VpnLinkConnectionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnLinkConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VpnLinkConnectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VpnGatewayName, ok = parsed.Parsed["vpnGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnGatewayName", *parsed) + if id.VpnGatewayName, ok = input.Parsed["vpnGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vpnGatewayName", input) } - if id.VpnConnectionName, ok = parsed.Parsed["vpnConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnConnectionName", *parsed) + if id.VpnConnectionName, ok = input.Parsed["vpnConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vpnConnectionName", input) } - if id.VpnLinkConnectionName, ok = parsed.Parsed["vpnLinkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnLinkConnectionName", *parsed) + if id.VpnLinkConnectionName, ok = input.Parsed["vpnLinkConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vpnLinkConnectionName", input) } - return &id, nil + return nil } // ValidateVpnLinkConnectionID checks that 'input' can be parsed as a Vpn Link Connection ID diff --git a/resource-manager/network/2023-06-01/virtualwans/id_vpnserverconfiguration.go b/resource-manager/network/2023-06-01/virtualwans/id_vpnserverconfiguration.go index 194ee0e58a3..9bd02160920 100644 --- a/resource-manager/network/2023-06-01/virtualwans/id_vpnserverconfiguration.go +++ b/resource-manager/network/2023-06-01/virtualwans/id_vpnserverconfiguration.go @@ -36,19 +36,9 @@ func ParseVpnServerConfigurationID(input string) (*VpnServerConfigurationId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnServerConfigurationId{} - - 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.VpnServerConfigurationName, ok = parsed.Parsed["vpnServerConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnServerConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVpnServerConfigurationIDInsensitively(input string) (*VpnServerConfigu return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnServerConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VpnServerConfigurationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VpnServerConfigurationName, ok = parsed.Parsed["vpnServerConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnServerConfigurationName", *parsed) + if id.VpnServerConfigurationName, ok = input.Parsed["vpnServerConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vpnServerConfigurationName", input) } - return &id, nil + return nil } // ValidateVpnServerConfigurationID checks that 'input' can be parsed as a Vpn Server Configuration ID diff --git a/resource-manager/network/2023-06-01/virtualwans/id_vpnsite.go b/resource-manager/network/2023-06-01/virtualwans/id_vpnsite.go index d32b6f6dba4..4c1e5f7deec 100644 --- a/resource-manager/network/2023-06-01/virtualwans/id_vpnsite.go +++ b/resource-manager/network/2023-06-01/virtualwans/id_vpnsite.go @@ -36,19 +36,9 @@ func ParseVpnSiteID(input string) (*VpnSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnSiteId{} - - 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.VpnSiteName, ok = parsed.Parsed["vpnSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnSiteName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVpnSiteIDInsensitively(input string) (*VpnSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnSiteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VpnSiteId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VpnSiteName, ok = parsed.Parsed["vpnSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnSiteName", *parsed) + if id.VpnSiteName, ok = input.Parsed["vpnSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vpnSiteName", input) } - return &id, nil + return nil } // ValidateVpnSiteID checks that 'input' can be parsed as a Vpn Site ID diff --git a/resource-manager/network/2023-06-01/virtualwans/id_vpnsitelink.go b/resource-manager/network/2023-06-01/virtualwans/id_vpnsitelink.go index e43deb2be92..aebb2d3d5d6 100644 --- a/resource-manager/network/2023-06-01/virtualwans/id_vpnsitelink.go +++ b/resource-manager/network/2023-06-01/virtualwans/id_vpnsitelink.go @@ -38,23 +38,9 @@ func ParseVpnSiteLinkID(input string) (*VpnSiteLinkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnSiteLinkId{} - - 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.VpnSiteName, ok = parsed.Parsed["vpnSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnSiteName", *parsed) - } - - if id.VpnSiteLinkName, ok = parsed.Parsed["vpnSiteLinkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnSiteLinkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVpnSiteLinkIDInsensitively(input string) (*VpnSiteLinkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnSiteLinkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VpnSiteLinkId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VpnSiteName, ok = parsed.Parsed["vpnSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnSiteName", *parsed) + if id.VpnSiteName, ok = input.Parsed["vpnSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vpnSiteName", input) } - if id.VpnSiteLinkName, ok = parsed.Parsed["vpnSiteLinkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnSiteLinkName", *parsed) + if id.VpnSiteLinkName, ok = input.Parsed["vpnSiteLinkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vpnSiteLinkName", input) } - return &id, nil + return nil } // ValidateVpnSiteLinkID checks that 'input' can be parsed as a Vpn Site Link ID diff --git a/resource-manager/network/2023-06-01/vmsspublicipaddresses/id_virtualmachinescaleset.go b/resource-manager/network/2023-06-01/vmsspublicipaddresses/id_virtualmachinescaleset.go index b798e513d2e..7f2795675f6 100644 --- a/resource-manager/network/2023-06-01/vmsspublicipaddresses/id_virtualmachinescaleset.go +++ b/resource-manager/network/2023-06-01/vmsspublicipaddresses/id_virtualmachinescaleset.go @@ -36,19 +36,9 @@ func ParseVirtualMachineScaleSetID(input string) (*VirtualMachineScaleSetId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetId{} - - 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.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineScaleSetIDInsensitively(input string) (*VirtualMachineSc return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineScaleSetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineScaleSetId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineScaleSetName, ok = parsed.Parsed["virtualMachineScaleSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", *parsed) + if id.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) } - return &id, nil + return nil } // ValidateVirtualMachineScaleSetID checks that 'input' can be parsed as a Virtual Machine Scale Set ID diff --git a/resource-manager/network/2023-06-01/vpngateways/id_vpngateway.go b/resource-manager/network/2023-06-01/vpngateways/id_vpngateway.go index 5e23e288887..bf76c30c5da 100644 --- a/resource-manager/network/2023-06-01/vpngateways/id_vpngateway.go +++ b/resource-manager/network/2023-06-01/vpngateways/id_vpngateway.go @@ -36,19 +36,9 @@ func ParseVpnGatewayID(input string) (*VpnGatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnGatewayId{} - - 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.VpnGatewayName, ok = parsed.Parsed["vpnGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnGatewayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVpnGatewayIDInsensitively(input string) (*VpnGatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnGatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VpnGatewayId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VpnGatewayName, ok = parsed.Parsed["vpnGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnGatewayName", *parsed) + if id.VpnGatewayName, ok = input.Parsed["vpnGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vpnGatewayName", input) } - return &id, nil + return nil } // ValidateVpnGatewayID checks that 'input' can be parsed as a Vpn Gateway ID diff --git a/resource-manager/network/2023-06-01/vpnlinkconnections/id_vpnlinkconnection.go b/resource-manager/network/2023-06-01/vpnlinkconnections/id_vpnlinkconnection.go index 1fc8b77b7e9..b5191696d31 100644 --- a/resource-manager/network/2023-06-01/vpnlinkconnections/id_vpnlinkconnection.go +++ b/resource-manager/network/2023-06-01/vpnlinkconnections/id_vpnlinkconnection.go @@ -40,27 +40,9 @@ func ParseVpnLinkConnectionID(input string) (*VpnLinkConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnLinkConnectionId{} - - 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.VpnGatewayName, ok = parsed.Parsed["vpnGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnGatewayName", *parsed) - } - - if id.VpnConnectionName, ok = parsed.Parsed["vpnConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnConnectionName", *parsed) - } - - if id.VpnLinkConnectionName, ok = parsed.Parsed["vpnLinkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnLinkConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVpnLinkConnectionIDInsensitively(input string) (*VpnLinkConnectionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnLinkConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VpnLinkConnectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VpnGatewayName, ok = parsed.Parsed["vpnGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnGatewayName", *parsed) + if id.VpnGatewayName, ok = input.Parsed["vpnGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vpnGatewayName", input) } - if id.VpnConnectionName, ok = parsed.Parsed["vpnConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnConnectionName", *parsed) + if id.VpnConnectionName, ok = input.Parsed["vpnConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vpnConnectionName", input) } - if id.VpnLinkConnectionName, ok = parsed.Parsed["vpnLinkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnLinkConnectionName", *parsed) + if id.VpnLinkConnectionName, ok = input.Parsed["vpnLinkConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vpnLinkConnectionName", input) } - return &id, nil + return nil } // ValidateVpnLinkConnectionID checks that 'input' can be parsed as a Vpn Link Connection ID diff --git a/resource-manager/network/2023-06-01/vpnserverconfigurations/id_vpnserverconfiguration.go b/resource-manager/network/2023-06-01/vpnserverconfigurations/id_vpnserverconfiguration.go index 688f2431145..3371906376c 100644 --- a/resource-manager/network/2023-06-01/vpnserverconfigurations/id_vpnserverconfiguration.go +++ b/resource-manager/network/2023-06-01/vpnserverconfigurations/id_vpnserverconfiguration.go @@ -36,19 +36,9 @@ func ParseVpnServerConfigurationID(input string) (*VpnServerConfigurationId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnServerConfigurationId{} - - 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.VpnServerConfigurationName, ok = parsed.Parsed["vpnServerConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnServerConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVpnServerConfigurationIDInsensitively(input string) (*VpnServerConfigu return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnServerConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VpnServerConfigurationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VpnServerConfigurationName, ok = parsed.Parsed["vpnServerConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnServerConfigurationName", *parsed) + if id.VpnServerConfigurationName, ok = input.Parsed["vpnServerConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vpnServerConfigurationName", input) } - return &id, nil + return nil } // ValidateVpnServerConfigurationID checks that 'input' can be parsed as a Vpn Server Configuration ID diff --git a/resource-manager/network/2023-06-01/vpnsites/id_vpnsite.go b/resource-manager/network/2023-06-01/vpnsites/id_vpnsite.go index 01be85624d7..4266864fca0 100644 --- a/resource-manager/network/2023-06-01/vpnsites/id_vpnsite.go +++ b/resource-manager/network/2023-06-01/vpnsites/id_vpnsite.go @@ -36,19 +36,9 @@ func ParseVpnSiteID(input string) (*VpnSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnSiteId{} - - 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.VpnSiteName, ok = parsed.Parsed["vpnSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnSiteName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVpnSiteIDInsensitively(input string) (*VpnSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VpnSiteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VpnSiteId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VpnSiteName, ok = parsed.Parsed["vpnSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vpnSiteName", *parsed) + if id.VpnSiteName, ok = input.Parsed["vpnSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vpnSiteName", input) } - return &id, nil + return nil } // ValidateVpnSiteID checks that 'input' can be parsed as a Vpn Site ID diff --git a/resource-manager/network/2023-06-01/webapplicationfirewallpolicies/id_applicationgatewaywebapplicationfirewallpolicy.go b/resource-manager/network/2023-06-01/webapplicationfirewallpolicies/id_applicationgatewaywebapplicationfirewallpolicy.go index d15af832185..d06b36f8867 100644 --- a/resource-manager/network/2023-06-01/webapplicationfirewallpolicies/id_applicationgatewaywebapplicationfirewallpolicy.go +++ b/resource-manager/network/2023-06-01/webapplicationfirewallpolicies/id_applicationgatewaywebapplicationfirewallpolicy.go @@ -36,19 +36,9 @@ func ParseApplicationGatewayWebApplicationFirewallPolicyID(input string) (*Appli return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGatewayWebApplicationFirewallPolicyId{} - - 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.ApplicationGatewayWebApplicationFirewallPolicyName, ok = parsed.Parsed["applicationGatewayWebApplicationFirewallPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGatewayWebApplicationFirewallPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseApplicationGatewayWebApplicationFirewallPolicyIDInsensitively(input st return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationGatewayWebApplicationFirewallPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ApplicationGatewayWebApplicationFirewallPolicyId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ApplicationGatewayWebApplicationFirewallPolicyName, ok = parsed.Parsed["applicationGatewayWebApplicationFirewallPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationGatewayWebApplicationFirewallPolicyName", *parsed) + if id.ApplicationGatewayWebApplicationFirewallPolicyName, ok = input.Parsed["applicationGatewayWebApplicationFirewallPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationGatewayWebApplicationFirewallPolicyName", input) } - return &id, nil + return nil } // ValidateApplicationGatewayWebApplicationFirewallPolicyID checks that 'input' can be parsed as a Application Gateway Web Application Firewall Policy ID diff --git a/resource-manager/network/2023-06-01/webcategories/id_azurewebcategory.go b/resource-manager/network/2023-06-01/webcategories/id_azurewebcategory.go index 05fb4633638..acb30d2a8fa 100644 --- a/resource-manager/network/2023-06-01/webcategories/id_azurewebcategory.go +++ b/resource-manager/network/2023-06-01/webcategories/id_azurewebcategory.go @@ -34,15 +34,9 @@ func ParseAzureWebCategoryID(input string) (*AzureWebCategoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AzureWebCategoryId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.AzureWebCategoryName, ok = parsed.Parsed["azureWebCategoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "azureWebCategoryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseAzureWebCategoryIDInsensitively(input string) (*AzureWebCategoryId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AzureWebCategoryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *AzureWebCategoryId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.AzureWebCategoryName, ok = parsed.Parsed["azureWebCategoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "azureWebCategoryName", *parsed) + if id.AzureWebCategoryName, ok = input.Parsed["azureWebCategoryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "azureWebCategoryName", input) } - return &id, nil + return nil } // ValidateAzureWebCategoryID checks that 'input' can be parsed as a Azure Web Category ID diff --git a/resource-manager/networkcloud/2023-07-01/networkclouds/id_agentpool.go b/resource-manager/networkcloud/2023-07-01/networkclouds/id_agentpool.go index 52493561310..3ba67859d74 100644 --- a/resource-manager/networkcloud/2023-07-01/networkclouds/id_agentpool.go +++ b/resource-manager/networkcloud/2023-07-01/networkclouds/id_agentpool.go @@ -38,23 +38,9 @@ func ParseAgentPoolID(input string) (*AgentPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AgentPoolId{} - - 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.KubernetesClusterName, ok = parsed.Parsed["kubernetesClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "kubernetesClusterName", *parsed) - } - - if id.AgentPoolName, ok = parsed.Parsed["agentPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "agentPoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAgentPoolIDInsensitively(input string) (*AgentPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AgentPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AgentPoolId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.KubernetesClusterName, ok = parsed.Parsed["kubernetesClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "kubernetesClusterName", *parsed) + if id.KubernetesClusterName, ok = input.Parsed["kubernetesClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "kubernetesClusterName", input) } - if id.AgentPoolName, ok = parsed.Parsed["agentPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "agentPoolName", *parsed) + if id.AgentPoolName, ok = input.Parsed["agentPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "agentPoolName", input) } - return &id, nil + return nil } // ValidateAgentPoolID checks that 'input' can be parsed as a Agent Pool ID diff --git a/resource-manager/networkcloud/2023-07-01/networkclouds/id_baremetalmachine.go b/resource-manager/networkcloud/2023-07-01/networkclouds/id_baremetalmachine.go index 873508b7afc..b3c591355ec 100644 --- a/resource-manager/networkcloud/2023-07-01/networkclouds/id_baremetalmachine.go +++ b/resource-manager/networkcloud/2023-07-01/networkclouds/id_baremetalmachine.go @@ -36,19 +36,9 @@ func ParseBareMetalMachineID(input string) (*BareMetalMachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BareMetalMachineId{} - - 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.BareMetalMachineName, ok = parsed.Parsed["bareMetalMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bareMetalMachineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseBareMetalMachineIDInsensitively(input string) (*BareMetalMachineId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BareMetalMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *BareMetalMachineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.BareMetalMachineName, ok = parsed.Parsed["bareMetalMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bareMetalMachineName", *parsed) + if id.BareMetalMachineName, ok = input.Parsed["bareMetalMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "bareMetalMachineName", input) } - return &id, nil + return nil } // ValidateBareMetalMachineID checks that 'input' can be parsed as a Bare Metal Machine ID diff --git a/resource-manager/networkcloud/2023-07-01/networkclouds/id_baremetalmachinekeyset.go b/resource-manager/networkcloud/2023-07-01/networkclouds/id_baremetalmachinekeyset.go index 28e683d414c..4b60f64b8fb 100644 --- a/resource-manager/networkcloud/2023-07-01/networkclouds/id_baremetalmachinekeyset.go +++ b/resource-manager/networkcloud/2023-07-01/networkclouds/id_baremetalmachinekeyset.go @@ -38,23 +38,9 @@ func ParseBareMetalMachineKeySetID(input string) (*BareMetalMachineKeySetId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BareMetalMachineKeySetId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.BareMetalMachineKeySetName, ok = parsed.Parsed["bareMetalMachineKeySetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bareMetalMachineKeySetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBareMetalMachineKeySetIDInsensitively(input string) (*BareMetalMachine return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BareMetalMachineKeySetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BareMetalMachineKeySetId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.BareMetalMachineKeySetName, ok = parsed.Parsed["bareMetalMachineKeySetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bareMetalMachineKeySetName", *parsed) + if id.BareMetalMachineKeySetName, ok = input.Parsed["bareMetalMachineKeySetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "bareMetalMachineKeySetName", input) } - return &id, nil + return nil } // ValidateBareMetalMachineKeySetID checks that 'input' can be parsed as a Bare Metal Machine Key Set ID diff --git a/resource-manager/networkcloud/2023-07-01/networkclouds/id_bmckeyset.go b/resource-manager/networkcloud/2023-07-01/networkclouds/id_bmckeyset.go index 29821c14100..e2074f8c7b6 100644 --- a/resource-manager/networkcloud/2023-07-01/networkclouds/id_bmckeyset.go +++ b/resource-manager/networkcloud/2023-07-01/networkclouds/id_bmckeyset.go @@ -38,23 +38,9 @@ func ParseBmcKeySetID(input string) (*BmcKeySetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BmcKeySetId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.BmcKeySetName, ok = parsed.Parsed["bmcKeySetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bmcKeySetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBmcKeySetIDInsensitively(input string) (*BmcKeySetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BmcKeySetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BmcKeySetId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.BmcKeySetName, ok = parsed.Parsed["bmcKeySetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bmcKeySetName", *parsed) + if id.BmcKeySetName, ok = input.Parsed["bmcKeySetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "bmcKeySetName", input) } - return &id, nil + return nil } // ValidateBmcKeySetID checks that 'input' can be parsed as a Bmc Key Set ID diff --git a/resource-manager/networkcloud/2023-07-01/networkclouds/id_cloudservicesnetwork.go b/resource-manager/networkcloud/2023-07-01/networkclouds/id_cloudservicesnetwork.go index a99aa1d6933..1050da17665 100644 --- a/resource-manager/networkcloud/2023-07-01/networkclouds/id_cloudservicesnetwork.go +++ b/resource-manager/networkcloud/2023-07-01/networkclouds/id_cloudservicesnetwork.go @@ -36,19 +36,9 @@ func ParseCloudServicesNetworkID(input string) (*CloudServicesNetworkId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CloudServicesNetworkId{} - - 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.CloudServicesNetworkName, ok = parsed.Parsed["cloudServicesNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudServicesNetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseCloudServicesNetworkIDInsensitively(input string) (*CloudServicesNetwo return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CloudServicesNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CloudServicesNetworkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CloudServicesNetworkName, ok = parsed.Parsed["cloudServicesNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudServicesNetworkName", *parsed) + if id.CloudServicesNetworkName, ok = input.Parsed["cloudServicesNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cloudServicesNetworkName", input) } - return &id, nil + return nil } // ValidateCloudServicesNetworkID checks that 'input' can be parsed as a Cloud Services Network ID diff --git a/resource-manager/networkcloud/2023-07-01/networkclouds/id_cluster.go b/resource-manager/networkcloud/2023-07-01/networkclouds/id_cluster.go index 1bf3f151bb7..e403d31adac 100644 --- a/resource-manager/networkcloud/2023-07-01/networkclouds/id_cluster.go +++ b/resource-manager/networkcloud/2023-07-01/networkclouds/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/networkcloud/2023-07-01/networkclouds/id_clustermanager.go b/resource-manager/networkcloud/2023-07-01/networkclouds/id_clustermanager.go index 3a251c5d03d..7bd47f53184 100644 --- a/resource-manager/networkcloud/2023-07-01/networkclouds/id_clustermanager.go +++ b/resource-manager/networkcloud/2023-07-01/networkclouds/id_clustermanager.go @@ -36,19 +36,9 @@ func ParseClusterManagerID(input string) (*ClusterManagerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterManagerId{} - - 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.ClusterManagerName, ok = parsed.Parsed["clusterManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterManagerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterManagerIDInsensitively(input string) (*ClusterManagerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterManagerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterManagerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterManagerName, ok = parsed.Parsed["clusterManagerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterManagerName", *parsed) + if id.ClusterManagerName, ok = input.Parsed["clusterManagerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterManagerName", input) } - return &id, nil + return nil } // ValidateClusterManagerID checks that 'input' can be parsed as a Cluster Manager ID diff --git a/resource-manager/networkcloud/2023-07-01/networkclouds/id_console.go b/resource-manager/networkcloud/2023-07-01/networkclouds/id_console.go index 847df17d6a2..5ece51c8c96 100644 --- a/resource-manager/networkcloud/2023-07-01/networkclouds/id_console.go +++ b/resource-manager/networkcloud/2023-07-01/networkclouds/id_console.go @@ -38,23 +38,9 @@ func ParseConsoleID(input string) (*ConsoleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConsoleId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) - } - - if id.ConsoleName, ok = parsed.Parsed["consoleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "consoleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConsoleIDInsensitively(input string) (*ConsoleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConsoleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConsoleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - if id.ConsoleName, ok = parsed.Parsed["consoleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "consoleName", *parsed) + if id.ConsoleName, ok = input.Parsed["consoleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "consoleName", input) } - return &id, nil + return nil } // ValidateConsoleID checks that 'input' can be parsed as a Console ID diff --git a/resource-manager/networkcloud/2023-07-01/networkclouds/id_kubernetescluster.go b/resource-manager/networkcloud/2023-07-01/networkclouds/id_kubernetescluster.go index 5cf1b7da5f0..b201e7ca616 100644 --- a/resource-manager/networkcloud/2023-07-01/networkclouds/id_kubernetescluster.go +++ b/resource-manager/networkcloud/2023-07-01/networkclouds/id_kubernetescluster.go @@ -36,19 +36,9 @@ func ParseKubernetesClusterID(input string) (*KubernetesClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := KubernetesClusterId{} - - 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.KubernetesClusterName, ok = parsed.Parsed["kubernetesClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "kubernetesClusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseKubernetesClusterIDInsensitively(input string) (*KubernetesClusterId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := KubernetesClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *KubernetesClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.KubernetesClusterName, ok = parsed.Parsed["kubernetesClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "kubernetesClusterName", *parsed) + if id.KubernetesClusterName, ok = input.Parsed["kubernetesClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "kubernetesClusterName", input) } - return &id, nil + return nil } // ValidateKubernetesClusterID checks that 'input' can be parsed as a Kubernetes Cluster ID diff --git a/resource-manager/networkcloud/2023-07-01/networkclouds/id_l2network.go b/resource-manager/networkcloud/2023-07-01/networkclouds/id_l2network.go index 31d8956d700..5aa60e757db 100644 --- a/resource-manager/networkcloud/2023-07-01/networkclouds/id_l2network.go +++ b/resource-manager/networkcloud/2023-07-01/networkclouds/id_l2network.go @@ -36,19 +36,9 @@ func ParseL2NetworkID(input string) (*L2NetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := L2NetworkId{} - - 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.L2NetworkName, ok = parsed.Parsed["l2NetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "l2NetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseL2NetworkIDInsensitively(input string) (*L2NetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := L2NetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *L2NetworkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.L2NetworkName, ok = parsed.Parsed["l2NetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "l2NetworkName", *parsed) + if id.L2NetworkName, ok = input.Parsed["l2NetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "l2NetworkName", input) } - return &id, nil + return nil } // ValidateL2NetworkID checks that 'input' can be parsed as a L 2 Network ID diff --git a/resource-manager/networkcloud/2023-07-01/networkclouds/id_l3network.go b/resource-manager/networkcloud/2023-07-01/networkclouds/id_l3network.go index cc985f9b159..f6a3a83a679 100644 --- a/resource-manager/networkcloud/2023-07-01/networkclouds/id_l3network.go +++ b/resource-manager/networkcloud/2023-07-01/networkclouds/id_l3network.go @@ -36,19 +36,9 @@ func ParseL3NetworkID(input string) (*L3NetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := L3NetworkId{} - - 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.L3NetworkName, ok = parsed.Parsed["l3NetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "l3NetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseL3NetworkIDInsensitively(input string) (*L3NetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := L3NetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *L3NetworkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.L3NetworkName, ok = parsed.Parsed["l3NetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "l3NetworkName", *parsed) + if id.L3NetworkName, ok = input.Parsed["l3NetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "l3NetworkName", input) } - return &id, nil + return nil } // ValidateL3NetworkID checks that 'input' can be parsed as a L 3 Network ID diff --git a/resource-manager/networkcloud/2023-07-01/networkclouds/id_metricsconfiguration.go b/resource-manager/networkcloud/2023-07-01/networkclouds/id_metricsconfiguration.go index 02077c59a38..22db0367ce9 100644 --- a/resource-manager/networkcloud/2023-07-01/networkclouds/id_metricsconfiguration.go +++ b/resource-manager/networkcloud/2023-07-01/networkclouds/id_metricsconfiguration.go @@ -38,23 +38,9 @@ func ParseMetricsConfigurationID(input string) (*MetricsConfigurationId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MetricsConfigurationId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.MetricsConfigurationName, ok = parsed.Parsed["metricsConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "metricsConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseMetricsConfigurationIDInsensitively(input string) (*MetricsConfigurati return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MetricsConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *MetricsConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.MetricsConfigurationName, ok = parsed.Parsed["metricsConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "metricsConfigurationName", *parsed) + if id.MetricsConfigurationName, ok = input.Parsed["metricsConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "metricsConfigurationName", input) } - return &id, nil + return nil } // ValidateMetricsConfigurationID checks that 'input' can be parsed as a Metrics Configuration ID diff --git a/resource-manager/networkcloud/2023-07-01/networkclouds/id_rack.go b/resource-manager/networkcloud/2023-07-01/networkclouds/id_rack.go index 1e2951c5228..c7962652499 100644 --- a/resource-manager/networkcloud/2023-07-01/networkclouds/id_rack.go +++ b/resource-manager/networkcloud/2023-07-01/networkclouds/id_rack.go @@ -36,19 +36,9 @@ func ParseRackID(input string) (*RackId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RackId{} - - 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.RackName, ok = parsed.Parsed["rackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "rackName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRackIDInsensitively(input string) (*RackId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RackId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RackId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RackName, ok = parsed.Parsed["rackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "rackName", *parsed) + if id.RackName, ok = input.Parsed["rackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "rackName", input) } - return &id, nil + return nil } // ValidateRackID checks that 'input' can be parsed as a Rack ID diff --git a/resource-manager/networkcloud/2023-07-01/networkclouds/id_racksku.go b/resource-manager/networkcloud/2023-07-01/networkclouds/id_racksku.go index 550e1c667dd..372cdd78394 100644 --- a/resource-manager/networkcloud/2023-07-01/networkclouds/id_racksku.go +++ b/resource-manager/networkcloud/2023-07-01/networkclouds/id_racksku.go @@ -34,15 +34,9 @@ func ParseRackSkuID(input string) (*RackSkuId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RackSkuId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.RackSkuName, ok = parsed.Parsed["rackSkuName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "rackSkuName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseRackSkuIDInsensitively(input string) (*RackSkuId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RackSkuId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RackSkuId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.RackSkuName, ok = parsed.Parsed["rackSkuName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "rackSkuName", *parsed) + if id.RackSkuName, ok = input.Parsed["rackSkuName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "rackSkuName", input) } - return &id, nil + return nil } // ValidateRackSkuID checks that 'input' can be parsed as a Rack Sku ID diff --git a/resource-manager/networkcloud/2023-07-01/networkclouds/id_storageappliance.go b/resource-manager/networkcloud/2023-07-01/networkclouds/id_storageappliance.go index 26f055d150c..ece3301eaf5 100644 --- a/resource-manager/networkcloud/2023-07-01/networkclouds/id_storageappliance.go +++ b/resource-manager/networkcloud/2023-07-01/networkclouds/id_storageappliance.go @@ -36,19 +36,9 @@ func ParseStorageApplianceID(input string) (*StorageApplianceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageApplianceId{} - - 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.StorageApplianceName, ok = parsed.Parsed["storageApplianceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageApplianceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseStorageApplianceIDInsensitively(input string) (*StorageApplianceId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageApplianceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *StorageApplianceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageApplianceName, ok = parsed.Parsed["storageApplianceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageApplianceName", *parsed) + if id.StorageApplianceName, ok = input.Parsed["storageApplianceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageApplianceName", input) } - return &id, nil + return nil } // ValidateStorageApplianceID checks that 'input' can be parsed as a Storage Appliance ID diff --git a/resource-manager/networkcloud/2023-07-01/networkclouds/id_trunkednetwork.go b/resource-manager/networkcloud/2023-07-01/networkclouds/id_trunkednetwork.go index c36f64df8f6..eaa57769c90 100644 --- a/resource-manager/networkcloud/2023-07-01/networkclouds/id_trunkednetwork.go +++ b/resource-manager/networkcloud/2023-07-01/networkclouds/id_trunkednetwork.go @@ -36,19 +36,9 @@ func ParseTrunkedNetworkID(input string) (*TrunkedNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TrunkedNetworkId{} - - 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.TrunkedNetworkName, ok = parsed.Parsed["trunkedNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "trunkedNetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseTrunkedNetworkIDInsensitively(input string) (*TrunkedNetworkId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TrunkedNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *TrunkedNetworkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.TrunkedNetworkName, ok = parsed.Parsed["trunkedNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "trunkedNetworkName", *parsed) + if id.TrunkedNetworkName, ok = input.Parsed["trunkedNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "trunkedNetworkName", input) } - return &id, nil + return nil } // ValidateTrunkedNetworkID checks that 'input' can be parsed as a Trunked Network ID diff --git a/resource-manager/networkcloud/2023-07-01/networkclouds/id_virtualmachine.go b/resource-manager/networkcloud/2023-07-01/networkclouds/id_virtualmachine.go index afb81cb9b69..7b1a62469c8 100644 --- a/resource-manager/networkcloud/2023-07-01/networkclouds/id_virtualmachine.go +++ b/resource-manager/networkcloud/2023-07-01/networkclouds/id_virtualmachine.go @@ -36,19 +36,9 @@ func ParseVirtualMachineID(input string) (*VirtualMachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineIDInsensitively(input string) (*VirtualMachineId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - return &id, nil + return nil } // ValidateVirtualMachineID checks that 'input' can be parsed as a Virtual Machine ID diff --git a/resource-manager/networkcloud/2023-07-01/networkclouds/id_volume.go b/resource-manager/networkcloud/2023-07-01/networkclouds/id_volume.go index 9749482ec5d..0d6a08f2c56 100644 --- a/resource-manager/networkcloud/2023-07-01/networkclouds/id_volume.go +++ b/resource-manager/networkcloud/2023-07-01/networkclouds/id_volume.go @@ -36,19 +36,9 @@ func ParseVolumeID(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} - - 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.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VolumeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VolumeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "volumeName", *parsed) + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) } - return &id, nil + return nil } // ValidateVolumeID checks that 'input' can be parsed as a Volume ID diff --git a/resource-manager/networkfunction/2022-08-01/azuretrafficcollectors/id_azuretrafficcollector.go b/resource-manager/networkfunction/2022-08-01/azuretrafficcollectors/id_azuretrafficcollector.go index 3d0cf730c13..37daf654765 100644 --- a/resource-manager/networkfunction/2022-08-01/azuretrafficcollectors/id_azuretrafficcollector.go +++ b/resource-manager/networkfunction/2022-08-01/azuretrafficcollectors/id_azuretrafficcollector.go @@ -36,19 +36,9 @@ func ParseAzureTrafficCollectorID(input string) (*AzureTrafficCollectorId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AzureTrafficCollectorId{} - - 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.AzureTrafficCollectorName, ok = parsed.Parsed["azureTrafficCollectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "azureTrafficCollectorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAzureTrafficCollectorIDInsensitively(input string) (*AzureTrafficColle return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AzureTrafficCollectorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AzureTrafficCollectorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AzureTrafficCollectorName, ok = parsed.Parsed["azureTrafficCollectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "azureTrafficCollectorName", *parsed) + if id.AzureTrafficCollectorName, ok = input.Parsed["azureTrafficCollectorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "azureTrafficCollectorName", input) } - return &id, nil + return nil } // ValidateAzureTrafficCollectorID checks that 'input' can be parsed as a Azure Traffic Collector ID diff --git a/resource-manager/networkfunction/2022-08-01/collectorpolicies/id_azuretrafficcollector.go b/resource-manager/networkfunction/2022-08-01/collectorpolicies/id_azuretrafficcollector.go index 7626d2634cf..6079f72dd08 100644 --- a/resource-manager/networkfunction/2022-08-01/collectorpolicies/id_azuretrafficcollector.go +++ b/resource-manager/networkfunction/2022-08-01/collectorpolicies/id_azuretrafficcollector.go @@ -36,19 +36,9 @@ func ParseAzureTrafficCollectorID(input string) (*AzureTrafficCollectorId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AzureTrafficCollectorId{} - - 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.AzureTrafficCollectorName, ok = parsed.Parsed["azureTrafficCollectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "azureTrafficCollectorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAzureTrafficCollectorIDInsensitively(input string) (*AzureTrafficColle return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AzureTrafficCollectorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AzureTrafficCollectorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AzureTrafficCollectorName, ok = parsed.Parsed["azureTrafficCollectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "azureTrafficCollectorName", *parsed) + if id.AzureTrafficCollectorName, ok = input.Parsed["azureTrafficCollectorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "azureTrafficCollectorName", input) } - return &id, nil + return nil } // ValidateAzureTrafficCollectorID checks that 'input' can be parsed as a Azure Traffic Collector ID diff --git a/resource-manager/networkfunction/2022-08-01/collectorpolicies/id_collectorpolicy.go b/resource-manager/networkfunction/2022-08-01/collectorpolicies/id_collectorpolicy.go index b70be0df570..59971b30a96 100644 --- a/resource-manager/networkfunction/2022-08-01/collectorpolicies/id_collectorpolicy.go +++ b/resource-manager/networkfunction/2022-08-01/collectorpolicies/id_collectorpolicy.go @@ -38,23 +38,9 @@ func ParseCollectorPolicyID(input string) (*CollectorPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CollectorPolicyId{} - - 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.AzureTrafficCollectorName, ok = parsed.Parsed["azureTrafficCollectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "azureTrafficCollectorName", *parsed) - } - - if id.CollectorPolicyName, ok = parsed.Parsed["collectorPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectorPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCollectorPolicyIDInsensitively(input string) (*CollectorPolicyId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CollectorPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CollectorPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AzureTrafficCollectorName, ok = parsed.Parsed["azureTrafficCollectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "azureTrafficCollectorName", *parsed) + if id.AzureTrafficCollectorName, ok = input.Parsed["azureTrafficCollectorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "azureTrafficCollectorName", input) } - if id.CollectorPolicyName, ok = parsed.Parsed["collectorPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectorPolicyName", *parsed) + if id.CollectorPolicyName, ok = input.Parsed["collectorPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "collectorPolicyName", input) } - return &id, nil + return nil } // ValidateCollectorPolicyID checks that 'input' can be parsed as a Collector Policy ID diff --git a/resource-manager/networkfunction/2022-11-01/azuretrafficcollectors/id_azuretrafficcollector.go b/resource-manager/networkfunction/2022-11-01/azuretrafficcollectors/id_azuretrafficcollector.go index 3d0cf730c13..37daf654765 100644 --- a/resource-manager/networkfunction/2022-11-01/azuretrafficcollectors/id_azuretrafficcollector.go +++ b/resource-manager/networkfunction/2022-11-01/azuretrafficcollectors/id_azuretrafficcollector.go @@ -36,19 +36,9 @@ func ParseAzureTrafficCollectorID(input string) (*AzureTrafficCollectorId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AzureTrafficCollectorId{} - - 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.AzureTrafficCollectorName, ok = parsed.Parsed["azureTrafficCollectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "azureTrafficCollectorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAzureTrafficCollectorIDInsensitively(input string) (*AzureTrafficColle return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AzureTrafficCollectorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AzureTrafficCollectorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AzureTrafficCollectorName, ok = parsed.Parsed["azureTrafficCollectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "azureTrafficCollectorName", *parsed) + if id.AzureTrafficCollectorName, ok = input.Parsed["azureTrafficCollectorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "azureTrafficCollectorName", input) } - return &id, nil + return nil } // ValidateAzureTrafficCollectorID checks that 'input' can be parsed as a Azure Traffic Collector ID diff --git a/resource-manager/networkfunction/2022-11-01/collectorpolicies/id_azuretrafficcollector.go b/resource-manager/networkfunction/2022-11-01/collectorpolicies/id_azuretrafficcollector.go index 7626d2634cf..6079f72dd08 100644 --- a/resource-manager/networkfunction/2022-11-01/collectorpolicies/id_azuretrafficcollector.go +++ b/resource-manager/networkfunction/2022-11-01/collectorpolicies/id_azuretrafficcollector.go @@ -36,19 +36,9 @@ func ParseAzureTrafficCollectorID(input string) (*AzureTrafficCollectorId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AzureTrafficCollectorId{} - - 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.AzureTrafficCollectorName, ok = parsed.Parsed["azureTrafficCollectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "azureTrafficCollectorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAzureTrafficCollectorIDInsensitively(input string) (*AzureTrafficColle return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AzureTrafficCollectorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AzureTrafficCollectorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AzureTrafficCollectorName, ok = parsed.Parsed["azureTrafficCollectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "azureTrafficCollectorName", *parsed) + if id.AzureTrafficCollectorName, ok = input.Parsed["azureTrafficCollectorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "azureTrafficCollectorName", input) } - return &id, nil + return nil } // ValidateAzureTrafficCollectorID checks that 'input' can be parsed as a Azure Traffic Collector ID diff --git a/resource-manager/networkfunction/2022-11-01/collectorpolicies/id_collectorpolicy.go b/resource-manager/networkfunction/2022-11-01/collectorpolicies/id_collectorpolicy.go index b70be0df570..59971b30a96 100644 --- a/resource-manager/networkfunction/2022-11-01/collectorpolicies/id_collectorpolicy.go +++ b/resource-manager/networkfunction/2022-11-01/collectorpolicies/id_collectorpolicy.go @@ -38,23 +38,9 @@ func ParseCollectorPolicyID(input string) (*CollectorPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CollectorPolicyId{} - - 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.AzureTrafficCollectorName, ok = parsed.Parsed["azureTrafficCollectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "azureTrafficCollectorName", *parsed) - } - - if id.CollectorPolicyName, ok = parsed.Parsed["collectorPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectorPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCollectorPolicyIDInsensitively(input string) (*CollectorPolicyId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CollectorPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CollectorPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AzureTrafficCollectorName, ok = parsed.Parsed["azureTrafficCollectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "azureTrafficCollectorName", *parsed) + if id.AzureTrafficCollectorName, ok = input.Parsed["azureTrafficCollectorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "azureTrafficCollectorName", input) } - if id.CollectorPolicyName, ok = parsed.Parsed["collectorPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "collectorPolicyName", *parsed) + if id.CollectorPolicyName, ok = input.Parsed["collectorPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "collectorPolicyName", input) } - return &id, nil + return nil } // ValidateCollectorPolicyID checks that 'input' can be parsed as a Collector Policy ID diff --git a/resource-manager/newrelic/2022-07-01-preview/monitors/id_monitor.go b/resource-manager/newrelic/2022-07-01-preview/monitors/id_monitor.go index 1b178c41cd0..f66509a175b 100644 --- a/resource-manager/newrelic/2022-07-01-preview/monitors/id_monitor.go +++ b/resource-manager/newrelic/2022-07-01-preview/monitors/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/newrelic/2022-07-01-preview/tagrules/id_monitor.go b/resource-manager/newrelic/2022-07-01-preview/tagrules/id_monitor.go index 91def2f39e1..865b538a9e9 100644 --- a/resource-manager/newrelic/2022-07-01-preview/tagrules/id_monitor.go +++ b/resource-manager/newrelic/2022-07-01-preview/tagrules/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/newrelic/2022-07-01-preview/tagrules/id_tagrule.go b/resource-manager/newrelic/2022-07-01-preview/tagrules/id_tagrule.go index 0f89ab5c649..98785f2e11f 100644 --- a/resource-manager/newrelic/2022-07-01-preview/tagrules/id_tagrule.go +++ b/resource-manager/newrelic/2022-07-01-preview/tagrules/id_tagrule.go @@ -38,23 +38,9 @@ func ParseTagRuleID(input string) (*TagRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TagRuleId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) - } - - if id.TagRuleName, ok = parsed.Parsed["tagRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTagRuleIDInsensitively(input string) (*TagRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TagRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TagRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - if id.TagRuleName, ok = parsed.Parsed["tagRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagRuleName", *parsed) + if id.TagRuleName, ok = input.Parsed["tagRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tagRuleName", input) } - return &id, nil + return nil } // ValidateTagRuleID checks that 'input' can be parsed as a Tag Rule ID diff --git a/resource-manager/newrelic/2022-07-01/monitors/id_monitor.go b/resource-manager/newrelic/2022-07-01/monitors/id_monitor.go index 1b178c41cd0..f66509a175b 100644 --- a/resource-manager/newrelic/2022-07-01/monitors/id_monitor.go +++ b/resource-manager/newrelic/2022-07-01/monitors/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/newrelic/2022-07-01/tagrules/id_monitor.go b/resource-manager/newrelic/2022-07-01/tagrules/id_monitor.go index 91def2f39e1..865b538a9e9 100644 --- a/resource-manager/newrelic/2022-07-01/tagrules/id_monitor.go +++ b/resource-manager/newrelic/2022-07-01/tagrules/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/newrelic/2022-07-01/tagrules/id_tagrule.go b/resource-manager/newrelic/2022-07-01/tagrules/id_tagrule.go index 0f89ab5c649..98785f2e11f 100644 --- a/resource-manager/newrelic/2022-07-01/tagrules/id_tagrule.go +++ b/resource-manager/newrelic/2022-07-01/tagrules/id_tagrule.go @@ -38,23 +38,9 @@ func ParseTagRuleID(input string) (*TagRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TagRuleId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) - } - - if id.TagRuleName, ok = parsed.Parsed["tagRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTagRuleIDInsensitively(input string) (*TagRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TagRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TagRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - if id.TagRuleName, ok = parsed.Parsed["tagRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tagRuleName", *parsed) + if id.TagRuleName, ok = input.Parsed["tagRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tagRuleName", input) } - return &id, nil + return nil } // ValidateTagRuleID checks that 'input' can be parsed as a Tag Rule ID diff --git a/resource-manager/nginx/2022-08-01/nginxcertificate/id_certificate.go b/resource-manager/nginx/2022-08-01/nginxcertificate/id_certificate.go index 4d6f53b5b26..fedae0413df 100644 --- a/resource-manager/nginx/2022-08-01/nginxcertificate/id_certificate.go +++ b/resource-manager/nginx/2022-08-01/nginxcertificate/id_certificate.go @@ -38,23 +38,9 @@ func ParseCertificateID(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} - - 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.NginxDeploymentName, ok = parsed.Parsed["nginxDeploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nginxDeploymentName", *parsed) - } - - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCertificateIDInsensitively(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NginxDeploymentName, ok = parsed.Parsed["nginxDeploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nginxDeploymentName", *parsed) + if id.NginxDeploymentName, ok = input.Parsed["nginxDeploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "nginxDeploymentName", input) } - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if id.CertificateName, ok = input.Parsed["certificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateName", input) } - return &id, nil + return nil } // ValidateCertificateID checks that 'input' can be parsed as a Certificate ID diff --git a/resource-manager/nginx/2022-08-01/nginxcertificate/id_nginxdeployment.go b/resource-manager/nginx/2022-08-01/nginxcertificate/id_nginxdeployment.go index ad8f96db489..98ca5db8fa9 100644 --- a/resource-manager/nginx/2022-08-01/nginxcertificate/id_nginxdeployment.go +++ b/resource-manager/nginx/2022-08-01/nginxcertificate/id_nginxdeployment.go @@ -36,19 +36,9 @@ func ParseNginxDeploymentID(input string) (*NginxDeploymentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NginxDeploymentId{} - - 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.NginxDeploymentName, ok = parsed.Parsed["nginxDeploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nginxDeploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNginxDeploymentIDInsensitively(input string) (*NginxDeploymentId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NginxDeploymentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NginxDeploymentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NginxDeploymentName, ok = parsed.Parsed["nginxDeploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nginxDeploymentName", *parsed) + if id.NginxDeploymentName, ok = input.Parsed["nginxDeploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "nginxDeploymentName", input) } - return &id, nil + return nil } // ValidateNginxDeploymentID checks that 'input' can be parsed as a Nginx Deployment ID diff --git a/resource-manager/nginx/2022-08-01/nginxconfiguration/id_configuration.go b/resource-manager/nginx/2022-08-01/nginxconfiguration/id_configuration.go index 7a3131a1eaf..ac4c2d0cbdb 100644 --- a/resource-manager/nginx/2022-08-01/nginxconfiguration/id_configuration.go +++ b/resource-manager/nginx/2022-08-01/nginxconfiguration/id_configuration.go @@ -38,23 +38,9 @@ func ParseConfigurationID(input string) (*ConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationId{} - - 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.NginxDeploymentName, ok = parsed.Parsed["nginxDeploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nginxDeploymentName", *parsed) - } - - if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConfigurationIDInsensitively(input string) (*ConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NginxDeploymentName, ok = parsed.Parsed["nginxDeploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nginxDeploymentName", *parsed) + if id.NginxDeploymentName, ok = input.Parsed["nginxDeploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "nginxDeploymentName", input) } - if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationName", *parsed) + if id.ConfigurationName, ok = input.Parsed["configurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationName", input) } - return &id, nil + return nil } // ValidateConfigurationID checks that 'input' can be parsed as a Configuration ID diff --git a/resource-manager/nginx/2022-08-01/nginxconfiguration/id_nginxdeployment.go b/resource-manager/nginx/2022-08-01/nginxconfiguration/id_nginxdeployment.go index ab125d9e6ca..dc4f3640508 100644 --- a/resource-manager/nginx/2022-08-01/nginxconfiguration/id_nginxdeployment.go +++ b/resource-manager/nginx/2022-08-01/nginxconfiguration/id_nginxdeployment.go @@ -36,19 +36,9 @@ func ParseNginxDeploymentID(input string) (*NginxDeploymentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NginxDeploymentId{} - - 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.NginxDeploymentName, ok = parsed.Parsed["nginxDeploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nginxDeploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNginxDeploymentIDInsensitively(input string) (*NginxDeploymentId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NginxDeploymentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NginxDeploymentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NginxDeploymentName, ok = parsed.Parsed["nginxDeploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nginxDeploymentName", *parsed) + if id.NginxDeploymentName, ok = input.Parsed["nginxDeploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "nginxDeploymentName", input) } - return &id, nil + return nil } // ValidateNginxDeploymentID checks that 'input' can be parsed as a Nginx Deployment ID diff --git a/resource-manager/nginx/2022-08-01/nginxdeployment/id_nginxdeployment.go b/resource-manager/nginx/2022-08-01/nginxdeployment/id_nginxdeployment.go index bd5eb587fac..159775a4f8c 100644 --- a/resource-manager/nginx/2022-08-01/nginxdeployment/id_nginxdeployment.go +++ b/resource-manager/nginx/2022-08-01/nginxdeployment/id_nginxdeployment.go @@ -36,19 +36,9 @@ func ParseNginxDeploymentID(input string) (*NginxDeploymentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NginxDeploymentId{} - - 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.NginxDeploymentName, ok = parsed.Parsed["nginxDeploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nginxDeploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNginxDeploymentIDInsensitively(input string) (*NginxDeploymentId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NginxDeploymentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NginxDeploymentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NginxDeploymentName, ok = parsed.Parsed["nginxDeploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nginxDeploymentName", *parsed) + if id.NginxDeploymentName, ok = input.Parsed["nginxDeploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "nginxDeploymentName", input) } - return &id, nil + return nil } // ValidateNginxDeploymentID checks that 'input' can be parsed as a Nginx Deployment ID diff --git a/resource-manager/nginx/2023-04-01/nginxcertificate/id_certificate.go b/resource-manager/nginx/2023-04-01/nginxcertificate/id_certificate.go index 4d6f53b5b26..fedae0413df 100644 --- a/resource-manager/nginx/2023-04-01/nginxcertificate/id_certificate.go +++ b/resource-manager/nginx/2023-04-01/nginxcertificate/id_certificate.go @@ -38,23 +38,9 @@ func ParseCertificateID(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} - - 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.NginxDeploymentName, ok = parsed.Parsed["nginxDeploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nginxDeploymentName", *parsed) - } - - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCertificateIDInsensitively(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NginxDeploymentName, ok = parsed.Parsed["nginxDeploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nginxDeploymentName", *parsed) + if id.NginxDeploymentName, ok = input.Parsed["nginxDeploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "nginxDeploymentName", input) } - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if id.CertificateName, ok = input.Parsed["certificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateName", input) } - return &id, nil + return nil } // ValidateCertificateID checks that 'input' can be parsed as a Certificate ID diff --git a/resource-manager/nginx/2023-04-01/nginxcertificate/id_nginxdeployment.go b/resource-manager/nginx/2023-04-01/nginxcertificate/id_nginxdeployment.go index ad8f96db489..98ca5db8fa9 100644 --- a/resource-manager/nginx/2023-04-01/nginxcertificate/id_nginxdeployment.go +++ b/resource-manager/nginx/2023-04-01/nginxcertificate/id_nginxdeployment.go @@ -36,19 +36,9 @@ func ParseNginxDeploymentID(input string) (*NginxDeploymentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NginxDeploymentId{} - - 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.NginxDeploymentName, ok = parsed.Parsed["nginxDeploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nginxDeploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNginxDeploymentIDInsensitively(input string) (*NginxDeploymentId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NginxDeploymentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NginxDeploymentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NginxDeploymentName, ok = parsed.Parsed["nginxDeploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nginxDeploymentName", *parsed) + if id.NginxDeploymentName, ok = input.Parsed["nginxDeploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "nginxDeploymentName", input) } - return &id, nil + return nil } // ValidateNginxDeploymentID checks that 'input' can be parsed as a Nginx Deployment ID diff --git a/resource-manager/nginx/2023-04-01/nginxconfiguration/id_configuration.go b/resource-manager/nginx/2023-04-01/nginxconfiguration/id_configuration.go index 7a3131a1eaf..ac4c2d0cbdb 100644 --- a/resource-manager/nginx/2023-04-01/nginxconfiguration/id_configuration.go +++ b/resource-manager/nginx/2023-04-01/nginxconfiguration/id_configuration.go @@ -38,23 +38,9 @@ func ParseConfigurationID(input string) (*ConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationId{} - - 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.NginxDeploymentName, ok = parsed.Parsed["nginxDeploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nginxDeploymentName", *parsed) - } - - if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConfigurationIDInsensitively(input string) (*ConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NginxDeploymentName, ok = parsed.Parsed["nginxDeploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nginxDeploymentName", *parsed) + if id.NginxDeploymentName, ok = input.Parsed["nginxDeploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "nginxDeploymentName", input) } - if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationName", *parsed) + if id.ConfigurationName, ok = input.Parsed["configurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationName", input) } - return &id, nil + return nil } // ValidateConfigurationID checks that 'input' can be parsed as a Configuration ID diff --git a/resource-manager/nginx/2023-04-01/nginxconfiguration/id_nginxdeployment.go b/resource-manager/nginx/2023-04-01/nginxconfiguration/id_nginxdeployment.go index ab125d9e6ca..dc4f3640508 100644 --- a/resource-manager/nginx/2023-04-01/nginxconfiguration/id_nginxdeployment.go +++ b/resource-manager/nginx/2023-04-01/nginxconfiguration/id_nginxdeployment.go @@ -36,19 +36,9 @@ func ParseNginxDeploymentID(input string) (*NginxDeploymentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NginxDeploymentId{} - - 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.NginxDeploymentName, ok = parsed.Parsed["nginxDeploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nginxDeploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNginxDeploymentIDInsensitively(input string) (*NginxDeploymentId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NginxDeploymentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NginxDeploymentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NginxDeploymentName, ok = parsed.Parsed["nginxDeploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nginxDeploymentName", *parsed) + if id.NginxDeploymentName, ok = input.Parsed["nginxDeploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "nginxDeploymentName", input) } - return &id, nil + return nil } // ValidateNginxDeploymentID checks that 'input' can be parsed as a Nginx Deployment ID diff --git a/resource-manager/nginx/2023-04-01/nginxdeployment/id_nginxdeployment.go b/resource-manager/nginx/2023-04-01/nginxdeployment/id_nginxdeployment.go index bd5eb587fac..159775a4f8c 100644 --- a/resource-manager/nginx/2023-04-01/nginxdeployment/id_nginxdeployment.go +++ b/resource-manager/nginx/2023-04-01/nginxdeployment/id_nginxdeployment.go @@ -36,19 +36,9 @@ func ParseNginxDeploymentID(input string) (*NginxDeploymentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NginxDeploymentId{} - - 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.NginxDeploymentName, ok = parsed.Parsed["nginxDeploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nginxDeploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNginxDeploymentIDInsensitively(input string) (*NginxDeploymentId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NginxDeploymentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NginxDeploymentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NginxDeploymentName, ok = parsed.Parsed["nginxDeploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nginxDeploymentName", *parsed) + if id.NginxDeploymentName, ok = input.Parsed["nginxDeploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "nginxDeploymentName", input) } - return &id, nil + return nil } // ValidateNginxDeploymentID checks that 'input' can be parsed as a Nginx Deployment ID diff --git a/resource-manager/notificationhubs/2017-04-01/namespaces/id_authorizationrule.go b/resource-manager/notificationhubs/2017-04-01/namespaces/id_authorizationrule.go index 521d93c802c..f2ee82f7d2d 100644 --- a/resource-manager/notificationhubs/2017-04-01/namespaces/id_authorizationrule.go +++ b/resource-manager/notificationhubs/2017-04-01/namespaces/id_authorizationrule.go @@ -38,23 +38,9 @@ func ParseAuthorizationRuleID(input string) (*AuthorizationRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationRuleId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAuthorizationRuleIDInsensitively(input string) (*AuthorizationRuleId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AuthorizationRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if id.AuthorizationRuleName, ok = input.Parsed["authorizationRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", input) } - return &id, nil + return nil } // ValidateAuthorizationRuleID checks that 'input' can be parsed as a Authorization Rule ID diff --git a/resource-manager/notificationhubs/2017-04-01/namespaces/id_namespace.go b/resource-manager/notificationhubs/2017-04-01/namespaces/id_namespace.go index 1eddd491afa..b3824b1b309 100644 --- a/resource-manager/notificationhubs/2017-04-01/namespaces/id_namespace.go +++ b/resource-manager/notificationhubs/2017-04-01/namespaces/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/notificationhubs/2017-04-01/notificationhubs/id_namespace.go b/resource-manager/notificationhubs/2017-04-01/notificationhubs/id_namespace.go index 28ee3695959..cf50e60f784 100644 --- a/resource-manager/notificationhubs/2017-04-01/notificationhubs/id_namespace.go +++ b/resource-manager/notificationhubs/2017-04-01/notificationhubs/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/notificationhubs/2017-04-01/notificationhubs/id_notificationhub.go b/resource-manager/notificationhubs/2017-04-01/notificationhubs/id_notificationhub.go index 1204bec2b63..f3744b63071 100644 --- a/resource-manager/notificationhubs/2017-04-01/notificationhubs/id_notificationhub.go +++ b/resource-manager/notificationhubs/2017-04-01/notificationhubs/id_notificationhub.go @@ -38,23 +38,9 @@ func ParseNotificationHubID(input string) (*NotificationHubId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NotificationHubId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.NotificationHubName, ok = parsed.Parsed["notificationHubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationHubName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseNotificationHubIDInsensitively(input string) (*NotificationHubId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NotificationHubId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *NotificationHubId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.NotificationHubName, ok = parsed.Parsed["notificationHubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationHubName", *parsed) + if id.NotificationHubName, ok = input.Parsed["notificationHubName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "notificationHubName", input) } - return &id, nil + return nil } // ValidateNotificationHubID checks that 'input' can be parsed as a Notification Hub ID diff --git a/resource-manager/notificationhubs/2017-04-01/notificationhubs/id_notificationhubauthorizationrule.go b/resource-manager/notificationhubs/2017-04-01/notificationhubs/id_notificationhubauthorizationrule.go index 97ee7b6b3ba..ca7d31d6d91 100644 --- a/resource-manager/notificationhubs/2017-04-01/notificationhubs/id_notificationhubauthorizationrule.go +++ b/resource-manager/notificationhubs/2017-04-01/notificationhubs/id_notificationhubauthorizationrule.go @@ -40,27 +40,9 @@ func ParseNotificationHubAuthorizationRuleID(input string) (*NotificationHubAuth return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NotificationHubAuthorizationRuleId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.NotificationHubName, ok = parsed.Parsed["notificationHubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationHubName", *parsed) - } - - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseNotificationHubAuthorizationRuleIDInsensitively(input string) (*Notifi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NotificationHubAuthorizationRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *NotificationHubAuthorizationRuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.NotificationHubName, ok = parsed.Parsed["notificationHubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationHubName", *parsed) + if id.NotificationHubName, ok = input.Parsed["notificationHubName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "notificationHubName", input) } - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if id.AuthorizationRuleName, ok = input.Parsed["authorizationRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", input) } - return &id, nil + return nil } // ValidateNotificationHubAuthorizationRuleID checks that 'input' can be parsed as a Notification Hub Authorization Rule ID diff --git a/resource-manager/notificationhubs/2023-09-01/hubs/id_namespace.go b/resource-manager/notificationhubs/2023-09-01/hubs/id_namespace.go index 996ec8ea275..60d62d1d706 100644 --- a/resource-manager/notificationhubs/2023-09-01/hubs/id_namespace.go +++ b/resource-manager/notificationhubs/2023-09-01/hubs/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/notificationhubs/2023-09-01/hubs/id_notificationhub.go b/resource-manager/notificationhubs/2023-09-01/hubs/id_notificationhub.go index d53050fddde..e876ff7cfe0 100644 --- a/resource-manager/notificationhubs/2023-09-01/hubs/id_notificationhub.go +++ b/resource-manager/notificationhubs/2023-09-01/hubs/id_notificationhub.go @@ -38,23 +38,9 @@ func ParseNotificationHubID(input string) (*NotificationHubId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NotificationHubId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.NotificationHubName, ok = parsed.Parsed["notificationHubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationHubName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseNotificationHubIDInsensitively(input string) (*NotificationHubId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NotificationHubId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *NotificationHubId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.NotificationHubName, ok = parsed.Parsed["notificationHubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationHubName", *parsed) + if id.NotificationHubName, ok = input.Parsed["notificationHubName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "notificationHubName", input) } - return &id, nil + return nil } // ValidateNotificationHubID checks that 'input' can be parsed as a Notification Hub ID diff --git a/resource-manager/notificationhubs/2023-09-01/hubs/id_notificationhubauthorizationrule.go b/resource-manager/notificationhubs/2023-09-01/hubs/id_notificationhubauthorizationrule.go index d40fc89089d..7b0a91b6a4c 100644 --- a/resource-manager/notificationhubs/2023-09-01/hubs/id_notificationhubauthorizationrule.go +++ b/resource-manager/notificationhubs/2023-09-01/hubs/id_notificationhubauthorizationrule.go @@ -40,27 +40,9 @@ func ParseNotificationHubAuthorizationRuleID(input string) (*NotificationHubAuth return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NotificationHubAuthorizationRuleId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.NotificationHubName, ok = parsed.Parsed["notificationHubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationHubName", *parsed) - } - - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseNotificationHubAuthorizationRuleIDInsensitively(input string) (*Notifi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NotificationHubAuthorizationRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *NotificationHubAuthorizationRuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.NotificationHubName, ok = parsed.Parsed["notificationHubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "notificationHubName", *parsed) + if id.NotificationHubName, ok = input.Parsed["notificationHubName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "notificationHubName", input) } - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if id.AuthorizationRuleName, ok = input.Parsed["authorizationRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", input) } - return &id, nil + return nil } // ValidateNotificationHubAuthorizationRuleID checks that 'input' can be parsed as a Notification Hub Authorization Rule ID diff --git a/resource-manager/notificationhubs/2023-09-01/namespaces/id_authorizationrule.go b/resource-manager/notificationhubs/2023-09-01/namespaces/id_authorizationrule.go index 521d93c802c..f2ee82f7d2d 100644 --- a/resource-manager/notificationhubs/2023-09-01/namespaces/id_authorizationrule.go +++ b/resource-manager/notificationhubs/2023-09-01/namespaces/id_authorizationrule.go @@ -38,23 +38,9 @@ func ParseAuthorizationRuleID(input string) (*AuthorizationRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationRuleId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAuthorizationRuleIDInsensitively(input string) (*AuthorizationRuleId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AuthorizationRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if id.AuthorizationRuleName, ok = input.Parsed["authorizationRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", input) } - return &id, nil + return nil } // ValidateAuthorizationRuleID checks that 'input' can be parsed as a Authorization Rule ID diff --git a/resource-manager/notificationhubs/2023-09-01/namespaces/id_namespace.go b/resource-manager/notificationhubs/2023-09-01/namespaces/id_namespace.go index 1eddd491afa..b3824b1b309 100644 --- a/resource-manager/notificationhubs/2023-09-01/namespaces/id_namespace.go +++ b/resource-manager/notificationhubs/2023-09-01/namespaces/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/notificationhubs/2023-09-01/privatelink/id_namespace.go b/resource-manager/notificationhubs/2023-09-01/privatelink/id_namespace.go index 0b21b4d4831..34943e8905f 100644 --- a/resource-manager/notificationhubs/2023-09-01/privatelink/id_namespace.go +++ b/resource-manager/notificationhubs/2023-09-01/privatelink/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/notificationhubs/2023-09-01/privatelink/id_privateendpointconnection.go b/resource-manager/notificationhubs/2023-09-01/privatelink/id_privateendpointconnection.go index 8ff63e5cfbe..912eec6f12e 100644 --- a/resource-manager/notificationhubs/2023-09-01/privatelink/id_privateendpointconnection.go +++ b/resource-manager/notificationhubs/2023-09-01/privatelink/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/notificationhubs/2023-09-01/privatelink/id_privatelinkresource.go b/resource-manager/notificationhubs/2023-09-01/privatelink/id_privatelinkresource.go index e17b627fdf2..6b4eff0870f 100644 --- a/resource-manager/notificationhubs/2023-09-01/privatelink/id_privatelinkresource.go +++ b/resource-manager/notificationhubs/2023-09-01/privatelink/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/operationalinsights/2019-09-01/querypackqueries/id_query.go b/resource-manager/operationalinsights/2019-09-01/querypackqueries/id_query.go index 053747e6db0..d729b8f7aa4 100644 --- a/resource-manager/operationalinsights/2019-09-01/querypackqueries/id_query.go +++ b/resource-manager/operationalinsights/2019-09-01/querypackqueries/id_query.go @@ -38,23 +38,9 @@ func ParseQueryID(input string) (*QueryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QueryId{} - - 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.QueryPackName, ok = parsed.Parsed["queryPackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "queryPackName", *parsed) - } - - if id.QueryName, ok = parsed.Parsed["queryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "queryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseQueryIDInsensitively(input string) (*QueryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QueryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *QueryId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.QueryPackName, ok = parsed.Parsed["queryPackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "queryPackName", *parsed) + if id.QueryPackName, ok = input.Parsed["queryPackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "queryPackName", input) } - if id.QueryName, ok = parsed.Parsed["queryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "queryName", *parsed) + if id.QueryName, ok = input.Parsed["queryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "queryName", input) } - return &id, nil + return nil } // ValidateQueryID checks that 'input' can be parsed as a Query ID diff --git a/resource-manager/operationalinsights/2019-09-01/querypackqueries/id_querypack.go b/resource-manager/operationalinsights/2019-09-01/querypackqueries/id_querypack.go index 7763d8f5094..2d7b4e9bfd8 100644 --- a/resource-manager/operationalinsights/2019-09-01/querypackqueries/id_querypack.go +++ b/resource-manager/operationalinsights/2019-09-01/querypackqueries/id_querypack.go @@ -36,19 +36,9 @@ func ParseQueryPackID(input string) (*QueryPackId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QueryPackId{} - - 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.QueryPackName, ok = parsed.Parsed["queryPackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "queryPackName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseQueryPackIDInsensitively(input string) (*QueryPackId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QueryPackId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *QueryPackId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.QueryPackName, ok = parsed.Parsed["queryPackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "queryPackName", *parsed) + if id.QueryPackName, ok = input.Parsed["queryPackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "queryPackName", input) } - return &id, nil + return nil } // ValidateQueryPackID checks that 'input' can be parsed as a Query Pack ID diff --git a/resource-manager/operationalinsights/2019-09-01/querypacks/id_querypack.go b/resource-manager/operationalinsights/2019-09-01/querypacks/id_querypack.go index ef50ff29b40..287dd7ae875 100644 --- a/resource-manager/operationalinsights/2019-09-01/querypacks/id_querypack.go +++ b/resource-manager/operationalinsights/2019-09-01/querypacks/id_querypack.go @@ -36,19 +36,9 @@ func ParseQueryPackID(input string) (*QueryPackId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QueryPackId{} - - 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.QueryPackName, ok = parsed.Parsed["queryPackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "queryPackName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseQueryPackIDInsensitively(input string) (*QueryPackId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QueryPackId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *QueryPackId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.QueryPackName, ok = parsed.Parsed["queryPackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "queryPackName", *parsed) + if id.QueryPackName, ok = input.Parsed["queryPackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "queryPackName", input) } - return &id, nil + return nil } // ValidateQueryPackID checks that 'input' can be parsed as a Query Pack ID diff --git a/resource-manager/operationalinsights/2020-08-01/availableservicetiers/id_workspace.go b/resource-manager/operationalinsights/2020-08-01/availableservicetiers/id_workspace.go index f1f522c320f..572963c3562 100644 --- a/resource-manager/operationalinsights/2020-08-01/availableservicetiers/id_workspace.go +++ b/resource-manager/operationalinsights/2020-08-01/availableservicetiers/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/operationalinsights/2020-08-01/clusters/id_cluster.go b/resource-manager/operationalinsights/2020-08-01/clusters/id_cluster.go index c1ac2c07ed1..d87cbd6e769 100644 --- a/resource-manager/operationalinsights/2020-08-01/clusters/id_cluster.go +++ b/resource-manager/operationalinsights/2020-08-01/clusters/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/operationalinsights/2020-08-01/dataexport/id_dataexport.go b/resource-manager/operationalinsights/2020-08-01/dataexport/id_dataexport.go index 7d26a6a6fa3..4100d83f16f 100644 --- a/resource-manager/operationalinsights/2020-08-01/dataexport/id_dataexport.go +++ b/resource-manager/operationalinsights/2020-08-01/dataexport/id_dataexport.go @@ -38,23 +38,9 @@ func ParseDataExportID(input string) (*DataExportId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataExportId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.DataExportName, ok = parsed.Parsed["dataExportName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataExportName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDataExportIDInsensitively(input string) (*DataExportId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataExportId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DataExportId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.DataExportName, ok = parsed.Parsed["dataExportName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataExportName", *parsed) + if id.DataExportName, ok = input.Parsed["dataExportName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataExportName", input) } - return &id, nil + return nil } // ValidateDataExportID checks that 'input' can be parsed as a Data Export ID diff --git a/resource-manager/operationalinsights/2020-08-01/dataexport/id_workspace.go b/resource-manager/operationalinsights/2020-08-01/dataexport/id_workspace.go index cec9837159c..9ad90d67518 100644 --- a/resource-manager/operationalinsights/2020-08-01/dataexport/id_workspace.go +++ b/resource-manager/operationalinsights/2020-08-01/dataexport/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/operationalinsights/2020-08-01/datasources/id_datasource.go b/resource-manager/operationalinsights/2020-08-01/datasources/id_datasource.go index e8ec25bcd23..ea05d4c1663 100644 --- a/resource-manager/operationalinsights/2020-08-01/datasources/id_datasource.go +++ b/resource-manager/operationalinsights/2020-08-01/datasources/id_datasource.go @@ -38,23 +38,9 @@ func ParseDataSourceID(input string) (*DataSourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataSourceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.DataSourceName, ok = parsed.Parsed["dataSourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataSourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDataSourceIDInsensitively(input string) (*DataSourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataSourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DataSourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.DataSourceName, ok = parsed.Parsed["dataSourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataSourceName", *parsed) + if id.DataSourceName, ok = input.Parsed["dataSourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataSourceName", input) } - return &id, nil + return nil } // ValidateDataSourceID checks that 'input' can be parsed as a Data Source ID diff --git a/resource-manager/operationalinsights/2020-08-01/datasources/id_workspace.go b/resource-manager/operationalinsights/2020-08-01/datasources/id_workspace.go index 2a37fcd6fe2..4c7ecbd55b3 100644 --- a/resource-manager/operationalinsights/2020-08-01/datasources/id_workspace.go +++ b/resource-manager/operationalinsights/2020-08-01/datasources/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/operationalinsights/2020-08-01/intelligencepacks/id_intelligencepack.go b/resource-manager/operationalinsights/2020-08-01/intelligencepacks/id_intelligencepack.go index 072bfa58a4f..c01986cb069 100644 --- a/resource-manager/operationalinsights/2020-08-01/intelligencepacks/id_intelligencepack.go +++ b/resource-manager/operationalinsights/2020-08-01/intelligencepacks/id_intelligencepack.go @@ -38,23 +38,9 @@ func ParseIntelligencePackID(input string) (*IntelligencePackId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IntelligencePackId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IntelligencePackName, ok = parsed.Parsed["intelligencePackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "intelligencePackName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIntelligencePackIDInsensitively(input string) (*IntelligencePackId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IntelligencePackId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IntelligencePackId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IntelligencePackName, ok = parsed.Parsed["intelligencePackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "intelligencePackName", *parsed) + if id.IntelligencePackName, ok = input.Parsed["intelligencePackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "intelligencePackName", input) } - return &id, nil + return nil } // ValidateIntelligencePackID checks that 'input' can be parsed as a Intelligence Pack ID diff --git a/resource-manager/operationalinsights/2020-08-01/intelligencepacks/id_workspace.go b/resource-manager/operationalinsights/2020-08-01/intelligencepacks/id_workspace.go index d8d62c1ec7d..5802c22fe41 100644 --- a/resource-manager/operationalinsights/2020-08-01/intelligencepacks/id_workspace.go +++ b/resource-manager/operationalinsights/2020-08-01/intelligencepacks/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/operationalinsights/2020-08-01/linkedservices/id_linkedservice.go b/resource-manager/operationalinsights/2020-08-01/linkedservices/id_linkedservice.go index da344f5ca42..dda349a6660 100644 --- a/resource-manager/operationalinsights/2020-08-01/linkedservices/id_linkedservice.go +++ b/resource-manager/operationalinsights/2020-08-01/linkedservices/id_linkedservice.go @@ -38,23 +38,9 @@ func ParseLinkedServiceID(input string) (*LinkedServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LinkedServiceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.LinkedServiceName, ok = parsed.Parsed["linkedServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "linkedServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLinkedServiceIDInsensitively(input string) (*LinkedServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LinkedServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LinkedServiceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.LinkedServiceName, ok = parsed.Parsed["linkedServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "linkedServiceName", *parsed) + if id.LinkedServiceName, ok = input.Parsed["linkedServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "linkedServiceName", input) } - return &id, nil + return nil } // ValidateLinkedServiceID checks that 'input' can be parsed as a Linked Service ID diff --git a/resource-manager/operationalinsights/2020-08-01/linkedservices/id_workspace.go b/resource-manager/operationalinsights/2020-08-01/linkedservices/id_workspace.go index 3762a7ba8f5..5c55053c3a3 100644 --- a/resource-manager/operationalinsights/2020-08-01/linkedservices/id_workspace.go +++ b/resource-manager/operationalinsights/2020-08-01/linkedservices/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/operationalinsights/2020-08-01/linkedstorageaccounts/id_datasourcetype.go b/resource-manager/operationalinsights/2020-08-01/linkedstorageaccounts/id_datasourcetype.go index 1bd4a05c633..a231c9e1bf3 100644 --- a/resource-manager/operationalinsights/2020-08-01/linkedstorageaccounts/id_datasourcetype.go +++ b/resource-manager/operationalinsights/2020-08-01/linkedstorageaccounts/id_datasourcetype.go @@ -38,31 +38,9 @@ func ParseDataSourceTypeID(input string) (*DataSourceTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataSourceTypeId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if v, ok := parsed.Parsed["dataSourceType"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataSourceType", *parsed) - } - - dataSourceType, err := parseDataSourceType(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.DataSourceType = *dataSourceType + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -77,34 +55,42 @@ func ParseDataSourceTypeIDInsensitively(input string) (*DataSourceTypeId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataSourceTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DataSourceTypeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if v, ok := parsed.Parsed["dataSourceType"]; true { + if v, ok := input.Parsed["dataSourceType"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataSourceType", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "dataSourceType", input) } dataSourceType, err := parseDataSourceType(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.DataSourceType = *dataSourceType } - return &id, nil + return nil } // ValidateDataSourceTypeID checks that 'input' can be parsed as a Data Source Type ID diff --git a/resource-manager/operationalinsights/2020-08-01/linkedstorageaccounts/id_workspace.go b/resource-manager/operationalinsights/2020-08-01/linkedstorageaccounts/id_workspace.go index 06b07396b15..bb97dbb2bda 100644 --- a/resource-manager/operationalinsights/2020-08-01/linkedstorageaccounts/id_workspace.go +++ b/resource-manager/operationalinsights/2020-08-01/linkedstorageaccounts/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/operationalinsights/2020-08-01/savedsearches/id_savedsearch.go b/resource-manager/operationalinsights/2020-08-01/savedsearches/id_savedsearch.go index 2b4c59de1e5..9abbca51a60 100644 --- a/resource-manager/operationalinsights/2020-08-01/savedsearches/id_savedsearch.go +++ b/resource-manager/operationalinsights/2020-08-01/savedsearches/id_savedsearch.go @@ -38,23 +38,9 @@ func ParseSavedSearchID(input string) (*SavedSearchId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SavedSearchId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.SavedSearchId, ok = parsed.Parsed["savedSearchId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "savedSearchId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSavedSearchIDInsensitively(input string) (*SavedSearchId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SavedSearchId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SavedSearchId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.SavedSearchId, ok = parsed.Parsed["savedSearchId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "savedSearchId", *parsed) + if id.SavedSearchId, ok = input.Parsed["savedSearchId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "savedSearchId", input) } - return &id, nil + return nil } // ValidateSavedSearchID checks that 'input' can be parsed as a Saved Search ID diff --git a/resource-manager/operationalinsights/2020-08-01/savedsearches/id_workspace.go b/resource-manager/operationalinsights/2020-08-01/savedsearches/id_workspace.go index 94ac6d69eca..940760cbc7f 100644 --- a/resource-manager/operationalinsights/2020-08-01/savedsearches/id_workspace.go +++ b/resource-manager/operationalinsights/2020-08-01/savedsearches/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/operationalinsights/2020-08-01/storageinsights/id_storageinsightconfig.go b/resource-manager/operationalinsights/2020-08-01/storageinsights/id_storageinsightconfig.go index 495e236211b..68f7df9b886 100644 --- a/resource-manager/operationalinsights/2020-08-01/storageinsights/id_storageinsightconfig.go +++ b/resource-manager/operationalinsights/2020-08-01/storageinsights/id_storageinsightconfig.go @@ -38,23 +38,9 @@ func ParseStorageInsightConfigID(input string) (*StorageInsightConfigId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageInsightConfigId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.StorageInsightConfigName, ok = parsed.Parsed["storageInsightConfigName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageInsightConfigName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseStorageInsightConfigIDInsensitively(input string) (*StorageInsightConf return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageInsightConfigId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *StorageInsightConfigId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.StorageInsightConfigName, ok = parsed.Parsed["storageInsightConfigName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageInsightConfigName", *parsed) + if id.StorageInsightConfigName, ok = input.Parsed["storageInsightConfigName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageInsightConfigName", input) } - return &id, nil + return nil } // ValidateStorageInsightConfigID checks that 'input' can be parsed as a Storage Insight Config ID diff --git a/resource-manager/operationalinsights/2020-08-01/storageinsights/id_workspace.go b/resource-manager/operationalinsights/2020-08-01/storageinsights/id_workspace.go index bbbd6239380..6bb83125763 100644 --- a/resource-manager/operationalinsights/2020-08-01/storageinsights/id_workspace.go +++ b/resource-manager/operationalinsights/2020-08-01/storageinsights/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/operationalinsights/2020-08-01/tables/id_table.go b/resource-manager/operationalinsights/2020-08-01/tables/id_table.go index e39cc33ed4f..43b615488db 100644 --- a/resource-manager/operationalinsights/2020-08-01/tables/id_table.go +++ b/resource-manager/operationalinsights/2020-08-01/tables/id_table.go @@ -38,23 +38,9 @@ func ParseTableID(input string) (*TableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TableId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTableIDInsensitively(input string) (*TableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TableId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if id.TableName, ok = input.Parsed["tableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tableName", input) } - return &id, nil + return nil } // ValidateTableID checks that 'input' can be parsed as a Table ID diff --git a/resource-manager/operationalinsights/2020-08-01/tables/id_workspace.go b/resource-manager/operationalinsights/2020-08-01/tables/id_workspace.go index 49a90ec8a22..faa86da9be1 100644 --- a/resource-manager/operationalinsights/2020-08-01/tables/id_workspace.go +++ b/resource-manager/operationalinsights/2020-08-01/tables/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/operationalinsights/2020-08-01/workspaces/id_gateway.go b/resource-manager/operationalinsights/2020-08-01/workspaces/id_gateway.go index 527fb24cf2d..a59c574ed57 100644 --- a/resource-manager/operationalinsights/2020-08-01/workspaces/id_gateway.go +++ b/resource-manager/operationalinsights/2020-08-01/workspaces/id_gateway.go @@ -38,23 +38,9 @@ func ParseGatewayID(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGatewayIDInsensitively(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GatewayId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if id.GatewayId, ok = input.Parsed["gatewayId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", input) } - return &id, nil + return nil } // ValidateGatewayID checks that 'input' can be parsed as a Gateway ID diff --git a/resource-manager/operationalinsights/2020-08-01/workspaces/id_intelligencepack.go b/resource-manager/operationalinsights/2020-08-01/workspaces/id_intelligencepack.go index 102fc88c7a1..d8839c8d39b 100644 --- a/resource-manager/operationalinsights/2020-08-01/workspaces/id_intelligencepack.go +++ b/resource-manager/operationalinsights/2020-08-01/workspaces/id_intelligencepack.go @@ -38,23 +38,9 @@ func ParseIntelligencePackID(input string) (*IntelligencePackId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IntelligencePackId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IntelligencePackName, ok = parsed.Parsed["intelligencePackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "intelligencePackName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIntelligencePackIDInsensitively(input string) (*IntelligencePackId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IntelligencePackId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IntelligencePackId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IntelligencePackName, ok = parsed.Parsed["intelligencePackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "intelligencePackName", *parsed) + if id.IntelligencePackName, ok = input.Parsed["intelligencePackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "intelligencePackName", input) } - return &id, nil + return nil } // ValidateIntelligencePackID checks that 'input' can be parsed as a Intelligence Pack ID diff --git a/resource-manager/operationalinsights/2020-08-01/workspaces/id_operation.go b/resource-manager/operationalinsights/2020-08-01/workspaces/id_operation.go index bb10ceb91c9..11e6f0ee6e3 100644 --- a/resource-manager/operationalinsights/2020-08-01/workspaces/id_operation.go +++ b/resource-manager/operationalinsights/2020-08-01/workspaces/id_operation.go @@ -38,23 +38,9 @@ func ParseOperationID(input string) (*OperationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.PurgeId, ok = parsed.Parsed["purgeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "purgeId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseOperationIDInsensitively(input string) (*OperationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OperationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.PurgeId, ok = parsed.Parsed["purgeId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "purgeId", *parsed) + if id.PurgeId, ok = input.Parsed["purgeId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "purgeId", input) } - return &id, nil + return nil } // ValidateOperationID checks that 'input' can be parsed as a Operation ID diff --git a/resource-manager/operationalinsights/2020-08-01/workspaces/id_workspace.go b/resource-manager/operationalinsights/2020-08-01/workspaces/id_workspace.go index 9836aaf5b26..005b06a756d 100644 --- a/resource-manager/operationalinsights/2020-08-01/workspaces/id_workspace.go +++ b/resource-manager/operationalinsights/2020-08-01/workspaces/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/operationalinsights/2021-06-01/clusters/id_cluster.go b/resource-manager/operationalinsights/2021-06-01/clusters/id_cluster.go index c1ac2c07ed1..d87cbd6e769 100644 --- a/resource-manager/operationalinsights/2021-06-01/clusters/id_cluster.go +++ b/resource-manager/operationalinsights/2021-06-01/clusters/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/operationalinsights/2021-06-01/workspaces/id_workspace.go b/resource-manager/operationalinsights/2021-06-01/workspaces/id_workspace.go index 9836aaf5b26..005b06a756d 100644 --- a/resource-manager/operationalinsights/2021-06-01/workspaces/id_workspace.go +++ b/resource-manager/operationalinsights/2021-06-01/workspaces/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/operationalinsights/2022-10-01/tables/id_table.go b/resource-manager/operationalinsights/2022-10-01/tables/id_table.go index e39cc33ed4f..43b615488db 100644 --- a/resource-manager/operationalinsights/2022-10-01/tables/id_table.go +++ b/resource-manager/operationalinsights/2022-10-01/tables/id_table.go @@ -38,23 +38,9 @@ func ParseTableID(input string) (*TableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TableId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTableIDInsensitively(input string) (*TableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TableId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if id.TableName, ok = input.Parsed["tableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tableName", input) } - return &id, nil + return nil } // ValidateTableID checks that 'input' can be parsed as a Table ID diff --git a/resource-manager/operationalinsights/2022-10-01/tables/id_workspace.go b/resource-manager/operationalinsights/2022-10-01/tables/id_workspace.go index 49a90ec8a22..faa86da9be1 100644 --- a/resource-manager/operationalinsights/2022-10-01/tables/id_workspace.go +++ b/resource-manager/operationalinsights/2022-10-01/tables/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/operationalinsights/2022-10-01/workspaces/id_workspace.go b/resource-manager/operationalinsights/2022-10-01/workspaces/id_workspace.go index 9836aaf5b26..005b06a756d 100644 --- a/resource-manager/operationalinsights/2022-10-01/workspaces/id_workspace.go +++ b/resource-manager/operationalinsights/2022-10-01/workspaces/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/operationsmanagement/2015-11-01-preview/managementassociation/id_scopedmanagementassociation.go b/resource-manager/operationsmanagement/2015-11-01-preview/managementassociation/id_scopedmanagementassociation.go index 953fda9f3dd..98a1b9f8d81 100644 --- a/resource-manager/operationsmanagement/2015-11-01-preview/managementassociation/id_scopedmanagementassociation.go +++ b/resource-manager/operationsmanagement/2015-11-01-preview/managementassociation/id_scopedmanagementassociation.go @@ -34,15 +34,9 @@ func ParseScopedManagementAssociationID(input string) (*ScopedManagementAssociat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedManagementAssociationId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.ManagementAssociationName, ok = parsed.Parsed["managementAssociationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managementAssociationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedManagementAssociationIDInsensitively(input string) (*ScopedManag return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedManagementAssociationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedManagementAssociationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.ManagementAssociationName, ok = parsed.Parsed["managementAssociationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managementAssociationName", *parsed) + if id.ManagementAssociationName, ok = input.Parsed["managementAssociationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managementAssociationName", input) } - return &id, nil + return nil } // ValidateScopedManagementAssociationID checks that 'input' can be parsed as a Scoped Management Association ID diff --git a/resource-manager/operationsmanagement/2015-11-01-preview/managementconfiguration/id_managementconfiguration.go b/resource-manager/operationsmanagement/2015-11-01-preview/managementconfiguration/id_managementconfiguration.go index 51b58674715..f882c47bf44 100644 --- a/resource-manager/operationsmanagement/2015-11-01-preview/managementconfiguration/id_managementconfiguration.go +++ b/resource-manager/operationsmanagement/2015-11-01-preview/managementconfiguration/id_managementconfiguration.go @@ -36,19 +36,9 @@ func ParseManagementConfigurationID(input string) (*ManagementConfigurationId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagementConfigurationId{} - - 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.ManagementConfigurationName, ok = parsed.Parsed["managementConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managementConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagementConfigurationIDInsensitively(input string) (*ManagementConfi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagementConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagementConfigurationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagementConfigurationName, ok = parsed.Parsed["managementConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managementConfigurationName", *parsed) + if id.ManagementConfigurationName, ok = input.Parsed["managementConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managementConfigurationName", input) } - return &id, nil + return nil } // ValidateManagementConfigurationID checks that 'input' can be parsed as a Management Configuration ID diff --git a/resource-manager/operationsmanagement/2015-11-01-preview/solution/id_solution.go b/resource-manager/operationsmanagement/2015-11-01-preview/solution/id_solution.go index 78d2b342de0..50e1e4a6a32 100644 --- a/resource-manager/operationsmanagement/2015-11-01-preview/solution/id_solution.go +++ b/resource-manager/operationsmanagement/2015-11-01-preview/solution/id_solution.go @@ -36,19 +36,9 @@ func ParseSolutionID(input string) (*SolutionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SolutionId{} - - 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.SolutionName, ok = parsed.Parsed["solutionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "solutionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSolutionIDInsensitively(input string) (*SolutionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SolutionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SolutionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SolutionName, ok = parsed.Parsed["solutionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "solutionName", *parsed) + if id.SolutionName, ok = input.Parsed["solutionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "solutionName", input) } - return &id, nil + return nil } // ValidateSolutionID checks that 'input' can be parsed as a Solution ID diff --git a/resource-manager/orbital/2022-11-01/contact/id_contact.go b/resource-manager/orbital/2022-11-01/contact/id_contact.go index 3ba0c0260d3..e3f3c49abe0 100644 --- a/resource-manager/orbital/2022-11-01/contact/id_contact.go +++ b/resource-manager/orbital/2022-11-01/contact/id_contact.go @@ -38,23 +38,9 @@ func ParseContactID(input string) (*ContactId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContactId{} - - 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.SpacecraftName, ok = parsed.Parsed["spacecraftName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "spacecraftName", *parsed) - } - - if id.ContactName, ok = parsed.Parsed["contactName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "contactName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseContactIDInsensitively(input string) (*ContactId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContactId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ContactId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpacecraftName, ok = parsed.Parsed["spacecraftName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "spacecraftName", *parsed) + if id.SpacecraftName, ok = input.Parsed["spacecraftName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "spacecraftName", input) } - if id.ContactName, ok = parsed.Parsed["contactName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "contactName", *parsed) + if id.ContactName, ok = input.Parsed["contactName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "contactName", input) } - return &id, nil + return nil } // ValidateContactID checks that 'input' can be parsed as a Contact ID diff --git a/resource-manager/orbital/2022-11-01/contact/id_spacecraft.go b/resource-manager/orbital/2022-11-01/contact/id_spacecraft.go index 8eb861c5bf9..05374500aa4 100644 --- a/resource-manager/orbital/2022-11-01/contact/id_spacecraft.go +++ b/resource-manager/orbital/2022-11-01/contact/id_spacecraft.go @@ -36,19 +36,9 @@ func ParseSpacecraftID(input string) (*SpacecraftId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SpacecraftId{} - - 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.SpacecraftName, ok = parsed.Parsed["spacecraftName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "spacecraftName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSpacecraftIDInsensitively(input string) (*SpacecraftId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SpacecraftId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SpacecraftId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpacecraftName, ok = parsed.Parsed["spacecraftName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "spacecraftName", *parsed) + if id.SpacecraftName, ok = input.Parsed["spacecraftName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "spacecraftName", input) } - return &id, nil + return nil } // ValidateSpacecraftID checks that 'input' can be parsed as a Spacecraft ID diff --git a/resource-manager/orbital/2022-11-01/contactprofile/id_contactprofile.go b/resource-manager/orbital/2022-11-01/contactprofile/id_contactprofile.go index 4586037714b..11d09616a46 100644 --- a/resource-manager/orbital/2022-11-01/contactprofile/id_contactprofile.go +++ b/resource-manager/orbital/2022-11-01/contactprofile/id_contactprofile.go @@ -36,19 +36,9 @@ func ParseContactProfileID(input string) (*ContactProfileId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContactProfileId{} - - 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.ContactProfileName, ok = parsed.Parsed["contactProfileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "contactProfileName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseContactProfileIDInsensitively(input string) (*ContactProfileId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContactProfileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ContactProfileId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ContactProfileName, ok = parsed.Parsed["contactProfileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "contactProfileName", *parsed) + if id.ContactProfileName, ok = input.Parsed["contactProfileName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "contactProfileName", input) } - return &id, nil + return nil } // ValidateContactProfileID checks that 'input' can be parsed as a Contact Profile ID diff --git a/resource-manager/orbital/2022-11-01/spacecraft/id_spacecraft.go b/resource-manager/orbital/2022-11-01/spacecraft/id_spacecraft.go index e0e34ffff83..ec488a65935 100644 --- a/resource-manager/orbital/2022-11-01/spacecraft/id_spacecraft.go +++ b/resource-manager/orbital/2022-11-01/spacecraft/id_spacecraft.go @@ -36,19 +36,9 @@ func ParseSpacecraftID(input string) (*SpacecraftId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SpacecraftId{} - - 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.SpacecraftName, ok = parsed.Parsed["spacecraftName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "spacecraftName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSpacecraftIDInsensitively(input string) (*SpacecraftId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SpacecraftId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SpacecraftId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SpacecraftName, ok = parsed.Parsed["spacecraftName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "spacecraftName", *parsed) + if id.SpacecraftName, ok = input.Parsed["spacecraftName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "spacecraftName", input) } - return &id, nil + return nil } // ValidateSpacecraftID checks that 'input' can be parsed as a Spacecraft ID diff --git a/resource-manager/paloaltonetworks/2022-08-29/certificateobjectglobalrulestack/id_certificate.go b/resource-manager/paloaltonetworks/2022-08-29/certificateobjectglobalrulestack/id_certificate.go index e82e0b4e843..0679b5b6867 100644 --- a/resource-manager/paloaltonetworks/2022-08-29/certificateobjectglobalrulestack/id_certificate.go +++ b/resource-manager/paloaltonetworks/2022-08-29/certificateobjectglobalrulestack/id_certificate.go @@ -34,15 +34,9 @@ func ParseCertificateID(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} - - if id.GlobalRulestackName, ok = parsed.Parsed["globalRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", *parsed) - } - - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseCertificateIDInsensitively(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.GlobalRulestackName, ok = parsed.Parsed["globalRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", *parsed) + return &id, nil +} + +func (id *CertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.GlobalRulestackName, ok = input.Parsed["globalRulestackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", input) } - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if id.CertificateName, ok = input.Parsed["certificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateName", input) } - return &id, nil + return nil } // ValidateCertificateID checks that 'input' can be parsed as a Certificate ID diff --git a/resource-manager/paloaltonetworks/2022-08-29/certificateobjectglobalrulestack/id_globalrulestack.go b/resource-manager/paloaltonetworks/2022-08-29/certificateobjectglobalrulestack/id_globalrulestack.go index 090306d87a0..b93138721f7 100644 --- a/resource-manager/paloaltonetworks/2022-08-29/certificateobjectglobalrulestack/id_globalrulestack.go +++ b/resource-manager/paloaltonetworks/2022-08-29/certificateobjectglobalrulestack/id_globalrulestack.go @@ -32,11 +32,9 @@ func ParseGlobalRulestackID(input string) (*GlobalRulestackId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GlobalRulestackId{} - - if id.GlobalRulestackName, ok = parsed.Parsed["globalRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseGlobalRulestackIDInsensitively(input string) (*GlobalRulestackId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GlobalRulestackId{} - - if id.GlobalRulestackName, ok = parsed.Parsed["globalRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *GlobalRulestackId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.GlobalRulestackName, ok = input.Parsed["globalRulestackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", input) + } + + return nil +} + // ValidateGlobalRulestackID checks that 'input' can be parsed as a Global Rulestack ID func ValidateGlobalRulestackID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/paloaltonetworks/2022-08-29/certificateobjectlocalrulestack/id_localrulestack.go b/resource-manager/paloaltonetworks/2022-08-29/certificateobjectlocalrulestack/id_localrulestack.go index 22edb8f8f15..f7c9ca3e513 100644 --- a/resource-manager/paloaltonetworks/2022-08-29/certificateobjectlocalrulestack/id_localrulestack.go +++ b/resource-manager/paloaltonetworks/2022-08-29/certificateobjectlocalrulestack/id_localrulestack.go @@ -36,19 +36,9 @@ func ParseLocalRulestackID(input string) (*LocalRulestackId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocalRulestackId{} - - 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.LocalRulestackName, ok = parsed.Parsed["localRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLocalRulestackIDInsensitively(input string) (*LocalRulestackId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocalRulestackId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LocalRulestackId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocalRulestackName, ok = parsed.Parsed["localRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", *parsed) + if id.LocalRulestackName, ok = input.Parsed["localRulestackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", input) } - return &id, nil + return nil } // ValidateLocalRulestackID checks that 'input' can be parsed as a Local Rulestack ID diff --git a/resource-manager/paloaltonetworks/2022-08-29/certificateobjectlocalrulestack/id_localrulestackcertificate.go b/resource-manager/paloaltonetworks/2022-08-29/certificateobjectlocalrulestack/id_localrulestackcertificate.go index 0113f5a68a1..78f8eebe8b7 100644 --- a/resource-manager/paloaltonetworks/2022-08-29/certificateobjectlocalrulestack/id_localrulestackcertificate.go +++ b/resource-manager/paloaltonetworks/2022-08-29/certificateobjectlocalrulestack/id_localrulestackcertificate.go @@ -38,23 +38,9 @@ func ParseLocalRulestackCertificateID(input string) (*LocalRulestackCertificateI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocalRulestackCertificateId{} - - 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.LocalRulestackName, ok = parsed.Parsed["localRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", *parsed) - } - - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLocalRulestackCertificateIDInsensitively(input string) (*LocalRulestac return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocalRulestackCertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LocalRulestackCertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocalRulestackName, ok = parsed.Parsed["localRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", *parsed) + if id.LocalRulestackName, ok = input.Parsed["localRulestackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", input) } - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if id.CertificateName, ok = input.Parsed["certificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateName", input) } - return &id, nil + return nil } // ValidateLocalRulestackCertificateID checks that 'input' can be parsed as a Local Rulestack Certificate ID diff --git a/resource-manager/paloaltonetworks/2022-08-29/firewalls/id_firewall.go b/resource-manager/paloaltonetworks/2022-08-29/firewalls/id_firewall.go index 2e460652130..b531f7aba3c 100644 --- a/resource-manager/paloaltonetworks/2022-08-29/firewalls/id_firewall.go +++ b/resource-manager/paloaltonetworks/2022-08-29/firewalls/id_firewall.go @@ -36,19 +36,9 @@ func ParseFirewallID(input string) (*FirewallId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallId{} - - 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.FirewallName, ok = parsed.Parsed["firewallName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFirewallIDInsensitively(input string) (*FirewallId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FirewallId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FirewallName, ok = parsed.Parsed["firewallName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallName", *parsed) + if id.FirewallName, ok = input.Parsed["firewallName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "firewallName", input) } - return &id, nil + return nil } // ValidateFirewallID checks that 'input' can be parsed as a Firewall ID diff --git a/resource-manager/paloaltonetworks/2022-08-29/firewallstatus/id_firewall.go b/resource-manager/paloaltonetworks/2022-08-29/firewallstatus/id_firewall.go index 975c7d9c9dd..a45aa650afa 100644 --- a/resource-manager/paloaltonetworks/2022-08-29/firewallstatus/id_firewall.go +++ b/resource-manager/paloaltonetworks/2022-08-29/firewallstatus/id_firewall.go @@ -36,19 +36,9 @@ func ParseFirewallID(input string) (*FirewallId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallId{} - - 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.FirewallName, ok = parsed.Parsed["firewallName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFirewallIDInsensitively(input string) (*FirewallId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FirewallId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FirewallName, ok = parsed.Parsed["firewallName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallName", *parsed) + if id.FirewallName, ok = input.Parsed["firewallName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "firewallName", input) } - return &id, nil + return nil } // ValidateFirewallID checks that 'input' can be parsed as a Firewall ID diff --git a/resource-manager/paloaltonetworks/2022-08-29/fqdnlistglobalrulestack/id_fqdnlist.go b/resource-manager/paloaltonetworks/2022-08-29/fqdnlistglobalrulestack/id_fqdnlist.go index c649e37898f..0427cc7af39 100644 --- a/resource-manager/paloaltonetworks/2022-08-29/fqdnlistglobalrulestack/id_fqdnlist.go +++ b/resource-manager/paloaltonetworks/2022-08-29/fqdnlistglobalrulestack/id_fqdnlist.go @@ -34,15 +34,9 @@ func ParseFqdnListID(input string) (*FqdnListId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FqdnListId{} - - if id.GlobalRulestackName, ok = parsed.Parsed["globalRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", *parsed) - } - - if id.FqdnListName, ok = parsed.Parsed["fqdnListName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fqdnListName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseFqdnListIDInsensitively(input string) (*FqdnListId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FqdnListId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.GlobalRulestackName, ok = parsed.Parsed["globalRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", *parsed) + return &id, nil +} + +func (id *FqdnListId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.GlobalRulestackName, ok = input.Parsed["globalRulestackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", input) } - if id.FqdnListName, ok = parsed.Parsed["fqdnListName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fqdnListName", *parsed) + if id.FqdnListName, ok = input.Parsed["fqdnListName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fqdnListName", input) } - return &id, nil + return nil } // ValidateFqdnListID checks that 'input' can be parsed as a Fqdn List ID diff --git a/resource-manager/paloaltonetworks/2022-08-29/fqdnlistglobalrulestack/id_globalrulestack.go b/resource-manager/paloaltonetworks/2022-08-29/fqdnlistglobalrulestack/id_globalrulestack.go index 42c770e5b8d..bbcd9689098 100644 --- a/resource-manager/paloaltonetworks/2022-08-29/fqdnlistglobalrulestack/id_globalrulestack.go +++ b/resource-manager/paloaltonetworks/2022-08-29/fqdnlistglobalrulestack/id_globalrulestack.go @@ -32,11 +32,9 @@ func ParseGlobalRulestackID(input string) (*GlobalRulestackId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GlobalRulestackId{} - - if id.GlobalRulestackName, ok = parsed.Parsed["globalRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseGlobalRulestackIDInsensitively(input string) (*GlobalRulestackId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GlobalRulestackId{} - - if id.GlobalRulestackName, ok = parsed.Parsed["globalRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *GlobalRulestackId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.GlobalRulestackName, ok = input.Parsed["globalRulestackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", input) + } + + return nil +} + // ValidateGlobalRulestackID checks that 'input' can be parsed as a Global Rulestack ID func ValidateGlobalRulestackID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/paloaltonetworks/2022-08-29/fqdnlistlocalrulestack/id_localrulestack.go b/resource-manager/paloaltonetworks/2022-08-29/fqdnlistlocalrulestack/id_localrulestack.go index dcf74d99154..eb6c8249499 100644 --- a/resource-manager/paloaltonetworks/2022-08-29/fqdnlistlocalrulestack/id_localrulestack.go +++ b/resource-manager/paloaltonetworks/2022-08-29/fqdnlistlocalrulestack/id_localrulestack.go @@ -36,19 +36,9 @@ func ParseLocalRulestackID(input string) (*LocalRulestackId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocalRulestackId{} - - 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.LocalRulestackName, ok = parsed.Parsed["localRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLocalRulestackIDInsensitively(input string) (*LocalRulestackId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocalRulestackId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LocalRulestackId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocalRulestackName, ok = parsed.Parsed["localRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", *parsed) + if id.LocalRulestackName, ok = input.Parsed["localRulestackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", input) } - return &id, nil + return nil } // ValidateLocalRulestackID checks that 'input' can be parsed as a Local Rulestack ID diff --git a/resource-manager/paloaltonetworks/2022-08-29/fqdnlistlocalrulestack/id_localrulestackfqdnlist.go b/resource-manager/paloaltonetworks/2022-08-29/fqdnlistlocalrulestack/id_localrulestackfqdnlist.go index a088885391d..5484ffc44f0 100644 --- a/resource-manager/paloaltonetworks/2022-08-29/fqdnlistlocalrulestack/id_localrulestackfqdnlist.go +++ b/resource-manager/paloaltonetworks/2022-08-29/fqdnlistlocalrulestack/id_localrulestackfqdnlist.go @@ -38,23 +38,9 @@ func ParseLocalRulestackFqdnListID(input string) (*LocalRulestackFqdnListId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocalRulestackFqdnListId{} - - 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.LocalRulestackName, ok = parsed.Parsed["localRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", *parsed) - } - - if id.FqdnListName, ok = parsed.Parsed["fqdnListName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fqdnListName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLocalRulestackFqdnListIDInsensitively(input string) (*LocalRulestackFq return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocalRulestackFqdnListId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LocalRulestackFqdnListId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocalRulestackName, ok = parsed.Parsed["localRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", *parsed) + if id.LocalRulestackName, ok = input.Parsed["localRulestackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", input) } - if id.FqdnListName, ok = parsed.Parsed["fqdnListName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fqdnListName", *parsed) + if id.FqdnListName, ok = input.Parsed["fqdnListName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fqdnListName", input) } - return &id, nil + return nil } // ValidateLocalRulestackFqdnListID checks that 'input' can be parsed as a Local Rulestack Fqdn List ID diff --git a/resource-manager/paloaltonetworks/2022-08-29/globalrulestack/id_globalrulestack.go b/resource-manager/paloaltonetworks/2022-08-29/globalrulestack/id_globalrulestack.go index 9de874ca642..4fad054dd3c 100644 --- a/resource-manager/paloaltonetworks/2022-08-29/globalrulestack/id_globalrulestack.go +++ b/resource-manager/paloaltonetworks/2022-08-29/globalrulestack/id_globalrulestack.go @@ -32,11 +32,9 @@ func ParseGlobalRulestackID(input string) (*GlobalRulestackId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GlobalRulestackId{} - - if id.GlobalRulestackName, ok = parsed.Parsed["globalRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseGlobalRulestackIDInsensitively(input string) (*GlobalRulestackId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GlobalRulestackId{} - - if id.GlobalRulestackName, ok = parsed.Parsed["globalRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *GlobalRulestackId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.GlobalRulestackName, ok = input.Parsed["globalRulestackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", input) + } + + return nil +} + // ValidateGlobalRulestackID checks that 'input' can be parsed as a Global Rulestack ID func ValidateGlobalRulestackID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/paloaltonetworks/2022-08-29/localrules/id_localrule.go b/resource-manager/paloaltonetworks/2022-08-29/localrules/id_localrule.go index 4baa8a275f4..ac5666e081c 100644 --- a/resource-manager/paloaltonetworks/2022-08-29/localrules/id_localrule.go +++ b/resource-manager/paloaltonetworks/2022-08-29/localrules/id_localrule.go @@ -38,23 +38,9 @@ func ParseLocalRuleID(input string) (*LocalRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocalRuleId{} - - 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.LocalRulestackName, ok = parsed.Parsed["localRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", *parsed) - } - - if id.LocalRuleName, ok = parsed.Parsed["localRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLocalRuleIDInsensitively(input string) (*LocalRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocalRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LocalRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocalRulestackName, ok = parsed.Parsed["localRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", *parsed) + if id.LocalRulestackName, ok = input.Parsed["localRulestackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", input) } - if id.LocalRuleName, ok = parsed.Parsed["localRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localRuleName", *parsed) + if id.LocalRuleName, ok = input.Parsed["localRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "localRuleName", input) } - return &id, nil + return nil } // ValidateLocalRuleID checks that 'input' can be parsed as a Local Rule ID diff --git a/resource-manager/paloaltonetworks/2022-08-29/localrules/id_localrulestack.go b/resource-manager/paloaltonetworks/2022-08-29/localrules/id_localrulestack.go index 54f5af9056b..d2598cbdb33 100644 --- a/resource-manager/paloaltonetworks/2022-08-29/localrules/id_localrulestack.go +++ b/resource-manager/paloaltonetworks/2022-08-29/localrules/id_localrulestack.go @@ -36,19 +36,9 @@ func ParseLocalRulestackID(input string) (*LocalRulestackId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocalRulestackId{} - - 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.LocalRulestackName, ok = parsed.Parsed["localRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLocalRulestackIDInsensitively(input string) (*LocalRulestackId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocalRulestackId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LocalRulestackId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocalRulestackName, ok = parsed.Parsed["localRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", *parsed) + if id.LocalRulestackName, ok = input.Parsed["localRulestackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", input) } - return &id, nil + return nil } // ValidateLocalRulestackID checks that 'input' can be parsed as a Local Rulestack ID diff --git a/resource-manager/paloaltonetworks/2022-08-29/localrulestacks/id_localrulestack.go b/resource-manager/paloaltonetworks/2022-08-29/localrulestacks/id_localrulestack.go index 7aaf9d556ac..42ef8ed4d21 100644 --- a/resource-manager/paloaltonetworks/2022-08-29/localrulestacks/id_localrulestack.go +++ b/resource-manager/paloaltonetworks/2022-08-29/localrulestacks/id_localrulestack.go @@ -36,19 +36,9 @@ func ParseLocalRulestackID(input string) (*LocalRulestackId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocalRulestackId{} - - 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.LocalRulestackName, ok = parsed.Parsed["localRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLocalRulestackIDInsensitively(input string) (*LocalRulestackId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocalRulestackId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LocalRulestackId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocalRulestackName, ok = parsed.Parsed["localRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", *parsed) + if id.LocalRulestackName, ok = input.Parsed["localRulestackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", input) } - return &id, nil + return nil } // ValidateLocalRulestackID checks that 'input' can be parsed as a Local Rulestack ID diff --git a/resource-manager/paloaltonetworks/2022-08-29/postrules/id_globalrulestack.go b/resource-manager/paloaltonetworks/2022-08-29/postrules/id_globalrulestack.go index 3c52aa06775..9da5b7060e1 100644 --- a/resource-manager/paloaltonetworks/2022-08-29/postrules/id_globalrulestack.go +++ b/resource-manager/paloaltonetworks/2022-08-29/postrules/id_globalrulestack.go @@ -32,11 +32,9 @@ func ParseGlobalRulestackID(input string) (*GlobalRulestackId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GlobalRulestackId{} - - if id.GlobalRulestackName, ok = parsed.Parsed["globalRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseGlobalRulestackIDInsensitively(input string) (*GlobalRulestackId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GlobalRulestackId{} - - if id.GlobalRulestackName, ok = parsed.Parsed["globalRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *GlobalRulestackId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.GlobalRulestackName, ok = input.Parsed["globalRulestackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", input) + } + + return nil +} + // ValidateGlobalRulestackID checks that 'input' can be parsed as a Global Rulestack ID func ValidateGlobalRulestackID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/paloaltonetworks/2022-08-29/postrules/id_postrule.go b/resource-manager/paloaltonetworks/2022-08-29/postrules/id_postrule.go index 5a4b0b7ac51..6ab38de9423 100644 --- a/resource-manager/paloaltonetworks/2022-08-29/postrules/id_postrule.go +++ b/resource-manager/paloaltonetworks/2022-08-29/postrules/id_postrule.go @@ -34,15 +34,9 @@ func ParsePostRuleID(input string) (*PostRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PostRuleId{} - - if id.GlobalRulestackName, ok = parsed.Parsed["globalRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", *parsed) - } - - if id.PostRuleName, ok = parsed.Parsed["postRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "postRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParsePostRuleIDInsensitively(input string) (*PostRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PostRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.GlobalRulestackName, ok = parsed.Parsed["globalRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", *parsed) + return &id, nil +} + +func (id *PostRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.GlobalRulestackName, ok = input.Parsed["globalRulestackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", input) } - if id.PostRuleName, ok = parsed.Parsed["postRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "postRuleName", *parsed) + if id.PostRuleName, ok = input.Parsed["postRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "postRuleName", input) } - return &id, nil + return nil } // ValidatePostRuleID checks that 'input' can be parsed as a Post Rule ID diff --git a/resource-manager/paloaltonetworks/2022-08-29/prefixlistglobalrulestack/id_globalrulestack.go b/resource-manager/paloaltonetworks/2022-08-29/prefixlistglobalrulestack/id_globalrulestack.go index 0786f30daa5..ea6f31f5a18 100644 --- a/resource-manager/paloaltonetworks/2022-08-29/prefixlistglobalrulestack/id_globalrulestack.go +++ b/resource-manager/paloaltonetworks/2022-08-29/prefixlistglobalrulestack/id_globalrulestack.go @@ -32,11 +32,9 @@ func ParseGlobalRulestackID(input string) (*GlobalRulestackId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GlobalRulestackId{} - - if id.GlobalRulestackName, ok = parsed.Parsed["globalRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseGlobalRulestackIDInsensitively(input string) (*GlobalRulestackId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GlobalRulestackId{} - - if id.GlobalRulestackName, ok = parsed.Parsed["globalRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *GlobalRulestackId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.GlobalRulestackName, ok = input.Parsed["globalRulestackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", input) + } + + return nil +} + // ValidateGlobalRulestackID checks that 'input' can be parsed as a Global Rulestack ID func ValidateGlobalRulestackID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/paloaltonetworks/2022-08-29/prefixlistglobalrulestack/id_prefixlist.go b/resource-manager/paloaltonetworks/2022-08-29/prefixlistglobalrulestack/id_prefixlist.go index 652e439b662..238efee3bd3 100644 --- a/resource-manager/paloaltonetworks/2022-08-29/prefixlistglobalrulestack/id_prefixlist.go +++ b/resource-manager/paloaltonetworks/2022-08-29/prefixlistglobalrulestack/id_prefixlist.go @@ -34,15 +34,9 @@ func ParsePrefixListID(input string) (*PrefixListId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrefixListId{} - - if id.GlobalRulestackName, ok = parsed.Parsed["globalRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", *parsed) - } - - if id.PrefixListName, ok = parsed.Parsed["prefixListName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "prefixListName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParsePrefixListIDInsensitively(input string) (*PrefixListId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrefixListId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.GlobalRulestackName, ok = parsed.Parsed["globalRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", *parsed) + return &id, nil +} + +func (id *PrefixListId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.GlobalRulestackName, ok = input.Parsed["globalRulestackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", input) } - if id.PrefixListName, ok = parsed.Parsed["prefixListName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "prefixListName", *parsed) + if id.PrefixListName, ok = input.Parsed["prefixListName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "prefixListName", input) } - return &id, nil + return nil } // ValidatePrefixListID checks that 'input' can be parsed as a Prefix List ID diff --git a/resource-manager/paloaltonetworks/2022-08-29/prefixlistlocalrulestack/id_localrulestack.go b/resource-manager/paloaltonetworks/2022-08-29/prefixlistlocalrulestack/id_localrulestack.go index 5e1569f8387..9ef23418690 100644 --- a/resource-manager/paloaltonetworks/2022-08-29/prefixlistlocalrulestack/id_localrulestack.go +++ b/resource-manager/paloaltonetworks/2022-08-29/prefixlistlocalrulestack/id_localrulestack.go @@ -36,19 +36,9 @@ func ParseLocalRulestackID(input string) (*LocalRulestackId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocalRulestackId{} - - 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.LocalRulestackName, ok = parsed.Parsed["localRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLocalRulestackIDInsensitively(input string) (*LocalRulestackId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocalRulestackId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LocalRulestackId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocalRulestackName, ok = parsed.Parsed["localRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", *parsed) + if id.LocalRulestackName, ok = input.Parsed["localRulestackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", input) } - return &id, nil + return nil } // ValidateLocalRulestackID checks that 'input' can be parsed as a Local Rulestack ID diff --git a/resource-manager/paloaltonetworks/2022-08-29/prefixlistlocalrulestack/id_localrulestackprefixlist.go b/resource-manager/paloaltonetworks/2022-08-29/prefixlistlocalrulestack/id_localrulestackprefixlist.go index a67aab6ae7d..67fa4a971b6 100644 --- a/resource-manager/paloaltonetworks/2022-08-29/prefixlistlocalrulestack/id_localrulestackprefixlist.go +++ b/resource-manager/paloaltonetworks/2022-08-29/prefixlistlocalrulestack/id_localrulestackprefixlist.go @@ -38,23 +38,9 @@ func ParseLocalRulestackPrefixListID(input string) (*LocalRulestackPrefixListId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocalRulestackPrefixListId{} - - 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.LocalRulestackName, ok = parsed.Parsed["localRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", *parsed) - } - - if id.PrefixListName, ok = parsed.Parsed["prefixListName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "prefixListName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLocalRulestackPrefixListIDInsensitively(input string) (*LocalRulestack return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocalRulestackPrefixListId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LocalRulestackPrefixListId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocalRulestackName, ok = parsed.Parsed["localRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", *parsed) + if id.LocalRulestackName, ok = input.Parsed["localRulestackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", input) } - if id.PrefixListName, ok = parsed.Parsed["prefixListName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "prefixListName", *parsed) + if id.PrefixListName, ok = input.Parsed["prefixListName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "prefixListName", input) } - return &id, nil + return nil } // ValidateLocalRulestackPrefixListID checks that 'input' can be parsed as a Local Rulestack Prefix List ID diff --git a/resource-manager/paloaltonetworks/2022-08-29/prerules/id_globalrulestack.go b/resource-manager/paloaltonetworks/2022-08-29/prerules/id_globalrulestack.go index 1d44ae375c7..2214bd08aca 100644 --- a/resource-manager/paloaltonetworks/2022-08-29/prerules/id_globalrulestack.go +++ b/resource-manager/paloaltonetworks/2022-08-29/prerules/id_globalrulestack.go @@ -32,11 +32,9 @@ func ParseGlobalRulestackID(input string) (*GlobalRulestackId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GlobalRulestackId{} - - if id.GlobalRulestackName, ok = parsed.Parsed["globalRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseGlobalRulestackIDInsensitively(input string) (*GlobalRulestackId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GlobalRulestackId{} - - if id.GlobalRulestackName, ok = parsed.Parsed["globalRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *GlobalRulestackId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.GlobalRulestackName, ok = input.Parsed["globalRulestackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", input) + } + + return nil +} + // ValidateGlobalRulestackID checks that 'input' can be parsed as a Global Rulestack ID func ValidateGlobalRulestackID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/paloaltonetworks/2022-08-29/prerules/id_prerule.go b/resource-manager/paloaltonetworks/2022-08-29/prerules/id_prerule.go index 03ef0a9c8b6..35bfe3b4c5c 100644 --- a/resource-manager/paloaltonetworks/2022-08-29/prerules/id_prerule.go +++ b/resource-manager/paloaltonetworks/2022-08-29/prerules/id_prerule.go @@ -34,15 +34,9 @@ func ParsePreRuleID(input string) (*PreRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PreRuleId{} - - if id.GlobalRulestackName, ok = parsed.Parsed["globalRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", *parsed) - } - - if id.PreRuleName, ok = parsed.Parsed["preRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "preRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParsePreRuleIDInsensitively(input string) (*PreRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PreRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.GlobalRulestackName, ok = parsed.Parsed["globalRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", *parsed) + return &id, nil +} + +func (id *PreRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.GlobalRulestackName, ok = input.Parsed["globalRulestackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", input) } - if id.PreRuleName, ok = parsed.Parsed["preRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "preRuleName", *parsed) + if id.PreRuleName, ok = input.Parsed["preRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "preRuleName", input) } - return &id, nil + return nil } // ValidatePreRuleID checks that 'input' can be parsed as a Pre Rule ID diff --git a/resource-manager/paloaltonetworks/2023-09-01/certificateobjectglobalrulestack/id_certificate.go b/resource-manager/paloaltonetworks/2023-09-01/certificateobjectglobalrulestack/id_certificate.go index e82e0b4e843..0679b5b6867 100644 --- a/resource-manager/paloaltonetworks/2023-09-01/certificateobjectglobalrulestack/id_certificate.go +++ b/resource-manager/paloaltonetworks/2023-09-01/certificateobjectglobalrulestack/id_certificate.go @@ -34,15 +34,9 @@ func ParseCertificateID(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} - - if id.GlobalRulestackName, ok = parsed.Parsed["globalRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", *parsed) - } - - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseCertificateIDInsensitively(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.GlobalRulestackName, ok = parsed.Parsed["globalRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", *parsed) + return &id, nil +} + +func (id *CertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.GlobalRulestackName, ok = input.Parsed["globalRulestackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", input) } - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if id.CertificateName, ok = input.Parsed["certificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateName", input) } - return &id, nil + return nil } // ValidateCertificateID checks that 'input' can be parsed as a Certificate ID diff --git a/resource-manager/paloaltonetworks/2023-09-01/certificateobjectglobalrulestack/id_globalrulestack.go b/resource-manager/paloaltonetworks/2023-09-01/certificateobjectglobalrulestack/id_globalrulestack.go index 090306d87a0..b93138721f7 100644 --- a/resource-manager/paloaltonetworks/2023-09-01/certificateobjectglobalrulestack/id_globalrulestack.go +++ b/resource-manager/paloaltonetworks/2023-09-01/certificateobjectglobalrulestack/id_globalrulestack.go @@ -32,11 +32,9 @@ func ParseGlobalRulestackID(input string) (*GlobalRulestackId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GlobalRulestackId{} - - if id.GlobalRulestackName, ok = parsed.Parsed["globalRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseGlobalRulestackIDInsensitively(input string) (*GlobalRulestackId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GlobalRulestackId{} - - if id.GlobalRulestackName, ok = parsed.Parsed["globalRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *GlobalRulestackId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.GlobalRulestackName, ok = input.Parsed["globalRulestackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", input) + } + + return nil +} + // ValidateGlobalRulestackID checks that 'input' can be parsed as a Global Rulestack ID func ValidateGlobalRulestackID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/paloaltonetworks/2023-09-01/certificateobjectlocalrulestack/id_localrulestack.go b/resource-manager/paloaltonetworks/2023-09-01/certificateobjectlocalrulestack/id_localrulestack.go index 22edb8f8f15..f7c9ca3e513 100644 --- a/resource-manager/paloaltonetworks/2023-09-01/certificateobjectlocalrulestack/id_localrulestack.go +++ b/resource-manager/paloaltonetworks/2023-09-01/certificateobjectlocalrulestack/id_localrulestack.go @@ -36,19 +36,9 @@ func ParseLocalRulestackID(input string) (*LocalRulestackId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocalRulestackId{} - - 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.LocalRulestackName, ok = parsed.Parsed["localRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLocalRulestackIDInsensitively(input string) (*LocalRulestackId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocalRulestackId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LocalRulestackId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocalRulestackName, ok = parsed.Parsed["localRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", *parsed) + if id.LocalRulestackName, ok = input.Parsed["localRulestackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", input) } - return &id, nil + return nil } // ValidateLocalRulestackID checks that 'input' can be parsed as a Local Rulestack ID diff --git a/resource-manager/paloaltonetworks/2023-09-01/certificateobjectlocalrulestack/id_localrulestackcertificate.go b/resource-manager/paloaltonetworks/2023-09-01/certificateobjectlocalrulestack/id_localrulestackcertificate.go index 0113f5a68a1..78f8eebe8b7 100644 --- a/resource-manager/paloaltonetworks/2023-09-01/certificateobjectlocalrulestack/id_localrulestackcertificate.go +++ b/resource-manager/paloaltonetworks/2023-09-01/certificateobjectlocalrulestack/id_localrulestackcertificate.go @@ -38,23 +38,9 @@ func ParseLocalRulestackCertificateID(input string) (*LocalRulestackCertificateI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocalRulestackCertificateId{} - - 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.LocalRulestackName, ok = parsed.Parsed["localRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", *parsed) - } - - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLocalRulestackCertificateIDInsensitively(input string) (*LocalRulestac return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocalRulestackCertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LocalRulestackCertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocalRulestackName, ok = parsed.Parsed["localRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", *parsed) + if id.LocalRulestackName, ok = input.Parsed["localRulestackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", input) } - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if id.CertificateName, ok = input.Parsed["certificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateName", input) } - return &id, nil + return nil } // ValidateLocalRulestackCertificateID checks that 'input' can be parsed as a Local Rulestack Certificate ID diff --git a/resource-manager/paloaltonetworks/2023-09-01/firewalls/id_firewall.go b/resource-manager/paloaltonetworks/2023-09-01/firewalls/id_firewall.go index 2e460652130..b531f7aba3c 100644 --- a/resource-manager/paloaltonetworks/2023-09-01/firewalls/id_firewall.go +++ b/resource-manager/paloaltonetworks/2023-09-01/firewalls/id_firewall.go @@ -36,19 +36,9 @@ func ParseFirewallID(input string) (*FirewallId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallId{} - - 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.FirewallName, ok = parsed.Parsed["firewallName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFirewallIDInsensitively(input string) (*FirewallId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FirewallId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FirewallName, ok = parsed.Parsed["firewallName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallName", *parsed) + if id.FirewallName, ok = input.Parsed["firewallName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "firewallName", input) } - return &id, nil + return nil } // ValidateFirewallID checks that 'input' can be parsed as a Firewall ID diff --git a/resource-manager/paloaltonetworks/2023-09-01/firewallstatus/id_firewall.go b/resource-manager/paloaltonetworks/2023-09-01/firewallstatus/id_firewall.go index 975c7d9c9dd..a45aa650afa 100644 --- a/resource-manager/paloaltonetworks/2023-09-01/firewallstatus/id_firewall.go +++ b/resource-manager/paloaltonetworks/2023-09-01/firewallstatus/id_firewall.go @@ -36,19 +36,9 @@ func ParseFirewallID(input string) (*FirewallId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallId{} - - 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.FirewallName, ok = parsed.Parsed["firewallName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFirewallIDInsensitively(input string) (*FirewallId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FirewallId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FirewallName, ok = parsed.Parsed["firewallName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallName", *parsed) + if id.FirewallName, ok = input.Parsed["firewallName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "firewallName", input) } - return &id, nil + return nil } // ValidateFirewallID checks that 'input' can be parsed as a Firewall ID diff --git a/resource-manager/paloaltonetworks/2023-09-01/fqdnlistglobalrulestack/id_fqdnlist.go b/resource-manager/paloaltonetworks/2023-09-01/fqdnlistglobalrulestack/id_fqdnlist.go index c649e37898f..0427cc7af39 100644 --- a/resource-manager/paloaltonetworks/2023-09-01/fqdnlistglobalrulestack/id_fqdnlist.go +++ b/resource-manager/paloaltonetworks/2023-09-01/fqdnlistglobalrulestack/id_fqdnlist.go @@ -34,15 +34,9 @@ func ParseFqdnListID(input string) (*FqdnListId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FqdnListId{} - - if id.GlobalRulestackName, ok = parsed.Parsed["globalRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", *parsed) - } - - if id.FqdnListName, ok = parsed.Parsed["fqdnListName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fqdnListName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseFqdnListIDInsensitively(input string) (*FqdnListId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FqdnListId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.GlobalRulestackName, ok = parsed.Parsed["globalRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", *parsed) + return &id, nil +} + +func (id *FqdnListId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.GlobalRulestackName, ok = input.Parsed["globalRulestackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", input) } - if id.FqdnListName, ok = parsed.Parsed["fqdnListName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fqdnListName", *parsed) + if id.FqdnListName, ok = input.Parsed["fqdnListName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fqdnListName", input) } - return &id, nil + return nil } // ValidateFqdnListID checks that 'input' can be parsed as a Fqdn List ID diff --git a/resource-manager/paloaltonetworks/2023-09-01/fqdnlistglobalrulestack/id_globalrulestack.go b/resource-manager/paloaltonetworks/2023-09-01/fqdnlistglobalrulestack/id_globalrulestack.go index 42c770e5b8d..bbcd9689098 100644 --- a/resource-manager/paloaltonetworks/2023-09-01/fqdnlistglobalrulestack/id_globalrulestack.go +++ b/resource-manager/paloaltonetworks/2023-09-01/fqdnlistglobalrulestack/id_globalrulestack.go @@ -32,11 +32,9 @@ func ParseGlobalRulestackID(input string) (*GlobalRulestackId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GlobalRulestackId{} - - if id.GlobalRulestackName, ok = parsed.Parsed["globalRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseGlobalRulestackIDInsensitively(input string) (*GlobalRulestackId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GlobalRulestackId{} - - if id.GlobalRulestackName, ok = parsed.Parsed["globalRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *GlobalRulestackId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.GlobalRulestackName, ok = input.Parsed["globalRulestackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", input) + } + + return nil +} + // ValidateGlobalRulestackID checks that 'input' can be parsed as a Global Rulestack ID func ValidateGlobalRulestackID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/paloaltonetworks/2023-09-01/fqdnlistlocalrulestack/id_localrulestack.go b/resource-manager/paloaltonetworks/2023-09-01/fqdnlistlocalrulestack/id_localrulestack.go index dcf74d99154..eb6c8249499 100644 --- a/resource-manager/paloaltonetworks/2023-09-01/fqdnlistlocalrulestack/id_localrulestack.go +++ b/resource-manager/paloaltonetworks/2023-09-01/fqdnlistlocalrulestack/id_localrulestack.go @@ -36,19 +36,9 @@ func ParseLocalRulestackID(input string) (*LocalRulestackId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocalRulestackId{} - - 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.LocalRulestackName, ok = parsed.Parsed["localRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLocalRulestackIDInsensitively(input string) (*LocalRulestackId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocalRulestackId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LocalRulestackId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocalRulestackName, ok = parsed.Parsed["localRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", *parsed) + if id.LocalRulestackName, ok = input.Parsed["localRulestackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", input) } - return &id, nil + return nil } // ValidateLocalRulestackID checks that 'input' can be parsed as a Local Rulestack ID diff --git a/resource-manager/paloaltonetworks/2023-09-01/fqdnlistlocalrulestack/id_localrulestackfqdnlist.go b/resource-manager/paloaltonetworks/2023-09-01/fqdnlistlocalrulestack/id_localrulestackfqdnlist.go index a088885391d..5484ffc44f0 100644 --- a/resource-manager/paloaltonetworks/2023-09-01/fqdnlistlocalrulestack/id_localrulestackfqdnlist.go +++ b/resource-manager/paloaltonetworks/2023-09-01/fqdnlistlocalrulestack/id_localrulestackfqdnlist.go @@ -38,23 +38,9 @@ func ParseLocalRulestackFqdnListID(input string) (*LocalRulestackFqdnListId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocalRulestackFqdnListId{} - - 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.LocalRulestackName, ok = parsed.Parsed["localRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", *parsed) - } - - if id.FqdnListName, ok = parsed.Parsed["fqdnListName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fqdnListName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLocalRulestackFqdnListIDInsensitively(input string) (*LocalRulestackFq return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocalRulestackFqdnListId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LocalRulestackFqdnListId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocalRulestackName, ok = parsed.Parsed["localRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", *parsed) + if id.LocalRulestackName, ok = input.Parsed["localRulestackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", input) } - if id.FqdnListName, ok = parsed.Parsed["fqdnListName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fqdnListName", *parsed) + if id.FqdnListName, ok = input.Parsed["fqdnListName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fqdnListName", input) } - return &id, nil + return nil } // ValidateLocalRulestackFqdnListID checks that 'input' can be parsed as a Local Rulestack Fqdn List ID diff --git a/resource-manager/paloaltonetworks/2023-09-01/globalrulestack/id_globalrulestack.go b/resource-manager/paloaltonetworks/2023-09-01/globalrulestack/id_globalrulestack.go index 9de874ca642..4fad054dd3c 100644 --- a/resource-manager/paloaltonetworks/2023-09-01/globalrulestack/id_globalrulestack.go +++ b/resource-manager/paloaltonetworks/2023-09-01/globalrulestack/id_globalrulestack.go @@ -32,11 +32,9 @@ func ParseGlobalRulestackID(input string) (*GlobalRulestackId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GlobalRulestackId{} - - if id.GlobalRulestackName, ok = parsed.Parsed["globalRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseGlobalRulestackIDInsensitively(input string) (*GlobalRulestackId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GlobalRulestackId{} - - if id.GlobalRulestackName, ok = parsed.Parsed["globalRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *GlobalRulestackId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.GlobalRulestackName, ok = input.Parsed["globalRulestackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", input) + } + + return nil +} + // ValidateGlobalRulestackID checks that 'input' can be parsed as a Global Rulestack ID func ValidateGlobalRulestackID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/paloaltonetworks/2023-09-01/localrules/id_localrule.go b/resource-manager/paloaltonetworks/2023-09-01/localrules/id_localrule.go index 4baa8a275f4..ac5666e081c 100644 --- a/resource-manager/paloaltonetworks/2023-09-01/localrules/id_localrule.go +++ b/resource-manager/paloaltonetworks/2023-09-01/localrules/id_localrule.go @@ -38,23 +38,9 @@ func ParseLocalRuleID(input string) (*LocalRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocalRuleId{} - - 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.LocalRulestackName, ok = parsed.Parsed["localRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", *parsed) - } - - if id.LocalRuleName, ok = parsed.Parsed["localRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLocalRuleIDInsensitively(input string) (*LocalRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocalRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LocalRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocalRulestackName, ok = parsed.Parsed["localRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", *parsed) + if id.LocalRulestackName, ok = input.Parsed["localRulestackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", input) } - if id.LocalRuleName, ok = parsed.Parsed["localRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localRuleName", *parsed) + if id.LocalRuleName, ok = input.Parsed["localRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "localRuleName", input) } - return &id, nil + return nil } // ValidateLocalRuleID checks that 'input' can be parsed as a Local Rule ID diff --git a/resource-manager/paloaltonetworks/2023-09-01/localrules/id_localrulestack.go b/resource-manager/paloaltonetworks/2023-09-01/localrules/id_localrulestack.go index 54f5af9056b..d2598cbdb33 100644 --- a/resource-manager/paloaltonetworks/2023-09-01/localrules/id_localrulestack.go +++ b/resource-manager/paloaltonetworks/2023-09-01/localrules/id_localrulestack.go @@ -36,19 +36,9 @@ func ParseLocalRulestackID(input string) (*LocalRulestackId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocalRulestackId{} - - 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.LocalRulestackName, ok = parsed.Parsed["localRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLocalRulestackIDInsensitively(input string) (*LocalRulestackId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocalRulestackId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LocalRulestackId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocalRulestackName, ok = parsed.Parsed["localRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", *parsed) + if id.LocalRulestackName, ok = input.Parsed["localRulestackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", input) } - return &id, nil + return nil } // ValidateLocalRulestackID checks that 'input' can be parsed as a Local Rulestack ID diff --git a/resource-manager/paloaltonetworks/2023-09-01/localrulestacks/id_localrulestack.go b/resource-manager/paloaltonetworks/2023-09-01/localrulestacks/id_localrulestack.go index 7aaf9d556ac..42ef8ed4d21 100644 --- a/resource-manager/paloaltonetworks/2023-09-01/localrulestacks/id_localrulestack.go +++ b/resource-manager/paloaltonetworks/2023-09-01/localrulestacks/id_localrulestack.go @@ -36,19 +36,9 @@ func ParseLocalRulestackID(input string) (*LocalRulestackId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocalRulestackId{} - - 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.LocalRulestackName, ok = parsed.Parsed["localRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLocalRulestackIDInsensitively(input string) (*LocalRulestackId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocalRulestackId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LocalRulestackId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocalRulestackName, ok = parsed.Parsed["localRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", *parsed) + if id.LocalRulestackName, ok = input.Parsed["localRulestackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", input) } - return &id, nil + return nil } // ValidateLocalRulestackID checks that 'input' can be parsed as a Local Rulestack ID diff --git a/resource-manager/paloaltonetworks/2023-09-01/postrules/id_globalrulestack.go b/resource-manager/paloaltonetworks/2023-09-01/postrules/id_globalrulestack.go index 3c52aa06775..9da5b7060e1 100644 --- a/resource-manager/paloaltonetworks/2023-09-01/postrules/id_globalrulestack.go +++ b/resource-manager/paloaltonetworks/2023-09-01/postrules/id_globalrulestack.go @@ -32,11 +32,9 @@ func ParseGlobalRulestackID(input string) (*GlobalRulestackId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GlobalRulestackId{} - - if id.GlobalRulestackName, ok = parsed.Parsed["globalRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseGlobalRulestackIDInsensitively(input string) (*GlobalRulestackId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GlobalRulestackId{} - - if id.GlobalRulestackName, ok = parsed.Parsed["globalRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *GlobalRulestackId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.GlobalRulestackName, ok = input.Parsed["globalRulestackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", input) + } + + return nil +} + // ValidateGlobalRulestackID checks that 'input' can be parsed as a Global Rulestack ID func ValidateGlobalRulestackID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/paloaltonetworks/2023-09-01/postrules/id_postrule.go b/resource-manager/paloaltonetworks/2023-09-01/postrules/id_postrule.go index 5a4b0b7ac51..6ab38de9423 100644 --- a/resource-manager/paloaltonetworks/2023-09-01/postrules/id_postrule.go +++ b/resource-manager/paloaltonetworks/2023-09-01/postrules/id_postrule.go @@ -34,15 +34,9 @@ func ParsePostRuleID(input string) (*PostRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PostRuleId{} - - if id.GlobalRulestackName, ok = parsed.Parsed["globalRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", *parsed) - } - - if id.PostRuleName, ok = parsed.Parsed["postRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "postRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParsePostRuleIDInsensitively(input string) (*PostRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PostRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.GlobalRulestackName, ok = parsed.Parsed["globalRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", *parsed) + return &id, nil +} + +func (id *PostRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.GlobalRulestackName, ok = input.Parsed["globalRulestackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", input) } - if id.PostRuleName, ok = parsed.Parsed["postRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "postRuleName", *parsed) + if id.PostRuleName, ok = input.Parsed["postRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "postRuleName", input) } - return &id, nil + return nil } // ValidatePostRuleID checks that 'input' can be parsed as a Post Rule ID diff --git a/resource-manager/paloaltonetworks/2023-09-01/prefixlistglobalrulestack/id_globalrulestack.go b/resource-manager/paloaltonetworks/2023-09-01/prefixlistglobalrulestack/id_globalrulestack.go index 0786f30daa5..ea6f31f5a18 100644 --- a/resource-manager/paloaltonetworks/2023-09-01/prefixlistglobalrulestack/id_globalrulestack.go +++ b/resource-manager/paloaltonetworks/2023-09-01/prefixlistglobalrulestack/id_globalrulestack.go @@ -32,11 +32,9 @@ func ParseGlobalRulestackID(input string) (*GlobalRulestackId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GlobalRulestackId{} - - if id.GlobalRulestackName, ok = parsed.Parsed["globalRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseGlobalRulestackIDInsensitively(input string) (*GlobalRulestackId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GlobalRulestackId{} - - if id.GlobalRulestackName, ok = parsed.Parsed["globalRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *GlobalRulestackId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.GlobalRulestackName, ok = input.Parsed["globalRulestackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", input) + } + + return nil +} + // ValidateGlobalRulestackID checks that 'input' can be parsed as a Global Rulestack ID func ValidateGlobalRulestackID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/paloaltonetworks/2023-09-01/prefixlistglobalrulestack/id_prefixlist.go b/resource-manager/paloaltonetworks/2023-09-01/prefixlistglobalrulestack/id_prefixlist.go index 652e439b662..238efee3bd3 100644 --- a/resource-manager/paloaltonetworks/2023-09-01/prefixlistglobalrulestack/id_prefixlist.go +++ b/resource-manager/paloaltonetworks/2023-09-01/prefixlistglobalrulestack/id_prefixlist.go @@ -34,15 +34,9 @@ func ParsePrefixListID(input string) (*PrefixListId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrefixListId{} - - if id.GlobalRulestackName, ok = parsed.Parsed["globalRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", *parsed) - } - - if id.PrefixListName, ok = parsed.Parsed["prefixListName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "prefixListName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParsePrefixListIDInsensitively(input string) (*PrefixListId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrefixListId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.GlobalRulestackName, ok = parsed.Parsed["globalRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", *parsed) + return &id, nil +} + +func (id *PrefixListId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.GlobalRulestackName, ok = input.Parsed["globalRulestackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", input) } - if id.PrefixListName, ok = parsed.Parsed["prefixListName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "prefixListName", *parsed) + if id.PrefixListName, ok = input.Parsed["prefixListName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "prefixListName", input) } - return &id, nil + return nil } // ValidatePrefixListID checks that 'input' can be parsed as a Prefix List ID diff --git a/resource-manager/paloaltonetworks/2023-09-01/prefixlistlocalrulestack/id_localrulestack.go b/resource-manager/paloaltonetworks/2023-09-01/prefixlistlocalrulestack/id_localrulestack.go index 5e1569f8387..9ef23418690 100644 --- a/resource-manager/paloaltonetworks/2023-09-01/prefixlistlocalrulestack/id_localrulestack.go +++ b/resource-manager/paloaltonetworks/2023-09-01/prefixlistlocalrulestack/id_localrulestack.go @@ -36,19 +36,9 @@ func ParseLocalRulestackID(input string) (*LocalRulestackId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocalRulestackId{} - - 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.LocalRulestackName, ok = parsed.Parsed["localRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLocalRulestackIDInsensitively(input string) (*LocalRulestackId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocalRulestackId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LocalRulestackId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocalRulestackName, ok = parsed.Parsed["localRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", *parsed) + if id.LocalRulestackName, ok = input.Parsed["localRulestackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", input) } - return &id, nil + return nil } // ValidateLocalRulestackID checks that 'input' can be parsed as a Local Rulestack ID diff --git a/resource-manager/paloaltonetworks/2023-09-01/prefixlistlocalrulestack/id_localrulestackprefixlist.go b/resource-manager/paloaltonetworks/2023-09-01/prefixlistlocalrulestack/id_localrulestackprefixlist.go index a67aab6ae7d..67fa4a971b6 100644 --- a/resource-manager/paloaltonetworks/2023-09-01/prefixlistlocalrulestack/id_localrulestackprefixlist.go +++ b/resource-manager/paloaltonetworks/2023-09-01/prefixlistlocalrulestack/id_localrulestackprefixlist.go @@ -38,23 +38,9 @@ func ParseLocalRulestackPrefixListID(input string) (*LocalRulestackPrefixListId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocalRulestackPrefixListId{} - - 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.LocalRulestackName, ok = parsed.Parsed["localRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", *parsed) - } - - if id.PrefixListName, ok = parsed.Parsed["prefixListName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "prefixListName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLocalRulestackPrefixListIDInsensitively(input string) (*LocalRulestack return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocalRulestackPrefixListId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LocalRulestackPrefixListId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocalRulestackName, ok = parsed.Parsed["localRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", *parsed) + if id.LocalRulestackName, ok = input.Parsed["localRulestackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "localRulestackName", input) } - if id.PrefixListName, ok = parsed.Parsed["prefixListName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "prefixListName", *parsed) + if id.PrefixListName, ok = input.Parsed["prefixListName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "prefixListName", input) } - return &id, nil + return nil } // ValidateLocalRulestackPrefixListID checks that 'input' can be parsed as a Local Rulestack Prefix List ID diff --git a/resource-manager/paloaltonetworks/2023-09-01/prerules/id_globalrulestack.go b/resource-manager/paloaltonetworks/2023-09-01/prerules/id_globalrulestack.go index 1d44ae375c7..2214bd08aca 100644 --- a/resource-manager/paloaltonetworks/2023-09-01/prerules/id_globalrulestack.go +++ b/resource-manager/paloaltonetworks/2023-09-01/prerules/id_globalrulestack.go @@ -32,11 +32,9 @@ func ParseGlobalRulestackID(input string) (*GlobalRulestackId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GlobalRulestackId{} - - if id.GlobalRulestackName, ok = parsed.Parsed["globalRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseGlobalRulestackIDInsensitively(input string) (*GlobalRulestackId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GlobalRulestackId{} - - if id.GlobalRulestackName, ok = parsed.Parsed["globalRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *GlobalRulestackId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.GlobalRulestackName, ok = input.Parsed["globalRulestackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", input) + } + + return nil +} + // ValidateGlobalRulestackID checks that 'input' can be parsed as a Global Rulestack ID func ValidateGlobalRulestackID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/paloaltonetworks/2023-09-01/prerules/id_prerule.go b/resource-manager/paloaltonetworks/2023-09-01/prerules/id_prerule.go index 03ef0a9c8b6..35bfe3b4c5c 100644 --- a/resource-manager/paloaltonetworks/2023-09-01/prerules/id_prerule.go +++ b/resource-manager/paloaltonetworks/2023-09-01/prerules/id_prerule.go @@ -34,15 +34,9 @@ func ParsePreRuleID(input string) (*PreRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PreRuleId{} - - if id.GlobalRulestackName, ok = parsed.Parsed["globalRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", *parsed) - } - - if id.PreRuleName, ok = parsed.Parsed["preRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "preRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParsePreRuleIDInsensitively(input string) (*PreRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PreRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.GlobalRulestackName, ok = parsed.Parsed["globalRulestackName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", *parsed) + return &id, nil +} + +func (id *PreRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.GlobalRulestackName, ok = input.Parsed["globalRulestackName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "globalRulestackName", input) } - if id.PreRuleName, ok = parsed.Parsed["preRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "preRuleName", *parsed) + if id.PreRuleName, ok = input.Parsed["preRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "preRuleName", input) } - return &id, nil + return nil } // ValidatePreRuleID checks that 'input' can be parsed as a Pre Rule ID diff --git a/resource-manager/policyinsights/2021-10-01/remediations/id_managementgroup.go b/resource-manager/policyinsights/2021-10-01/remediations/id_managementgroup.go index b0919b86f25..7269223e370 100644 --- a/resource-manager/policyinsights/2021-10-01/remediations/id_managementgroup.go +++ b/resource-manager/policyinsights/2021-10-01/remediations/id_managementgroup.go @@ -32,11 +32,9 @@ func ParseManagementGroupID(input string) (*ManagementGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagementGroupId{} - - if id.ManagementGroupId, ok = parsed.Parsed["managementGroupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managementGroupId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseManagementGroupIDInsensitively(input string) (*ManagementGroupId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagementGroupId{} - - if id.ManagementGroupId, ok = parsed.Parsed["managementGroupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managementGroupId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *ManagementGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ManagementGroupId, ok = input.Parsed["managementGroupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managementGroupId", input) + } + + return nil +} + // ValidateManagementGroupID checks that 'input' can be parsed as a Management Group ID func ValidateManagementGroupID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/policyinsights/2021-10-01/remediations/id_providerremediation.go b/resource-manager/policyinsights/2021-10-01/remediations/id_providerremediation.go index f9418db5cc9..99ee5c1a66a 100644 --- a/resource-manager/policyinsights/2021-10-01/remediations/id_providerremediation.go +++ b/resource-manager/policyinsights/2021-10-01/remediations/id_providerremediation.go @@ -36,19 +36,9 @@ func ParseProviderRemediationID(input string) (*ProviderRemediationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderRemediationId{} - - 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.RemediationName, ok = parsed.Parsed["remediationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "remediationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderRemediationIDInsensitively(input string) (*ProviderRemediation return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderRemediationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderRemediationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RemediationName, ok = parsed.Parsed["remediationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "remediationName", *parsed) + if id.RemediationName, ok = input.Parsed["remediationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "remediationName", input) } - return &id, nil + return nil } // ValidateProviderRemediationID checks that 'input' can be parsed as a Provider Remediation ID diff --git a/resource-manager/policyinsights/2021-10-01/remediations/id_providers2remediation.go b/resource-manager/policyinsights/2021-10-01/remediations/id_providers2remediation.go index a0a141d3b8d..6ce9068e5c3 100644 --- a/resource-manager/policyinsights/2021-10-01/remediations/id_providers2remediation.go +++ b/resource-manager/policyinsights/2021-10-01/remediations/id_providers2remediation.go @@ -34,15 +34,9 @@ func ParseProviders2RemediationID(input string) (*Providers2RemediationId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2RemediationId{} - - if id.ManagementGroupId, ok = parsed.Parsed["managementGroupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managementGroupId", *parsed) - } - - if id.RemediationName, ok = parsed.Parsed["remediationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "remediationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviders2RemediationIDInsensitively(input string) (*Providers2Remedia return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2RemediationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ManagementGroupId, ok = parsed.Parsed["managementGroupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managementGroupId", *parsed) + return &id, nil +} + +func (id *Providers2RemediationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ManagementGroupId, ok = input.Parsed["managementGroupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managementGroupId", input) } - if id.RemediationName, ok = parsed.Parsed["remediationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "remediationName", *parsed) + if id.RemediationName, ok = input.Parsed["remediationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "remediationName", input) } - return &id, nil + return nil } // ValidateProviders2RemediationID checks that 'input' can be parsed as a Providers 2 Remediation ID diff --git a/resource-manager/policyinsights/2021-10-01/remediations/id_remediation.go b/resource-manager/policyinsights/2021-10-01/remediations/id_remediation.go index 93603cb0720..0d47bc1d8a5 100644 --- a/resource-manager/policyinsights/2021-10-01/remediations/id_remediation.go +++ b/resource-manager/policyinsights/2021-10-01/remediations/id_remediation.go @@ -34,15 +34,9 @@ func ParseRemediationID(input string) (*RemediationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RemediationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.RemediationName, ok = parsed.Parsed["remediationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "remediationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseRemediationIDInsensitively(input string) (*RemediationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RemediationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RemediationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.RemediationName, ok = parsed.Parsed["remediationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "remediationName", *parsed) + if id.RemediationName, ok = input.Parsed["remediationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "remediationName", input) } - return &id, nil + return nil } // ValidateRemediationID checks that 'input' can be parsed as a Remediation ID diff --git a/resource-manager/policyinsights/2021-10-01/remediations/id_scopedremediation.go b/resource-manager/policyinsights/2021-10-01/remediations/id_scopedremediation.go index c94dee0b549..76201f165f5 100644 --- a/resource-manager/policyinsights/2021-10-01/remediations/id_scopedremediation.go +++ b/resource-manager/policyinsights/2021-10-01/remediations/id_scopedremediation.go @@ -34,15 +34,9 @@ func ParseScopedRemediationID(input string) (*ScopedRemediationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedRemediationId{} - - if id.ResourceId, ok = parsed.Parsed["resourceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceId", *parsed) - } - - if id.RemediationName, ok = parsed.Parsed["remediationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "remediationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedRemediationIDInsensitively(input string) (*ScopedRemediationId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedRemediationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ResourceId, ok = parsed.Parsed["resourceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceId", *parsed) + return &id, nil +} + +func (id *ScopedRemediationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ResourceId, ok = input.Parsed["resourceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceId", input) } - if id.RemediationName, ok = parsed.Parsed["remediationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "remediationName", *parsed) + if id.RemediationName, ok = input.Parsed["remediationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "remediationName", input) } - return &id, nil + return nil } // ValidateScopedRemediationID checks that 'input' can be parsed as a Scoped Remediation ID diff --git a/resource-manager/policyinsights/2022-09-01/attestations/id_attestation.go b/resource-manager/policyinsights/2022-09-01/attestations/id_attestation.go index de3fe8919b2..7994fe3197d 100644 --- a/resource-manager/policyinsights/2022-09-01/attestations/id_attestation.go +++ b/resource-manager/policyinsights/2022-09-01/attestations/id_attestation.go @@ -34,15 +34,9 @@ func ParseAttestationID(input string) (*AttestationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AttestationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.AttestationName, ok = parsed.Parsed["attestationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "attestationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseAttestationIDInsensitively(input string) (*AttestationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AttestationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *AttestationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.AttestationName, ok = parsed.Parsed["attestationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "attestationName", *parsed) + if id.AttestationName, ok = input.Parsed["attestationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "attestationName", input) } - return &id, nil + return nil } // ValidateAttestationID checks that 'input' can be parsed as a Attestation ID diff --git a/resource-manager/policyinsights/2022-09-01/attestations/id_providerattestation.go b/resource-manager/policyinsights/2022-09-01/attestations/id_providerattestation.go index 1ce4653efa0..7e511978a30 100644 --- a/resource-manager/policyinsights/2022-09-01/attestations/id_providerattestation.go +++ b/resource-manager/policyinsights/2022-09-01/attestations/id_providerattestation.go @@ -36,19 +36,9 @@ func ParseProviderAttestationID(input string) (*ProviderAttestationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderAttestationId{} - - 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.AttestationName, ok = parsed.Parsed["attestationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "attestationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderAttestationIDInsensitively(input string) (*ProviderAttestation return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderAttestationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderAttestationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AttestationName, ok = parsed.Parsed["attestationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "attestationName", *parsed) + if id.AttestationName, ok = input.Parsed["attestationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "attestationName", input) } - return &id, nil + return nil } // ValidateProviderAttestationID checks that 'input' can be parsed as a Provider Attestation ID diff --git a/resource-manager/policyinsights/2022-09-01/attestations/id_scopedattestation.go b/resource-manager/policyinsights/2022-09-01/attestations/id_scopedattestation.go index 2442d388ad7..2a93a215121 100644 --- a/resource-manager/policyinsights/2022-09-01/attestations/id_scopedattestation.go +++ b/resource-manager/policyinsights/2022-09-01/attestations/id_scopedattestation.go @@ -34,15 +34,9 @@ func ParseScopedAttestationID(input string) (*ScopedAttestationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedAttestationId{} - - if id.ResourceId, ok = parsed.Parsed["resourceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceId", *parsed) - } - - if id.AttestationName, ok = parsed.Parsed["attestationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "attestationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedAttestationIDInsensitively(input string) (*ScopedAttestationId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedAttestationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ResourceId, ok = parsed.Parsed["resourceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceId", *parsed) + return &id, nil +} + +func (id *ScopedAttestationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ResourceId, ok = input.Parsed["resourceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceId", input) } - if id.AttestationName, ok = parsed.Parsed["attestationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "attestationName", *parsed) + if id.AttestationName, ok = input.Parsed["attestationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "attestationName", input) } - return &id, nil + return nil } // ValidateScopedAttestationID checks that 'input' can be parsed as a Scoped Attestation ID diff --git a/resource-manager/policyinsights/2023-03-01/checkpolicyrestrictions/id_managementgroup.go b/resource-manager/policyinsights/2023-03-01/checkpolicyrestrictions/id_managementgroup.go index 879166e1f10..9af0abbec8c 100644 --- a/resource-manager/policyinsights/2023-03-01/checkpolicyrestrictions/id_managementgroup.go +++ b/resource-manager/policyinsights/2023-03-01/checkpolicyrestrictions/id_managementgroup.go @@ -32,11 +32,9 @@ func ParseManagementGroupID(input string) (*ManagementGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagementGroupId{} - - if id.ManagementGroupId, ok = parsed.Parsed["managementGroupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managementGroupId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseManagementGroupIDInsensitively(input string) (*ManagementGroupId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagementGroupId{} - - if id.ManagementGroupId, ok = parsed.Parsed["managementGroupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managementGroupId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *ManagementGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ManagementGroupId, ok = input.Parsed["managementGroupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managementGroupId", input) + } + + return nil +} + // ValidateManagementGroupID checks that 'input' can be parsed as a Management Group ID func ValidateManagementGroupID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/portal/2019-01-01-preview/dashboard/id_dashboard.go b/resource-manager/portal/2019-01-01-preview/dashboard/id_dashboard.go index 43f9698da25..128e091fa5a 100644 --- a/resource-manager/portal/2019-01-01-preview/dashboard/id_dashboard.go +++ b/resource-manager/portal/2019-01-01-preview/dashboard/id_dashboard.go @@ -36,19 +36,9 @@ func ParseDashboardID(input string) (*DashboardId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DashboardId{} - - 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.DashboardName, ok = parsed.Parsed["dashboardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dashboardName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDashboardIDInsensitively(input string) (*DashboardId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DashboardId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DashboardId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DashboardName, ok = parsed.Parsed["dashboardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dashboardName", *parsed) + if id.DashboardName, ok = input.Parsed["dashboardName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dashboardName", input) } - return &id, nil + return nil } // ValidateDashboardID checks that 'input' can be parsed as a Dashboard ID diff --git a/resource-manager/postgresql/2017-12-01/configurations/id_configuration.go b/resource-manager/postgresql/2017-12-01/configurations/id_configuration.go index 5f2dc735ca9..65383a3e638 100644 --- a/resource-manager/postgresql/2017-12-01/configurations/id_configuration.go +++ b/resource-manager/postgresql/2017-12-01/configurations/id_configuration.go @@ -38,23 +38,9 @@ func ParseConfigurationID(input string) (*ConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationId{} - - 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.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConfigurationIDInsensitively(input string) (*ConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationName", *parsed) + if id.ConfigurationName, ok = input.Parsed["configurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationName", input) } - return &id, nil + return nil } // ValidateConfigurationID checks that 'input' can be parsed as a Configuration ID diff --git a/resource-manager/postgresql/2017-12-01/configurations/id_server.go b/resource-manager/postgresql/2017-12-01/configurations/id_server.go index fab0d426cc8..f6fb993ddd5 100644 --- a/resource-manager/postgresql/2017-12-01/configurations/id_server.go +++ b/resource-manager/postgresql/2017-12-01/configurations/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/postgresql/2017-12-01/configurationsupdate/id_server.go b/resource-manager/postgresql/2017-12-01/configurationsupdate/id_server.go index ca1e95c2edb..cb96fd1325e 100644 --- a/resource-manager/postgresql/2017-12-01/configurationsupdate/id_server.go +++ b/resource-manager/postgresql/2017-12-01/configurationsupdate/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/postgresql/2017-12-01/databases/id_database.go b/resource-manager/postgresql/2017-12-01/databases/id_database.go index 7fd3d541bcb..3c92ebbedcf 100644 --- a/resource-manager/postgresql/2017-12-01/databases/id_database.go +++ b/resource-manager/postgresql/2017-12-01/databases/id_database.go @@ -38,23 +38,9 @@ func ParseDatabaseID(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} - - 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) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDatabaseIDInsensitively(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - return &id, nil + return nil } // ValidateDatabaseID checks that 'input' can be parsed as a Database ID diff --git a/resource-manager/postgresql/2017-12-01/databases/id_server.go b/resource-manager/postgresql/2017-12-01/databases/id_server.go index d355696c478..9dd20bf64e3 100644 --- a/resource-manager/postgresql/2017-12-01/databases/id_server.go +++ b/resource-manager/postgresql/2017-12-01/databases/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/postgresql/2017-12-01/firewallrules/id_firewallrule.go b/resource-manager/postgresql/2017-12-01/firewallrules/id_firewallrule.go index 6be3e99e007..f48c17b4ad1 100644 --- a/resource-manager/postgresql/2017-12-01/firewallrules/id_firewallrule.go +++ b/resource-manager/postgresql/2017-12-01/firewallrules/id_firewallrule.go @@ -38,23 +38,9 @@ func ParseFirewallRuleID(input string) (*FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallRuleId{} - - 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.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFirewallRuleIDInsensitively(input string) (*FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FirewallRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + if id.FirewallRuleName, ok = input.Parsed["firewallRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", input) } - return &id, nil + return nil } // ValidateFirewallRuleID checks that 'input' can be parsed as a Firewall Rule ID diff --git a/resource-manager/postgresql/2017-12-01/firewallrules/id_server.go b/resource-manager/postgresql/2017-12-01/firewallrules/id_server.go index 1fbb75bfe25..4d705865300 100644 --- a/resource-manager/postgresql/2017-12-01/firewallrules/id_server.go +++ b/resource-manager/postgresql/2017-12-01/firewallrules/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/postgresql/2017-12-01/locationbasedperformancetier/id_location.go b/resource-manager/postgresql/2017-12-01/locationbasedperformancetier/id_location.go index 31e6153abc3..f28eaebd342 100644 --- a/resource-manager/postgresql/2017-12-01/locationbasedperformancetier/id_location.go +++ b/resource-manager/postgresql/2017-12-01/locationbasedperformancetier/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/postgresql/2017-12-01/logfiles/id_server.go b/resource-manager/postgresql/2017-12-01/logfiles/id_server.go index cb8dd181fb8..e347e9da1c7 100644 --- a/resource-manager/postgresql/2017-12-01/logfiles/id_server.go +++ b/resource-manager/postgresql/2017-12-01/logfiles/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/postgresql/2017-12-01/recoverableservers/id_server.go b/resource-manager/postgresql/2017-12-01/recoverableservers/id_server.go index 1387818fd99..85b4dd8fbce 100644 --- a/resource-manager/postgresql/2017-12-01/recoverableservers/id_server.go +++ b/resource-manager/postgresql/2017-12-01/recoverableservers/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/postgresql/2017-12-01/replicas/id_server.go b/resource-manager/postgresql/2017-12-01/replicas/id_server.go index c9077c10e09..212537d8784 100644 --- a/resource-manager/postgresql/2017-12-01/replicas/id_server.go +++ b/resource-manager/postgresql/2017-12-01/replicas/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/postgresql/2017-12-01/serveradministrators/id_server.go b/resource-manager/postgresql/2017-12-01/serveradministrators/id_server.go index 9c560e120c1..d8bd12393a3 100644 --- a/resource-manager/postgresql/2017-12-01/serveradministrators/id_server.go +++ b/resource-manager/postgresql/2017-12-01/serveradministrators/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/postgresql/2017-12-01/serverbasedperformancetier/id_server.go b/resource-manager/postgresql/2017-12-01/serverbasedperformancetier/id_server.go index 8303712ccf4..012e6f4cba4 100644 --- a/resource-manager/postgresql/2017-12-01/serverbasedperformancetier/id_server.go +++ b/resource-manager/postgresql/2017-12-01/serverbasedperformancetier/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/postgresql/2017-12-01/serverrestart/id_server.go b/resource-manager/postgresql/2017-12-01/serverrestart/id_server.go index ac9dbc1053c..a9afb656a87 100644 --- a/resource-manager/postgresql/2017-12-01/serverrestart/id_server.go +++ b/resource-manager/postgresql/2017-12-01/serverrestart/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/postgresql/2017-12-01/servers/id_server.go b/resource-manager/postgresql/2017-12-01/servers/id_server.go index 54edc87ec53..e45954bade9 100644 --- a/resource-manager/postgresql/2017-12-01/servers/id_server.go +++ b/resource-manager/postgresql/2017-12-01/servers/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/postgresql/2017-12-01/serversecurityalertpolicies/id_server.go b/resource-manager/postgresql/2017-12-01/serversecurityalertpolicies/id_server.go index 1d4d380e669..f0945312f4c 100644 --- a/resource-manager/postgresql/2017-12-01/serversecurityalertpolicies/id_server.go +++ b/resource-manager/postgresql/2017-12-01/serversecurityalertpolicies/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/postgresql/2017-12-01/virtualnetworkrules/id_server.go b/resource-manager/postgresql/2017-12-01/virtualnetworkrules/id_server.go index 9d107ebec74..6db668beeea 100644 --- a/resource-manager/postgresql/2017-12-01/virtualnetworkrules/id_server.go +++ b/resource-manager/postgresql/2017-12-01/virtualnetworkrules/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/postgresql/2017-12-01/virtualnetworkrules/id_virtualnetworkrule.go b/resource-manager/postgresql/2017-12-01/virtualnetworkrules/id_virtualnetworkrule.go index bafcd3659fb..64906c05d7b 100644 --- a/resource-manager/postgresql/2017-12-01/virtualnetworkrules/id_virtualnetworkrule.go +++ b/resource-manager/postgresql/2017-12-01/virtualnetworkrules/id_virtualnetworkrule.go @@ -38,23 +38,9 @@ func ParseVirtualNetworkRuleID(input string) (*VirtualNetworkRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkRuleId{} - - 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.VirtualNetworkRuleName, ok = parsed.Parsed["virtualNetworkRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualNetworkRuleIDInsensitively(input string) (*VirtualNetworkRuleId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualNetworkRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.VirtualNetworkRuleName, ok = parsed.Parsed["virtualNetworkRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkRuleName", *parsed) + if id.VirtualNetworkRuleName, ok = input.Parsed["virtualNetworkRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkRuleName", input) } - return &id, nil + return nil } // ValidateVirtualNetworkRuleID checks that 'input' can be parsed as a Virtual Network Rule ID diff --git a/resource-manager/postgresql/2018-06-01/advisors/id_advisor.go b/resource-manager/postgresql/2018-06-01/advisors/id_advisor.go index a33acb79d8e..dcca79f5326 100644 --- a/resource-manager/postgresql/2018-06-01/advisors/id_advisor.go +++ b/resource-manager/postgresql/2018-06-01/advisors/id_advisor.go @@ -38,23 +38,9 @@ func ParseAdvisorID(input string) (*AdvisorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AdvisorId{} - - 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.AdvisorName, ok = parsed.Parsed["advisorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "advisorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAdvisorIDInsensitively(input string) (*AdvisorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AdvisorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AdvisorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.AdvisorName, ok = parsed.Parsed["advisorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "advisorName", *parsed) + if id.AdvisorName, ok = input.Parsed["advisorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "advisorName", input) } - return &id, nil + return nil } // ValidateAdvisorID checks that 'input' can be parsed as a Advisor ID diff --git a/resource-manager/postgresql/2018-06-01/advisors/id_server.go b/resource-manager/postgresql/2018-06-01/advisors/id_server.go index 5843e3a55dc..5a6daf08f3a 100644 --- a/resource-manager/postgresql/2018-06-01/advisors/id_server.go +++ b/resource-manager/postgresql/2018-06-01/advisors/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/postgresql/2018-06-01/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/postgresql/2018-06-01/privateendpointconnections/id_privateendpointconnection.go index f8ae9549eb0..7c30f055340 100644 --- a/resource-manager/postgresql/2018-06-01/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/postgresql/2018-06-01/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/postgresql/2018-06-01/privateendpointconnections/id_server.go b/resource-manager/postgresql/2018-06-01/privateendpointconnections/id_server.go index 07a92f89aa8..eff99081581 100644 --- a/resource-manager/postgresql/2018-06-01/privateendpointconnections/id_server.go +++ b/resource-manager/postgresql/2018-06-01/privateendpointconnections/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/postgresql/2018-06-01/privatelinkresources/id_privatelinkresource.go b/resource-manager/postgresql/2018-06-01/privatelinkresources/id_privatelinkresource.go index a0f2643055e..8d3b7fe7500 100644 --- a/resource-manager/postgresql/2018-06-01/privatelinkresources/id_privatelinkresource.go +++ b/resource-manager/postgresql/2018-06-01/privatelinkresources/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/postgresql/2018-06-01/privatelinkresources/id_server.go b/resource-manager/postgresql/2018-06-01/privatelinkresources/id_server.go index dfcccc66360..4b2e10b3f90 100644 --- a/resource-manager/postgresql/2018-06-01/privatelinkresources/id_server.go +++ b/resource-manager/postgresql/2018-06-01/privatelinkresources/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/postgresql/2018-06-01/querytexts/id_querytext.go b/resource-manager/postgresql/2018-06-01/querytexts/id_querytext.go index 2b6f4e38dc7..247a488aa40 100644 --- a/resource-manager/postgresql/2018-06-01/querytexts/id_querytext.go +++ b/resource-manager/postgresql/2018-06-01/querytexts/id_querytext.go @@ -38,23 +38,9 @@ func ParseQueryTextID(input string) (*QueryTextId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QueryTextId{} - - 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.QueryId, ok = parsed.Parsed["queryId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "queryId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseQueryTextIDInsensitively(input string) (*QueryTextId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QueryTextId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *QueryTextId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.QueryId, ok = parsed.Parsed["queryId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "queryId", *parsed) + if id.QueryId, ok = input.Parsed["queryId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "queryId", input) } - return &id, nil + return nil } // ValidateQueryTextID checks that 'input' can be parsed as a Query Text ID diff --git a/resource-manager/postgresql/2018-06-01/querytexts/id_server.go b/resource-manager/postgresql/2018-06-01/querytexts/id_server.go index 50c7bfe68e9..31839bea75c 100644 --- a/resource-manager/postgresql/2018-06-01/querytexts/id_server.go +++ b/resource-manager/postgresql/2018-06-01/querytexts/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/postgresql/2018-06-01/recommendedactions/id_advisor.go b/resource-manager/postgresql/2018-06-01/recommendedactions/id_advisor.go index a915c58782f..e347d0d112d 100644 --- a/resource-manager/postgresql/2018-06-01/recommendedactions/id_advisor.go +++ b/resource-manager/postgresql/2018-06-01/recommendedactions/id_advisor.go @@ -38,23 +38,9 @@ func ParseAdvisorID(input string) (*AdvisorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AdvisorId{} - - 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.AdvisorName, ok = parsed.Parsed["advisorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "advisorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAdvisorIDInsensitively(input string) (*AdvisorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AdvisorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AdvisorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.AdvisorName, ok = parsed.Parsed["advisorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "advisorName", *parsed) + if id.AdvisorName, ok = input.Parsed["advisorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "advisorName", input) } - return &id, nil + return nil } // ValidateAdvisorID checks that 'input' can be parsed as a Advisor ID diff --git a/resource-manager/postgresql/2018-06-01/recommendedactions/id_recommendedaction.go b/resource-manager/postgresql/2018-06-01/recommendedactions/id_recommendedaction.go index 843fa68f69d..a671b4f38e8 100644 --- a/resource-manager/postgresql/2018-06-01/recommendedactions/id_recommendedaction.go +++ b/resource-manager/postgresql/2018-06-01/recommendedactions/id_recommendedaction.go @@ -40,27 +40,9 @@ func ParseRecommendedActionID(input string) (*RecommendedActionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecommendedActionId{} - - 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.AdvisorName, ok = parsed.Parsed["advisorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "advisorName", *parsed) - } - - if id.RecommendedActionName, ok = parsed.Parsed["recommendedActionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recommendedActionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseRecommendedActionIDInsensitively(input string) (*RecommendedActionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecommendedActionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RecommendedActionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.AdvisorName, ok = parsed.Parsed["advisorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "advisorName", *parsed) + if id.AdvisorName, ok = input.Parsed["advisorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "advisorName", input) } - if id.RecommendedActionName, ok = parsed.Parsed["recommendedActionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recommendedActionName", *parsed) + if id.RecommendedActionName, ok = input.Parsed["recommendedActionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "recommendedActionName", input) } - return &id, nil + return nil } // ValidateRecommendedActionID checks that 'input' can be parsed as a Recommended Action ID diff --git a/resource-manager/postgresql/2018-06-01/recommendedactionsessions/id_advisor.go b/resource-manager/postgresql/2018-06-01/recommendedactionsessions/id_advisor.go index e69887a8e68..673b1e50887 100644 --- a/resource-manager/postgresql/2018-06-01/recommendedactionsessions/id_advisor.go +++ b/resource-manager/postgresql/2018-06-01/recommendedactionsessions/id_advisor.go @@ -38,23 +38,9 @@ func ParseAdvisorID(input string) (*AdvisorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AdvisorId{} - - 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.AdvisorName, ok = parsed.Parsed["advisorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "advisorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAdvisorIDInsensitively(input string) (*AdvisorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AdvisorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AdvisorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.AdvisorName, ok = parsed.Parsed["advisorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "advisorName", *parsed) + if id.AdvisorName, ok = input.Parsed["advisorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "advisorName", input) } - return &id, nil + return nil } // ValidateAdvisorID checks that 'input' can be parsed as a Advisor ID diff --git a/resource-manager/postgresql/2018-06-01/resetqueryperformanceinsightdata/id_server.go b/resource-manager/postgresql/2018-06-01/resetqueryperformanceinsightdata/id_server.go index 950fab882c7..5a724061933 100644 --- a/resource-manager/postgresql/2018-06-01/resetqueryperformanceinsightdata/id_server.go +++ b/resource-manager/postgresql/2018-06-01/resetqueryperformanceinsightdata/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/postgresql/2018-06-01/topquerystatistics/id_server.go b/resource-manager/postgresql/2018-06-01/topquerystatistics/id_server.go index d1f6af61d7e..812189e06f4 100644 --- a/resource-manager/postgresql/2018-06-01/topquerystatistics/id_server.go +++ b/resource-manager/postgresql/2018-06-01/topquerystatistics/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/postgresql/2018-06-01/topquerystatistics/id_topquerystatistic.go b/resource-manager/postgresql/2018-06-01/topquerystatistics/id_topquerystatistic.go index ad47ade812d..fdd797e117f 100644 --- a/resource-manager/postgresql/2018-06-01/topquerystatistics/id_topquerystatistic.go +++ b/resource-manager/postgresql/2018-06-01/topquerystatistics/id_topquerystatistic.go @@ -38,23 +38,9 @@ func ParseTopQueryStatisticID(input string) (*TopQueryStatisticId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TopQueryStatisticId{} - - 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.QueryStatisticId, ok = parsed.Parsed["queryStatisticId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "queryStatisticId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTopQueryStatisticIDInsensitively(input string) (*TopQueryStatisticId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TopQueryStatisticId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TopQueryStatisticId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.QueryStatisticId, ok = parsed.Parsed["queryStatisticId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "queryStatisticId", *parsed) + if id.QueryStatisticId, ok = input.Parsed["queryStatisticId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "queryStatisticId", input) } - return &id, nil + return nil } // ValidateTopQueryStatisticID checks that 'input' can be parsed as a Top Query Statistic ID diff --git a/resource-manager/postgresql/2018-06-01/waitstatistics/id_server.go b/resource-manager/postgresql/2018-06-01/waitstatistics/id_server.go index 728ead2d8a1..8643e469610 100644 --- a/resource-manager/postgresql/2018-06-01/waitstatistics/id_server.go +++ b/resource-manager/postgresql/2018-06-01/waitstatistics/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/postgresql/2018-06-01/waitstatistics/id_waitstatistic.go b/resource-manager/postgresql/2018-06-01/waitstatistics/id_waitstatistic.go index e1aaef23bf4..b45e266abac 100644 --- a/resource-manager/postgresql/2018-06-01/waitstatistics/id_waitstatistic.go +++ b/resource-manager/postgresql/2018-06-01/waitstatistics/id_waitstatistic.go @@ -38,23 +38,9 @@ func ParseWaitStatisticID(input string) (*WaitStatisticId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WaitStatisticId{} - - 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.WaitStatisticsId, ok = parsed.Parsed["waitStatisticsId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "waitStatisticsId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWaitStatisticIDInsensitively(input string) (*WaitStatisticId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WaitStatisticId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WaitStatisticId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.WaitStatisticsId, ok = parsed.Parsed["waitStatisticsId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "waitStatisticsId", *parsed) + if id.WaitStatisticsId, ok = input.Parsed["waitStatisticsId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "waitStatisticsId", input) } - return &id, nil + return nil } // ValidateWaitStatisticID checks that 'input' can be parsed as a Wait Statistic ID diff --git a/resource-manager/postgresql/2020-01-01/serverkeys/id_key.go b/resource-manager/postgresql/2020-01-01/serverkeys/id_key.go index d18f225f49e..1d7dd0bc8be 100644 --- a/resource-manager/postgresql/2020-01-01/serverkeys/id_key.go +++ b/resource-manager/postgresql/2020-01-01/serverkeys/id_key.go @@ -38,23 +38,9 @@ func ParseKeyID(input string) (*KeyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := KeyId{} - - 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.KeyName, ok = parsed.Parsed["keyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseKeyIDInsensitively(input string) (*KeyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := KeyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *KeyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.KeyName, ok = parsed.Parsed["keyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyName", *parsed) + if id.KeyName, ok = input.Parsed["keyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "keyName", input) } - return &id, nil + return nil } // ValidateKeyID checks that 'input' can be parsed as a Key ID diff --git a/resource-manager/postgresql/2020-01-01/serverkeys/id_server.go b/resource-manager/postgresql/2020-01-01/serverkeys/id_server.go index d0ad03177e2..9cfe370fe78 100644 --- a/resource-manager/postgresql/2020-01-01/serverkeys/id_server.go +++ b/resource-manager/postgresql/2020-01-01/serverkeys/id_server.go @@ -36,19 +36,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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 err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/postgresql/2021-06-01/configurations/id_configuration.go b/resource-manager/postgresql/2021-06-01/configurations/id_configuration.go index 637b3889318..13ccace66ca 100644 --- a/resource-manager/postgresql/2021-06-01/configurations/id_configuration.go +++ b/resource-manager/postgresql/2021-06-01/configurations/id_configuration.go @@ -38,23 +38,9 @@ func ParseConfigurationID(input string) (*ConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) - } - - if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConfigurationIDInsensitively(input string) (*ConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationName", *parsed) + if id.ConfigurationName, ok = input.Parsed["configurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationName", input) } - return &id, nil + return nil } // ValidateConfigurationID checks that 'input' can be parsed as a Configuration ID diff --git a/resource-manager/postgresql/2021-06-01/configurations/id_flexibleserver.go b/resource-manager/postgresql/2021-06-01/configurations/id_flexibleserver.go index e46d806c603..14ca470c4fa 100644 --- a/resource-manager/postgresql/2021-06-01/configurations/id_flexibleserver.go +++ b/resource-manager/postgresql/2021-06-01/configurations/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2021-06-01/databases/id_database.go b/resource-manager/postgresql/2021-06-01/databases/id_database.go index 7c12e7e5637..55faf833ac6 100644 --- a/resource-manager/postgresql/2021-06-01/databases/id_database.go +++ b/resource-manager/postgresql/2021-06-01/databases/id_database.go @@ -38,23 +38,9 @@ func ParseDatabaseID(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDatabaseIDInsensitively(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - return &id, nil + return nil } // ValidateDatabaseID checks that 'input' can be parsed as a Database ID diff --git a/resource-manager/postgresql/2021-06-01/databases/id_flexibleserver.go b/resource-manager/postgresql/2021-06-01/databases/id_flexibleserver.go index 27e57057dc2..a1dc8d0a72e 100644 --- a/resource-manager/postgresql/2021-06-01/databases/id_flexibleserver.go +++ b/resource-manager/postgresql/2021-06-01/databases/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2021-06-01/firewallrules/id_firewallrule.go b/resource-manager/postgresql/2021-06-01/firewallrules/id_firewallrule.go index 54e67084ed7..ec173732176 100644 --- a/resource-manager/postgresql/2021-06-01/firewallrules/id_firewallrule.go +++ b/resource-manager/postgresql/2021-06-01/firewallrules/id_firewallrule.go @@ -38,23 +38,9 @@ func ParseFirewallRuleID(input string) (*FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallRuleId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) - } - - if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFirewallRuleIDInsensitively(input string) (*FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FirewallRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + if id.FirewallRuleName, ok = input.Parsed["firewallRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", input) } - return &id, nil + return nil } // ValidateFirewallRuleID checks that 'input' can be parsed as a Firewall Rule ID diff --git a/resource-manager/postgresql/2021-06-01/firewallrules/id_flexibleserver.go b/resource-manager/postgresql/2021-06-01/firewallrules/id_flexibleserver.go index 4f87c5d4620..42d9408afac 100644 --- a/resource-manager/postgresql/2021-06-01/firewallrules/id_flexibleserver.go +++ b/resource-manager/postgresql/2021-06-01/firewallrules/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2021-06-01/locationbasedcapabilities/id_location.go b/resource-manager/postgresql/2021-06-01/locationbasedcapabilities/id_location.go index 7bd93fc9c3c..135b4bedf00 100644 --- a/resource-manager/postgresql/2021-06-01/locationbasedcapabilities/id_location.go +++ b/resource-manager/postgresql/2021-06-01/locationbasedcapabilities/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/postgresql/2021-06-01/serverrestart/id_flexibleserver.go b/resource-manager/postgresql/2021-06-01/serverrestart/id_flexibleserver.go index fbcd5eee062..c5ee5c5b5ec 100644 --- a/resource-manager/postgresql/2021-06-01/serverrestart/id_flexibleserver.go +++ b/resource-manager/postgresql/2021-06-01/serverrestart/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2021-06-01/servers/id_flexibleserver.go b/resource-manager/postgresql/2021-06-01/servers/id_flexibleserver.go index 10f7db4ca36..61acacfe354 100644 --- a/resource-manager/postgresql/2021-06-01/servers/id_flexibleserver.go +++ b/resource-manager/postgresql/2021-06-01/servers/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2021-06-01/serverstart/id_flexibleserver.go b/resource-manager/postgresql/2021-06-01/serverstart/id_flexibleserver.go index 27100958c0f..0f22022953b 100644 --- a/resource-manager/postgresql/2021-06-01/serverstart/id_flexibleserver.go +++ b/resource-manager/postgresql/2021-06-01/serverstart/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2021-06-01/serverstop/id_flexibleserver.go b/resource-manager/postgresql/2021-06-01/serverstop/id_flexibleserver.go index 405b7346a8f..810b8980af9 100644 --- a/resource-manager/postgresql/2021-06-01/serverstop/id_flexibleserver.go +++ b/resource-manager/postgresql/2021-06-01/serverstop/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2022-03-08-preview/administrators/id_administrator.go b/resource-manager/postgresql/2022-03-08-preview/administrators/id_administrator.go index d425b96cbc1..6155faf52a2 100644 --- a/resource-manager/postgresql/2022-03-08-preview/administrators/id_administrator.go +++ b/resource-manager/postgresql/2022-03-08-preview/administrators/id_administrator.go @@ -38,23 +38,9 @@ func ParseAdministratorID(input string) (*AdministratorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AdministratorId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) - } - - if id.ObjectId, ok = parsed.Parsed["objectId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "objectId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAdministratorIDInsensitively(input string) (*AdministratorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AdministratorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AdministratorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - if id.ObjectId, ok = parsed.Parsed["objectId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "objectId", *parsed) + if id.ObjectId, ok = input.Parsed["objectId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "objectId", input) } - return &id, nil + return nil } // ValidateAdministratorID checks that 'input' can be parsed as a Administrator ID diff --git a/resource-manager/postgresql/2022-03-08-preview/administrators/id_flexibleserver.go b/resource-manager/postgresql/2022-03-08-preview/administrators/id_flexibleserver.go index 9dc1595e365..49eb38e5bd9 100644 --- a/resource-manager/postgresql/2022-03-08-preview/administrators/id_flexibleserver.go +++ b/resource-manager/postgresql/2022-03-08-preview/administrators/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2022-03-08-preview/backups/id_backup.go b/resource-manager/postgresql/2022-03-08-preview/backups/id_backup.go index f0d4cea7af5..b18dd0971f4 100644 --- a/resource-manager/postgresql/2022-03-08-preview/backups/id_backup.go +++ b/resource-manager/postgresql/2022-03-08-preview/backups/id_backup.go @@ -38,23 +38,9 @@ func ParseBackupID(input string) (*BackupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) - } - - if id.BackupName, ok = parsed.Parsed["backupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupIDInsensitively(input string) (*BackupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - if id.BackupName, ok = parsed.Parsed["backupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupName", *parsed) + if id.BackupName, ok = input.Parsed["backupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupName", input) } - return &id, nil + return nil } // ValidateBackupID checks that 'input' can be parsed as a Backup ID diff --git a/resource-manager/postgresql/2022-03-08-preview/backups/id_flexibleserver.go b/resource-manager/postgresql/2022-03-08-preview/backups/id_flexibleserver.go index 039e31009d7..1a8ba0f8bcc 100644 --- a/resource-manager/postgresql/2022-03-08-preview/backups/id_flexibleserver.go +++ b/resource-manager/postgresql/2022-03-08-preview/backups/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2022-03-08-preview/checknameavailability/id_location.go b/resource-manager/postgresql/2022-03-08-preview/checknameavailability/id_location.go index 242649555e6..5985b341037 100644 --- a/resource-manager/postgresql/2022-03-08-preview/checknameavailability/id_location.go +++ b/resource-manager/postgresql/2022-03-08-preview/checknameavailability/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/postgresql/2022-03-08-preview/configurations/id_configuration.go b/resource-manager/postgresql/2022-03-08-preview/configurations/id_configuration.go index 637b3889318..13ccace66ca 100644 --- a/resource-manager/postgresql/2022-03-08-preview/configurations/id_configuration.go +++ b/resource-manager/postgresql/2022-03-08-preview/configurations/id_configuration.go @@ -38,23 +38,9 @@ func ParseConfigurationID(input string) (*ConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) - } - - if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConfigurationIDInsensitively(input string) (*ConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationName", *parsed) + if id.ConfigurationName, ok = input.Parsed["configurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationName", input) } - return &id, nil + return nil } // ValidateConfigurationID checks that 'input' can be parsed as a Configuration ID diff --git a/resource-manager/postgresql/2022-03-08-preview/configurations/id_flexibleserver.go b/resource-manager/postgresql/2022-03-08-preview/configurations/id_flexibleserver.go index e46d806c603..14ca470c4fa 100644 --- a/resource-manager/postgresql/2022-03-08-preview/configurations/id_flexibleserver.go +++ b/resource-manager/postgresql/2022-03-08-preview/configurations/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2022-03-08-preview/databases/id_database.go b/resource-manager/postgresql/2022-03-08-preview/databases/id_database.go index 7c12e7e5637..55faf833ac6 100644 --- a/resource-manager/postgresql/2022-03-08-preview/databases/id_database.go +++ b/resource-manager/postgresql/2022-03-08-preview/databases/id_database.go @@ -38,23 +38,9 @@ func ParseDatabaseID(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDatabaseIDInsensitively(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - return &id, nil + return nil } // ValidateDatabaseID checks that 'input' can be parsed as a Database ID diff --git a/resource-manager/postgresql/2022-03-08-preview/databases/id_flexibleserver.go b/resource-manager/postgresql/2022-03-08-preview/databases/id_flexibleserver.go index 27e57057dc2..a1dc8d0a72e 100644 --- a/resource-manager/postgresql/2022-03-08-preview/databases/id_flexibleserver.go +++ b/resource-manager/postgresql/2022-03-08-preview/databases/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2022-03-08-preview/firewallrules/id_firewallrule.go b/resource-manager/postgresql/2022-03-08-preview/firewallrules/id_firewallrule.go index 54e67084ed7..ec173732176 100644 --- a/resource-manager/postgresql/2022-03-08-preview/firewallrules/id_firewallrule.go +++ b/resource-manager/postgresql/2022-03-08-preview/firewallrules/id_firewallrule.go @@ -38,23 +38,9 @@ func ParseFirewallRuleID(input string) (*FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallRuleId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) - } - - if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFirewallRuleIDInsensitively(input string) (*FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FirewallRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + if id.FirewallRuleName, ok = input.Parsed["firewallRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", input) } - return &id, nil + return nil } // ValidateFirewallRuleID checks that 'input' can be parsed as a Firewall Rule ID diff --git a/resource-manager/postgresql/2022-03-08-preview/firewallrules/id_flexibleserver.go b/resource-manager/postgresql/2022-03-08-preview/firewallrules/id_flexibleserver.go index 4f87c5d4620..42d9408afac 100644 --- a/resource-manager/postgresql/2022-03-08-preview/firewallrules/id_flexibleserver.go +++ b/resource-manager/postgresql/2022-03-08-preview/firewallrules/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2022-03-08-preview/locationbasedcapabilities/id_location.go b/resource-manager/postgresql/2022-03-08-preview/locationbasedcapabilities/id_location.go index 7bd93fc9c3c..135b4bedf00 100644 --- a/resource-manager/postgresql/2022-03-08-preview/locationbasedcapabilities/id_location.go +++ b/resource-manager/postgresql/2022-03-08-preview/locationbasedcapabilities/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/postgresql/2022-03-08-preview/replicas/id_flexibleserver.go b/resource-manager/postgresql/2022-03-08-preview/replicas/id_flexibleserver.go index 33352ce9d81..a912a099590 100644 --- a/resource-manager/postgresql/2022-03-08-preview/replicas/id_flexibleserver.go +++ b/resource-manager/postgresql/2022-03-08-preview/replicas/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2022-03-08-preview/serverrestart/id_flexibleserver.go b/resource-manager/postgresql/2022-03-08-preview/serverrestart/id_flexibleserver.go index fbcd5eee062..c5ee5c5b5ec 100644 --- a/resource-manager/postgresql/2022-03-08-preview/serverrestart/id_flexibleserver.go +++ b/resource-manager/postgresql/2022-03-08-preview/serverrestart/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2022-03-08-preview/servers/id_flexibleserver.go b/resource-manager/postgresql/2022-03-08-preview/servers/id_flexibleserver.go index 10f7db4ca36..61acacfe354 100644 --- a/resource-manager/postgresql/2022-03-08-preview/servers/id_flexibleserver.go +++ b/resource-manager/postgresql/2022-03-08-preview/servers/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2022-03-08-preview/serverstart/id_flexibleserver.go b/resource-manager/postgresql/2022-03-08-preview/serverstart/id_flexibleserver.go index 27100958c0f..0f22022953b 100644 --- a/resource-manager/postgresql/2022-03-08-preview/serverstart/id_flexibleserver.go +++ b/resource-manager/postgresql/2022-03-08-preview/serverstart/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2022-03-08-preview/serverstop/id_flexibleserver.go b/resource-manager/postgresql/2022-03-08-preview/serverstop/id_flexibleserver.go index 405b7346a8f..810b8980af9 100644 --- a/resource-manager/postgresql/2022-03-08-preview/serverstop/id_flexibleserver.go +++ b/resource-manager/postgresql/2022-03-08-preview/serverstop/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2022-12-01/administrators/id_administrator.go b/resource-manager/postgresql/2022-12-01/administrators/id_administrator.go index d425b96cbc1..6155faf52a2 100644 --- a/resource-manager/postgresql/2022-12-01/administrators/id_administrator.go +++ b/resource-manager/postgresql/2022-12-01/administrators/id_administrator.go @@ -38,23 +38,9 @@ func ParseAdministratorID(input string) (*AdministratorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AdministratorId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) - } - - if id.ObjectId, ok = parsed.Parsed["objectId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "objectId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAdministratorIDInsensitively(input string) (*AdministratorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AdministratorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AdministratorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - if id.ObjectId, ok = parsed.Parsed["objectId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "objectId", *parsed) + if id.ObjectId, ok = input.Parsed["objectId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "objectId", input) } - return &id, nil + return nil } // ValidateAdministratorID checks that 'input' can be parsed as a Administrator ID diff --git a/resource-manager/postgresql/2022-12-01/administrators/id_flexibleserver.go b/resource-manager/postgresql/2022-12-01/administrators/id_flexibleserver.go index 9dc1595e365..49eb38e5bd9 100644 --- a/resource-manager/postgresql/2022-12-01/administrators/id_flexibleserver.go +++ b/resource-manager/postgresql/2022-12-01/administrators/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2022-12-01/backups/id_backup.go b/resource-manager/postgresql/2022-12-01/backups/id_backup.go index f0d4cea7af5..b18dd0971f4 100644 --- a/resource-manager/postgresql/2022-12-01/backups/id_backup.go +++ b/resource-manager/postgresql/2022-12-01/backups/id_backup.go @@ -38,23 +38,9 @@ func ParseBackupID(input string) (*BackupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) - } - - if id.BackupName, ok = parsed.Parsed["backupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupIDInsensitively(input string) (*BackupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - if id.BackupName, ok = parsed.Parsed["backupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupName", *parsed) + if id.BackupName, ok = input.Parsed["backupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupName", input) } - return &id, nil + return nil } // ValidateBackupID checks that 'input' can be parsed as a Backup ID diff --git a/resource-manager/postgresql/2022-12-01/backups/id_flexibleserver.go b/resource-manager/postgresql/2022-12-01/backups/id_flexibleserver.go index 039e31009d7..1a8ba0f8bcc 100644 --- a/resource-manager/postgresql/2022-12-01/backups/id_flexibleserver.go +++ b/resource-manager/postgresql/2022-12-01/backups/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2022-12-01/checknameavailability/id_location.go b/resource-manager/postgresql/2022-12-01/checknameavailability/id_location.go index 242649555e6..5985b341037 100644 --- a/resource-manager/postgresql/2022-12-01/checknameavailability/id_location.go +++ b/resource-manager/postgresql/2022-12-01/checknameavailability/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/postgresql/2022-12-01/configurations/id_configuration.go b/resource-manager/postgresql/2022-12-01/configurations/id_configuration.go index 637b3889318..13ccace66ca 100644 --- a/resource-manager/postgresql/2022-12-01/configurations/id_configuration.go +++ b/resource-manager/postgresql/2022-12-01/configurations/id_configuration.go @@ -38,23 +38,9 @@ func ParseConfigurationID(input string) (*ConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) - } - - if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConfigurationIDInsensitively(input string) (*ConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationName", *parsed) + if id.ConfigurationName, ok = input.Parsed["configurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationName", input) } - return &id, nil + return nil } // ValidateConfigurationID checks that 'input' can be parsed as a Configuration ID diff --git a/resource-manager/postgresql/2022-12-01/configurations/id_flexibleserver.go b/resource-manager/postgresql/2022-12-01/configurations/id_flexibleserver.go index e46d806c603..14ca470c4fa 100644 --- a/resource-manager/postgresql/2022-12-01/configurations/id_flexibleserver.go +++ b/resource-manager/postgresql/2022-12-01/configurations/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2022-12-01/databases/id_database.go b/resource-manager/postgresql/2022-12-01/databases/id_database.go index 7c12e7e5637..55faf833ac6 100644 --- a/resource-manager/postgresql/2022-12-01/databases/id_database.go +++ b/resource-manager/postgresql/2022-12-01/databases/id_database.go @@ -38,23 +38,9 @@ func ParseDatabaseID(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDatabaseIDInsensitively(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - return &id, nil + return nil } // ValidateDatabaseID checks that 'input' can be parsed as a Database ID diff --git a/resource-manager/postgresql/2022-12-01/databases/id_flexibleserver.go b/resource-manager/postgresql/2022-12-01/databases/id_flexibleserver.go index 27e57057dc2..a1dc8d0a72e 100644 --- a/resource-manager/postgresql/2022-12-01/databases/id_flexibleserver.go +++ b/resource-manager/postgresql/2022-12-01/databases/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2022-12-01/firewallrules/id_firewallrule.go b/resource-manager/postgresql/2022-12-01/firewallrules/id_firewallrule.go index 54e67084ed7..ec173732176 100644 --- a/resource-manager/postgresql/2022-12-01/firewallrules/id_firewallrule.go +++ b/resource-manager/postgresql/2022-12-01/firewallrules/id_firewallrule.go @@ -38,23 +38,9 @@ func ParseFirewallRuleID(input string) (*FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallRuleId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) - } - - if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFirewallRuleIDInsensitively(input string) (*FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FirewallRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + if id.FirewallRuleName, ok = input.Parsed["firewallRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", input) } - return &id, nil + return nil } // ValidateFirewallRuleID checks that 'input' can be parsed as a Firewall Rule ID diff --git a/resource-manager/postgresql/2022-12-01/firewallrules/id_flexibleserver.go b/resource-manager/postgresql/2022-12-01/firewallrules/id_flexibleserver.go index 4f87c5d4620..42d9408afac 100644 --- a/resource-manager/postgresql/2022-12-01/firewallrules/id_flexibleserver.go +++ b/resource-manager/postgresql/2022-12-01/firewallrules/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2022-12-01/locationbasedcapabilities/id_location.go b/resource-manager/postgresql/2022-12-01/locationbasedcapabilities/id_location.go index 7bd93fc9c3c..135b4bedf00 100644 --- a/resource-manager/postgresql/2022-12-01/locationbasedcapabilities/id_location.go +++ b/resource-manager/postgresql/2022-12-01/locationbasedcapabilities/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/postgresql/2022-12-01/replicas/id_flexibleserver.go b/resource-manager/postgresql/2022-12-01/replicas/id_flexibleserver.go index 33352ce9d81..a912a099590 100644 --- a/resource-manager/postgresql/2022-12-01/replicas/id_flexibleserver.go +++ b/resource-manager/postgresql/2022-12-01/replicas/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2022-12-01/serverrestart/id_flexibleserver.go b/resource-manager/postgresql/2022-12-01/serverrestart/id_flexibleserver.go index fbcd5eee062..c5ee5c5b5ec 100644 --- a/resource-manager/postgresql/2022-12-01/serverrestart/id_flexibleserver.go +++ b/resource-manager/postgresql/2022-12-01/serverrestart/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2022-12-01/servers/id_flexibleserver.go b/resource-manager/postgresql/2022-12-01/servers/id_flexibleserver.go index 10f7db4ca36..61acacfe354 100644 --- a/resource-manager/postgresql/2022-12-01/servers/id_flexibleserver.go +++ b/resource-manager/postgresql/2022-12-01/servers/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2022-12-01/serverstart/id_flexibleserver.go b/resource-manager/postgresql/2022-12-01/serverstart/id_flexibleserver.go index 27100958c0f..0f22022953b 100644 --- a/resource-manager/postgresql/2022-12-01/serverstart/id_flexibleserver.go +++ b/resource-manager/postgresql/2022-12-01/serverstart/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2022-12-01/serverstop/id_flexibleserver.go b/resource-manager/postgresql/2022-12-01/serverstop/id_flexibleserver.go index 405b7346a8f..810b8980af9 100644 --- a/resource-manager/postgresql/2022-12-01/serverstop/id_flexibleserver.go +++ b/resource-manager/postgresql/2022-12-01/serverstop/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2023-03-01-preview/administrators/id_administrator.go b/resource-manager/postgresql/2023-03-01-preview/administrators/id_administrator.go index d425b96cbc1..6155faf52a2 100644 --- a/resource-manager/postgresql/2023-03-01-preview/administrators/id_administrator.go +++ b/resource-manager/postgresql/2023-03-01-preview/administrators/id_administrator.go @@ -38,23 +38,9 @@ func ParseAdministratorID(input string) (*AdministratorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AdministratorId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) - } - - if id.ObjectId, ok = parsed.Parsed["objectId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "objectId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAdministratorIDInsensitively(input string) (*AdministratorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AdministratorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AdministratorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - if id.ObjectId, ok = parsed.Parsed["objectId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "objectId", *parsed) + if id.ObjectId, ok = input.Parsed["objectId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "objectId", input) } - return &id, nil + return nil } // ValidateAdministratorID checks that 'input' can be parsed as a Administrator ID diff --git a/resource-manager/postgresql/2023-03-01-preview/administrators/id_flexibleserver.go b/resource-manager/postgresql/2023-03-01-preview/administrators/id_flexibleserver.go index 9dc1595e365..49eb38e5bd9 100644 --- a/resource-manager/postgresql/2023-03-01-preview/administrators/id_flexibleserver.go +++ b/resource-manager/postgresql/2023-03-01-preview/administrators/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2023-03-01-preview/backups/id_backup.go b/resource-manager/postgresql/2023-03-01-preview/backups/id_backup.go index f0d4cea7af5..b18dd0971f4 100644 --- a/resource-manager/postgresql/2023-03-01-preview/backups/id_backup.go +++ b/resource-manager/postgresql/2023-03-01-preview/backups/id_backup.go @@ -38,23 +38,9 @@ func ParseBackupID(input string) (*BackupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) - } - - if id.BackupName, ok = parsed.Parsed["backupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupIDInsensitively(input string) (*BackupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - if id.BackupName, ok = parsed.Parsed["backupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupName", *parsed) + if id.BackupName, ok = input.Parsed["backupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupName", input) } - return &id, nil + return nil } // ValidateBackupID checks that 'input' can be parsed as a Backup ID diff --git a/resource-manager/postgresql/2023-03-01-preview/backups/id_flexibleserver.go b/resource-manager/postgresql/2023-03-01-preview/backups/id_flexibleserver.go index 039e31009d7..1a8ba0f8bcc 100644 --- a/resource-manager/postgresql/2023-03-01-preview/backups/id_flexibleserver.go +++ b/resource-manager/postgresql/2023-03-01-preview/backups/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2023-03-01-preview/checknameavailability/id_location.go b/resource-manager/postgresql/2023-03-01-preview/checknameavailability/id_location.go index 242649555e6..5985b341037 100644 --- a/resource-manager/postgresql/2023-03-01-preview/checknameavailability/id_location.go +++ b/resource-manager/postgresql/2023-03-01-preview/checknameavailability/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/postgresql/2023-03-01-preview/configurations/id_configuration.go b/resource-manager/postgresql/2023-03-01-preview/configurations/id_configuration.go index 637b3889318..13ccace66ca 100644 --- a/resource-manager/postgresql/2023-03-01-preview/configurations/id_configuration.go +++ b/resource-manager/postgresql/2023-03-01-preview/configurations/id_configuration.go @@ -38,23 +38,9 @@ func ParseConfigurationID(input string) (*ConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) - } - - if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConfigurationIDInsensitively(input string) (*ConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationName", *parsed) + if id.ConfigurationName, ok = input.Parsed["configurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationName", input) } - return &id, nil + return nil } // ValidateConfigurationID checks that 'input' can be parsed as a Configuration ID diff --git a/resource-manager/postgresql/2023-03-01-preview/configurations/id_flexibleserver.go b/resource-manager/postgresql/2023-03-01-preview/configurations/id_flexibleserver.go index e46d806c603..14ca470c4fa 100644 --- a/resource-manager/postgresql/2023-03-01-preview/configurations/id_flexibleserver.go +++ b/resource-manager/postgresql/2023-03-01-preview/configurations/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2023-03-01-preview/customoperation/id_flexibleserver.go b/resource-manager/postgresql/2023-03-01-preview/customoperation/id_flexibleserver.go index e1c10215ec7..67271f59836 100644 --- a/resource-manager/postgresql/2023-03-01-preview/customoperation/id_flexibleserver.go +++ b/resource-manager/postgresql/2023-03-01-preview/customoperation/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2023-03-01-preview/databases/id_database.go b/resource-manager/postgresql/2023-03-01-preview/databases/id_database.go index 7c12e7e5637..55faf833ac6 100644 --- a/resource-manager/postgresql/2023-03-01-preview/databases/id_database.go +++ b/resource-manager/postgresql/2023-03-01-preview/databases/id_database.go @@ -38,23 +38,9 @@ func ParseDatabaseID(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDatabaseIDInsensitively(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - return &id, nil + return nil } // ValidateDatabaseID checks that 'input' can be parsed as a Database ID diff --git a/resource-manager/postgresql/2023-03-01-preview/databases/id_flexibleserver.go b/resource-manager/postgresql/2023-03-01-preview/databases/id_flexibleserver.go index 27e57057dc2..a1dc8d0a72e 100644 --- a/resource-manager/postgresql/2023-03-01-preview/databases/id_flexibleserver.go +++ b/resource-manager/postgresql/2023-03-01-preview/databases/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2023-03-01-preview/firewallrules/id_firewallrule.go b/resource-manager/postgresql/2023-03-01-preview/firewallrules/id_firewallrule.go index 54e67084ed7..ec173732176 100644 --- a/resource-manager/postgresql/2023-03-01-preview/firewallrules/id_firewallrule.go +++ b/resource-manager/postgresql/2023-03-01-preview/firewallrules/id_firewallrule.go @@ -38,23 +38,9 @@ func ParseFirewallRuleID(input string) (*FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallRuleId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) - } - - if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFirewallRuleIDInsensitively(input string) (*FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FirewallRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + if id.FirewallRuleName, ok = input.Parsed["firewallRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", input) } - return &id, nil + return nil } // ValidateFirewallRuleID checks that 'input' can be parsed as a Firewall Rule ID diff --git a/resource-manager/postgresql/2023-03-01-preview/firewallrules/id_flexibleserver.go b/resource-manager/postgresql/2023-03-01-preview/firewallrules/id_flexibleserver.go index 4f87c5d4620..42d9408afac 100644 --- a/resource-manager/postgresql/2023-03-01-preview/firewallrules/id_flexibleserver.go +++ b/resource-manager/postgresql/2023-03-01-preview/firewallrules/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2023-03-01-preview/flexibleservercapabilities/id_flexibleserver.go b/resource-manager/postgresql/2023-03-01-preview/flexibleservercapabilities/id_flexibleserver.go index 584bcf7af15..2eda1434e3b 100644 --- a/resource-manager/postgresql/2023-03-01-preview/flexibleservercapabilities/id_flexibleserver.go +++ b/resource-manager/postgresql/2023-03-01-preview/flexibleservercapabilities/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2023-03-01-preview/locationbasedcapabilities/id_location.go b/resource-manager/postgresql/2023-03-01-preview/locationbasedcapabilities/id_location.go index 7bd93fc9c3c..135b4bedf00 100644 --- a/resource-manager/postgresql/2023-03-01-preview/locationbasedcapabilities/id_location.go +++ b/resource-manager/postgresql/2023-03-01-preview/locationbasedcapabilities/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/postgresql/2023-03-01-preview/logfiles/id_flexibleserver.go b/resource-manager/postgresql/2023-03-01-preview/logfiles/id_flexibleserver.go index c75ea773830..824423cfcc6 100644 --- a/resource-manager/postgresql/2023-03-01-preview/logfiles/id_flexibleserver.go +++ b/resource-manager/postgresql/2023-03-01-preview/logfiles/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2023-03-01-preview/longtermretentionbackup/id_flexibleserver.go b/resource-manager/postgresql/2023-03-01-preview/longtermretentionbackup/id_flexibleserver.go index f5b6fc5f7b0..d9620918c6c 100644 --- a/resource-manager/postgresql/2023-03-01-preview/longtermretentionbackup/id_flexibleserver.go +++ b/resource-manager/postgresql/2023-03-01-preview/longtermretentionbackup/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2023-03-01-preview/longtermretentionbackup/id_ltrbackupoperation.go b/resource-manager/postgresql/2023-03-01-preview/longtermretentionbackup/id_ltrbackupoperation.go index 6433401917b..a19d9fc4dc7 100644 --- a/resource-manager/postgresql/2023-03-01-preview/longtermretentionbackup/id_ltrbackupoperation.go +++ b/resource-manager/postgresql/2023-03-01-preview/longtermretentionbackup/id_ltrbackupoperation.go @@ -38,23 +38,9 @@ func ParseLtrBackupOperationID(input string) (*LtrBackupOperationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LtrBackupOperationId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) - } - - if id.LtrBackupOperationName, ok = parsed.Parsed["ltrBackupOperationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ltrBackupOperationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLtrBackupOperationIDInsensitively(input string) (*LtrBackupOperationId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LtrBackupOperationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LtrBackupOperationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - if id.LtrBackupOperationName, ok = parsed.Parsed["ltrBackupOperationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ltrBackupOperationName", *parsed) + if id.LtrBackupOperationName, ok = input.Parsed["ltrBackupOperationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ltrBackupOperationName", input) } - return &id, nil + return nil } // ValidateLtrBackupOperationID checks that 'input' can be parsed as a Ltr Backup Operation ID diff --git a/resource-manager/postgresql/2023-03-01-preview/migrations/id_flexibleserver.go b/resource-manager/postgresql/2023-03-01-preview/migrations/id_flexibleserver.go index 5df72f712c7..61b979a8820 100644 --- a/resource-manager/postgresql/2023-03-01-preview/migrations/id_flexibleserver.go +++ b/resource-manager/postgresql/2023-03-01-preview/migrations/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2023-03-01-preview/migrations/id_migration.go b/resource-manager/postgresql/2023-03-01-preview/migrations/id_migration.go index 0532c7e57f8..eef326063b7 100644 --- a/resource-manager/postgresql/2023-03-01-preview/migrations/id_migration.go +++ b/resource-manager/postgresql/2023-03-01-preview/migrations/id_migration.go @@ -38,23 +38,9 @@ func ParseMigrationID(input string) (*MigrationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MigrationId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) - } - - if id.MigrationName, ok = parsed.Parsed["migrationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "migrationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseMigrationIDInsensitively(input string) (*MigrationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MigrationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *MigrationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - if id.MigrationName, ok = parsed.Parsed["migrationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "migrationName", *parsed) + if id.MigrationName, ok = input.Parsed["migrationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "migrationName", input) } - return &id, nil + return nil } // ValidateMigrationID checks that 'input' can be parsed as a Migration ID diff --git a/resource-manager/postgresql/2023-03-01-preview/post/id_flexibleserver.go b/resource-manager/postgresql/2023-03-01-preview/post/id_flexibleserver.go index c8b021fabab..e727e294b3f 100644 --- a/resource-manager/postgresql/2023-03-01-preview/post/id_flexibleserver.go +++ b/resource-manager/postgresql/2023-03-01-preview/post/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2023-03-01-preview/replicas/id_flexibleserver.go b/resource-manager/postgresql/2023-03-01-preview/replicas/id_flexibleserver.go index 33352ce9d81..a912a099590 100644 --- a/resource-manager/postgresql/2023-03-01-preview/replicas/id_flexibleserver.go +++ b/resource-manager/postgresql/2023-03-01-preview/replicas/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2023-03-01-preview/serverrestart/id_flexibleserver.go b/resource-manager/postgresql/2023-03-01-preview/serverrestart/id_flexibleserver.go index fbcd5eee062..c5ee5c5b5ec 100644 --- a/resource-manager/postgresql/2023-03-01-preview/serverrestart/id_flexibleserver.go +++ b/resource-manager/postgresql/2023-03-01-preview/serverrestart/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2023-03-01-preview/servers/id_flexibleserver.go b/resource-manager/postgresql/2023-03-01-preview/servers/id_flexibleserver.go index 10f7db4ca36..61acacfe354 100644 --- a/resource-manager/postgresql/2023-03-01-preview/servers/id_flexibleserver.go +++ b/resource-manager/postgresql/2023-03-01-preview/servers/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2023-03-01-preview/serverstart/id_flexibleserver.go b/resource-manager/postgresql/2023-03-01-preview/serverstart/id_flexibleserver.go index 27100958c0f..0f22022953b 100644 --- a/resource-manager/postgresql/2023-03-01-preview/serverstart/id_flexibleserver.go +++ b/resource-manager/postgresql/2023-03-01-preview/serverstart/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2023-03-01-preview/serverstop/id_flexibleserver.go b/resource-manager/postgresql/2023-03-01-preview/serverstop/id_flexibleserver.go index 405b7346a8f..810b8980af9 100644 --- a/resource-manager/postgresql/2023-03-01-preview/serverstop/id_flexibleserver.go +++ b/resource-manager/postgresql/2023-03-01-preview/serverstop/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2023-06-01-preview/administrators/id_administrator.go b/resource-manager/postgresql/2023-06-01-preview/administrators/id_administrator.go index d425b96cbc1..6155faf52a2 100644 --- a/resource-manager/postgresql/2023-06-01-preview/administrators/id_administrator.go +++ b/resource-manager/postgresql/2023-06-01-preview/administrators/id_administrator.go @@ -38,23 +38,9 @@ func ParseAdministratorID(input string) (*AdministratorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AdministratorId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) - } - - if id.ObjectId, ok = parsed.Parsed["objectId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "objectId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAdministratorIDInsensitively(input string) (*AdministratorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AdministratorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AdministratorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - if id.ObjectId, ok = parsed.Parsed["objectId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "objectId", *parsed) + if id.ObjectId, ok = input.Parsed["objectId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "objectId", input) } - return &id, nil + return nil } // ValidateAdministratorID checks that 'input' can be parsed as a Administrator ID diff --git a/resource-manager/postgresql/2023-06-01-preview/administrators/id_flexibleserver.go b/resource-manager/postgresql/2023-06-01-preview/administrators/id_flexibleserver.go index 9dc1595e365..49eb38e5bd9 100644 --- a/resource-manager/postgresql/2023-06-01-preview/administrators/id_flexibleserver.go +++ b/resource-manager/postgresql/2023-06-01-preview/administrators/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2023-06-01-preview/advancedthreatprotectionsettings/id_flexibleserver.go b/resource-manager/postgresql/2023-06-01-preview/advancedthreatprotectionsettings/id_flexibleserver.go index f15a96fdf3c..2fb8a262b97 100644 --- a/resource-manager/postgresql/2023-06-01-preview/advancedthreatprotectionsettings/id_flexibleserver.go +++ b/resource-manager/postgresql/2023-06-01-preview/advancedthreatprotectionsettings/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2023-06-01-preview/backups/id_backup.go b/resource-manager/postgresql/2023-06-01-preview/backups/id_backup.go index f0d4cea7af5..b18dd0971f4 100644 --- a/resource-manager/postgresql/2023-06-01-preview/backups/id_backup.go +++ b/resource-manager/postgresql/2023-06-01-preview/backups/id_backup.go @@ -38,23 +38,9 @@ func ParseBackupID(input string) (*BackupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) - } - - if id.BackupName, ok = parsed.Parsed["backupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupIDInsensitively(input string) (*BackupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - if id.BackupName, ok = parsed.Parsed["backupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupName", *parsed) + if id.BackupName, ok = input.Parsed["backupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupName", input) } - return &id, nil + return nil } // ValidateBackupID checks that 'input' can be parsed as a Backup ID diff --git a/resource-manager/postgresql/2023-06-01-preview/backups/id_flexibleserver.go b/resource-manager/postgresql/2023-06-01-preview/backups/id_flexibleserver.go index 039e31009d7..1a8ba0f8bcc 100644 --- a/resource-manager/postgresql/2023-06-01-preview/backups/id_flexibleserver.go +++ b/resource-manager/postgresql/2023-06-01-preview/backups/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2023-06-01-preview/checknameavailability/id_location.go b/resource-manager/postgresql/2023-06-01-preview/checknameavailability/id_location.go index 242649555e6..5985b341037 100644 --- a/resource-manager/postgresql/2023-06-01-preview/checknameavailability/id_location.go +++ b/resource-manager/postgresql/2023-06-01-preview/checknameavailability/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/postgresql/2023-06-01-preview/configurations/id_configuration.go b/resource-manager/postgresql/2023-06-01-preview/configurations/id_configuration.go index 637b3889318..13ccace66ca 100644 --- a/resource-manager/postgresql/2023-06-01-preview/configurations/id_configuration.go +++ b/resource-manager/postgresql/2023-06-01-preview/configurations/id_configuration.go @@ -38,23 +38,9 @@ func ParseConfigurationID(input string) (*ConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) - } - - if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConfigurationIDInsensitively(input string) (*ConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationName", *parsed) + if id.ConfigurationName, ok = input.Parsed["configurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationName", input) } - return &id, nil + return nil } // ValidateConfigurationID checks that 'input' can be parsed as a Configuration ID diff --git a/resource-manager/postgresql/2023-06-01-preview/configurations/id_flexibleserver.go b/resource-manager/postgresql/2023-06-01-preview/configurations/id_flexibleserver.go index e46d806c603..14ca470c4fa 100644 --- a/resource-manager/postgresql/2023-06-01-preview/configurations/id_flexibleserver.go +++ b/resource-manager/postgresql/2023-06-01-preview/configurations/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2023-06-01-preview/customoperation/id_flexibleserver.go b/resource-manager/postgresql/2023-06-01-preview/customoperation/id_flexibleserver.go index e1c10215ec7..67271f59836 100644 --- a/resource-manager/postgresql/2023-06-01-preview/customoperation/id_flexibleserver.go +++ b/resource-manager/postgresql/2023-06-01-preview/customoperation/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2023-06-01-preview/databases/id_database.go b/resource-manager/postgresql/2023-06-01-preview/databases/id_database.go index 7c12e7e5637..55faf833ac6 100644 --- a/resource-manager/postgresql/2023-06-01-preview/databases/id_database.go +++ b/resource-manager/postgresql/2023-06-01-preview/databases/id_database.go @@ -38,23 +38,9 @@ func ParseDatabaseID(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDatabaseIDInsensitively(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - return &id, nil + return nil } // ValidateDatabaseID checks that 'input' can be parsed as a Database ID diff --git a/resource-manager/postgresql/2023-06-01-preview/databases/id_flexibleserver.go b/resource-manager/postgresql/2023-06-01-preview/databases/id_flexibleserver.go index 27e57057dc2..a1dc8d0a72e 100644 --- a/resource-manager/postgresql/2023-06-01-preview/databases/id_flexibleserver.go +++ b/resource-manager/postgresql/2023-06-01-preview/databases/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2023-06-01-preview/firewallrules/id_firewallrule.go b/resource-manager/postgresql/2023-06-01-preview/firewallrules/id_firewallrule.go index 54e67084ed7..ec173732176 100644 --- a/resource-manager/postgresql/2023-06-01-preview/firewallrules/id_firewallrule.go +++ b/resource-manager/postgresql/2023-06-01-preview/firewallrules/id_firewallrule.go @@ -38,23 +38,9 @@ func ParseFirewallRuleID(input string) (*FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallRuleId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) - } - - if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFirewallRuleIDInsensitively(input string) (*FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FirewallRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + if id.FirewallRuleName, ok = input.Parsed["firewallRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", input) } - return &id, nil + return nil } // ValidateFirewallRuleID checks that 'input' can be parsed as a Firewall Rule ID diff --git a/resource-manager/postgresql/2023-06-01-preview/firewallrules/id_flexibleserver.go b/resource-manager/postgresql/2023-06-01-preview/firewallrules/id_flexibleserver.go index 4f87c5d4620..42d9408afac 100644 --- a/resource-manager/postgresql/2023-06-01-preview/firewallrules/id_flexibleserver.go +++ b/resource-manager/postgresql/2023-06-01-preview/firewallrules/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2023-06-01-preview/flexibleservercapabilities/id_flexibleserver.go b/resource-manager/postgresql/2023-06-01-preview/flexibleservercapabilities/id_flexibleserver.go index 584bcf7af15..2eda1434e3b 100644 --- a/resource-manager/postgresql/2023-06-01-preview/flexibleservercapabilities/id_flexibleserver.go +++ b/resource-manager/postgresql/2023-06-01-preview/flexibleservercapabilities/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2023-06-01-preview/locationbasedcapabilities/id_location.go b/resource-manager/postgresql/2023-06-01-preview/locationbasedcapabilities/id_location.go index 7bd93fc9c3c..135b4bedf00 100644 --- a/resource-manager/postgresql/2023-06-01-preview/locationbasedcapabilities/id_location.go +++ b/resource-manager/postgresql/2023-06-01-preview/locationbasedcapabilities/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/postgresql/2023-06-01-preview/logfiles/id_flexibleserver.go b/resource-manager/postgresql/2023-06-01-preview/logfiles/id_flexibleserver.go index c75ea773830..824423cfcc6 100644 --- a/resource-manager/postgresql/2023-06-01-preview/logfiles/id_flexibleserver.go +++ b/resource-manager/postgresql/2023-06-01-preview/logfiles/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2023-06-01-preview/longtermretentionbackup/id_flexibleserver.go b/resource-manager/postgresql/2023-06-01-preview/longtermretentionbackup/id_flexibleserver.go index f5b6fc5f7b0..d9620918c6c 100644 --- a/resource-manager/postgresql/2023-06-01-preview/longtermretentionbackup/id_flexibleserver.go +++ b/resource-manager/postgresql/2023-06-01-preview/longtermretentionbackup/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2023-06-01-preview/longtermretentionbackup/id_ltrbackupoperation.go b/resource-manager/postgresql/2023-06-01-preview/longtermretentionbackup/id_ltrbackupoperation.go index 6433401917b..a19d9fc4dc7 100644 --- a/resource-manager/postgresql/2023-06-01-preview/longtermretentionbackup/id_ltrbackupoperation.go +++ b/resource-manager/postgresql/2023-06-01-preview/longtermretentionbackup/id_ltrbackupoperation.go @@ -38,23 +38,9 @@ func ParseLtrBackupOperationID(input string) (*LtrBackupOperationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LtrBackupOperationId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) - } - - if id.LtrBackupOperationName, ok = parsed.Parsed["ltrBackupOperationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ltrBackupOperationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLtrBackupOperationIDInsensitively(input string) (*LtrBackupOperationId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LtrBackupOperationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LtrBackupOperationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - if id.LtrBackupOperationName, ok = parsed.Parsed["ltrBackupOperationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ltrBackupOperationName", *parsed) + if id.LtrBackupOperationName, ok = input.Parsed["ltrBackupOperationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ltrBackupOperationName", input) } - return &id, nil + return nil } // ValidateLtrBackupOperationID checks that 'input' can be parsed as a Ltr Backup Operation ID diff --git a/resource-manager/postgresql/2023-06-01-preview/migrations/id_flexibleserver.go b/resource-manager/postgresql/2023-06-01-preview/migrations/id_flexibleserver.go index 5df72f712c7..61b979a8820 100644 --- a/resource-manager/postgresql/2023-06-01-preview/migrations/id_flexibleserver.go +++ b/resource-manager/postgresql/2023-06-01-preview/migrations/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2023-06-01-preview/migrations/id_migration.go b/resource-manager/postgresql/2023-06-01-preview/migrations/id_migration.go index 0532c7e57f8..eef326063b7 100644 --- a/resource-manager/postgresql/2023-06-01-preview/migrations/id_migration.go +++ b/resource-manager/postgresql/2023-06-01-preview/migrations/id_migration.go @@ -38,23 +38,9 @@ func ParseMigrationID(input string) (*MigrationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MigrationId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) - } - - if id.MigrationName, ok = parsed.Parsed["migrationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "migrationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseMigrationIDInsensitively(input string) (*MigrationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MigrationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *MigrationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - if id.MigrationName, ok = parsed.Parsed["migrationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "migrationName", *parsed) + if id.MigrationName, ok = input.Parsed["migrationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "migrationName", input) } - return &id, nil + return nil } // ValidateMigrationID checks that 'input' can be parsed as a Migration ID diff --git a/resource-manager/postgresql/2023-06-01-preview/post/id_flexibleserver.go b/resource-manager/postgresql/2023-06-01-preview/post/id_flexibleserver.go index c8b021fabab..e727e294b3f 100644 --- a/resource-manager/postgresql/2023-06-01-preview/post/id_flexibleserver.go +++ b/resource-manager/postgresql/2023-06-01-preview/post/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2023-06-01-preview/privateendpointconnections/id_flexibleserver.go b/resource-manager/postgresql/2023-06-01-preview/privateendpointconnections/id_flexibleserver.go index 3cda7cedf06..5ea5ae0b7b5 100644 --- a/resource-manager/postgresql/2023-06-01-preview/privateendpointconnections/id_flexibleserver.go +++ b/resource-manager/postgresql/2023-06-01-preview/privateendpointconnections/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2023-06-01-preview/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/postgresql/2023-06-01-preview/privateendpointconnections/id_privateendpointconnection.go index dbc685ddf7e..aa282aa9df4 100644 --- a/resource-manager/postgresql/2023-06-01-preview/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/postgresql/2023-06-01-preview/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/postgresql/2023-06-01-preview/privatelinkresources/id_flexibleserver.go b/resource-manager/postgresql/2023-06-01-preview/privatelinkresources/id_flexibleserver.go index f85dbc21199..173a721e256 100644 --- a/resource-manager/postgresql/2023-06-01-preview/privatelinkresources/id_flexibleserver.go +++ b/resource-manager/postgresql/2023-06-01-preview/privatelinkresources/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2023-06-01-preview/privatelinkresources/id_privatelinkresource.go b/resource-manager/postgresql/2023-06-01-preview/privatelinkresources/id_privatelinkresource.go index f57955dbbcc..5070634eb11 100644 --- a/resource-manager/postgresql/2023-06-01-preview/privatelinkresources/id_privatelinkresource.go +++ b/resource-manager/postgresql/2023-06-01-preview/privatelinkresources/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) - } - - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/postgresql/2023-06-01-preview/quotausagesforflexibleservers/id_location.go b/resource-manager/postgresql/2023-06-01-preview/quotausagesforflexibleservers/id_location.go index f123f77b660..901f85fdb70 100644 --- a/resource-manager/postgresql/2023-06-01-preview/quotausagesforflexibleservers/id_location.go +++ b/resource-manager/postgresql/2023-06-01-preview/quotausagesforflexibleservers/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/postgresql/2023-06-01-preview/replicas/id_flexibleserver.go b/resource-manager/postgresql/2023-06-01-preview/replicas/id_flexibleserver.go index 33352ce9d81..a912a099590 100644 --- a/resource-manager/postgresql/2023-06-01-preview/replicas/id_flexibleserver.go +++ b/resource-manager/postgresql/2023-06-01-preview/replicas/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2023-06-01-preview/serverrestart/id_flexibleserver.go b/resource-manager/postgresql/2023-06-01-preview/serverrestart/id_flexibleserver.go index fbcd5eee062..c5ee5c5b5ec 100644 --- a/resource-manager/postgresql/2023-06-01-preview/serverrestart/id_flexibleserver.go +++ b/resource-manager/postgresql/2023-06-01-preview/serverrestart/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2023-06-01-preview/servers/id_flexibleserver.go b/resource-manager/postgresql/2023-06-01-preview/servers/id_flexibleserver.go index 10f7db4ca36..61acacfe354 100644 --- a/resource-manager/postgresql/2023-06-01-preview/servers/id_flexibleserver.go +++ b/resource-manager/postgresql/2023-06-01-preview/servers/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2023-06-01-preview/serverstart/id_flexibleserver.go b/resource-manager/postgresql/2023-06-01-preview/serverstart/id_flexibleserver.go index 27100958c0f..0f22022953b 100644 --- a/resource-manager/postgresql/2023-06-01-preview/serverstart/id_flexibleserver.go +++ b/resource-manager/postgresql/2023-06-01-preview/serverstart/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2023-06-01-preview/serverstop/id_flexibleserver.go b/resource-manager/postgresql/2023-06-01-preview/serverstop/id_flexibleserver.go index 405b7346a8f..810b8980af9 100644 --- a/resource-manager/postgresql/2023-06-01-preview/serverstop/id_flexibleserver.go +++ b/resource-manager/postgresql/2023-06-01-preview/serverstop/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2023-06-01-preview/virtualendpoints/id_flexibleserver.go b/resource-manager/postgresql/2023-06-01-preview/virtualendpoints/id_flexibleserver.go index ea25836a381..52ccd957dcb 100644 --- a/resource-manager/postgresql/2023-06-01-preview/virtualendpoints/id_flexibleserver.go +++ b/resource-manager/postgresql/2023-06-01-preview/virtualendpoints/id_flexibleserver.go @@ -36,19 +36,9 @@ func ParseFlexibleServerID(input string) (*FlexibleServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFlexibleServerIDInsensitively(input string) (*FlexibleServerId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FlexibleServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FlexibleServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - return &id, nil + return nil } // ValidateFlexibleServerID checks that 'input' can be parsed as a Flexible Server ID diff --git a/resource-manager/postgresql/2023-06-01-preview/virtualendpoints/id_virtualendpoint.go b/resource-manager/postgresql/2023-06-01-preview/virtualendpoints/id_virtualendpoint.go index 6254906d589..404b1ec7cda 100644 --- a/resource-manager/postgresql/2023-06-01-preview/virtualendpoints/id_virtualendpoint.go +++ b/resource-manager/postgresql/2023-06-01-preview/virtualendpoints/id_virtualendpoint.go @@ -38,23 +38,9 @@ func ParseVirtualEndpointID(input string) (*VirtualEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualEndpointId{} - - 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.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) - } - - if id.VirtualEndpointName, ok = parsed.Parsed["virtualEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualEndpointIDInsensitively(input string) (*VirtualEndpointId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualEndpointId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FlexibleServerName, ok = parsed.Parsed["flexibleServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", *parsed) + if id.FlexibleServerName, ok = input.Parsed["flexibleServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "flexibleServerName", input) } - if id.VirtualEndpointName, ok = parsed.Parsed["virtualEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualEndpointName", *parsed) + if id.VirtualEndpointName, ok = input.Parsed["virtualEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualEndpointName", input) } - return &id, nil + return nil } // ValidateVirtualEndpointID checks that 'input' can be parsed as a Virtual Endpoint ID diff --git a/resource-manager/postgresqlhsc/2020-10-05-privatepreview/configurations/id_configuration.go b/resource-manager/postgresqlhsc/2020-10-05-privatepreview/configurations/id_configuration.go index 5fb83ba41cf..5191a5aef04 100644 --- a/resource-manager/postgresqlhsc/2020-10-05-privatepreview/configurations/id_configuration.go +++ b/resource-manager/postgresqlhsc/2020-10-05-privatepreview/configurations/id_configuration.go @@ -38,23 +38,9 @@ func ParseConfigurationID(input string) (*ConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationId{} - - 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.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) - } - - if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConfigurationIDInsensitively(input string) (*ConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) + if id.ServerGroupsv2Name, ok = input.Parsed["serverGroupsv2Name"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", input) } - if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationName", *parsed) + if id.ConfigurationName, ok = input.Parsed["configurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationName", input) } - return &id, nil + return nil } // ValidateConfigurationID checks that 'input' can be parsed as a Configuration ID diff --git a/resource-manager/postgresqlhsc/2020-10-05-privatepreview/configurations/id_server.go b/resource-manager/postgresqlhsc/2020-10-05-privatepreview/configurations/id_server.go index 049f8ba9b1a..4ea73c6605b 100644 --- a/resource-manager/postgresqlhsc/2020-10-05-privatepreview/configurations/id_server.go +++ b/resource-manager/postgresqlhsc/2020-10-05-privatepreview/configurations/id_server.go @@ -38,23 +38,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) - } - - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ServerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) + if id.ServerGroupsv2Name, ok = input.Parsed["serverGroupsv2Name"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/postgresqlhsc/2020-10-05-privatepreview/configurations/id_servergroupsv2.go b/resource-manager/postgresqlhsc/2020-10-05-privatepreview/configurations/id_servergroupsv2.go index fbc2b0a6f81..7cfeb1439d0 100644 --- a/resource-manager/postgresqlhsc/2020-10-05-privatepreview/configurations/id_servergroupsv2.go +++ b/resource-manager/postgresqlhsc/2020-10-05-privatepreview/configurations/id_servergroupsv2.go @@ -36,19 +36,9 @@ func ParseServerGroupsv2ID(input string) (*ServerGroupsv2Id, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerGroupsv2Id{} - - 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.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerGroupsv2IDInsensitively(input string) (*ServerGroupsv2Id, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerGroupsv2Id{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerGroupsv2Id) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) + if id.ServerGroupsv2Name, ok = input.Parsed["serverGroupsv2Name"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", input) } - return &id, nil + return nil } // ValidateServerGroupsv2ID checks that 'input' can be parsed as a Server Groupsv 2 ID diff --git a/resource-manager/postgresqlhsc/2020-10-05-privatepreview/firewallrules/id_firewallrule.go b/resource-manager/postgresqlhsc/2020-10-05-privatepreview/firewallrules/id_firewallrule.go index 0d6e2664f11..068affce5bf 100644 --- a/resource-manager/postgresqlhsc/2020-10-05-privatepreview/firewallrules/id_firewallrule.go +++ b/resource-manager/postgresqlhsc/2020-10-05-privatepreview/firewallrules/id_firewallrule.go @@ -38,23 +38,9 @@ func ParseFirewallRuleID(input string) (*FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallRuleId{} - - 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.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) - } - - if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFirewallRuleIDInsensitively(input string) (*FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FirewallRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) + if id.ServerGroupsv2Name, ok = input.Parsed["serverGroupsv2Name"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", input) } - if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + if id.FirewallRuleName, ok = input.Parsed["firewallRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", input) } - return &id, nil + return nil } // ValidateFirewallRuleID checks that 'input' can be parsed as a Firewall Rule ID diff --git a/resource-manager/postgresqlhsc/2020-10-05-privatepreview/firewallrules/id_servergroupsv2.go b/resource-manager/postgresqlhsc/2020-10-05-privatepreview/firewallrules/id_servergroupsv2.go index 1deaf523b0e..6745d0d82d6 100644 --- a/resource-manager/postgresqlhsc/2020-10-05-privatepreview/firewallrules/id_servergroupsv2.go +++ b/resource-manager/postgresqlhsc/2020-10-05-privatepreview/firewallrules/id_servergroupsv2.go @@ -36,19 +36,9 @@ func ParseServerGroupsv2ID(input string) (*ServerGroupsv2Id, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerGroupsv2Id{} - - 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.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerGroupsv2IDInsensitively(input string) (*ServerGroupsv2Id, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerGroupsv2Id{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerGroupsv2Id) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) + if id.ServerGroupsv2Name, ok = input.Parsed["serverGroupsv2Name"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", input) } - return &id, nil + return nil } // ValidateServerGroupsv2ID checks that 'input' can be parsed as a Server Groupsv 2 ID diff --git a/resource-manager/postgresqlhsc/2020-10-05-privatepreview/roles/id_role.go b/resource-manager/postgresqlhsc/2020-10-05-privatepreview/roles/id_role.go index e5677738fce..847158f1723 100644 --- a/resource-manager/postgresqlhsc/2020-10-05-privatepreview/roles/id_role.go +++ b/resource-manager/postgresqlhsc/2020-10-05-privatepreview/roles/id_role.go @@ -38,23 +38,9 @@ func ParseRoleID(input string) (*RoleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RoleId{} - - 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.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) - } - - if id.RoleName, ok = parsed.Parsed["roleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRoleIDInsensitively(input string) (*RoleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RoleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RoleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) + if id.ServerGroupsv2Name, ok = input.Parsed["serverGroupsv2Name"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", input) } - if id.RoleName, ok = parsed.Parsed["roleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleName", *parsed) + if id.RoleName, ok = input.Parsed["roleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "roleName", input) } - return &id, nil + return nil } // ValidateRoleID checks that 'input' can be parsed as a Role ID diff --git a/resource-manager/postgresqlhsc/2020-10-05-privatepreview/roles/id_servergroupsv2.go b/resource-manager/postgresqlhsc/2020-10-05-privatepreview/roles/id_servergroupsv2.go index 50c509ce71a..aa87f75ff85 100644 --- a/resource-manager/postgresqlhsc/2020-10-05-privatepreview/roles/id_servergroupsv2.go +++ b/resource-manager/postgresqlhsc/2020-10-05-privatepreview/roles/id_servergroupsv2.go @@ -36,19 +36,9 @@ func ParseServerGroupsv2ID(input string) (*ServerGroupsv2Id, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerGroupsv2Id{} - - 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.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerGroupsv2IDInsensitively(input string) (*ServerGroupsv2Id, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerGroupsv2Id{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerGroupsv2Id) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) + if id.ServerGroupsv2Name, ok = input.Parsed["serverGroupsv2Name"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", input) } - return &id, nil + return nil } // ValidateServerGroupsv2ID checks that 'input' can be parsed as a Server Groupsv 2 ID diff --git a/resource-manager/postgresqlhsc/2020-10-05-privatepreview/servergroupoperations/id_servergroupsv2.go b/resource-manager/postgresqlhsc/2020-10-05-privatepreview/servergroupoperations/id_servergroupsv2.go index 664163c1009..7f1c00663af 100644 --- a/resource-manager/postgresqlhsc/2020-10-05-privatepreview/servergroupoperations/id_servergroupsv2.go +++ b/resource-manager/postgresqlhsc/2020-10-05-privatepreview/servergroupoperations/id_servergroupsv2.go @@ -36,19 +36,9 @@ func ParseServerGroupsv2ID(input string) (*ServerGroupsv2Id, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerGroupsv2Id{} - - 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.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerGroupsv2IDInsensitively(input string) (*ServerGroupsv2Id, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerGroupsv2Id{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerGroupsv2Id) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) + if id.ServerGroupsv2Name, ok = input.Parsed["serverGroupsv2Name"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", input) } - return &id, nil + return nil } // ValidateServerGroupsv2ID checks that 'input' can be parsed as a Server Groupsv 2 ID diff --git a/resource-manager/postgresqlhsc/2020-10-05-privatepreview/servergroups/id_servergroupsv2.go b/resource-manager/postgresqlhsc/2020-10-05-privatepreview/servergroups/id_servergroupsv2.go index 4efdcc684b3..ad0464dbfd9 100644 --- a/resource-manager/postgresqlhsc/2020-10-05-privatepreview/servergroups/id_servergroupsv2.go +++ b/resource-manager/postgresqlhsc/2020-10-05-privatepreview/servergroups/id_servergroupsv2.go @@ -36,19 +36,9 @@ func ParseServerGroupsv2ID(input string) (*ServerGroupsv2Id, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerGroupsv2Id{} - - 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.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerGroupsv2IDInsensitively(input string) (*ServerGroupsv2Id, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerGroupsv2Id{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerGroupsv2Id) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) + if id.ServerGroupsv2Name, ok = input.Parsed["serverGroupsv2Name"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", input) } - return &id, nil + return nil } // ValidateServerGroupsv2ID checks that 'input' can be parsed as a Server Groupsv 2 ID diff --git a/resource-manager/postgresqlhsc/2020-10-05-privatepreview/servers/id_server.go b/resource-manager/postgresqlhsc/2020-10-05-privatepreview/servers/id_server.go index c19b3a78ef3..fb6906af980 100644 --- a/resource-manager/postgresqlhsc/2020-10-05-privatepreview/servers/id_server.go +++ b/resource-manager/postgresqlhsc/2020-10-05-privatepreview/servers/id_server.go @@ -38,23 +38,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) - } - - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ServerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) + if id.ServerGroupsv2Name, ok = input.Parsed["serverGroupsv2Name"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/postgresqlhsc/2020-10-05-privatepreview/servers/id_servergroupsv2.go b/resource-manager/postgresqlhsc/2020-10-05-privatepreview/servers/id_servergroupsv2.go index 491d83e59a5..f040d9dae9e 100644 --- a/resource-manager/postgresqlhsc/2020-10-05-privatepreview/servers/id_servergroupsv2.go +++ b/resource-manager/postgresqlhsc/2020-10-05-privatepreview/servers/id_servergroupsv2.go @@ -36,19 +36,9 @@ func ParseServerGroupsv2ID(input string) (*ServerGroupsv2Id, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerGroupsv2Id{} - - 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.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerGroupsv2IDInsensitively(input string) (*ServerGroupsv2Id, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerGroupsv2Id{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerGroupsv2Id) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) + if id.ServerGroupsv2Name, ok = input.Parsed["serverGroupsv2Name"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", input) } - return &id, nil + return nil } // ValidateServerGroupsv2ID checks that 'input' can be parsed as a Server Groupsv 2 ID diff --git a/resource-manager/postgresqlhsc/2022-11-08/clusteroperations/id_servergroupsv2.go b/resource-manager/postgresqlhsc/2022-11-08/clusteroperations/id_servergroupsv2.go index 743aafc54e7..f2b6c53bb5e 100644 --- a/resource-manager/postgresqlhsc/2022-11-08/clusteroperations/id_servergroupsv2.go +++ b/resource-manager/postgresqlhsc/2022-11-08/clusteroperations/id_servergroupsv2.go @@ -36,19 +36,9 @@ func ParseServerGroupsv2ID(input string) (*ServerGroupsv2Id, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerGroupsv2Id{} - - 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.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerGroupsv2IDInsensitively(input string) (*ServerGroupsv2Id, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerGroupsv2Id{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerGroupsv2Id) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) + if id.ServerGroupsv2Name, ok = input.Parsed["serverGroupsv2Name"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", input) } - return &id, nil + return nil } // ValidateServerGroupsv2ID checks that 'input' can be parsed as a Server Groupsv 2 ID diff --git a/resource-manager/postgresqlhsc/2022-11-08/clusters/id_servergroupsv2.go b/resource-manager/postgresqlhsc/2022-11-08/clusters/id_servergroupsv2.go index 1a0dc0bfa70..30f891f9c23 100644 --- a/resource-manager/postgresqlhsc/2022-11-08/clusters/id_servergroupsv2.go +++ b/resource-manager/postgresqlhsc/2022-11-08/clusters/id_servergroupsv2.go @@ -36,19 +36,9 @@ func ParseServerGroupsv2ID(input string) (*ServerGroupsv2Id, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerGroupsv2Id{} - - 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.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerGroupsv2IDInsensitively(input string) (*ServerGroupsv2Id, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerGroupsv2Id{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerGroupsv2Id) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) + if id.ServerGroupsv2Name, ok = input.Parsed["serverGroupsv2Name"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", input) } - return &id, nil + return nil } // ValidateServerGroupsv2ID checks that 'input' can be parsed as a Server Groupsv 2 ID diff --git a/resource-manager/postgresqlhsc/2022-11-08/configurations/id_configuration.go b/resource-manager/postgresqlhsc/2022-11-08/configurations/id_configuration.go index 5fb83ba41cf..5191a5aef04 100644 --- a/resource-manager/postgresqlhsc/2022-11-08/configurations/id_configuration.go +++ b/resource-manager/postgresqlhsc/2022-11-08/configurations/id_configuration.go @@ -38,23 +38,9 @@ func ParseConfigurationID(input string) (*ConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationId{} - - 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.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) - } - - if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConfigurationIDInsensitively(input string) (*ConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) + if id.ServerGroupsv2Name, ok = input.Parsed["serverGroupsv2Name"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", input) } - if id.ConfigurationName, ok = parsed.Parsed["configurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "configurationName", *parsed) + if id.ConfigurationName, ok = input.Parsed["configurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "configurationName", input) } - return &id, nil + return nil } // ValidateConfigurationID checks that 'input' can be parsed as a Configuration ID diff --git a/resource-manager/postgresqlhsc/2022-11-08/configurations/id_coordinatorconfiguration.go b/resource-manager/postgresqlhsc/2022-11-08/configurations/id_coordinatorconfiguration.go index 9cefaa8d4e8..ccadaba503d 100644 --- a/resource-manager/postgresqlhsc/2022-11-08/configurations/id_coordinatorconfiguration.go +++ b/resource-manager/postgresqlhsc/2022-11-08/configurations/id_coordinatorconfiguration.go @@ -38,23 +38,9 @@ func ParseCoordinatorConfigurationID(input string) (*CoordinatorConfigurationId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CoordinatorConfigurationId{} - - 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.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) - } - - if id.CoordinatorConfigurationName, ok = parsed.Parsed["coordinatorConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "coordinatorConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCoordinatorConfigurationIDInsensitively(input string) (*CoordinatorCon return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CoordinatorConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CoordinatorConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) + if id.ServerGroupsv2Name, ok = input.Parsed["serverGroupsv2Name"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", input) } - if id.CoordinatorConfigurationName, ok = parsed.Parsed["coordinatorConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "coordinatorConfigurationName", *parsed) + if id.CoordinatorConfigurationName, ok = input.Parsed["coordinatorConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "coordinatorConfigurationName", input) } - return &id, nil + return nil } // ValidateCoordinatorConfigurationID checks that 'input' can be parsed as a Coordinator Configuration ID diff --git a/resource-manager/postgresqlhsc/2022-11-08/configurations/id_nodeconfiguration.go b/resource-manager/postgresqlhsc/2022-11-08/configurations/id_nodeconfiguration.go index c95b371bc77..f3dc23ea09f 100644 --- a/resource-manager/postgresqlhsc/2022-11-08/configurations/id_nodeconfiguration.go +++ b/resource-manager/postgresqlhsc/2022-11-08/configurations/id_nodeconfiguration.go @@ -38,23 +38,9 @@ func ParseNodeConfigurationID(input string) (*NodeConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NodeConfigurationId{} - - 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.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) - } - - if id.NodeConfigurationName, ok = parsed.Parsed["nodeConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nodeConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseNodeConfigurationIDInsensitively(input string) (*NodeConfigurationId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NodeConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *NodeConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) + if id.ServerGroupsv2Name, ok = input.Parsed["serverGroupsv2Name"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", input) } - if id.NodeConfigurationName, ok = parsed.Parsed["nodeConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nodeConfigurationName", *parsed) + if id.NodeConfigurationName, ok = input.Parsed["nodeConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "nodeConfigurationName", input) } - return &id, nil + return nil } // ValidateNodeConfigurationID checks that 'input' can be parsed as a Node Configuration ID diff --git a/resource-manager/postgresqlhsc/2022-11-08/configurations/id_server.go b/resource-manager/postgresqlhsc/2022-11-08/configurations/id_server.go index 049f8ba9b1a..4ea73c6605b 100644 --- a/resource-manager/postgresqlhsc/2022-11-08/configurations/id_server.go +++ b/resource-manager/postgresqlhsc/2022-11-08/configurations/id_server.go @@ -38,23 +38,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) - } - - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ServerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) + if id.ServerGroupsv2Name, ok = input.Parsed["serverGroupsv2Name"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/postgresqlhsc/2022-11-08/configurations/id_servergroupsv2.go b/resource-manager/postgresqlhsc/2022-11-08/configurations/id_servergroupsv2.go index fbc2b0a6f81..7cfeb1439d0 100644 --- a/resource-manager/postgresqlhsc/2022-11-08/configurations/id_servergroupsv2.go +++ b/resource-manager/postgresqlhsc/2022-11-08/configurations/id_servergroupsv2.go @@ -36,19 +36,9 @@ func ParseServerGroupsv2ID(input string) (*ServerGroupsv2Id, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerGroupsv2Id{} - - 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.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerGroupsv2IDInsensitively(input string) (*ServerGroupsv2Id, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerGroupsv2Id{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerGroupsv2Id) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) + if id.ServerGroupsv2Name, ok = input.Parsed["serverGroupsv2Name"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", input) } - return &id, nil + return nil } // ValidateServerGroupsv2ID checks that 'input' can be parsed as a Server Groupsv 2 ID diff --git a/resource-manager/postgresqlhsc/2022-11-08/firewallrules/id_firewallrule.go b/resource-manager/postgresqlhsc/2022-11-08/firewallrules/id_firewallrule.go index 0d6e2664f11..068affce5bf 100644 --- a/resource-manager/postgresqlhsc/2022-11-08/firewallrules/id_firewallrule.go +++ b/resource-manager/postgresqlhsc/2022-11-08/firewallrules/id_firewallrule.go @@ -38,23 +38,9 @@ func ParseFirewallRuleID(input string) (*FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallRuleId{} - - 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.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) - } - - if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFirewallRuleIDInsensitively(input string) (*FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FirewallRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) + if id.ServerGroupsv2Name, ok = input.Parsed["serverGroupsv2Name"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", input) } - if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + if id.FirewallRuleName, ok = input.Parsed["firewallRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", input) } - return &id, nil + return nil } // ValidateFirewallRuleID checks that 'input' can be parsed as a Firewall Rule ID diff --git a/resource-manager/postgresqlhsc/2022-11-08/firewallrules/id_servergroupsv2.go b/resource-manager/postgresqlhsc/2022-11-08/firewallrules/id_servergroupsv2.go index 1deaf523b0e..6745d0d82d6 100644 --- a/resource-manager/postgresqlhsc/2022-11-08/firewallrules/id_servergroupsv2.go +++ b/resource-manager/postgresqlhsc/2022-11-08/firewallrules/id_servergroupsv2.go @@ -36,19 +36,9 @@ func ParseServerGroupsv2ID(input string) (*ServerGroupsv2Id, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerGroupsv2Id{} - - 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.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerGroupsv2IDInsensitively(input string) (*ServerGroupsv2Id, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerGroupsv2Id{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerGroupsv2Id) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) + if id.ServerGroupsv2Name, ok = input.Parsed["serverGroupsv2Name"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", input) } - return &id, nil + return nil } // ValidateServerGroupsv2ID checks that 'input' can be parsed as a Server Groupsv 2 ID diff --git a/resource-manager/postgresqlhsc/2022-11-08/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/postgresqlhsc/2022-11-08/privateendpointconnections/id_privateendpointconnection.go index 24283c2a4c8..035e65d44d8 100644 --- a/resource-manager/postgresqlhsc/2022-11-08/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/postgresqlhsc/2022-11-08/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) + if id.ServerGroupsv2Name, ok = input.Parsed["serverGroupsv2Name"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/postgresqlhsc/2022-11-08/privateendpointconnections/id_servergroupsv2.go b/resource-manager/postgresqlhsc/2022-11-08/privateendpointconnections/id_servergroupsv2.go index f8410ab0769..754bc5cd028 100644 --- a/resource-manager/postgresqlhsc/2022-11-08/privateendpointconnections/id_servergroupsv2.go +++ b/resource-manager/postgresqlhsc/2022-11-08/privateendpointconnections/id_servergroupsv2.go @@ -36,19 +36,9 @@ func ParseServerGroupsv2ID(input string) (*ServerGroupsv2Id, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerGroupsv2Id{} - - 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.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerGroupsv2IDInsensitively(input string) (*ServerGroupsv2Id, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerGroupsv2Id{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerGroupsv2Id) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) + if id.ServerGroupsv2Name, ok = input.Parsed["serverGroupsv2Name"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", input) } - return &id, nil + return nil } // ValidateServerGroupsv2ID checks that 'input' can be parsed as a Server Groupsv 2 ID diff --git a/resource-manager/postgresqlhsc/2022-11-08/privatelinkresources/id_privatelinkresource.go b/resource-manager/postgresqlhsc/2022-11-08/privatelinkresources/id_privatelinkresource.go index 9bf8e2f1cf0..ba5624a16a1 100644 --- a/resource-manager/postgresqlhsc/2022-11-08/privatelinkresources/id_privatelinkresource.go +++ b/resource-manager/postgresqlhsc/2022-11-08/privatelinkresources/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) - } - - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) + if id.ServerGroupsv2Name, ok = input.Parsed["serverGroupsv2Name"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/postgresqlhsc/2022-11-08/privatelinkresources/id_servergroupsv2.go b/resource-manager/postgresqlhsc/2022-11-08/privatelinkresources/id_servergroupsv2.go index 36ac9a6e9e9..b6008bfcb93 100644 --- a/resource-manager/postgresqlhsc/2022-11-08/privatelinkresources/id_servergroupsv2.go +++ b/resource-manager/postgresqlhsc/2022-11-08/privatelinkresources/id_servergroupsv2.go @@ -36,19 +36,9 @@ func ParseServerGroupsv2ID(input string) (*ServerGroupsv2Id, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerGroupsv2Id{} - - 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.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerGroupsv2IDInsensitively(input string) (*ServerGroupsv2Id, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerGroupsv2Id{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerGroupsv2Id) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) + if id.ServerGroupsv2Name, ok = input.Parsed["serverGroupsv2Name"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", input) } - return &id, nil + return nil } // ValidateServerGroupsv2ID checks that 'input' can be parsed as a Server Groupsv 2 ID diff --git a/resource-manager/postgresqlhsc/2022-11-08/roles/id_role.go b/resource-manager/postgresqlhsc/2022-11-08/roles/id_role.go index e5677738fce..847158f1723 100644 --- a/resource-manager/postgresqlhsc/2022-11-08/roles/id_role.go +++ b/resource-manager/postgresqlhsc/2022-11-08/roles/id_role.go @@ -38,23 +38,9 @@ func ParseRoleID(input string) (*RoleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RoleId{} - - 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.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) - } - - if id.RoleName, ok = parsed.Parsed["roleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRoleIDInsensitively(input string) (*RoleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RoleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RoleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) + if id.ServerGroupsv2Name, ok = input.Parsed["serverGroupsv2Name"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", input) } - if id.RoleName, ok = parsed.Parsed["roleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "roleName", *parsed) + if id.RoleName, ok = input.Parsed["roleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "roleName", input) } - return &id, nil + return nil } // ValidateRoleID checks that 'input' can be parsed as a Role ID diff --git a/resource-manager/postgresqlhsc/2022-11-08/roles/id_servergroupsv2.go b/resource-manager/postgresqlhsc/2022-11-08/roles/id_servergroupsv2.go index 50c509ce71a..aa87f75ff85 100644 --- a/resource-manager/postgresqlhsc/2022-11-08/roles/id_servergroupsv2.go +++ b/resource-manager/postgresqlhsc/2022-11-08/roles/id_servergroupsv2.go @@ -36,19 +36,9 @@ func ParseServerGroupsv2ID(input string) (*ServerGroupsv2Id, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerGroupsv2Id{} - - 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.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerGroupsv2IDInsensitively(input string) (*ServerGroupsv2Id, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerGroupsv2Id{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerGroupsv2Id) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) + if id.ServerGroupsv2Name, ok = input.Parsed["serverGroupsv2Name"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", input) } - return &id, nil + return nil } // ValidateServerGroupsv2ID checks that 'input' can be parsed as a Server Groupsv 2 ID diff --git a/resource-manager/postgresqlhsc/2022-11-08/servers/id_server.go b/resource-manager/postgresqlhsc/2022-11-08/servers/id_server.go index c19b3a78ef3..fb6906af980 100644 --- a/resource-manager/postgresqlhsc/2022-11-08/servers/id_server.go +++ b/resource-manager/postgresqlhsc/2022-11-08/servers/id_server.go @@ -38,23 +38,9 @@ func ParseServerID(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} - - 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.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) - } - - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseServerIDInsensitively(input string) (*ServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ServerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) + if id.ServerGroupsv2Name, ok = input.Parsed["serverGroupsv2Name"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - return &id, nil + return nil } // ValidateServerID checks that 'input' can be parsed as a Server ID diff --git a/resource-manager/postgresqlhsc/2022-11-08/servers/id_servergroupsv2.go b/resource-manager/postgresqlhsc/2022-11-08/servers/id_servergroupsv2.go index 491d83e59a5..f040d9dae9e 100644 --- a/resource-manager/postgresqlhsc/2022-11-08/servers/id_servergroupsv2.go +++ b/resource-manager/postgresqlhsc/2022-11-08/servers/id_servergroupsv2.go @@ -36,19 +36,9 @@ func ParseServerGroupsv2ID(input string) (*ServerGroupsv2Id, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerGroupsv2Id{} - - 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.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServerGroupsv2IDInsensitively(input string) (*ServerGroupsv2Id, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerGroupsv2Id{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServerGroupsv2Id) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerGroupsv2Name, ok = parsed.Parsed["serverGroupsv2Name"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", *parsed) + if id.ServerGroupsv2Name, ok = input.Parsed["serverGroupsv2Name"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverGroupsv2Name", input) } - return &id, nil + return nil } // ValidateServerGroupsv2ID checks that 'input' can be parsed as a Server Groupsv 2 ID diff --git a/resource-manager/powerbidedicated/2021-01-01/autoscalevcores/id_autoscalevcore.go b/resource-manager/powerbidedicated/2021-01-01/autoscalevcores/id_autoscalevcore.go index 848454829aa..f8a433bdce0 100644 --- a/resource-manager/powerbidedicated/2021-01-01/autoscalevcores/id_autoscalevcore.go +++ b/resource-manager/powerbidedicated/2021-01-01/autoscalevcores/id_autoscalevcore.go @@ -36,19 +36,9 @@ func ParseAutoScaleVCoreID(input string) (*AutoScaleVCoreId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutoScaleVCoreId{} - - 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.AutoScaleVCoreName, ok = parsed.Parsed["autoScaleVCoreName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "autoScaleVCoreName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutoScaleVCoreIDInsensitively(input string) (*AutoScaleVCoreId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutoScaleVCoreId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutoScaleVCoreId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutoScaleVCoreName, ok = parsed.Parsed["autoScaleVCoreName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "autoScaleVCoreName", *parsed) + if id.AutoScaleVCoreName, ok = input.Parsed["autoScaleVCoreName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "autoScaleVCoreName", input) } - return &id, nil + return nil } // ValidateAutoScaleVCoreID checks that 'input' can be parsed as a Auto Scale V Core ID diff --git a/resource-manager/powerbidedicated/2021-01-01/capacities/id_capacity.go b/resource-manager/powerbidedicated/2021-01-01/capacities/id_capacity.go index 0b34e0a59e6..ebeda414077 100644 --- a/resource-manager/powerbidedicated/2021-01-01/capacities/id_capacity.go +++ b/resource-manager/powerbidedicated/2021-01-01/capacities/id_capacity.go @@ -36,19 +36,9 @@ func ParseCapacityID(input string) (*CapacityId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapacityId{} - - 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.CapacityName, ok = parsed.Parsed["capacityName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseCapacityIDInsensitively(input string) (*CapacityId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CapacityId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CapacityId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CapacityName, ok = parsed.Parsed["capacityName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "capacityName", *parsed) + if id.CapacityName, ok = input.Parsed["capacityName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityName", input) } - return &id, nil + return nil } // ValidateCapacityID checks that 'input' can be parsed as a Capacity ID diff --git a/resource-manager/powerbidedicated/2021-01-01/capacities/id_location.go b/resource-manager/powerbidedicated/2021-01-01/capacities/id_location.go index 93d78bb2d8c..846a6816f7a 100644 --- a/resource-manager/powerbidedicated/2021-01-01/capacities/id_location.go +++ b/resource-manager/powerbidedicated/2021-01-01/capacities/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/privatedns/2020-06-01/privatezones/id_privatednszone.go b/resource-manager/privatedns/2020-06-01/privatezones/id_privatednszone.go index f548d0aa35b..546d3ef5518 100644 --- a/resource-manager/privatedns/2020-06-01/privatezones/id_privatednszone.go +++ b/resource-manager/privatedns/2020-06-01/privatezones/id_privatednszone.go @@ -36,19 +36,9 @@ func ParsePrivateDnsZoneID(input string) (*PrivateDnsZoneId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateDnsZoneId{} - - 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.PrivateDnsZoneName, ok = parsed.Parsed["privateDnsZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateDnsZoneName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePrivateDnsZoneIDInsensitively(input string) (*PrivateDnsZoneId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateDnsZoneId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PrivateDnsZoneId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateDnsZoneName, ok = parsed.Parsed["privateDnsZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateDnsZoneName", *parsed) + if id.PrivateDnsZoneName, ok = input.Parsed["privateDnsZoneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateDnsZoneName", input) } - return &id, nil + return nil } // ValidatePrivateDnsZoneID checks that 'input' can be parsed as a Private Dns Zone ID diff --git a/resource-manager/privatedns/2020-06-01/recordsets/id_privatednszone.go b/resource-manager/privatedns/2020-06-01/recordsets/id_privatednszone.go index f3f6b052201..62b602a631f 100644 --- a/resource-manager/privatedns/2020-06-01/recordsets/id_privatednszone.go +++ b/resource-manager/privatedns/2020-06-01/recordsets/id_privatednszone.go @@ -36,19 +36,9 @@ func ParsePrivateDnsZoneID(input string) (*PrivateDnsZoneId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateDnsZoneId{} - - 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.PrivateDnsZoneName, ok = parsed.Parsed["privateDnsZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateDnsZoneName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePrivateDnsZoneIDInsensitively(input string) (*PrivateDnsZoneId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateDnsZoneId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PrivateDnsZoneId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateDnsZoneName, ok = parsed.Parsed["privateDnsZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateDnsZoneName", *parsed) + if id.PrivateDnsZoneName, ok = input.Parsed["privateDnsZoneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateDnsZoneName", input) } - return &id, nil + return nil } // ValidatePrivateDnsZoneID checks that 'input' can be parsed as a Private Dns Zone ID diff --git a/resource-manager/privatedns/2020-06-01/recordsets/id_privatezone.go b/resource-manager/privatedns/2020-06-01/recordsets/id_privatezone.go index da8be2cda85..4c41d149506 100644 --- a/resource-manager/privatedns/2020-06-01/recordsets/id_privatezone.go +++ b/resource-manager/privatedns/2020-06-01/recordsets/id_privatezone.go @@ -38,31 +38,9 @@ func ParsePrivateZoneID(input string) (*PrivateZoneId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateZoneId{} - - 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.PrivateDnsZoneName, ok = parsed.Parsed["privateDnsZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateDnsZoneName", *parsed) - } - - if v, ok := parsed.Parsed["recordType"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recordType", *parsed) - } - - recordType, err := parseRecordType(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.RecordType = *recordType + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -77,34 +55,42 @@ func ParsePrivateZoneIDInsensitively(input string) (*PrivateZoneId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateZoneId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *PrivateZoneId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateDnsZoneName, ok = parsed.Parsed["privateDnsZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateDnsZoneName", *parsed) + if id.PrivateDnsZoneName, ok = input.Parsed["privateDnsZoneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateDnsZoneName", input) } - if v, ok := parsed.Parsed["recordType"]; true { + if v, ok := input.Parsed["recordType"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recordType", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "recordType", input) } recordType, err := parseRecordType(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.RecordType = *recordType } - return &id, nil + return nil } // ValidatePrivateZoneID checks that 'input' can be parsed as a Private Zone ID diff --git a/resource-manager/privatedns/2020-06-01/recordsets/id_recordtype.go b/resource-manager/privatedns/2020-06-01/recordsets/id_recordtype.go index db7c0e39823..51a924f7478 100644 --- a/resource-manager/privatedns/2020-06-01/recordsets/id_recordtype.go +++ b/resource-manager/privatedns/2020-06-01/recordsets/id_recordtype.go @@ -40,35 +40,9 @@ func ParseRecordTypeID(input string) (*RecordTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecordTypeId{} - - 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.PrivateDnsZoneName, ok = parsed.Parsed["privateDnsZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateDnsZoneName", *parsed) - } - - if v, ok := parsed.Parsed["recordType"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recordType", *parsed) - } - - recordType, err := parseRecordType(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.RecordType = *recordType - } - - if id.RelativeRecordSetName, ok = parsed.Parsed["relativeRecordSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "relativeRecordSetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -83,38 +57,46 @@ func ParseRecordTypeIDInsensitively(input string) (*RecordTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecordTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RecordTypeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateDnsZoneName, ok = parsed.Parsed["privateDnsZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateDnsZoneName", *parsed) + if id.PrivateDnsZoneName, ok = input.Parsed["privateDnsZoneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateDnsZoneName", input) } - if v, ok := parsed.Parsed["recordType"]; true { + if v, ok := input.Parsed["recordType"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recordType", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "recordType", input) } recordType, err := parseRecordType(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.RecordType = *recordType } - if id.RelativeRecordSetName, ok = parsed.Parsed["relativeRecordSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "relativeRecordSetName", *parsed) + if id.RelativeRecordSetName, ok = input.Parsed["relativeRecordSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "relativeRecordSetName", input) } - return &id, nil + return nil } // ValidateRecordTypeID checks that 'input' can be parsed as a Record Type ID diff --git a/resource-manager/privatedns/2020-06-01/virtualnetworklinks/id_privatednszone.go b/resource-manager/privatedns/2020-06-01/virtualnetworklinks/id_privatednszone.go index 8caf9a57f3d..0c5fa87c2af 100644 --- a/resource-manager/privatedns/2020-06-01/virtualnetworklinks/id_privatednszone.go +++ b/resource-manager/privatedns/2020-06-01/virtualnetworklinks/id_privatednszone.go @@ -36,19 +36,9 @@ func ParsePrivateDnsZoneID(input string) (*PrivateDnsZoneId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateDnsZoneId{} - - 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.PrivateDnsZoneName, ok = parsed.Parsed["privateDnsZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateDnsZoneName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePrivateDnsZoneIDInsensitively(input string) (*PrivateDnsZoneId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateDnsZoneId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PrivateDnsZoneId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateDnsZoneName, ok = parsed.Parsed["privateDnsZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateDnsZoneName", *parsed) + if id.PrivateDnsZoneName, ok = input.Parsed["privateDnsZoneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateDnsZoneName", input) } - return &id, nil + return nil } // ValidatePrivateDnsZoneID checks that 'input' can be parsed as a Private Dns Zone ID diff --git a/resource-manager/privatedns/2020-06-01/virtualnetworklinks/id_virtualnetworklink.go b/resource-manager/privatedns/2020-06-01/virtualnetworklinks/id_virtualnetworklink.go index b3e1ee6396b..644ade97786 100644 --- a/resource-manager/privatedns/2020-06-01/virtualnetworklinks/id_virtualnetworklink.go +++ b/resource-manager/privatedns/2020-06-01/virtualnetworklinks/id_virtualnetworklink.go @@ -38,23 +38,9 @@ func ParseVirtualNetworkLinkID(input string) (*VirtualNetworkLinkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkLinkId{} - - 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.PrivateDnsZoneName, ok = parsed.Parsed["privateDnsZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateDnsZoneName", *parsed) - } - - if id.VirtualNetworkLinkName, ok = parsed.Parsed["virtualNetworkLinkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkLinkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualNetworkLinkIDInsensitively(input string) (*VirtualNetworkLinkId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkLinkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualNetworkLinkId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateDnsZoneName, ok = parsed.Parsed["privateDnsZoneName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateDnsZoneName", *parsed) + if id.PrivateDnsZoneName, ok = input.Parsed["privateDnsZoneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateDnsZoneName", input) } - if id.VirtualNetworkLinkName, ok = parsed.Parsed["virtualNetworkLinkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkLinkName", *parsed) + if id.VirtualNetworkLinkName, ok = input.Parsed["virtualNetworkLinkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkLinkName", input) } - return &id, nil + return nil } // ValidateVirtualNetworkLinkID checks that 'input' can be parsed as a Virtual Network Link ID diff --git a/resource-manager/purview/2021-07-01/account/id_account.go b/resource-manager/purview/2021-07-01/account/id_account.go index abb56d58728..03f4e5c969d 100644 --- a/resource-manager/purview/2021-07-01/account/id_account.go +++ b/resource-manager/purview/2021-07-01/account/id_account.go @@ -36,19 +36,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/purview/2021-07-01/privateendpointconnection/id_account.go b/resource-manager/purview/2021-07-01/privateendpointconnection/id_account.go index ff857b71ac1..29a44aca365 100644 --- a/resource-manager/purview/2021-07-01/privateendpointconnection/id_account.go +++ b/resource-manager/purview/2021-07-01/privateendpointconnection/id_account.go @@ -36,19 +36,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/purview/2021-07-01/privateendpointconnection/id_privateendpointconnection.go b/resource-manager/purview/2021-07-01/privateendpointconnection/id_privateendpointconnection.go index 6a9533d6a2f..edea55b7128 100644 --- a/resource-manager/purview/2021-07-01/privateendpointconnection/id_privateendpointconnection.go +++ b/resource-manager/purview/2021-07-01/privateendpointconnection/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/purview/2021-07-01/privatelinkresource/id_account.go b/resource-manager/purview/2021-07-01/privatelinkresource/id_account.go index f8b4e3ff763..257d48c58d4 100644 --- a/resource-manager/purview/2021-07-01/privatelinkresource/id_account.go +++ b/resource-manager/purview/2021-07-01/privatelinkresource/id_account.go @@ -36,19 +36,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/purview/2021-07-01/privatelinkresource/id_privatelinkresource.go b/resource-manager/purview/2021-07-01/privatelinkresource/id_privatelinkresource.go index 1019811d5ce..9c7da841550 100644 --- a/resource-manager/purview/2021-07-01/privatelinkresource/id_privatelinkresource.go +++ b/resource-manager/purview/2021-07-01/privatelinkresource/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + if id.GroupId, ok = input.Parsed["groupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "groupId", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/purview/2021-12-01/account/id_account.go b/resource-manager/purview/2021-12-01/account/id_account.go index abb56d58728..03f4e5c969d 100644 --- a/resource-manager/purview/2021-12-01/account/id_account.go +++ b/resource-manager/purview/2021-12-01/account/id_account.go @@ -36,19 +36,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/purview/2021-12-01/feature/id_account.go b/resource-manager/purview/2021-12-01/feature/id_account.go index dd5e8272812..11de1ad7153 100644 --- a/resource-manager/purview/2021-12-01/feature/id_account.go +++ b/resource-manager/purview/2021-12-01/feature/id_account.go @@ -36,19 +36,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/purview/2021-12-01/feature/id_location.go b/resource-manager/purview/2021-12-01/feature/id_location.go index 3d415fea3ae..43d438cef1f 100644 --- a/resource-manager/purview/2021-12-01/feature/id_location.go +++ b/resource-manager/purview/2021-12-01/feature/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/purview/2021-12-01/kafkaconfiguration/id_account.go b/resource-manager/purview/2021-12-01/kafkaconfiguration/id_account.go index 57faf88dab7..14c2f0f585c 100644 --- a/resource-manager/purview/2021-12-01/kafkaconfiguration/id_account.go +++ b/resource-manager/purview/2021-12-01/kafkaconfiguration/id_account.go @@ -36,19 +36,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/purview/2021-12-01/kafkaconfiguration/id_kafkaconfiguration.go b/resource-manager/purview/2021-12-01/kafkaconfiguration/id_kafkaconfiguration.go index 379f15c51ab..e3b56071159 100644 --- a/resource-manager/purview/2021-12-01/kafkaconfiguration/id_kafkaconfiguration.go +++ b/resource-manager/purview/2021-12-01/kafkaconfiguration/id_kafkaconfiguration.go @@ -38,23 +38,9 @@ func ParseKafkaConfigurationID(input string) (*KafkaConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := KafkaConfigurationId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.KafkaConfigurationName, ok = parsed.Parsed["kafkaConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "kafkaConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseKafkaConfigurationIDInsensitively(input string) (*KafkaConfigurationId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := KafkaConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *KafkaConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.KafkaConfigurationName, ok = parsed.Parsed["kafkaConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "kafkaConfigurationName", *parsed) + if id.KafkaConfigurationName, ok = input.Parsed["kafkaConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "kafkaConfigurationName", input) } - return &id, nil + return nil } // ValidateKafkaConfigurationID checks that 'input' can be parsed as a Kafka Configuration ID diff --git a/resource-manager/purview/2021-12-01/privateendpointconnection/id_account.go b/resource-manager/purview/2021-12-01/privateendpointconnection/id_account.go index ff857b71ac1..29a44aca365 100644 --- a/resource-manager/purview/2021-12-01/privateendpointconnection/id_account.go +++ b/resource-manager/purview/2021-12-01/privateendpointconnection/id_account.go @@ -36,19 +36,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/purview/2021-12-01/privateendpointconnection/id_privateendpointconnection.go b/resource-manager/purview/2021-12-01/privateendpointconnection/id_privateendpointconnection.go index 6a9533d6a2f..edea55b7128 100644 --- a/resource-manager/purview/2021-12-01/privateendpointconnection/id_privateendpointconnection.go +++ b/resource-manager/purview/2021-12-01/privateendpointconnection/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/purview/2021-12-01/privatelinkresource/id_account.go b/resource-manager/purview/2021-12-01/privatelinkresource/id_account.go index f8b4e3ff763..257d48c58d4 100644 --- a/resource-manager/purview/2021-12-01/privatelinkresource/id_account.go +++ b/resource-manager/purview/2021-12-01/privatelinkresource/id_account.go @@ -36,19 +36,9 @@ func ParseAccountID(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAccountIDInsensitively(input string) (*AccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AccountId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - return &id, nil + return nil } // ValidateAccountID checks that 'input' can be parsed as a Account ID diff --git a/resource-manager/purview/2021-12-01/privatelinkresource/id_privatelinkresource.go b/resource-manager/purview/2021-12-01/privatelinkresource/id_privatelinkresource.go index 1019811d5ce..9c7da841550 100644 --- a/resource-manager/purview/2021-12-01/privatelinkresource/id_privatelinkresource.go +++ b/resource-manager/purview/2021-12-01/privatelinkresource/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) - } - - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accountName", *parsed) + if id.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) } - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + if id.GroupId, ok = input.Parsed["groupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "groupId", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/purview/2021-12-01/usages/id_location.go b/resource-manager/purview/2021-12-01/usages/id_location.go index cb4094efd26..8f2c582f210 100644 --- a/resource-manager/purview/2021-12-01/usages/id_location.go +++ b/resource-manager/purview/2021-12-01/usages/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/qumulostorage/2022-10-12/filesystems/id_filesystem.go b/resource-manager/qumulostorage/2022-10-12/filesystems/id_filesystem.go index 7669de6c516..ebe0d579af8 100644 --- a/resource-manager/qumulostorage/2022-10-12/filesystems/id_filesystem.go +++ b/resource-manager/qumulostorage/2022-10-12/filesystems/id_filesystem.go @@ -36,19 +36,9 @@ func ParseFileSystemID(input string) (*FileSystemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FileSystemId{} - - 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.FileSystemName, ok = parsed.Parsed["fileSystemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fileSystemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFileSystemIDInsensitively(input string) (*FileSystemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FileSystemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FileSystemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.FileSystemName, ok = parsed.Parsed["fileSystemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fileSystemName", *parsed) + if id.FileSystemName, ok = input.Parsed["fileSystemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fileSystemName", input) } - return &id, nil + return nil } // ValidateFileSystemID checks that 'input' can be parsed as a File System ID diff --git a/resource-manager/recoveryservices/2021-08-01/getprivatelinkresources/id_privatelinkresource.go b/resource-manager/recoveryservices/2021-08-01/getprivatelinkresources/id_privatelinkresource.go index 0ce9e647995..0e99511ea9d 100644 --- a/resource-manager/recoveryservices/2021-08-01/getprivatelinkresources/id_privatelinkresource.go +++ b/resource-manager/recoveryservices/2021-08-01/getprivatelinkresources/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/recoveryservices/2021-08-01/listprivatelinkresources/id_vault.go b/resource-manager/recoveryservices/2021-08-01/listprivatelinkresources/id_vault.go index c502cc1f256..481d9f0e8cd 100644 --- a/resource-manager/recoveryservices/2021-08-01/listprivatelinkresources/id_vault.go +++ b/resource-manager/recoveryservices/2021-08-01/listprivatelinkresources/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservices/2021-08-01/recoveryservices/id_location.go b/resource-manager/recoveryservices/2021-08-01/recoveryservices/id_location.go index 9a280dccc3f..6d2d5b937e2 100644 --- a/resource-manager/recoveryservices/2021-08-01/recoveryservices/id_location.go +++ b/resource-manager/recoveryservices/2021-08-01/recoveryservices/id_location.go @@ -36,19 +36,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LocationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/recoveryservices/2021-08-01/registeredidentities/id_registeredidentity.go b/resource-manager/recoveryservices/2021-08-01/registeredidentities/id_registeredidentity.go index 8fcaacac2a7..005805b327b 100644 --- a/resource-manager/recoveryservices/2021-08-01/registeredidentities/id_registeredidentity.go +++ b/resource-manager/recoveryservices/2021-08-01/registeredidentities/id_registeredidentity.go @@ -38,23 +38,9 @@ func ParseRegisteredIdentityID(input string) (*RegisteredIdentityId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegisteredIdentityId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.RegisteredIdentityName, ok = parsed.Parsed["registeredIdentityName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registeredIdentityName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRegisteredIdentityIDInsensitively(input string) (*RegisteredIdentityId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegisteredIdentityId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RegisteredIdentityId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.RegisteredIdentityName, ok = parsed.Parsed["registeredIdentityName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registeredIdentityName", *parsed) + if id.RegisteredIdentityName, ok = input.Parsed["registeredIdentityName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registeredIdentityName", input) } - return &id, nil + return nil } // ValidateRegisteredIdentityID checks that 'input' can be parsed as a Registered Identity ID diff --git a/resource-manager/recoveryservices/2021-08-01/replicationusages/id_vault.go b/resource-manager/recoveryservices/2021-08-01/replicationusages/id_vault.go index 8d2b432414c..6162db2fbbf 100644 --- a/resource-manager/recoveryservices/2021-08-01/replicationusages/id_vault.go +++ b/resource-manager/recoveryservices/2021-08-01/replicationusages/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservices/2021-08-01/vaultcertificates/id_certificate.go b/resource-manager/recoveryservices/2021-08-01/vaultcertificates/id_certificate.go index 56dd60171f7..be70b62e4ca 100644 --- a/resource-manager/recoveryservices/2021-08-01/vaultcertificates/id_certificate.go +++ b/resource-manager/recoveryservices/2021-08-01/vaultcertificates/id_certificate.go @@ -38,23 +38,9 @@ func ParseCertificateID(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCertificateIDInsensitively(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if id.CertificateName, ok = input.Parsed["certificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateName", input) } - return &id, nil + return nil } // ValidateCertificateID checks that 'input' can be parsed as a Certificate ID diff --git a/resource-manager/recoveryservices/2021-08-01/vaultextendedinfo/id_vault.go b/resource-manager/recoveryservices/2021-08-01/vaultextendedinfo/id_vault.go index a2f93c1502d..187d3501a78 100644 --- a/resource-manager/recoveryservices/2021-08-01/vaultextendedinfo/id_vault.go +++ b/resource-manager/recoveryservices/2021-08-01/vaultextendedinfo/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservices/2021-08-01/vaults/id_vault.go b/resource-manager/recoveryservices/2021-08-01/vaults/id_vault.go index c436e8031c6..e5a807d164d 100644 --- a/resource-manager/recoveryservices/2021-08-01/vaults/id_vault.go +++ b/resource-manager/recoveryservices/2021-08-01/vaults/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservices/2021-08-01/vaultusages/id_vault.go b/resource-manager/recoveryservices/2021-08-01/vaultusages/id_vault.go index e8ab259d24f..58d8c489405 100644 --- a/resource-manager/recoveryservices/2021-08-01/vaultusages/id_vault.go +++ b/resource-manager/recoveryservices/2021-08-01/vaultusages/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservices/2021-12-01/getprivatelinkresources/id_privatelinkresource.go b/resource-manager/recoveryservices/2021-12-01/getprivatelinkresources/id_privatelinkresource.go index 0ce9e647995..0e99511ea9d 100644 --- a/resource-manager/recoveryservices/2021-12-01/getprivatelinkresources/id_privatelinkresource.go +++ b/resource-manager/recoveryservices/2021-12-01/getprivatelinkresources/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/recoveryservices/2021-12-01/listprivatelinkresources/id_vault.go b/resource-manager/recoveryservices/2021-12-01/listprivatelinkresources/id_vault.go index c502cc1f256..481d9f0e8cd 100644 --- a/resource-manager/recoveryservices/2021-12-01/listprivatelinkresources/id_vault.go +++ b/resource-manager/recoveryservices/2021-12-01/listprivatelinkresources/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservices/2021-12-01/recoveryservices/id_location.go b/resource-manager/recoveryservices/2021-12-01/recoveryservices/id_location.go index 9a280dccc3f..6d2d5b937e2 100644 --- a/resource-manager/recoveryservices/2021-12-01/recoveryservices/id_location.go +++ b/resource-manager/recoveryservices/2021-12-01/recoveryservices/id_location.go @@ -36,19 +36,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LocationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/recoveryservices/2021-12-01/registeredidentities/id_registeredidentity.go b/resource-manager/recoveryservices/2021-12-01/registeredidentities/id_registeredidentity.go index 8fcaacac2a7..005805b327b 100644 --- a/resource-manager/recoveryservices/2021-12-01/registeredidentities/id_registeredidentity.go +++ b/resource-manager/recoveryservices/2021-12-01/registeredidentities/id_registeredidentity.go @@ -38,23 +38,9 @@ func ParseRegisteredIdentityID(input string) (*RegisteredIdentityId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegisteredIdentityId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.RegisteredIdentityName, ok = parsed.Parsed["registeredIdentityName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registeredIdentityName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRegisteredIdentityIDInsensitively(input string) (*RegisteredIdentityId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegisteredIdentityId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RegisteredIdentityId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.RegisteredIdentityName, ok = parsed.Parsed["registeredIdentityName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registeredIdentityName", *parsed) + if id.RegisteredIdentityName, ok = input.Parsed["registeredIdentityName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registeredIdentityName", input) } - return &id, nil + return nil } // ValidateRegisteredIdentityID checks that 'input' can be parsed as a Registered Identity ID diff --git a/resource-manager/recoveryservices/2021-12-01/replicationusages/id_vault.go b/resource-manager/recoveryservices/2021-12-01/replicationusages/id_vault.go index 8d2b432414c..6162db2fbbf 100644 --- a/resource-manager/recoveryservices/2021-12-01/replicationusages/id_vault.go +++ b/resource-manager/recoveryservices/2021-12-01/replicationusages/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservices/2021-12-01/vaultcertificates/id_certificate.go b/resource-manager/recoveryservices/2021-12-01/vaultcertificates/id_certificate.go index 56dd60171f7..be70b62e4ca 100644 --- a/resource-manager/recoveryservices/2021-12-01/vaultcertificates/id_certificate.go +++ b/resource-manager/recoveryservices/2021-12-01/vaultcertificates/id_certificate.go @@ -38,23 +38,9 @@ func ParseCertificateID(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCertificateIDInsensitively(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if id.CertificateName, ok = input.Parsed["certificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateName", input) } - return &id, nil + return nil } // ValidateCertificateID checks that 'input' can be parsed as a Certificate ID diff --git a/resource-manager/recoveryservices/2021-12-01/vaultextendedinfo/id_vault.go b/resource-manager/recoveryservices/2021-12-01/vaultextendedinfo/id_vault.go index a2f93c1502d..187d3501a78 100644 --- a/resource-manager/recoveryservices/2021-12-01/vaultextendedinfo/id_vault.go +++ b/resource-manager/recoveryservices/2021-12-01/vaultextendedinfo/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservices/2021-12-01/vaults/id_vault.go b/resource-manager/recoveryservices/2021-12-01/vaults/id_vault.go index c436e8031c6..e5a807d164d 100644 --- a/resource-manager/recoveryservices/2021-12-01/vaults/id_vault.go +++ b/resource-manager/recoveryservices/2021-12-01/vaults/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservices/2021-12-01/vaultusages/id_vault.go b/resource-manager/recoveryservices/2021-12-01/vaultusages/id_vault.go index e8ab259d24f..58d8c489405 100644 --- a/resource-manager/recoveryservices/2021-12-01/vaultusages/id_vault.go +++ b/resource-manager/recoveryservices/2021-12-01/vaultusages/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservices/2022-03-01/getprivatelinkresources/id_privatelinkresource.go b/resource-manager/recoveryservices/2022-03-01/getprivatelinkresources/id_privatelinkresource.go index 0ce9e647995..0e99511ea9d 100644 --- a/resource-manager/recoveryservices/2022-03-01/getprivatelinkresources/id_privatelinkresource.go +++ b/resource-manager/recoveryservices/2022-03-01/getprivatelinkresources/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/recoveryservices/2022-03-01/listprivatelinkresources/id_vault.go b/resource-manager/recoveryservices/2022-03-01/listprivatelinkresources/id_vault.go index c502cc1f256..481d9f0e8cd 100644 --- a/resource-manager/recoveryservices/2022-03-01/listprivatelinkresources/id_vault.go +++ b/resource-manager/recoveryservices/2022-03-01/listprivatelinkresources/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservices/2022-03-01/recoveryservices/id_location.go b/resource-manager/recoveryservices/2022-03-01/recoveryservices/id_location.go index 9a280dccc3f..6d2d5b937e2 100644 --- a/resource-manager/recoveryservices/2022-03-01/recoveryservices/id_location.go +++ b/resource-manager/recoveryservices/2022-03-01/recoveryservices/id_location.go @@ -36,19 +36,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LocationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/recoveryservices/2022-03-01/registeredidentities/id_registeredidentity.go b/resource-manager/recoveryservices/2022-03-01/registeredidentities/id_registeredidentity.go index 8fcaacac2a7..005805b327b 100644 --- a/resource-manager/recoveryservices/2022-03-01/registeredidentities/id_registeredidentity.go +++ b/resource-manager/recoveryservices/2022-03-01/registeredidentities/id_registeredidentity.go @@ -38,23 +38,9 @@ func ParseRegisteredIdentityID(input string) (*RegisteredIdentityId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegisteredIdentityId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.RegisteredIdentityName, ok = parsed.Parsed["registeredIdentityName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registeredIdentityName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRegisteredIdentityIDInsensitively(input string) (*RegisteredIdentityId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegisteredIdentityId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RegisteredIdentityId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.RegisteredIdentityName, ok = parsed.Parsed["registeredIdentityName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registeredIdentityName", *parsed) + if id.RegisteredIdentityName, ok = input.Parsed["registeredIdentityName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registeredIdentityName", input) } - return &id, nil + return nil } // ValidateRegisteredIdentityID checks that 'input' can be parsed as a Registered Identity ID diff --git a/resource-manager/recoveryservices/2022-03-01/replicationusages/id_vault.go b/resource-manager/recoveryservices/2022-03-01/replicationusages/id_vault.go index 8d2b432414c..6162db2fbbf 100644 --- a/resource-manager/recoveryservices/2022-03-01/replicationusages/id_vault.go +++ b/resource-manager/recoveryservices/2022-03-01/replicationusages/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservices/2022-03-01/vaultcertificates/id_certificate.go b/resource-manager/recoveryservices/2022-03-01/vaultcertificates/id_certificate.go index 56dd60171f7..be70b62e4ca 100644 --- a/resource-manager/recoveryservices/2022-03-01/vaultcertificates/id_certificate.go +++ b/resource-manager/recoveryservices/2022-03-01/vaultcertificates/id_certificate.go @@ -38,23 +38,9 @@ func ParseCertificateID(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCertificateIDInsensitively(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if id.CertificateName, ok = input.Parsed["certificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateName", input) } - return &id, nil + return nil } // ValidateCertificateID checks that 'input' can be parsed as a Certificate ID diff --git a/resource-manager/recoveryservices/2022-03-01/vaultextendedinfo/id_vault.go b/resource-manager/recoveryservices/2022-03-01/vaultextendedinfo/id_vault.go index a2f93c1502d..187d3501a78 100644 --- a/resource-manager/recoveryservices/2022-03-01/vaultextendedinfo/id_vault.go +++ b/resource-manager/recoveryservices/2022-03-01/vaultextendedinfo/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservices/2022-03-01/vaults/id_vault.go b/resource-manager/recoveryservices/2022-03-01/vaults/id_vault.go index c436e8031c6..e5a807d164d 100644 --- a/resource-manager/recoveryservices/2022-03-01/vaults/id_vault.go +++ b/resource-manager/recoveryservices/2022-03-01/vaults/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservices/2022-03-01/vaultusages/id_vault.go b/resource-manager/recoveryservices/2022-03-01/vaultusages/id_vault.go index e8ab259d24f..58d8c489405 100644 --- a/resource-manager/recoveryservices/2022-03-01/vaultusages/id_vault.go +++ b/resource-manager/recoveryservices/2022-03-01/vaultusages/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservices/2022-08-01/getprivatelinkresources/id_privatelinkresource.go b/resource-manager/recoveryservices/2022-08-01/getprivatelinkresources/id_privatelinkresource.go index 0ce9e647995..0e99511ea9d 100644 --- a/resource-manager/recoveryservices/2022-08-01/getprivatelinkresources/id_privatelinkresource.go +++ b/resource-manager/recoveryservices/2022-08-01/getprivatelinkresources/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/recoveryservices/2022-08-01/listprivatelinkresources/id_vault.go b/resource-manager/recoveryservices/2022-08-01/listprivatelinkresources/id_vault.go index c502cc1f256..481d9f0e8cd 100644 --- a/resource-manager/recoveryservices/2022-08-01/listprivatelinkresources/id_vault.go +++ b/resource-manager/recoveryservices/2022-08-01/listprivatelinkresources/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservices/2022-08-01/recoveryservices/id_location.go b/resource-manager/recoveryservices/2022-08-01/recoveryservices/id_location.go index 9a280dccc3f..6d2d5b937e2 100644 --- a/resource-manager/recoveryservices/2022-08-01/recoveryservices/id_location.go +++ b/resource-manager/recoveryservices/2022-08-01/recoveryservices/id_location.go @@ -36,19 +36,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LocationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/recoveryservices/2022-08-01/registeredidentities/id_registeredidentity.go b/resource-manager/recoveryservices/2022-08-01/registeredidentities/id_registeredidentity.go index 8fcaacac2a7..005805b327b 100644 --- a/resource-manager/recoveryservices/2022-08-01/registeredidentities/id_registeredidentity.go +++ b/resource-manager/recoveryservices/2022-08-01/registeredidentities/id_registeredidentity.go @@ -38,23 +38,9 @@ func ParseRegisteredIdentityID(input string) (*RegisteredIdentityId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegisteredIdentityId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.RegisteredIdentityName, ok = parsed.Parsed["registeredIdentityName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registeredIdentityName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRegisteredIdentityIDInsensitively(input string) (*RegisteredIdentityId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegisteredIdentityId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RegisteredIdentityId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.RegisteredIdentityName, ok = parsed.Parsed["registeredIdentityName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registeredIdentityName", *parsed) + if id.RegisteredIdentityName, ok = input.Parsed["registeredIdentityName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registeredIdentityName", input) } - return &id, nil + return nil } // ValidateRegisteredIdentityID checks that 'input' can be parsed as a Registered Identity ID diff --git a/resource-manager/recoveryservices/2022-08-01/replicationusages/id_vault.go b/resource-manager/recoveryservices/2022-08-01/replicationusages/id_vault.go index 8d2b432414c..6162db2fbbf 100644 --- a/resource-manager/recoveryservices/2022-08-01/replicationusages/id_vault.go +++ b/resource-manager/recoveryservices/2022-08-01/replicationusages/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservices/2022-08-01/vaultcertificates/id_certificate.go b/resource-manager/recoveryservices/2022-08-01/vaultcertificates/id_certificate.go index 56dd60171f7..be70b62e4ca 100644 --- a/resource-manager/recoveryservices/2022-08-01/vaultcertificates/id_certificate.go +++ b/resource-manager/recoveryservices/2022-08-01/vaultcertificates/id_certificate.go @@ -38,23 +38,9 @@ func ParseCertificateID(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCertificateIDInsensitively(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if id.CertificateName, ok = input.Parsed["certificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateName", input) } - return &id, nil + return nil } // ValidateCertificateID checks that 'input' can be parsed as a Certificate ID diff --git a/resource-manager/recoveryservices/2022-08-01/vaultextendedinfo/id_vault.go b/resource-manager/recoveryservices/2022-08-01/vaultextendedinfo/id_vault.go index a2f93c1502d..187d3501a78 100644 --- a/resource-manager/recoveryservices/2022-08-01/vaultextendedinfo/id_vault.go +++ b/resource-manager/recoveryservices/2022-08-01/vaultextendedinfo/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservices/2022-08-01/vaults/id_vault.go b/resource-manager/recoveryservices/2022-08-01/vaults/id_vault.go index c436e8031c6..e5a807d164d 100644 --- a/resource-manager/recoveryservices/2022-08-01/vaults/id_vault.go +++ b/resource-manager/recoveryservices/2022-08-01/vaults/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservices/2022-08-01/vaultusages/id_vault.go b/resource-manager/recoveryservices/2022-08-01/vaultusages/id_vault.go index e8ab259d24f..58d8c489405 100644 --- a/resource-manager/recoveryservices/2022-08-01/vaultusages/id_vault.go +++ b/resource-manager/recoveryservices/2022-08-01/vaultusages/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservices/2022-09-10/getprivatelinkresources/id_privatelinkresource.go b/resource-manager/recoveryservices/2022-09-10/getprivatelinkresources/id_privatelinkresource.go index 0ce9e647995..0e99511ea9d 100644 --- a/resource-manager/recoveryservices/2022-09-10/getprivatelinkresources/id_privatelinkresource.go +++ b/resource-manager/recoveryservices/2022-09-10/getprivatelinkresources/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/recoveryservices/2022-09-10/listprivatelinkresources/id_vault.go b/resource-manager/recoveryservices/2022-09-10/listprivatelinkresources/id_vault.go index c502cc1f256..481d9f0e8cd 100644 --- a/resource-manager/recoveryservices/2022-09-10/listprivatelinkresources/id_vault.go +++ b/resource-manager/recoveryservices/2022-09-10/listprivatelinkresources/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservices/2022-09-10/recoveryservices/id_location.go b/resource-manager/recoveryservices/2022-09-10/recoveryservices/id_location.go index 9a280dccc3f..6d2d5b937e2 100644 --- a/resource-manager/recoveryservices/2022-09-10/recoveryservices/id_location.go +++ b/resource-manager/recoveryservices/2022-09-10/recoveryservices/id_location.go @@ -36,19 +36,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LocationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/recoveryservices/2022-09-10/registeredidentities/id_registeredidentity.go b/resource-manager/recoveryservices/2022-09-10/registeredidentities/id_registeredidentity.go index 8fcaacac2a7..005805b327b 100644 --- a/resource-manager/recoveryservices/2022-09-10/registeredidentities/id_registeredidentity.go +++ b/resource-manager/recoveryservices/2022-09-10/registeredidentities/id_registeredidentity.go @@ -38,23 +38,9 @@ func ParseRegisteredIdentityID(input string) (*RegisteredIdentityId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegisteredIdentityId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.RegisteredIdentityName, ok = parsed.Parsed["registeredIdentityName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registeredIdentityName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRegisteredIdentityIDInsensitively(input string) (*RegisteredIdentityId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegisteredIdentityId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RegisteredIdentityId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.RegisteredIdentityName, ok = parsed.Parsed["registeredIdentityName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registeredIdentityName", *parsed) + if id.RegisteredIdentityName, ok = input.Parsed["registeredIdentityName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registeredIdentityName", input) } - return &id, nil + return nil } // ValidateRegisteredIdentityID checks that 'input' can be parsed as a Registered Identity ID diff --git a/resource-manager/recoveryservices/2022-09-10/replicationusages/id_vault.go b/resource-manager/recoveryservices/2022-09-10/replicationusages/id_vault.go index 8d2b432414c..6162db2fbbf 100644 --- a/resource-manager/recoveryservices/2022-09-10/replicationusages/id_vault.go +++ b/resource-manager/recoveryservices/2022-09-10/replicationusages/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservices/2022-09-10/vaultcertificates/id_certificate.go b/resource-manager/recoveryservices/2022-09-10/vaultcertificates/id_certificate.go index 56dd60171f7..be70b62e4ca 100644 --- a/resource-manager/recoveryservices/2022-09-10/vaultcertificates/id_certificate.go +++ b/resource-manager/recoveryservices/2022-09-10/vaultcertificates/id_certificate.go @@ -38,23 +38,9 @@ func ParseCertificateID(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCertificateIDInsensitively(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if id.CertificateName, ok = input.Parsed["certificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateName", input) } - return &id, nil + return nil } // ValidateCertificateID checks that 'input' can be parsed as a Certificate ID diff --git a/resource-manager/recoveryservices/2022-09-10/vaultextendedinfo/id_vault.go b/resource-manager/recoveryservices/2022-09-10/vaultextendedinfo/id_vault.go index a2f93c1502d..187d3501a78 100644 --- a/resource-manager/recoveryservices/2022-09-10/vaultextendedinfo/id_vault.go +++ b/resource-manager/recoveryservices/2022-09-10/vaultextendedinfo/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservices/2022-09-10/vaults/id_vault.go b/resource-manager/recoveryservices/2022-09-10/vaults/id_vault.go index c436e8031c6..e5a807d164d 100644 --- a/resource-manager/recoveryservices/2022-09-10/vaults/id_vault.go +++ b/resource-manager/recoveryservices/2022-09-10/vaults/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservices/2022-09-10/vaultusages/id_vault.go b/resource-manager/recoveryservices/2022-09-10/vaultusages/id_vault.go index e8ab259d24f..58d8c489405 100644 --- a/resource-manager/recoveryservices/2022-09-10/vaultusages/id_vault.go +++ b/resource-manager/recoveryservices/2022-09-10/vaultusages/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservices/2022-10-01/getprivatelinkresources/id_privatelinkresource.go b/resource-manager/recoveryservices/2022-10-01/getprivatelinkresources/id_privatelinkresource.go index 0ce9e647995..0e99511ea9d 100644 --- a/resource-manager/recoveryservices/2022-10-01/getprivatelinkresources/id_privatelinkresource.go +++ b/resource-manager/recoveryservices/2022-10-01/getprivatelinkresources/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/recoveryservices/2022-10-01/listprivatelinkresources/id_vault.go b/resource-manager/recoveryservices/2022-10-01/listprivatelinkresources/id_vault.go index c502cc1f256..481d9f0e8cd 100644 --- a/resource-manager/recoveryservices/2022-10-01/listprivatelinkresources/id_vault.go +++ b/resource-manager/recoveryservices/2022-10-01/listprivatelinkresources/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservices/2022-10-01/recoveryservices/id_location.go b/resource-manager/recoveryservices/2022-10-01/recoveryservices/id_location.go index fb98de32b1e..53de925c0d7 100644 --- a/resource-manager/recoveryservices/2022-10-01/recoveryservices/id_location.go +++ b/resource-manager/recoveryservices/2022-10-01/recoveryservices/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/recoveryservices/2022-10-01/recoveryservices/id_providerlocation.go b/resource-manager/recoveryservices/2022-10-01/recoveryservices/id_providerlocation.go index a01ff0bd7aa..ef6d110f066 100644 --- a/resource-manager/recoveryservices/2022-10-01/recoveryservices/id_providerlocation.go +++ b/resource-manager/recoveryservices/2022-10-01/recoveryservices/id_providerlocation.go @@ -36,19 +36,9 @@ func ParseProviderLocationID(input string) (*ProviderLocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderLocationIDInsensitively(input string) (*ProviderLocationId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderLocationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateProviderLocationID checks that 'input' can be parsed as a Provider Location ID diff --git a/resource-manager/recoveryservices/2022-10-01/registeredidentities/id_registeredidentity.go b/resource-manager/recoveryservices/2022-10-01/registeredidentities/id_registeredidentity.go index 8fcaacac2a7..005805b327b 100644 --- a/resource-manager/recoveryservices/2022-10-01/registeredidentities/id_registeredidentity.go +++ b/resource-manager/recoveryservices/2022-10-01/registeredidentities/id_registeredidentity.go @@ -38,23 +38,9 @@ func ParseRegisteredIdentityID(input string) (*RegisteredIdentityId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegisteredIdentityId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.RegisteredIdentityName, ok = parsed.Parsed["registeredIdentityName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registeredIdentityName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRegisteredIdentityIDInsensitively(input string) (*RegisteredIdentityId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegisteredIdentityId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RegisteredIdentityId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.RegisteredIdentityName, ok = parsed.Parsed["registeredIdentityName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registeredIdentityName", *parsed) + if id.RegisteredIdentityName, ok = input.Parsed["registeredIdentityName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registeredIdentityName", input) } - return &id, nil + return nil } // ValidateRegisteredIdentityID checks that 'input' can be parsed as a Registered Identity ID diff --git a/resource-manager/recoveryservices/2022-10-01/replicationusages/id_vault.go b/resource-manager/recoveryservices/2022-10-01/replicationusages/id_vault.go index 8d2b432414c..6162db2fbbf 100644 --- a/resource-manager/recoveryservices/2022-10-01/replicationusages/id_vault.go +++ b/resource-manager/recoveryservices/2022-10-01/replicationusages/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservices/2022-10-01/vaultcertificates/id_certificate.go b/resource-manager/recoveryservices/2022-10-01/vaultcertificates/id_certificate.go index 56dd60171f7..be70b62e4ca 100644 --- a/resource-manager/recoveryservices/2022-10-01/vaultcertificates/id_certificate.go +++ b/resource-manager/recoveryservices/2022-10-01/vaultcertificates/id_certificate.go @@ -38,23 +38,9 @@ func ParseCertificateID(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCertificateIDInsensitively(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if id.CertificateName, ok = input.Parsed["certificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateName", input) } - return &id, nil + return nil } // ValidateCertificateID checks that 'input' can be parsed as a Certificate ID diff --git a/resource-manager/recoveryservices/2022-10-01/vaultextendedinfo/id_vault.go b/resource-manager/recoveryservices/2022-10-01/vaultextendedinfo/id_vault.go index a2f93c1502d..187d3501a78 100644 --- a/resource-manager/recoveryservices/2022-10-01/vaultextendedinfo/id_vault.go +++ b/resource-manager/recoveryservices/2022-10-01/vaultextendedinfo/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservices/2022-10-01/vaults/id_vault.go b/resource-manager/recoveryservices/2022-10-01/vaults/id_vault.go index c436e8031c6..e5a807d164d 100644 --- a/resource-manager/recoveryservices/2022-10-01/vaults/id_vault.go +++ b/resource-manager/recoveryservices/2022-10-01/vaults/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservices/2022-10-01/vaultusages/id_vault.go b/resource-manager/recoveryservices/2022-10-01/vaultusages/id_vault.go index e8ab259d24f..58d8c489405 100644 --- a/resource-manager/recoveryservices/2022-10-01/vaultusages/id_vault.go +++ b/resource-manager/recoveryservices/2022-10-01/vaultusages/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservices/2023-02-01/getprivatelinkresources/id_privatelinkresource.go b/resource-manager/recoveryservices/2023-02-01/getprivatelinkresources/id_privatelinkresource.go index 0ce9e647995..0e99511ea9d 100644 --- a/resource-manager/recoveryservices/2023-02-01/getprivatelinkresources/id_privatelinkresource.go +++ b/resource-manager/recoveryservices/2023-02-01/getprivatelinkresources/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/recoveryservices/2023-02-01/listprivatelinkresources/id_vault.go b/resource-manager/recoveryservices/2023-02-01/listprivatelinkresources/id_vault.go index c502cc1f256..481d9f0e8cd 100644 --- a/resource-manager/recoveryservices/2023-02-01/listprivatelinkresources/id_vault.go +++ b/resource-manager/recoveryservices/2023-02-01/listprivatelinkresources/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservices/2023-02-01/recoveryservices/id_location.go b/resource-manager/recoveryservices/2023-02-01/recoveryservices/id_location.go index fb98de32b1e..53de925c0d7 100644 --- a/resource-manager/recoveryservices/2023-02-01/recoveryservices/id_location.go +++ b/resource-manager/recoveryservices/2023-02-01/recoveryservices/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/recoveryservices/2023-02-01/recoveryservices/id_providerlocation.go b/resource-manager/recoveryservices/2023-02-01/recoveryservices/id_providerlocation.go index a01ff0bd7aa..ef6d110f066 100644 --- a/resource-manager/recoveryservices/2023-02-01/recoveryservices/id_providerlocation.go +++ b/resource-manager/recoveryservices/2023-02-01/recoveryservices/id_providerlocation.go @@ -36,19 +36,9 @@ func ParseProviderLocationID(input string) (*ProviderLocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderLocationIDInsensitively(input string) (*ProviderLocationId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderLocationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateProviderLocationID checks that 'input' can be parsed as a Provider Location ID diff --git a/resource-manager/recoveryservices/2023-02-01/registeredidentities/id_registeredidentity.go b/resource-manager/recoveryservices/2023-02-01/registeredidentities/id_registeredidentity.go index 8fcaacac2a7..005805b327b 100644 --- a/resource-manager/recoveryservices/2023-02-01/registeredidentities/id_registeredidentity.go +++ b/resource-manager/recoveryservices/2023-02-01/registeredidentities/id_registeredidentity.go @@ -38,23 +38,9 @@ func ParseRegisteredIdentityID(input string) (*RegisteredIdentityId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegisteredIdentityId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.RegisteredIdentityName, ok = parsed.Parsed["registeredIdentityName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registeredIdentityName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRegisteredIdentityIDInsensitively(input string) (*RegisteredIdentityId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegisteredIdentityId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RegisteredIdentityId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.RegisteredIdentityName, ok = parsed.Parsed["registeredIdentityName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registeredIdentityName", *parsed) + if id.RegisteredIdentityName, ok = input.Parsed["registeredIdentityName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registeredIdentityName", input) } - return &id, nil + return nil } // ValidateRegisteredIdentityID checks that 'input' can be parsed as a Registered Identity ID diff --git a/resource-manager/recoveryservices/2023-02-01/replicationusages/id_vault.go b/resource-manager/recoveryservices/2023-02-01/replicationusages/id_vault.go index 8d2b432414c..6162db2fbbf 100644 --- a/resource-manager/recoveryservices/2023-02-01/replicationusages/id_vault.go +++ b/resource-manager/recoveryservices/2023-02-01/replicationusages/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservices/2023-02-01/vaultcertificates/id_certificate.go b/resource-manager/recoveryservices/2023-02-01/vaultcertificates/id_certificate.go index 56dd60171f7..be70b62e4ca 100644 --- a/resource-manager/recoveryservices/2023-02-01/vaultcertificates/id_certificate.go +++ b/resource-manager/recoveryservices/2023-02-01/vaultcertificates/id_certificate.go @@ -38,23 +38,9 @@ func ParseCertificateID(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCertificateIDInsensitively(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if id.CertificateName, ok = input.Parsed["certificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateName", input) } - return &id, nil + return nil } // ValidateCertificateID checks that 'input' can be parsed as a Certificate ID diff --git a/resource-manager/recoveryservices/2023-02-01/vaultextendedinfo/id_vault.go b/resource-manager/recoveryservices/2023-02-01/vaultextendedinfo/id_vault.go index a2f93c1502d..187d3501a78 100644 --- a/resource-manager/recoveryservices/2023-02-01/vaultextendedinfo/id_vault.go +++ b/resource-manager/recoveryservices/2023-02-01/vaultextendedinfo/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservices/2023-02-01/vaults/id_vault.go b/resource-manager/recoveryservices/2023-02-01/vaults/id_vault.go index c436e8031c6..e5a807d164d 100644 --- a/resource-manager/recoveryservices/2023-02-01/vaults/id_vault.go +++ b/resource-manager/recoveryservices/2023-02-01/vaults/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservices/2023-02-01/vaultusages/id_vault.go b/resource-manager/recoveryservices/2023-02-01/vaultusages/id_vault.go index e8ab259d24f..58d8c489405 100644 --- a/resource-manager/recoveryservices/2023-02-01/vaultusages/id_vault.go +++ b/resource-manager/recoveryservices/2023-02-01/vaultusages/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservices/2023-04-01/getprivatelinkresources/id_privatelinkresource.go b/resource-manager/recoveryservices/2023-04-01/getprivatelinkresources/id_privatelinkresource.go index 0ce9e647995..0e99511ea9d 100644 --- a/resource-manager/recoveryservices/2023-04-01/getprivatelinkresources/id_privatelinkresource.go +++ b/resource-manager/recoveryservices/2023-04-01/getprivatelinkresources/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/recoveryservices/2023-04-01/listprivatelinkresources/id_vault.go b/resource-manager/recoveryservices/2023-04-01/listprivatelinkresources/id_vault.go index c502cc1f256..481d9f0e8cd 100644 --- a/resource-manager/recoveryservices/2023-04-01/listprivatelinkresources/id_vault.go +++ b/resource-manager/recoveryservices/2023-04-01/listprivatelinkresources/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservices/2023-04-01/recoveryservices/id_location.go b/resource-manager/recoveryservices/2023-04-01/recoveryservices/id_location.go index fb98de32b1e..53de925c0d7 100644 --- a/resource-manager/recoveryservices/2023-04-01/recoveryservices/id_location.go +++ b/resource-manager/recoveryservices/2023-04-01/recoveryservices/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/recoveryservices/2023-04-01/recoveryservices/id_providerlocation.go b/resource-manager/recoveryservices/2023-04-01/recoveryservices/id_providerlocation.go index a01ff0bd7aa..ef6d110f066 100644 --- a/resource-manager/recoveryservices/2023-04-01/recoveryservices/id_providerlocation.go +++ b/resource-manager/recoveryservices/2023-04-01/recoveryservices/id_providerlocation.go @@ -36,19 +36,9 @@ func ParseProviderLocationID(input string) (*ProviderLocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderLocationIDInsensitively(input string) (*ProviderLocationId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderLocationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateProviderLocationID checks that 'input' can be parsed as a Provider Location ID diff --git a/resource-manager/recoveryservices/2023-04-01/registeredidentities/id_registeredidentity.go b/resource-manager/recoveryservices/2023-04-01/registeredidentities/id_registeredidentity.go index 8fcaacac2a7..005805b327b 100644 --- a/resource-manager/recoveryservices/2023-04-01/registeredidentities/id_registeredidentity.go +++ b/resource-manager/recoveryservices/2023-04-01/registeredidentities/id_registeredidentity.go @@ -38,23 +38,9 @@ func ParseRegisteredIdentityID(input string) (*RegisteredIdentityId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegisteredIdentityId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.RegisteredIdentityName, ok = parsed.Parsed["registeredIdentityName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registeredIdentityName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRegisteredIdentityIDInsensitively(input string) (*RegisteredIdentityId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegisteredIdentityId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RegisteredIdentityId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.RegisteredIdentityName, ok = parsed.Parsed["registeredIdentityName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registeredIdentityName", *parsed) + if id.RegisteredIdentityName, ok = input.Parsed["registeredIdentityName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registeredIdentityName", input) } - return &id, nil + return nil } // ValidateRegisteredIdentityID checks that 'input' can be parsed as a Registered Identity ID diff --git a/resource-manager/recoveryservices/2023-04-01/replicationusages/id_vault.go b/resource-manager/recoveryservices/2023-04-01/replicationusages/id_vault.go index 8d2b432414c..6162db2fbbf 100644 --- a/resource-manager/recoveryservices/2023-04-01/replicationusages/id_vault.go +++ b/resource-manager/recoveryservices/2023-04-01/replicationusages/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservices/2023-04-01/vaultcertificates/id_certificate.go b/resource-manager/recoveryservices/2023-04-01/vaultcertificates/id_certificate.go index 56dd60171f7..be70b62e4ca 100644 --- a/resource-manager/recoveryservices/2023-04-01/vaultcertificates/id_certificate.go +++ b/resource-manager/recoveryservices/2023-04-01/vaultcertificates/id_certificate.go @@ -38,23 +38,9 @@ func ParseCertificateID(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCertificateIDInsensitively(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if id.CertificateName, ok = input.Parsed["certificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateName", input) } - return &id, nil + return nil } // ValidateCertificateID checks that 'input' can be parsed as a Certificate ID diff --git a/resource-manager/recoveryservices/2023-04-01/vaultextendedinfo/id_vault.go b/resource-manager/recoveryservices/2023-04-01/vaultextendedinfo/id_vault.go index a2f93c1502d..187d3501a78 100644 --- a/resource-manager/recoveryservices/2023-04-01/vaultextendedinfo/id_vault.go +++ b/resource-manager/recoveryservices/2023-04-01/vaultextendedinfo/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservices/2023-04-01/vaults/id_vault.go b/resource-manager/recoveryservices/2023-04-01/vaults/id_vault.go index c436e8031c6..e5a807d164d 100644 --- a/resource-manager/recoveryservices/2023-04-01/vaults/id_vault.go +++ b/resource-manager/recoveryservices/2023-04-01/vaults/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservices/2023-04-01/vaultusages/id_vault.go b/resource-manager/recoveryservices/2023-04-01/vaultusages/id_vault.go index e8ab259d24f..58d8c489405 100644 --- a/resource-manager/recoveryservices/2023-04-01/vaultusages/id_vault.go +++ b/resource-manager/recoveryservices/2023-04-01/vaultusages/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservices/2023-06-01/getprivatelinkresources/id_privatelinkresource.go b/resource-manager/recoveryservices/2023-06-01/getprivatelinkresources/id_privatelinkresource.go index 0ce9e647995..0e99511ea9d 100644 --- a/resource-manager/recoveryservices/2023-06-01/getprivatelinkresources/id_privatelinkresource.go +++ b/resource-manager/recoveryservices/2023-06-01/getprivatelinkresources/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/recoveryservices/2023-06-01/listprivatelinkresources/id_vault.go b/resource-manager/recoveryservices/2023-06-01/listprivatelinkresources/id_vault.go index c502cc1f256..481d9f0e8cd 100644 --- a/resource-manager/recoveryservices/2023-06-01/listprivatelinkresources/id_vault.go +++ b/resource-manager/recoveryservices/2023-06-01/listprivatelinkresources/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservices/2023-06-01/recoveryservices/id_location.go b/resource-manager/recoveryservices/2023-06-01/recoveryservices/id_location.go index fb98de32b1e..53de925c0d7 100644 --- a/resource-manager/recoveryservices/2023-06-01/recoveryservices/id_location.go +++ b/resource-manager/recoveryservices/2023-06-01/recoveryservices/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/recoveryservices/2023-06-01/recoveryservices/id_providerlocation.go b/resource-manager/recoveryservices/2023-06-01/recoveryservices/id_providerlocation.go index a01ff0bd7aa..ef6d110f066 100644 --- a/resource-manager/recoveryservices/2023-06-01/recoveryservices/id_providerlocation.go +++ b/resource-manager/recoveryservices/2023-06-01/recoveryservices/id_providerlocation.go @@ -36,19 +36,9 @@ func ParseProviderLocationID(input string) (*ProviderLocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderLocationIDInsensitively(input string) (*ProviderLocationId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderLocationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateProviderLocationID checks that 'input' can be parsed as a Provider Location ID diff --git a/resource-manager/recoveryservices/2023-06-01/registeredidentities/id_registeredidentity.go b/resource-manager/recoveryservices/2023-06-01/registeredidentities/id_registeredidentity.go index 8fcaacac2a7..005805b327b 100644 --- a/resource-manager/recoveryservices/2023-06-01/registeredidentities/id_registeredidentity.go +++ b/resource-manager/recoveryservices/2023-06-01/registeredidentities/id_registeredidentity.go @@ -38,23 +38,9 @@ func ParseRegisteredIdentityID(input string) (*RegisteredIdentityId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegisteredIdentityId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.RegisteredIdentityName, ok = parsed.Parsed["registeredIdentityName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registeredIdentityName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRegisteredIdentityIDInsensitively(input string) (*RegisteredIdentityId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegisteredIdentityId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RegisteredIdentityId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.RegisteredIdentityName, ok = parsed.Parsed["registeredIdentityName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "registeredIdentityName", *parsed) + if id.RegisteredIdentityName, ok = input.Parsed["registeredIdentityName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registeredIdentityName", input) } - return &id, nil + return nil } // ValidateRegisteredIdentityID checks that 'input' can be parsed as a Registered Identity ID diff --git a/resource-manager/recoveryservices/2023-06-01/replicationusages/id_vault.go b/resource-manager/recoveryservices/2023-06-01/replicationusages/id_vault.go index 8d2b432414c..6162db2fbbf 100644 --- a/resource-manager/recoveryservices/2023-06-01/replicationusages/id_vault.go +++ b/resource-manager/recoveryservices/2023-06-01/replicationusages/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservices/2023-06-01/vaultcertificates/id_certificate.go b/resource-manager/recoveryservices/2023-06-01/vaultcertificates/id_certificate.go index 56dd60171f7..be70b62e4ca 100644 --- a/resource-manager/recoveryservices/2023-06-01/vaultcertificates/id_certificate.go +++ b/resource-manager/recoveryservices/2023-06-01/vaultcertificates/id_certificate.go @@ -38,23 +38,9 @@ func ParseCertificateID(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCertificateIDInsensitively(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if id.CertificateName, ok = input.Parsed["certificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateName", input) } - return &id, nil + return nil } // ValidateCertificateID checks that 'input' can be parsed as a Certificate ID diff --git a/resource-manager/recoveryservices/2023-06-01/vaultextendedinfo/id_vault.go b/resource-manager/recoveryservices/2023-06-01/vaultextendedinfo/id_vault.go index a2f93c1502d..187d3501a78 100644 --- a/resource-manager/recoveryservices/2023-06-01/vaultextendedinfo/id_vault.go +++ b/resource-manager/recoveryservices/2023-06-01/vaultextendedinfo/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservices/2023-06-01/vaults/id_vault.go b/resource-manager/recoveryservices/2023-06-01/vaults/id_vault.go index c436e8031c6..e5a807d164d 100644 --- a/resource-manager/recoveryservices/2023-06-01/vaults/id_vault.go +++ b/resource-manager/recoveryservices/2023-06-01/vaults/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservices/2023-06-01/vaultusages/id_vault.go b/resource-manager/recoveryservices/2023-06-01/vaultusages/id_vault.go index e8ab259d24f..58d8c489405 100644 --- a/resource-manager/recoveryservices/2023-06-01/vaultusages/id_vault.go +++ b/resource-manager/recoveryservices/2023-06-01/vaultusages/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-01-15/aadproperties/id_location.go b/resource-manager/recoveryservicesbackup/2023-01-15/aadproperties/id_location.go index 994b1a5c242..042d60ad565 100644 --- a/resource-manager/recoveryservicesbackup/2023-01-15/aadproperties/id_location.go +++ b/resource-manager/recoveryservicesbackup/2023-01-15/aadproperties/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/recoveryservicesbackup/2023-01-15/backupcrrjobs/id_location.go b/resource-manager/recoveryservicesbackup/2023-01-15/backupcrrjobs/id_location.go index 56de6855339..2e0f6d8928d 100644 --- a/resource-manager/recoveryservicesbackup/2023-01-15/backupcrrjobs/id_location.go +++ b/resource-manager/recoveryservicesbackup/2023-01-15/backupcrrjobs/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/recoveryservicesbackup/2023-01-15/backupprotecteditemscrr/id_vault.go b/resource-manager/recoveryservicesbackup/2023-01-15/backupprotecteditemscrr/id_vault.go index 81dda9bd34f..e29fac2f0f2 100644 --- a/resource-manager/recoveryservicesbackup/2023-01-15/backupprotecteditemscrr/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-01-15/backupprotecteditemscrr/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-01-15/backupresourcestorageconfigs/id_vault.go b/resource-manager/recoveryservicesbackup/2023-01-15/backupresourcestorageconfigs/id_vault.go index 83e790f0d95..1a8ec86bc61 100644 --- a/resource-manager/recoveryservicesbackup/2023-01-15/backupresourcestorageconfigs/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-01-15/backupresourcestorageconfigs/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-01-15/backupusagesummariescrr/id_vault.go b/resource-manager/recoveryservicesbackup/2023-01-15/backupusagesummariescrr/id_vault.go index c24b58b283e..6afd5d6694d 100644 --- a/resource-manager/recoveryservicesbackup/2023-01-15/backupusagesummariescrr/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-01-15/backupusagesummariescrr/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-01-15/crossregionrestore/id_location.go b/resource-manager/recoveryservicesbackup/2023-01-15/crossregionrestore/id_location.go index 77c317f51d8..43778589969 100644 --- a/resource-manager/recoveryservicesbackup/2023-01-15/crossregionrestore/id_location.go +++ b/resource-manager/recoveryservicesbackup/2023-01-15/crossregionrestore/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/recoveryservicesbackup/2023-01-15/crrjobdetails/id_location.go b/resource-manager/recoveryservicesbackup/2023-01-15/crrjobdetails/id_location.go index 377e10b3efc..9a7051affc6 100644 --- a/resource-manager/recoveryservicesbackup/2023-01-15/crrjobdetails/id_location.go +++ b/resource-manager/recoveryservicesbackup/2023-01-15/crrjobdetails/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/recoveryservicesbackup/2023-01-15/recoverypointscrr/id_protecteditem.go b/resource-manager/recoveryservicesbackup/2023-01-15/recoverypointscrr/id_protecteditem.go index c8594a726ce..4aefb8ecb9c 100644 --- a/resource-manager/recoveryservicesbackup/2023-01-15/recoverypointscrr/id_protecteditem.go +++ b/resource-manager/recoveryservicesbackup/2023-01-15/recoverypointscrr/id_protecteditem.go @@ -42,31 +42,9 @@ func ParseProtectedItemID(input string) (*ProtectedItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProtectedItemId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) - } - - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) - } - - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseProtectedItemIDInsensitively(input string) (*ProtectedItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProtectedItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProtectedItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) + if id.BackupFabricName, ok = input.Parsed["backupFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", input) } - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) + if id.ProtectionContainerName, ok = input.Parsed["protectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", input) } - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) + if id.ProtectedItemName, ok = input.Parsed["protectedItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", input) } - return &id, nil + return nil } // ValidateProtectedItemID checks that 'input' can be parsed as a Protected Item ID diff --git a/resource-manager/recoveryservicesbackup/2023-01-15/recoverypointscrr/id_recoverypoint.go b/resource-manager/recoveryservicesbackup/2023-01-15/recoverypointscrr/id_recoverypoint.go index c12c2aea19c..3a562bd1783 100644 --- a/resource-manager/recoveryservicesbackup/2023-01-15/recoverypointscrr/id_recoverypoint.go +++ b/resource-manager/recoveryservicesbackup/2023-01-15/recoverypointscrr/id_recoverypoint.go @@ -44,35 +44,9 @@ func ParseRecoveryPointID(input string) (*RecoveryPointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecoveryPointId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) - } - - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) - } - - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) - } - - if id.RecoveryPointId, ok = parsed.Parsed["recoveryPointId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseRecoveryPointIDInsensitively(input string) (*RecoveryPointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecoveryPointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RecoveryPointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) + if id.BackupFabricName, ok = input.Parsed["backupFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", input) } - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) + if id.ProtectionContainerName, ok = input.Parsed["protectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", input) } - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) + if id.ProtectedItemName, ok = input.Parsed["protectedItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", input) } - if id.RecoveryPointId, ok = parsed.Parsed["recoveryPointId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", *parsed) + if id.RecoveryPointId, ok = input.Parsed["recoveryPointId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", input) } - return &id, nil + return nil } // ValidateRecoveryPointID checks that 'input' can be parsed as a Recovery Point ID diff --git a/resource-manager/recoveryservicesbackup/2023-01-15/recoverypointsgetaccesstoken/id_recoverypoint.go b/resource-manager/recoveryservicesbackup/2023-01-15/recoverypointsgetaccesstoken/id_recoverypoint.go index d05f29fcd80..49167f7cbf3 100644 --- a/resource-manager/recoveryservicesbackup/2023-01-15/recoverypointsgetaccesstoken/id_recoverypoint.go +++ b/resource-manager/recoveryservicesbackup/2023-01-15/recoverypointsgetaccesstoken/id_recoverypoint.go @@ -44,35 +44,9 @@ func ParseRecoveryPointID(input string) (*RecoveryPointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecoveryPointId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) - } - - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) - } - - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) - } - - if id.RecoveryPointId, ok = parsed.Parsed["recoveryPointId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseRecoveryPointIDInsensitively(input string) (*RecoveryPointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecoveryPointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RecoveryPointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) + if id.BackupFabricName, ok = input.Parsed["backupFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", input) } - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) + if id.ProtectionContainerName, ok = input.Parsed["protectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", input) } - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) + if id.ProtectedItemName, ok = input.Parsed["protectedItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", input) } - if id.RecoveryPointId, ok = parsed.Parsed["recoveryPointId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", *parsed) + if id.RecoveryPointId, ok = input.Parsed["recoveryPointId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", input) } - return &id, nil + return nil } // ValidateRecoveryPointID checks that 'input' can be parsed as a Recovery Point ID diff --git a/resource-manager/recoveryservicesbackup/2023-02-01/backupengines/id_backupengine.go b/resource-manager/recoveryservicesbackup/2023-02-01/backupengines/id_backupengine.go index c954a9d2d82..25df491f17f 100644 --- a/resource-manager/recoveryservicesbackup/2023-02-01/backupengines/id_backupengine.go +++ b/resource-manager/recoveryservicesbackup/2023-02-01/backupengines/id_backupengine.go @@ -38,23 +38,9 @@ func ParseBackupEngineID(input string) (*BackupEngineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupEngineId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupEngineName, ok = parsed.Parsed["backupEngineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupEngineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupEngineIDInsensitively(input string) (*BackupEngineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupEngineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupEngineId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupEngineName, ok = parsed.Parsed["backupEngineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupEngineName", *parsed) + if id.BackupEngineName, ok = input.Parsed["backupEngineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupEngineName", input) } - return &id, nil + return nil } // ValidateBackupEngineID checks that 'input' can be parsed as a Backup Engine ID diff --git a/resource-manager/recoveryservicesbackup/2023-02-01/backupengines/id_vault.go b/resource-manager/recoveryservicesbackup/2023-02-01/backupengines/id_vault.go index 6a3e4a29fb9..ce1dc1fecf2 100644 --- a/resource-manager/recoveryservicesbackup/2023-02-01/backupengines/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-02-01/backupengines/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-02-01/backupjobs/id_vault.go b/resource-manager/recoveryservicesbackup/2023-02-01/backupjobs/id_vault.go index 92bf7396d77..cdc8297c734 100644 --- a/resource-manager/recoveryservicesbackup/2023-02-01/backupjobs/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-02-01/backupjobs/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-02-01/backuppolicies/id_vault.go b/resource-manager/recoveryservicesbackup/2023-02-01/backuppolicies/id_vault.go index 58359bb7145..5ba22360b54 100644 --- a/resource-manager/recoveryservicesbackup/2023-02-01/backuppolicies/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-02-01/backuppolicies/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-02-01/backupprotectableitems/id_vault.go b/resource-manager/recoveryservicesbackup/2023-02-01/backupprotectableitems/id_vault.go index ff2ce757403..634cfb3c0cd 100644 --- a/resource-manager/recoveryservicesbackup/2023-02-01/backupprotectableitems/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-02-01/backupprotectableitems/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-02-01/backupprotecteditems/id_vault.go b/resource-manager/recoveryservicesbackup/2023-02-01/backupprotecteditems/id_vault.go index c573dda4a65..f05c3b2777b 100644 --- a/resource-manager/recoveryservicesbackup/2023-02-01/backupprotecteditems/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-02-01/backupprotecteditems/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-02-01/backupprotectioncontainers/id_vault.go b/resource-manager/recoveryservicesbackup/2023-02-01/backupprotectioncontainers/id_vault.go index 997a5877d26..068ddce6bb5 100644 --- a/resource-manager/recoveryservicesbackup/2023-02-01/backupprotectioncontainers/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-02-01/backupprotectioncontainers/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-02-01/backupprotectionintent/id_vault.go b/resource-manager/recoveryservicesbackup/2023-02-01/backupprotectionintent/id_vault.go index b610d60c296..453d39583f5 100644 --- a/resource-manager/recoveryservicesbackup/2023-02-01/backupprotectionintent/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-02-01/backupprotectionintent/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-02-01/backupresourceencryptionconfigs/id_vault.go b/resource-manager/recoveryservicesbackup/2023-02-01/backupresourceencryptionconfigs/id_vault.go index d004887f441..7e698320c88 100644 --- a/resource-manager/recoveryservicesbackup/2023-02-01/backupresourceencryptionconfigs/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-02-01/backupresourceencryptionconfigs/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-02-01/backupresourcestorageconfigsnoncrr/id_vault.go b/resource-manager/recoveryservicesbackup/2023-02-01/backupresourcestorageconfigsnoncrr/id_vault.go index 2340c563656..c6bd079c196 100644 --- a/resource-manager/recoveryservicesbackup/2023-02-01/backupresourcestorageconfigsnoncrr/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-02-01/backupresourcestorageconfigsnoncrr/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-02-01/backupresourcevaultconfigs/id_vault.go b/resource-manager/recoveryservicesbackup/2023-02-01/backupresourcevaultconfigs/id_vault.go index 090ed67cb89..9e57d094359 100644 --- a/resource-manager/recoveryservicesbackup/2023-02-01/backupresourcevaultconfigs/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-02-01/backupresourcevaultconfigs/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-02-01/backups/id_protecteditem.go b/resource-manager/recoveryservicesbackup/2023-02-01/backups/id_protecteditem.go index 65a5e4d7514..b255fd16031 100644 --- a/resource-manager/recoveryservicesbackup/2023-02-01/backups/id_protecteditem.go +++ b/resource-manager/recoveryservicesbackup/2023-02-01/backups/id_protecteditem.go @@ -42,31 +42,9 @@ func ParseProtectedItemID(input string) (*ProtectedItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProtectedItemId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) - } - - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) - } - - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseProtectedItemIDInsensitively(input string) (*ProtectedItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProtectedItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProtectedItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) + if id.BackupFabricName, ok = input.Parsed["backupFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", input) } - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) + if id.ProtectionContainerName, ok = input.Parsed["protectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", input) } - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) + if id.ProtectedItemName, ok = input.Parsed["protectedItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", input) } - return &id, nil + return nil } // ValidateProtectedItemID checks that 'input' can be parsed as a Protected Item ID diff --git a/resource-manager/recoveryservicesbackup/2023-02-01/backupstatus/id_location.go b/resource-manager/recoveryservicesbackup/2023-02-01/backupstatus/id_location.go index 605da007f6f..2b1818689d8 100644 --- a/resource-manager/recoveryservicesbackup/2023-02-01/backupstatus/id_location.go +++ b/resource-manager/recoveryservicesbackup/2023-02-01/backupstatus/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/recoveryservicesbackup/2023-02-01/backupusagesummaries/id_vault.go b/resource-manager/recoveryservicesbackup/2023-02-01/backupusagesummaries/id_vault.go index 881af1e9703..6286b131a96 100644 --- a/resource-manager/recoveryservicesbackup/2023-02-01/backupusagesummaries/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-02-01/backupusagesummaries/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-02-01/backupworkloaditems/id_protectioncontainer.go b/resource-manager/recoveryservicesbackup/2023-02-01/backupworkloaditems/id_protectioncontainer.go index 252e675a1cd..5aabe5a9849 100644 --- a/resource-manager/recoveryservicesbackup/2023-02-01/backupworkloaditems/id_protectioncontainer.go +++ b/resource-manager/recoveryservicesbackup/2023-02-01/backupworkloaditems/id_protectioncontainer.go @@ -40,27 +40,9 @@ func ParseProtectionContainerID(input string) (*ProtectionContainerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProtectionContainerId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) - } - - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseProtectionContainerIDInsensitively(input string) (*ProtectionContainer return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProtectionContainerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ProtectionContainerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) + if id.BackupFabricName, ok = input.Parsed["backupFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", input) } - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) + if id.ProtectionContainerName, ok = input.Parsed["protectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", input) } - return &id, nil + return nil } // ValidateProtectionContainerID checks that 'input' can be parsed as a Protection Container ID diff --git a/resource-manager/recoveryservicesbackup/2023-02-01/datamove/id_vault.go b/resource-manager/recoveryservicesbackup/2023-02-01/datamove/id_vault.go index 3018d3e13af..7d274d08b54 100644 --- a/resource-manager/recoveryservicesbackup/2023-02-01/datamove/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-02-01/datamove/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-02-01/featuresupport/id_location.go b/resource-manager/recoveryservicesbackup/2023-02-01/featuresupport/id_location.go index b614b25be9e..43fe026a3f5 100644 --- a/resource-manager/recoveryservicesbackup/2023-02-01/featuresupport/id_location.go +++ b/resource-manager/recoveryservicesbackup/2023-02-01/featuresupport/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/recoveryservicesbackup/2023-02-01/itemlevelrecoveryconnections/id_recoverypoint.go b/resource-manager/recoveryservicesbackup/2023-02-01/itemlevelrecoveryconnections/id_recoverypoint.go index b578a390b56..23b6991307f 100644 --- a/resource-manager/recoveryservicesbackup/2023-02-01/itemlevelrecoveryconnections/id_recoverypoint.go +++ b/resource-manager/recoveryservicesbackup/2023-02-01/itemlevelrecoveryconnections/id_recoverypoint.go @@ -44,35 +44,9 @@ func ParseRecoveryPointID(input string) (*RecoveryPointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecoveryPointId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) - } - - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) - } - - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) - } - - if id.RecoveryPointId, ok = parsed.Parsed["recoveryPointId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseRecoveryPointIDInsensitively(input string) (*RecoveryPointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecoveryPointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RecoveryPointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) + if id.BackupFabricName, ok = input.Parsed["backupFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", input) } - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) + if id.ProtectionContainerName, ok = input.Parsed["protectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", input) } - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) + if id.ProtectedItemName, ok = input.Parsed["protectedItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", input) } - if id.RecoveryPointId, ok = parsed.Parsed["recoveryPointId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", *parsed) + if id.RecoveryPointId, ok = input.Parsed["recoveryPointId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", input) } - return &id, nil + return nil } // ValidateRecoveryPointID checks that 'input' can be parsed as a Recovery Point ID diff --git a/resource-manager/recoveryservicesbackup/2023-02-01/jobcancellations/id_backupjob.go b/resource-manager/recoveryservicesbackup/2023-02-01/jobcancellations/id_backupjob.go index dec2d00dccb..b653abc82d6 100644 --- a/resource-manager/recoveryservicesbackup/2023-02-01/jobcancellations/id_backupjob.go +++ b/resource-manager/recoveryservicesbackup/2023-02-01/jobcancellations/id_backupjob.go @@ -38,23 +38,9 @@ func ParseBackupJobID(input string) (*BackupJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupJobId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupJobName, ok = parsed.Parsed["backupJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupJobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupJobIDInsensitively(input string) (*BackupJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupJobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupJobId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupJobName, ok = parsed.Parsed["backupJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupJobName", *parsed) + if id.BackupJobName, ok = input.Parsed["backupJobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupJobName", input) } - return &id, nil + return nil } // ValidateBackupJobID checks that 'input' can be parsed as a Backup Job ID diff --git a/resource-manager/recoveryservicesbackup/2023-02-01/jobdetails/id_backupjob.go b/resource-manager/recoveryservicesbackup/2023-02-01/jobdetails/id_backupjob.go index daa9077226b..efd53b158d1 100644 --- a/resource-manager/recoveryservicesbackup/2023-02-01/jobdetails/id_backupjob.go +++ b/resource-manager/recoveryservicesbackup/2023-02-01/jobdetails/id_backupjob.go @@ -38,23 +38,9 @@ func ParseBackupJobID(input string) (*BackupJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupJobId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupJobName, ok = parsed.Parsed["backupJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupJobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupJobIDInsensitively(input string) (*BackupJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupJobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupJobId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupJobName, ok = parsed.Parsed["backupJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupJobName", *parsed) + if id.BackupJobName, ok = input.Parsed["backupJobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupJobName", input) } - return &id, nil + return nil } // ValidateBackupJobID checks that 'input' can be parsed as a Backup Job ID diff --git a/resource-manager/recoveryservicesbackup/2023-02-01/jobs/id_vault.go b/resource-manager/recoveryservicesbackup/2023-02-01/jobs/id_vault.go index 8d98d6d11a0..e8be0075007 100644 --- a/resource-manager/recoveryservicesbackup/2023-02-01/jobs/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-02-01/jobs/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-02-01/operation/id_vault.go b/resource-manager/recoveryservicesbackup/2023-02-01/operation/id_vault.go index 590d8ef449c..01b645cd807 100644 --- a/resource-manager/recoveryservicesbackup/2023-02-01/operation/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-02-01/operation/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-02-01/privateendpointconnection/id_privateendpointconnection.go b/resource-manager/recoveryservicesbackup/2023-02-01/privateendpointconnection/id_privateendpointconnection.go index 41ac452c47f..e23759094f8 100644 --- a/resource-manager/recoveryservicesbackup/2023-02-01/privateendpointconnection/id_privateendpointconnection.go +++ b/resource-manager/recoveryservicesbackup/2023-02-01/privateendpointconnection/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/recoveryservicesbackup/2023-02-01/protectablecontainers/id_backupfabric.go b/resource-manager/recoveryservicesbackup/2023-02-01/protectablecontainers/id_backupfabric.go index 0f79198981e..b06ebb0ca21 100644 --- a/resource-manager/recoveryservicesbackup/2023-02-01/protectablecontainers/id_backupfabric.go +++ b/resource-manager/recoveryservicesbackup/2023-02-01/protectablecontainers/id_backupfabric.go @@ -38,23 +38,9 @@ func ParseBackupFabricID(input string) (*BackupFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupFabricId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupFabricIDInsensitively(input string) (*BackupFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupFabricId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupFabricId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) + if id.BackupFabricName, ok = input.Parsed["backupFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", input) } - return &id, nil + return nil } // ValidateBackupFabricID checks that 'input' can be parsed as a Backup Fabric ID diff --git a/resource-manager/recoveryservicesbackup/2023-02-01/protecteditems/id_protecteditem.go b/resource-manager/recoveryservicesbackup/2023-02-01/protecteditems/id_protecteditem.go index f3fdb99d86c..e1e53a96b1f 100644 --- a/resource-manager/recoveryservicesbackup/2023-02-01/protecteditems/id_protecteditem.go +++ b/resource-manager/recoveryservicesbackup/2023-02-01/protecteditems/id_protecteditem.go @@ -42,31 +42,9 @@ func ParseProtectedItemID(input string) (*ProtectedItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProtectedItemId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) - } - - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) - } - - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseProtectedItemIDInsensitively(input string) (*ProtectedItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProtectedItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProtectedItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) + if id.BackupFabricName, ok = input.Parsed["backupFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", input) } - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) + if id.ProtectionContainerName, ok = input.Parsed["protectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", input) } - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) + if id.ProtectedItemName, ok = input.Parsed["protectedItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", input) } - return &id, nil + return nil } // ValidateProtectedItemID checks that 'input' can be parsed as a Protected Item ID diff --git a/resource-manager/recoveryservicesbackup/2023-02-01/protectioncontainers/id_backupfabric.go b/resource-manager/recoveryservicesbackup/2023-02-01/protectioncontainers/id_backupfabric.go index f929acd11e9..bcbc1243062 100644 --- a/resource-manager/recoveryservicesbackup/2023-02-01/protectioncontainers/id_backupfabric.go +++ b/resource-manager/recoveryservicesbackup/2023-02-01/protectioncontainers/id_backupfabric.go @@ -38,23 +38,9 @@ func ParseBackupFabricID(input string) (*BackupFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupFabricId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupFabricIDInsensitively(input string) (*BackupFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupFabricId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupFabricId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) + if id.BackupFabricName, ok = input.Parsed["backupFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", input) } - return &id, nil + return nil } // ValidateBackupFabricID checks that 'input' can be parsed as a Backup Fabric ID diff --git a/resource-manager/recoveryservicesbackup/2023-02-01/protectioncontainers/id_protectioncontainer.go b/resource-manager/recoveryservicesbackup/2023-02-01/protectioncontainers/id_protectioncontainer.go index bc3b402d92c..bd6c7e47669 100644 --- a/resource-manager/recoveryservicesbackup/2023-02-01/protectioncontainers/id_protectioncontainer.go +++ b/resource-manager/recoveryservicesbackup/2023-02-01/protectioncontainers/id_protectioncontainer.go @@ -40,27 +40,9 @@ func ParseProtectionContainerID(input string) (*ProtectionContainerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProtectionContainerId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) - } - - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseProtectionContainerIDInsensitively(input string) (*ProtectionContainer return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProtectionContainerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ProtectionContainerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) + if id.BackupFabricName, ok = input.Parsed["backupFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", input) } - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) + if id.ProtectionContainerName, ok = input.Parsed["protectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", input) } - return &id, nil + return nil } // ValidateProtectionContainerID checks that 'input' can be parsed as a Protection Container ID diff --git a/resource-manager/recoveryservicesbackup/2023-02-01/protectionintent/id_backupprotectionintent.go b/resource-manager/recoveryservicesbackup/2023-02-01/protectionintent/id_backupprotectionintent.go index e2861b56756..df0e96c1629 100644 --- a/resource-manager/recoveryservicesbackup/2023-02-01/protectionintent/id_backupprotectionintent.go +++ b/resource-manager/recoveryservicesbackup/2023-02-01/protectionintent/id_backupprotectionintent.go @@ -40,27 +40,9 @@ func ParseBackupProtectionIntentID(input string) (*BackupProtectionIntentId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupProtectionIntentId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) - } - - if id.BackupProtectionIntentName, ok = parsed.Parsed["backupProtectionIntentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupProtectionIntentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseBackupProtectionIntentIDInsensitively(input string) (*BackupProtection return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupProtectionIntentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *BackupProtectionIntentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) + if id.BackupFabricName, ok = input.Parsed["backupFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", input) } - if id.BackupProtectionIntentName, ok = parsed.Parsed["backupProtectionIntentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupProtectionIntentName", *parsed) + if id.BackupProtectionIntentName, ok = input.Parsed["backupProtectionIntentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupProtectionIntentName", input) } - return &id, nil + return nil } // ValidateBackupProtectionIntentID checks that 'input' can be parsed as a Backup Protection Intent ID diff --git a/resource-manager/recoveryservicesbackup/2023-02-01/protectionintent/id_location.go b/resource-manager/recoveryservicesbackup/2023-02-01/protectionintent/id_location.go index f7c66c4ef6c..3268f118478 100644 --- a/resource-manager/recoveryservicesbackup/2023-02-01/protectionintent/id_location.go +++ b/resource-manager/recoveryservicesbackup/2023-02-01/protectionintent/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/recoveryservicesbackup/2023-02-01/protectionpolicies/id_backuppolicy.go b/resource-manager/recoveryservicesbackup/2023-02-01/protectionpolicies/id_backuppolicy.go index 320ce51eb8e..0496c1a87bc 100644 --- a/resource-manager/recoveryservicesbackup/2023-02-01/protectionpolicies/id_backuppolicy.go +++ b/resource-manager/recoveryservicesbackup/2023-02-01/protectionpolicies/id_backuppolicy.go @@ -38,23 +38,9 @@ func ParseBackupPolicyID(input string) (*BackupPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupPolicyId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupPolicyName, ok = parsed.Parsed["backupPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupPolicyIDInsensitively(input string) (*BackupPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupPolicyName, ok = parsed.Parsed["backupPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupPolicyName", *parsed) + if id.BackupPolicyName, ok = input.Parsed["backupPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupPolicyName", input) } - return &id, nil + return nil } // ValidateBackupPolicyID checks that 'input' can be parsed as a Backup Policy ID diff --git a/resource-manager/recoveryservicesbackup/2023-02-01/recoverypoint/id_recoverypoint.go b/resource-manager/recoveryservicesbackup/2023-02-01/recoverypoint/id_recoverypoint.go index 986d9fee91f..aae82eef969 100644 --- a/resource-manager/recoveryservicesbackup/2023-02-01/recoverypoint/id_recoverypoint.go +++ b/resource-manager/recoveryservicesbackup/2023-02-01/recoverypoint/id_recoverypoint.go @@ -44,35 +44,9 @@ func ParseRecoveryPointID(input string) (*RecoveryPointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecoveryPointId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) - } - - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) - } - - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) - } - - if id.RecoveryPointId, ok = parsed.Parsed["recoveryPointId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseRecoveryPointIDInsensitively(input string) (*RecoveryPointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecoveryPointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RecoveryPointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) + if id.BackupFabricName, ok = input.Parsed["backupFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", input) } - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) + if id.ProtectionContainerName, ok = input.Parsed["protectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", input) } - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) + if id.ProtectedItemName, ok = input.Parsed["protectedItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", input) } - if id.RecoveryPointId, ok = parsed.Parsed["recoveryPointId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", *parsed) + if id.RecoveryPointId, ok = input.Parsed["recoveryPointId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", input) } - return &id, nil + return nil } // ValidateRecoveryPointID checks that 'input' can be parsed as a Recovery Point ID diff --git a/resource-manager/recoveryservicesbackup/2023-02-01/recoverypoints/id_protecteditem.go b/resource-manager/recoveryservicesbackup/2023-02-01/recoverypoints/id_protecteditem.go index 8f651e79aec..bdc49794b36 100644 --- a/resource-manager/recoveryservicesbackup/2023-02-01/recoverypoints/id_protecteditem.go +++ b/resource-manager/recoveryservicesbackup/2023-02-01/recoverypoints/id_protecteditem.go @@ -42,31 +42,9 @@ func ParseProtectedItemID(input string) (*ProtectedItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProtectedItemId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) - } - - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) - } - - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseProtectedItemIDInsensitively(input string) (*ProtectedItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProtectedItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProtectedItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) + if id.BackupFabricName, ok = input.Parsed["backupFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", input) } - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) + if id.ProtectionContainerName, ok = input.Parsed["protectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", input) } - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) + if id.ProtectedItemName, ok = input.Parsed["protectedItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", input) } - return &id, nil + return nil } // ValidateProtectedItemID checks that 'input' can be parsed as a Protected Item ID diff --git a/resource-manager/recoveryservicesbackup/2023-02-01/recoverypoints/id_recoverypoint.go b/resource-manager/recoveryservicesbackup/2023-02-01/recoverypoints/id_recoverypoint.go index 9a81b4d7188..fd5dcf42b77 100644 --- a/resource-manager/recoveryservicesbackup/2023-02-01/recoverypoints/id_recoverypoint.go +++ b/resource-manager/recoveryservicesbackup/2023-02-01/recoverypoints/id_recoverypoint.go @@ -44,35 +44,9 @@ func ParseRecoveryPointID(input string) (*RecoveryPointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecoveryPointId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) - } - - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) - } - - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) - } - - if id.RecoveryPointId, ok = parsed.Parsed["recoveryPointId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseRecoveryPointIDInsensitively(input string) (*RecoveryPointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecoveryPointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RecoveryPointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) + if id.BackupFabricName, ok = input.Parsed["backupFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", input) } - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) + if id.ProtectionContainerName, ok = input.Parsed["protectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", input) } - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) + if id.ProtectedItemName, ok = input.Parsed["protectedItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", input) } - if id.RecoveryPointId, ok = parsed.Parsed["recoveryPointId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", *parsed) + if id.RecoveryPointId, ok = input.Parsed["recoveryPointId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", input) } - return &id, nil + return nil } // ValidateRecoveryPointID checks that 'input' can be parsed as a Recovery Point ID diff --git a/resource-manager/recoveryservicesbackup/2023-02-01/recoverypointsrecommendedformove/id_protecteditem.go b/resource-manager/recoveryservicesbackup/2023-02-01/recoverypointsrecommendedformove/id_protecteditem.go index 61c6da6121e..b49a70f3629 100644 --- a/resource-manager/recoveryservicesbackup/2023-02-01/recoverypointsrecommendedformove/id_protecteditem.go +++ b/resource-manager/recoveryservicesbackup/2023-02-01/recoverypointsrecommendedformove/id_protecteditem.go @@ -42,31 +42,9 @@ func ParseProtectedItemID(input string) (*ProtectedItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProtectedItemId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) - } - - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) - } - - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseProtectedItemIDInsensitively(input string) (*ProtectedItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProtectedItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProtectedItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) + if id.BackupFabricName, ok = input.Parsed["backupFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", input) } - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) + if id.ProtectionContainerName, ok = input.Parsed["protectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", input) } - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) + if id.ProtectedItemName, ok = input.Parsed["protectedItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", input) } - return &id, nil + return nil } // ValidateProtectedItemID checks that 'input' can be parsed as a Protected Item ID diff --git a/resource-manager/recoveryservicesbackup/2023-02-01/resourceguardproxies/id_vault.go b/resource-manager/recoveryservicesbackup/2023-02-01/resourceguardproxies/id_vault.go index 93a4a6a0118..57c654c21ed 100644 --- a/resource-manager/recoveryservicesbackup/2023-02-01/resourceguardproxies/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-02-01/resourceguardproxies/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-02-01/resourceguardproxy/id_backupresourceguardproxy.go b/resource-manager/recoveryservicesbackup/2023-02-01/resourceguardproxy/id_backupresourceguardproxy.go index a05bd4a2c99..8fe87a68009 100644 --- a/resource-manager/recoveryservicesbackup/2023-02-01/resourceguardproxy/id_backupresourceguardproxy.go +++ b/resource-manager/recoveryservicesbackup/2023-02-01/resourceguardproxy/id_backupresourceguardproxy.go @@ -38,23 +38,9 @@ func ParseBackupResourceGuardProxyID(input string) (*BackupResourceGuardProxyId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupResourceGuardProxyId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupResourceGuardProxyName, ok = parsed.Parsed["backupResourceGuardProxyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupResourceGuardProxyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupResourceGuardProxyIDInsensitively(input string) (*BackupResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupResourceGuardProxyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupResourceGuardProxyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupResourceGuardProxyName, ok = parsed.Parsed["backupResourceGuardProxyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupResourceGuardProxyName", *parsed) + if id.BackupResourceGuardProxyName, ok = input.Parsed["backupResourceGuardProxyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupResourceGuardProxyName", input) } - return &id, nil + return nil } // ValidateBackupResourceGuardProxyID checks that 'input' can be parsed as a Backup Resource Guard Proxy ID diff --git a/resource-manager/recoveryservicesbackup/2023-02-01/restores/id_recoverypoint.go b/resource-manager/recoveryservicesbackup/2023-02-01/restores/id_recoverypoint.go index 46892f79641..847037510cb 100644 --- a/resource-manager/recoveryservicesbackup/2023-02-01/restores/id_recoverypoint.go +++ b/resource-manager/recoveryservicesbackup/2023-02-01/restores/id_recoverypoint.go @@ -44,35 +44,9 @@ func ParseRecoveryPointID(input string) (*RecoveryPointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecoveryPointId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) - } - - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) - } - - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) - } - - if id.RecoveryPointId, ok = parsed.Parsed["recoveryPointId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseRecoveryPointIDInsensitively(input string) (*RecoveryPointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecoveryPointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RecoveryPointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) + if id.BackupFabricName, ok = input.Parsed["backupFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", input) } - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) + if id.ProtectionContainerName, ok = input.Parsed["protectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", input) } - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) + if id.ProtectedItemName, ok = input.Parsed["protectedItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", input) } - if id.RecoveryPointId, ok = parsed.Parsed["recoveryPointId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", *parsed) + if id.RecoveryPointId, ok = input.Parsed["recoveryPointId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", input) } - return &id, nil + return nil } // ValidateRecoveryPointID checks that 'input' can be parsed as a Recovery Point ID diff --git a/resource-manager/recoveryservicesbackup/2023-02-01/securitypins/id_vault.go b/resource-manager/recoveryservicesbackup/2023-02-01/securitypins/id_vault.go index e4eae70fc2e..e7f79031e1e 100644 --- a/resource-manager/recoveryservicesbackup/2023-02-01/securitypins/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-02-01/securitypins/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-02-01/softdeletedcontainers/id_vault.go b/resource-manager/recoveryservicesbackup/2023-02-01/softdeletedcontainers/id_vault.go index 0e3711018d2..0e6d740d3e4 100644 --- a/resource-manager/recoveryservicesbackup/2023-02-01/softdeletedcontainers/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-02-01/softdeletedcontainers/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-02-01/validateoperation/id_vault.go b/resource-manager/recoveryservicesbackup/2023-02-01/validateoperation/id_vault.go index a9af720921b..975bf3188c2 100644 --- a/resource-manager/recoveryservicesbackup/2023-02-01/validateoperation/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-02-01/validateoperation/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-04-01/backupengines/id_backupengine.go b/resource-manager/recoveryservicesbackup/2023-04-01/backupengines/id_backupengine.go index c954a9d2d82..25df491f17f 100644 --- a/resource-manager/recoveryservicesbackup/2023-04-01/backupengines/id_backupengine.go +++ b/resource-manager/recoveryservicesbackup/2023-04-01/backupengines/id_backupengine.go @@ -38,23 +38,9 @@ func ParseBackupEngineID(input string) (*BackupEngineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupEngineId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupEngineName, ok = parsed.Parsed["backupEngineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupEngineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupEngineIDInsensitively(input string) (*BackupEngineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupEngineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupEngineId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupEngineName, ok = parsed.Parsed["backupEngineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupEngineName", *parsed) + if id.BackupEngineName, ok = input.Parsed["backupEngineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupEngineName", input) } - return &id, nil + return nil } // ValidateBackupEngineID checks that 'input' can be parsed as a Backup Engine ID diff --git a/resource-manager/recoveryservicesbackup/2023-04-01/backupengines/id_vault.go b/resource-manager/recoveryservicesbackup/2023-04-01/backupengines/id_vault.go index 6a3e4a29fb9..ce1dc1fecf2 100644 --- a/resource-manager/recoveryservicesbackup/2023-04-01/backupengines/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-04-01/backupengines/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-04-01/backupjobs/id_vault.go b/resource-manager/recoveryservicesbackup/2023-04-01/backupjobs/id_vault.go index 92bf7396d77..cdc8297c734 100644 --- a/resource-manager/recoveryservicesbackup/2023-04-01/backupjobs/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-04-01/backupjobs/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-04-01/backuppolicies/id_vault.go b/resource-manager/recoveryservicesbackup/2023-04-01/backuppolicies/id_vault.go index 58359bb7145..5ba22360b54 100644 --- a/resource-manager/recoveryservicesbackup/2023-04-01/backuppolicies/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-04-01/backuppolicies/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-04-01/backupprotectableitems/id_vault.go b/resource-manager/recoveryservicesbackup/2023-04-01/backupprotectableitems/id_vault.go index ff2ce757403..634cfb3c0cd 100644 --- a/resource-manager/recoveryservicesbackup/2023-04-01/backupprotectableitems/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-04-01/backupprotectableitems/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-04-01/backupprotecteditems/id_vault.go b/resource-manager/recoveryservicesbackup/2023-04-01/backupprotecteditems/id_vault.go index c573dda4a65..f05c3b2777b 100644 --- a/resource-manager/recoveryservicesbackup/2023-04-01/backupprotecteditems/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-04-01/backupprotecteditems/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-04-01/backupprotectioncontainers/id_vault.go b/resource-manager/recoveryservicesbackup/2023-04-01/backupprotectioncontainers/id_vault.go index 997a5877d26..068ddce6bb5 100644 --- a/resource-manager/recoveryservicesbackup/2023-04-01/backupprotectioncontainers/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-04-01/backupprotectioncontainers/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-04-01/backupprotectionintent/id_vault.go b/resource-manager/recoveryservicesbackup/2023-04-01/backupprotectionintent/id_vault.go index b610d60c296..453d39583f5 100644 --- a/resource-manager/recoveryservicesbackup/2023-04-01/backupprotectionintent/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-04-01/backupprotectionintent/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-04-01/backupresourceencryptionconfigs/id_vault.go b/resource-manager/recoveryservicesbackup/2023-04-01/backupresourceencryptionconfigs/id_vault.go index d004887f441..7e698320c88 100644 --- a/resource-manager/recoveryservicesbackup/2023-04-01/backupresourceencryptionconfigs/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-04-01/backupresourceencryptionconfigs/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-04-01/backupresourcestorageconfigsnoncrr/id_vault.go b/resource-manager/recoveryservicesbackup/2023-04-01/backupresourcestorageconfigsnoncrr/id_vault.go index 2340c563656..c6bd079c196 100644 --- a/resource-manager/recoveryservicesbackup/2023-04-01/backupresourcestorageconfigsnoncrr/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-04-01/backupresourcestorageconfigsnoncrr/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-04-01/backupresourcevaultconfigs/id_vault.go b/resource-manager/recoveryservicesbackup/2023-04-01/backupresourcevaultconfigs/id_vault.go index 090ed67cb89..9e57d094359 100644 --- a/resource-manager/recoveryservicesbackup/2023-04-01/backupresourcevaultconfigs/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-04-01/backupresourcevaultconfigs/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-04-01/backups/id_protecteditem.go b/resource-manager/recoveryservicesbackup/2023-04-01/backups/id_protecteditem.go index 65a5e4d7514..b255fd16031 100644 --- a/resource-manager/recoveryservicesbackup/2023-04-01/backups/id_protecteditem.go +++ b/resource-manager/recoveryservicesbackup/2023-04-01/backups/id_protecteditem.go @@ -42,31 +42,9 @@ func ParseProtectedItemID(input string) (*ProtectedItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProtectedItemId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) - } - - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) - } - - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseProtectedItemIDInsensitively(input string) (*ProtectedItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProtectedItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProtectedItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) + if id.BackupFabricName, ok = input.Parsed["backupFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", input) } - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) + if id.ProtectionContainerName, ok = input.Parsed["protectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", input) } - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) + if id.ProtectedItemName, ok = input.Parsed["protectedItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", input) } - return &id, nil + return nil } // ValidateProtectedItemID checks that 'input' can be parsed as a Protected Item ID diff --git a/resource-manager/recoveryservicesbackup/2023-04-01/backupstatus/id_location.go b/resource-manager/recoveryservicesbackup/2023-04-01/backupstatus/id_location.go index 605da007f6f..2b1818689d8 100644 --- a/resource-manager/recoveryservicesbackup/2023-04-01/backupstatus/id_location.go +++ b/resource-manager/recoveryservicesbackup/2023-04-01/backupstatus/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/recoveryservicesbackup/2023-04-01/backupusagesummaries/id_vault.go b/resource-manager/recoveryservicesbackup/2023-04-01/backupusagesummaries/id_vault.go index 881af1e9703..6286b131a96 100644 --- a/resource-manager/recoveryservicesbackup/2023-04-01/backupusagesummaries/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-04-01/backupusagesummaries/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-04-01/backupworkloaditems/id_protectioncontainer.go b/resource-manager/recoveryservicesbackup/2023-04-01/backupworkloaditems/id_protectioncontainer.go index 252e675a1cd..5aabe5a9849 100644 --- a/resource-manager/recoveryservicesbackup/2023-04-01/backupworkloaditems/id_protectioncontainer.go +++ b/resource-manager/recoveryservicesbackup/2023-04-01/backupworkloaditems/id_protectioncontainer.go @@ -40,27 +40,9 @@ func ParseProtectionContainerID(input string) (*ProtectionContainerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProtectionContainerId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) - } - - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseProtectionContainerIDInsensitively(input string) (*ProtectionContainer return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProtectionContainerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ProtectionContainerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) + if id.BackupFabricName, ok = input.Parsed["backupFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", input) } - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) + if id.ProtectionContainerName, ok = input.Parsed["protectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", input) } - return &id, nil + return nil } // ValidateProtectionContainerID checks that 'input' can be parsed as a Protection Container ID diff --git a/resource-manager/recoveryservicesbackup/2023-04-01/datamove/id_vault.go b/resource-manager/recoveryservicesbackup/2023-04-01/datamove/id_vault.go index 3018d3e13af..7d274d08b54 100644 --- a/resource-manager/recoveryservicesbackup/2023-04-01/datamove/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-04-01/datamove/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-04-01/featuresupport/id_location.go b/resource-manager/recoveryservicesbackup/2023-04-01/featuresupport/id_location.go index b614b25be9e..43fe026a3f5 100644 --- a/resource-manager/recoveryservicesbackup/2023-04-01/featuresupport/id_location.go +++ b/resource-manager/recoveryservicesbackup/2023-04-01/featuresupport/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/recoveryservicesbackup/2023-04-01/itemlevelrecoveryconnections/id_recoverypoint.go b/resource-manager/recoveryservicesbackup/2023-04-01/itemlevelrecoveryconnections/id_recoverypoint.go index b578a390b56..23b6991307f 100644 --- a/resource-manager/recoveryservicesbackup/2023-04-01/itemlevelrecoveryconnections/id_recoverypoint.go +++ b/resource-manager/recoveryservicesbackup/2023-04-01/itemlevelrecoveryconnections/id_recoverypoint.go @@ -44,35 +44,9 @@ func ParseRecoveryPointID(input string) (*RecoveryPointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecoveryPointId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) - } - - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) - } - - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) - } - - if id.RecoveryPointId, ok = parsed.Parsed["recoveryPointId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseRecoveryPointIDInsensitively(input string) (*RecoveryPointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecoveryPointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RecoveryPointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) + if id.BackupFabricName, ok = input.Parsed["backupFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", input) } - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) + if id.ProtectionContainerName, ok = input.Parsed["protectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", input) } - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) + if id.ProtectedItemName, ok = input.Parsed["protectedItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", input) } - if id.RecoveryPointId, ok = parsed.Parsed["recoveryPointId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", *parsed) + if id.RecoveryPointId, ok = input.Parsed["recoveryPointId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", input) } - return &id, nil + return nil } // ValidateRecoveryPointID checks that 'input' can be parsed as a Recovery Point ID diff --git a/resource-manager/recoveryservicesbackup/2023-04-01/jobcancellations/id_backupjob.go b/resource-manager/recoveryservicesbackup/2023-04-01/jobcancellations/id_backupjob.go index dec2d00dccb..b653abc82d6 100644 --- a/resource-manager/recoveryservicesbackup/2023-04-01/jobcancellations/id_backupjob.go +++ b/resource-manager/recoveryservicesbackup/2023-04-01/jobcancellations/id_backupjob.go @@ -38,23 +38,9 @@ func ParseBackupJobID(input string) (*BackupJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupJobId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupJobName, ok = parsed.Parsed["backupJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupJobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupJobIDInsensitively(input string) (*BackupJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupJobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupJobId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupJobName, ok = parsed.Parsed["backupJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupJobName", *parsed) + if id.BackupJobName, ok = input.Parsed["backupJobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupJobName", input) } - return &id, nil + return nil } // ValidateBackupJobID checks that 'input' can be parsed as a Backup Job ID diff --git a/resource-manager/recoveryservicesbackup/2023-04-01/jobdetails/id_backupjob.go b/resource-manager/recoveryservicesbackup/2023-04-01/jobdetails/id_backupjob.go index daa9077226b..efd53b158d1 100644 --- a/resource-manager/recoveryservicesbackup/2023-04-01/jobdetails/id_backupjob.go +++ b/resource-manager/recoveryservicesbackup/2023-04-01/jobdetails/id_backupjob.go @@ -38,23 +38,9 @@ func ParseBackupJobID(input string) (*BackupJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupJobId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupJobName, ok = parsed.Parsed["backupJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupJobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupJobIDInsensitively(input string) (*BackupJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupJobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupJobId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupJobName, ok = parsed.Parsed["backupJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupJobName", *parsed) + if id.BackupJobName, ok = input.Parsed["backupJobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupJobName", input) } - return &id, nil + return nil } // ValidateBackupJobID checks that 'input' can be parsed as a Backup Job ID diff --git a/resource-manager/recoveryservicesbackup/2023-04-01/jobs/id_vault.go b/resource-manager/recoveryservicesbackup/2023-04-01/jobs/id_vault.go index 8d98d6d11a0..e8be0075007 100644 --- a/resource-manager/recoveryservicesbackup/2023-04-01/jobs/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-04-01/jobs/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-04-01/operation/id_vault.go b/resource-manager/recoveryservicesbackup/2023-04-01/operation/id_vault.go index 590d8ef449c..01b645cd807 100644 --- a/resource-manager/recoveryservicesbackup/2023-04-01/operation/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-04-01/operation/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-04-01/privateendpointconnection/id_privateendpointconnection.go b/resource-manager/recoveryservicesbackup/2023-04-01/privateendpointconnection/id_privateendpointconnection.go index 41ac452c47f..e23759094f8 100644 --- a/resource-manager/recoveryservicesbackup/2023-04-01/privateendpointconnection/id_privateendpointconnection.go +++ b/resource-manager/recoveryservicesbackup/2023-04-01/privateendpointconnection/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/recoveryservicesbackup/2023-04-01/protectablecontainers/id_backupfabric.go b/resource-manager/recoveryservicesbackup/2023-04-01/protectablecontainers/id_backupfabric.go index 0f79198981e..b06ebb0ca21 100644 --- a/resource-manager/recoveryservicesbackup/2023-04-01/protectablecontainers/id_backupfabric.go +++ b/resource-manager/recoveryservicesbackup/2023-04-01/protectablecontainers/id_backupfabric.go @@ -38,23 +38,9 @@ func ParseBackupFabricID(input string) (*BackupFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupFabricId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupFabricIDInsensitively(input string) (*BackupFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupFabricId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupFabricId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) + if id.BackupFabricName, ok = input.Parsed["backupFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", input) } - return &id, nil + return nil } // ValidateBackupFabricID checks that 'input' can be parsed as a Backup Fabric ID diff --git a/resource-manager/recoveryservicesbackup/2023-04-01/protecteditems/id_protecteditem.go b/resource-manager/recoveryservicesbackup/2023-04-01/protecteditems/id_protecteditem.go index f3fdb99d86c..e1e53a96b1f 100644 --- a/resource-manager/recoveryservicesbackup/2023-04-01/protecteditems/id_protecteditem.go +++ b/resource-manager/recoveryservicesbackup/2023-04-01/protecteditems/id_protecteditem.go @@ -42,31 +42,9 @@ func ParseProtectedItemID(input string) (*ProtectedItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProtectedItemId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) - } - - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) - } - - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseProtectedItemIDInsensitively(input string) (*ProtectedItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProtectedItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProtectedItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) + if id.BackupFabricName, ok = input.Parsed["backupFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", input) } - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) + if id.ProtectionContainerName, ok = input.Parsed["protectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", input) } - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) + if id.ProtectedItemName, ok = input.Parsed["protectedItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", input) } - return &id, nil + return nil } // ValidateProtectedItemID checks that 'input' can be parsed as a Protected Item ID diff --git a/resource-manager/recoveryservicesbackup/2023-04-01/protectioncontainers/id_backupfabric.go b/resource-manager/recoveryservicesbackup/2023-04-01/protectioncontainers/id_backupfabric.go index f929acd11e9..bcbc1243062 100644 --- a/resource-manager/recoveryservicesbackup/2023-04-01/protectioncontainers/id_backupfabric.go +++ b/resource-manager/recoveryservicesbackup/2023-04-01/protectioncontainers/id_backupfabric.go @@ -38,23 +38,9 @@ func ParseBackupFabricID(input string) (*BackupFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupFabricId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupFabricIDInsensitively(input string) (*BackupFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupFabricId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupFabricId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) + if id.BackupFabricName, ok = input.Parsed["backupFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", input) } - return &id, nil + return nil } // ValidateBackupFabricID checks that 'input' can be parsed as a Backup Fabric ID diff --git a/resource-manager/recoveryservicesbackup/2023-04-01/protectioncontainers/id_protectioncontainer.go b/resource-manager/recoveryservicesbackup/2023-04-01/protectioncontainers/id_protectioncontainer.go index bc3b402d92c..bd6c7e47669 100644 --- a/resource-manager/recoveryservicesbackup/2023-04-01/protectioncontainers/id_protectioncontainer.go +++ b/resource-manager/recoveryservicesbackup/2023-04-01/protectioncontainers/id_protectioncontainer.go @@ -40,27 +40,9 @@ func ParseProtectionContainerID(input string) (*ProtectionContainerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProtectionContainerId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) - } - - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseProtectionContainerIDInsensitively(input string) (*ProtectionContainer return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProtectionContainerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ProtectionContainerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) + if id.BackupFabricName, ok = input.Parsed["backupFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", input) } - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) + if id.ProtectionContainerName, ok = input.Parsed["protectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", input) } - return &id, nil + return nil } // ValidateProtectionContainerID checks that 'input' can be parsed as a Protection Container ID diff --git a/resource-manager/recoveryservicesbackup/2023-04-01/protectionintent/id_backupprotectionintent.go b/resource-manager/recoveryservicesbackup/2023-04-01/protectionintent/id_backupprotectionintent.go index e2861b56756..df0e96c1629 100644 --- a/resource-manager/recoveryservicesbackup/2023-04-01/protectionintent/id_backupprotectionintent.go +++ b/resource-manager/recoveryservicesbackup/2023-04-01/protectionintent/id_backupprotectionintent.go @@ -40,27 +40,9 @@ func ParseBackupProtectionIntentID(input string) (*BackupProtectionIntentId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupProtectionIntentId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) - } - - if id.BackupProtectionIntentName, ok = parsed.Parsed["backupProtectionIntentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupProtectionIntentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseBackupProtectionIntentIDInsensitively(input string) (*BackupProtection return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupProtectionIntentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *BackupProtectionIntentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) + if id.BackupFabricName, ok = input.Parsed["backupFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", input) } - if id.BackupProtectionIntentName, ok = parsed.Parsed["backupProtectionIntentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupProtectionIntentName", *parsed) + if id.BackupProtectionIntentName, ok = input.Parsed["backupProtectionIntentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupProtectionIntentName", input) } - return &id, nil + return nil } // ValidateBackupProtectionIntentID checks that 'input' can be parsed as a Backup Protection Intent ID diff --git a/resource-manager/recoveryservicesbackup/2023-04-01/protectionintent/id_location.go b/resource-manager/recoveryservicesbackup/2023-04-01/protectionintent/id_location.go index f7c66c4ef6c..3268f118478 100644 --- a/resource-manager/recoveryservicesbackup/2023-04-01/protectionintent/id_location.go +++ b/resource-manager/recoveryservicesbackup/2023-04-01/protectionintent/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/recoveryservicesbackup/2023-04-01/protectionpolicies/id_backuppolicy.go b/resource-manager/recoveryservicesbackup/2023-04-01/protectionpolicies/id_backuppolicy.go index 320ce51eb8e..0496c1a87bc 100644 --- a/resource-manager/recoveryservicesbackup/2023-04-01/protectionpolicies/id_backuppolicy.go +++ b/resource-manager/recoveryservicesbackup/2023-04-01/protectionpolicies/id_backuppolicy.go @@ -38,23 +38,9 @@ func ParseBackupPolicyID(input string) (*BackupPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupPolicyId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupPolicyName, ok = parsed.Parsed["backupPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupPolicyIDInsensitively(input string) (*BackupPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupPolicyName, ok = parsed.Parsed["backupPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupPolicyName", *parsed) + if id.BackupPolicyName, ok = input.Parsed["backupPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupPolicyName", input) } - return &id, nil + return nil } // ValidateBackupPolicyID checks that 'input' can be parsed as a Backup Policy ID diff --git a/resource-manager/recoveryservicesbackup/2023-04-01/recoverypoint/id_recoverypoint.go b/resource-manager/recoveryservicesbackup/2023-04-01/recoverypoint/id_recoverypoint.go index 986d9fee91f..aae82eef969 100644 --- a/resource-manager/recoveryservicesbackup/2023-04-01/recoverypoint/id_recoverypoint.go +++ b/resource-manager/recoveryservicesbackup/2023-04-01/recoverypoint/id_recoverypoint.go @@ -44,35 +44,9 @@ func ParseRecoveryPointID(input string) (*RecoveryPointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecoveryPointId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) - } - - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) - } - - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) - } - - if id.RecoveryPointId, ok = parsed.Parsed["recoveryPointId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseRecoveryPointIDInsensitively(input string) (*RecoveryPointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecoveryPointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RecoveryPointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) + if id.BackupFabricName, ok = input.Parsed["backupFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", input) } - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) + if id.ProtectionContainerName, ok = input.Parsed["protectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", input) } - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) + if id.ProtectedItemName, ok = input.Parsed["protectedItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", input) } - if id.RecoveryPointId, ok = parsed.Parsed["recoveryPointId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", *parsed) + if id.RecoveryPointId, ok = input.Parsed["recoveryPointId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", input) } - return &id, nil + return nil } // ValidateRecoveryPointID checks that 'input' can be parsed as a Recovery Point ID diff --git a/resource-manager/recoveryservicesbackup/2023-04-01/recoverypoints/id_protecteditem.go b/resource-manager/recoveryservicesbackup/2023-04-01/recoverypoints/id_protecteditem.go index 8f651e79aec..bdc49794b36 100644 --- a/resource-manager/recoveryservicesbackup/2023-04-01/recoverypoints/id_protecteditem.go +++ b/resource-manager/recoveryservicesbackup/2023-04-01/recoverypoints/id_protecteditem.go @@ -42,31 +42,9 @@ func ParseProtectedItemID(input string) (*ProtectedItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProtectedItemId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) - } - - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) - } - - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseProtectedItemIDInsensitively(input string) (*ProtectedItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProtectedItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProtectedItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) + if id.BackupFabricName, ok = input.Parsed["backupFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", input) } - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) + if id.ProtectionContainerName, ok = input.Parsed["protectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", input) } - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) + if id.ProtectedItemName, ok = input.Parsed["protectedItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", input) } - return &id, nil + return nil } // ValidateProtectedItemID checks that 'input' can be parsed as a Protected Item ID diff --git a/resource-manager/recoveryservicesbackup/2023-04-01/recoverypoints/id_recoverypoint.go b/resource-manager/recoveryservicesbackup/2023-04-01/recoverypoints/id_recoverypoint.go index 9a81b4d7188..fd5dcf42b77 100644 --- a/resource-manager/recoveryservicesbackup/2023-04-01/recoverypoints/id_recoverypoint.go +++ b/resource-manager/recoveryservicesbackup/2023-04-01/recoverypoints/id_recoverypoint.go @@ -44,35 +44,9 @@ func ParseRecoveryPointID(input string) (*RecoveryPointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecoveryPointId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) - } - - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) - } - - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) - } - - if id.RecoveryPointId, ok = parsed.Parsed["recoveryPointId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseRecoveryPointIDInsensitively(input string) (*RecoveryPointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecoveryPointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RecoveryPointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) + if id.BackupFabricName, ok = input.Parsed["backupFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", input) } - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) + if id.ProtectionContainerName, ok = input.Parsed["protectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", input) } - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) + if id.ProtectedItemName, ok = input.Parsed["protectedItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", input) } - if id.RecoveryPointId, ok = parsed.Parsed["recoveryPointId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", *parsed) + if id.RecoveryPointId, ok = input.Parsed["recoveryPointId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", input) } - return &id, nil + return nil } // ValidateRecoveryPointID checks that 'input' can be parsed as a Recovery Point ID diff --git a/resource-manager/recoveryservicesbackup/2023-04-01/recoverypointsrecommendedformove/id_protecteditem.go b/resource-manager/recoveryservicesbackup/2023-04-01/recoverypointsrecommendedformove/id_protecteditem.go index 61c6da6121e..b49a70f3629 100644 --- a/resource-manager/recoveryservicesbackup/2023-04-01/recoverypointsrecommendedformove/id_protecteditem.go +++ b/resource-manager/recoveryservicesbackup/2023-04-01/recoverypointsrecommendedformove/id_protecteditem.go @@ -42,31 +42,9 @@ func ParseProtectedItemID(input string) (*ProtectedItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProtectedItemId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) - } - - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) - } - - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseProtectedItemIDInsensitively(input string) (*ProtectedItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProtectedItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProtectedItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) + if id.BackupFabricName, ok = input.Parsed["backupFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", input) } - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) + if id.ProtectionContainerName, ok = input.Parsed["protectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", input) } - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) + if id.ProtectedItemName, ok = input.Parsed["protectedItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", input) } - return &id, nil + return nil } // ValidateProtectedItemID checks that 'input' can be parsed as a Protected Item ID diff --git a/resource-manager/recoveryservicesbackup/2023-04-01/resourceguardproxies/id_vault.go b/resource-manager/recoveryservicesbackup/2023-04-01/resourceguardproxies/id_vault.go index 93a4a6a0118..57c654c21ed 100644 --- a/resource-manager/recoveryservicesbackup/2023-04-01/resourceguardproxies/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-04-01/resourceguardproxies/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-04-01/resourceguardproxy/id_backupresourceguardproxy.go b/resource-manager/recoveryservicesbackup/2023-04-01/resourceguardproxy/id_backupresourceguardproxy.go index a05bd4a2c99..8fe87a68009 100644 --- a/resource-manager/recoveryservicesbackup/2023-04-01/resourceguardproxy/id_backupresourceguardproxy.go +++ b/resource-manager/recoveryservicesbackup/2023-04-01/resourceguardproxy/id_backupresourceguardproxy.go @@ -38,23 +38,9 @@ func ParseBackupResourceGuardProxyID(input string) (*BackupResourceGuardProxyId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupResourceGuardProxyId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupResourceGuardProxyName, ok = parsed.Parsed["backupResourceGuardProxyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupResourceGuardProxyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupResourceGuardProxyIDInsensitively(input string) (*BackupResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupResourceGuardProxyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupResourceGuardProxyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupResourceGuardProxyName, ok = parsed.Parsed["backupResourceGuardProxyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupResourceGuardProxyName", *parsed) + if id.BackupResourceGuardProxyName, ok = input.Parsed["backupResourceGuardProxyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupResourceGuardProxyName", input) } - return &id, nil + return nil } // ValidateBackupResourceGuardProxyID checks that 'input' can be parsed as a Backup Resource Guard Proxy ID diff --git a/resource-manager/recoveryservicesbackup/2023-04-01/restores/id_recoverypoint.go b/resource-manager/recoveryservicesbackup/2023-04-01/restores/id_recoverypoint.go index 46892f79641..847037510cb 100644 --- a/resource-manager/recoveryservicesbackup/2023-04-01/restores/id_recoverypoint.go +++ b/resource-manager/recoveryservicesbackup/2023-04-01/restores/id_recoverypoint.go @@ -44,35 +44,9 @@ func ParseRecoveryPointID(input string) (*RecoveryPointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecoveryPointId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) - } - - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) - } - - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) - } - - if id.RecoveryPointId, ok = parsed.Parsed["recoveryPointId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseRecoveryPointIDInsensitively(input string) (*RecoveryPointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecoveryPointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RecoveryPointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) + if id.BackupFabricName, ok = input.Parsed["backupFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", input) } - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) + if id.ProtectionContainerName, ok = input.Parsed["protectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", input) } - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) + if id.ProtectedItemName, ok = input.Parsed["protectedItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", input) } - if id.RecoveryPointId, ok = parsed.Parsed["recoveryPointId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", *parsed) + if id.RecoveryPointId, ok = input.Parsed["recoveryPointId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", input) } - return &id, nil + return nil } // ValidateRecoveryPointID checks that 'input' can be parsed as a Recovery Point ID diff --git a/resource-manager/recoveryservicesbackup/2023-04-01/securitypins/id_vault.go b/resource-manager/recoveryservicesbackup/2023-04-01/securitypins/id_vault.go index e4eae70fc2e..e7f79031e1e 100644 --- a/resource-manager/recoveryservicesbackup/2023-04-01/securitypins/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-04-01/securitypins/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-04-01/softdeletedcontainers/id_vault.go b/resource-manager/recoveryservicesbackup/2023-04-01/softdeletedcontainers/id_vault.go index 0e3711018d2..0e6d740d3e4 100644 --- a/resource-manager/recoveryservicesbackup/2023-04-01/softdeletedcontainers/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-04-01/softdeletedcontainers/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-04-01/validateoperation/id_vault.go b/resource-manager/recoveryservicesbackup/2023-04-01/validateoperation/id_vault.go index a9af720921b..975bf3188c2 100644 --- a/resource-manager/recoveryservicesbackup/2023-04-01/validateoperation/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-04-01/validateoperation/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-06-01/backupengines/id_backupengine.go b/resource-manager/recoveryservicesbackup/2023-06-01/backupengines/id_backupengine.go index c954a9d2d82..25df491f17f 100644 --- a/resource-manager/recoveryservicesbackup/2023-06-01/backupengines/id_backupengine.go +++ b/resource-manager/recoveryservicesbackup/2023-06-01/backupengines/id_backupengine.go @@ -38,23 +38,9 @@ func ParseBackupEngineID(input string) (*BackupEngineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupEngineId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupEngineName, ok = parsed.Parsed["backupEngineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupEngineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupEngineIDInsensitively(input string) (*BackupEngineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupEngineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupEngineId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupEngineName, ok = parsed.Parsed["backupEngineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupEngineName", *parsed) + if id.BackupEngineName, ok = input.Parsed["backupEngineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupEngineName", input) } - return &id, nil + return nil } // ValidateBackupEngineID checks that 'input' can be parsed as a Backup Engine ID diff --git a/resource-manager/recoveryservicesbackup/2023-06-01/backupengines/id_vault.go b/resource-manager/recoveryservicesbackup/2023-06-01/backupengines/id_vault.go index 6a3e4a29fb9..ce1dc1fecf2 100644 --- a/resource-manager/recoveryservicesbackup/2023-06-01/backupengines/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-06-01/backupengines/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-06-01/backupjobs/id_vault.go b/resource-manager/recoveryservicesbackup/2023-06-01/backupjobs/id_vault.go index 92bf7396d77..cdc8297c734 100644 --- a/resource-manager/recoveryservicesbackup/2023-06-01/backupjobs/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-06-01/backupjobs/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-06-01/backuppolicies/id_vault.go b/resource-manager/recoveryservicesbackup/2023-06-01/backuppolicies/id_vault.go index 58359bb7145..5ba22360b54 100644 --- a/resource-manager/recoveryservicesbackup/2023-06-01/backuppolicies/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-06-01/backuppolicies/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-06-01/backupprotectableitems/id_vault.go b/resource-manager/recoveryservicesbackup/2023-06-01/backupprotectableitems/id_vault.go index ff2ce757403..634cfb3c0cd 100644 --- a/resource-manager/recoveryservicesbackup/2023-06-01/backupprotectableitems/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-06-01/backupprotectableitems/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-06-01/backupprotecteditems/id_vault.go b/resource-manager/recoveryservicesbackup/2023-06-01/backupprotecteditems/id_vault.go index c573dda4a65..f05c3b2777b 100644 --- a/resource-manager/recoveryservicesbackup/2023-06-01/backupprotecteditems/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-06-01/backupprotecteditems/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-06-01/backupprotectioncontainers/id_vault.go b/resource-manager/recoveryservicesbackup/2023-06-01/backupprotectioncontainers/id_vault.go index 997a5877d26..068ddce6bb5 100644 --- a/resource-manager/recoveryservicesbackup/2023-06-01/backupprotectioncontainers/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-06-01/backupprotectioncontainers/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-06-01/backupprotectionintent/id_vault.go b/resource-manager/recoveryservicesbackup/2023-06-01/backupprotectionintent/id_vault.go index b610d60c296..453d39583f5 100644 --- a/resource-manager/recoveryservicesbackup/2023-06-01/backupprotectionintent/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-06-01/backupprotectionintent/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-06-01/backupresourceencryptionconfigs/id_vault.go b/resource-manager/recoveryservicesbackup/2023-06-01/backupresourceencryptionconfigs/id_vault.go index d004887f441..7e698320c88 100644 --- a/resource-manager/recoveryservicesbackup/2023-06-01/backupresourceencryptionconfigs/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-06-01/backupresourceencryptionconfigs/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-06-01/backupresourcestorageconfigsnoncrr/id_vault.go b/resource-manager/recoveryservicesbackup/2023-06-01/backupresourcestorageconfigsnoncrr/id_vault.go index 2340c563656..c6bd079c196 100644 --- a/resource-manager/recoveryservicesbackup/2023-06-01/backupresourcestorageconfigsnoncrr/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-06-01/backupresourcestorageconfigsnoncrr/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-06-01/backupresourcevaultconfigs/id_vault.go b/resource-manager/recoveryservicesbackup/2023-06-01/backupresourcevaultconfigs/id_vault.go index 090ed67cb89..9e57d094359 100644 --- a/resource-manager/recoveryservicesbackup/2023-06-01/backupresourcevaultconfigs/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-06-01/backupresourcevaultconfigs/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-06-01/backups/id_protecteditem.go b/resource-manager/recoveryservicesbackup/2023-06-01/backups/id_protecteditem.go index 65a5e4d7514..b255fd16031 100644 --- a/resource-manager/recoveryservicesbackup/2023-06-01/backups/id_protecteditem.go +++ b/resource-manager/recoveryservicesbackup/2023-06-01/backups/id_protecteditem.go @@ -42,31 +42,9 @@ func ParseProtectedItemID(input string) (*ProtectedItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProtectedItemId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) - } - - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) - } - - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseProtectedItemIDInsensitively(input string) (*ProtectedItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProtectedItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProtectedItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) + if id.BackupFabricName, ok = input.Parsed["backupFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", input) } - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) + if id.ProtectionContainerName, ok = input.Parsed["protectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", input) } - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) + if id.ProtectedItemName, ok = input.Parsed["protectedItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", input) } - return &id, nil + return nil } // ValidateProtectedItemID checks that 'input' can be parsed as a Protected Item ID diff --git a/resource-manager/recoveryservicesbackup/2023-06-01/backupstatus/id_location.go b/resource-manager/recoveryservicesbackup/2023-06-01/backupstatus/id_location.go index 605da007f6f..2b1818689d8 100644 --- a/resource-manager/recoveryservicesbackup/2023-06-01/backupstatus/id_location.go +++ b/resource-manager/recoveryservicesbackup/2023-06-01/backupstatus/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/recoveryservicesbackup/2023-06-01/backupusagesummaries/id_vault.go b/resource-manager/recoveryservicesbackup/2023-06-01/backupusagesummaries/id_vault.go index 881af1e9703..6286b131a96 100644 --- a/resource-manager/recoveryservicesbackup/2023-06-01/backupusagesummaries/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-06-01/backupusagesummaries/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-06-01/backupworkloaditems/id_protectioncontainer.go b/resource-manager/recoveryservicesbackup/2023-06-01/backupworkloaditems/id_protectioncontainer.go index 252e675a1cd..5aabe5a9849 100644 --- a/resource-manager/recoveryservicesbackup/2023-06-01/backupworkloaditems/id_protectioncontainer.go +++ b/resource-manager/recoveryservicesbackup/2023-06-01/backupworkloaditems/id_protectioncontainer.go @@ -40,27 +40,9 @@ func ParseProtectionContainerID(input string) (*ProtectionContainerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProtectionContainerId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) - } - - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseProtectionContainerIDInsensitively(input string) (*ProtectionContainer return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProtectionContainerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ProtectionContainerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) + if id.BackupFabricName, ok = input.Parsed["backupFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", input) } - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) + if id.ProtectionContainerName, ok = input.Parsed["protectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", input) } - return &id, nil + return nil } // ValidateProtectionContainerID checks that 'input' can be parsed as a Protection Container ID diff --git a/resource-manager/recoveryservicesbackup/2023-06-01/datamove/id_vault.go b/resource-manager/recoveryservicesbackup/2023-06-01/datamove/id_vault.go index 3018d3e13af..7d274d08b54 100644 --- a/resource-manager/recoveryservicesbackup/2023-06-01/datamove/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-06-01/datamove/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-06-01/featuresupport/id_location.go b/resource-manager/recoveryservicesbackup/2023-06-01/featuresupport/id_location.go index b614b25be9e..43fe026a3f5 100644 --- a/resource-manager/recoveryservicesbackup/2023-06-01/featuresupport/id_location.go +++ b/resource-manager/recoveryservicesbackup/2023-06-01/featuresupport/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/recoveryservicesbackup/2023-06-01/fetchtieringcost/id_vault.go b/resource-manager/recoveryservicesbackup/2023-06-01/fetchtieringcost/id_vault.go index 4c0390fd872..440d8452341 100644 --- a/resource-manager/recoveryservicesbackup/2023-06-01/fetchtieringcost/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-06-01/fetchtieringcost/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-06-01/itemlevelrecoveryconnections/id_recoverypoint.go b/resource-manager/recoveryservicesbackup/2023-06-01/itemlevelrecoveryconnections/id_recoverypoint.go index b578a390b56..23b6991307f 100644 --- a/resource-manager/recoveryservicesbackup/2023-06-01/itemlevelrecoveryconnections/id_recoverypoint.go +++ b/resource-manager/recoveryservicesbackup/2023-06-01/itemlevelrecoveryconnections/id_recoverypoint.go @@ -44,35 +44,9 @@ func ParseRecoveryPointID(input string) (*RecoveryPointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecoveryPointId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) - } - - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) - } - - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) - } - - if id.RecoveryPointId, ok = parsed.Parsed["recoveryPointId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseRecoveryPointIDInsensitively(input string) (*RecoveryPointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecoveryPointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RecoveryPointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) + if id.BackupFabricName, ok = input.Parsed["backupFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", input) } - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) + if id.ProtectionContainerName, ok = input.Parsed["protectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", input) } - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) + if id.ProtectedItemName, ok = input.Parsed["protectedItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", input) } - if id.RecoveryPointId, ok = parsed.Parsed["recoveryPointId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", *parsed) + if id.RecoveryPointId, ok = input.Parsed["recoveryPointId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", input) } - return &id, nil + return nil } // ValidateRecoveryPointID checks that 'input' can be parsed as a Recovery Point ID diff --git a/resource-manager/recoveryservicesbackup/2023-06-01/jobcancellations/id_backupjob.go b/resource-manager/recoveryservicesbackup/2023-06-01/jobcancellations/id_backupjob.go index dec2d00dccb..b653abc82d6 100644 --- a/resource-manager/recoveryservicesbackup/2023-06-01/jobcancellations/id_backupjob.go +++ b/resource-manager/recoveryservicesbackup/2023-06-01/jobcancellations/id_backupjob.go @@ -38,23 +38,9 @@ func ParseBackupJobID(input string) (*BackupJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupJobId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupJobName, ok = parsed.Parsed["backupJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupJobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupJobIDInsensitively(input string) (*BackupJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupJobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupJobId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupJobName, ok = parsed.Parsed["backupJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupJobName", *parsed) + if id.BackupJobName, ok = input.Parsed["backupJobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupJobName", input) } - return &id, nil + return nil } // ValidateBackupJobID checks that 'input' can be parsed as a Backup Job ID diff --git a/resource-manager/recoveryservicesbackup/2023-06-01/jobdetails/id_backupjob.go b/resource-manager/recoveryservicesbackup/2023-06-01/jobdetails/id_backupjob.go index daa9077226b..efd53b158d1 100644 --- a/resource-manager/recoveryservicesbackup/2023-06-01/jobdetails/id_backupjob.go +++ b/resource-manager/recoveryservicesbackup/2023-06-01/jobdetails/id_backupjob.go @@ -38,23 +38,9 @@ func ParseBackupJobID(input string) (*BackupJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupJobId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupJobName, ok = parsed.Parsed["backupJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupJobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupJobIDInsensitively(input string) (*BackupJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupJobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupJobId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupJobName, ok = parsed.Parsed["backupJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupJobName", *parsed) + if id.BackupJobName, ok = input.Parsed["backupJobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupJobName", input) } - return &id, nil + return nil } // ValidateBackupJobID checks that 'input' can be parsed as a Backup Job ID diff --git a/resource-manager/recoveryservicesbackup/2023-06-01/jobs/id_vault.go b/resource-manager/recoveryservicesbackup/2023-06-01/jobs/id_vault.go index 8d98d6d11a0..e8be0075007 100644 --- a/resource-manager/recoveryservicesbackup/2023-06-01/jobs/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-06-01/jobs/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-06-01/operation/id_vault.go b/resource-manager/recoveryservicesbackup/2023-06-01/operation/id_vault.go index 590d8ef449c..01b645cd807 100644 --- a/resource-manager/recoveryservicesbackup/2023-06-01/operation/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-06-01/operation/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-06-01/privateendpointconnection/id_privateendpointconnection.go b/resource-manager/recoveryservicesbackup/2023-06-01/privateendpointconnection/id_privateendpointconnection.go index 41ac452c47f..e23759094f8 100644 --- a/resource-manager/recoveryservicesbackup/2023-06-01/privateendpointconnection/id_privateendpointconnection.go +++ b/resource-manager/recoveryservicesbackup/2023-06-01/privateendpointconnection/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/recoveryservicesbackup/2023-06-01/protectablecontainers/id_backupfabric.go b/resource-manager/recoveryservicesbackup/2023-06-01/protectablecontainers/id_backupfabric.go index 0f79198981e..b06ebb0ca21 100644 --- a/resource-manager/recoveryservicesbackup/2023-06-01/protectablecontainers/id_backupfabric.go +++ b/resource-manager/recoveryservicesbackup/2023-06-01/protectablecontainers/id_backupfabric.go @@ -38,23 +38,9 @@ func ParseBackupFabricID(input string) (*BackupFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupFabricId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupFabricIDInsensitively(input string) (*BackupFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupFabricId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupFabricId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) + if id.BackupFabricName, ok = input.Parsed["backupFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", input) } - return &id, nil + return nil } // ValidateBackupFabricID checks that 'input' can be parsed as a Backup Fabric ID diff --git a/resource-manager/recoveryservicesbackup/2023-06-01/protecteditems/id_protecteditem.go b/resource-manager/recoveryservicesbackup/2023-06-01/protecteditems/id_protecteditem.go index f3fdb99d86c..e1e53a96b1f 100644 --- a/resource-manager/recoveryservicesbackup/2023-06-01/protecteditems/id_protecteditem.go +++ b/resource-manager/recoveryservicesbackup/2023-06-01/protecteditems/id_protecteditem.go @@ -42,31 +42,9 @@ func ParseProtectedItemID(input string) (*ProtectedItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProtectedItemId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) - } - - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) - } - - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseProtectedItemIDInsensitively(input string) (*ProtectedItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProtectedItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProtectedItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) + if id.BackupFabricName, ok = input.Parsed["backupFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", input) } - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) + if id.ProtectionContainerName, ok = input.Parsed["protectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", input) } - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) + if id.ProtectedItemName, ok = input.Parsed["protectedItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", input) } - return &id, nil + return nil } // ValidateProtectedItemID checks that 'input' can be parsed as a Protected Item ID diff --git a/resource-manager/recoveryservicesbackup/2023-06-01/protectioncontainers/id_backupfabric.go b/resource-manager/recoveryservicesbackup/2023-06-01/protectioncontainers/id_backupfabric.go index f929acd11e9..bcbc1243062 100644 --- a/resource-manager/recoveryservicesbackup/2023-06-01/protectioncontainers/id_backupfabric.go +++ b/resource-manager/recoveryservicesbackup/2023-06-01/protectioncontainers/id_backupfabric.go @@ -38,23 +38,9 @@ func ParseBackupFabricID(input string) (*BackupFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupFabricId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupFabricIDInsensitively(input string) (*BackupFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupFabricId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupFabricId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) + if id.BackupFabricName, ok = input.Parsed["backupFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", input) } - return &id, nil + return nil } // ValidateBackupFabricID checks that 'input' can be parsed as a Backup Fabric ID diff --git a/resource-manager/recoveryservicesbackup/2023-06-01/protectioncontainers/id_protectioncontainer.go b/resource-manager/recoveryservicesbackup/2023-06-01/protectioncontainers/id_protectioncontainer.go index bc3b402d92c..bd6c7e47669 100644 --- a/resource-manager/recoveryservicesbackup/2023-06-01/protectioncontainers/id_protectioncontainer.go +++ b/resource-manager/recoveryservicesbackup/2023-06-01/protectioncontainers/id_protectioncontainer.go @@ -40,27 +40,9 @@ func ParseProtectionContainerID(input string) (*ProtectionContainerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProtectionContainerId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) - } - - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseProtectionContainerIDInsensitively(input string) (*ProtectionContainer return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProtectionContainerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ProtectionContainerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) + if id.BackupFabricName, ok = input.Parsed["backupFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", input) } - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) + if id.ProtectionContainerName, ok = input.Parsed["protectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", input) } - return &id, nil + return nil } // ValidateProtectionContainerID checks that 'input' can be parsed as a Protection Container ID diff --git a/resource-manager/recoveryservicesbackup/2023-06-01/protectionintent/id_backupprotectionintent.go b/resource-manager/recoveryservicesbackup/2023-06-01/protectionintent/id_backupprotectionintent.go index e2861b56756..df0e96c1629 100644 --- a/resource-manager/recoveryservicesbackup/2023-06-01/protectionintent/id_backupprotectionintent.go +++ b/resource-manager/recoveryservicesbackup/2023-06-01/protectionintent/id_backupprotectionintent.go @@ -40,27 +40,9 @@ func ParseBackupProtectionIntentID(input string) (*BackupProtectionIntentId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupProtectionIntentId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) - } - - if id.BackupProtectionIntentName, ok = parsed.Parsed["backupProtectionIntentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupProtectionIntentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseBackupProtectionIntentIDInsensitively(input string) (*BackupProtection return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupProtectionIntentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *BackupProtectionIntentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) + if id.BackupFabricName, ok = input.Parsed["backupFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", input) } - if id.BackupProtectionIntentName, ok = parsed.Parsed["backupProtectionIntentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupProtectionIntentName", *parsed) + if id.BackupProtectionIntentName, ok = input.Parsed["backupProtectionIntentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupProtectionIntentName", input) } - return &id, nil + return nil } // ValidateBackupProtectionIntentID checks that 'input' can be parsed as a Backup Protection Intent ID diff --git a/resource-manager/recoveryservicesbackup/2023-06-01/protectionintent/id_location.go b/resource-manager/recoveryservicesbackup/2023-06-01/protectionintent/id_location.go index f7c66c4ef6c..3268f118478 100644 --- a/resource-manager/recoveryservicesbackup/2023-06-01/protectionintent/id_location.go +++ b/resource-manager/recoveryservicesbackup/2023-06-01/protectionintent/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/recoveryservicesbackup/2023-06-01/protectionpolicies/id_backuppolicy.go b/resource-manager/recoveryservicesbackup/2023-06-01/protectionpolicies/id_backuppolicy.go index 320ce51eb8e..0496c1a87bc 100644 --- a/resource-manager/recoveryservicesbackup/2023-06-01/protectionpolicies/id_backuppolicy.go +++ b/resource-manager/recoveryservicesbackup/2023-06-01/protectionpolicies/id_backuppolicy.go @@ -38,23 +38,9 @@ func ParseBackupPolicyID(input string) (*BackupPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupPolicyId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupPolicyName, ok = parsed.Parsed["backupPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupPolicyIDInsensitively(input string) (*BackupPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupPolicyName, ok = parsed.Parsed["backupPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupPolicyName", *parsed) + if id.BackupPolicyName, ok = input.Parsed["backupPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupPolicyName", input) } - return &id, nil + return nil } // ValidateBackupPolicyID checks that 'input' can be parsed as a Backup Policy ID diff --git a/resource-manager/recoveryservicesbackup/2023-06-01/recoverypoint/id_recoverypoint.go b/resource-manager/recoveryservicesbackup/2023-06-01/recoverypoint/id_recoverypoint.go index 986d9fee91f..aae82eef969 100644 --- a/resource-manager/recoveryservicesbackup/2023-06-01/recoverypoint/id_recoverypoint.go +++ b/resource-manager/recoveryservicesbackup/2023-06-01/recoverypoint/id_recoverypoint.go @@ -44,35 +44,9 @@ func ParseRecoveryPointID(input string) (*RecoveryPointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecoveryPointId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) - } - - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) - } - - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) - } - - if id.RecoveryPointId, ok = parsed.Parsed["recoveryPointId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseRecoveryPointIDInsensitively(input string) (*RecoveryPointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecoveryPointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RecoveryPointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) + if id.BackupFabricName, ok = input.Parsed["backupFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", input) } - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) + if id.ProtectionContainerName, ok = input.Parsed["protectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", input) } - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) + if id.ProtectedItemName, ok = input.Parsed["protectedItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", input) } - if id.RecoveryPointId, ok = parsed.Parsed["recoveryPointId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", *parsed) + if id.RecoveryPointId, ok = input.Parsed["recoveryPointId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", input) } - return &id, nil + return nil } // ValidateRecoveryPointID checks that 'input' can be parsed as a Recovery Point ID diff --git a/resource-manager/recoveryservicesbackup/2023-06-01/recoverypoints/id_protecteditem.go b/resource-manager/recoveryservicesbackup/2023-06-01/recoverypoints/id_protecteditem.go index 8f651e79aec..bdc49794b36 100644 --- a/resource-manager/recoveryservicesbackup/2023-06-01/recoverypoints/id_protecteditem.go +++ b/resource-manager/recoveryservicesbackup/2023-06-01/recoverypoints/id_protecteditem.go @@ -42,31 +42,9 @@ func ParseProtectedItemID(input string) (*ProtectedItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProtectedItemId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) - } - - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) - } - - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseProtectedItemIDInsensitively(input string) (*ProtectedItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProtectedItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProtectedItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) + if id.BackupFabricName, ok = input.Parsed["backupFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", input) } - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) + if id.ProtectionContainerName, ok = input.Parsed["protectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", input) } - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) + if id.ProtectedItemName, ok = input.Parsed["protectedItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", input) } - return &id, nil + return nil } // ValidateProtectedItemID checks that 'input' can be parsed as a Protected Item ID diff --git a/resource-manager/recoveryservicesbackup/2023-06-01/recoverypoints/id_recoverypoint.go b/resource-manager/recoveryservicesbackup/2023-06-01/recoverypoints/id_recoverypoint.go index 9a81b4d7188..fd5dcf42b77 100644 --- a/resource-manager/recoveryservicesbackup/2023-06-01/recoverypoints/id_recoverypoint.go +++ b/resource-manager/recoveryservicesbackup/2023-06-01/recoverypoints/id_recoverypoint.go @@ -44,35 +44,9 @@ func ParseRecoveryPointID(input string) (*RecoveryPointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecoveryPointId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) - } - - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) - } - - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) - } - - if id.RecoveryPointId, ok = parsed.Parsed["recoveryPointId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseRecoveryPointIDInsensitively(input string) (*RecoveryPointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecoveryPointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RecoveryPointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) + if id.BackupFabricName, ok = input.Parsed["backupFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", input) } - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) + if id.ProtectionContainerName, ok = input.Parsed["protectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", input) } - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) + if id.ProtectedItemName, ok = input.Parsed["protectedItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", input) } - if id.RecoveryPointId, ok = parsed.Parsed["recoveryPointId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", *parsed) + if id.RecoveryPointId, ok = input.Parsed["recoveryPointId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", input) } - return &id, nil + return nil } // ValidateRecoveryPointID checks that 'input' can be parsed as a Recovery Point ID diff --git a/resource-manager/recoveryservicesbackup/2023-06-01/recoverypointsrecommendedformove/id_protecteditem.go b/resource-manager/recoveryservicesbackup/2023-06-01/recoverypointsrecommendedformove/id_protecteditem.go index 61c6da6121e..b49a70f3629 100644 --- a/resource-manager/recoveryservicesbackup/2023-06-01/recoverypointsrecommendedformove/id_protecteditem.go +++ b/resource-manager/recoveryservicesbackup/2023-06-01/recoverypointsrecommendedformove/id_protecteditem.go @@ -42,31 +42,9 @@ func ParseProtectedItemID(input string) (*ProtectedItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProtectedItemId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) - } - - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) - } - - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseProtectedItemIDInsensitively(input string) (*ProtectedItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProtectedItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProtectedItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) + if id.BackupFabricName, ok = input.Parsed["backupFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", input) } - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) + if id.ProtectionContainerName, ok = input.Parsed["protectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", input) } - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) + if id.ProtectedItemName, ok = input.Parsed["protectedItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", input) } - return &id, nil + return nil } // ValidateProtectedItemID checks that 'input' can be parsed as a Protected Item ID diff --git a/resource-manager/recoveryservicesbackup/2023-06-01/resourceguardproxies/id_vault.go b/resource-manager/recoveryservicesbackup/2023-06-01/resourceguardproxies/id_vault.go index 93a4a6a0118..57c654c21ed 100644 --- a/resource-manager/recoveryservicesbackup/2023-06-01/resourceguardproxies/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-06-01/resourceguardproxies/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-06-01/resourceguardproxy/id_backupresourceguardproxy.go b/resource-manager/recoveryservicesbackup/2023-06-01/resourceguardproxy/id_backupresourceguardproxy.go index a05bd4a2c99..8fe87a68009 100644 --- a/resource-manager/recoveryservicesbackup/2023-06-01/resourceguardproxy/id_backupresourceguardproxy.go +++ b/resource-manager/recoveryservicesbackup/2023-06-01/resourceguardproxy/id_backupresourceguardproxy.go @@ -38,23 +38,9 @@ func ParseBackupResourceGuardProxyID(input string) (*BackupResourceGuardProxyId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupResourceGuardProxyId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupResourceGuardProxyName, ok = parsed.Parsed["backupResourceGuardProxyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupResourceGuardProxyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupResourceGuardProxyIDInsensitively(input string) (*BackupResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupResourceGuardProxyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupResourceGuardProxyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupResourceGuardProxyName, ok = parsed.Parsed["backupResourceGuardProxyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupResourceGuardProxyName", *parsed) + if id.BackupResourceGuardProxyName, ok = input.Parsed["backupResourceGuardProxyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupResourceGuardProxyName", input) } - return &id, nil + return nil } // ValidateBackupResourceGuardProxyID checks that 'input' can be parsed as a Backup Resource Guard Proxy ID diff --git a/resource-manager/recoveryservicesbackup/2023-06-01/restores/id_recoverypoint.go b/resource-manager/recoveryservicesbackup/2023-06-01/restores/id_recoverypoint.go index 46892f79641..847037510cb 100644 --- a/resource-manager/recoveryservicesbackup/2023-06-01/restores/id_recoverypoint.go +++ b/resource-manager/recoveryservicesbackup/2023-06-01/restores/id_recoverypoint.go @@ -44,35 +44,9 @@ func ParseRecoveryPointID(input string) (*RecoveryPointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecoveryPointId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) - } - - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) - } - - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) - } - - if id.RecoveryPointId, ok = parsed.Parsed["recoveryPointId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseRecoveryPointIDInsensitively(input string) (*RecoveryPointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecoveryPointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RecoveryPointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.BackupFabricName, ok = parsed.Parsed["backupFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", *parsed) + if id.BackupFabricName, ok = input.Parsed["backupFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupFabricName", input) } - if id.ProtectionContainerName, ok = parsed.Parsed["protectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", *parsed) + if id.ProtectionContainerName, ok = input.Parsed["protectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectionContainerName", input) } - if id.ProtectedItemName, ok = parsed.Parsed["protectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", *parsed) + if id.ProtectedItemName, ok = input.Parsed["protectedItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "protectedItemName", input) } - if id.RecoveryPointId, ok = parsed.Parsed["recoveryPointId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", *parsed) + if id.RecoveryPointId, ok = input.Parsed["recoveryPointId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointId", input) } - return &id, nil + return nil } // ValidateRecoveryPointID checks that 'input' can be parsed as a Recovery Point ID diff --git a/resource-manager/recoveryservicesbackup/2023-06-01/securitypins/id_vault.go b/resource-manager/recoveryservicesbackup/2023-06-01/securitypins/id_vault.go index e4eae70fc2e..e7f79031e1e 100644 --- a/resource-manager/recoveryservicesbackup/2023-06-01/securitypins/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-06-01/securitypins/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-06-01/softdeletedcontainers/id_vault.go b/resource-manager/recoveryservicesbackup/2023-06-01/softdeletedcontainers/id_vault.go index 0e3711018d2..0e6d740d3e4 100644 --- a/resource-manager/recoveryservicesbackup/2023-06-01/softdeletedcontainers/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-06-01/softdeletedcontainers/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicesbackup/2023-06-01/validateoperation/id_vault.go b/resource-manager/recoveryservicesbackup/2023-06-01/validateoperation/id_vault.go index a9af720921b..975bf3188c2 100644 --- a/resource-manager/recoveryservicesbackup/2023-06-01/validateoperation/id_vault.go +++ b/resource-manager/recoveryservicesbackup/2023-06-01/validateoperation/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/migrationrecoverypoints/id_migrationrecoverypoint.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/migrationrecoverypoints/id_migrationrecoverypoint.go index 85f737b6ac0..6635a133bbd 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/migrationrecoverypoints/id_migrationrecoverypoint.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/migrationrecoverypoints/id_migrationrecoverypoint.go @@ -44,35 +44,9 @@ func ParseMigrationRecoveryPointID(input string) (*MigrationRecoveryPointId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MigrationRecoveryPointId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) - } - - if id.ReplicationMigrationItemName, ok = parsed.Parsed["replicationMigrationItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationMigrationItemName", *parsed) - } - - if id.MigrationRecoveryPointName, ok = parsed.Parsed["migrationRecoveryPointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "migrationRecoveryPointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseMigrationRecoveryPointIDInsensitively(input string) (*MigrationRecover return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MigrationRecoveryPointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *MigrationRecoveryPointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - if id.ReplicationMigrationItemName, ok = parsed.Parsed["replicationMigrationItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationMigrationItemName", *parsed) + if id.ReplicationMigrationItemName, ok = input.Parsed["replicationMigrationItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationMigrationItemName", input) } - if id.MigrationRecoveryPointName, ok = parsed.Parsed["migrationRecoveryPointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "migrationRecoveryPointName", *parsed) + if id.MigrationRecoveryPointName, ok = input.Parsed["migrationRecoveryPointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "migrationRecoveryPointName", input) } - return &id, nil + return nil } // ValidateMigrationRecoveryPointID checks that 'input' can be parsed as a Migration Recovery Point ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/migrationrecoverypoints/id_replicationmigrationitem.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/migrationrecoverypoints/id_replicationmigrationitem.go index cd7a8f23e9c..bf44279baa2 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/migrationrecoverypoints/id_replicationmigrationitem.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/migrationrecoverypoints/id_replicationmigrationitem.go @@ -42,31 +42,9 @@ func ParseReplicationMigrationItemID(input string) (*ReplicationMigrationItemId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationMigrationItemId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) - } - - if id.ReplicationMigrationItemName, ok = parsed.Parsed["replicationMigrationItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationMigrationItemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseReplicationMigrationItemIDInsensitively(input string) (*ReplicationMig return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationMigrationItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ReplicationMigrationItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - if id.ReplicationMigrationItemName, ok = parsed.Parsed["replicationMigrationItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationMigrationItemName", *parsed) + if id.ReplicationMigrationItemName, ok = input.Parsed["replicationMigrationItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationMigrationItemName", input) } - return &id, nil + return nil } // ValidateReplicationMigrationItemID checks that 'input' can be parsed as a Replication Migration Item ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/recoverypoints/id_recoverypoint.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/recoverypoints/id_recoverypoint.go index ad43c081904..2e5b42d0055 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/recoverypoints/id_recoverypoint.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/recoverypoints/id_recoverypoint.go @@ -44,35 +44,9 @@ func ParseRecoveryPointID(input string) (*RecoveryPointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecoveryPointId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) - } - - if id.ReplicationProtectedItemName, ok = parsed.Parsed["replicationProtectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", *parsed) - } - - if id.RecoveryPointName, ok = parsed.Parsed["recoveryPointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseRecoveryPointIDInsensitively(input string) (*RecoveryPointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecoveryPointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RecoveryPointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - if id.ReplicationProtectedItemName, ok = parsed.Parsed["replicationProtectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", *parsed) + if id.ReplicationProtectedItemName, ok = input.Parsed["replicationProtectedItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", input) } - if id.RecoveryPointName, ok = parsed.Parsed["recoveryPointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointName", *parsed) + if id.RecoveryPointName, ok = input.Parsed["recoveryPointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointName", input) } - return &id, nil + return nil } // ValidateRecoveryPointID checks that 'input' can be parsed as a Recovery Point ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/recoverypoints/id_replicationprotecteditem.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/recoverypoints/id_replicationprotecteditem.go index d8eff4f5e4d..4a66a2ef06d 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/recoverypoints/id_replicationprotecteditem.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/recoverypoints/id_replicationprotecteditem.go @@ -42,31 +42,9 @@ func ParseReplicationProtectedItemID(input string) (*ReplicationProtectedItemId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectedItemId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) - } - - if id.ReplicationProtectedItemName, ok = parsed.Parsed["replicationProtectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseReplicationProtectedItemIDInsensitively(input string) (*ReplicationPro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectedItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ReplicationProtectedItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - if id.ReplicationProtectedItemName, ok = parsed.Parsed["replicationProtectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", *parsed) + if id.ReplicationProtectedItemName, ok = input.Parsed["replicationProtectedItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", input) } - return &id, nil + return nil } // ValidateReplicationProtectedItemID checks that 'input' can be parsed as a Replication Protected Item ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationalertsettings/id_replicationalertsetting.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationalertsettings/id_replicationalertsetting.go index fd4bbe7bf22..7cc4b4916cc 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationalertsettings/id_replicationalertsetting.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationalertsettings/id_replicationalertsetting.go @@ -38,23 +38,9 @@ func ParseReplicationAlertSettingID(input string) (*ReplicationAlertSettingId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationAlertSettingId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationAlertSettingName, ok = parsed.Parsed["replicationAlertSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationAlertSettingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationAlertSettingIDInsensitively(input string) (*ReplicationAler return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationAlertSettingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationAlertSettingId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationAlertSettingName, ok = parsed.Parsed["replicationAlertSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationAlertSettingName", *parsed) + if id.ReplicationAlertSettingName, ok = input.Parsed["replicationAlertSettingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationAlertSettingName", input) } - return &id, nil + return nil } // ValidateReplicationAlertSettingID checks that 'input' can be parsed as a Replication Alert Setting ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationalertsettings/id_vault.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationalertsettings/id_vault.go index e942d185177..42183390cf3 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationalertsettings/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationalertsettings/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationappliances/id_vault.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationappliances/id_vault.go index c5d015c9cd5..e37d9d05230 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationappliances/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationappliances/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationeligibilityresults/id_virtualmachine.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationeligibilityresults/id_virtualmachine.go index c27fea51a7b..47a386f894f 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationeligibilityresults/id_virtualmachine.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationeligibilityresults/id_virtualmachine.go @@ -36,19 +36,9 @@ func ParseVirtualMachineID(input string) (*VirtualMachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineIDInsensitively(input string) (*VirtualMachineId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - return &id, nil + return nil } // ValidateVirtualMachineID checks that 'input' can be parsed as a Virtual Machine ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationevents/id_replicationevent.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationevents/id_replicationevent.go index 49f794e3ccf..89ea4cefe9d 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationevents/id_replicationevent.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationevents/id_replicationevent.go @@ -38,23 +38,9 @@ func ParseReplicationEventID(input string) (*ReplicationEventId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationEventId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationEventName, ok = parsed.Parsed["replicationEventName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationEventName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationEventIDInsensitively(input string) (*ReplicationEventId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationEventId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationEventId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationEventName, ok = parsed.Parsed["replicationEventName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationEventName", *parsed) + if id.ReplicationEventName, ok = input.Parsed["replicationEventName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationEventName", input) } - return &id, nil + return nil } // ValidateReplicationEventID checks that 'input' can be parsed as a Replication Event ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationevents/id_vault.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationevents/id_vault.go index 73bfeb6a4b7..3997a813f75 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationevents/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationevents/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationfabrics/id_replicationfabric.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationfabrics/id_replicationfabric.go index db5f8d7ab5e..72935507a8c 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationfabrics/id_replicationfabric.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationfabrics/id_replicationfabric.go @@ -38,23 +38,9 @@ func ParseReplicationFabricID(input string) (*ReplicationFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationFabricIDInsensitively(input string) (*ReplicationFabricId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationFabricId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - return &id, nil + return nil } // ValidateReplicationFabricID checks that 'input' can be parsed as a Replication Fabric ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationfabrics/id_vault.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationfabrics/id_vault.go index 2a58d893c0e..b88ddbb8e33 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationfabrics/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationfabrics/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationjobs/id_replicationjob.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationjobs/id_replicationjob.go index 5f1c028407b..8aaf763372f 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationjobs/id_replicationjob.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationjobs/id_replicationjob.go @@ -38,23 +38,9 @@ func ParseReplicationJobID(input string) (*ReplicationJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationJobId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationJobName, ok = parsed.Parsed["replicationJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationJobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationJobIDInsensitively(input string) (*ReplicationJobId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationJobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationJobId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationJobName, ok = parsed.Parsed["replicationJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationJobName", *parsed) + if id.ReplicationJobName, ok = input.Parsed["replicationJobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationJobName", input) } - return &id, nil + return nil } // ValidateReplicationJobID checks that 'input' can be parsed as a Replication Job ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationjobs/id_vault.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationjobs/id_vault.go index d63ce87429f..4da941eb753 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationjobs/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationjobs/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationlogicalnetworks/id_replicationfabric.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationlogicalnetworks/id_replicationfabric.go index a9dcb375bef..d34e37e4196 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationlogicalnetworks/id_replicationfabric.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationlogicalnetworks/id_replicationfabric.go @@ -38,23 +38,9 @@ func ParseReplicationFabricID(input string) (*ReplicationFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationFabricIDInsensitively(input string) (*ReplicationFabricId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationFabricId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - return &id, nil + return nil } // ValidateReplicationFabricID checks that 'input' can be parsed as a Replication Fabric ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationlogicalnetworks/id_replicationlogicalnetwork.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationlogicalnetworks/id_replicationlogicalnetwork.go index 26fb05fb737..67601ab37cb 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationlogicalnetworks/id_replicationlogicalnetwork.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationlogicalnetworks/id_replicationlogicalnetwork.go @@ -40,27 +40,9 @@ func ParseReplicationLogicalNetworkID(input string) (*ReplicationLogicalNetworkI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationLogicalNetworkId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationLogicalNetworkName, ok = parsed.Parsed["replicationLogicalNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationLogicalNetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationLogicalNetworkIDInsensitively(input string) (*ReplicationLo return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationLogicalNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationLogicalNetworkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationLogicalNetworkName, ok = parsed.Parsed["replicationLogicalNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationLogicalNetworkName", *parsed) + if id.ReplicationLogicalNetworkName, ok = input.Parsed["replicationLogicalNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationLogicalNetworkName", input) } - return &id, nil + return nil } // ValidateReplicationLogicalNetworkID checks that 'input' can be parsed as a Replication Logical Network ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationmigrationitems/id_replicationmigrationitem.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationmigrationitems/id_replicationmigrationitem.go index 1f52aff025c..4af937308f0 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationmigrationitems/id_replicationmigrationitem.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationmigrationitems/id_replicationmigrationitem.go @@ -42,31 +42,9 @@ func ParseReplicationMigrationItemID(input string) (*ReplicationMigrationItemId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationMigrationItemId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) - } - - if id.ReplicationMigrationItemName, ok = parsed.Parsed["replicationMigrationItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationMigrationItemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseReplicationMigrationItemIDInsensitively(input string) (*ReplicationMig return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationMigrationItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ReplicationMigrationItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - if id.ReplicationMigrationItemName, ok = parsed.Parsed["replicationMigrationItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationMigrationItemName", *parsed) + if id.ReplicationMigrationItemName, ok = input.Parsed["replicationMigrationItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationMigrationItemName", input) } - return &id, nil + return nil } // ValidateReplicationMigrationItemID checks that 'input' can be parsed as a Replication Migration Item ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationmigrationitems/id_replicationprotectioncontainer.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationmigrationitems/id_replicationprotectioncontainer.go index e977a910480..434724573c3 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationmigrationitems/id_replicationprotectioncontainer.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationmigrationitems/id_replicationprotectioncontainer.go @@ -40,27 +40,9 @@ func ParseReplicationProtectionContainerID(input string) (*ReplicationProtection return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationProtectionContainerIDInsensitively(input string) (*Replicat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationProtectionContainerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - return &id, nil + return nil } // ValidateReplicationProtectionContainerID checks that 'input' can be parsed as a Replication Protection Container ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationmigrationitems/id_vault.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationmigrationitems/id_vault.go index 58abd104387..e05e06bc8d8 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationmigrationitems/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationmigrationitems/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationnetworkmappings/id_replicationnetwork.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationnetworkmappings/id_replicationnetwork.go index 8f65b4f0ffd..521fb241bed 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationnetworkmappings/id_replicationnetwork.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationnetworkmappings/id_replicationnetwork.go @@ -40,27 +40,9 @@ func ParseReplicationNetworkID(input string) (*ReplicationNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationNetworkId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationNetworkName, ok = parsed.Parsed["replicationNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationNetworkIDInsensitively(input string) (*ReplicationNetworkId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationNetworkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationNetworkName, ok = parsed.Parsed["replicationNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkName", *parsed) + if id.ReplicationNetworkName, ok = input.Parsed["replicationNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkName", input) } - return &id, nil + return nil } // ValidateReplicationNetworkID checks that 'input' can be parsed as a Replication Network ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationnetworkmappings/id_replicationnetworkmapping.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationnetworkmappings/id_replicationnetworkmapping.go index e67c61eed51..5705f27e9b7 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationnetworkmappings/id_replicationnetworkmapping.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationnetworkmappings/id_replicationnetworkmapping.go @@ -42,31 +42,9 @@ func ParseReplicationNetworkMappingID(input string) (*ReplicationNetworkMappingI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationNetworkMappingId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationNetworkName, ok = parsed.Parsed["replicationNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkName", *parsed) - } - - if id.ReplicationNetworkMappingName, ok = parsed.Parsed["replicationNetworkMappingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkMappingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseReplicationNetworkMappingIDInsensitively(input string) (*ReplicationNe return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationNetworkMappingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ReplicationNetworkMappingId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationNetworkName, ok = parsed.Parsed["replicationNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkName", *parsed) + if id.ReplicationNetworkName, ok = input.Parsed["replicationNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkName", input) } - if id.ReplicationNetworkMappingName, ok = parsed.Parsed["replicationNetworkMappingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkMappingName", *parsed) + if id.ReplicationNetworkMappingName, ok = input.Parsed["replicationNetworkMappingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkMappingName", input) } - return &id, nil + return nil } // ValidateReplicationNetworkMappingID checks that 'input' can be parsed as a Replication Network Mapping ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationnetworkmappings/id_vault.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationnetworkmappings/id_vault.go index 192509d68b9..e154527e540 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationnetworkmappings/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationnetworkmappings/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationnetworks/id_replicationfabric.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationnetworks/id_replicationfabric.go index 73c02b723ee..c46331fc5f7 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationnetworks/id_replicationfabric.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationnetworks/id_replicationfabric.go @@ -38,23 +38,9 @@ func ParseReplicationFabricID(input string) (*ReplicationFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationFabricIDInsensitively(input string) (*ReplicationFabricId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationFabricId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - return &id, nil + return nil } // ValidateReplicationFabricID checks that 'input' can be parsed as a Replication Fabric ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationnetworks/id_replicationnetwork.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationnetworks/id_replicationnetwork.go index e1869f6fb0d..e9f54c2f47a 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationnetworks/id_replicationnetwork.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationnetworks/id_replicationnetwork.go @@ -40,27 +40,9 @@ func ParseReplicationNetworkID(input string) (*ReplicationNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationNetworkId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationNetworkName, ok = parsed.Parsed["replicationNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationNetworkIDInsensitively(input string) (*ReplicationNetworkId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationNetworkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationNetworkName, ok = parsed.Parsed["replicationNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkName", *parsed) + if id.ReplicationNetworkName, ok = input.Parsed["replicationNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkName", input) } - return &id, nil + return nil } // ValidateReplicationNetworkID checks that 'input' can be parsed as a Replication Network ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationnetworks/id_vault.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationnetworks/id_vault.go index 0bfde13c55d..6e0f3a3d4a3 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationnetworks/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationnetworks/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationpolicies/id_replicationpolicy.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationpolicies/id_replicationpolicy.go index c9d0ad0e634..a75a6de5d56 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationpolicies/id_replicationpolicy.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationpolicies/id_replicationpolicy.go @@ -38,23 +38,9 @@ func ParseReplicationPolicyID(input string) (*ReplicationPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationPolicyId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationPolicyName, ok = parsed.Parsed["replicationPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationPolicyIDInsensitively(input string) (*ReplicationPolicyId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationPolicyName, ok = parsed.Parsed["replicationPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationPolicyName", *parsed) + if id.ReplicationPolicyName, ok = input.Parsed["replicationPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationPolicyName", input) } - return &id, nil + return nil } // ValidateReplicationPolicyID checks that 'input' can be parsed as a Replication Policy ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationpolicies/id_vault.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationpolicies/id_vault.go index f4a5bf6b711..6a89bd687a5 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationpolicies/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationpolicies/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectableitems/id_replicationprotectableitem.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectableitems/id_replicationprotectableitem.go index f7f0b3936ce..90f92bce414 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectableitems/id_replicationprotectableitem.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectableitems/id_replicationprotectableitem.go @@ -42,31 +42,9 @@ func ParseReplicationProtectableItemID(input string) (*ReplicationProtectableIte return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectableItemId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) - } - - if id.ReplicationProtectableItemName, ok = parsed.Parsed["replicationProtectableItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectableItemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseReplicationProtectableItemIDInsensitively(input string) (*ReplicationP return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectableItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ReplicationProtectableItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - if id.ReplicationProtectableItemName, ok = parsed.Parsed["replicationProtectableItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectableItemName", *parsed) + if id.ReplicationProtectableItemName, ok = input.Parsed["replicationProtectableItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectableItemName", input) } - return &id, nil + return nil } // ValidateReplicationProtectableItemID checks that 'input' can be parsed as a Replication Protectable Item ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectableitems/id_replicationprotectioncontainer.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectableitems/id_replicationprotectioncontainer.go index 927a68eca8c..ce37ff1bc04 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectableitems/id_replicationprotectioncontainer.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectableitems/id_replicationprotectioncontainer.go @@ -40,27 +40,9 @@ func ParseReplicationProtectionContainerID(input string) (*ReplicationProtection return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationProtectionContainerIDInsensitively(input string) (*Replicat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationProtectionContainerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - return &id, nil + return nil } // ValidateReplicationProtectionContainerID checks that 'input' can be parsed as a Replication Protection Container ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotecteditems/id_replicationprotecteditem.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotecteditems/id_replicationprotecteditem.go index 557ea1c29ea..1857f1b1c6d 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotecteditems/id_replicationprotecteditem.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotecteditems/id_replicationprotecteditem.go @@ -42,31 +42,9 @@ func ParseReplicationProtectedItemID(input string) (*ReplicationProtectedItemId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectedItemId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) - } - - if id.ReplicationProtectedItemName, ok = parsed.Parsed["replicationProtectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseReplicationProtectedItemIDInsensitively(input string) (*ReplicationPro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectedItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ReplicationProtectedItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - if id.ReplicationProtectedItemName, ok = parsed.Parsed["replicationProtectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", *parsed) + if id.ReplicationProtectedItemName, ok = input.Parsed["replicationProtectedItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", input) } - return &id, nil + return nil } // ValidateReplicationProtectedItemID checks that 'input' can be parsed as a Replication Protected Item ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotecteditems/id_replicationprotectioncontainer.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotecteditems/id_replicationprotectioncontainer.go index 4c5b4524f12..8f0abd62b2c 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotecteditems/id_replicationprotectioncontainer.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotecteditems/id_replicationprotectioncontainer.go @@ -40,27 +40,9 @@ func ParseReplicationProtectionContainerID(input string) (*ReplicationProtection return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationProtectionContainerIDInsensitively(input string) (*Replicat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationProtectionContainerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - return &id, nil + return nil } // ValidateReplicationProtectionContainerID checks that 'input' can be parsed as a Replication Protection Container ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotecteditems/id_vault.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotecteditems/id_vault.go index 1e669936aab..dbbb913e424 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotecteditems/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotecteditems/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainermappings/id_replicationprotectioncontainer.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainermappings/id_replicationprotectioncontainer.go index c1b2a09565d..0c905cb402a 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainermappings/id_replicationprotectioncontainer.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainermappings/id_replicationprotectioncontainer.go @@ -40,27 +40,9 @@ func ParseReplicationProtectionContainerID(input string) (*ReplicationProtection return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationProtectionContainerIDInsensitively(input string) (*Replicat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationProtectionContainerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - return &id, nil + return nil } // ValidateReplicationProtectionContainerID checks that 'input' can be parsed as a Replication Protection Container ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainermappings/id_replicationprotectioncontainermapping.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainermappings/id_replicationprotectioncontainermapping.go index 3a5c8ab08a9..7c336381006 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainermappings/id_replicationprotectioncontainermapping.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainermappings/id_replicationprotectioncontainermapping.go @@ -42,31 +42,9 @@ func ParseReplicationProtectionContainerMappingID(input string) (*ReplicationPro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerMappingId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) - } - - if id.ReplicationProtectionContainerMappingName, ok = parsed.Parsed["replicationProtectionContainerMappingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerMappingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseReplicationProtectionContainerMappingIDInsensitively(input string) (*R return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerMappingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ReplicationProtectionContainerMappingId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - if id.ReplicationProtectionContainerMappingName, ok = parsed.Parsed["replicationProtectionContainerMappingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerMappingName", *parsed) + if id.ReplicationProtectionContainerMappingName, ok = input.Parsed["replicationProtectionContainerMappingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerMappingName", input) } - return &id, nil + return nil } // ValidateReplicationProtectionContainerMappingID checks that 'input' can be parsed as a Replication Protection Container Mapping ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainermappings/id_vault.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainermappings/id_vault.go index 7aa36b783ff..2a63a1f3299 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainermappings/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainermappings/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainers/id_replicationfabric.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainers/id_replicationfabric.go index c8c5de12a39..7668b03a571 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainers/id_replicationfabric.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainers/id_replicationfabric.go @@ -38,23 +38,9 @@ func ParseReplicationFabricID(input string) (*ReplicationFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationFabricIDInsensitively(input string) (*ReplicationFabricId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationFabricId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - return &id, nil + return nil } // ValidateReplicationFabricID checks that 'input' can be parsed as a Replication Fabric ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainers/id_replicationprotectioncontainer.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainers/id_replicationprotectioncontainer.go index 41b97b229a1..e5ac027a57a 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainers/id_replicationprotectioncontainer.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainers/id_replicationprotectioncontainer.go @@ -40,27 +40,9 @@ func ParseReplicationProtectionContainerID(input string) (*ReplicationProtection return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationProtectionContainerIDInsensitively(input string) (*Replicat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationProtectionContainerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - return &id, nil + return nil } // ValidateReplicationProtectionContainerID checks that 'input' can be parsed as a Replication Protection Container ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainers/id_vault.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainers/id_vault.go index 6e73b89bd30..123feaadd44 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainers/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectioncontainers/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectionintents/id_replicationprotectionintent.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectionintents/id_replicationprotectionintent.go index 4c5fc59a48c..6972c69b12a 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectionintents/id_replicationprotectionintent.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectionintents/id_replicationprotectionintent.go @@ -38,23 +38,9 @@ func ParseReplicationProtectionIntentID(input string) (*ReplicationProtectionInt return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionIntentId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationProtectionIntentName, ok = parsed.Parsed["replicationProtectionIntentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionIntentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationProtectionIntentIDInsensitively(input string) (*Replication return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionIntentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationProtectionIntentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationProtectionIntentName, ok = parsed.Parsed["replicationProtectionIntentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionIntentName", *parsed) + if id.ReplicationProtectionIntentName, ok = input.Parsed["replicationProtectionIntentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionIntentName", input) } - return &id, nil + return nil } // ValidateReplicationProtectionIntentID checks that 'input' can be parsed as a Replication Protection Intent ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectionintents/id_vault.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectionintents/id_vault.go index 045675168a5..8e68c254171 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectionintents/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationprotectionintents/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationrecoveryplans/id_replicationrecoveryplan.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationrecoveryplans/id_replicationrecoveryplan.go index f99b2d54f2b..b7787ae706b 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationrecoveryplans/id_replicationrecoveryplan.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationrecoveryplans/id_replicationrecoveryplan.go @@ -38,23 +38,9 @@ func ParseReplicationRecoveryPlanID(input string) (*ReplicationRecoveryPlanId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationRecoveryPlanId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationRecoveryPlanName, ok = parsed.Parsed["replicationRecoveryPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationRecoveryPlanName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationRecoveryPlanIDInsensitively(input string) (*ReplicationReco return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationRecoveryPlanId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationRecoveryPlanId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationRecoveryPlanName, ok = parsed.Parsed["replicationRecoveryPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationRecoveryPlanName", *parsed) + if id.ReplicationRecoveryPlanName, ok = input.Parsed["replicationRecoveryPlanName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationRecoveryPlanName", input) } - return &id, nil + return nil } // ValidateReplicationRecoveryPlanID checks that 'input' can be parsed as a Replication Recovery Plan ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationrecoveryplans/id_vault.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationrecoveryplans/id_vault.go index 2682100c630..b15709cdd0f 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationrecoveryplans/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationrecoveryplans/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationrecoveryservicesproviders/id_replicationfabric.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationrecoveryservicesproviders/id_replicationfabric.go index 34d30092c2e..12020d9804c 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationrecoveryservicesproviders/id_replicationfabric.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationrecoveryservicesproviders/id_replicationfabric.go @@ -38,23 +38,9 @@ func ParseReplicationFabricID(input string) (*ReplicationFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationFabricIDInsensitively(input string) (*ReplicationFabricId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationFabricId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - return &id, nil + return nil } // ValidateReplicationFabricID checks that 'input' can be parsed as a Replication Fabric ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationrecoveryservicesproviders/id_replicationrecoveryservicesprovider.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationrecoveryservicesproviders/id_replicationrecoveryservicesprovider.go index 7afec8d9785..2edeccae53a 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationrecoveryservicesproviders/id_replicationrecoveryservicesprovider.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationrecoveryservicesproviders/id_replicationrecoveryservicesprovider.go @@ -40,27 +40,9 @@ func ParseReplicationRecoveryServicesProviderID(input string) (*ReplicationRecov return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationRecoveryServicesProviderId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationRecoveryServicesProviderName, ok = parsed.Parsed["replicationRecoveryServicesProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationRecoveryServicesProviderName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationRecoveryServicesProviderIDInsensitively(input string) (*Rep return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationRecoveryServicesProviderId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationRecoveryServicesProviderId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationRecoveryServicesProviderName, ok = parsed.Parsed["replicationRecoveryServicesProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationRecoveryServicesProviderName", *parsed) + if id.ReplicationRecoveryServicesProviderName, ok = input.Parsed["replicationRecoveryServicesProviderName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationRecoveryServicesProviderName", input) } - return &id, nil + return nil } // ValidateReplicationRecoveryServicesProviderID checks that 'input' can be parsed as a Replication Recovery Services Provider ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationrecoveryservicesproviders/id_vault.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationrecoveryservicesproviders/id_vault.go index a80d2f9b1b3..c2d20a2cf82 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationrecoveryservicesproviders/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationrecoveryservicesproviders/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationstorageclassificationmappings/id_replicationstorageclassification.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationstorageclassificationmappings/id_replicationstorageclassification.go index c9e4158848c..aa52aca12f6 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationstorageclassificationmappings/id_replicationstorageclassification.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationstorageclassificationmappings/id_replicationstorageclassification.go @@ -40,27 +40,9 @@ func ParseReplicationStorageClassificationID(input string) (*ReplicationStorageC return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationStorageClassificationId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationStorageClassificationName, ok = parsed.Parsed["replicationStorageClassificationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationStorageClassificationIDInsensitively(input string) (*Replic return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationStorageClassificationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationStorageClassificationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationStorageClassificationName, ok = parsed.Parsed["replicationStorageClassificationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationName", *parsed) + if id.ReplicationStorageClassificationName, ok = input.Parsed["replicationStorageClassificationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationName", input) } - return &id, nil + return nil } // ValidateReplicationStorageClassificationID checks that 'input' can be parsed as a Replication Storage Classification ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationstorageclassificationmappings/id_replicationstorageclassificationmapping.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationstorageclassificationmappings/id_replicationstorageclassificationmapping.go index b5ef125805c..6caeede79df 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationstorageclassificationmappings/id_replicationstorageclassificationmapping.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationstorageclassificationmappings/id_replicationstorageclassificationmapping.go @@ -42,31 +42,9 @@ func ParseReplicationStorageClassificationMappingID(input string) (*ReplicationS return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationStorageClassificationMappingId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationStorageClassificationName, ok = parsed.Parsed["replicationStorageClassificationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationName", *parsed) - } - - if id.ReplicationStorageClassificationMappingName, ok = parsed.Parsed["replicationStorageClassificationMappingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationMappingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseReplicationStorageClassificationMappingIDInsensitively(input string) ( return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationStorageClassificationMappingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ReplicationStorageClassificationMappingId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationStorageClassificationName, ok = parsed.Parsed["replicationStorageClassificationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationName", *parsed) + if id.ReplicationStorageClassificationName, ok = input.Parsed["replicationStorageClassificationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationName", input) } - if id.ReplicationStorageClassificationMappingName, ok = parsed.Parsed["replicationStorageClassificationMappingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationMappingName", *parsed) + if id.ReplicationStorageClassificationMappingName, ok = input.Parsed["replicationStorageClassificationMappingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationMappingName", input) } - return &id, nil + return nil } // ValidateReplicationStorageClassificationMappingID checks that 'input' can be parsed as a Replication Storage Classification Mapping ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationstorageclassificationmappings/id_vault.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationstorageclassificationmappings/id_vault.go index 06f16f6053a..1bb58c8307a 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationstorageclassificationmappings/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationstorageclassificationmappings/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationstorageclassifications/id_replicationfabric.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationstorageclassifications/id_replicationfabric.go index 5f6840e7c65..a91440b70ca 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationstorageclassifications/id_replicationfabric.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationstorageclassifications/id_replicationfabric.go @@ -38,23 +38,9 @@ func ParseReplicationFabricID(input string) (*ReplicationFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationFabricIDInsensitively(input string) (*ReplicationFabricId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationFabricId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - return &id, nil + return nil } // ValidateReplicationFabricID checks that 'input' can be parsed as a Replication Fabric ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationstorageclassifications/id_replicationstorageclassification.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationstorageclassifications/id_replicationstorageclassification.go index ceff72d0b94..e415acfef9e 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationstorageclassifications/id_replicationstorageclassification.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationstorageclassifications/id_replicationstorageclassification.go @@ -40,27 +40,9 @@ func ParseReplicationStorageClassificationID(input string) (*ReplicationStorageC return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationStorageClassificationId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationStorageClassificationName, ok = parsed.Parsed["replicationStorageClassificationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationStorageClassificationIDInsensitively(input string) (*Replic return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationStorageClassificationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationStorageClassificationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationStorageClassificationName, ok = parsed.Parsed["replicationStorageClassificationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationName", *parsed) + if id.ReplicationStorageClassificationName, ok = input.Parsed["replicationStorageClassificationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationName", input) } - return &id, nil + return nil } // ValidateReplicationStorageClassificationID checks that 'input' can be parsed as a Replication Storage Classification ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationstorageclassifications/id_vault.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationstorageclassifications/id_vault.go index 0a08dd4e876..da6d5015c80 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationstorageclassifications/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationstorageclassifications/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationvaulthealth/id_vault.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationvaulthealth/id_vault.go index 36c0195fba0..5755dfb54a6 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationvaulthealth/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationvaulthealth/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationvaultsetting/id_replicationvaultsetting.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationvaultsetting/id_replicationvaultsetting.go index 26e25501d51..806eee37993 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationvaultsetting/id_replicationvaultsetting.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationvaultsetting/id_replicationvaultsetting.go @@ -38,23 +38,9 @@ func ParseReplicationVaultSettingID(input string) (*ReplicationVaultSettingId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationVaultSettingId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationVaultSettingName, ok = parsed.Parsed["replicationVaultSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationVaultSettingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationVaultSettingIDInsensitively(input string) (*ReplicationVaul return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationVaultSettingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationVaultSettingId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationVaultSettingName, ok = parsed.Parsed["replicationVaultSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationVaultSettingName", *parsed) + if id.ReplicationVaultSettingName, ok = input.Parsed["replicationVaultSettingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationVaultSettingName", input) } - return &id, nil + return nil } // ValidateReplicationVaultSettingID checks that 'input' can be parsed as a Replication Vault Setting ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationvaultsetting/id_vault.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationvaultsetting/id_vault.go index accb6845a98..879a3742af7 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationvaultsetting/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationvaultsetting/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationvcenters/id_replicationfabric.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationvcenters/id_replicationfabric.go index 43b4791b4ef..966f39ff0f9 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationvcenters/id_replicationfabric.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationvcenters/id_replicationfabric.go @@ -38,23 +38,9 @@ func ParseReplicationFabricID(input string) (*ReplicationFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationFabricIDInsensitively(input string) (*ReplicationFabricId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationFabricId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - return &id, nil + return nil } // ValidateReplicationFabricID checks that 'input' can be parsed as a Replication Fabric ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationvcenters/id_replicationvcenter.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationvcenters/id_replicationvcenter.go index 1ed680e598b..bc3e7254dfe 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationvcenters/id_replicationvcenter.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationvcenters/id_replicationvcenter.go @@ -40,27 +40,9 @@ func ParseReplicationvCenterID(input string) (*ReplicationvCenterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationvCenterId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationvCenterName, ok = parsed.Parsed["replicationvCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationvCenterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationvCenterIDInsensitively(input string) (*ReplicationvCenterId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationvCenterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationvCenterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationvCenterName, ok = parsed.Parsed["replicationvCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationvCenterName", *parsed) + if id.ReplicationvCenterName, ok = input.Parsed["replicationvCenterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationvCenterName", input) } - return &id, nil + return nil } // ValidateReplicationvCenterID checks that 'input' can be parsed as a Replicationv Center ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationvcenters/id_vault.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationvcenters/id_vault.go index 2c014d1915f..bdf783ba09a 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationvcenters/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/replicationvcenters/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/supportedoperatingsystems/id_vault.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/supportedoperatingsystems/id_vault.go index 41796b3f013..f027ebd1633 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/supportedoperatingsystems/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/supportedoperatingsystems/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2022-10-01/targetcomputesizes/id_replicationprotecteditem.go b/resource-manager/recoveryservicessiterecovery/2022-10-01/targetcomputesizes/id_replicationprotecteditem.go index c16c821a521..0e4d833485d 100644 --- a/resource-manager/recoveryservicessiterecovery/2022-10-01/targetcomputesizes/id_replicationprotecteditem.go +++ b/resource-manager/recoveryservicessiterecovery/2022-10-01/targetcomputesizes/id_replicationprotecteditem.go @@ -42,31 +42,9 @@ func ParseReplicationProtectedItemID(input string) (*ReplicationProtectedItemId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectedItemId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) - } - - if id.ReplicationProtectedItemName, ok = parsed.Parsed["replicationProtectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseReplicationProtectedItemIDInsensitively(input string) (*ReplicationPro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectedItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ReplicationProtectedItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - if id.ReplicationProtectedItemName, ok = parsed.Parsed["replicationProtectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", *parsed) + if id.ReplicationProtectedItemName, ok = input.Parsed["replicationProtectedItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", input) } - return &id, nil + return nil } // ValidateReplicationProtectedItemID checks that 'input' can be parsed as a Replication Protected Item ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/migrationrecoverypoints/id_migrationrecoverypoint.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/migrationrecoverypoints/id_migrationrecoverypoint.go index 85f737b6ac0..6635a133bbd 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/migrationrecoverypoints/id_migrationrecoverypoint.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/migrationrecoverypoints/id_migrationrecoverypoint.go @@ -44,35 +44,9 @@ func ParseMigrationRecoveryPointID(input string) (*MigrationRecoveryPointId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MigrationRecoveryPointId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) - } - - if id.ReplicationMigrationItemName, ok = parsed.Parsed["replicationMigrationItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationMigrationItemName", *parsed) - } - - if id.MigrationRecoveryPointName, ok = parsed.Parsed["migrationRecoveryPointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "migrationRecoveryPointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseMigrationRecoveryPointIDInsensitively(input string) (*MigrationRecover return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MigrationRecoveryPointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *MigrationRecoveryPointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - if id.ReplicationMigrationItemName, ok = parsed.Parsed["replicationMigrationItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationMigrationItemName", *parsed) + if id.ReplicationMigrationItemName, ok = input.Parsed["replicationMigrationItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationMigrationItemName", input) } - if id.MigrationRecoveryPointName, ok = parsed.Parsed["migrationRecoveryPointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "migrationRecoveryPointName", *parsed) + if id.MigrationRecoveryPointName, ok = input.Parsed["migrationRecoveryPointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "migrationRecoveryPointName", input) } - return &id, nil + return nil } // ValidateMigrationRecoveryPointID checks that 'input' can be parsed as a Migration Recovery Point ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/migrationrecoverypoints/id_replicationmigrationitem.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/migrationrecoverypoints/id_replicationmigrationitem.go index cd7a8f23e9c..bf44279baa2 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/migrationrecoverypoints/id_replicationmigrationitem.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/migrationrecoverypoints/id_replicationmigrationitem.go @@ -42,31 +42,9 @@ func ParseReplicationMigrationItemID(input string) (*ReplicationMigrationItemId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationMigrationItemId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) - } - - if id.ReplicationMigrationItemName, ok = parsed.Parsed["replicationMigrationItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationMigrationItemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseReplicationMigrationItemIDInsensitively(input string) (*ReplicationMig return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationMigrationItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ReplicationMigrationItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - if id.ReplicationMigrationItemName, ok = parsed.Parsed["replicationMigrationItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationMigrationItemName", *parsed) + if id.ReplicationMigrationItemName, ok = input.Parsed["replicationMigrationItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationMigrationItemName", input) } - return &id, nil + return nil } // ValidateReplicationMigrationItemID checks that 'input' can be parsed as a Replication Migration Item ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/recoverypoints/id_recoverypoint.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/recoverypoints/id_recoverypoint.go index ad43c081904..2e5b42d0055 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/recoverypoints/id_recoverypoint.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/recoverypoints/id_recoverypoint.go @@ -44,35 +44,9 @@ func ParseRecoveryPointID(input string) (*RecoveryPointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecoveryPointId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) - } - - if id.ReplicationProtectedItemName, ok = parsed.Parsed["replicationProtectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", *parsed) - } - - if id.RecoveryPointName, ok = parsed.Parsed["recoveryPointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseRecoveryPointIDInsensitively(input string) (*RecoveryPointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecoveryPointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RecoveryPointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - if id.ReplicationProtectedItemName, ok = parsed.Parsed["replicationProtectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", *parsed) + if id.ReplicationProtectedItemName, ok = input.Parsed["replicationProtectedItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", input) } - if id.RecoveryPointName, ok = parsed.Parsed["recoveryPointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointName", *parsed) + if id.RecoveryPointName, ok = input.Parsed["recoveryPointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointName", input) } - return &id, nil + return nil } // ValidateRecoveryPointID checks that 'input' can be parsed as a Recovery Point ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/recoverypoints/id_replicationprotecteditem.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/recoverypoints/id_replicationprotecteditem.go index d8eff4f5e4d..4a66a2ef06d 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/recoverypoints/id_replicationprotecteditem.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/recoverypoints/id_replicationprotecteditem.go @@ -42,31 +42,9 @@ func ParseReplicationProtectedItemID(input string) (*ReplicationProtectedItemId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectedItemId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) - } - - if id.ReplicationProtectedItemName, ok = parsed.Parsed["replicationProtectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseReplicationProtectedItemIDInsensitively(input string) (*ReplicationPro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectedItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ReplicationProtectedItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - if id.ReplicationProtectedItemName, ok = parsed.Parsed["replicationProtectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", *parsed) + if id.ReplicationProtectedItemName, ok = input.Parsed["replicationProtectedItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", input) } - return &id, nil + return nil } // ValidateReplicationProtectedItemID checks that 'input' can be parsed as a Replication Protected Item ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationalertsettings/id_replicationalertsetting.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationalertsettings/id_replicationalertsetting.go index fd4bbe7bf22..7cc4b4916cc 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationalertsettings/id_replicationalertsetting.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationalertsettings/id_replicationalertsetting.go @@ -38,23 +38,9 @@ func ParseReplicationAlertSettingID(input string) (*ReplicationAlertSettingId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationAlertSettingId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationAlertSettingName, ok = parsed.Parsed["replicationAlertSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationAlertSettingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationAlertSettingIDInsensitively(input string) (*ReplicationAler return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationAlertSettingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationAlertSettingId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationAlertSettingName, ok = parsed.Parsed["replicationAlertSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationAlertSettingName", *parsed) + if id.ReplicationAlertSettingName, ok = input.Parsed["replicationAlertSettingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationAlertSettingName", input) } - return &id, nil + return nil } // ValidateReplicationAlertSettingID checks that 'input' can be parsed as a Replication Alert Setting ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationalertsettings/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationalertsettings/id_vault.go index e942d185177..42183390cf3 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationalertsettings/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationalertsettings/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationappliances/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationappliances/id_vault.go index c5d015c9cd5..e37d9d05230 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationappliances/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationappliances/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationeligibilityresults/id_virtualmachine.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationeligibilityresults/id_virtualmachine.go index c27fea51a7b..47a386f894f 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationeligibilityresults/id_virtualmachine.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationeligibilityresults/id_virtualmachine.go @@ -36,19 +36,9 @@ func ParseVirtualMachineID(input string) (*VirtualMachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineIDInsensitively(input string) (*VirtualMachineId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - return &id, nil + return nil } // ValidateVirtualMachineID checks that 'input' can be parsed as a Virtual Machine ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationevents/id_replicationevent.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationevents/id_replicationevent.go index 49f794e3ccf..89ea4cefe9d 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationevents/id_replicationevent.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationevents/id_replicationevent.go @@ -38,23 +38,9 @@ func ParseReplicationEventID(input string) (*ReplicationEventId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationEventId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationEventName, ok = parsed.Parsed["replicationEventName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationEventName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationEventIDInsensitively(input string) (*ReplicationEventId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationEventId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationEventId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationEventName, ok = parsed.Parsed["replicationEventName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationEventName", *parsed) + if id.ReplicationEventName, ok = input.Parsed["replicationEventName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationEventName", input) } - return &id, nil + return nil } // ValidateReplicationEventID checks that 'input' can be parsed as a Replication Event ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationevents/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationevents/id_vault.go index 73bfeb6a4b7..3997a813f75 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationevents/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationevents/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationfabrics/id_replicationfabric.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationfabrics/id_replicationfabric.go index db5f8d7ab5e..72935507a8c 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationfabrics/id_replicationfabric.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationfabrics/id_replicationfabric.go @@ -38,23 +38,9 @@ func ParseReplicationFabricID(input string) (*ReplicationFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationFabricIDInsensitively(input string) (*ReplicationFabricId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationFabricId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - return &id, nil + return nil } // ValidateReplicationFabricID checks that 'input' can be parsed as a Replication Fabric ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationfabrics/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationfabrics/id_vault.go index 2a58d893c0e..b88ddbb8e33 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationfabrics/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationfabrics/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationjobs/id_replicationjob.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationjobs/id_replicationjob.go index 5f1c028407b..8aaf763372f 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationjobs/id_replicationjob.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationjobs/id_replicationjob.go @@ -38,23 +38,9 @@ func ParseReplicationJobID(input string) (*ReplicationJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationJobId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationJobName, ok = parsed.Parsed["replicationJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationJobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationJobIDInsensitively(input string) (*ReplicationJobId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationJobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationJobId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationJobName, ok = parsed.Parsed["replicationJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationJobName", *parsed) + if id.ReplicationJobName, ok = input.Parsed["replicationJobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationJobName", input) } - return &id, nil + return nil } // ValidateReplicationJobID checks that 'input' can be parsed as a Replication Job ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationjobs/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationjobs/id_vault.go index d63ce87429f..4da941eb753 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationjobs/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationjobs/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationlogicalnetworks/id_replicationfabric.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationlogicalnetworks/id_replicationfabric.go index a9dcb375bef..d34e37e4196 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationlogicalnetworks/id_replicationfabric.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationlogicalnetworks/id_replicationfabric.go @@ -38,23 +38,9 @@ func ParseReplicationFabricID(input string) (*ReplicationFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationFabricIDInsensitively(input string) (*ReplicationFabricId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationFabricId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - return &id, nil + return nil } // ValidateReplicationFabricID checks that 'input' can be parsed as a Replication Fabric ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationlogicalnetworks/id_replicationlogicalnetwork.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationlogicalnetworks/id_replicationlogicalnetwork.go index 26fb05fb737..67601ab37cb 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationlogicalnetworks/id_replicationlogicalnetwork.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationlogicalnetworks/id_replicationlogicalnetwork.go @@ -40,27 +40,9 @@ func ParseReplicationLogicalNetworkID(input string) (*ReplicationLogicalNetworkI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationLogicalNetworkId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationLogicalNetworkName, ok = parsed.Parsed["replicationLogicalNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationLogicalNetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationLogicalNetworkIDInsensitively(input string) (*ReplicationLo return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationLogicalNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationLogicalNetworkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationLogicalNetworkName, ok = parsed.Parsed["replicationLogicalNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationLogicalNetworkName", *parsed) + if id.ReplicationLogicalNetworkName, ok = input.Parsed["replicationLogicalNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationLogicalNetworkName", input) } - return &id, nil + return nil } // ValidateReplicationLogicalNetworkID checks that 'input' can be parsed as a Replication Logical Network ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationmigrationitems/id_replicationmigrationitem.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationmigrationitems/id_replicationmigrationitem.go index 1f52aff025c..4af937308f0 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationmigrationitems/id_replicationmigrationitem.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationmigrationitems/id_replicationmigrationitem.go @@ -42,31 +42,9 @@ func ParseReplicationMigrationItemID(input string) (*ReplicationMigrationItemId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationMigrationItemId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) - } - - if id.ReplicationMigrationItemName, ok = parsed.Parsed["replicationMigrationItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationMigrationItemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseReplicationMigrationItemIDInsensitively(input string) (*ReplicationMig return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationMigrationItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ReplicationMigrationItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - if id.ReplicationMigrationItemName, ok = parsed.Parsed["replicationMigrationItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationMigrationItemName", *parsed) + if id.ReplicationMigrationItemName, ok = input.Parsed["replicationMigrationItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationMigrationItemName", input) } - return &id, nil + return nil } // ValidateReplicationMigrationItemID checks that 'input' can be parsed as a Replication Migration Item ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationmigrationitems/id_replicationprotectioncontainer.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationmigrationitems/id_replicationprotectioncontainer.go index e977a910480..434724573c3 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationmigrationitems/id_replicationprotectioncontainer.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationmigrationitems/id_replicationprotectioncontainer.go @@ -40,27 +40,9 @@ func ParseReplicationProtectionContainerID(input string) (*ReplicationProtection return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationProtectionContainerIDInsensitively(input string) (*Replicat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationProtectionContainerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - return &id, nil + return nil } // ValidateReplicationProtectionContainerID checks that 'input' can be parsed as a Replication Protection Container ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationmigrationitems/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationmigrationitems/id_vault.go index 58abd104387..e05e06bc8d8 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationmigrationitems/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationmigrationitems/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationnetworkmappings/id_replicationnetwork.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationnetworkmappings/id_replicationnetwork.go index 8f65b4f0ffd..521fb241bed 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationnetworkmappings/id_replicationnetwork.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationnetworkmappings/id_replicationnetwork.go @@ -40,27 +40,9 @@ func ParseReplicationNetworkID(input string) (*ReplicationNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationNetworkId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationNetworkName, ok = parsed.Parsed["replicationNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationNetworkIDInsensitively(input string) (*ReplicationNetworkId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationNetworkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationNetworkName, ok = parsed.Parsed["replicationNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkName", *parsed) + if id.ReplicationNetworkName, ok = input.Parsed["replicationNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkName", input) } - return &id, nil + return nil } // ValidateReplicationNetworkID checks that 'input' can be parsed as a Replication Network ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationnetworkmappings/id_replicationnetworkmapping.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationnetworkmappings/id_replicationnetworkmapping.go index e67c61eed51..5705f27e9b7 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationnetworkmappings/id_replicationnetworkmapping.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationnetworkmappings/id_replicationnetworkmapping.go @@ -42,31 +42,9 @@ func ParseReplicationNetworkMappingID(input string) (*ReplicationNetworkMappingI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationNetworkMappingId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationNetworkName, ok = parsed.Parsed["replicationNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkName", *parsed) - } - - if id.ReplicationNetworkMappingName, ok = parsed.Parsed["replicationNetworkMappingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkMappingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseReplicationNetworkMappingIDInsensitively(input string) (*ReplicationNe return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationNetworkMappingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ReplicationNetworkMappingId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationNetworkName, ok = parsed.Parsed["replicationNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkName", *parsed) + if id.ReplicationNetworkName, ok = input.Parsed["replicationNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkName", input) } - if id.ReplicationNetworkMappingName, ok = parsed.Parsed["replicationNetworkMappingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkMappingName", *parsed) + if id.ReplicationNetworkMappingName, ok = input.Parsed["replicationNetworkMappingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkMappingName", input) } - return &id, nil + return nil } // ValidateReplicationNetworkMappingID checks that 'input' can be parsed as a Replication Network Mapping ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationnetworkmappings/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationnetworkmappings/id_vault.go index 192509d68b9..e154527e540 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationnetworkmappings/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationnetworkmappings/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationnetworks/id_replicationfabric.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationnetworks/id_replicationfabric.go index 73c02b723ee..c46331fc5f7 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationnetworks/id_replicationfabric.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationnetworks/id_replicationfabric.go @@ -38,23 +38,9 @@ func ParseReplicationFabricID(input string) (*ReplicationFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationFabricIDInsensitively(input string) (*ReplicationFabricId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationFabricId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - return &id, nil + return nil } // ValidateReplicationFabricID checks that 'input' can be parsed as a Replication Fabric ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationnetworks/id_replicationnetwork.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationnetworks/id_replicationnetwork.go index e1869f6fb0d..e9f54c2f47a 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationnetworks/id_replicationnetwork.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationnetworks/id_replicationnetwork.go @@ -40,27 +40,9 @@ func ParseReplicationNetworkID(input string) (*ReplicationNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationNetworkId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationNetworkName, ok = parsed.Parsed["replicationNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationNetworkIDInsensitively(input string) (*ReplicationNetworkId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationNetworkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationNetworkName, ok = parsed.Parsed["replicationNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkName", *parsed) + if id.ReplicationNetworkName, ok = input.Parsed["replicationNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkName", input) } - return &id, nil + return nil } // ValidateReplicationNetworkID checks that 'input' can be parsed as a Replication Network ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationnetworks/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationnetworks/id_vault.go index 0bfde13c55d..6e0f3a3d4a3 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationnetworks/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationnetworks/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationpolicies/id_replicationpolicy.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationpolicies/id_replicationpolicy.go index c9d0ad0e634..a75a6de5d56 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationpolicies/id_replicationpolicy.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationpolicies/id_replicationpolicy.go @@ -38,23 +38,9 @@ func ParseReplicationPolicyID(input string) (*ReplicationPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationPolicyId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationPolicyName, ok = parsed.Parsed["replicationPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationPolicyIDInsensitively(input string) (*ReplicationPolicyId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationPolicyName, ok = parsed.Parsed["replicationPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationPolicyName", *parsed) + if id.ReplicationPolicyName, ok = input.Parsed["replicationPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationPolicyName", input) } - return &id, nil + return nil } // ValidateReplicationPolicyID checks that 'input' can be parsed as a Replication Policy ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationpolicies/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationpolicies/id_vault.go index f4a5bf6b711..6a89bd687a5 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationpolicies/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationpolicies/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotectableitems/id_replicationprotectableitem.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotectableitems/id_replicationprotectableitem.go index f7f0b3936ce..90f92bce414 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotectableitems/id_replicationprotectableitem.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotectableitems/id_replicationprotectableitem.go @@ -42,31 +42,9 @@ func ParseReplicationProtectableItemID(input string) (*ReplicationProtectableIte return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectableItemId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) - } - - if id.ReplicationProtectableItemName, ok = parsed.Parsed["replicationProtectableItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectableItemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseReplicationProtectableItemIDInsensitively(input string) (*ReplicationP return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectableItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ReplicationProtectableItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - if id.ReplicationProtectableItemName, ok = parsed.Parsed["replicationProtectableItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectableItemName", *parsed) + if id.ReplicationProtectableItemName, ok = input.Parsed["replicationProtectableItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectableItemName", input) } - return &id, nil + return nil } // ValidateReplicationProtectableItemID checks that 'input' can be parsed as a Replication Protectable Item ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotectableitems/id_replicationprotectioncontainer.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotectableitems/id_replicationprotectioncontainer.go index 927a68eca8c..ce37ff1bc04 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotectableitems/id_replicationprotectioncontainer.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotectableitems/id_replicationprotectioncontainer.go @@ -40,27 +40,9 @@ func ParseReplicationProtectionContainerID(input string) (*ReplicationProtection return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationProtectionContainerIDInsensitively(input string) (*Replicat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationProtectionContainerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - return &id, nil + return nil } // ValidateReplicationProtectionContainerID checks that 'input' can be parsed as a Replication Protection Container ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotecteditems/id_replicationprotecteditem.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotecteditems/id_replicationprotecteditem.go index 557ea1c29ea..1857f1b1c6d 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotecteditems/id_replicationprotecteditem.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotecteditems/id_replicationprotecteditem.go @@ -42,31 +42,9 @@ func ParseReplicationProtectedItemID(input string) (*ReplicationProtectedItemId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectedItemId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) - } - - if id.ReplicationProtectedItemName, ok = parsed.Parsed["replicationProtectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseReplicationProtectedItemIDInsensitively(input string) (*ReplicationPro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectedItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ReplicationProtectedItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - if id.ReplicationProtectedItemName, ok = parsed.Parsed["replicationProtectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", *parsed) + if id.ReplicationProtectedItemName, ok = input.Parsed["replicationProtectedItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", input) } - return &id, nil + return nil } // ValidateReplicationProtectedItemID checks that 'input' can be parsed as a Replication Protected Item ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotecteditems/id_replicationprotectioncontainer.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotecteditems/id_replicationprotectioncontainer.go index 4c5b4524f12..8f0abd62b2c 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotecteditems/id_replicationprotectioncontainer.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotecteditems/id_replicationprotectioncontainer.go @@ -40,27 +40,9 @@ func ParseReplicationProtectionContainerID(input string) (*ReplicationProtection return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationProtectionContainerIDInsensitively(input string) (*Replicat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationProtectionContainerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - return &id, nil + return nil } // ValidateReplicationProtectionContainerID checks that 'input' can be parsed as a Replication Protection Container ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotecteditems/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotecteditems/id_vault.go index 1e669936aab..dbbb913e424 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotecteditems/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotecteditems/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotectioncontainermappings/id_replicationprotectioncontainer.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotectioncontainermappings/id_replicationprotectioncontainer.go index c1b2a09565d..0c905cb402a 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotectioncontainermappings/id_replicationprotectioncontainer.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotectioncontainermappings/id_replicationprotectioncontainer.go @@ -40,27 +40,9 @@ func ParseReplicationProtectionContainerID(input string) (*ReplicationProtection return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationProtectionContainerIDInsensitively(input string) (*Replicat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationProtectionContainerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - return &id, nil + return nil } // ValidateReplicationProtectionContainerID checks that 'input' can be parsed as a Replication Protection Container ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotectioncontainermappings/id_replicationprotectioncontainermapping.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotectioncontainermappings/id_replicationprotectioncontainermapping.go index 3a5c8ab08a9..7c336381006 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotectioncontainermappings/id_replicationprotectioncontainermapping.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotectioncontainermappings/id_replicationprotectioncontainermapping.go @@ -42,31 +42,9 @@ func ParseReplicationProtectionContainerMappingID(input string) (*ReplicationPro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerMappingId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) - } - - if id.ReplicationProtectionContainerMappingName, ok = parsed.Parsed["replicationProtectionContainerMappingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerMappingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseReplicationProtectionContainerMappingIDInsensitively(input string) (*R return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerMappingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ReplicationProtectionContainerMappingId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - if id.ReplicationProtectionContainerMappingName, ok = parsed.Parsed["replicationProtectionContainerMappingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerMappingName", *parsed) + if id.ReplicationProtectionContainerMappingName, ok = input.Parsed["replicationProtectionContainerMappingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerMappingName", input) } - return &id, nil + return nil } // ValidateReplicationProtectionContainerMappingID checks that 'input' can be parsed as a Replication Protection Container Mapping ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotectioncontainermappings/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotectioncontainermappings/id_vault.go index 7aa36b783ff..2a63a1f3299 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotectioncontainermappings/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotectioncontainermappings/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotectioncontainers/id_replicationfabric.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotectioncontainers/id_replicationfabric.go index c8c5de12a39..7668b03a571 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotectioncontainers/id_replicationfabric.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotectioncontainers/id_replicationfabric.go @@ -38,23 +38,9 @@ func ParseReplicationFabricID(input string) (*ReplicationFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationFabricIDInsensitively(input string) (*ReplicationFabricId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationFabricId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - return &id, nil + return nil } // ValidateReplicationFabricID checks that 'input' can be parsed as a Replication Fabric ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotectioncontainers/id_replicationprotectioncontainer.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotectioncontainers/id_replicationprotectioncontainer.go index 41b97b229a1..e5ac027a57a 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotectioncontainers/id_replicationprotectioncontainer.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotectioncontainers/id_replicationprotectioncontainer.go @@ -40,27 +40,9 @@ func ParseReplicationProtectionContainerID(input string) (*ReplicationProtection return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationProtectionContainerIDInsensitively(input string) (*Replicat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationProtectionContainerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - return &id, nil + return nil } // ValidateReplicationProtectionContainerID checks that 'input' can be parsed as a Replication Protection Container ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotectioncontainers/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotectioncontainers/id_vault.go index 6e73b89bd30..123feaadd44 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotectioncontainers/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotectioncontainers/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotectionintents/id_replicationprotectionintent.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotectionintents/id_replicationprotectionintent.go index 4c5fc59a48c..6972c69b12a 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotectionintents/id_replicationprotectionintent.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotectionintents/id_replicationprotectionintent.go @@ -38,23 +38,9 @@ func ParseReplicationProtectionIntentID(input string) (*ReplicationProtectionInt return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionIntentId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationProtectionIntentName, ok = parsed.Parsed["replicationProtectionIntentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionIntentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationProtectionIntentIDInsensitively(input string) (*Replication return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionIntentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationProtectionIntentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationProtectionIntentName, ok = parsed.Parsed["replicationProtectionIntentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionIntentName", *parsed) + if id.ReplicationProtectionIntentName, ok = input.Parsed["replicationProtectionIntentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionIntentName", input) } - return &id, nil + return nil } // ValidateReplicationProtectionIntentID checks that 'input' can be parsed as a Replication Protection Intent ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotectionintents/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotectionintents/id_vault.go index 045675168a5..8e68c254171 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotectionintents/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationprotectionintents/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationrecoveryplans/id_replicationrecoveryplan.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationrecoveryplans/id_replicationrecoveryplan.go index f99b2d54f2b..b7787ae706b 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationrecoveryplans/id_replicationrecoveryplan.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationrecoveryplans/id_replicationrecoveryplan.go @@ -38,23 +38,9 @@ func ParseReplicationRecoveryPlanID(input string) (*ReplicationRecoveryPlanId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationRecoveryPlanId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationRecoveryPlanName, ok = parsed.Parsed["replicationRecoveryPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationRecoveryPlanName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationRecoveryPlanIDInsensitively(input string) (*ReplicationReco return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationRecoveryPlanId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationRecoveryPlanId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationRecoveryPlanName, ok = parsed.Parsed["replicationRecoveryPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationRecoveryPlanName", *parsed) + if id.ReplicationRecoveryPlanName, ok = input.Parsed["replicationRecoveryPlanName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationRecoveryPlanName", input) } - return &id, nil + return nil } // ValidateReplicationRecoveryPlanID checks that 'input' can be parsed as a Replication Recovery Plan ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationrecoveryplans/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationrecoveryplans/id_vault.go index 2682100c630..b15709cdd0f 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationrecoveryplans/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationrecoveryplans/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationrecoveryservicesproviders/id_replicationfabric.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationrecoveryservicesproviders/id_replicationfabric.go index 34d30092c2e..12020d9804c 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationrecoveryservicesproviders/id_replicationfabric.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationrecoveryservicesproviders/id_replicationfabric.go @@ -38,23 +38,9 @@ func ParseReplicationFabricID(input string) (*ReplicationFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationFabricIDInsensitively(input string) (*ReplicationFabricId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationFabricId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - return &id, nil + return nil } // ValidateReplicationFabricID checks that 'input' can be parsed as a Replication Fabric ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationrecoveryservicesproviders/id_replicationrecoveryservicesprovider.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationrecoveryservicesproviders/id_replicationrecoveryservicesprovider.go index 7afec8d9785..2edeccae53a 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationrecoveryservicesproviders/id_replicationrecoveryservicesprovider.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationrecoveryservicesproviders/id_replicationrecoveryservicesprovider.go @@ -40,27 +40,9 @@ func ParseReplicationRecoveryServicesProviderID(input string) (*ReplicationRecov return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationRecoveryServicesProviderId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationRecoveryServicesProviderName, ok = parsed.Parsed["replicationRecoveryServicesProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationRecoveryServicesProviderName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationRecoveryServicesProviderIDInsensitively(input string) (*Rep return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationRecoveryServicesProviderId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationRecoveryServicesProviderId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationRecoveryServicesProviderName, ok = parsed.Parsed["replicationRecoveryServicesProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationRecoveryServicesProviderName", *parsed) + if id.ReplicationRecoveryServicesProviderName, ok = input.Parsed["replicationRecoveryServicesProviderName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationRecoveryServicesProviderName", input) } - return &id, nil + return nil } // ValidateReplicationRecoveryServicesProviderID checks that 'input' can be parsed as a Replication Recovery Services Provider ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationrecoveryservicesproviders/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationrecoveryservicesproviders/id_vault.go index a80d2f9b1b3..c2d20a2cf82 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationrecoveryservicesproviders/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationrecoveryservicesproviders/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationstorageclassificationmappings/id_replicationstorageclassification.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationstorageclassificationmappings/id_replicationstorageclassification.go index c9e4158848c..aa52aca12f6 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationstorageclassificationmappings/id_replicationstorageclassification.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationstorageclassificationmappings/id_replicationstorageclassification.go @@ -40,27 +40,9 @@ func ParseReplicationStorageClassificationID(input string) (*ReplicationStorageC return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationStorageClassificationId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationStorageClassificationName, ok = parsed.Parsed["replicationStorageClassificationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationStorageClassificationIDInsensitively(input string) (*Replic return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationStorageClassificationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationStorageClassificationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationStorageClassificationName, ok = parsed.Parsed["replicationStorageClassificationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationName", *parsed) + if id.ReplicationStorageClassificationName, ok = input.Parsed["replicationStorageClassificationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationName", input) } - return &id, nil + return nil } // ValidateReplicationStorageClassificationID checks that 'input' can be parsed as a Replication Storage Classification ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationstorageclassificationmappings/id_replicationstorageclassificationmapping.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationstorageclassificationmappings/id_replicationstorageclassificationmapping.go index b5ef125805c..6caeede79df 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationstorageclassificationmappings/id_replicationstorageclassificationmapping.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationstorageclassificationmappings/id_replicationstorageclassificationmapping.go @@ -42,31 +42,9 @@ func ParseReplicationStorageClassificationMappingID(input string) (*ReplicationS return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationStorageClassificationMappingId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationStorageClassificationName, ok = parsed.Parsed["replicationStorageClassificationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationName", *parsed) - } - - if id.ReplicationStorageClassificationMappingName, ok = parsed.Parsed["replicationStorageClassificationMappingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationMappingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseReplicationStorageClassificationMappingIDInsensitively(input string) ( return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationStorageClassificationMappingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ReplicationStorageClassificationMappingId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationStorageClassificationName, ok = parsed.Parsed["replicationStorageClassificationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationName", *parsed) + if id.ReplicationStorageClassificationName, ok = input.Parsed["replicationStorageClassificationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationName", input) } - if id.ReplicationStorageClassificationMappingName, ok = parsed.Parsed["replicationStorageClassificationMappingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationMappingName", *parsed) + if id.ReplicationStorageClassificationMappingName, ok = input.Parsed["replicationStorageClassificationMappingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationMappingName", input) } - return &id, nil + return nil } // ValidateReplicationStorageClassificationMappingID checks that 'input' can be parsed as a Replication Storage Classification Mapping ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationstorageclassificationmappings/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationstorageclassificationmappings/id_vault.go index 06f16f6053a..1bb58c8307a 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationstorageclassificationmappings/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationstorageclassificationmappings/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationstorageclassifications/id_replicationfabric.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationstorageclassifications/id_replicationfabric.go index 5f6840e7c65..a91440b70ca 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationstorageclassifications/id_replicationfabric.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationstorageclassifications/id_replicationfabric.go @@ -38,23 +38,9 @@ func ParseReplicationFabricID(input string) (*ReplicationFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationFabricIDInsensitively(input string) (*ReplicationFabricId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationFabricId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - return &id, nil + return nil } // ValidateReplicationFabricID checks that 'input' can be parsed as a Replication Fabric ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationstorageclassifications/id_replicationstorageclassification.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationstorageclassifications/id_replicationstorageclassification.go index ceff72d0b94..e415acfef9e 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationstorageclassifications/id_replicationstorageclassification.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationstorageclassifications/id_replicationstorageclassification.go @@ -40,27 +40,9 @@ func ParseReplicationStorageClassificationID(input string) (*ReplicationStorageC return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationStorageClassificationId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationStorageClassificationName, ok = parsed.Parsed["replicationStorageClassificationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationStorageClassificationIDInsensitively(input string) (*Replic return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationStorageClassificationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationStorageClassificationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationStorageClassificationName, ok = parsed.Parsed["replicationStorageClassificationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationName", *parsed) + if id.ReplicationStorageClassificationName, ok = input.Parsed["replicationStorageClassificationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationName", input) } - return &id, nil + return nil } // ValidateReplicationStorageClassificationID checks that 'input' can be parsed as a Replication Storage Classification ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationstorageclassifications/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationstorageclassifications/id_vault.go index 0a08dd4e876..da6d5015c80 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationstorageclassifications/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationstorageclassifications/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationvaulthealth/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationvaulthealth/id_vault.go index 36c0195fba0..5755dfb54a6 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationvaulthealth/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationvaulthealth/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationvaultsetting/id_replicationvaultsetting.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationvaultsetting/id_replicationvaultsetting.go index 26e25501d51..806eee37993 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationvaultsetting/id_replicationvaultsetting.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationvaultsetting/id_replicationvaultsetting.go @@ -38,23 +38,9 @@ func ParseReplicationVaultSettingID(input string) (*ReplicationVaultSettingId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationVaultSettingId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationVaultSettingName, ok = parsed.Parsed["replicationVaultSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationVaultSettingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationVaultSettingIDInsensitively(input string) (*ReplicationVaul return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationVaultSettingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationVaultSettingId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationVaultSettingName, ok = parsed.Parsed["replicationVaultSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationVaultSettingName", *parsed) + if id.ReplicationVaultSettingName, ok = input.Parsed["replicationVaultSettingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationVaultSettingName", input) } - return &id, nil + return nil } // ValidateReplicationVaultSettingID checks that 'input' can be parsed as a Replication Vault Setting ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationvaultsetting/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationvaultsetting/id_vault.go index accb6845a98..879a3742af7 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationvaultsetting/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationvaultsetting/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationvcenters/id_replicationfabric.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationvcenters/id_replicationfabric.go index 43b4791b4ef..966f39ff0f9 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationvcenters/id_replicationfabric.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationvcenters/id_replicationfabric.go @@ -38,23 +38,9 @@ func ParseReplicationFabricID(input string) (*ReplicationFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationFabricIDInsensitively(input string) (*ReplicationFabricId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationFabricId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - return &id, nil + return nil } // ValidateReplicationFabricID checks that 'input' can be parsed as a Replication Fabric ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationvcenters/id_replicationvcenter.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationvcenters/id_replicationvcenter.go index 1ed680e598b..bc3e7254dfe 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationvcenters/id_replicationvcenter.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationvcenters/id_replicationvcenter.go @@ -40,27 +40,9 @@ func ParseReplicationvCenterID(input string) (*ReplicationvCenterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationvCenterId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationvCenterName, ok = parsed.Parsed["replicationvCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationvCenterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationvCenterIDInsensitively(input string) (*ReplicationvCenterId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationvCenterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationvCenterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationvCenterName, ok = parsed.Parsed["replicationvCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationvCenterName", *parsed) + if id.ReplicationvCenterName, ok = input.Parsed["replicationvCenterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationvCenterName", input) } - return &id, nil + return nil } // ValidateReplicationvCenterID checks that 'input' can be parsed as a Replicationv Center ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationvcenters/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationvcenters/id_vault.go index 2c014d1915f..bdf783ba09a 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationvcenters/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/replicationvcenters/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/supportedoperatingsystems/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/supportedoperatingsystems/id_vault.go index 41796b3f013..f027ebd1633 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/supportedoperatingsystems/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/supportedoperatingsystems/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-01-01/targetcomputesizes/id_replicationprotecteditem.go b/resource-manager/recoveryservicessiterecovery/2023-01-01/targetcomputesizes/id_replicationprotecteditem.go index c16c821a521..0e4d833485d 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-01-01/targetcomputesizes/id_replicationprotecteditem.go +++ b/resource-manager/recoveryservicessiterecovery/2023-01-01/targetcomputesizes/id_replicationprotecteditem.go @@ -42,31 +42,9 @@ func ParseReplicationProtectedItemID(input string) (*ReplicationProtectedItemId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectedItemId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) - } - - if id.ReplicationProtectedItemName, ok = parsed.Parsed["replicationProtectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseReplicationProtectedItemIDInsensitively(input string) (*ReplicationPro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectedItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ReplicationProtectedItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - if id.ReplicationProtectedItemName, ok = parsed.Parsed["replicationProtectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", *parsed) + if id.ReplicationProtectedItemName, ok = input.Parsed["replicationProtectedItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", input) } - return &id, nil + return nil } // ValidateReplicationProtectedItemID checks that 'input' can be parsed as a Replication Protected Item ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/migrationrecoverypoints/id_migrationrecoverypoint.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/migrationrecoverypoints/id_migrationrecoverypoint.go index 85f737b6ac0..6635a133bbd 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/migrationrecoverypoints/id_migrationrecoverypoint.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/migrationrecoverypoints/id_migrationrecoverypoint.go @@ -44,35 +44,9 @@ func ParseMigrationRecoveryPointID(input string) (*MigrationRecoveryPointId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MigrationRecoveryPointId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) - } - - if id.ReplicationMigrationItemName, ok = parsed.Parsed["replicationMigrationItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationMigrationItemName", *parsed) - } - - if id.MigrationRecoveryPointName, ok = parsed.Parsed["migrationRecoveryPointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "migrationRecoveryPointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseMigrationRecoveryPointIDInsensitively(input string) (*MigrationRecover return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MigrationRecoveryPointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *MigrationRecoveryPointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - if id.ReplicationMigrationItemName, ok = parsed.Parsed["replicationMigrationItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationMigrationItemName", *parsed) + if id.ReplicationMigrationItemName, ok = input.Parsed["replicationMigrationItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationMigrationItemName", input) } - if id.MigrationRecoveryPointName, ok = parsed.Parsed["migrationRecoveryPointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "migrationRecoveryPointName", *parsed) + if id.MigrationRecoveryPointName, ok = input.Parsed["migrationRecoveryPointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "migrationRecoveryPointName", input) } - return &id, nil + return nil } // ValidateMigrationRecoveryPointID checks that 'input' can be parsed as a Migration Recovery Point ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/migrationrecoverypoints/id_replicationmigrationitem.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/migrationrecoverypoints/id_replicationmigrationitem.go index cd7a8f23e9c..bf44279baa2 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/migrationrecoverypoints/id_replicationmigrationitem.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/migrationrecoverypoints/id_replicationmigrationitem.go @@ -42,31 +42,9 @@ func ParseReplicationMigrationItemID(input string) (*ReplicationMigrationItemId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationMigrationItemId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) - } - - if id.ReplicationMigrationItemName, ok = parsed.Parsed["replicationMigrationItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationMigrationItemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseReplicationMigrationItemIDInsensitively(input string) (*ReplicationMig return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationMigrationItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ReplicationMigrationItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - if id.ReplicationMigrationItemName, ok = parsed.Parsed["replicationMigrationItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationMigrationItemName", *parsed) + if id.ReplicationMigrationItemName, ok = input.Parsed["replicationMigrationItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationMigrationItemName", input) } - return &id, nil + return nil } // ValidateReplicationMigrationItemID checks that 'input' can be parsed as a Replication Migration Item ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/recoverypoints/id_recoverypoint.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/recoverypoints/id_recoverypoint.go index ad43c081904..2e5b42d0055 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/recoverypoints/id_recoverypoint.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/recoverypoints/id_recoverypoint.go @@ -44,35 +44,9 @@ func ParseRecoveryPointID(input string) (*RecoveryPointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecoveryPointId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) - } - - if id.ReplicationProtectedItemName, ok = parsed.Parsed["replicationProtectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", *parsed) - } - - if id.RecoveryPointName, ok = parsed.Parsed["recoveryPointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseRecoveryPointIDInsensitively(input string) (*RecoveryPointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecoveryPointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RecoveryPointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - if id.ReplicationProtectedItemName, ok = parsed.Parsed["replicationProtectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", *parsed) + if id.ReplicationProtectedItemName, ok = input.Parsed["replicationProtectedItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", input) } - if id.RecoveryPointName, ok = parsed.Parsed["recoveryPointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointName", *parsed) + if id.RecoveryPointName, ok = input.Parsed["recoveryPointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointName", input) } - return &id, nil + return nil } // ValidateRecoveryPointID checks that 'input' can be parsed as a Recovery Point ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/recoverypoints/id_replicationprotecteditem.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/recoverypoints/id_replicationprotecteditem.go index d8eff4f5e4d..4a66a2ef06d 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/recoverypoints/id_replicationprotecteditem.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/recoverypoints/id_replicationprotecteditem.go @@ -42,31 +42,9 @@ func ParseReplicationProtectedItemID(input string) (*ReplicationProtectedItemId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectedItemId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) - } - - if id.ReplicationProtectedItemName, ok = parsed.Parsed["replicationProtectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseReplicationProtectedItemIDInsensitively(input string) (*ReplicationPro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectedItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ReplicationProtectedItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - if id.ReplicationProtectedItemName, ok = parsed.Parsed["replicationProtectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", *parsed) + if id.ReplicationProtectedItemName, ok = input.Parsed["replicationProtectedItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", input) } - return &id, nil + return nil } // ValidateReplicationProtectedItemID checks that 'input' can be parsed as a Replication Protected Item ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationalertsettings/id_replicationalertsetting.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationalertsettings/id_replicationalertsetting.go index fd4bbe7bf22..7cc4b4916cc 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationalertsettings/id_replicationalertsetting.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationalertsettings/id_replicationalertsetting.go @@ -38,23 +38,9 @@ func ParseReplicationAlertSettingID(input string) (*ReplicationAlertSettingId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationAlertSettingId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationAlertSettingName, ok = parsed.Parsed["replicationAlertSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationAlertSettingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationAlertSettingIDInsensitively(input string) (*ReplicationAler return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationAlertSettingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationAlertSettingId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationAlertSettingName, ok = parsed.Parsed["replicationAlertSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationAlertSettingName", *parsed) + if id.ReplicationAlertSettingName, ok = input.Parsed["replicationAlertSettingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationAlertSettingName", input) } - return &id, nil + return nil } // ValidateReplicationAlertSettingID checks that 'input' can be parsed as a Replication Alert Setting ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationalertsettings/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationalertsettings/id_vault.go index e942d185177..42183390cf3 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationalertsettings/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationalertsettings/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationappliances/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationappliances/id_vault.go index c5d015c9cd5..e37d9d05230 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationappliances/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationappliances/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationeligibilityresults/id_virtualmachine.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationeligibilityresults/id_virtualmachine.go index c27fea51a7b..47a386f894f 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationeligibilityresults/id_virtualmachine.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationeligibilityresults/id_virtualmachine.go @@ -36,19 +36,9 @@ func ParseVirtualMachineID(input string) (*VirtualMachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineIDInsensitively(input string) (*VirtualMachineId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - return &id, nil + return nil } // ValidateVirtualMachineID checks that 'input' can be parsed as a Virtual Machine ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationevents/id_replicationevent.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationevents/id_replicationevent.go index 49f794e3ccf..89ea4cefe9d 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationevents/id_replicationevent.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationevents/id_replicationevent.go @@ -38,23 +38,9 @@ func ParseReplicationEventID(input string) (*ReplicationEventId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationEventId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationEventName, ok = parsed.Parsed["replicationEventName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationEventName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationEventIDInsensitively(input string) (*ReplicationEventId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationEventId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationEventId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationEventName, ok = parsed.Parsed["replicationEventName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationEventName", *parsed) + if id.ReplicationEventName, ok = input.Parsed["replicationEventName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationEventName", input) } - return &id, nil + return nil } // ValidateReplicationEventID checks that 'input' can be parsed as a Replication Event ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationevents/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationevents/id_vault.go index 73bfeb6a4b7..3997a813f75 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationevents/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationevents/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationfabrics/id_replicationfabric.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationfabrics/id_replicationfabric.go index db5f8d7ab5e..72935507a8c 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationfabrics/id_replicationfabric.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationfabrics/id_replicationfabric.go @@ -38,23 +38,9 @@ func ParseReplicationFabricID(input string) (*ReplicationFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationFabricIDInsensitively(input string) (*ReplicationFabricId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationFabricId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - return &id, nil + return nil } // ValidateReplicationFabricID checks that 'input' can be parsed as a Replication Fabric ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationfabrics/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationfabrics/id_vault.go index 2a58d893c0e..b88ddbb8e33 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationfabrics/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationfabrics/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationjobs/id_replicationjob.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationjobs/id_replicationjob.go index 5f1c028407b..8aaf763372f 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationjobs/id_replicationjob.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationjobs/id_replicationjob.go @@ -38,23 +38,9 @@ func ParseReplicationJobID(input string) (*ReplicationJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationJobId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationJobName, ok = parsed.Parsed["replicationJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationJobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationJobIDInsensitively(input string) (*ReplicationJobId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationJobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationJobId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationJobName, ok = parsed.Parsed["replicationJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationJobName", *parsed) + if id.ReplicationJobName, ok = input.Parsed["replicationJobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationJobName", input) } - return &id, nil + return nil } // ValidateReplicationJobID checks that 'input' can be parsed as a Replication Job ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationjobs/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationjobs/id_vault.go index d63ce87429f..4da941eb753 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationjobs/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationjobs/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationlogicalnetworks/id_replicationfabric.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationlogicalnetworks/id_replicationfabric.go index a9dcb375bef..d34e37e4196 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationlogicalnetworks/id_replicationfabric.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationlogicalnetworks/id_replicationfabric.go @@ -38,23 +38,9 @@ func ParseReplicationFabricID(input string) (*ReplicationFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationFabricIDInsensitively(input string) (*ReplicationFabricId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationFabricId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - return &id, nil + return nil } // ValidateReplicationFabricID checks that 'input' can be parsed as a Replication Fabric ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationlogicalnetworks/id_replicationlogicalnetwork.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationlogicalnetworks/id_replicationlogicalnetwork.go index 26fb05fb737..67601ab37cb 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationlogicalnetworks/id_replicationlogicalnetwork.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationlogicalnetworks/id_replicationlogicalnetwork.go @@ -40,27 +40,9 @@ func ParseReplicationLogicalNetworkID(input string) (*ReplicationLogicalNetworkI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationLogicalNetworkId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationLogicalNetworkName, ok = parsed.Parsed["replicationLogicalNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationLogicalNetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationLogicalNetworkIDInsensitively(input string) (*ReplicationLo return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationLogicalNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationLogicalNetworkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationLogicalNetworkName, ok = parsed.Parsed["replicationLogicalNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationLogicalNetworkName", *parsed) + if id.ReplicationLogicalNetworkName, ok = input.Parsed["replicationLogicalNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationLogicalNetworkName", input) } - return &id, nil + return nil } // ValidateReplicationLogicalNetworkID checks that 'input' can be parsed as a Replication Logical Network ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationmigrationitems/id_replicationmigrationitem.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationmigrationitems/id_replicationmigrationitem.go index 1f52aff025c..4af937308f0 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationmigrationitems/id_replicationmigrationitem.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationmigrationitems/id_replicationmigrationitem.go @@ -42,31 +42,9 @@ func ParseReplicationMigrationItemID(input string) (*ReplicationMigrationItemId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationMigrationItemId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) - } - - if id.ReplicationMigrationItemName, ok = parsed.Parsed["replicationMigrationItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationMigrationItemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseReplicationMigrationItemIDInsensitively(input string) (*ReplicationMig return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationMigrationItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ReplicationMigrationItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - if id.ReplicationMigrationItemName, ok = parsed.Parsed["replicationMigrationItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationMigrationItemName", *parsed) + if id.ReplicationMigrationItemName, ok = input.Parsed["replicationMigrationItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationMigrationItemName", input) } - return &id, nil + return nil } // ValidateReplicationMigrationItemID checks that 'input' can be parsed as a Replication Migration Item ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationmigrationitems/id_replicationprotectioncontainer.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationmigrationitems/id_replicationprotectioncontainer.go index e977a910480..434724573c3 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationmigrationitems/id_replicationprotectioncontainer.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationmigrationitems/id_replicationprotectioncontainer.go @@ -40,27 +40,9 @@ func ParseReplicationProtectionContainerID(input string) (*ReplicationProtection return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationProtectionContainerIDInsensitively(input string) (*Replicat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationProtectionContainerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - return &id, nil + return nil } // ValidateReplicationProtectionContainerID checks that 'input' can be parsed as a Replication Protection Container ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationmigrationitems/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationmigrationitems/id_vault.go index 58abd104387..e05e06bc8d8 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationmigrationitems/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationmigrationitems/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationnetworkmappings/id_replicationnetwork.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationnetworkmappings/id_replicationnetwork.go index 8f65b4f0ffd..521fb241bed 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationnetworkmappings/id_replicationnetwork.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationnetworkmappings/id_replicationnetwork.go @@ -40,27 +40,9 @@ func ParseReplicationNetworkID(input string) (*ReplicationNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationNetworkId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationNetworkName, ok = parsed.Parsed["replicationNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationNetworkIDInsensitively(input string) (*ReplicationNetworkId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationNetworkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationNetworkName, ok = parsed.Parsed["replicationNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkName", *parsed) + if id.ReplicationNetworkName, ok = input.Parsed["replicationNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkName", input) } - return &id, nil + return nil } // ValidateReplicationNetworkID checks that 'input' can be parsed as a Replication Network ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationnetworkmappings/id_replicationnetworkmapping.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationnetworkmappings/id_replicationnetworkmapping.go index e67c61eed51..5705f27e9b7 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationnetworkmappings/id_replicationnetworkmapping.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationnetworkmappings/id_replicationnetworkmapping.go @@ -42,31 +42,9 @@ func ParseReplicationNetworkMappingID(input string) (*ReplicationNetworkMappingI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationNetworkMappingId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationNetworkName, ok = parsed.Parsed["replicationNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkName", *parsed) - } - - if id.ReplicationNetworkMappingName, ok = parsed.Parsed["replicationNetworkMappingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkMappingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseReplicationNetworkMappingIDInsensitively(input string) (*ReplicationNe return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationNetworkMappingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ReplicationNetworkMappingId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationNetworkName, ok = parsed.Parsed["replicationNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkName", *parsed) + if id.ReplicationNetworkName, ok = input.Parsed["replicationNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkName", input) } - if id.ReplicationNetworkMappingName, ok = parsed.Parsed["replicationNetworkMappingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkMappingName", *parsed) + if id.ReplicationNetworkMappingName, ok = input.Parsed["replicationNetworkMappingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkMappingName", input) } - return &id, nil + return nil } // ValidateReplicationNetworkMappingID checks that 'input' can be parsed as a Replication Network Mapping ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationnetworkmappings/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationnetworkmappings/id_vault.go index 192509d68b9..e154527e540 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationnetworkmappings/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationnetworkmappings/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationnetworks/id_replicationfabric.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationnetworks/id_replicationfabric.go index 73c02b723ee..c46331fc5f7 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationnetworks/id_replicationfabric.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationnetworks/id_replicationfabric.go @@ -38,23 +38,9 @@ func ParseReplicationFabricID(input string) (*ReplicationFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationFabricIDInsensitively(input string) (*ReplicationFabricId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationFabricId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - return &id, nil + return nil } // ValidateReplicationFabricID checks that 'input' can be parsed as a Replication Fabric ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationnetworks/id_replicationnetwork.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationnetworks/id_replicationnetwork.go index e1869f6fb0d..e9f54c2f47a 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationnetworks/id_replicationnetwork.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationnetworks/id_replicationnetwork.go @@ -40,27 +40,9 @@ func ParseReplicationNetworkID(input string) (*ReplicationNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationNetworkId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationNetworkName, ok = parsed.Parsed["replicationNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationNetworkIDInsensitively(input string) (*ReplicationNetworkId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationNetworkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationNetworkName, ok = parsed.Parsed["replicationNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkName", *parsed) + if id.ReplicationNetworkName, ok = input.Parsed["replicationNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkName", input) } - return &id, nil + return nil } // ValidateReplicationNetworkID checks that 'input' can be parsed as a Replication Network ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationnetworks/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationnetworks/id_vault.go index 0bfde13c55d..6e0f3a3d4a3 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationnetworks/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationnetworks/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationpolicies/id_replicationpolicy.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationpolicies/id_replicationpolicy.go index c9d0ad0e634..a75a6de5d56 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationpolicies/id_replicationpolicy.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationpolicies/id_replicationpolicy.go @@ -38,23 +38,9 @@ func ParseReplicationPolicyID(input string) (*ReplicationPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationPolicyId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationPolicyName, ok = parsed.Parsed["replicationPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationPolicyIDInsensitively(input string) (*ReplicationPolicyId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationPolicyName, ok = parsed.Parsed["replicationPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationPolicyName", *parsed) + if id.ReplicationPolicyName, ok = input.Parsed["replicationPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationPolicyName", input) } - return &id, nil + return nil } // ValidateReplicationPolicyID checks that 'input' can be parsed as a Replication Policy ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationpolicies/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationpolicies/id_vault.go index f4a5bf6b711..6a89bd687a5 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationpolicies/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationpolicies/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotectableitems/id_replicationprotectableitem.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotectableitems/id_replicationprotectableitem.go index f7f0b3936ce..90f92bce414 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotectableitems/id_replicationprotectableitem.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotectableitems/id_replicationprotectableitem.go @@ -42,31 +42,9 @@ func ParseReplicationProtectableItemID(input string) (*ReplicationProtectableIte return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectableItemId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) - } - - if id.ReplicationProtectableItemName, ok = parsed.Parsed["replicationProtectableItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectableItemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseReplicationProtectableItemIDInsensitively(input string) (*ReplicationP return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectableItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ReplicationProtectableItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - if id.ReplicationProtectableItemName, ok = parsed.Parsed["replicationProtectableItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectableItemName", *parsed) + if id.ReplicationProtectableItemName, ok = input.Parsed["replicationProtectableItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectableItemName", input) } - return &id, nil + return nil } // ValidateReplicationProtectableItemID checks that 'input' can be parsed as a Replication Protectable Item ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotectableitems/id_replicationprotectioncontainer.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotectableitems/id_replicationprotectioncontainer.go index 927a68eca8c..ce37ff1bc04 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotectableitems/id_replicationprotectioncontainer.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotectableitems/id_replicationprotectioncontainer.go @@ -40,27 +40,9 @@ func ParseReplicationProtectionContainerID(input string) (*ReplicationProtection return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationProtectionContainerIDInsensitively(input string) (*Replicat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationProtectionContainerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - return &id, nil + return nil } // ValidateReplicationProtectionContainerID checks that 'input' can be parsed as a Replication Protection Container ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotecteditems/id_replicationprotecteditem.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotecteditems/id_replicationprotecteditem.go index 557ea1c29ea..1857f1b1c6d 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotecteditems/id_replicationprotecteditem.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotecteditems/id_replicationprotecteditem.go @@ -42,31 +42,9 @@ func ParseReplicationProtectedItemID(input string) (*ReplicationProtectedItemId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectedItemId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) - } - - if id.ReplicationProtectedItemName, ok = parsed.Parsed["replicationProtectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseReplicationProtectedItemIDInsensitively(input string) (*ReplicationPro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectedItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ReplicationProtectedItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - if id.ReplicationProtectedItemName, ok = parsed.Parsed["replicationProtectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", *parsed) + if id.ReplicationProtectedItemName, ok = input.Parsed["replicationProtectedItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", input) } - return &id, nil + return nil } // ValidateReplicationProtectedItemID checks that 'input' can be parsed as a Replication Protected Item ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotecteditems/id_replicationprotectioncontainer.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotecteditems/id_replicationprotectioncontainer.go index 4c5b4524f12..8f0abd62b2c 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotecteditems/id_replicationprotectioncontainer.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotecteditems/id_replicationprotectioncontainer.go @@ -40,27 +40,9 @@ func ParseReplicationProtectionContainerID(input string) (*ReplicationProtection return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationProtectionContainerIDInsensitively(input string) (*Replicat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationProtectionContainerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - return &id, nil + return nil } // ValidateReplicationProtectionContainerID checks that 'input' can be parsed as a Replication Protection Container ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotecteditems/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotecteditems/id_vault.go index 1e669936aab..dbbb913e424 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotecteditems/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotecteditems/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotectioncontainermappings/id_replicationprotectioncontainer.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotectioncontainermappings/id_replicationprotectioncontainer.go index c1b2a09565d..0c905cb402a 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotectioncontainermappings/id_replicationprotectioncontainer.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotectioncontainermappings/id_replicationprotectioncontainer.go @@ -40,27 +40,9 @@ func ParseReplicationProtectionContainerID(input string) (*ReplicationProtection return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationProtectionContainerIDInsensitively(input string) (*Replicat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationProtectionContainerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - return &id, nil + return nil } // ValidateReplicationProtectionContainerID checks that 'input' can be parsed as a Replication Protection Container ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotectioncontainermappings/id_replicationprotectioncontainermapping.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotectioncontainermappings/id_replicationprotectioncontainermapping.go index 3a5c8ab08a9..7c336381006 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotectioncontainermappings/id_replicationprotectioncontainermapping.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotectioncontainermappings/id_replicationprotectioncontainermapping.go @@ -42,31 +42,9 @@ func ParseReplicationProtectionContainerMappingID(input string) (*ReplicationPro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerMappingId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) - } - - if id.ReplicationProtectionContainerMappingName, ok = parsed.Parsed["replicationProtectionContainerMappingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerMappingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseReplicationProtectionContainerMappingIDInsensitively(input string) (*R return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerMappingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ReplicationProtectionContainerMappingId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - if id.ReplicationProtectionContainerMappingName, ok = parsed.Parsed["replicationProtectionContainerMappingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerMappingName", *parsed) + if id.ReplicationProtectionContainerMappingName, ok = input.Parsed["replicationProtectionContainerMappingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerMappingName", input) } - return &id, nil + return nil } // ValidateReplicationProtectionContainerMappingID checks that 'input' can be parsed as a Replication Protection Container Mapping ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotectioncontainermappings/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotectioncontainermappings/id_vault.go index 7aa36b783ff..2a63a1f3299 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotectioncontainermappings/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotectioncontainermappings/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotectioncontainers/id_replicationfabric.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotectioncontainers/id_replicationfabric.go index c8c5de12a39..7668b03a571 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotectioncontainers/id_replicationfabric.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotectioncontainers/id_replicationfabric.go @@ -38,23 +38,9 @@ func ParseReplicationFabricID(input string) (*ReplicationFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationFabricIDInsensitively(input string) (*ReplicationFabricId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationFabricId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - return &id, nil + return nil } // ValidateReplicationFabricID checks that 'input' can be parsed as a Replication Fabric ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotectioncontainers/id_replicationprotectioncontainer.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotectioncontainers/id_replicationprotectioncontainer.go index 41b97b229a1..e5ac027a57a 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotectioncontainers/id_replicationprotectioncontainer.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotectioncontainers/id_replicationprotectioncontainer.go @@ -40,27 +40,9 @@ func ParseReplicationProtectionContainerID(input string) (*ReplicationProtection return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationProtectionContainerIDInsensitively(input string) (*Replicat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationProtectionContainerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - return &id, nil + return nil } // ValidateReplicationProtectionContainerID checks that 'input' can be parsed as a Replication Protection Container ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotectioncontainers/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotectioncontainers/id_vault.go index 6e73b89bd30..123feaadd44 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotectioncontainers/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotectioncontainers/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotectionintents/id_replicationprotectionintent.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotectionintents/id_replicationprotectionintent.go index 4c5fc59a48c..6972c69b12a 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotectionintents/id_replicationprotectionintent.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotectionintents/id_replicationprotectionintent.go @@ -38,23 +38,9 @@ func ParseReplicationProtectionIntentID(input string) (*ReplicationProtectionInt return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionIntentId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationProtectionIntentName, ok = parsed.Parsed["replicationProtectionIntentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionIntentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationProtectionIntentIDInsensitively(input string) (*Replication return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionIntentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationProtectionIntentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationProtectionIntentName, ok = parsed.Parsed["replicationProtectionIntentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionIntentName", *parsed) + if id.ReplicationProtectionIntentName, ok = input.Parsed["replicationProtectionIntentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionIntentName", input) } - return &id, nil + return nil } // ValidateReplicationProtectionIntentID checks that 'input' can be parsed as a Replication Protection Intent ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotectionintents/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotectionintents/id_vault.go index 045675168a5..8e68c254171 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotectionintents/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationprotectionintents/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationrecoveryplans/id_replicationrecoveryplan.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationrecoveryplans/id_replicationrecoveryplan.go index f99b2d54f2b..b7787ae706b 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationrecoveryplans/id_replicationrecoveryplan.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationrecoveryplans/id_replicationrecoveryplan.go @@ -38,23 +38,9 @@ func ParseReplicationRecoveryPlanID(input string) (*ReplicationRecoveryPlanId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationRecoveryPlanId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationRecoveryPlanName, ok = parsed.Parsed["replicationRecoveryPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationRecoveryPlanName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationRecoveryPlanIDInsensitively(input string) (*ReplicationReco return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationRecoveryPlanId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationRecoveryPlanId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationRecoveryPlanName, ok = parsed.Parsed["replicationRecoveryPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationRecoveryPlanName", *parsed) + if id.ReplicationRecoveryPlanName, ok = input.Parsed["replicationRecoveryPlanName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationRecoveryPlanName", input) } - return &id, nil + return nil } // ValidateReplicationRecoveryPlanID checks that 'input' can be parsed as a Replication Recovery Plan ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationrecoveryplans/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationrecoveryplans/id_vault.go index 2682100c630..b15709cdd0f 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationrecoveryplans/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationrecoveryplans/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationrecoveryservicesproviders/id_replicationfabric.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationrecoveryservicesproviders/id_replicationfabric.go index 34d30092c2e..12020d9804c 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationrecoveryservicesproviders/id_replicationfabric.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationrecoveryservicesproviders/id_replicationfabric.go @@ -38,23 +38,9 @@ func ParseReplicationFabricID(input string) (*ReplicationFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationFabricIDInsensitively(input string) (*ReplicationFabricId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationFabricId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - return &id, nil + return nil } // ValidateReplicationFabricID checks that 'input' can be parsed as a Replication Fabric ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationrecoveryservicesproviders/id_replicationrecoveryservicesprovider.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationrecoveryservicesproviders/id_replicationrecoveryservicesprovider.go index 7afec8d9785..2edeccae53a 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationrecoveryservicesproviders/id_replicationrecoveryservicesprovider.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationrecoveryservicesproviders/id_replicationrecoveryservicesprovider.go @@ -40,27 +40,9 @@ func ParseReplicationRecoveryServicesProviderID(input string) (*ReplicationRecov return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationRecoveryServicesProviderId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationRecoveryServicesProviderName, ok = parsed.Parsed["replicationRecoveryServicesProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationRecoveryServicesProviderName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationRecoveryServicesProviderIDInsensitively(input string) (*Rep return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationRecoveryServicesProviderId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationRecoveryServicesProviderId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationRecoveryServicesProviderName, ok = parsed.Parsed["replicationRecoveryServicesProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationRecoveryServicesProviderName", *parsed) + if id.ReplicationRecoveryServicesProviderName, ok = input.Parsed["replicationRecoveryServicesProviderName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationRecoveryServicesProviderName", input) } - return &id, nil + return nil } // ValidateReplicationRecoveryServicesProviderID checks that 'input' can be parsed as a Replication Recovery Services Provider ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationrecoveryservicesproviders/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationrecoveryservicesproviders/id_vault.go index a80d2f9b1b3..c2d20a2cf82 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationrecoveryservicesproviders/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationrecoveryservicesproviders/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationstorageclassificationmappings/id_replicationstorageclassification.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationstorageclassificationmappings/id_replicationstorageclassification.go index c9e4158848c..aa52aca12f6 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationstorageclassificationmappings/id_replicationstorageclassification.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationstorageclassificationmappings/id_replicationstorageclassification.go @@ -40,27 +40,9 @@ func ParseReplicationStorageClassificationID(input string) (*ReplicationStorageC return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationStorageClassificationId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationStorageClassificationName, ok = parsed.Parsed["replicationStorageClassificationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationStorageClassificationIDInsensitively(input string) (*Replic return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationStorageClassificationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationStorageClassificationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationStorageClassificationName, ok = parsed.Parsed["replicationStorageClassificationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationName", *parsed) + if id.ReplicationStorageClassificationName, ok = input.Parsed["replicationStorageClassificationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationName", input) } - return &id, nil + return nil } // ValidateReplicationStorageClassificationID checks that 'input' can be parsed as a Replication Storage Classification ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationstorageclassificationmappings/id_replicationstorageclassificationmapping.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationstorageclassificationmappings/id_replicationstorageclassificationmapping.go index b5ef125805c..6caeede79df 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationstorageclassificationmappings/id_replicationstorageclassificationmapping.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationstorageclassificationmappings/id_replicationstorageclassificationmapping.go @@ -42,31 +42,9 @@ func ParseReplicationStorageClassificationMappingID(input string) (*ReplicationS return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationStorageClassificationMappingId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationStorageClassificationName, ok = parsed.Parsed["replicationStorageClassificationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationName", *parsed) - } - - if id.ReplicationStorageClassificationMappingName, ok = parsed.Parsed["replicationStorageClassificationMappingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationMappingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseReplicationStorageClassificationMappingIDInsensitively(input string) ( return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationStorageClassificationMappingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ReplicationStorageClassificationMappingId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationStorageClassificationName, ok = parsed.Parsed["replicationStorageClassificationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationName", *parsed) + if id.ReplicationStorageClassificationName, ok = input.Parsed["replicationStorageClassificationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationName", input) } - if id.ReplicationStorageClassificationMappingName, ok = parsed.Parsed["replicationStorageClassificationMappingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationMappingName", *parsed) + if id.ReplicationStorageClassificationMappingName, ok = input.Parsed["replicationStorageClassificationMappingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationMappingName", input) } - return &id, nil + return nil } // ValidateReplicationStorageClassificationMappingID checks that 'input' can be parsed as a Replication Storage Classification Mapping ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationstorageclassificationmappings/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationstorageclassificationmappings/id_vault.go index 06f16f6053a..1bb58c8307a 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationstorageclassificationmappings/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationstorageclassificationmappings/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationstorageclassifications/id_replicationfabric.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationstorageclassifications/id_replicationfabric.go index 5f6840e7c65..a91440b70ca 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationstorageclassifications/id_replicationfabric.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationstorageclassifications/id_replicationfabric.go @@ -38,23 +38,9 @@ func ParseReplicationFabricID(input string) (*ReplicationFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationFabricIDInsensitively(input string) (*ReplicationFabricId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationFabricId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - return &id, nil + return nil } // ValidateReplicationFabricID checks that 'input' can be parsed as a Replication Fabric ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationstorageclassifications/id_replicationstorageclassification.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationstorageclassifications/id_replicationstorageclassification.go index ceff72d0b94..e415acfef9e 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationstorageclassifications/id_replicationstorageclassification.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationstorageclassifications/id_replicationstorageclassification.go @@ -40,27 +40,9 @@ func ParseReplicationStorageClassificationID(input string) (*ReplicationStorageC return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationStorageClassificationId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationStorageClassificationName, ok = parsed.Parsed["replicationStorageClassificationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationStorageClassificationIDInsensitively(input string) (*Replic return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationStorageClassificationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationStorageClassificationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationStorageClassificationName, ok = parsed.Parsed["replicationStorageClassificationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationName", *parsed) + if id.ReplicationStorageClassificationName, ok = input.Parsed["replicationStorageClassificationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationName", input) } - return &id, nil + return nil } // ValidateReplicationStorageClassificationID checks that 'input' can be parsed as a Replication Storage Classification ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationstorageclassifications/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationstorageclassifications/id_vault.go index 0a08dd4e876..da6d5015c80 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationstorageclassifications/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationstorageclassifications/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationvaulthealth/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationvaulthealth/id_vault.go index 36c0195fba0..5755dfb54a6 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationvaulthealth/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationvaulthealth/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationvaultsetting/id_replicationvaultsetting.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationvaultsetting/id_replicationvaultsetting.go index 26e25501d51..806eee37993 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationvaultsetting/id_replicationvaultsetting.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationvaultsetting/id_replicationvaultsetting.go @@ -38,23 +38,9 @@ func ParseReplicationVaultSettingID(input string) (*ReplicationVaultSettingId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationVaultSettingId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationVaultSettingName, ok = parsed.Parsed["replicationVaultSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationVaultSettingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationVaultSettingIDInsensitively(input string) (*ReplicationVaul return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationVaultSettingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationVaultSettingId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationVaultSettingName, ok = parsed.Parsed["replicationVaultSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationVaultSettingName", *parsed) + if id.ReplicationVaultSettingName, ok = input.Parsed["replicationVaultSettingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationVaultSettingName", input) } - return &id, nil + return nil } // ValidateReplicationVaultSettingID checks that 'input' can be parsed as a Replication Vault Setting ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationvaultsetting/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationvaultsetting/id_vault.go index accb6845a98..879a3742af7 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationvaultsetting/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationvaultsetting/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationvcenters/id_replicationfabric.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationvcenters/id_replicationfabric.go index 43b4791b4ef..966f39ff0f9 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationvcenters/id_replicationfabric.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationvcenters/id_replicationfabric.go @@ -38,23 +38,9 @@ func ParseReplicationFabricID(input string) (*ReplicationFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationFabricIDInsensitively(input string) (*ReplicationFabricId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationFabricId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - return &id, nil + return nil } // ValidateReplicationFabricID checks that 'input' can be parsed as a Replication Fabric ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationvcenters/id_replicationvcenter.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationvcenters/id_replicationvcenter.go index 1ed680e598b..bc3e7254dfe 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationvcenters/id_replicationvcenter.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationvcenters/id_replicationvcenter.go @@ -40,27 +40,9 @@ func ParseReplicationvCenterID(input string) (*ReplicationvCenterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationvCenterId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationvCenterName, ok = parsed.Parsed["replicationvCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationvCenterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationvCenterIDInsensitively(input string) (*ReplicationvCenterId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationvCenterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationvCenterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationvCenterName, ok = parsed.Parsed["replicationvCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationvCenterName", *parsed) + if id.ReplicationvCenterName, ok = input.Parsed["replicationvCenterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationvCenterName", input) } - return &id, nil + return nil } // ValidateReplicationvCenterID checks that 'input' can be parsed as a Replicationv Center ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationvcenters/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationvcenters/id_vault.go index 2c014d1915f..bdf783ba09a 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationvcenters/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/replicationvcenters/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/supportedoperatingsystems/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/supportedoperatingsystems/id_vault.go index 41796b3f013..f027ebd1633 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/supportedoperatingsystems/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/supportedoperatingsystems/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-02-01/targetcomputesizes/id_replicationprotecteditem.go b/resource-manager/recoveryservicessiterecovery/2023-02-01/targetcomputesizes/id_replicationprotecteditem.go index c16c821a521..0e4d833485d 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-02-01/targetcomputesizes/id_replicationprotecteditem.go +++ b/resource-manager/recoveryservicessiterecovery/2023-02-01/targetcomputesizes/id_replicationprotecteditem.go @@ -42,31 +42,9 @@ func ParseReplicationProtectedItemID(input string) (*ReplicationProtectedItemId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectedItemId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) - } - - if id.ReplicationProtectedItemName, ok = parsed.Parsed["replicationProtectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseReplicationProtectedItemIDInsensitively(input string) (*ReplicationPro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectedItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ReplicationProtectedItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - if id.ReplicationProtectedItemName, ok = parsed.Parsed["replicationProtectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", *parsed) + if id.ReplicationProtectedItemName, ok = input.Parsed["replicationProtectedItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", input) } - return &id, nil + return nil } // ValidateReplicationProtectedItemID checks that 'input' can be parsed as a Replication Protected Item ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/migrationrecoverypoints/id_migrationrecoverypoint.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/migrationrecoverypoints/id_migrationrecoverypoint.go index 85f737b6ac0..6635a133bbd 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/migrationrecoverypoints/id_migrationrecoverypoint.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/migrationrecoverypoints/id_migrationrecoverypoint.go @@ -44,35 +44,9 @@ func ParseMigrationRecoveryPointID(input string) (*MigrationRecoveryPointId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MigrationRecoveryPointId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) - } - - if id.ReplicationMigrationItemName, ok = parsed.Parsed["replicationMigrationItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationMigrationItemName", *parsed) - } - - if id.MigrationRecoveryPointName, ok = parsed.Parsed["migrationRecoveryPointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "migrationRecoveryPointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseMigrationRecoveryPointIDInsensitively(input string) (*MigrationRecover return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MigrationRecoveryPointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *MigrationRecoveryPointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - if id.ReplicationMigrationItemName, ok = parsed.Parsed["replicationMigrationItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationMigrationItemName", *parsed) + if id.ReplicationMigrationItemName, ok = input.Parsed["replicationMigrationItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationMigrationItemName", input) } - if id.MigrationRecoveryPointName, ok = parsed.Parsed["migrationRecoveryPointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "migrationRecoveryPointName", *parsed) + if id.MigrationRecoveryPointName, ok = input.Parsed["migrationRecoveryPointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "migrationRecoveryPointName", input) } - return &id, nil + return nil } // ValidateMigrationRecoveryPointID checks that 'input' can be parsed as a Migration Recovery Point ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/migrationrecoverypoints/id_replicationmigrationitem.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/migrationrecoverypoints/id_replicationmigrationitem.go index cd7a8f23e9c..bf44279baa2 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/migrationrecoverypoints/id_replicationmigrationitem.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/migrationrecoverypoints/id_replicationmigrationitem.go @@ -42,31 +42,9 @@ func ParseReplicationMigrationItemID(input string) (*ReplicationMigrationItemId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationMigrationItemId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) - } - - if id.ReplicationMigrationItemName, ok = parsed.Parsed["replicationMigrationItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationMigrationItemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseReplicationMigrationItemIDInsensitively(input string) (*ReplicationMig return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationMigrationItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ReplicationMigrationItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - if id.ReplicationMigrationItemName, ok = parsed.Parsed["replicationMigrationItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationMigrationItemName", *parsed) + if id.ReplicationMigrationItemName, ok = input.Parsed["replicationMigrationItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationMigrationItemName", input) } - return &id, nil + return nil } // ValidateReplicationMigrationItemID checks that 'input' can be parsed as a Replication Migration Item ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/recoverypoints/id_recoverypoint.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/recoverypoints/id_recoverypoint.go index ad43c081904..2e5b42d0055 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/recoverypoints/id_recoverypoint.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/recoverypoints/id_recoverypoint.go @@ -44,35 +44,9 @@ func ParseRecoveryPointID(input string) (*RecoveryPointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecoveryPointId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) - } - - if id.ReplicationProtectedItemName, ok = parsed.Parsed["replicationProtectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", *parsed) - } - - if id.RecoveryPointName, ok = parsed.Parsed["recoveryPointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseRecoveryPointIDInsensitively(input string) (*RecoveryPointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecoveryPointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RecoveryPointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - if id.ReplicationProtectedItemName, ok = parsed.Parsed["replicationProtectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", *parsed) + if id.ReplicationProtectedItemName, ok = input.Parsed["replicationProtectedItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", input) } - if id.RecoveryPointName, ok = parsed.Parsed["recoveryPointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointName", *parsed) + if id.RecoveryPointName, ok = input.Parsed["recoveryPointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointName", input) } - return &id, nil + return nil } // ValidateRecoveryPointID checks that 'input' can be parsed as a Recovery Point ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/recoverypoints/id_replicationprotecteditem.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/recoverypoints/id_replicationprotecteditem.go index d8eff4f5e4d..4a66a2ef06d 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/recoverypoints/id_replicationprotecteditem.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/recoverypoints/id_replicationprotecteditem.go @@ -42,31 +42,9 @@ func ParseReplicationProtectedItemID(input string) (*ReplicationProtectedItemId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectedItemId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) - } - - if id.ReplicationProtectedItemName, ok = parsed.Parsed["replicationProtectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseReplicationProtectedItemIDInsensitively(input string) (*ReplicationPro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectedItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ReplicationProtectedItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - if id.ReplicationProtectedItemName, ok = parsed.Parsed["replicationProtectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", *parsed) + if id.ReplicationProtectedItemName, ok = input.Parsed["replicationProtectedItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", input) } - return &id, nil + return nil } // ValidateReplicationProtectedItemID checks that 'input' can be parsed as a Replication Protected Item ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationalertsettings/id_replicationalertsetting.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationalertsettings/id_replicationalertsetting.go index fd4bbe7bf22..7cc4b4916cc 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationalertsettings/id_replicationalertsetting.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationalertsettings/id_replicationalertsetting.go @@ -38,23 +38,9 @@ func ParseReplicationAlertSettingID(input string) (*ReplicationAlertSettingId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationAlertSettingId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationAlertSettingName, ok = parsed.Parsed["replicationAlertSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationAlertSettingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationAlertSettingIDInsensitively(input string) (*ReplicationAler return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationAlertSettingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationAlertSettingId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationAlertSettingName, ok = parsed.Parsed["replicationAlertSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationAlertSettingName", *parsed) + if id.ReplicationAlertSettingName, ok = input.Parsed["replicationAlertSettingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationAlertSettingName", input) } - return &id, nil + return nil } // ValidateReplicationAlertSettingID checks that 'input' can be parsed as a Replication Alert Setting ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationalertsettings/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationalertsettings/id_vault.go index e942d185177..42183390cf3 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationalertsettings/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationalertsettings/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationappliances/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationappliances/id_vault.go index c5d015c9cd5..e37d9d05230 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationappliances/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationappliances/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationeligibilityresults/id_virtualmachine.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationeligibilityresults/id_virtualmachine.go index c27fea51a7b..47a386f894f 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationeligibilityresults/id_virtualmachine.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationeligibilityresults/id_virtualmachine.go @@ -36,19 +36,9 @@ func ParseVirtualMachineID(input string) (*VirtualMachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineIDInsensitively(input string) (*VirtualMachineId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - return &id, nil + return nil } // ValidateVirtualMachineID checks that 'input' can be parsed as a Virtual Machine ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationevents/id_replicationevent.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationevents/id_replicationevent.go index 49f794e3ccf..89ea4cefe9d 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationevents/id_replicationevent.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationevents/id_replicationevent.go @@ -38,23 +38,9 @@ func ParseReplicationEventID(input string) (*ReplicationEventId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationEventId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationEventName, ok = parsed.Parsed["replicationEventName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationEventName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationEventIDInsensitively(input string) (*ReplicationEventId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationEventId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationEventId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationEventName, ok = parsed.Parsed["replicationEventName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationEventName", *parsed) + if id.ReplicationEventName, ok = input.Parsed["replicationEventName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationEventName", input) } - return &id, nil + return nil } // ValidateReplicationEventID checks that 'input' can be parsed as a Replication Event ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationevents/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationevents/id_vault.go index 73bfeb6a4b7..3997a813f75 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationevents/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationevents/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationfabrics/id_replicationfabric.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationfabrics/id_replicationfabric.go index db5f8d7ab5e..72935507a8c 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationfabrics/id_replicationfabric.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationfabrics/id_replicationfabric.go @@ -38,23 +38,9 @@ func ParseReplicationFabricID(input string) (*ReplicationFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationFabricIDInsensitively(input string) (*ReplicationFabricId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationFabricId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - return &id, nil + return nil } // ValidateReplicationFabricID checks that 'input' can be parsed as a Replication Fabric ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationfabrics/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationfabrics/id_vault.go index 2a58d893c0e..b88ddbb8e33 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationfabrics/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationfabrics/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationjobs/id_replicationjob.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationjobs/id_replicationjob.go index 5f1c028407b..8aaf763372f 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationjobs/id_replicationjob.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationjobs/id_replicationjob.go @@ -38,23 +38,9 @@ func ParseReplicationJobID(input string) (*ReplicationJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationJobId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationJobName, ok = parsed.Parsed["replicationJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationJobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationJobIDInsensitively(input string) (*ReplicationJobId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationJobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationJobId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationJobName, ok = parsed.Parsed["replicationJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationJobName", *parsed) + if id.ReplicationJobName, ok = input.Parsed["replicationJobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationJobName", input) } - return &id, nil + return nil } // ValidateReplicationJobID checks that 'input' can be parsed as a Replication Job ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationjobs/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationjobs/id_vault.go index d63ce87429f..4da941eb753 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationjobs/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationjobs/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationlogicalnetworks/id_replicationfabric.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationlogicalnetworks/id_replicationfabric.go index a9dcb375bef..d34e37e4196 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationlogicalnetworks/id_replicationfabric.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationlogicalnetworks/id_replicationfabric.go @@ -38,23 +38,9 @@ func ParseReplicationFabricID(input string) (*ReplicationFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationFabricIDInsensitively(input string) (*ReplicationFabricId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationFabricId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - return &id, nil + return nil } // ValidateReplicationFabricID checks that 'input' can be parsed as a Replication Fabric ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationlogicalnetworks/id_replicationlogicalnetwork.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationlogicalnetworks/id_replicationlogicalnetwork.go index 26fb05fb737..67601ab37cb 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationlogicalnetworks/id_replicationlogicalnetwork.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationlogicalnetworks/id_replicationlogicalnetwork.go @@ -40,27 +40,9 @@ func ParseReplicationLogicalNetworkID(input string) (*ReplicationLogicalNetworkI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationLogicalNetworkId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationLogicalNetworkName, ok = parsed.Parsed["replicationLogicalNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationLogicalNetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationLogicalNetworkIDInsensitively(input string) (*ReplicationLo return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationLogicalNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationLogicalNetworkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationLogicalNetworkName, ok = parsed.Parsed["replicationLogicalNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationLogicalNetworkName", *parsed) + if id.ReplicationLogicalNetworkName, ok = input.Parsed["replicationLogicalNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationLogicalNetworkName", input) } - return &id, nil + return nil } // ValidateReplicationLogicalNetworkID checks that 'input' can be parsed as a Replication Logical Network ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationmigrationitems/id_replicationmigrationitem.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationmigrationitems/id_replicationmigrationitem.go index 1f52aff025c..4af937308f0 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationmigrationitems/id_replicationmigrationitem.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationmigrationitems/id_replicationmigrationitem.go @@ -42,31 +42,9 @@ func ParseReplicationMigrationItemID(input string) (*ReplicationMigrationItemId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationMigrationItemId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) - } - - if id.ReplicationMigrationItemName, ok = parsed.Parsed["replicationMigrationItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationMigrationItemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseReplicationMigrationItemIDInsensitively(input string) (*ReplicationMig return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationMigrationItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ReplicationMigrationItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - if id.ReplicationMigrationItemName, ok = parsed.Parsed["replicationMigrationItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationMigrationItemName", *parsed) + if id.ReplicationMigrationItemName, ok = input.Parsed["replicationMigrationItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationMigrationItemName", input) } - return &id, nil + return nil } // ValidateReplicationMigrationItemID checks that 'input' can be parsed as a Replication Migration Item ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationmigrationitems/id_replicationprotectioncontainer.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationmigrationitems/id_replicationprotectioncontainer.go index e977a910480..434724573c3 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationmigrationitems/id_replicationprotectioncontainer.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationmigrationitems/id_replicationprotectioncontainer.go @@ -40,27 +40,9 @@ func ParseReplicationProtectionContainerID(input string) (*ReplicationProtection return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationProtectionContainerIDInsensitively(input string) (*Replicat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationProtectionContainerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - return &id, nil + return nil } // ValidateReplicationProtectionContainerID checks that 'input' can be parsed as a Replication Protection Container ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationmigrationitems/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationmigrationitems/id_vault.go index 58abd104387..e05e06bc8d8 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationmigrationitems/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationmigrationitems/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationnetworkmappings/id_replicationnetwork.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationnetworkmappings/id_replicationnetwork.go index 8f65b4f0ffd..521fb241bed 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationnetworkmappings/id_replicationnetwork.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationnetworkmappings/id_replicationnetwork.go @@ -40,27 +40,9 @@ func ParseReplicationNetworkID(input string) (*ReplicationNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationNetworkId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationNetworkName, ok = parsed.Parsed["replicationNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationNetworkIDInsensitively(input string) (*ReplicationNetworkId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationNetworkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationNetworkName, ok = parsed.Parsed["replicationNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkName", *parsed) + if id.ReplicationNetworkName, ok = input.Parsed["replicationNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkName", input) } - return &id, nil + return nil } // ValidateReplicationNetworkID checks that 'input' can be parsed as a Replication Network ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationnetworkmappings/id_replicationnetworkmapping.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationnetworkmappings/id_replicationnetworkmapping.go index e67c61eed51..5705f27e9b7 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationnetworkmappings/id_replicationnetworkmapping.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationnetworkmappings/id_replicationnetworkmapping.go @@ -42,31 +42,9 @@ func ParseReplicationNetworkMappingID(input string) (*ReplicationNetworkMappingI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationNetworkMappingId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationNetworkName, ok = parsed.Parsed["replicationNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkName", *parsed) - } - - if id.ReplicationNetworkMappingName, ok = parsed.Parsed["replicationNetworkMappingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkMappingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseReplicationNetworkMappingIDInsensitively(input string) (*ReplicationNe return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationNetworkMappingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ReplicationNetworkMappingId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationNetworkName, ok = parsed.Parsed["replicationNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkName", *parsed) + if id.ReplicationNetworkName, ok = input.Parsed["replicationNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkName", input) } - if id.ReplicationNetworkMappingName, ok = parsed.Parsed["replicationNetworkMappingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkMappingName", *parsed) + if id.ReplicationNetworkMappingName, ok = input.Parsed["replicationNetworkMappingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkMappingName", input) } - return &id, nil + return nil } // ValidateReplicationNetworkMappingID checks that 'input' can be parsed as a Replication Network Mapping ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationnetworkmappings/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationnetworkmappings/id_vault.go index 192509d68b9..e154527e540 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationnetworkmappings/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationnetworkmappings/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationnetworks/id_replicationfabric.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationnetworks/id_replicationfabric.go index 73c02b723ee..c46331fc5f7 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationnetworks/id_replicationfabric.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationnetworks/id_replicationfabric.go @@ -38,23 +38,9 @@ func ParseReplicationFabricID(input string) (*ReplicationFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationFabricIDInsensitively(input string) (*ReplicationFabricId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationFabricId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - return &id, nil + return nil } // ValidateReplicationFabricID checks that 'input' can be parsed as a Replication Fabric ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationnetworks/id_replicationnetwork.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationnetworks/id_replicationnetwork.go index e1869f6fb0d..e9f54c2f47a 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationnetworks/id_replicationnetwork.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationnetworks/id_replicationnetwork.go @@ -40,27 +40,9 @@ func ParseReplicationNetworkID(input string) (*ReplicationNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationNetworkId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationNetworkName, ok = parsed.Parsed["replicationNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationNetworkIDInsensitively(input string) (*ReplicationNetworkId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationNetworkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationNetworkName, ok = parsed.Parsed["replicationNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkName", *parsed) + if id.ReplicationNetworkName, ok = input.Parsed["replicationNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkName", input) } - return &id, nil + return nil } // ValidateReplicationNetworkID checks that 'input' can be parsed as a Replication Network ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationnetworks/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationnetworks/id_vault.go index 0bfde13c55d..6e0f3a3d4a3 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationnetworks/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationnetworks/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationpolicies/id_replicationpolicy.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationpolicies/id_replicationpolicy.go index c9d0ad0e634..a75a6de5d56 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationpolicies/id_replicationpolicy.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationpolicies/id_replicationpolicy.go @@ -38,23 +38,9 @@ func ParseReplicationPolicyID(input string) (*ReplicationPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationPolicyId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationPolicyName, ok = parsed.Parsed["replicationPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationPolicyIDInsensitively(input string) (*ReplicationPolicyId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationPolicyName, ok = parsed.Parsed["replicationPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationPolicyName", *parsed) + if id.ReplicationPolicyName, ok = input.Parsed["replicationPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationPolicyName", input) } - return &id, nil + return nil } // ValidateReplicationPolicyID checks that 'input' can be parsed as a Replication Policy ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationpolicies/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationpolicies/id_vault.go index f4a5bf6b711..6a89bd687a5 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationpolicies/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationpolicies/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotectableitems/id_replicationprotectableitem.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotectableitems/id_replicationprotectableitem.go index f7f0b3936ce..90f92bce414 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotectableitems/id_replicationprotectableitem.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotectableitems/id_replicationprotectableitem.go @@ -42,31 +42,9 @@ func ParseReplicationProtectableItemID(input string) (*ReplicationProtectableIte return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectableItemId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) - } - - if id.ReplicationProtectableItemName, ok = parsed.Parsed["replicationProtectableItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectableItemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseReplicationProtectableItemIDInsensitively(input string) (*ReplicationP return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectableItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ReplicationProtectableItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - if id.ReplicationProtectableItemName, ok = parsed.Parsed["replicationProtectableItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectableItemName", *parsed) + if id.ReplicationProtectableItemName, ok = input.Parsed["replicationProtectableItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectableItemName", input) } - return &id, nil + return nil } // ValidateReplicationProtectableItemID checks that 'input' can be parsed as a Replication Protectable Item ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotectableitems/id_replicationprotectioncontainer.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotectableitems/id_replicationprotectioncontainer.go index 927a68eca8c..ce37ff1bc04 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotectableitems/id_replicationprotectioncontainer.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotectableitems/id_replicationprotectioncontainer.go @@ -40,27 +40,9 @@ func ParseReplicationProtectionContainerID(input string) (*ReplicationProtection return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationProtectionContainerIDInsensitively(input string) (*Replicat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationProtectionContainerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - return &id, nil + return nil } // ValidateReplicationProtectionContainerID checks that 'input' can be parsed as a Replication Protection Container ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotecteditems/id_replicationprotecteditem.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotecteditems/id_replicationprotecteditem.go index 557ea1c29ea..1857f1b1c6d 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotecteditems/id_replicationprotecteditem.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotecteditems/id_replicationprotecteditem.go @@ -42,31 +42,9 @@ func ParseReplicationProtectedItemID(input string) (*ReplicationProtectedItemId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectedItemId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) - } - - if id.ReplicationProtectedItemName, ok = parsed.Parsed["replicationProtectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseReplicationProtectedItemIDInsensitively(input string) (*ReplicationPro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectedItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ReplicationProtectedItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - if id.ReplicationProtectedItemName, ok = parsed.Parsed["replicationProtectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", *parsed) + if id.ReplicationProtectedItemName, ok = input.Parsed["replicationProtectedItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", input) } - return &id, nil + return nil } // ValidateReplicationProtectedItemID checks that 'input' can be parsed as a Replication Protected Item ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotecteditems/id_replicationprotectioncontainer.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotecteditems/id_replicationprotectioncontainer.go index 4c5b4524f12..8f0abd62b2c 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotecteditems/id_replicationprotectioncontainer.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotecteditems/id_replicationprotectioncontainer.go @@ -40,27 +40,9 @@ func ParseReplicationProtectionContainerID(input string) (*ReplicationProtection return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationProtectionContainerIDInsensitively(input string) (*Replicat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationProtectionContainerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - return &id, nil + return nil } // ValidateReplicationProtectionContainerID checks that 'input' can be parsed as a Replication Protection Container ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotecteditems/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotecteditems/id_vault.go index 1e669936aab..dbbb913e424 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotecteditems/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotecteditems/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotectioncontainermappings/id_replicationprotectioncontainer.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotectioncontainermappings/id_replicationprotectioncontainer.go index c1b2a09565d..0c905cb402a 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotectioncontainermappings/id_replicationprotectioncontainer.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotectioncontainermappings/id_replicationprotectioncontainer.go @@ -40,27 +40,9 @@ func ParseReplicationProtectionContainerID(input string) (*ReplicationProtection return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationProtectionContainerIDInsensitively(input string) (*Replicat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationProtectionContainerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - return &id, nil + return nil } // ValidateReplicationProtectionContainerID checks that 'input' can be parsed as a Replication Protection Container ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotectioncontainermappings/id_replicationprotectioncontainermapping.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotectioncontainermappings/id_replicationprotectioncontainermapping.go index 3a5c8ab08a9..7c336381006 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotectioncontainermappings/id_replicationprotectioncontainermapping.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotectioncontainermappings/id_replicationprotectioncontainermapping.go @@ -42,31 +42,9 @@ func ParseReplicationProtectionContainerMappingID(input string) (*ReplicationPro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerMappingId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) - } - - if id.ReplicationProtectionContainerMappingName, ok = parsed.Parsed["replicationProtectionContainerMappingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerMappingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseReplicationProtectionContainerMappingIDInsensitively(input string) (*R return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerMappingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ReplicationProtectionContainerMappingId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - if id.ReplicationProtectionContainerMappingName, ok = parsed.Parsed["replicationProtectionContainerMappingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerMappingName", *parsed) + if id.ReplicationProtectionContainerMappingName, ok = input.Parsed["replicationProtectionContainerMappingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerMappingName", input) } - return &id, nil + return nil } // ValidateReplicationProtectionContainerMappingID checks that 'input' can be parsed as a Replication Protection Container Mapping ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotectioncontainermappings/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotectioncontainermappings/id_vault.go index 7aa36b783ff..2a63a1f3299 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotectioncontainermappings/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotectioncontainermappings/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotectioncontainers/id_replicationfabric.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotectioncontainers/id_replicationfabric.go index c8c5de12a39..7668b03a571 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotectioncontainers/id_replicationfabric.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotectioncontainers/id_replicationfabric.go @@ -38,23 +38,9 @@ func ParseReplicationFabricID(input string) (*ReplicationFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationFabricIDInsensitively(input string) (*ReplicationFabricId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationFabricId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - return &id, nil + return nil } // ValidateReplicationFabricID checks that 'input' can be parsed as a Replication Fabric ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotectioncontainers/id_replicationprotectioncontainer.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotectioncontainers/id_replicationprotectioncontainer.go index 41b97b229a1..e5ac027a57a 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotectioncontainers/id_replicationprotectioncontainer.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotectioncontainers/id_replicationprotectioncontainer.go @@ -40,27 +40,9 @@ func ParseReplicationProtectionContainerID(input string) (*ReplicationProtection return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationProtectionContainerIDInsensitively(input string) (*Replicat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationProtectionContainerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - return &id, nil + return nil } // ValidateReplicationProtectionContainerID checks that 'input' can be parsed as a Replication Protection Container ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotectioncontainers/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotectioncontainers/id_vault.go index 6e73b89bd30..123feaadd44 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotectioncontainers/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotectioncontainers/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotectionintents/id_replicationprotectionintent.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotectionintents/id_replicationprotectionintent.go index 4c5fc59a48c..6972c69b12a 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotectionintents/id_replicationprotectionintent.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotectionintents/id_replicationprotectionintent.go @@ -38,23 +38,9 @@ func ParseReplicationProtectionIntentID(input string) (*ReplicationProtectionInt return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionIntentId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationProtectionIntentName, ok = parsed.Parsed["replicationProtectionIntentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionIntentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationProtectionIntentIDInsensitively(input string) (*Replication return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionIntentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationProtectionIntentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationProtectionIntentName, ok = parsed.Parsed["replicationProtectionIntentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionIntentName", *parsed) + if id.ReplicationProtectionIntentName, ok = input.Parsed["replicationProtectionIntentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionIntentName", input) } - return &id, nil + return nil } // ValidateReplicationProtectionIntentID checks that 'input' can be parsed as a Replication Protection Intent ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotectionintents/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotectionintents/id_vault.go index 045675168a5..8e68c254171 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotectionintents/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationprotectionintents/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationrecoveryplans/id_replicationrecoveryplan.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationrecoveryplans/id_replicationrecoveryplan.go index f99b2d54f2b..b7787ae706b 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationrecoveryplans/id_replicationrecoveryplan.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationrecoveryplans/id_replicationrecoveryplan.go @@ -38,23 +38,9 @@ func ParseReplicationRecoveryPlanID(input string) (*ReplicationRecoveryPlanId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationRecoveryPlanId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationRecoveryPlanName, ok = parsed.Parsed["replicationRecoveryPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationRecoveryPlanName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationRecoveryPlanIDInsensitively(input string) (*ReplicationReco return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationRecoveryPlanId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationRecoveryPlanId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationRecoveryPlanName, ok = parsed.Parsed["replicationRecoveryPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationRecoveryPlanName", *parsed) + if id.ReplicationRecoveryPlanName, ok = input.Parsed["replicationRecoveryPlanName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationRecoveryPlanName", input) } - return &id, nil + return nil } // ValidateReplicationRecoveryPlanID checks that 'input' can be parsed as a Replication Recovery Plan ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationrecoveryplans/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationrecoveryplans/id_vault.go index 2682100c630..b15709cdd0f 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationrecoveryplans/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationrecoveryplans/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationrecoveryservicesproviders/id_replicationfabric.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationrecoveryservicesproviders/id_replicationfabric.go index 34d30092c2e..12020d9804c 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationrecoveryservicesproviders/id_replicationfabric.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationrecoveryservicesproviders/id_replicationfabric.go @@ -38,23 +38,9 @@ func ParseReplicationFabricID(input string) (*ReplicationFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationFabricIDInsensitively(input string) (*ReplicationFabricId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationFabricId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - return &id, nil + return nil } // ValidateReplicationFabricID checks that 'input' can be parsed as a Replication Fabric ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationrecoveryservicesproviders/id_replicationrecoveryservicesprovider.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationrecoveryservicesproviders/id_replicationrecoveryservicesprovider.go index 7afec8d9785..2edeccae53a 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationrecoveryservicesproviders/id_replicationrecoveryservicesprovider.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationrecoveryservicesproviders/id_replicationrecoveryservicesprovider.go @@ -40,27 +40,9 @@ func ParseReplicationRecoveryServicesProviderID(input string) (*ReplicationRecov return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationRecoveryServicesProviderId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationRecoveryServicesProviderName, ok = parsed.Parsed["replicationRecoveryServicesProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationRecoveryServicesProviderName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationRecoveryServicesProviderIDInsensitively(input string) (*Rep return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationRecoveryServicesProviderId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationRecoveryServicesProviderId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationRecoveryServicesProviderName, ok = parsed.Parsed["replicationRecoveryServicesProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationRecoveryServicesProviderName", *parsed) + if id.ReplicationRecoveryServicesProviderName, ok = input.Parsed["replicationRecoveryServicesProviderName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationRecoveryServicesProviderName", input) } - return &id, nil + return nil } // ValidateReplicationRecoveryServicesProviderID checks that 'input' can be parsed as a Replication Recovery Services Provider ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationrecoveryservicesproviders/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationrecoveryservicesproviders/id_vault.go index a80d2f9b1b3..c2d20a2cf82 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationrecoveryservicesproviders/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationrecoveryservicesproviders/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationstorageclassificationmappings/id_replicationstorageclassification.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationstorageclassificationmappings/id_replicationstorageclassification.go index c9e4158848c..aa52aca12f6 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationstorageclassificationmappings/id_replicationstorageclassification.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationstorageclassificationmappings/id_replicationstorageclassification.go @@ -40,27 +40,9 @@ func ParseReplicationStorageClassificationID(input string) (*ReplicationStorageC return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationStorageClassificationId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationStorageClassificationName, ok = parsed.Parsed["replicationStorageClassificationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationStorageClassificationIDInsensitively(input string) (*Replic return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationStorageClassificationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationStorageClassificationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationStorageClassificationName, ok = parsed.Parsed["replicationStorageClassificationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationName", *parsed) + if id.ReplicationStorageClassificationName, ok = input.Parsed["replicationStorageClassificationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationName", input) } - return &id, nil + return nil } // ValidateReplicationStorageClassificationID checks that 'input' can be parsed as a Replication Storage Classification ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationstorageclassificationmappings/id_replicationstorageclassificationmapping.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationstorageclassificationmappings/id_replicationstorageclassificationmapping.go index b5ef125805c..6caeede79df 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationstorageclassificationmappings/id_replicationstorageclassificationmapping.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationstorageclassificationmappings/id_replicationstorageclassificationmapping.go @@ -42,31 +42,9 @@ func ParseReplicationStorageClassificationMappingID(input string) (*ReplicationS return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationStorageClassificationMappingId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationStorageClassificationName, ok = parsed.Parsed["replicationStorageClassificationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationName", *parsed) - } - - if id.ReplicationStorageClassificationMappingName, ok = parsed.Parsed["replicationStorageClassificationMappingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationMappingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseReplicationStorageClassificationMappingIDInsensitively(input string) ( return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationStorageClassificationMappingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ReplicationStorageClassificationMappingId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationStorageClassificationName, ok = parsed.Parsed["replicationStorageClassificationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationName", *parsed) + if id.ReplicationStorageClassificationName, ok = input.Parsed["replicationStorageClassificationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationName", input) } - if id.ReplicationStorageClassificationMappingName, ok = parsed.Parsed["replicationStorageClassificationMappingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationMappingName", *parsed) + if id.ReplicationStorageClassificationMappingName, ok = input.Parsed["replicationStorageClassificationMappingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationMappingName", input) } - return &id, nil + return nil } // ValidateReplicationStorageClassificationMappingID checks that 'input' can be parsed as a Replication Storage Classification Mapping ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationstorageclassificationmappings/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationstorageclassificationmappings/id_vault.go index 06f16f6053a..1bb58c8307a 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationstorageclassificationmappings/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationstorageclassificationmappings/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationstorageclassifications/id_replicationfabric.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationstorageclassifications/id_replicationfabric.go index 5f6840e7c65..a91440b70ca 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationstorageclassifications/id_replicationfabric.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationstorageclassifications/id_replicationfabric.go @@ -38,23 +38,9 @@ func ParseReplicationFabricID(input string) (*ReplicationFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationFabricIDInsensitively(input string) (*ReplicationFabricId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationFabricId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - return &id, nil + return nil } // ValidateReplicationFabricID checks that 'input' can be parsed as a Replication Fabric ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationstorageclassifications/id_replicationstorageclassification.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationstorageclassifications/id_replicationstorageclassification.go index ceff72d0b94..e415acfef9e 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationstorageclassifications/id_replicationstorageclassification.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationstorageclassifications/id_replicationstorageclassification.go @@ -40,27 +40,9 @@ func ParseReplicationStorageClassificationID(input string) (*ReplicationStorageC return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationStorageClassificationId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationStorageClassificationName, ok = parsed.Parsed["replicationStorageClassificationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationStorageClassificationIDInsensitively(input string) (*Replic return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationStorageClassificationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationStorageClassificationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationStorageClassificationName, ok = parsed.Parsed["replicationStorageClassificationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationName", *parsed) + if id.ReplicationStorageClassificationName, ok = input.Parsed["replicationStorageClassificationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationName", input) } - return &id, nil + return nil } // ValidateReplicationStorageClassificationID checks that 'input' can be parsed as a Replication Storage Classification ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationstorageclassifications/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationstorageclassifications/id_vault.go index 0a08dd4e876..da6d5015c80 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationstorageclassifications/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationstorageclassifications/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationvaulthealth/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationvaulthealth/id_vault.go index 36c0195fba0..5755dfb54a6 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationvaulthealth/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationvaulthealth/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationvaultsetting/id_replicationvaultsetting.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationvaultsetting/id_replicationvaultsetting.go index 26e25501d51..806eee37993 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationvaultsetting/id_replicationvaultsetting.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationvaultsetting/id_replicationvaultsetting.go @@ -38,23 +38,9 @@ func ParseReplicationVaultSettingID(input string) (*ReplicationVaultSettingId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationVaultSettingId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationVaultSettingName, ok = parsed.Parsed["replicationVaultSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationVaultSettingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationVaultSettingIDInsensitively(input string) (*ReplicationVaul return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationVaultSettingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationVaultSettingId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationVaultSettingName, ok = parsed.Parsed["replicationVaultSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationVaultSettingName", *parsed) + if id.ReplicationVaultSettingName, ok = input.Parsed["replicationVaultSettingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationVaultSettingName", input) } - return &id, nil + return nil } // ValidateReplicationVaultSettingID checks that 'input' can be parsed as a Replication Vault Setting ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationvaultsetting/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationvaultsetting/id_vault.go index accb6845a98..879a3742af7 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationvaultsetting/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationvaultsetting/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationvcenters/id_replicationfabric.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationvcenters/id_replicationfabric.go index 43b4791b4ef..966f39ff0f9 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationvcenters/id_replicationfabric.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationvcenters/id_replicationfabric.go @@ -38,23 +38,9 @@ func ParseReplicationFabricID(input string) (*ReplicationFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationFabricIDInsensitively(input string) (*ReplicationFabricId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationFabricId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - return &id, nil + return nil } // ValidateReplicationFabricID checks that 'input' can be parsed as a Replication Fabric ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationvcenters/id_replicationvcenter.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationvcenters/id_replicationvcenter.go index 1ed680e598b..bc3e7254dfe 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationvcenters/id_replicationvcenter.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationvcenters/id_replicationvcenter.go @@ -40,27 +40,9 @@ func ParseReplicationvCenterID(input string) (*ReplicationvCenterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationvCenterId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationvCenterName, ok = parsed.Parsed["replicationvCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationvCenterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationvCenterIDInsensitively(input string) (*ReplicationvCenterId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationvCenterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationvCenterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationvCenterName, ok = parsed.Parsed["replicationvCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationvCenterName", *parsed) + if id.ReplicationvCenterName, ok = input.Parsed["replicationvCenterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationvCenterName", input) } - return &id, nil + return nil } // ValidateReplicationvCenterID checks that 'input' can be parsed as a Replicationv Center ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationvcenters/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationvcenters/id_vault.go index 2c014d1915f..bdf783ba09a 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationvcenters/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/replicationvcenters/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/supportedoperatingsystems/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/supportedoperatingsystems/id_vault.go index 41796b3f013..f027ebd1633 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/supportedoperatingsystems/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/supportedoperatingsystems/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-04-01/targetcomputesizes/id_replicationprotecteditem.go b/resource-manager/recoveryservicessiterecovery/2023-04-01/targetcomputesizes/id_replicationprotecteditem.go index c16c821a521..0e4d833485d 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-04-01/targetcomputesizes/id_replicationprotecteditem.go +++ b/resource-manager/recoveryservicessiterecovery/2023-04-01/targetcomputesizes/id_replicationprotecteditem.go @@ -42,31 +42,9 @@ func ParseReplicationProtectedItemID(input string) (*ReplicationProtectedItemId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectedItemId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) - } - - if id.ReplicationProtectedItemName, ok = parsed.Parsed["replicationProtectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseReplicationProtectedItemIDInsensitively(input string) (*ReplicationPro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectedItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ReplicationProtectedItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - if id.ReplicationProtectedItemName, ok = parsed.Parsed["replicationProtectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", *parsed) + if id.ReplicationProtectedItemName, ok = input.Parsed["replicationProtectedItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", input) } - return &id, nil + return nil } // ValidateReplicationProtectedItemID checks that 'input' can be parsed as a Replication Protected Item ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/migrationrecoverypoints/id_migrationrecoverypoint.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/migrationrecoverypoints/id_migrationrecoverypoint.go index 85f737b6ac0..6635a133bbd 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/migrationrecoverypoints/id_migrationrecoverypoint.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/migrationrecoverypoints/id_migrationrecoverypoint.go @@ -44,35 +44,9 @@ func ParseMigrationRecoveryPointID(input string) (*MigrationRecoveryPointId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MigrationRecoveryPointId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) - } - - if id.ReplicationMigrationItemName, ok = parsed.Parsed["replicationMigrationItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationMigrationItemName", *parsed) - } - - if id.MigrationRecoveryPointName, ok = parsed.Parsed["migrationRecoveryPointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "migrationRecoveryPointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseMigrationRecoveryPointIDInsensitively(input string) (*MigrationRecover return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MigrationRecoveryPointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *MigrationRecoveryPointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - if id.ReplicationMigrationItemName, ok = parsed.Parsed["replicationMigrationItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationMigrationItemName", *parsed) + if id.ReplicationMigrationItemName, ok = input.Parsed["replicationMigrationItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationMigrationItemName", input) } - if id.MigrationRecoveryPointName, ok = parsed.Parsed["migrationRecoveryPointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "migrationRecoveryPointName", *parsed) + if id.MigrationRecoveryPointName, ok = input.Parsed["migrationRecoveryPointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "migrationRecoveryPointName", input) } - return &id, nil + return nil } // ValidateMigrationRecoveryPointID checks that 'input' can be parsed as a Migration Recovery Point ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/migrationrecoverypoints/id_replicationmigrationitem.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/migrationrecoverypoints/id_replicationmigrationitem.go index cd7a8f23e9c..bf44279baa2 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/migrationrecoverypoints/id_replicationmigrationitem.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/migrationrecoverypoints/id_replicationmigrationitem.go @@ -42,31 +42,9 @@ func ParseReplicationMigrationItemID(input string) (*ReplicationMigrationItemId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationMigrationItemId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) - } - - if id.ReplicationMigrationItemName, ok = parsed.Parsed["replicationMigrationItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationMigrationItemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseReplicationMigrationItemIDInsensitively(input string) (*ReplicationMig return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationMigrationItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ReplicationMigrationItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - if id.ReplicationMigrationItemName, ok = parsed.Parsed["replicationMigrationItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationMigrationItemName", *parsed) + if id.ReplicationMigrationItemName, ok = input.Parsed["replicationMigrationItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationMigrationItemName", input) } - return &id, nil + return nil } // ValidateReplicationMigrationItemID checks that 'input' can be parsed as a Replication Migration Item ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/recoverypoints/id_recoverypoint.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/recoverypoints/id_recoverypoint.go index ad43c081904..2e5b42d0055 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/recoverypoints/id_recoverypoint.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/recoverypoints/id_recoverypoint.go @@ -44,35 +44,9 @@ func ParseRecoveryPointID(input string) (*RecoveryPointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecoveryPointId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) - } - - if id.ReplicationProtectedItemName, ok = parsed.Parsed["replicationProtectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", *parsed) - } - - if id.RecoveryPointName, ok = parsed.Parsed["recoveryPointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseRecoveryPointIDInsensitively(input string) (*RecoveryPointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecoveryPointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RecoveryPointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - if id.ReplicationProtectedItemName, ok = parsed.Parsed["replicationProtectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", *parsed) + if id.ReplicationProtectedItemName, ok = input.Parsed["replicationProtectedItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", input) } - if id.RecoveryPointName, ok = parsed.Parsed["recoveryPointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointName", *parsed) + if id.RecoveryPointName, ok = input.Parsed["recoveryPointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "recoveryPointName", input) } - return &id, nil + return nil } // ValidateRecoveryPointID checks that 'input' can be parsed as a Recovery Point ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/recoverypoints/id_replicationprotecteditem.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/recoverypoints/id_replicationprotecteditem.go index d8eff4f5e4d..4a66a2ef06d 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/recoverypoints/id_replicationprotecteditem.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/recoverypoints/id_replicationprotecteditem.go @@ -42,31 +42,9 @@ func ParseReplicationProtectedItemID(input string) (*ReplicationProtectedItemId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectedItemId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) - } - - if id.ReplicationProtectedItemName, ok = parsed.Parsed["replicationProtectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseReplicationProtectedItemIDInsensitively(input string) (*ReplicationPro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectedItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ReplicationProtectedItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - if id.ReplicationProtectedItemName, ok = parsed.Parsed["replicationProtectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", *parsed) + if id.ReplicationProtectedItemName, ok = input.Parsed["replicationProtectedItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", input) } - return &id, nil + return nil } // ValidateReplicationProtectedItemID checks that 'input' can be parsed as a Replication Protected Item ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationalertsettings/id_replicationalertsetting.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationalertsettings/id_replicationalertsetting.go index fd4bbe7bf22..7cc4b4916cc 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationalertsettings/id_replicationalertsetting.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationalertsettings/id_replicationalertsetting.go @@ -38,23 +38,9 @@ func ParseReplicationAlertSettingID(input string) (*ReplicationAlertSettingId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationAlertSettingId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationAlertSettingName, ok = parsed.Parsed["replicationAlertSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationAlertSettingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationAlertSettingIDInsensitively(input string) (*ReplicationAler return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationAlertSettingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationAlertSettingId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationAlertSettingName, ok = parsed.Parsed["replicationAlertSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationAlertSettingName", *parsed) + if id.ReplicationAlertSettingName, ok = input.Parsed["replicationAlertSettingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationAlertSettingName", input) } - return &id, nil + return nil } // ValidateReplicationAlertSettingID checks that 'input' can be parsed as a Replication Alert Setting ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationalertsettings/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationalertsettings/id_vault.go index e942d185177..42183390cf3 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationalertsettings/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationalertsettings/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationappliances/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationappliances/id_vault.go index c5d015c9cd5..e37d9d05230 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationappliances/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationappliances/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationeligibilityresults/id_virtualmachine.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationeligibilityresults/id_virtualmachine.go index c27fea51a7b..47a386f894f 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationeligibilityresults/id_virtualmachine.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationeligibilityresults/id_virtualmachine.go @@ -36,19 +36,9 @@ func ParseVirtualMachineID(input string) (*VirtualMachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} - - 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.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineIDInsensitively(input string) (*VirtualMachineId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + if id.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) } - return &id, nil + return nil } // ValidateVirtualMachineID checks that 'input' can be parsed as a Virtual Machine ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationevents/id_replicationevent.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationevents/id_replicationevent.go index 49f794e3ccf..89ea4cefe9d 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationevents/id_replicationevent.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationevents/id_replicationevent.go @@ -38,23 +38,9 @@ func ParseReplicationEventID(input string) (*ReplicationEventId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationEventId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationEventName, ok = parsed.Parsed["replicationEventName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationEventName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationEventIDInsensitively(input string) (*ReplicationEventId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationEventId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationEventId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationEventName, ok = parsed.Parsed["replicationEventName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationEventName", *parsed) + if id.ReplicationEventName, ok = input.Parsed["replicationEventName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationEventName", input) } - return &id, nil + return nil } // ValidateReplicationEventID checks that 'input' can be parsed as a Replication Event ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationevents/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationevents/id_vault.go index 73bfeb6a4b7..3997a813f75 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationevents/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationevents/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationfabrics/id_replicationfabric.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationfabrics/id_replicationfabric.go index db5f8d7ab5e..72935507a8c 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationfabrics/id_replicationfabric.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationfabrics/id_replicationfabric.go @@ -38,23 +38,9 @@ func ParseReplicationFabricID(input string) (*ReplicationFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationFabricIDInsensitively(input string) (*ReplicationFabricId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationFabricId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - return &id, nil + return nil } // ValidateReplicationFabricID checks that 'input' can be parsed as a Replication Fabric ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationfabrics/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationfabrics/id_vault.go index 2a58d893c0e..b88ddbb8e33 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationfabrics/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationfabrics/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationjobs/id_replicationjob.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationjobs/id_replicationjob.go index 5f1c028407b..8aaf763372f 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationjobs/id_replicationjob.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationjobs/id_replicationjob.go @@ -38,23 +38,9 @@ func ParseReplicationJobID(input string) (*ReplicationJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationJobId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationJobName, ok = parsed.Parsed["replicationJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationJobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationJobIDInsensitively(input string) (*ReplicationJobId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationJobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationJobId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationJobName, ok = parsed.Parsed["replicationJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationJobName", *parsed) + if id.ReplicationJobName, ok = input.Parsed["replicationJobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationJobName", input) } - return &id, nil + return nil } // ValidateReplicationJobID checks that 'input' can be parsed as a Replication Job ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationjobs/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationjobs/id_vault.go index d63ce87429f..4da941eb753 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationjobs/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationjobs/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationlogicalnetworks/id_replicationfabric.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationlogicalnetworks/id_replicationfabric.go index a9dcb375bef..d34e37e4196 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationlogicalnetworks/id_replicationfabric.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationlogicalnetworks/id_replicationfabric.go @@ -38,23 +38,9 @@ func ParseReplicationFabricID(input string) (*ReplicationFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationFabricIDInsensitively(input string) (*ReplicationFabricId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationFabricId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - return &id, nil + return nil } // ValidateReplicationFabricID checks that 'input' can be parsed as a Replication Fabric ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationlogicalnetworks/id_replicationlogicalnetwork.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationlogicalnetworks/id_replicationlogicalnetwork.go index 26fb05fb737..67601ab37cb 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationlogicalnetworks/id_replicationlogicalnetwork.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationlogicalnetworks/id_replicationlogicalnetwork.go @@ -40,27 +40,9 @@ func ParseReplicationLogicalNetworkID(input string) (*ReplicationLogicalNetworkI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationLogicalNetworkId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationLogicalNetworkName, ok = parsed.Parsed["replicationLogicalNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationLogicalNetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationLogicalNetworkIDInsensitively(input string) (*ReplicationLo return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationLogicalNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationLogicalNetworkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationLogicalNetworkName, ok = parsed.Parsed["replicationLogicalNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationLogicalNetworkName", *parsed) + if id.ReplicationLogicalNetworkName, ok = input.Parsed["replicationLogicalNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationLogicalNetworkName", input) } - return &id, nil + return nil } // ValidateReplicationLogicalNetworkID checks that 'input' can be parsed as a Replication Logical Network ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationmigrationitems/id_replicationmigrationitem.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationmigrationitems/id_replicationmigrationitem.go index 1f52aff025c..4af937308f0 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationmigrationitems/id_replicationmigrationitem.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationmigrationitems/id_replicationmigrationitem.go @@ -42,31 +42,9 @@ func ParseReplicationMigrationItemID(input string) (*ReplicationMigrationItemId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationMigrationItemId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) - } - - if id.ReplicationMigrationItemName, ok = parsed.Parsed["replicationMigrationItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationMigrationItemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseReplicationMigrationItemIDInsensitively(input string) (*ReplicationMig return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationMigrationItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ReplicationMigrationItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - if id.ReplicationMigrationItemName, ok = parsed.Parsed["replicationMigrationItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationMigrationItemName", *parsed) + if id.ReplicationMigrationItemName, ok = input.Parsed["replicationMigrationItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationMigrationItemName", input) } - return &id, nil + return nil } // ValidateReplicationMigrationItemID checks that 'input' can be parsed as a Replication Migration Item ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationmigrationitems/id_replicationprotectioncontainer.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationmigrationitems/id_replicationprotectioncontainer.go index e977a910480..434724573c3 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationmigrationitems/id_replicationprotectioncontainer.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationmigrationitems/id_replicationprotectioncontainer.go @@ -40,27 +40,9 @@ func ParseReplicationProtectionContainerID(input string) (*ReplicationProtection return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationProtectionContainerIDInsensitively(input string) (*Replicat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationProtectionContainerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - return &id, nil + return nil } // ValidateReplicationProtectionContainerID checks that 'input' can be parsed as a Replication Protection Container ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationmigrationitems/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationmigrationitems/id_vault.go index 58abd104387..e05e06bc8d8 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationmigrationitems/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationmigrationitems/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationnetworkmappings/id_replicationnetwork.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationnetworkmappings/id_replicationnetwork.go index 8f65b4f0ffd..521fb241bed 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationnetworkmappings/id_replicationnetwork.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationnetworkmappings/id_replicationnetwork.go @@ -40,27 +40,9 @@ func ParseReplicationNetworkID(input string) (*ReplicationNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationNetworkId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationNetworkName, ok = parsed.Parsed["replicationNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationNetworkIDInsensitively(input string) (*ReplicationNetworkId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationNetworkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationNetworkName, ok = parsed.Parsed["replicationNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkName", *parsed) + if id.ReplicationNetworkName, ok = input.Parsed["replicationNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkName", input) } - return &id, nil + return nil } // ValidateReplicationNetworkID checks that 'input' can be parsed as a Replication Network ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationnetworkmappings/id_replicationnetworkmapping.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationnetworkmappings/id_replicationnetworkmapping.go index e67c61eed51..5705f27e9b7 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationnetworkmappings/id_replicationnetworkmapping.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationnetworkmappings/id_replicationnetworkmapping.go @@ -42,31 +42,9 @@ func ParseReplicationNetworkMappingID(input string) (*ReplicationNetworkMappingI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationNetworkMappingId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationNetworkName, ok = parsed.Parsed["replicationNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkName", *parsed) - } - - if id.ReplicationNetworkMappingName, ok = parsed.Parsed["replicationNetworkMappingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkMappingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseReplicationNetworkMappingIDInsensitively(input string) (*ReplicationNe return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationNetworkMappingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ReplicationNetworkMappingId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationNetworkName, ok = parsed.Parsed["replicationNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkName", *parsed) + if id.ReplicationNetworkName, ok = input.Parsed["replicationNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkName", input) } - if id.ReplicationNetworkMappingName, ok = parsed.Parsed["replicationNetworkMappingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkMappingName", *parsed) + if id.ReplicationNetworkMappingName, ok = input.Parsed["replicationNetworkMappingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkMappingName", input) } - return &id, nil + return nil } // ValidateReplicationNetworkMappingID checks that 'input' can be parsed as a Replication Network Mapping ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationnetworkmappings/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationnetworkmappings/id_vault.go index 192509d68b9..e154527e540 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationnetworkmappings/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationnetworkmappings/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationnetworks/id_replicationfabric.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationnetworks/id_replicationfabric.go index 73c02b723ee..c46331fc5f7 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationnetworks/id_replicationfabric.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationnetworks/id_replicationfabric.go @@ -38,23 +38,9 @@ func ParseReplicationFabricID(input string) (*ReplicationFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationFabricIDInsensitively(input string) (*ReplicationFabricId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationFabricId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - return &id, nil + return nil } // ValidateReplicationFabricID checks that 'input' can be parsed as a Replication Fabric ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationnetworks/id_replicationnetwork.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationnetworks/id_replicationnetwork.go index e1869f6fb0d..e9f54c2f47a 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationnetworks/id_replicationnetwork.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationnetworks/id_replicationnetwork.go @@ -40,27 +40,9 @@ func ParseReplicationNetworkID(input string) (*ReplicationNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationNetworkId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationNetworkName, ok = parsed.Parsed["replicationNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationNetworkIDInsensitively(input string) (*ReplicationNetworkId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationNetworkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationNetworkName, ok = parsed.Parsed["replicationNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkName", *parsed) + if id.ReplicationNetworkName, ok = input.Parsed["replicationNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationNetworkName", input) } - return &id, nil + return nil } // ValidateReplicationNetworkID checks that 'input' can be parsed as a Replication Network ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationnetworks/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationnetworks/id_vault.go index 0bfde13c55d..6e0f3a3d4a3 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationnetworks/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationnetworks/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationpolicies/id_replicationpolicy.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationpolicies/id_replicationpolicy.go index c9d0ad0e634..a75a6de5d56 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationpolicies/id_replicationpolicy.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationpolicies/id_replicationpolicy.go @@ -38,23 +38,9 @@ func ParseReplicationPolicyID(input string) (*ReplicationPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationPolicyId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationPolicyName, ok = parsed.Parsed["replicationPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationPolicyIDInsensitively(input string) (*ReplicationPolicyId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationPolicyName, ok = parsed.Parsed["replicationPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationPolicyName", *parsed) + if id.ReplicationPolicyName, ok = input.Parsed["replicationPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationPolicyName", input) } - return &id, nil + return nil } // ValidateReplicationPolicyID checks that 'input' can be parsed as a Replication Policy ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationpolicies/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationpolicies/id_vault.go index f4a5bf6b711..6a89bd687a5 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationpolicies/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationpolicies/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotectableitems/id_replicationprotectableitem.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotectableitems/id_replicationprotectableitem.go index f7f0b3936ce..90f92bce414 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotectableitems/id_replicationprotectableitem.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotectableitems/id_replicationprotectableitem.go @@ -42,31 +42,9 @@ func ParseReplicationProtectableItemID(input string) (*ReplicationProtectableIte return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectableItemId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) - } - - if id.ReplicationProtectableItemName, ok = parsed.Parsed["replicationProtectableItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectableItemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseReplicationProtectableItemIDInsensitively(input string) (*ReplicationP return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectableItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ReplicationProtectableItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - if id.ReplicationProtectableItemName, ok = parsed.Parsed["replicationProtectableItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectableItemName", *parsed) + if id.ReplicationProtectableItemName, ok = input.Parsed["replicationProtectableItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectableItemName", input) } - return &id, nil + return nil } // ValidateReplicationProtectableItemID checks that 'input' can be parsed as a Replication Protectable Item ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotectableitems/id_replicationprotectioncontainer.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotectableitems/id_replicationprotectioncontainer.go index 927a68eca8c..ce37ff1bc04 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotectableitems/id_replicationprotectioncontainer.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotectableitems/id_replicationprotectioncontainer.go @@ -40,27 +40,9 @@ func ParseReplicationProtectionContainerID(input string) (*ReplicationProtection return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationProtectionContainerIDInsensitively(input string) (*Replicat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationProtectionContainerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - return &id, nil + return nil } // ValidateReplicationProtectionContainerID checks that 'input' can be parsed as a Replication Protection Container ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotecteditems/id_replicationprotecteditem.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotecteditems/id_replicationprotecteditem.go index 557ea1c29ea..1857f1b1c6d 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotecteditems/id_replicationprotecteditem.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotecteditems/id_replicationprotecteditem.go @@ -42,31 +42,9 @@ func ParseReplicationProtectedItemID(input string) (*ReplicationProtectedItemId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectedItemId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) - } - - if id.ReplicationProtectedItemName, ok = parsed.Parsed["replicationProtectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseReplicationProtectedItemIDInsensitively(input string) (*ReplicationPro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectedItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ReplicationProtectedItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - if id.ReplicationProtectedItemName, ok = parsed.Parsed["replicationProtectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", *parsed) + if id.ReplicationProtectedItemName, ok = input.Parsed["replicationProtectedItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", input) } - return &id, nil + return nil } // ValidateReplicationProtectedItemID checks that 'input' can be parsed as a Replication Protected Item ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotecteditems/id_replicationprotectioncontainer.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotecteditems/id_replicationprotectioncontainer.go index 4c5b4524f12..8f0abd62b2c 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotecteditems/id_replicationprotectioncontainer.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotecteditems/id_replicationprotectioncontainer.go @@ -40,27 +40,9 @@ func ParseReplicationProtectionContainerID(input string) (*ReplicationProtection return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationProtectionContainerIDInsensitively(input string) (*Replicat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationProtectionContainerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - return &id, nil + return nil } // ValidateReplicationProtectionContainerID checks that 'input' can be parsed as a Replication Protection Container ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotecteditems/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotecteditems/id_vault.go index 1e669936aab..dbbb913e424 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotecteditems/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotecteditems/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotectioncontainermappings/id_replicationprotectioncontainer.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotectioncontainermappings/id_replicationprotectioncontainer.go index c1b2a09565d..0c905cb402a 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotectioncontainermappings/id_replicationprotectioncontainer.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotectioncontainermappings/id_replicationprotectioncontainer.go @@ -40,27 +40,9 @@ func ParseReplicationProtectionContainerID(input string) (*ReplicationProtection return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationProtectionContainerIDInsensitively(input string) (*Replicat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationProtectionContainerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - return &id, nil + return nil } // ValidateReplicationProtectionContainerID checks that 'input' can be parsed as a Replication Protection Container ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotectioncontainermappings/id_replicationprotectioncontainermapping.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotectioncontainermappings/id_replicationprotectioncontainermapping.go index 3a5c8ab08a9..7c336381006 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotectioncontainermappings/id_replicationprotectioncontainermapping.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotectioncontainermappings/id_replicationprotectioncontainermapping.go @@ -42,31 +42,9 @@ func ParseReplicationProtectionContainerMappingID(input string) (*ReplicationPro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerMappingId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) - } - - if id.ReplicationProtectionContainerMappingName, ok = parsed.Parsed["replicationProtectionContainerMappingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerMappingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseReplicationProtectionContainerMappingIDInsensitively(input string) (*R return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerMappingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ReplicationProtectionContainerMappingId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - if id.ReplicationProtectionContainerMappingName, ok = parsed.Parsed["replicationProtectionContainerMappingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerMappingName", *parsed) + if id.ReplicationProtectionContainerMappingName, ok = input.Parsed["replicationProtectionContainerMappingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerMappingName", input) } - return &id, nil + return nil } // ValidateReplicationProtectionContainerMappingID checks that 'input' can be parsed as a Replication Protection Container Mapping ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotectioncontainermappings/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotectioncontainermappings/id_vault.go index 7aa36b783ff..2a63a1f3299 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotectioncontainermappings/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotectioncontainermappings/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotectioncontainers/id_replicationfabric.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotectioncontainers/id_replicationfabric.go index c8c5de12a39..7668b03a571 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotectioncontainers/id_replicationfabric.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotectioncontainers/id_replicationfabric.go @@ -38,23 +38,9 @@ func ParseReplicationFabricID(input string) (*ReplicationFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationFabricIDInsensitively(input string) (*ReplicationFabricId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationFabricId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - return &id, nil + return nil } // ValidateReplicationFabricID checks that 'input' can be parsed as a Replication Fabric ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotectioncontainers/id_replicationprotectioncontainer.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotectioncontainers/id_replicationprotectioncontainer.go index 41b97b229a1..e5ac027a57a 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotectioncontainers/id_replicationprotectioncontainer.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotectioncontainers/id_replicationprotectioncontainer.go @@ -40,27 +40,9 @@ func ParseReplicationProtectionContainerID(input string) (*ReplicationProtection return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationProtectionContainerIDInsensitively(input string) (*Replicat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionContainerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationProtectionContainerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - return &id, nil + return nil } // ValidateReplicationProtectionContainerID checks that 'input' can be parsed as a Replication Protection Container ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotectioncontainers/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotectioncontainers/id_vault.go index 6e73b89bd30..123feaadd44 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotectioncontainers/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotectioncontainers/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotectionintents/id_replicationprotectionintent.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotectionintents/id_replicationprotectionintent.go index 4c5fc59a48c..6972c69b12a 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotectionintents/id_replicationprotectionintent.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotectionintents/id_replicationprotectionintent.go @@ -38,23 +38,9 @@ func ParseReplicationProtectionIntentID(input string) (*ReplicationProtectionInt return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionIntentId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationProtectionIntentName, ok = parsed.Parsed["replicationProtectionIntentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionIntentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationProtectionIntentIDInsensitively(input string) (*Replication return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectionIntentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationProtectionIntentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationProtectionIntentName, ok = parsed.Parsed["replicationProtectionIntentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionIntentName", *parsed) + if id.ReplicationProtectionIntentName, ok = input.Parsed["replicationProtectionIntentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionIntentName", input) } - return &id, nil + return nil } // ValidateReplicationProtectionIntentID checks that 'input' can be parsed as a Replication Protection Intent ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotectionintents/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotectionintents/id_vault.go index 045675168a5..8e68c254171 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotectionintents/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationprotectionintents/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationrecoveryplans/id_replicationrecoveryplan.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationrecoveryplans/id_replicationrecoveryplan.go index f99b2d54f2b..b7787ae706b 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationrecoveryplans/id_replicationrecoveryplan.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationrecoveryplans/id_replicationrecoveryplan.go @@ -38,23 +38,9 @@ func ParseReplicationRecoveryPlanID(input string) (*ReplicationRecoveryPlanId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationRecoveryPlanId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationRecoveryPlanName, ok = parsed.Parsed["replicationRecoveryPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationRecoveryPlanName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationRecoveryPlanIDInsensitively(input string) (*ReplicationReco return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationRecoveryPlanId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationRecoveryPlanId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationRecoveryPlanName, ok = parsed.Parsed["replicationRecoveryPlanName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationRecoveryPlanName", *parsed) + if id.ReplicationRecoveryPlanName, ok = input.Parsed["replicationRecoveryPlanName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationRecoveryPlanName", input) } - return &id, nil + return nil } // ValidateReplicationRecoveryPlanID checks that 'input' can be parsed as a Replication Recovery Plan ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationrecoveryplans/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationrecoveryplans/id_vault.go index 2682100c630..b15709cdd0f 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationrecoveryplans/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationrecoveryplans/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationrecoveryservicesproviders/id_replicationfabric.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationrecoveryservicesproviders/id_replicationfabric.go index 34d30092c2e..12020d9804c 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationrecoveryservicesproviders/id_replicationfabric.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationrecoveryservicesproviders/id_replicationfabric.go @@ -38,23 +38,9 @@ func ParseReplicationFabricID(input string) (*ReplicationFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationFabricIDInsensitively(input string) (*ReplicationFabricId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationFabricId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - return &id, nil + return nil } // ValidateReplicationFabricID checks that 'input' can be parsed as a Replication Fabric ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationrecoveryservicesproviders/id_replicationrecoveryservicesprovider.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationrecoveryservicesproviders/id_replicationrecoveryservicesprovider.go index 7afec8d9785..2edeccae53a 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationrecoveryservicesproviders/id_replicationrecoveryservicesprovider.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationrecoveryservicesproviders/id_replicationrecoveryservicesprovider.go @@ -40,27 +40,9 @@ func ParseReplicationRecoveryServicesProviderID(input string) (*ReplicationRecov return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationRecoveryServicesProviderId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationRecoveryServicesProviderName, ok = parsed.Parsed["replicationRecoveryServicesProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationRecoveryServicesProviderName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationRecoveryServicesProviderIDInsensitively(input string) (*Rep return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationRecoveryServicesProviderId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationRecoveryServicesProviderId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationRecoveryServicesProviderName, ok = parsed.Parsed["replicationRecoveryServicesProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationRecoveryServicesProviderName", *parsed) + if id.ReplicationRecoveryServicesProviderName, ok = input.Parsed["replicationRecoveryServicesProviderName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationRecoveryServicesProviderName", input) } - return &id, nil + return nil } // ValidateReplicationRecoveryServicesProviderID checks that 'input' can be parsed as a Replication Recovery Services Provider ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationrecoveryservicesproviders/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationrecoveryservicesproviders/id_vault.go index a80d2f9b1b3..c2d20a2cf82 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationrecoveryservicesproviders/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationrecoveryservicesproviders/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationstorageclassificationmappings/id_replicationstorageclassification.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationstorageclassificationmappings/id_replicationstorageclassification.go index c9e4158848c..aa52aca12f6 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationstorageclassificationmappings/id_replicationstorageclassification.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationstorageclassificationmappings/id_replicationstorageclassification.go @@ -40,27 +40,9 @@ func ParseReplicationStorageClassificationID(input string) (*ReplicationStorageC return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationStorageClassificationId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationStorageClassificationName, ok = parsed.Parsed["replicationStorageClassificationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationStorageClassificationIDInsensitively(input string) (*Replic return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationStorageClassificationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationStorageClassificationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationStorageClassificationName, ok = parsed.Parsed["replicationStorageClassificationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationName", *parsed) + if id.ReplicationStorageClassificationName, ok = input.Parsed["replicationStorageClassificationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationName", input) } - return &id, nil + return nil } // ValidateReplicationStorageClassificationID checks that 'input' can be parsed as a Replication Storage Classification ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationstorageclassificationmappings/id_replicationstorageclassificationmapping.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationstorageclassificationmappings/id_replicationstorageclassificationmapping.go index b5ef125805c..6caeede79df 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationstorageclassificationmappings/id_replicationstorageclassificationmapping.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationstorageclassificationmappings/id_replicationstorageclassificationmapping.go @@ -42,31 +42,9 @@ func ParseReplicationStorageClassificationMappingID(input string) (*ReplicationS return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationStorageClassificationMappingId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationStorageClassificationName, ok = parsed.Parsed["replicationStorageClassificationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationName", *parsed) - } - - if id.ReplicationStorageClassificationMappingName, ok = parsed.Parsed["replicationStorageClassificationMappingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationMappingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseReplicationStorageClassificationMappingIDInsensitively(input string) ( return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationStorageClassificationMappingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ReplicationStorageClassificationMappingId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationStorageClassificationName, ok = parsed.Parsed["replicationStorageClassificationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationName", *parsed) + if id.ReplicationStorageClassificationName, ok = input.Parsed["replicationStorageClassificationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationName", input) } - if id.ReplicationStorageClassificationMappingName, ok = parsed.Parsed["replicationStorageClassificationMappingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationMappingName", *parsed) + if id.ReplicationStorageClassificationMappingName, ok = input.Parsed["replicationStorageClassificationMappingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationMappingName", input) } - return &id, nil + return nil } // ValidateReplicationStorageClassificationMappingID checks that 'input' can be parsed as a Replication Storage Classification Mapping ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationstorageclassificationmappings/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationstorageclassificationmappings/id_vault.go index 06f16f6053a..1bb58c8307a 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationstorageclassificationmappings/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationstorageclassificationmappings/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationstorageclassifications/id_replicationfabric.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationstorageclassifications/id_replicationfabric.go index 5f6840e7c65..a91440b70ca 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationstorageclassifications/id_replicationfabric.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationstorageclassifications/id_replicationfabric.go @@ -38,23 +38,9 @@ func ParseReplicationFabricID(input string) (*ReplicationFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationFabricIDInsensitively(input string) (*ReplicationFabricId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationFabricId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - return &id, nil + return nil } // ValidateReplicationFabricID checks that 'input' can be parsed as a Replication Fabric ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationstorageclassifications/id_replicationstorageclassification.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationstorageclassifications/id_replicationstorageclassification.go index ceff72d0b94..e415acfef9e 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationstorageclassifications/id_replicationstorageclassification.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationstorageclassifications/id_replicationstorageclassification.go @@ -40,27 +40,9 @@ func ParseReplicationStorageClassificationID(input string) (*ReplicationStorageC return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationStorageClassificationId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationStorageClassificationName, ok = parsed.Parsed["replicationStorageClassificationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationStorageClassificationIDInsensitively(input string) (*Replic return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationStorageClassificationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationStorageClassificationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationStorageClassificationName, ok = parsed.Parsed["replicationStorageClassificationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationName", *parsed) + if id.ReplicationStorageClassificationName, ok = input.Parsed["replicationStorageClassificationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationStorageClassificationName", input) } - return &id, nil + return nil } // ValidateReplicationStorageClassificationID checks that 'input' can be parsed as a Replication Storage Classification ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationstorageclassifications/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationstorageclassifications/id_vault.go index 0a08dd4e876..da6d5015c80 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationstorageclassifications/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationstorageclassifications/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationvaulthealth/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationvaulthealth/id_vault.go index 36c0195fba0..5755dfb54a6 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationvaulthealth/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationvaulthealth/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationvaultsetting/id_replicationvaultsetting.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationvaultsetting/id_replicationvaultsetting.go index 26e25501d51..806eee37993 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationvaultsetting/id_replicationvaultsetting.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationvaultsetting/id_replicationvaultsetting.go @@ -38,23 +38,9 @@ func ParseReplicationVaultSettingID(input string) (*ReplicationVaultSettingId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationVaultSettingId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationVaultSettingName, ok = parsed.Parsed["replicationVaultSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationVaultSettingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationVaultSettingIDInsensitively(input string) (*ReplicationVaul return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationVaultSettingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationVaultSettingId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationVaultSettingName, ok = parsed.Parsed["replicationVaultSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationVaultSettingName", *parsed) + if id.ReplicationVaultSettingName, ok = input.Parsed["replicationVaultSettingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationVaultSettingName", input) } - return &id, nil + return nil } // ValidateReplicationVaultSettingID checks that 'input' can be parsed as a Replication Vault Setting ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationvaultsetting/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationvaultsetting/id_vault.go index accb6845a98..879a3742af7 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationvaultsetting/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationvaultsetting/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationvcenters/id_replicationfabric.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationvcenters/id_replicationfabric.go index 43b4791b4ef..966f39ff0f9 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationvcenters/id_replicationfabric.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationvcenters/id_replicationfabric.go @@ -38,23 +38,9 @@ func ParseReplicationFabricID(input string) (*ReplicationFabricId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReplicationFabricIDInsensitively(input string) (*ReplicationFabricId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationFabricId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReplicationFabricId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - return &id, nil + return nil } // ValidateReplicationFabricID checks that 'input' can be parsed as a Replication Fabric ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationvcenters/id_replicationvcenter.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationvcenters/id_replicationvcenter.go index 1ed680e598b..bc3e7254dfe 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationvcenters/id_replicationvcenter.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationvcenters/id_replicationvcenter.go @@ -40,27 +40,9 @@ func ParseReplicationvCenterID(input string) (*ReplicationvCenterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationvCenterId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationvCenterName, ok = parsed.Parsed["replicationvCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationvCenterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationvCenterIDInsensitively(input string) (*ReplicationvCenterId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationvCenterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationvCenterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationvCenterName, ok = parsed.Parsed["replicationvCenterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationvCenterName", *parsed) + if id.ReplicationvCenterName, ok = input.Parsed["replicationvCenterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationvCenterName", input) } - return &id, nil + return nil } // ValidateReplicationvCenterID checks that 'input' can be parsed as a Replicationv Center ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationvcenters/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationvcenters/id_vault.go index 2c014d1915f..bdf783ba09a 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationvcenters/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/replicationvcenters/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/supportedoperatingsystems/id_vault.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/supportedoperatingsystems/id_vault.go index 41796b3f013..f027ebd1633 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/supportedoperatingsystems/id_vault.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/supportedoperatingsystems/id_vault.go @@ -36,19 +36,9 @@ func ParseVaultID(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVaultIDInsensitively(input string) (*VaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - return &id, nil + return nil } // ValidateVaultID checks that 'input' can be parsed as a Vault ID diff --git a/resource-manager/recoveryservicessiterecovery/2023-06-01/targetcomputesizes/id_replicationprotecteditem.go b/resource-manager/recoveryservicessiterecovery/2023-06-01/targetcomputesizes/id_replicationprotecteditem.go index c16c821a521..0e4d833485d 100644 --- a/resource-manager/recoveryservicessiterecovery/2023-06-01/targetcomputesizes/id_replicationprotecteditem.go +++ b/resource-manager/recoveryservicessiterecovery/2023-06-01/targetcomputesizes/id_replicationprotecteditem.go @@ -42,31 +42,9 @@ func ParseReplicationProtectedItemID(input string) (*ReplicationProtectedItemId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectedItemId{} - - 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.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) - } - - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) - } - - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) - } - - if id.ReplicationProtectedItemName, ok = parsed.Parsed["replicationProtectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseReplicationProtectedItemIDInsensitively(input string) (*ReplicationPro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationProtectedItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ReplicationProtectedItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VaultName, ok = parsed.Parsed["vaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vaultName", *parsed) + if id.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) } - if id.ReplicationFabricName, ok = parsed.Parsed["replicationFabricName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", *parsed) + if id.ReplicationFabricName, ok = input.Parsed["replicationFabricName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationFabricName", input) } - if id.ReplicationProtectionContainerName, ok = parsed.Parsed["replicationProtectionContainerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", *parsed) + if id.ReplicationProtectionContainerName, ok = input.Parsed["replicationProtectionContainerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectionContainerName", input) } - if id.ReplicationProtectedItemName, ok = parsed.Parsed["replicationProtectedItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", *parsed) + if id.ReplicationProtectedItemName, ok = input.Parsed["replicationProtectedItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "replicationProtectedItemName", input) } - return &id, nil + return nil } // ValidateReplicationProtectedItemID checks that 'input' can be parsed as a Replication Protected Item ID diff --git a/resource-manager/redhatopenshift/2022-04-01/openshiftclusters/id_openshiftcluster.go b/resource-manager/redhatopenshift/2022-04-01/openshiftclusters/id_openshiftcluster.go index 780735bd606..94a8a392d32 100644 --- a/resource-manager/redhatopenshift/2022-04-01/openshiftclusters/id_openshiftcluster.go +++ b/resource-manager/redhatopenshift/2022-04-01/openshiftclusters/id_openshiftcluster.go @@ -36,19 +36,9 @@ func ParseOpenShiftClusterID(input string) (*OpenShiftClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OpenShiftClusterId{} - - 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.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseOpenShiftClusterIDInsensitively(input string) (*OpenShiftClusterId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OpenShiftClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *OpenShiftClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) + if id.OpenShiftClusterName, ok = input.Parsed["openShiftClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", input) } - return &id, nil + return nil } // ValidateOpenShiftClusterID checks that 'input' can be parsed as a Open Shift Cluster ID diff --git a/resource-manager/redhatopenshift/2022-09-04/machinepools/id_machinepool.go b/resource-manager/redhatopenshift/2022-09-04/machinepools/id_machinepool.go index bc95b8dffe5..972bec1f296 100644 --- a/resource-manager/redhatopenshift/2022-09-04/machinepools/id_machinepool.go +++ b/resource-manager/redhatopenshift/2022-09-04/machinepools/id_machinepool.go @@ -38,23 +38,9 @@ func ParseMachinePoolID(input string) (*MachinePoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MachinePoolId{} - - 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.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) - } - - if id.MachinePoolName, ok = parsed.Parsed["machinePoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machinePoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseMachinePoolIDInsensitively(input string) (*MachinePoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MachinePoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *MachinePoolId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) + if id.OpenShiftClusterName, ok = input.Parsed["openShiftClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", input) } - if id.MachinePoolName, ok = parsed.Parsed["machinePoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machinePoolName", *parsed) + if id.MachinePoolName, ok = input.Parsed["machinePoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "machinePoolName", input) } - return &id, nil + return nil } // ValidateMachinePoolID checks that 'input' can be parsed as a Machine Pool ID diff --git a/resource-manager/redhatopenshift/2022-09-04/machinepools/id_openshiftcluster.go b/resource-manager/redhatopenshift/2022-09-04/machinepools/id_openshiftcluster.go index 574447f01bc..2623ad7c176 100644 --- a/resource-manager/redhatopenshift/2022-09-04/machinepools/id_openshiftcluster.go +++ b/resource-manager/redhatopenshift/2022-09-04/machinepools/id_openshiftcluster.go @@ -36,19 +36,9 @@ func ParseOpenShiftClusterID(input string) (*OpenShiftClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OpenShiftClusterId{} - - 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.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseOpenShiftClusterIDInsensitively(input string) (*OpenShiftClusterId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OpenShiftClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *OpenShiftClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) + if id.OpenShiftClusterName, ok = input.Parsed["openShiftClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", input) } - return &id, nil + return nil } // ValidateOpenShiftClusterID checks that 'input' can be parsed as a Open Shift Cluster ID diff --git a/resource-manager/redhatopenshift/2022-09-04/openshiftclusters/id_provideropenshiftcluster.go b/resource-manager/redhatopenshift/2022-09-04/openshiftclusters/id_provideropenshiftcluster.go index c73f19875c5..ce5c49dcfaf 100644 --- a/resource-manager/redhatopenshift/2022-09-04/openshiftclusters/id_provideropenshiftcluster.go +++ b/resource-manager/redhatopenshift/2022-09-04/openshiftclusters/id_provideropenshiftcluster.go @@ -36,19 +36,9 @@ func ParseProviderOpenShiftClusterID(input string) (*ProviderOpenShiftClusterId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderOpenShiftClusterId{} - - 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.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderOpenShiftClusterIDInsensitively(input string) (*ProviderOpenSh return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderOpenShiftClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderOpenShiftClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) + if id.OpenShiftClusterName, ok = input.Parsed["openShiftClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", input) } - return &id, nil + return nil } // ValidateProviderOpenShiftClusterID checks that 'input' can be parsed as a Provider Open Shift Cluster ID diff --git a/resource-manager/redhatopenshift/2022-09-04/openshiftversions/id_location.go b/resource-manager/redhatopenshift/2022-09-04/openshiftversions/id_location.go index f2a16f27559..2f844247812 100644 --- a/resource-manager/redhatopenshift/2022-09-04/openshiftversions/id_location.go +++ b/resource-manager/redhatopenshift/2022-09-04/openshiftversions/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/redhatopenshift/2022-09-04/secrets/id_openshiftcluster.go b/resource-manager/redhatopenshift/2022-09-04/secrets/id_openshiftcluster.go index ce480b3d4eb..840d35dbdcd 100644 --- a/resource-manager/redhatopenshift/2022-09-04/secrets/id_openshiftcluster.go +++ b/resource-manager/redhatopenshift/2022-09-04/secrets/id_openshiftcluster.go @@ -36,19 +36,9 @@ func ParseOpenShiftClusterID(input string) (*OpenShiftClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OpenShiftClusterId{} - - 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.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseOpenShiftClusterIDInsensitively(input string) (*OpenShiftClusterId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OpenShiftClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *OpenShiftClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) + if id.OpenShiftClusterName, ok = input.Parsed["openShiftClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", input) } - return &id, nil + return nil } // ValidateOpenShiftClusterID checks that 'input' can be parsed as a Open Shift Cluster ID diff --git a/resource-manager/redhatopenshift/2022-09-04/secrets/id_secret.go b/resource-manager/redhatopenshift/2022-09-04/secrets/id_secret.go index fc0a40a7c51..136d48bcf7d 100644 --- a/resource-manager/redhatopenshift/2022-09-04/secrets/id_secret.go +++ b/resource-manager/redhatopenshift/2022-09-04/secrets/id_secret.go @@ -38,23 +38,9 @@ func ParseSecretID(input string) (*SecretId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecretId{} - - 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.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) - } - - if id.SecretName, ok = parsed.Parsed["secretName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "secretName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSecretIDInsensitively(input string) (*SecretId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecretId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SecretId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) + if id.OpenShiftClusterName, ok = input.Parsed["openShiftClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", input) } - if id.SecretName, ok = parsed.Parsed["secretName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "secretName", *parsed) + if id.SecretName, ok = input.Parsed["secretName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "secretName", input) } - return &id, nil + return nil } // ValidateSecretID checks that 'input' can be parsed as a Secret ID diff --git a/resource-manager/redhatopenshift/2022-09-04/syncidentityproviders/id_openshiftcluster.go b/resource-manager/redhatopenshift/2022-09-04/syncidentityproviders/id_openshiftcluster.go index 8c29a31881e..8e89c0a3fcb 100644 --- a/resource-manager/redhatopenshift/2022-09-04/syncidentityproviders/id_openshiftcluster.go +++ b/resource-manager/redhatopenshift/2022-09-04/syncidentityproviders/id_openshiftcluster.go @@ -36,19 +36,9 @@ func ParseOpenShiftClusterID(input string) (*OpenShiftClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OpenShiftClusterId{} - - 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.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseOpenShiftClusterIDInsensitively(input string) (*OpenShiftClusterId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OpenShiftClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *OpenShiftClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) + if id.OpenShiftClusterName, ok = input.Parsed["openShiftClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", input) } - return &id, nil + return nil } // ValidateOpenShiftClusterID checks that 'input' can be parsed as a Open Shift Cluster ID diff --git a/resource-manager/redhatopenshift/2022-09-04/syncidentityproviders/id_syncidentityprovider.go b/resource-manager/redhatopenshift/2022-09-04/syncidentityproviders/id_syncidentityprovider.go index 79cd41328cc..b7f2e3d2307 100644 --- a/resource-manager/redhatopenshift/2022-09-04/syncidentityproviders/id_syncidentityprovider.go +++ b/resource-manager/redhatopenshift/2022-09-04/syncidentityproviders/id_syncidentityprovider.go @@ -38,23 +38,9 @@ func ParseSyncIdentityProviderID(input string) (*SyncIdentityProviderId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SyncIdentityProviderId{} - - 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.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) - } - - if id.SyncIdentityProviderName, ok = parsed.Parsed["syncIdentityProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncIdentityProviderName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSyncIdentityProviderIDInsensitively(input string) (*SyncIdentityProvid return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SyncIdentityProviderId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SyncIdentityProviderId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) + if id.OpenShiftClusterName, ok = input.Parsed["openShiftClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", input) } - if id.SyncIdentityProviderName, ok = parsed.Parsed["syncIdentityProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncIdentityProviderName", *parsed) + if id.SyncIdentityProviderName, ok = input.Parsed["syncIdentityProviderName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "syncIdentityProviderName", input) } - return &id, nil + return nil } // ValidateSyncIdentityProviderID checks that 'input' can be parsed as a Sync Identity Provider ID diff --git a/resource-manager/redhatopenshift/2022-09-04/syncsets/id_openshiftcluster.go b/resource-manager/redhatopenshift/2022-09-04/syncsets/id_openshiftcluster.go index 4b90fb86b8f..d6a99d6f42e 100644 --- a/resource-manager/redhatopenshift/2022-09-04/syncsets/id_openshiftcluster.go +++ b/resource-manager/redhatopenshift/2022-09-04/syncsets/id_openshiftcluster.go @@ -36,19 +36,9 @@ func ParseOpenShiftClusterID(input string) (*OpenShiftClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OpenShiftClusterId{} - - 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.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseOpenShiftClusterIDInsensitively(input string) (*OpenShiftClusterId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OpenShiftClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *OpenShiftClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) + if id.OpenShiftClusterName, ok = input.Parsed["openShiftClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", input) } - return &id, nil + return nil } // ValidateOpenShiftClusterID checks that 'input' can be parsed as a Open Shift Cluster ID diff --git a/resource-manager/redhatopenshift/2022-09-04/syncsets/id_syncset.go b/resource-manager/redhatopenshift/2022-09-04/syncsets/id_syncset.go index 4e91cc42633..7da2a9f51d3 100644 --- a/resource-manager/redhatopenshift/2022-09-04/syncsets/id_syncset.go +++ b/resource-manager/redhatopenshift/2022-09-04/syncsets/id_syncset.go @@ -38,23 +38,9 @@ func ParseSyncSetID(input string) (*SyncSetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SyncSetId{} - - 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.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) - } - - if id.SyncSetName, ok = parsed.Parsed["syncSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncSetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSyncSetIDInsensitively(input string) (*SyncSetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SyncSetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SyncSetId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) + if id.OpenShiftClusterName, ok = input.Parsed["openShiftClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", input) } - if id.SyncSetName, ok = parsed.Parsed["syncSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncSetName", *parsed) + if id.SyncSetName, ok = input.Parsed["syncSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "syncSetName", input) } - return &id, nil + return nil } // ValidateSyncSetID checks that 'input' can be parsed as a Sync Set ID diff --git a/resource-manager/redhatopenshift/2023-04-01/machinepools/id_machinepool.go b/resource-manager/redhatopenshift/2023-04-01/machinepools/id_machinepool.go index bc95b8dffe5..972bec1f296 100644 --- a/resource-manager/redhatopenshift/2023-04-01/machinepools/id_machinepool.go +++ b/resource-manager/redhatopenshift/2023-04-01/machinepools/id_machinepool.go @@ -38,23 +38,9 @@ func ParseMachinePoolID(input string) (*MachinePoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MachinePoolId{} - - 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.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) - } - - if id.MachinePoolName, ok = parsed.Parsed["machinePoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machinePoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseMachinePoolIDInsensitively(input string) (*MachinePoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MachinePoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *MachinePoolId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) + if id.OpenShiftClusterName, ok = input.Parsed["openShiftClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", input) } - if id.MachinePoolName, ok = parsed.Parsed["machinePoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machinePoolName", *parsed) + if id.MachinePoolName, ok = input.Parsed["machinePoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "machinePoolName", input) } - return &id, nil + return nil } // ValidateMachinePoolID checks that 'input' can be parsed as a Machine Pool ID diff --git a/resource-manager/redhatopenshift/2023-04-01/machinepools/id_openshiftcluster.go b/resource-manager/redhatopenshift/2023-04-01/machinepools/id_openshiftcluster.go index 574447f01bc..2623ad7c176 100644 --- a/resource-manager/redhatopenshift/2023-04-01/machinepools/id_openshiftcluster.go +++ b/resource-manager/redhatopenshift/2023-04-01/machinepools/id_openshiftcluster.go @@ -36,19 +36,9 @@ func ParseOpenShiftClusterID(input string) (*OpenShiftClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OpenShiftClusterId{} - - 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.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseOpenShiftClusterIDInsensitively(input string) (*OpenShiftClusterId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OpenShiftClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *OpenShiftClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) + if id.OpenShiftClusterName, ok = input.Parsed["openShiftClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", input) } - return &id, nil + return nil } // ValidateOpenShiftClusterID checks that 'input' can be parsed as a Open Shift Cluster ID diff --git a/resource-manager/redhatopenshift/2023-04-01/openshiftclusters/id_provideropenshiftcluster.go b/resource-manager/redhatopenshift/2023-04-01/openshiftclusters/id_provideropenshiftcluster.go index c73f19875c5..ce5c49dcfaf 100644 --- a/resource-manager/redhatopenshift/2023-04-01/openshiftclusters/id_provideropenshiftcluster.go +++ b/resource-manager/redhatopenshift/2023-04-01/openshiftclusters/id_provideropenshiftcluster.go @@ -36,19 +36,9 @@ func ParseProviderOpenShiftClusterID(input string) (*ProviderOpenShiftClusterId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderOpenShiftClusterId{} - - 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.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderOpenShiftClusterIDInsensitively(input string) (*ProviderOpenSh return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderOpenShiftClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderOpenShiftClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) + if id.OpenShiftClusterName, ok = input.Parsed["openShiftClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", input) } - return &id, nil + return nil } // ValidateProviderOpenShiftClusterID checks that 'input' can be parsed as a Provider Open Shift Cluster ID diff --git a/resource-manager/redhatopenshift/2023-04-01/openshiftversions/id_location.go b/resource-manager/redhatopenshift/2023-04-01/openshiftversions/id_location.go index f2a16f27559..2f844247812 100644 --- a/resource-manager/redhatopenshift/2023-04-01/openshiftversions/id_location.go +++ b/resource-manager/redhatopenshift/2023-04-01/openshiftversions/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/redhatopenshift/2023-04-01/secrets/id_openshiftcluster.go b/resource-manager/redhatopenshift/2023-04-01/secrets/id_openshiftcluster.go index ce480b3d4eb..840d35dbdcd 100644 --- a/resource-manager/redhatopenshift/2023-04-01/secrets/id_openshiftcluster.go +++ b/resource-manager/redhatopenshift/2023-04-01/secrets/id_openshiftcluster.go @@ -36,19 +36,9 @@ func ParseOpenShiftClusterID(input string) (*OpenShiftClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OpenShiftClusterId{} - - 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.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseOpenShiftClusterIDInsensitively(input string) (*OpenShiftClusterId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OpenShiftClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *OpenShiftClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) + if id.OpenShiftClusterName, ok = input.Parsed["openShiftClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", input) } - return &id, nil + return nil } // ValidateOpenShiftClusterID checks that 'input' can be parsed as a Open Shift Cluster ID diff --git a/resource-manager/redhatopenshift/2023-04-01/secrets/id_secret.go b/resource-manager/redhatopenshift/2023-04-01/secrets/id_secret.go index fc0a40a7c51..136d48bcf7d 100644 --- a/resource-manager/redhatopenshift/2023-04-01/secrets/id_secret.go +++ b/resource-manager/redhatopenshift/2023-04-01/secrets/id_secret.go @@ -38,23 +38,9 @@ func ParseSecretID(input string) (*SecretId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecretId{} - - 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.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) - } - - if id.SecretName, ok = parsed.Parsed["secretName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "secretName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSecretIDInsensitively(input string) (*SecretId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecretId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SecretId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) + if id.OpenShiftClusterName, ok = input.Parsed["openShiftClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", input) } - if id.SecretName, ok = parsed.Parsed["secretName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "secretName", *parsed) + if id.SecretName, ok = input.Parsed["secretName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "secretName", input) } - return &id, nil + return nil } // ValidateSecretID checks that 'input' can be parsed as a Secret ID diff --git a/resource-manager/redhatopenshift/2023-04-01/syncidentityproviders/id_openshiftcluster.go b/resource-manager/redhatopenshift/2023-04-01/syncidentityproviders/id_openshiftcluster.go index 8c29a31881e..8e89c0a3fcb 100644 --- a/resource-manager/redhatopenshift/2023-04-01/syncidentityproviders/id_openshiftcluster.go +++ b/resource-manager/redhatopenshift/2023-04-01/syncidentityproviders/id_openshiftcluster.go @@ -36,19 +36,9 @@ func ParseOpenShiftClusterID(input string) (*OpenShiftClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OpenShiftClusterId{} - - 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.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseOpenShiftClusterIDInsensitively(input string) (*OpenShiftClusterId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OpenShiftClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *OpenShiftClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) + if id.OpenShiftClusterName, ok = input.Parsed["openShiftClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", input) } - return &id, nil + return nil } // ValidateOpenShiftClusterID checks that 'input' can be parsed as a Open Shift Cluster ID diff --git a/resource-manager/redhatopenshift/2023-04-01/syncidentityproviders/id_syncidentityprovider.go b/resource-manager/redhatopenshift/2023-04-01/syncidentityproviders/id_syncidentityprovider.go index 79cd41328cc..b7f2e3d2307 100644 --- a/resource-manager/redhatopenshift/2023-04-01/syncidentityproviders/id_syncidentityprovider.go +++ b/resource-manager/redhatopenshift/2023-04-01/syncidentityproviders/id_syncidentityprovider.go @@ -38,23 +38,9 @@ func ParseSyncIdentityProviderID(input string) (*SyncIdentityProviderId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SyncIdentityProviderId{} - - 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.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) - } - - if id.SyncIdentityProviderName, ok = parsed.Parsed["syncIdentityProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncIdentityProviderName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSyncIdentityProviderIDInsensitively(input string) (*SyncIdentityProvid return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SyncIdentityProviderId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SyncIdentityProviderId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) + if id.OpenShiftClusterName, ok = input.Parsed["openShiftClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", input) } - if id.SyncIdentityProviderName, ok = parsed.Parsed["syncIdentityProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncIdentityProviderName", *parsed) + if id.SyncIdentityProviderName, ok = input.Parsed["syncIdentityProviderName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "syncIdentityProviderName", input) } - return &id, nil + return nil } // ValidateSyncIdentityProviderID checks that 'input' can be parsed as a Sync Identity Provider ID diff --git a/resource-manager/redhatopenshift/2023-04-01/syncsets/id_openshiftcluster.go b/resource-manager/redhatopenshift/2023-04-01/syncsets/id_openshiftcluster.go index 4b90fb86b8f..d6a99d6f42e 100644 --- a/resource-manager/redhatopenshift/2023-04-01/syncsets/id_openshiftcluster.go +++ b/resource-manager/redhatopenshift/2023-04-01/syncsets/id_openshiftcluster.go @@ -36,19 +36,9 @@ func ParseOpenShiftClusterID(input string) (*OpenShiftClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OpenShiftClusterId{} - - 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.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseOpenShiftClusterIDInsensitively(input string) (*OpenShiftClusterId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OpenShiftClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *OpenShiftClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) + if id.OpenShiftClusterName, ok = input.Parsed["openShiftClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", input) } - return &id, nil + return nil } // ValidateOpenShiftClusterID checks that 'input' can be parsed as a Open Shift Cluster ID diff --git a/resource-manager/redhatopenshift/2023-04-01/syncsets/id_syncset.go b/resource-manager/redhatopenshift/2023-04-01/syncsets/id_syncset.go index 4e91cc42633..7da2a9f51d3 100644 --- a/resource-manager/redhatopenshift/2023-04-01/syncsets/id_syncset.go +++ b/resource-manager/redhatopenshift/2023-04-01/syncsets/id_syncset.go @@ -38,23 +38,9 @@ func ParseSyncSetID(input string) (*SyncSetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SyncSetId{} - - 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.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) - } - - if id.SyncSetName, ok = parsed.Parsed["syncSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncSetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSyncSetIDInsensitively(input string) (*SyncSetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SyncSetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SyncSetId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) + if id.OpenShiftClusterName, ok = input.Parsed["openShiftClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", input) } - if id.SyncSetName, ok = parsed.Parsed["syncSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncSetName", *parsed) + if id.SyncSetName, ok = input.Parsed["syncSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "syncSetName", input) } - return &id, nil + return nil } // ValidateSyncSetID checks that 'input' can be parsed as a Sync Set ID diff --git a/resource-manager/redhatopenshift/2023-09-04/machinepools/id_machinepool.go b/resource-manager/redhatopenshift/2023-09-04/machinepools/id_machinepool.go index bc95b8dffe5..972bec1f296 100644 --- a/resource-manager/redhatopenshift/2023-09-04/machinepools/id_machinepool.go +++ b/resource-manager/redhatopenshift/2023-09-04/machinepools/id_machinepool.go @@ -38,23 +38,9 @@ func ParseMachinePoolID(input string) (*MachinePoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MachinePoolId{} - - 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.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) - } - - if id.MachinePoolName, ok = parsed.Parsed["machinePoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machinePoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseMachinePoolIDInsensitively(input string) (*MachinePoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MachinePoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *MachinePoolId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) + if id.OpenShiftClusterName, ok = input.Parsed["openShiftClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", input) } - if id.MachinePoolName, ok = parsed.Parsed["machinePoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "machinePoolName", *parsed) + if id.MachinePoolName, ok = input.Parsed["machinePoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "machinePoolName", input) } - return &id, nil + return nil } // ValidateMachinePoolID checks that 'input' can be parsed as a Machine Pool ID diff --git a/resource-manager/redhatopenshift/2023-09-04/machinepools/id_openshiftcluster.go b/resource-manager/redhatopenshift/2023-09-04/machinepools/id_openshiftcluster.go index 574447f01bc..2623ad7c176 100644 --- a/resource-manager/redhatopenshift/2023-09-04/machinepools/id_openshiftcluster.go +++ b/resource-manager/redhatopenshift/2023-09-04/machinepools/id_openshiftcluster.go @@ -36,19 +36,9 @@ func ParseOpenShiftClusterID(input string) (*OpenShiftClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OpenShiftClusterId{} - - 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.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseOpenShiftClusterIDInsensitively(input string) (*OpenShiftClusterId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OpenShiftClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *OpenShiftClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) + if id.OpenShiftClusterName, ok = input.Parsed["openShiftClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", input) } - return &id, nil + return nil } // ValidateOpenShiftClusterID checks that 'input' can be parsed as a Open Shift Cluster ID diff --git a/resource-manager/redhatopenshift/2023-09-04/openshiftclusters/id_provideropenshiftcluster.go b/resource-manager/redhatopenshift/2023-09-04/openshiftclusters/id_provideropenshiftcluster.go index c73f19875c5..ce5c49dcfaf 100644 --- a/resource-manager/redhatopenshift/2023-09-04/openshiftclusters/id_provideropenshiftcluster.go +++ b/resource-manager/redhatopenshift/2023-09-04/openshiftclusters/id_provideropenshiftcluster.go @@ -36,19 +36,9 @@ func ParseProviderOpenShiftClusterID(input string) (*ProviderOpenShiftClusterId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderOpenShiftClusterId{} - - 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.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderOpenShiftClusterIDInsensitively(input string) (*ProviderOpenSh return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderOpenShiftClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderOpenShiftClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) + if id.OpenShiftClusterName, ok = input.Parsed["openShiftClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", input) } - return &id, nil + return nil } // ValidateProviderOpenShiftClusterID checks that 'input' can be parsed as a Provider Open Shift Cluster ID diff --git a/resource-manager/redhatopenshift/2023-09-04/openshiftversions/id_location.go b/resource-manager/redhatopenshift/2023-09-04/openshiftversions/id_location.go index f2a16f27559..2f844247812 100644 --- a/resource-manager/redhatopenshift/2023-09-04/openshiftversions/id_location.go +++ b/resource-manager/redhatopenshift/2023-09-04/openshiftversions/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/redhatopenshift/2023-09-04/secrets/id_openshiftcluster.go b/resource-manager/redhatopenshift/2023-09-04/secrets/id_openshiftcluster.go index ce480b3d4eb..840d35dbdcd 100644 --- a/resource-manager/redhatopenshift/2023-09-04/secrets/id_openshiftcluster.go +++ b/resource-manager/redhatopenshift/2023-09-04/secrets/id_openshiftcluster.go @@ -36,19 +36,9 @@ func ParseOpenShiftClusterID(input string) (*OpenShiftClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OpenShiftClusterId{} - - 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.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseOpenShiftClusterIDInsensitively(input string) (*OpenShiftClusterId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OpenShiftClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *OpenShiftClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) + if id.OpenShiftClusterName, ok = input.Parsed["openShiftClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", input) } - return &id, nil + return nil } // ValidateOpenShiftClusterID checks that 'input' can be parsed as a Open Shift Cluster ID diff --git a/resource-manager/redhatopenshift/2023-09-04/secrets/id_secret.go b/resource-manager/redhatopenshift/2023-09-04/secrets/id_secret.go index fc0a40a7c51..136d48bcf7d 100644 --- a/resource-manager/redhatopenshift/2023-09-04/secrets/id_secret.go +++ b/resource-manager/redhatopenshift/2023-09-04/secrets/id_secret.go @@ -38,23 +38,9 @@ func ParseSecretID(input string) (*SecretId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecretId{} - - 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.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) - } - - if id.SecretName, ok = parsed.Parsed["secretName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "secretName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSecretIDInsensitively(input string) (*SecretId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecretId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SecretId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) + if id.OpenShiftClusterName, ok = input.Parsed["openShiftClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", input) } - if id.SecretName, ok = parsed.Parsed["secretName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "secretName", *parsed) + if id.SecretName, ok = input.Parsed["secretName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "secretName", input) } - return &id, nil + return nil } // ValidateSecretID checks that 'input' can be parsed as a Secret ID diff --git a/resource-manager/redhatopenshift/2023-09-04/syncidentityproviders/id_openshiftcluster.go b/resource-manager/redhatopenshift/2023-09-04/syncidentityproviders/id_openshiftcluster.go index 8c29a31881e..8e89c0a3fcb 100644 --- a/resource-manager/redhatopenshift/2023-09-04/syncidentityproviders/id_openshiftcluster.go +++ b/resource-manager/redhatopenshift/2023-09-04/syncidentityproviders/id_openshiftcluster.go @@ -36,19 +36,9 @@ func ParseOpenShiftClusterID(input string) (*OpenShiftClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OpenShiftClusterId{} - - 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.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseOpenShiftClusterIDInsensitively(input string) (*OpenShiftClusterId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OpenShiftClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *OpenShiftClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) + if id.OpenShiftClusterName, ok = input.Parsed["openShiftClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", input) } - return &id, nil + return nil } // ValidateOpenShiftClusterID checks that 'input' can be parsed as a Open Shift Cluster ID diff --git a/resource-manager/redhatopenshift/2023-09-04/syncidentityproviders/id_syncidentityprovider.go b/resource-manager/redhatopenshift/2023-09-04/syncidentityproviders/id_syncidentityprovider.go index 79cd41328cc..b7f2e3d2307 100644 --- a/resource-manager/redhatopenshift/2023-09-04/syncidentityproviders/id_syncidentityprovider.go +++ b/resource-manager/redhatopenshift/2023-09-04/syncidentityproviders/id_syncidentityprovider.go @@ -38,23 +38,9 @@ func ParseSyncIdentityProviderID(input string) (*SyncIdentityProviderId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SyncIdentityProviderId{} - - 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.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) - } - - if id.SyncIdentityProviderName, ok = parsed.Parsed["syncIdentityProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncIdentityProviderName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSyncIdentityProviderIDInsensitively(input string) (*SyncIdentityProvid return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SyncIdentityProviderId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SyncIdentityProviderId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) + if id.OpenShiftClusterName, ok = input.Parsed["openShiftClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", input) } - if id.SyncIdentityProviderName, ok = parsed.Parsed["syncIdentityProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncIdentityProviderName", *parsed) + if id.SyncIdentityProviderName, ok = input.Parsed["syncIdentityProviderName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "syncIdentityProviderName", input) } - return &id, nil + return nil } // ValidateSyncIdentityProviderID checks that 'input' can be parsed as a Sync Identity Provider ID diff --git a/resource-manager/redhatopenshift/2023-09-04/syncsets/id_openshiftcluster.go b/resource-manager/redhatopenshift/2023-09-04/syncsets/id_openshiftcluster.go index 4b90fb86b8f..d6a99d6f42e 100644 --- a/resource-manager/redhatopenshift/2023-09-04/syncsets/id_openshiftcluster.go +++ b/resource-manager/redhatopenshift/2023-09-04/syncsets/id_openshiftcluster.go @@ -36,19 +36,9 @@ func ParseOpenShiftClusterID(input string) (*OpenShiftClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OpenShiftClusterId{} - - 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.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseOpenShiftClusterIDInsensitively(input string) (*OpenShiftClusterId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OpenShiftClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *OpenShiftClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) + if id.OpenShiftClusterName, ok = input.Parsed["openShiftClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", input) } - return &id, nil + return nil } // ValidateOpenShiftClusterID checks that 'input' can be parsed as a Open Shift Cluster ID diff --git a/resource-manager/redhatopenshift/2023-09-04/syncsets/id_syncset.go b/resource-manager/redhatopenshift/2023-09-04/syncsets/id_syncset.go index 4e91cc42633..7da2a9f51d3 100644 --- a/resource-manager/redhatopenshift/2023-09-04/syncsets/id_syncset.go +++ b/resource-manager/redhatopenshift/2023-09-04/syncsets/id_syncset.go @@ -38,23 +38,9 @@ func ParseSyncSetID(input string) (*SyncSetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SyncSetId{} - - 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.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) - } - - if id.SyncSetName, ok = parsed.Parsed["syncSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncSetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSyncSetIDInsensitively(input string) (*SyncSetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SyncSetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SyncSetId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.OpenShiftClusterName, ok = parsed.Parsed["openShiftClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", *parsed) + if id.OpenShiftClusterName, ok = input.Parsed["openShiftClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "openShiftClusterName", input) } - if id.SyncSetName, ok = parsed.Parsed["syncSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncSetName", *parsed) + if id.SyncSetName, ok = input.Parsed["syncSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "syncSetName", input) } - return &id, nil + return nil } // ValidateSyncSetID checks that 'input' can be parsed as a Sync Set ID diff --git a/resource-manager/redis/2022-06-01/firewallrules/id_firewallrule.go b/resource-manager/redis/2022-06-01/firewallrules/id_firewallrule.go index a92dffc4cbf..19aa6548ac1 100644 --- a/resource-manager/redis/2022-06-01/firewallrules/id_firewallrule.go +++ b/resource-manager/redis/2022-06-01/firewallrules/id_firewallrule.go @@ -38,23 +38,9 @@ func ParseFirewallRuleID(input string) (*FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallRuleId{} - - 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.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) - } - - if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFirewallRuleIDInsensitively(input string) (*FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FirewallRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) + if id.RedisName, ok = input.Parsed["redisName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisName", input) } - if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + if id.FirewallRuleName, ok = input.Parsed["firewallRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", input) } - return &id, nil + return nil } // ValidateFirewallRuleID checks that 'input' can be parsed as a Firewall Rule ID diff --git a/resource-manager/redis/2022-06-01/firewallrules/id_redi.go b/resource-manager/redis/2022-06-01/firewallrules/id_redi.go index 90adc337e6e..5f583373f30 100644 --- a/resource-manager/redis/2022-06-01/firewallrules/id_redi.go +++ b/resource-manager/redis/2022-06-01/firewallrules/id_redi.go @@ -36,19 +36,9 @@ func ParseRediID(input string) (*RediId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RediId{} - - 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.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRediIDInsensitively(input string) (*RediId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RediId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RediId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) + if id.RedisName, ok = input.Parsed["redisName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisName", input) } - return &id, nil + return nil } // ValidateRediID checks that 'input' can be parsed as a Redi ID diff --git a/resource-manager/redis/2022-06-01/patchschedules/id_redi.go b/resource-manager/redis/2022-06-01/patchschedules/id_redi.go index 3a640ebcc7a..44cdebe15df 100644 --- a/resource-manager/redis/2022-06-01/patchschedules/id_redi.go +++ b/resource-manager/redis/2022-06-01/patchschedules/id_redi.go @@ -36,19 +36,9 @@ func ParseRediID(input string) (*RediId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RediId{} - - 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.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRediIDInsensitively(input string) (*RediId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RediId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RediId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) + if id.RedisName, ok = input.Parsed["redisName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisName", input) } - return &id, nil + return nil } // ValidateRediID checks that 'input' can be parsed as a Redi ID diff --git a/resource-manager/redis/2022-06-01/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/redis/2022-06-01/privateendpointconnections/id_privateendpointconnection.go index 63dcecdbc45..12f9f1417e7 100644 --- a/resource-manager/redis/2022-06-01/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/redis/2022-06-01/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) + if id.RedisName, ok = input.Parsed["redisName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/redis/2022-06-01/privateendpointconnections/id_redi.go b/resource-manager/redis/2022-06-01/privateendpointconnections/id_redi.go index ee213d740a5..e285878e35a 100644 --- a/resource-manager/redis/2022-06-01/privateendpointconnections/id_redi.go +++ b/resource-manager/redis/2022-06-01/privateendpointconnections/id_redi.go @@ -36,19 +36,9 @@ func ParseRediID(input string) (*RediId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RediId{} - - 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.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRediIDInsensitively(input string) (*RediId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RediId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RediId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) + if id.RedisName, ok = input.Parsed["redisName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisName", input) } - return &id, nil + return nil } // ValidateRediID checks that 'input' can be parsed as a Redi ID diff --git a/resource-manager/redis/2022-06-01/privatelinkresources/id_redi.go b/resource-manager/redis/2022-06-01/privatelinkresources/id_redi.go index f7f3511b26e..4eb8643565b 100644 --- a/resource-manager/redis/2022-06-01/privatelinkresources/id_redi.go +++ b/resource-manager/redis/2022-06-01/privatelinkresources/id_redi.go @@ -36,19 +36,9 @@ func ParseRediID(input string) (*RediId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RediId{} - - 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.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRediIDInsensitively(input string) (*RediId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RediId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RediId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) + if id.RedisName, ok = input.Parsed["redisName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisName", input) } - return &id, nil + return nil } // ValidateRediID checks that 'input' can be parsed as a Redi ID diff --git a/resource-manager/redis/2022-06-01/redis/id_firewallrule.go b/resource-manager/redis/2022-06-01/redis/id_firewallrule.go index 149f043538a..ded86547cd3 100644 --- a/resource-manager/redis/2022-06-01/redis/id_firewallrule.go +++ b/resource-manager/redis/2022-06-01/redis/id_firewallrule.go @@ -38,23 +38,9 @@ func ParseFirewallRuleID(input string) (*FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallRuleId{} - - 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.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) - } - - if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFirewallRuleIDInsensitively(input string) (*FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FirewallRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) + if id.RedisName, ok = input.Parsed["redisName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisName", input) } - if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + if id.FirewallRuleName, ok = input.Parsed["firewallRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", input) } - return &id, nil + return nil } // ValidateFirewallRuleID checks that 'input' can be parsed as a Firewall Rule ID diff --git a/resource-manager/redis/2022-06-01/redis/id_linkedserver.go b/resource-manager/redis/2022-06-01/redis/id_linkedserver.go index ffc24ebb327..730e770e694 100644 --- a/resource-manager/redis/2022-06-01/redis/id_linkedserver.go +++ b/resource-manager/redis/2022-06-01/redis/id_linkedserver.go @@ -38,23 +38,9 @@ func ParseLinkedServerID(input string) (*LinkedServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LinkedServerId{} - - 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.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) - } - - if id.LinkedServerName, ok = parsed.Parsed["linkedServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "linkedServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLinkedServerIDInsensitively(input string) (*LinkedServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LinkedServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LinkedServerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) + if id.RedisName, ok = input.Parsed["redisName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisName", input) } - if id.LinkedServerName, ok = parsed.Parsed["linkedServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "linkedServerName", *parsed) + if id.LinkedServerName, ok = input.Parsed["linkedServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "linkedServerName", input) } - return &id, nil + return nil } // ValidateLinkedServerID checks that 'input' can be parsed as a Linked Server ID diff --git a/resource-manager/redis/2022-06-01/redis/id_redi.go b/resource-manager/redis/2022-06-01/redis/id_redi.go index 1097358b416..ea56d7792a2 100644 --- a/resource-manager/redis/2022-06-01/redis/id_redi.go +++ b/resource-manager/redis/2022-06-01/redis/id_redi.go @@ -36,19 +36,9 @@ func ParseRediID(input string) (*RediId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RediId{} - - 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.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRediIDInsensitively(input string) (*RediId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RediId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RediId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) + if id.RedisName, ok = input.Parsed["redisName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisName", input) } - return &id, nil + return nil } // ValidateRediID checks that 'input' can be parsed as a Redi ID diff --git a/resource-manager/redis/2023-04-01/firewallrules/id_firewallrule.go b/resource-manager/redis/2023-04-01/firewallrules/id_firewallrule.go index a92dffc4cbf..19aa6548ac1 100644 --- a/resource-manager/redis/2023-04-01/firewallrules/id_firewallrule.go +++ b/resource-manager/redis/2023-04-01/firewallrules/id_firewallrule.go @@ -38,23 +38,9 @@ func ParseFirewallRuleID(input string) (*FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallRuleId{} - - 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.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) - } - - if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFirewallRuleIDInsensitively(input string) (*FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FirewallRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) + if id.RedisName, ok = input.Parsed["redisName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisName", input) } - if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + if id.FirewallRuleName, ok = input.Parsed["firewallRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", input) } - return &id, nil + return nil } // ValidateFirewallRuleID checks that 'input' can be parsed as a Firewall Rule ID diff --git a/resource-manager/redis/2023-04-01/firewallrules/id_redi.go b/resource-manager/redis/2023-04-01/firewallrules/id_redi.go index 90adc337e6e..5f583373f30 100644 --- a/resource-manager/redis/2023-04-01/firewallrules/id_redi.go +++ b/resource-manager/redis/2023-04-01/firewallrules/id_redi.go @@ -36,19 +36,9 @@ func ParseRediID(input string) (*RediId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RediId{} - - 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.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRediIDInsensitively(input string) (*RediId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RediId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RediId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) + if id.RedisName, ok = input.Parsed["redisName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisName", input) } - return &id, nil + return nil } // ValidateRediID checks that 'input' can be parsed as a Redi ID diff --git a/resource-manager/redis/2023-04-01/patchschedules/id_redi.go b/resource-manager/redis/2023-04-01/patchschedules/id_redi.go index 3a640ebcc7a..44cdebe15df 100644 --- a/resource-manager/redis/2023-04-01/patchschedules/id_redi.go +++ b/resource-manager/redis/2023-04-01/patchschedules/id_redi.go @@ -36,19 +36,9 @@ func ParseRediID(input string) (*RediId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RediId{} - - 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.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRediIDInsensitively(input string) (*RediId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RediId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RediId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) + if id.RedisName, ok = input.Parsed["redisName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisName", input) } - return &id, nil + return nil } // ValidateRediID checks that 'input' can be parsed as a Redi ID diff --git a/resource-manager/redis/2023-04-01/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/redis/2023-04-01/privateendpointconnections/id_privateendpointconnection.go index 63dcecdbc45..12f9f1417e7 100644 --- a/resource-manager/redis/2023-04-01/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/redis/2023-04-01/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) + if id.RedisName, ok = input.Parsed["redisName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/redis/2023-04-01/privateendpointconnections/id_redi.go b/resource-manager/redis/2023-04-01/privateendpointconnections/id_redi.go index ee213d740a5..e285878e35a 100644 --- a/resource-manager/redis/2023-04-01/privateendpointconnections/id_redi.go +++ b/resource-manager/redis/2023-04-01/privateendpointconnections/id_redi.go @@ -36,19 +36,9 @@ func ParseRediID(input string) (*RediId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RediId{} - - 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.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRediIDInsensitively(input string) (*RediId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RediId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RediId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) + if id.RedisName, ok = input.Parsed["redisName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisName", input) } - return &id, nil + return nil } // ValidateRediID checks that 'input' can be parsed as a Redi ID diff --git a/resource-manager/redis/2023-04-01/privatelinkresources/id_redi.go b/resource-manager/redis/2023-04-01/privatelinkresources/id_redi.go index f7f3511b26e..4eb8643565b 100644 --- a/resource-manager/redis/2023-04-01/privatelinkresources/id_redi.go +++ b/resource-manager/redis/2023-04-01/privatelinkresources/id_redi.go @@ -36,19 +36,9 @@ func ParseRediID(input string) (*RediId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RediId{} - - 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.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRediIDInsensitively(input string) (*RediId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RediId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RediId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) + if id.RedisName, ok = input.Parsed["redisName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisName", input) } - return &id, nil + return nil } // ValidateRediID checks that 'input' can be parsed as a Redi ID diff --git a/resource-manager/redis/2023-04-01/redis/id_firewallrule.go b/resource-manager/redis/2023-04-01/redis/id_firewallrule.go index 149f043538a..ded86547cd3 100644 --- a/resource-manager/redis/2023-04-01/redis/id_firewallrule.go +++ b/resource-manager/redis/2023-04-01/redis/id_firewallrule.go @@ -38,23 +38,9 @@ func ParseFirewallRuleID(input string) (*FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallRuleId{} - - 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.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) - } - - if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFirewallRuleIDInsensitively(input string) (*FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FirewallRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) + if id.RedisName, ok = input.Parsed["redisName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisName", input) } - if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + if id.FirewallRuleName, ok = input.Parsed["firewallRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", input) } - return &id, nil + return nil } // ValidateFirewallRuleID checks that 'input' can be parsed as a Firewall Rule ID diff --git a/resource-manager/redis/2023-04-01/redis/id_linkedserver.go b/resource-manager/redis/2023-04-01/redis/id_linkedserver.go index ffc24ebb327..730e770e694 100644 --- a/resource-manager/redis/2023-04-01/redis/id_linkedserver.go +++ b/resource-manager/redis/2023-04-01/redis/id_linkedserver.go @@ -38,23 +38,9 @@ func ParseLinkedServerID(input string) (*LinkedServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LinkedServerId{} - - 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.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) - } - - if id.LinkedServerName, ok = parsed.Parsed["linkedServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "linkedServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLinkedServerIDInsensitively(input string) (*LinkedServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LinkedServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LinkedServerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) + if id.RedisName, ok = input.Parsed["redisName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisName", input) } - if id.LinkedServerName, ok = parsed.Parsed["linkedServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "linkedServerName", *parsed) + if id.LinkedServerName, ok = input.Parsed["linkedServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "linkedServerName", input) } - return &id, nil + return nil } // ValidateLinkedServerID checks that 'input' can be parsed as a Linked Server ID diff --git a/resource-manager/redis/2023-04-01/redis/id_redi.go b/resource-manager/redis/2023-04-01/redis/id_redi.go index 1097358b416..ea56d7792a2 100644 --- a/resource-manager/redis/2023-04-01/redis/id_redi.go +++ b/resource-manager/redis/2023-04-01/redis/id_redi.go @@ -36,19 +36,9 @@ func ParseRediID(input string) (*RediId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RediId{} - - 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.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRediIDInsensitively(input string) (*RediId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RediId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RediId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) + if id.RedisName, ok = input.Parsed["redisName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisName", input) } - return &id, nil + return nil } // ValidateRediID checks that 'input' can be parsed as a Redi ID diff --git a/resource-manager/redis/2023-08-01/aad/id_accesspolicy.go b/resource-manager/redis/2023-08-01/aad/id_accesspolicy.go index cffea9db453..cfe0f68c744 100644 --- a/resource-manager/redis/2023-08-01/aad/id_accesspolicy.go +++ b/resource-manager/redis/2023-08-01/aad/id_accesspolicy.go @@ -38,23 +38,9 @@ func ParseAccessPolicyID(input string) (*AccessPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccessPolicyId{} - - 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.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) - } - - if id.AccessPolicyName, ok = parsed.Parsed["accessPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accessPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAccessPolicyIDInsensitively(input string) (*AccessPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccessPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AccessPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) + if id.RedisName, ok = input.Parsed["redisName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisName", input) } - if id.AccessPolicyName, ok = parsed.Parsed["accessPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accessPolicyName", *parsed) + if id.AccessPolicyName, ok = input.Parsed["accessPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accessPolicyName", input) } - return &id, nil + return nil } // ValidateAccessPolicyID checks that 'input' can be parsed as a Access Policy ID diff --git a/resource-manager/redis/2023-08-01/aad/id_accesspolicyassignment.go b/resource-manager/redis/2023-08-01/aad/id_accesspolicyassignment.go index c3d4cd8bc39..7314beb871f 100644 --- a/resource-manager/redis/2023-08-01/aad/id_accesspolicyassignment.go +++ b/resource-manager/redis/2023-08-01/aad/id_accesspolicyassignment.go @@ -38,23 +38,9 @@ func ParseAccessPolicyAssignmentID(input string) (*AccessPolicyAssignmentId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccessPolicyAssignmentId{} - - 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.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) - } - - if id.AccessPolicyAssignmentName, ok = parsed.Parsed["accessPolicyAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accessPolicyAssignmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAccessPolicyAssignmentIDInsensitively(input string) (*AccessPolicyAssi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccessPolicyAssignmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AccessPolicyAssignmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) + if id.RedisName, ok = input.Parsed["redisName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisName", input) } - if id.AccessPolicyAssignmentName, ok = parsed.Parsed["accessPolicyAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accessPolicyAssignmentName", *parsed) + if id.AccessPolicyAssignmentName, ok = input.Parsed["accessPolicyAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accessPolicyAssignmentName", input) } - return &id, nil + return nil } // ValidateAccessPolicyAssignmentID checks that 'input' can be parsed as a Access Policy Assignment ID diff --git a/resource-manager/redis/2023-08-01/aad/id_redi.go b/resource-manager/redis/2023-08-01/aad/id_redi.go index deefc7bac86..0879efbbfb5 100644 --- a/resource-manager/redis/2023-08-01/aad/id_redi.go +++ b/resource-manager/redis/2023-08-01/aad/id_redi.go @@ -36,19 +36,9 @@ func ParseRediID(input string) (*RediId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RediId{} - - 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.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRediIDInsensitively(input string) (*RediId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RediId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RediId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) + if id.RedisName, ok = input.Parsed["redisName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisName", input) } - return &id, nil + return nil } // ValidateRediID checks that 'input' can be parsed as a Redi ID diff --git a/resource-manager/redis/2023-08-01/firewallrules/id_firewallrule.go b/resource-manager/redis/2023-08-01/firewallrules/id_firewallrule.go index a92dffc4cbf..19aa6548ac1 100644 --- a/resource-manager/redis/2023-08-01/firewallrules/id_firewallrule.go +++ b/resource-manager/redis/2023-08-01/firewallrules/id_firewallrule.go @@ -38,23 +38,9 @@ func ParseFirewallRuleID(input string) (*FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallRuleId{} - - 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.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) - } - - if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFirewallRuleIDInsensitively(input string) (*FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FirewallRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) + if id.RedisName, ok = input.Parsed["redisName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisName", input) } - if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + if id.FirewallRuleName, ok = input.Parsed["firewallRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", input) } - return &id, nil + return nil } // ValidateFirewallRuleID checks that 'input' can be parsed as a Firewall Rule ID diff --git a/resource-manager/redis/2023-08-01/firewallrules/id_redi.go b/resource-manager/redis/2023-08-01/firewallrules/id_redi.go index 90adc337e6e..5f583373f30 100644 --- a/resource-manager/redis/2023-08-01/firewallrules/id_redi.go +++ b/resource-manager/redis/2023-08-01/firewallrules/id_redi.go @@ -36,19 +36,9 @@ func ParseRediID(input string) (*RediId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RediId{} - - 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.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRediIDInsensitively(input string) (*RediId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RediId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RediId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) + if id.RedisName, ok = input.Parsed["redisName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisName", input) } - return &id, nil + return nil } // ValidateRediID checks that 'input' can be parsed as a Redi ID diff --git a/resource-manager/redis/2023-08-01/patchschedules/id_redi.go b/resource-manager/redis/2023-08-01/patchschedules/id_redi.go index 3a640ebcc7a..44cdebe15df 100644 --- a/resource-manager/redis/2023-08-01/patchschedules/id_redi.go +++ b/resource-manager/redis/2023-08-01/patchschedules/id_redi.go @@ -36,19 +36,9 @@ func ParseRediID(input string) (*RediId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RediId{} - - 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.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRediIDInsensitively(input string) (*RediId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RediId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RediId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) + if id.RedisName, ok = input.Parsed["redisName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisName", input) } - return &id, nil + return nil } // ValidateRediID checks that 'input' can be parsed as a Redi ID diff --git a/resource-manager/redis/2023-08-01/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/redis/2023-08-01/privateendpointconnections/id_privateendpointconnection.go index 63dcecdbc45..12f9f1417e7 100644 --- a/resource-manager/redis/2023-08-01/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/redis/2023-08-01/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) + if id.RedisName, ok = input.Parsed["redisName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/redis/2023-08-01/privateendpointconnections/id_redi.go b/resource-manager/redis/2023-08-01/privateendpointconnections/id_redi.go index ee213d740a5..e285878e35a 100644 --- a/resource-manager/redis/2023-08-01/privateendpointconnections/id_redi.go +++ b/resource-manager/redis/2023-08-01/privateendpointconnections/id_redi.go @@ -36,19 +36,9 @@ func ParseRediID(input string) (*RediId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RediId{} - - 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.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRediIDInsensitively(input string) (*RediId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RediId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RediId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) + if id.RedisName, ok = input.Parsed["redisName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisName", input) } - return &id, nil + return nil } // ValidateRediID checks that 'input' can be parsed as a Redi ID diff --git a/resource-manager/redis/2023-08-01/privatelinkresources/id_redi.go b/resource-manager/redis/2023-08-01/privatelinkresources/id_redi.go index f7f3511b26e..4eb8643565b 100644 --- a/resource-manager/redis/2023-08-01/privatelinkresources/id_redi.go +++ b/resource-manager/redis/2023-08-01/privatelinkresources/id_redi.go @@ -36,19 +36,9 @@ func ParseRediID(input string) (*RediId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RediId{} - - 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.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRediIDInsensitively(input string) (*RediId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RediId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RediId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) + if id.RedisName, ok = input.Parsed["redisName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisName", input) } - return &id, nil + return nil } // ValidateRediID checks that 'input' can be parsed as a Redi ID diff --git a/resource-manager/redis/2023-08-01/redis/id_accesspolicy.go b/resource-manager/redis/2023-08-01/redis/id_accesspolicy.go index 511bbf9c56c..33477cac8ce 100644 --- a/resource-manager/redis/2023-08-01/redis/id_accesspolicy.go +++ b/resource-manager/redis/2023-08-01/redis/id_accesspolicy.go @@ -38,23 +38,9 @@ func ParseAccessPolicyID(input string) (*AccessPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccessPolicyId{} - - 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.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) - } - - if id.AccessPolicyName, ok = parsed.Parsed["accessPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accessPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAccessPolicyIDInsensitively(input string) (*AccessPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccessPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AccessPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) + if id.RedisName, ok = input.Parsed["redisName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisName", input) } - if id.AccessPolicyName, ok = parsed.Parsed["accessPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accessPolicyName", *parsed) + if id.AccessPolicyName, ok = input.Parsed["accessPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accessPolicyName", input) } - return &id, nil + return nil } // ValidateAccessPolicyID checks that 'input' can be parsed as a Access Policy ID diff --git a/resource-manager/redis/2023-08-01/redis/id_accesspolicyassignment.go b/resource-manager/redis/2023-08-01/redis/id_accesspolicyassignment.go index ee52831a8b0..6068730f0ce 100644 --- a/resource-manager/redis/2023-08-01/redis/id_accesspolicyassignment.go +++ b/resource-manager/redis/2023-08-01/redis/id_accesspolicyassignment.go @@ -38,23 +38,9 @@ func ParseAccessPolicyAssignmentID(input string) (*AccessPolicyAssignmentId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccessPolicyAssignmentId{} - - 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.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) - } - - if id.AccessPolicyAssignmentName, ok = parsed.Parsed["accessPolicyAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accessPolicyAssignmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAccessPolicyAssignmentIDInsensitively(input string) (*AccessPolicyAssi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccessPolicyAssignmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AccessPolicyAssignmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) + if id.RedisName, ok = input.Parsed["redisName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisName", input) } - if id.AccessPolicyAssignmentName, ok = parsed.Parsed["accessPolicyAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accessPolicyAssignmentName", *parsed) + if id.AccessPolicyAssignmentName, ok = input.Parsed["accessPolicyAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accessPolicyAssignmentName", input) } - return &id, nil + return nil } // ValidateAccessPolicyAssignmentID checks that 'input' can be parsed as a Access Policy Assignment ID diff --git a/resource-manager/redis/2023-08-01/redis/id_firewallrule.go b/resource-manager/redis/2023-08-01/redis/id_firewallrule.go index 149f043538a..ded86547cd3 100644 --- a/resource-manager/redis/2023-08-01/redis/id_firewallrule.go +++ b/resource-manager/redis/2023-08-01/redis/id_firewallrule.go @@ -38,23 +38,9 @@ func ParseFirewallRuleID(input string) (*FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallRuleId{} - - 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.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) - } - - if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFirewallRuleIDInsensitively(input string) (*FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FirewallRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) + if id.RedisName, ok = input.Parsed["redisName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisName", input) } - if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + if id.FirewallRuleName, ok = input.Parsed["firewallRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", input) } - return &id, nil + return nil } // ValidateFirewallRuleID checks that 'input' can be parsed as a Firewall Rule ID diff --git a/resource-manager/redis/2023-08-01/redis/id_linkedserver.go b/resource-manager/redis/2023-08-01/redis/id_linkedserver.go index ffc24ebb327..730e770e694 100644 --- a/resource-manager/redis/2023-08-01/redis/id_linkedserver.go +++ b/resource-manager/redis/2023-08-01/redis/id_linkedserver.go @@ -38,23 +38,9 @@ func ParseLinkedServerID(input string) (*LinkedServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LinkedServerId{} - - 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.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) - } - - if id.LinkedServerName, ok = parsed.Parsed["linkedServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "linkedServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLinkedServerIDInsensitively(input string) (*LinkedServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LinkedServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LinkedServerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) + if id.RedisName, ok = input.Parsed["redisName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisName", input) } - if id.LinkedServerName, ok = parsed.Parsed["linkedServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "linkedServerName", *parsed) + if id.LinkedServerName, ok = input.Parsed["linkedServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "linkedServerName", input) } - return &id, nil + return nil } // ValidateLinkedServerID checks that 'input' can be parsed as a Linked Server ID diff --git a/resource-manager/redis/2023-08-01/redis/id_redi.go b/resource-manager/redis/2023-08-01/redis/id_redi.go index 1097358b416..ea56d7792a2 100644 --- a/resource-manager/redis/2023-08-01/redis/id_redi.go +++ b/resource-manager/redis/2023-08-01/redis/id_redi.go @@ -36,19 +36,9 @@ func ParseRediID(input string) (*RediId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RediId{} - - 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.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRediIDInsensitively(input string) (*RediId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RediId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RediId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisName, ok = parsed.Parsed["redisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisName", *parsed) + if id.RedisName, ok = input.Parsed["redisName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisName", input) } - return &id, nil + return nil } // ValidateRediID checks that 'input' can be parsed as a Redi ID diff --git a/resource-manager/redisenterprise/2022-01-01/databases/id_database.go b/resource-manager/redisenterprise/2022-01-01/databases/id_database.go index 19bbd656728..21e4bea2d10 100644 --- a/resource-manager/redisenterprise/2022-01-01/databases/id_database.go +++ b/resource-manager/redisenterprise/2022-01-01/databases/id_database.go @@ -38,23 +38,9 @@ func ParseDatabaseID(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} - - 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.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDatabaseIDInsensitively(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) + if id.RedisEnterpriseName, ok = input.Parsed["redisEnterpriseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - return &id, nil + return nil } // ValidateDatabaseID checks that 'input' can be parsed as a Database ID diff --git a/resource-manager/redisenterprise/2022-01-01/databases/id_redisenterprise.go b/resource-manager/redisenterprise/2022-01-01/databases/id_redisenterprise.go index 839c5f526e5..9326189d33a 100644 --- a/resource-manager/redisenterprise/2022-01-01/databases/id_redisenterprise.go +++ b/resource-manager/redisenterprise/2022-01-01/databases/id_redisenterprise.go @@ -36,19 +36,9 @@ func ParseRedisEnterpriseID(input string) (*RedisEnterpriseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RedisEnterpriseId{} - - 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.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRedisEnterpriseIDInsensitively(input string) (*RedisEnterpriseId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RedisEnterpriseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RedisEnterpriseId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) + if id.RedisEnterpriseName, ok = input.Parsed["redisEnterpriseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", input) } - return &id, nil + return nil } // ValidateRedisEnterpriseID checks that 'input' can be parsed as a Redis Enterprise ID diff --git a/resource-manager/redisenterprise/2022-01-01/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/redisenterprise/2022-01-01/privateendpointconnections/id_privateendpointconnection.go index 1976a52ed9f..fbc4788b870 100644 --- a/resource-manager/redisenterprise/2022-01-01/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/redisenterprise/2022-01-01/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) + if id.RedisEnterpriseName, ok = input.Parsed["redisEnterpriseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/redisenterprise/2022-01-01/privateendpointconnections/id_redisenterprise.go b/resource-manager/redisenterprise/2022-01-01/privateendpointconnections/id_redisenterprise.go index 719ec4167c6..3fbf9a66f29 100644 --- a/resource-manager/redisenterprise/2022-01-01/privateendpointconnections/id_redisenterprise.go +++ b/resource-manager/redisenterprise/2022-01-01/privateendpointconnections/id_redisenterprise.go @@ -36,19 +36,9 @@ func ParseRedisEnterpriseID(input string) (*RedisEnterpriseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RedisEnterpriseId{} - - 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.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRedisEnterpriseIDInsensitively(input string) (*RedisEnterpriseId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RedisEnterpriseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RedisEnterpriseId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) + if id.RedisEnterpriseName, ok = input.Parsed["redisEnterpriseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", input) } - return &id, nil + return nil } // ValidateRedisEnterpriseID checks that 'input' can be parsed as a Redis Enterprise ID diff --git a/resource-manager/redisenterprise/2022-01-01/privatelinkresources/id_redisenterprise.go b/resource-manager/redisenterprise/2022-01-01/privatelinkresources/id_redisenterprise.go index 3fff8f11fe7..a5d9addc4db 100644 --- a/resource-manager/redisenterprise/2022-01-01/privatelinkresources/id_redisenterprise.go +++ b/resource-manager/redisenterprise/2022-01-01/privatelinkresources/id_redisenterprise.go @@ -36,19 +36,9 @@ func ParseRedisEnterpriseID(input string) (*RedisEnterpriseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RedisEnterpriseId{} - - 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.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRedisEnterpriseIDInsensitively(input string) (*RedisEnterpriseId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RedisEnterpriseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RedisEnterpriseId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) + if id.RedisEnterpriseName, ok = input.Parsed["redisEnterpriseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", input) } - return &id, nil + return nil } // ValidateRedisEnterpriseID checks that 'input' can be parsed as a Redis Enterprise ID diff --git a/resource-manager/redisenterprise/2022-01-01/redisenterprise/id_database.go b/resource-manager/redisenterprise/2022-01-01/redisenterprise/id_database.go index c5e7720c818..066b2f00934 100644 --- a/resource-manager/redisenterprise/2022-01-01/redisenterprise/id_database.go +++ b/resource-manager/redisenterprise/2022-01-01/redisenterprise/id_database.go @@ -38,23 +38,9 @@ func ParseDatabaseID(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} - - 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.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDatabaseIDInsensitively(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) + if id.RedisEnterpriseName, ok = input.Parsed["redisEnterpriseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - return &id, nil + return nil } // ValidateDatabaseID checks that 'input' can be parsed as a Database ID diff --git a/resource-manager/redisenterprise/2022-01-01/redisenterprise/id_redisenterprise.go b/resource-manager/redisenterprise/2022-01-01/redisenterprise/id_redisenterprise.go index 28197291def..90b26f43be0 100644 --- a/resource-manager/redisenterprise/2022-01-01/redisenterprise/id_redisenterprise.go +++ b/resource-manager/redisenterprise/2022-01-01/redisenterprise/id_redisenterprise.go @@ -36,19 +36,9 @@ func ParseRedisEnterpriseID(input string) (*RedisEnterpriseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RedisEnterpriseId{} - - 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.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRedisEnterpriseIDInsensitively(input string) (*RedisEnterpriseId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RedisEnterpriseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RedisEnterpriseId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) + if id.RedisEnterpriseName, ok = input.Parsed["redisEnterpriseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", input) } - return &id, nil + return nil } // ValidateRedisEnterpriseID checks that 'input' can be parsed as a Redis Enterprise ID diff --git a/resource-manager/redisenterprise/2023-07-01/databases/id_database.go b/resource-manager/redisenterprise/2023-07-01/databases/id_database.go index 19bbd656728..21e4bea2d10 100644 --- a/resource-manager/redisenterprise/2023-07-01/databases/id_database.go +++ b/resource-manager/redisenterprise/2023-07-01/databases/id_database.go @@ -38,23 +38,9 @@ func ParseDatabaseID(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} - - 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.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDatabaseIDInsensitively(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) + if id.RedisEnterpriseName, ok = input.Parsed["redisEnterpriseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - return &id, nil + return nil } // ValidateDatabaseID checks that 'input' can be parsed as a Database ID diff --git a/resource-manager/redisenterprise/2023-07-01/databases/id_redisenterprise.go b/resource-manager/redisenterprise/2023-07-01/databases/id_redisenterprise.go index 839c5f526e5..9326189d33a 100644 --- a/resource-manager/redisenterprise/2023-07-01/databases/id_redisenterprise.go +++ b/resource-manager/redisenterprise/2023-07-01/databases/id_redisenterprise.go @@ -36,19 +36,9 @@ func ParseRedisEnterpriseID(input string) (*RedisEnterpriseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RedisEnterpriseId{} - - 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.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRedisEnterpriseIDInsensitively(input string) (*RedisEnterpriseId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RedisEnterpriseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RedisEnterpriseId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) + if id.RedisEnterpriseName, ok = input.Parsed["redisEnterpriseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", input) } - return &id, nil + return nil } // ValidateRedisEnterpriseID checks that 'input' can be parsed as a Redis Enterprise ID diff --git a/resource-manager/redisenterprise/2023-07-01/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/redisenterprise/2023-07-01/privateendpointconnections/id_privateendpointconnection.go index 1976a52ed9f..fbc4788b870 100644 --- a/resource-manager/redisenterprise/2023-07-01/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/redisenterprise/2023-07-01/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) + if id.RedisEnterpriseName, ok = input.Parsed["redisEnterpriseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/redisenterprise/2023-07-01/privateendpointconnections/id_redisenterprise.go b/resource-manager/redisenterprise/2023-07-01/privateendpointconnections/id_redisenterprise.go index 719ec4167c6..3fbf9a66f29 100644 --- a/resource-manager/redisenterprise/2023-07-01/privateendpointconnections/id_redisenterprise.go +++ b/resource-manager/redisenterprise/2023-07-01/privateendpointconnections/id_redisenterprise.go @@ -36,19 +36,9 @@ func ParseRedisEnterpriseID(input string) (*RedisEnterpriseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RedisEnterpriseId{} - - 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.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRedisEnterpriseIDInsensitively(input string) (*RedisEnterpriseId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RedisEnterpriseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RedisEnterpriseId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) + if id.RedisEnterpriseName, ok = input.Parsed["redisEnterpriseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", input) } - return &id, nil + return nil } // ValidateRedisEnterpriseID checks that 'input' can be parsed as a Redis Enterprise ID diff --git a/resource-manager/redisenterprise/2023-07-01/privatelinkresources/id_redisenterprise.go b/resource-manager/redisenterprise/2023-07-01/privatelinkresources/id_redisenterprise.go index 3fff8f11fe7..a5d9addc4db 100644 --- a/resource-manager/redisenterprise/2023-07-01/privatelinkresources/id_redisenterprise.go +++ b/resource-manager/redisenterprise/2023-07-01/privatelinkresources/id_redisenterprise.go @@ -36,19 +36,9 @@ func ParseRedisEnterpriseID(input string) (*RedisEnterpriseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RedisEnterpriseId{} - - 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.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRedisEnterpriseIDInsensitively(input string) (*RedisEnterpriseId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RedisEnterpriseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RedisEnterpriseId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) + if id.RedisEnterpriseName, ok = input.Parsed["redisEnterpriseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", input) } - return &id, nil + return nil } // ValidateRedisEnterpriseID checks that 'input' can be parsed as a Redis Enterprise ID diff --git a/resource-manager/redisenterprise/2023-07-01/redisenterprise/id_database.go b/resource-manager/redisenterprise/2023-07-01/redisenterprise/id_database.go index c5e7720c818..066b2f00934 100644 --- a/resource-manager/redisenterprise/2023-07-01/redisenterprise/id_database.go +++ b/resource-manager/redisenterprise/2023-07-01/redisenterprise/id_database.go @@ -38,23 +38,9 @@ func ParseDatabaseID(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} - - 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.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDatabaseIDInsensitively(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) + if id.RedisEnterpriseName, ok = input.Parsed["redisEnterpriseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - return &id, nil + return nil } // ValidateDatabaseID checks that 'input' can be parsed as a Database ID diff --git a/resource-manager/redisenterprise/2023-07-01/redisenterprise/id_redisenterprise.go b/resource-manager/redisenterprise/2023-07-01/redisenterprise/id_redisenterprise.go index 28197291def..90b26f43be0 100644 --- a/resource-manager/redisenterprise/2023-07-01/redisenterprise/id_redisenterprise.go +++ b/resource-manager/redisenterprise/2023-07-01/redisenterprise/id_redisenterprise.go @@ -36,19 +36,9 @@ func ParseRedisEnterpriseID(input string) (*RedisEnterpriseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RedisEnterpriseId{} - - 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.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRedisEnterpriseIDInsensitively(input string) (*RedisEnterpriseId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RedisEnterpriseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RedisEnterpriseId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) + if id.RedisEnterpriseName, ok = input.Parsed["redisEnterpriseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", input) } - return &id, nil + return nil } // ValidateRedisEnterpriseID checks that 'input' can be parsed as a Redis Enterprise ID diff --git a/resource-manager/redisenterprise/2023-10-01-preview/databases/id_database.go b/resource-manager/redisenterprise/2023-10-01-preview/databases/id_database.go index 19bbd656728..21e4bea2d10 100644 --- a/resource-manager/redisenterprise/2023-10-01-preview/databases/id_database.go +++ b/resource-manager/redisenterprise/2023-10-01-preview/databases/id_database.go @@ -38,23 +38,9 @@ func ParseDatabaseID(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} - - 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.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDatabaseIDInsensitively(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) + if id.RedisEnterpriseName, ok = input.Parsed["redisEnterpriseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - return &id, nil + return nil } // ValidateDatabaseID checks that 'input' can be parsed as a Database ID diff --git a/resource-manager/redisenterprise/2023-10-01-preview/databases/id_redisenterprise.go b/resource-manager/redisenterprise/2023-10-01-preview/databases/id_redisenterprise.go index 839c5f526e5..9326189d33a 100644 --- a/resource-manager/redisenterprise/2023-10-01-preview/databases/id_redisenterprise.go +++ b/resource-manager/redisenterprise/2023-10-01-preview/databases/id_redisenterprise.go @@ -36,19 +36,9 @@ func ParseRedisEnterpriseID(input string) (*RedisEnterpriseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RedisEnterpriseId{} - - 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.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRedisEnterpriseIDInsensitively(input string) (*RedisEnterpriseId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RedisEnterpriseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RedisEnterpriseId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) + if id.RedisEnterpriseName, ok = input.Parsed["redisEnterpriseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", input) } - return &id, nil + return nil } // ValidateRedisEnterpriseID checks that 'input' can be parsed as a Redis Enterprise ID diff --git a/resource-manager/redisenterprise/2023-10-01-preview/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/redisenterprise/2023-10-01-preview/privateendpointconnections/id_privateendpointconnection.go index 1976a52ed9f..fbc4788b870 100644 --- a/resource-manager/redisenterprise/2023-10-01-preview/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/redisenterprise/2023-10-01-preview/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) + if id.RedisEnterpriseName, ok = input.Parsed["redisEnterpriseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/redisenterprise/2023-10-01-preview/privateendpointconnections/id_redisenterprise.go b/resource-manager/redisenterprise/2023-10-01-preview/privateendpointconnections/id_redisenterprise.go index 719ec4167c6..3fbf9a66f29 100644 --- a/resource-manager/redisenterprise/2023-10-01-preview/privateendpointconnections/id_redisenterprise.go +++ b/resource-manager/redisenterprise/2023-10-01-preview/privateendpointconnections/id_redisenterprise.go @@ -36,19 +36,9 @@ func ParseRedisEnterpriseID(input string) (*RedisEnterpriseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RedisEnterpriseId{} - - 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.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRedisEnterpriseIDInsensitively(input string) (*RedisEnterpriseId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RedisEnterpriseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RedisEnterpriseId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) + if id.RedisEnterpriseName, ok = input.Parsed["redisEnterpriseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", input) } - return &id, nil + return nil } // ValidateRedisEnterpriseID checks that 'input' can be parsed as a Redis Enterprise ID diff --git a/resource-manager/redisenterprise/2023-10-01-preview/privatelinkresources/id_redisenterprise.go b/resource-manager/redisenterprise/2023-10-01-preview/privatelinkresources/id_redisenterprise.go index 3fff8f11fe7..a5d9addc4db 100644 --- a/resource-manager/redisenterprise/2023-10-01-preview/privatelinkresources/id_redisenterprise.go +++ b/resource-manager/redisenterprise/2023-10-01-preview/privatelinkresources/id_redisenterprise.go @@ -36,19 +36,9 @@ func ParseRedisEnterpriseID(input string) (*RedisEnterpriseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RedisEnterpriseId{} - - 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.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRedisEnterpriseIDInsensitively(input string) (*RedisEnterpriseId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RedisEnterpriseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RedisEnterpriseId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) + if id.RedisEnterpriseName, ok = input.Parsed["redisEnterpriseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", input) } - return &id, nil + return nil } // ValidateRedisEnterpriseID checks that 'input' can be parsed as a Redis Enterprise ID diff --git a/resource-manager/redisenterprise/2023-10-01-preview/redisenterprise/id_database.go b/resource-manager/redisenterprise/2023-10-01-preview/redisenterprise/id_database.go index c5e7720c818..066b2f00934 100644 --- a/resource-manager/redisenterprise/2023-10-01-preview/redisenterprise/id_database.go +++ b/resource-manager/redisenterprise/2023-10-01-preview/redisenterprise/id_database.go @@ -38,23 +38,9 @@ func ParseDatabaseID(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} - - 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.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDatabaseIDInsensitively(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) + if id.RedisEnterpriseName, ok = input.Parsed["redisEnterpriseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - return &id, nil + return nil } // ValidateDatabaseID checks that 'input' can be parsed as a Database ID diff --git a/resource-manager/redisenterprise/2023-10-01-preview/redisenterprise/id_redisenterprise.go b/resource-manager/redisenterprise/2023-10-01-preview/redisenterprise/id_redisenterprise.go index 28197291def..90b26f43be0 100644 --- a/resource-manager/redisenterprise/2023-10-01-preview/redisenterprise/id_redisenterprise.go +++ b/resource-manager/redisenterprise/2023-10-01-preview/redisenterprise/id_redisenterprise.go @@ -36,19 +36,9 @@ func ParseRedisEnterpriseID(input string) (*RedisEnterpriseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RedisEnterpriseId{} - - 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.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRedisEnterpriseIDInsensitively(input string) (*RedisEnterpriseId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RedisEnterpriseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RedisEnterpriseId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) + if id.RedisEnterpriseName, ok = input.Parsed["redisEnterpriseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", input) } - return &id, nil + return nil } // ValidateRedisEnterpriseID checks that 'input' can be parsed as a Redis Enterprise ID diff --git a/resource-manager/redisenterprise/2023-11-01/databases/id_database.go b/resource-manager/redisenterprise/2023-11-01/databases/id_database.go index 19bbd656728..21e4bea2d10 100644 --- a/resource-manager/redisenterprise/2023-11-01/databases/id_database.go +++ b/resource-manager/redisenterprise/2023-11-01/databases/id_database.go @@ -38,23 +38,9 @@ func ParseDatabaseID(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} - - 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.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDatabaseIDInsensitively(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) + if id.RedisEnterpriseName, ok = input.Parsed["redisEnterpriseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - return &id, nil + return nil } // ValidateDatabaseID checks that 'input' can be parsed as a Database ID diff --git a/resource-manager/redisenterprise/2023-11-01/databases/id_redisenterprise.go b/resource-manager/redisenterprise/2023-11-01/databases/id_redisenterprise.go index 839c5f526e5..9326189d33a 100644 --- a/resource-manager/redisenterprise/2023-11-01/databases/id_redisenterprise.go +++ b/resource-manager/redisenterprise/2023-11-01/databases/id_redisenterprise.go @@ -36,19 +36,9 @@ func ParseRedisEnterpriseID(input string) (*RedisEnterpriseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RedisEnterpriseId{} - - 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.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRedisEnterpriseIDInsensitively(input string) (*RedisEnterpriseId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RedisEnterpriseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RedisEnterpriseId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) + if id.RedisEnterpriseName, ok = input.Parsed["redisEnterpriseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", input) } - return &id, nil + return nil } // ValidateRedisEnterpriseID checks that 'input' can be parsed as a Redis Enterprise ID diff --git a/resource-manager/redisenterprise/2023-11-01/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/redisenterprise/2023-11-01/privateendpointconnections/id_privateendpointconnection.go index 1976a52ed9f..fbc4788b870 100644 --- a/resource-manager/redisenterprise/2023-11-01/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/redisenterprise/2023-11-01/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) + if id.RedisEnterpriseName, ok = input.Parsed["redisEnterpriseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/redisenterprise/2023-11-01/privateendpointconnections/id_redisenterprise.go b/resource-manager/redisenterprise/2023-11-01/privateendpointconnections/id_redisenterprise.go index 719ec4167c6..3fbf9a66f29 100644 --- a/resource-manager/redisenterprise/2023-11-01/privateendpointconnections/id_redisenterprise.go +++ b/resource-manager/redisenterprise/2023-11-01/privateendpointconnections/id_redisenterprise.go @@ -36,19 +36,9 @@ func ParseRedisEnterpriseID(input string) (*RedisEnterpriseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RedisEnterpriseId{} - - 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.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRedisEnterpriseIDInsensitively(input string) (*RedisEnterpriseId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RedisEnterpriseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RedisEnterpriseId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) + if id.RedisEnterpriseName, ok = input.Parsed["redisEnterpriseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", input) } - return &id, nil + return nil } // ValidateRedisEnterpriseID checks that 'input' can be parsed as a Redis Enterprise ID diff --git a/resource-manager/redisenterprise/2023-11-01/privatelinkresources/id_redisenterprise.go b/resource-manager/redisenterprise/2023-11-01/privatelinkresources/id_redisenterprise.go index 3fff8f11fe7..a5d9addc4db 100644 --- a/resource-manager/redisenterprise/2023-11-01/privatelinkresources/id_redisenterprise.go +++ b/resource-manager/redisenterprise/2023-11-01/privatelinkresources/id_redisenterprise.go @@ -36,19 +36,9 @@ func ParseRedisEnterpriseID(input string) (*RedisEnterpriseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RedisEnterpriseId{} - - 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.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRedisEnterpriseIDInsensitively(input string) (*RedisEnterpriseId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RedisEnterpriseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RedisEnterpriseId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) + if id.RedisEnterpriseName, ok = input.Parsed["redisEnterpriseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", input) } - return &id, nil + return nil } // ValidateRedisEnterpriseID checks that 'input' can be parsed as a Redis Enterprise ID diff --git a/resource-manager/redisenterprise/2023-11-01/redisenterprise/id_database.go b/resource-manager/redisenterprise/2023-11-01/redisenterprise/id_database.go index c5e7720c818..066b2f00934 100644 --- a/resource-manager/redisenterprise/2023-11-01/redisenterprise/id_database.go +++ b/resource-manager/redisenterprise/2023-11-01/redisenterprise/id_database.go @@ -38,23 +38,9 @@ func ParseDatabaseID(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} - - 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.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) - } - - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDatabaseIDInsensitively(input string) (*DatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) + if id.RedisEnterpriseName, ok = input.Parsed["redisEnterpriseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - return &id, nil + return nil } // ValidateDatabaseID checks that 'input' can be parsed as a Database ID diff --git a/resource-manager/redisenterprise/2023-11-01/redisenterprise/id_redisenterprise.go b/resource-manager/redisenterprise/2023-11-01/redisenterprise/id_redisenterprise.go index 28197291def..90b26f43be0 100644 --- a/resource-manager/redisenterprise/2023-11-01/redisenterprise/id_redisenterprise.go +++ b/resource-manager/redisenterprise/2023-11-01/redisenterprise/id_redisenterprise.go @@ -36,19 +36,9 @@ func ParseRedisEnterpriseID(input string) (*RedisEnterpriseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RedisEnterpriseId{} - - 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.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRedisEnterpriseIDInsensitively(input string) (*RedisEnterpriseId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RedisEnterpriseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RedisEnterpriseId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.RedisEnterpriseName, ok = parsed.Parsed["redisEnterpriseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", *parsed) + if id.RedisEnterpriseName, ok = input.Parsed["redisEnterpriseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", input) } - return &id, nil + return nil } // ValidateRedisEnterpriseID checks that 'input' can be parsed as a Redis Enterprise ID diff --git a/resource-manager/relay/2021-11-01/hybridconnections/id_hybridconnection.go b/resource-manager/relay/2021-11-01/hybridconnections/id_hybridconnection.go index 0dd0a312f30..473b07e4866 100644 --- a/resource-manager/relay/2021-11-01/hybridconnections/id_hybridconnection.go +++ b/resource-manager/relay/2021-11-01/hybridconnections/id_hybridconnection.go @@ -38,23 +38,9 @@ func ParseHybridConnectionID(input string) (*HybridConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HybridConnectionId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.HybridConnectionName, ok = parsed.Parsed["hybridConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseHybridConnectionIDInsensitively(input string) (*HybridConnectionId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HybridConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *HybridConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.HybridConnectionName, ok = parsed.Parsed["hybridConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridConnectionName", *parsed) + if id.HybridConnectionName, ok = input.Parsed["hybridConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hybridConnectionName", input) } - return &id, nil + return nil } // ValidateHybridConnectionID checks that 'input' can be parsed as a Hybrid Connection ID diff --git a/resource-manager/relay/2021-11-01/hybridconnections/id_hybridconnectionauthorizationrule.go b/resource-manager/relay/2021-11-01/hybridconnections/id_hybridconnectionauthorizationrule.go index 69f70ac6876..2f7a9de16be 100644 --- a/resource-manager/relay/2021-11-01/hybridconnections/id_hybridconnectionauthorizationrule.go +++ b/resource-manager/relay/2021-11-01/hybridconnections/id_hybridconnectionauthorizationrule.go @@ -40,27 +40,9 @@ func ParseHybridConnectionAuthorizationRuleID(input string) (*HybridConnectionAu return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HybridConnectionAuthorizationRuleId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.HybridConnectionName, ok = parsed.Parsed["hybridConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridConnectionName", *parsed) - } - - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseHybridConnectionAuthorizationRuleIDInsensitively(input string) (*Hybri return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HybridConnectionAuthorizationRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *HybridConnectionAuthorizationRuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.HybridConnectionName, ok = parsed.Parsed["hybridConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridConnectionName", *parsed) + if id.HybridConnectionName, ok = input.Parsed["hybridConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hybridConnectionName", input) } - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if id.AuthorizationRuleName, ok = input.Parsed["authorizationRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", input) } - return &id, nil + return nil } // ValidateHybridConnectionAuthorizationRuleID checks that 'input' can be parsed as a Hybrid Connection Authorization Rule ID diff --git a/resource-manager/relay/2021-11-01/hybridconnections/id_namespace.go b/resource-manager/relay/2021-11-01/hybridconnections/id_namespace.go index 4425ae0f7a2..937df43fba0 100644 --- a/resource-manager/relay/2021-11-01/hybridconnections/id_namespace.go +++ b/resource-manager/relay/2021-11-01/hybridconnections/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/relay/2021-11-01/namespaces/id_authorizationrule.go b/resource-manager/relay/2021-11-01/namespaces/id_authorizationrule.go index 352941df666..ade3efe8465 100644 --- a/resource-manager/relay/2021-11-01/namespaces/id_authorizationrule.go +++ b/resource-manager/relay/2021-11-01/namespaces/id_authorizationrule.go @@ -38,23 +38,9 @@ func ParseAuthorizationRuleID(input string) (*AuthorizationRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationRuleId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAuthorizationRuleIDInsensitively(input string) (*AuthorizationRuleId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AuthorizationRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if id.AuthorizationRuleName, ok = input.Parsed["authorizationRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", input) } - return &id, nil + return nil } // ValidateAuthorizationRuleID checks that 'input' can be parsed as a Authorization Rule ID diff --git a/resource-manager/relay/2021-11-01/namespaces/id_namespace.go b/resource-manager/relay/2021-11-01/namespaces/id_namespace.go index 0e384766a50..9f6f076e48e 100644 --- a/resource-manager/relay/2021-11-01/namespaces/id_namespace.go +++ b/resource-manager/relay/2021-11-01/namespaces/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/relay/2021-11-01/namespacesprivateendpointconnections/id_namespace.go b/resource-manager/relay/2021-11-01/namespacesprivateendpointconnections/id_namespace.go index f41d0cabef9..92dc5fc2051 100644 --- a/resource-manager/relay/2021-11-01/namespacesprivateendpointconnections/id_namespace.go +++ b/resource-manager/relay/2021-11-01/namespacesprivateendpointconnections/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/relay/2021-11-01/namespacesprivateendpointconnections/id_privateendpointconnection.go b/resource-manager/relay/2021-11-01/namespacesprivateendpointconnections/id_privateendpointconnection.go index 58caf8c382f..e34a871f8c8 100644 --- a/resource-manager/relay/2021-11-01/namespacesprivateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/relay/2021-11-01/namespacesprivateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/relay/2021-11-01/namespacesprivatelinkresources/id_namespace.go b/resource-manager/relay/2021-11-01/namespacesprivatelinkresources/id_namespace.go index 69684fa6a16..2da829e5a68 100644 --- a/resource-manager/relay/2021-11-01/namespacesprivatelinkresources/id_namespace.go +++ b/resource-manager/relay/2021-11-01/namespacesprivatelinkresources/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/relay/2021-11-01/namespacesprivatelinkresources/id_privatelinkresource.go b/resource-manager/relay/2021-11-01/namespacesprivatelinkresources/id_privatelinkresource.go index ed22746968f..173c62e6344 100644 --- a/resource-manager/relay/2021-11-01/namespacesprivatelinkresources/id_privatelinkresource.go +++ b/resource-manager/relay/2021-11-01/namespacesprivatelinkresources/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/relay/2021-11-01/wcfrelays/id_namespace.go b/resource-manager/relay/2021-11-01/wcfrelays/id_namespace.go index 0dc5c19f2e4..b262dfdbc2f 100644 --- a/resource-manager/relay/2021-11-01/wcfrelays/id_namespace.go +++ b/resource-manager/relay/2021-11-01/wcfrelays/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/relay/2021-11-01/wcfrelays/id_wcfrelay.go b/resource-manager/relay/2021-11-01/wcfrelays/id_wcfrelay.go index 6988bc8488f..8ff3d8d1f2f 100644 --- a/resource-manager/relay/2021-11-01/wcfrelays/id_wcfrelay.go +++ b/resource-manager/relay/2021-11-01/wcfrelays/id_wcfrelay.go @@ -38,23 +38,9 @@ func ParseWcfRelayID(input string) (*WcfRelayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WcfRelayId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.WcfRelayName, ok = parsed.Parsed["wcfRelayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "wcfRelayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWcfRelayIDInsensitively(input string) (*WcfRelayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WcfRelayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WcfRelayId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.WcfRelayName, ok = parsed.Parsed["wcfRelayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "wcfRelayName", *parsed) + if id.WcfRelayName, ok = input.Parsed["wcfRelayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "wcfRelayName", input) } - return &id, nil + return nil } // ValidateWcfRelayID checks that 'input' can be parsed as a Wcf Relay ID diff --git a/resource-manager/relay/2021-11-01/wcfrelays/id_wcfrelayauthorizationrule.go b/resource-manager/relay/2021-11-01/wcfrelays/id_wcfrelayauthorizationrule.go index 6f5ce6b9bc9..6189776b3d1 100644 --- a/resource-manager/relay/2021-11-01/wcfrelays/id_wcfrelayauthorizationrule.go +++ b/resource-manager/relay/2021-11-01/wcfrelays/id_wcfrelayauthorizationrule.go @@ -40,27 +40,9 @@ func ParseWcfRelayAuthorizationRuleID(input string) (*WcfRelayAuthorizationRuleI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WcfRelayAuthorizationRuleId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.WcfRelayName, ok = parsed.Parsed["wcfRelayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "wcfRelayName", *parsed) - } - - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseWcfRelayAuthorizationRuleIDInsensitively(input string) (*WcfRelayAutho return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WcfRelayAuthorizationRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *WcfRelayAuthorizationRuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.WcfRelayName, ok = parsed.Parsed["wcfRelayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "wcfRelayName", *parsed) + if id.WcfRelayName, ok = input.Parsed["wcfRelayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "wcfRelayName", input) } - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if id.AuthorizationRuleName, ok = input.Parsed["authorizationRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", input) } - return &id, nil + return nil } // ValidateWcfRelayAuthorizationRuleID checks that 'input' can be parsed as a Wcf Relay Authorization Rule ID diff --git a/resource-manager/resourceconnector/2022-10-27/appliances/id_appliance.go b/resource-manager/resourceconnector/2022-10-27/appliances/id_appliance.go index c8eb093b3a0..b2e2be1e694 100644 --- a/resource-manager/resourceconnector/2022-10-27/appliances/id_appliance.go +++ b/resource-manager/resourceconnector/2022-10-27/appliances/id_appliance.go @@ -36,19 +36,9 @@ func ParseApplianceID(input string) (*ApplianceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplianceId{} - - 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.ApplianceName, ok = parsed.Parsed["applianceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applianceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseApplianceIDInsensitively(input string) (*ApplianceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplianceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ApplianceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ApplianceName, ok = parsed.Parsed["applianceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applianceName", *parsed) + if id.ApplianceName, ok = input.Parsed["applianceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applianceName", input) } - return &id, nil + return nil } // ValidateApplianceID checks that 'input' can be parsed as a Appliance ID diff --git a/resource-manager/resourceconnector/2022-10-27/appliances/id_upgradegraph.go b/resource-manager/resourceconnector/2022-10-27/appliances/id_upgradegraph.go index 02d88d9c97c..c767441bc5e 100644 --- a/resource-manager/resourceconnector/2022-10-27/appliances/id_upgradegraph.go +++ b/resource-manager/resourceconnector/2022-10-27/appliances/id_upgradegraph.go @@ -38,23 +38,9 @@ func ParseUpgradeGraphID(input string) (*UpgradeGraphId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UpgradeGraphId{} - - 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.ApplianceName, ok = parsed.Parsed["applianceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applianceName", *parsed) - } - - if id.UpgradeGraphName, ok = parsed.Parsed["upgradeGraphName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "upgradeGraphName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseUpgradeGraphIDInsensitively(input string) (*UpgradeGraphId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UpgradeGraphId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UpgradeGraphId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ApplianceName, ok = parsed.Parsed["applianceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applianceName", *parsed) + if id.ApplianceName, ok = input.Parsed["applianceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applianceName", input) } - if id.UpgradeGraphName, ok = parsed.Parsed["upgradeGraphName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "upgradeGraphName", *parsed) + if id.UpgradeGraphName, ok = input.Parsed["upgradeGraphName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "upgradeGraphName", input) } - return &id, nil + return nil } // ValidateUpgradeGraphID checks that 'input' can be parsed as a Upgrade Graph ID diff --git a/resource-manager/resources/2020-05-01/managementlocks/id_lock.go b/resource-manager/resources/2020-05-01/managementlocks/id_lock.go index b3f7f84f605..f79253dd68b 100644 --- a/resource-manager/resources/2020-05-01/managementlocks/id_lock.go +++ b/resource-manager/resources/2020-05-01/managementlocks/id_lock.go @@ -34,15 +34,9 @@ func ParseLockID(input string) (*LockId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LockId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LockName, ok = parsed.Parsed["lockName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "lockName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLockIDInsensitively(input string) (*LockId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LockId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LockId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LockName, ok = parsed.Parsed["lockName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "lockName", *parsed) + if id.LockName, ok = input.Parsed["lockName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "lockName", input) } - return &id, nil + return nil } // ValidateLockID checks that 'input' can be parsed as a Lock ID diff --git a/resource-manager/resources/2020-05-01/managementlocks/id_providerlock.go b/resource-manager/resources/2020-05-01/managementlocks/id_providerlock.go index 7ab2b52649c..5749fc0593a 100644 --- a/resource-manager/resources/2020-05-01/managementlocks/id_providerlock.go +++ b/resource-manager/resources/2020-05-01/managementlocks/id_providerlock.go @@ -36,19 +36,9 @@ func ParseProviderLockID(input string) (*ProviderLockId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLockId{} - - 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.LockName, ok = parsed.Parsed["lockName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "lockName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderLockIDInsensitively(input string) (*ProviderLockId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLockId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderLockId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LockName, ok = parsed.Parsed["lockName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "lockName", *parsed) + if id.LockName, ok = input.Parsed["lockName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "lockName", input) } - return &id, nil + return nil } // ValidateProviderLockID checks that 'input' can be parsed as a Provider Lock ID diff --git a/resource-manager/resources/2020-05-01/managementlocks/id_scopedlock.go b/resource-manager/resources/2020-05-01/managementlocks/id_scopedlock.go index e196d67bfe8..5a6ac02bc68 100644 --- a/resource-manager/resources/2020-05-01/managementlocks/id_scopedlock.go +++ b/resource-manager/resources/2020-05-01/managementlocks/id_scopedlock.go @@ -34,15 +34,9 @@ func ParseScopedLockID(input string) (*ScopedLockId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedLockId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.LockName, ok = parsed.Parsed["lockName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "lockName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedLockIDInsensitively(input string) (*ScopedLockId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedLockId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedLockId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.LockName, ok = parsed.Parsed["lockName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "lockName", *parsed) + if id.LockName, ok = input.Parsed["lockName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "lockName", input) } - return &id, nil + return nil } // ValidateScopedLockID checks that 'input' can be parsed as a Scoped Lock ID diff --git a/resource-manager/resources/2020-05-01/privatelinkassociation/id_privatelinkassociation.go b/resource-manager/resources/2020-05-01/privatelinkassociation/id_privatelinkassociation.go index 4b93814fbc4..516ba26750d 100644 --- a/resource-manager/resources/2020-05-01/privatelinkassociation/id_privatelinkassociation.go +++ b/resource-manager/resources/2020-05-01/privatelinkassociation/id_privatelinkassociation.go @@ -34,15 +34,9 @@ func ParsePrivateLinkAssociationID(input string) (*PrivateLinkAssociationId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkAssociationId{} - - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) - } - - if id.PlaId, ok = parsed.Parsed["plaId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "plaId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParsePrivateLinkAssociationIDInsensitively(input string) (*PrivateLinkAssoc return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkAssociationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + return &id, nil +} + +func (id *PrivateLinkAssociationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.GroupId, ok = input.Parsed["groupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "groupId", input) } - if id.PlaId, ok = parsed.Parsed["plaId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "plaId", *parsed) + if id.PlaId, ok = input.Parsed["plaId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "plaId", input) } - return &id, nil + return nil } // ValidatePrivateLinkAssociationID checks that 'input' can be parsed as a Private Link Association ID diff --git a/resource-manager/resources/2020-05-01/resourcemanagementprivatelink/id_resourcemanagementprivatelink.go b/resource-manager/resources/2020-05-01/resourcemanagementprivatelink/id_resourcemanagementprivatelink.go index c02c6039a45..144a94e4f16 100644 --- a/resource-manager/resources/2020-05-01/resourcemanagementprivatelink/id_resourcemanagementprivatelink.go +++ b/resource-manager/resources/2020-05-01/resourcemanagementprivatelink/id_resourcemanagementprivatelink.go @@ -36,19 +36,9 @@ func ParseResourceManagementPrivateLinkID(input string) (*ResourceManagementPriv return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResourceManagementPrivateLinkId{} - - 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.ResourceManagementPrivateLinkName, ok = parsed.Parsed["resourceManagementPrivateLinkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceManagementPrivateLinkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseResourceManagementPrivateLinkIDInsensitively(input string) (*ResourceM return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResourceManagementPrivateLinkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ResourceManagementPrivateLinkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ResourceManagementPrivateLinkName, ok = parsed.Parsed["resourceManagementPrivateLinkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceManagementPrivateLinkName", *parsed) + if id.ResourceManagementPrivateLinkName, ok = input.Parsed["resourceManagementPrivateLinkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceManagementPrivateLinkName", input) } - return &id, nil + return nil } // ValidateResourceManagementPrivateLinkID checks that 'input' can be parsed as a Resource Management Private Link ID diff --git a/resource-manager/resources/2020-06-01/deployments/id_deployment.go b/resource-manager/resources/2020-06-01/deployments/id_deployment.go index 1b8ac9a0b7f..50d8ea2338d 100644 --- a/resource-manager/resources/2020-06-01/deployments/id_deployment.go +++ b/resource-manager/resources/2020-06-01/deployments/id_deployment.go @@ -32,11 +32,9 @@ func ParseDeploymentID(input string) (*DeploymentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeploymentId{} - - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseDeploymentIDInsensitively(input string) (*DeploymentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeploymentId{} - - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *DeploymentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.DeploymentName, ok = input.Parsed["deploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", input) + } + + return nil +} + // ValidateDeploymentID checks that 'input' can be parsed as a Deployment ID func ValidateDeploymentID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/resources/2020-06-01/deployments/id_providerdeployment.go b/resource-manager/resources/2020-06-01/deployments/id_providerdeployment.go index 4bc8c8177b7..6a836679087 100644 --- a/resource-manager/resources/2020-06-01/deployments/id_providerdeployment.go +++ b/resource-manager/resources/2020-06-01/deployments/id_providerdeployment.go @@ -34,15 +34,9 @@ func ParseProviderDeploymentID(input string) (*ProviderDeploymentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderDeploymentId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviderDeploymentIDInsensitively(input string) (*ProviderDeploymentId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderDeploymentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ProviderDeploymentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if id.DeploymentName, ok = input.Parsed["deploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", input) } - return &id, nil + return nil } // ValidateProviderDeploymentID checks that 'input' can be parsed as a Provider Deployment ID diff --git a/resource-manager/resources/2020-06-01/deployments/id_providers2deployment.go b/resource-manager/resources/2020-06-01/deployments/id_providers2deployment.go index 52265051c26..a75fc6f6268 100644 --- a/resource-manager/resources/2020-06-01/deployments/id_providers2deployment.go +++ b/resource-manager/resources/2020-06-01/deployments/id_providers2deployment.go @@ -34,15 +34,9 @@ func ParseProviders2DeploymentID(input string) (*Providers2DeploymentId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2DeploymentId{} - - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) - } - - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviders2DeploymentIDInsensitively(input string) (*Providers2Deployme return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2DeploymentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + return &id, nil +} + +func (id *Providers2DeploymentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.GroupId, ok = input.Parsed["groupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "groupId", input) } - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if id.DeploymentName, ok = input.Parsed["deploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", input) } - return &id, nil + return nil } // ValidateProviders2DeploymentID checks that 'input' can be parsed as a Providers 2 Deployment ID diff --git a/resource-manager/resources/2020-06-01/deployments/id_resourcegroupproviderdeployment.go b/resource-manager/resources/2020-06-01/deployments/id_resourcegroupproviderdeployment.go index 6e631c2aab4..8f17c3193b2 100644 --- a/resource-manager/resources/2020-06-01/deployments/id_resourcegroupproviderdeployment.go +++ b/resource-manager/resources/2020-06-01/deployments/id_resourcegroupproviderdeployment.go @@ -36,19 +36,9 @@ func ParseResourceGroupProviderDeploymentID(input string) (*ResourceGroupProvide return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResourceGroupProviderDeploymentId{} - - 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.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseResourceGroupProviderDeploymentIDInsensitively(input string) (*Resourc return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResourceGroupProviderDeploymentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ResourceGroupProviderDeploymentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if id.DeploymentName, ok = input.Parsed["deploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", input) } - return &id, nil + return nil } // ValidateResourceGroupProviderDeploymentID checks that 'input' can be parsed as a Resource Group Provider Deployment ID diff --git a/resource-manager/resources/2020-06-01/deployments/id_scopeddeployment.go b/resource-manager/resources/2020-06-01/deployments/id_scopeddeployment.go index 88c1e0fa504..ef514418e15 100644 --- a/resource-manager/resources/2020-06-01/deployments/id_scopeddeployment.go +++ b/resource-manager/resources/2020-06-01/deployments/id_scopeddeployment.go @@ -34,15 +34,9 @@ func ParseScopedDeploymentID(input string) (*ScopedDeploymentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedDeploymentId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedDeploymentIDInsensitively(input string) (*ScopedDeploymentId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedDeploymentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedDeploymentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if id.DeploymentName, ok = input.Parsed["deploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", input) } - return &id, nil + return nil } // ValidateScopedDeploymentID checks that 'input' can be parsed as a Scoped Deployment ID diff --git a/resource-manager/resources/2020-06-01/providers/id_provider.go b/resource-manager/resources/2020-06-01/providers/id_provider.go index 07ca7ca6019..0b86127bf7b 100644 --- a/resource-manager/resources/2020-06-01/providers/id_provider.go +++ b/resource-manager/resources/2020-06-01/providers/id_provider.go @@ -32,11 +32,9 @@ func ParseProviderID(input string) (*ProviderId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderId{} - - if id.ProviderName, ok = parsed.Parsed["providerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "providerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseProviderIDInsensitively(input string) (*ProviderId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderId{} - - if id.ProviderName, ok = parsed.Parsed["providerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "providerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *ProviderId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ProviderName, ok = input.Parsed["providerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "providerName", input) + } + + return nil +} + // ValidateProviderID checks that 'input' can be parsed as a Provider ID func ValidateProviderID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/resources/2020-06-01/providers/id_providers2.go b/resource-manager/resources/2020-06-01/providers/id_providers2.go index 58c356b00ef..af2005474ea 100644 --- a/resource-manager/resources/2020-06-01/providers/id_providers2.go +++ b/resource-manager/resources/2020-06-01/providers/id_providers2.go @@ -34,15 +34,9 @@ func ParseProviders2ID(input string) (*Providers2Id, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2Id{} - - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) - } - - if id.ProviderName, ok = parsed.Parsed["providerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "providerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviders2IDInsensitively(input string) (*Providers2Id, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2Id{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + return &id, nil +} + +func (id *Providers2Id) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.GroupId, ok = input.Parsed["groupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "groupId", input) } - if id.ProviderName, ok = parsed.Parsed["providerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "providerName", *parsed) + if id.ProviderName, ok = input.Parsed["providerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "providerName", input) } - return &id, nil + return nil } // ValidateProviders2ID checks that 'input' can be parsed as a Providers 2 ID diff --git a/resource-manager/resources/2020-06-01/providers/id_subscriptionprovider.go b/resource-manager/resources/2020-06-01/providers/id_subscriptionprovider.go index 17226acbe6e..6a3dfa8cc74 100644 --- a/resource-manager/resources/2020-06-01/providers/id_subscriptionprovider.go +++ b/resource-manager/resources/2020-06-01/providers/id_subscriptionprovider.go @@ -34,15 +34,9 @@ func ParseSubscriptionProviderID(input string) (*SubscriptionProviderId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SubscriptionProviderId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.ProviderName, ok = parsed.Parsed["providerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "providerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseSubscriptionProviderIDInsensitively(input string) (*SubscriptionProvid return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SubscriptionProviderId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SubscriptionProviderId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ProviderName, ok = parsed.Parsed["providerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "providerName", *parsed) + if id.ProviderName, ok = input.Parsed["providerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "providerName", input) } - return &id, nil + return nil } // ValidateSubscriptionProviderID checks that 'input' can be parsed as a Subscription Provider ID diff --git a/resource-manager/resources/2020-10-01/deployments/id_deployment.go b/resource-manager/resources/2020-10-01/deployments/id_deployment.go index 1b8ac9a0b7f..50d8ea2338d 100644 --- a/resource-manager/resources/2020-10-01/deployments/id_deployment.go +++ b/resource-manager/resources/2020-10-01/deployments/id_deployment.go @@ -32,11 +32,9 @@ func ParseDeploymentID(input string) (*DeploymentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeploymentId{} - - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseDeploymentIDInsensitively(input string) (*DeploymentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeploymentId{} - - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *DeploymentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.DeploymentName, ok = input.Parsed["deploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", input) + } + + return nil +} + // ValidateDeploymentID checks that 'input' can be parsed as a Deployment ID func ValidateDeploymentID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/resources/2020-10-01/deployments/id_providerdeployment.go b/resource-manager/resources/2020-10-01/deployments/id_providerdeployment.go index 4bc8c8177b7..6a836679087 100644 --- a/resource-manager/resources/2020-10-01/deployments/id_providerdeployment.go +++ b/resource-manager/resources/2020-10-01/deployments/id_providerdeployment.go @@ -34,15 +34,9 @@ func ParseProviderDeploymentID(input string) (*ProviderDeploymentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderDeploymentId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviderDeploymentIDInsensitively(input string) (*ProviderDeploymentId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderDeploymentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ProviderDeploymentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if id.DeploymentName, ok = input.Parsed["deploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", input) } - return &id, nil + return nil } // ValidateProviderDeploymentID checks that 'input' can be parsed as a Provider Deployment ID diff --git a/resource-manager/resources/2020-10-01/deployments/id_providers2deployment.go b/resource-manager/resources/2020-10-01/deployments/id_providers2deployment.go index 52265051c26..a75fc6f6268 100644 --- a/resource-manager/resources/2020-10-01/deployments/id_providers2deployment.go +++ b/resource-manager/resources/2020-10-01/deployments/id_providers2deployment.go @@ -34,15 +34,9 @@ func ParseProviders2DeploymentID(input string) (*Providers2DeploymentId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2DeploymentId{} - - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) - } - - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviders2DeploymentIDInsensitively(input string) (*Providers2Deployme return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2DeploymentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + return &id, nil +} + +func (id *Providers2DeploymentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.GroupId, ok = input.Parsed["groupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "groupId", input) } - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if id.DeploymentName, ok = input.Parsed["deploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", input) } - return &id, nil + return nil } // ValidateProviders2DeploymentID checks that 'input' can be parsed as a Providers 2 Deployment ID diff --git a/resource-manager/resources/2020-10-01/deployments/id_resourcegroupproviderdeployment.go b/resource-manager/resources/2020-10-01/deployments/id_resourcegroupproviderdeployment.go index 6e631c2aab4..8f17c3193b2 100644 --- a/resource-manager/resources/2020-10-01/deployments/id_resourcegroupproviderdeployment.go +++ b/resource-manager/resources/2020-10-01/deployments/id_resourcegroupproviderdeployment.go @@ -36,19 +36,9 @@ func ParseResourceGroupProviderDeploymentID(input string) (*ResourceGroupProvide return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResourceGroupProviderDeploymentId{} - - 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.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseResourceGroupProviderDeploymentIDInsensitively(input string) (*Resourc return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResourceGroupProviderDeploymentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ResourceGroupProviderDeploymentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if id.DeploymentName, ok = input.Parsed["deploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", input) } - return &id, nil + return nil } // ValidateResourceGroupProviderDeploymentID checks that 'input' can be parsed as a Resource Group Provider Deployment ID diff --git a/resource-manager/resources/2020-10-01/deployments/id_scopeddeployment.go b/resource-manager/resources/2020-10-01/deployments/id_scopeddeployment.go index 88c1e0fa504..ef514418e15 100644 --- a/resource-manager/resources/2020-10-01/deployments/id_scopeddeployment.go +++ b/resource-manager/resources/2020-10-01/deployments/id_scopeddeployment.go @@ -34,15 +34,9 @@ func ParseScopedDeploymentID(input string) (*ScopedDeploymentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedDeploymentId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedDeploymentIDInsensitively(input string) (*ScopedDeploymentId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedDeploymentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedDeploymentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if id.DeploymentName, ok = input.Parsed["deploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", input) } - return &id, nil + return nil } // ValidateScopedDeploymentID checks that 'input' can be parsed as a Scoped Deployment ID diff --git a/resource-manager/resources/2020-10-01/deploymentscripts/id_deploymentscript.go b/resource-manager/resources/2020-10-01/deploymentscripts/id_deploymentscript.go index 984a05168d4..b687535330b 100644 --- a/resource-manager/resources/2020-10-01/deploymentscripts/id_deploymentscript.go +++ b/resource-manager/resources/2020-10-01/deploymentscripts/id_deploymentscript.go @@ -36,19 +36,9 @@ func ParseDeploymentScriptID(input string) (*DeploymentScriptId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeploymentScriptId{} - - 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.DeploymentScriptName, ok = parsed.Parsed["deploymentScriptName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentScriptName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDeploymentScriptIDInsensitively(input string) (*DeploymentScriptId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeploymentScriptId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DeploymentScriptId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DeploymentScriptName, ok = parsed.Parsed["deploymentScriptName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentScriptName", *parsed) + if id.DeploymentScriptName, ok = input.Parsed["deploymentScriptName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deploymentScriptName", input) } - return &id, nil + return nil } // ValidateDeploymentScriptID checks that 'input' can be parsed as a Deployment Script ID diff --git a/resource-manager/resources/2020-10-01/providers/id_provider.go b/resource-manager/resources/2020-10-01/providers/id_provider.go index 07ca7ca6019..0b86127bf7b 100644 --- a/resource-manager/resources/2020-10-01/providers/id_provider.go +++ b/resource-manager/resources/2020-10-01/providers/id_provider.go @@ -32,11 +32,9 @@ func ParseProviderID(input string) (*ProviderId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderId{} - - if id.ProviderName, ok = parsed.Parsed["providerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "providerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseProviderIDInsensitively(input string) (*ProviderId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderId{} - - if id.ProviderName, ok = parsed.Parsed["providerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "providerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *ProviderId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ProviderName, ok = input.Parsed["providerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "providerName", input) + } + + return nil +} + // ValidateProviderID checks that 'input' can be parsed as a Provider ID func ValidateProviderID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/resources/2020-10-01/providers/id_providers2.go b/resource-manager/resources/2020-10-01/providers/id_providers2.go index 58c356b00ef..af2005474ea 100644 --- a/resource-manager/resources/2020-10-01/providers/id_providers2.go +++ b/resource-manager/resources/2020-10-01/providers/id_providers2.go @@ -34,15 +34,9 @@ func ParseProviders2ID(input string) (*Providers2Id, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2Id{} - - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) - } - - if id.ProviderName, ok = parsed.Parsed["providerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "providerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviders2IDInsensitively(input string) (*Providers2Id, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2Id{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + return &id, nil +} + +func (id *Providers2Id) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.GroupId, ok = input.Parsed["groupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "groupId", input) } - if id.ProviderName, ok = parsed.Parsed["providerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "providerName", *parsed) + if id.ProviderName, ok = input.Parsed["providerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "providerName", input) } - return &id, nil + return nil } // ValidateProviders2ID checks that 'input' can be parsed as a Providers 2 ID diff --git a/resource-manager/resources/2020-10-01/providers/id_subscriptionprovider.go b/resource-manager/resources/2020-10-01/providers/id_subscriptionprovider.go index 17226acbe6e..6a3dfa8cc74 100644 --- a/resource-manager/resources/2020-10-01/providers/id_subscriptionprovider.go +++ b/resource-manager/resources/2020-10-01/providers/id_subscriptionprovider.go @@ -34,15 +34,9 @@ func ParseSubscriptionProviderID(input string) (*SubscriptionProviderId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SubscriptionProviderId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.ProviderName, ok = parsed.Parsed["providerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "providerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseSubscriptionProviderIDInsensitively(input string) (*SubscriptionProvid return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SubscriptionProviderId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SubscriptionProviderId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ProviderName, ok = parsed.Parsed["providerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "providerName", *parsed) + if id.ProviderName, ok = input.Parsed["providerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "providerName", input) } - return &id, nil + return nil } // ValidateSubscriptionProviderID checks that 'input' can be parsed as a Subscription Provider ID diff --git a/resource-manager/resources/2021-04-01/deployments/id_deployment.go b/resource-manager/resources/2021-04-01/deployments/id_deployment.go index 1b8ac9a0b7f..50d8ea2338d 100644 --- a/resource-manager/resources/2021-04-01/deployments/id_deployment.go +++ b/resource-manager/resources/2021-04-01/deployments/id_deployment.go @@ -32,11 +32,9 @@ func ParseDeploymentID(input string) (*DeploymentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeploymentId{} - - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseDeploymentIDInsensitively(input string) (*DeploymentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeploymentId{} - - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *DeploymentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.DeploymentName, ok = input.Parsed["deploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", input) + } + + return nil +} + // ValidateDeploymentID checks that 'input' can be parsed as a Deployment ID func ValidateDeploymentID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/resources/2021-04-01/deployments/id_providerdeployment.go b/resource-manager/resources/2021-04-01/deployments/id_providerdeployment.go index 4bc8c8177b7..6a836679087 100644 --- a/resource-manager/resources/2021-04-01/deployments/id_providerdeployment.go +++ b/resource-manager/resources/2021-04-01/deployments/id_providerdeployment.go @@ -34,15 +34,9 @@ func ParseProviderDeploymentID(input string) (*ProviderDeploymentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderDeploymentId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviderDeploymentIDInsensitively(input string) (*ProviderDeploymentId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderDeploymentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ProviderDeploymentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if id.DeploymentName, ok = input.Parsed["deploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", input) } - return &id, nil + return nil } // ValidateProviderDeploymentID checks that 'input' can be parsed as a Provider Deployment ID diff --git a/resource-manager/resources/2021-04-01/deployments/id_providers2deployment.go b/resource-manager/resources/2021-04-01/deployments/id_providers2deployment.go index 52265051c26..a75fc6f6268 100644 --- a/resource-manager/resources/2021-04-01/deployments/id_providers2deployment.go +++ b/resource-manager/resources/2021-04-01/deployments/id_providers2deployment.go @@ -34,15 +34,9 @@ func ParseProviders2DeploymentID(input string) (*Providers2DeploymentId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2DeploymentId{} - - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) - } - - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviders2DeploymentIDInsensitively(input string) (*Providers2Deployme return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2DeploymentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + return &id, nil +} + +func (id *Providers2DeploymentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.GroupId, ok = input.Parsed["groupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "groupId", input) } - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if id.DeploymentName, ok = input.Parsed["deploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", input) } - return &id, nil + return nil } // ValidateProviders2DeploymentID checks that 'input' can be parsed as a Providers 2 Deployment ID diff --git a/resource-manager/resources/2021-04-01/deployments/id_resourcegroupproviderdeployment.go b/resource-manager/resources/2021-04-01/deployments/id_resourcegroupproviderdeployment.go index 6e631c2aab4..8f17c3193b2 100644 --- a/resource-manager/resources/2021-04-01/deployments/id_resourcegroupproviderdeployment.go +++ b/resource-manager/resources/2021-04-01/deployments/id_resourcegroupproviderdeployment.go @@ -36,19 +36,9 @@ func ParseResourceGroupProviderDeploymentID(input string) (*ResourceGroupProvide return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResourceGroupProviderDeploymentId{} - - 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.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseResourceGroupProviderDeploymentIDInsensitively(input string) (*Resourc return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResourceGroupProviderDeploymentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ResourceGroupProviderDeploymentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if id.DeploymentName, ok = input.Parsed["deploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", input) } - return &id, nil + return nil } // ValidateResourceGroupProviderDeploymentID checks that 'input' can be parsed as a Resource Group Provider Deployment ID diff --git a/resource-manager/resources/2021-04-01/deployments/id_scopeddeployment.go b/resource-manager/resources/2021-04-01/deployments/id_scopeddeployment.go index 88c1e0fa504..ef514418e15 100644 --- a/resource-manager/resources/2021-04-01/deployments/id_scopeddeployment.go +++ b/resource-manager/resources/2021-04-01/deployments/id_scopeddeployment.go @@ -34,15 +34,9 @@ func ParseScopedDeploymentID(input string) (*ScopedDeploymentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedDeploymentId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedDeploymentIDInsensitively(input string) (*ScopedDeploymentId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedDeploymentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedDeploymentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if id.DeploymentName, ok = input.Parsed["deploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", input) } - return &id, nil + return nil } // ValidateScopedDeploymentID checks that 'input' can be parsed as a Scoped Deployment ID diff --git a/resource-manager/resources/2021-04-01/providers/id_provider.go b/resource-manager/resources/2021-04-01/providers/id_provider.go index 07ca7ca6019..0b86127bf7b 100644 --- a/resource-manager/resources/2021-04-01/providers/id_provider.go +++ b/resource-manager/resources/2021-04-01/providers/id_provider.go @@ -32,11 +32,9 @@ func ParseProviderID(input string) (*ProviderId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderId{} - - if id.ProviderName, ok = parsed.Parsed["providerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "providerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseProviderIDInsensitively(input string) (*ProviderId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderId{} - - if id.ProviderName, ok = parsed.Parsed["providerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "providerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *ProviderId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ProviderName, ok = input.Parsed["providerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "providerName", input) + } + + return nil +} + // ValidateProviderID checks that 'input' can be parsed as a Provider ID func ValidateProviderID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/resources/2021-04-01/providers/id_providers2.go b/resource-manager/resources/2021-04-01/providers/id_providers2.go index 58c356b00ef..af2005474ea 100644 --- a/resource-manager/resources/2021-04-01/providers/id_providers2.go +++ b/resource-manager/resources/2021-04-01/providers/id_providers2.go @@ -34,15 +34,9 @@ func ParseProviders2ID(input string) (*Providers2Id, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2Id{} - - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) - } - - if id.ProviderName, ok = parsed.Parsed["providerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "providerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviders2IDInsensitively(input string) (*Providers2Id, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2Id{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + return &id, nil +} + +func (id *Providers2Id) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.GroupId, ok = input.Parsed["groupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "groupId", input) } - if id.ProviderName, ok = parsed.Parsed["providerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "providerName", *parsed) + if id.ProviderName, ok = input.Parsed["providerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "providerName", input) } - return &id, nil + return nil } // ValidateProviders2ID checks that 'input' can be parsed as a Providers 2 ID diff --git a/resource-manager/resources/2021-04-01/providers/id_subscriptionprovider.go b/resource-manager/resources/2021-04-01/providers/id_subscriptionprovider.go index 17226acbe6e..6a3dfa8cc74 100644 --- a/resource-manager/resources/2021-04-01/providers/id_subscriptionprovider.go +++ b/resource-manager/resources/2021-04-01/providers/id_subscriptionprovider.go @@ -34,15 +34,9 @@ func ParseSubscriptionProviderID(input string) (*SubscriptionProviderId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SubscriptionProviderId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.ProviderName, ok = parsed.Parsed["providerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "providerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseSubscriptionProviderIDInsensitively(input string) (*SubscriptionProvid return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SubscriptionProviderId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SubscriptionProviderId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ProviderName, ok = parsed.Parsed["providerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "providerName", *parsed) + if id.ProviderName, ok = input.Parsed["providerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "providerName", input) } - return &id, nil + return nil } // ValidateSubscriptionProviderID checks that 'input' can be parsed as a Subscription Provider ID diff --git a/resource-manager/resources/2021-06-01/policyassignments/id_policyassignmentid.go b/resource-manager/resources/2021-06-01/policyassignments/id_policyassignmentid.go index 08be41779d3..ff9fc39e80c 100644 --- a/resource-manager/resources/2021-06-01/policyassignments/id_policyassignmentid.go +++ b/resource-manager/resources/2021-06-01/policyassignments/id_policyassignmentid.go @@ -32,11 +32,9 @@ func ParsePolicyAssignmentIdID(input string) (*PolicyAssignmentIdId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PolicyAssignmentIdId{} - - if id.PolicyAssignmentId, ok = parsed.Parsed["policyAssignmentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policyAssignmentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParsePolicyAssignmentIdIDInsensitively(input string) (*PolicyAssignmentIdId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PolicyAssignmentIdId{} - - if id.PolicyAssignmentId, ok = parsed.Parsed["policyAssignmentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policyAssignmentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *PolicyAssignmentIdId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.PolicyAssignmentId, ok = input.Parsed["policyAssignmentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "policyAssignmentId", input) + } + + return nil +} + // ValidatePolicyAssignmentIdID checks that 'input' can be parsed as a Policy Assignment Id ID func ValidatePolicyAssignmentIdID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/resources/2021-06-01/policyassignments/id_scopedpolicyassignment.go b/resource-manager/resources/2021-06-01/policyassignments/id_scopedpolicyassignment.go index 3f3e0c84500..da25eae20dd 100644 --- a/resource-manager/resources/2021-06-01/policyassignments/id_scopedpolicyassignment.go +++ b/resource-manager/resources/2021-06-01/policyassignments/id_scopedpolicyassignment.go @@ -34,15 +34,9 @@ func ParseScopedPolicyAssignmentID(input string) (*ScopedPolicyAssignmentId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedPolicyAssignmentId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.PolicyAssignmentName, ok = parsed.Parsed["policyAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policyAssignmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedPolicyAssignmentIDInsensitively(input string) (*ScopedPolicyAssi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedPolicyAssignmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedPolicyAssignmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.PolicyAssignmentName, ok = parsed.Parsed["policyAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policyAssignmentName", *parsed) + if id.PolicyAssignmentName, ok = input.Parsed["policyAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "policyAssignmentName", input) } - return &id, nil + return nil } // ValidateScopedPolicyAssignmentID checks that 'input' can be parsed as a Scoped Policy Assignment ID diff --git a/resource-manager/resources/2021-06-01/policydefinitions/id_policydefinition.go b/resource-manager/resources/2021-06-01/policydefinitions/id_policydefinition.go index 8cfbb2005d7..7c9ace6a986 100644 --- a/resource-manager/resources/2021-06-01/policydefinitions/id_policydefinition.go +++ b/resource-manager/resources/2021-06-01/policydefinitions/id_policydefinition.go @@ -32,11 +32,9 @@ func ParsePolicyDefinitionID(input string) (*PolicyDefinitionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PolicyDefinitionId{} - - if id.PolicyDefinitionName, ok = parsed.Parsed["policyDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policyDefinitionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParsePolicyDefinitionIDInsensitively(input string) (*PolicyDefinitionId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PolicyDefinitionId{} - - if id.PolicyDefinitionName, ok = parsed.Parsed["policyDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policyDefinitionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *PolicyDefinitionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.PolicyDefinitionName, ok = input.Parsed["policyDefinitionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "policyDefinitionName", input) + } + + return nil +} + // ValidatePolicyDefinitionID checks that 'input' can be parsed as a Policy Definition ID func ValidatePolicyDefinitionID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/resources/2021-06-01/policydefinitions/id_providerpolicydefinition.go b/resource-manager/resources/2021-06-01/policydefinitions/id_providerpolicydefinition.go index 0284ff567c0..5d94222e677 100644 --- a/resource-manager/resources/2021-06-01/policydefinitions/id_providerpolicydefinition.go +++ b/resource-manager/resources/2021-06-01/policydefinitions/id_providerpolicydefinition.go @@ -34,15 +34,9 @@ func ParseProviderPolicyDefinitionID(input string) (*ProviderPolicyDefinitionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderPolicyDefinitionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.PolicyDefinitionName, ok = parsed.Parsed["policyDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policyDefinitionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviderPolicyDefinitionIDInsensitively(input string) (*ProviderPolicy return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderPolicyDefinitionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ProviderPolicyDefinitionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.PolicyDefinitionName, ok = parsed.Parsed["policyDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policyDefinitionName", *parsed) + if id.PolicyDefinitionName, ok = input.Parsed["policyDefinitionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "policyDefinitionName", input) } - return &id, nil + return nil } // ValidateProviderPolicyDefinitionID checks that 'input' can be parsed as a Provider Policy Definition ID diff --git a/resource-manager/resources/2021-06-01/policydefinitions/id_providers2policydefinition.go b/resource-manager/resources/2021-06-01/policydefinitions/id_providers2policydefinition.go index 3900e38c7ba..361e268aec8 100644 --- a/resource-manager/resources/2021-06-01/policydefinitions/id_providers2policydefinition.go +++ b/resource-manager/resources/2021-06-01/policydefinitions/id_providers2policydefinition.go @@ -34,15 +34,9 @@ func ParseProviders2PolicyDefinitionID(input string) (*Providers2PolicyDefinitio return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2PolicyDefinitionId{} - - if id.ManagementGroupId, ok = parsed.Parsed["managementGroupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managementGroupId", *parsed) - } - - if id.PolicyDefinitionName, ok = parsed.Parsed["policyDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policyDefinitionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviders2PolicyDefinitionIDInsensitively(input string) (*Providers2Po return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2PolicyDefinitionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ManagementGroupId, ok = parsed.Parsed["managementGroupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managementGroupId", *parsed) + return &id, nil +} + +func (id *Providers2PolicyDefinitionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ManagementGroupId, ok = input.Parsed["managementGroupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managementGroupId", input) } - if id.PolicyDefinitionName, ok = parsed.Parsed["policyDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policyDefinitionName", *parsed) + if id.PolicyDefinitionName, ok = input.Parsed["policyDefinitionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "policyDefinitionName", input) } - return &id, nil + return nil } // ValidateProviders2PolicyDefinitionID checks that 'input' can be parsed as a Providers 2 Policy Definition ID diff --git a/resource-manager/resources/2021-06-01/policysetdefinitions/id_policysetdefinition.go b/resource-manager/resources/2021-06-01/policysetdefinitions/id_policysetdefinition.go index 5e1cff6f7f2..b3e5d30c7fa 100644 --- a/resource-manager/resources/2021-06-01/policysetdefinitions/id_policysetdefinition.go +++ b/resource-manager/resources/2021-06-01/policysetdefinitions/id_policysetdefinition.go @@ -32,11 +32,9 @@ func ParsePolicySetDefinitionID(input string) (*PolicySetDefinitionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PolicySetDefinitionId{} - - if id.PolicySetDefinitionName, ok = parsed.Parsed["policySetDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policySetDefinitionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParsePolicySetDefinitionIDInsensitively(input string) (*PolicySetDefinition return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PolicySetDefinitionId{} - - if id.PolicySetDefinitionName, ok = parsed.Parsed["policySetDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policySetDefinitionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *PolicySetDefinitionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.PolicySetDefinitionName, ok = input.Parsed["policySetDefinitionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "policySetDefinitionName", input) + } + + return nil +} + // ValidatePolicySetDefinitionID checks that 'input' can be parsed as a Policy Set Definition ID func ValidatePolicySetDefinitionID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/resources/2021-06-01/policysetdefinitions/id_providerpolicysetdefinition.go b/resource-manager/resources/2021-06-01/policysetdefinitions/id_providerpolicysetdefinition.go index f1bfea9ad47..0ddfef3946a 100644 --- a/resource-manager/resources/2021-06-01/policysetdefinitions/id_providerpolicysetdefinition.go +++ b/resource-manager/resources/2021-06-01/policysetdefinitions/id_providerpolicysetdefinition.go @@ -34,15 +34,9 @@ func ParseProviderPolicySetDefinitionID(input string) (*ProviderPolicySetDefinit return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderPolicySetDefinitionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.PolicySetDefinitionName, ok = parsed.Parsed["policySetDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policySetDefinitionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviderPolicySetDefinitionIDInsensitively(input string) (*ProviderPol return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderPolicySetDefinitionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ProviderPolicySetDefinitionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.PolicySetDefinitionName, ok = parsed.Parsed["policySetDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policySetDefinitionName", *parsed) + if id.PolicySetDefinitionName, ok = input.Parsed["policySetDefinitionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "policySetDefinitionName", input) } - return &id, nil + return nil } // ValidateProviderPolicySetDefinitionID checks that 'input' can be parsed as a Provider Policy Set Definition ID diff --git a/resource-manager/resources/2021-06-01/policysetdefinitions/id_providers2policysetdefinition.go b/resource-manager/resources/2021-06-01/policysetdefinitions/id_providers2policysetdefinition.go index 0fec72718a8..1481eaf22dd 100644 --- a/resource-manager/resources/2021-06-01/policysetdefinitions/id_providers2policysetdefinition.go +++ b/resource-manager/resources/2021-06-01/policysetdefinitions/id_providers2policysetdefinition.go @@ -34,15 +34,9 @@ func ParseProviders2PolicySetDefinitionID(input string) (*Providers2PolicySetDef return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2PolicySetDefinitionId{} - - if id.ManagementGroupId, ok = parsed.Parsed["managementGroupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managementGroupId", *parsed) - } - - if id.PolicySetDefinitionName, ok = parsed.Parsed["policySetDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policySetDefinitionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviders2PolicySetDefinitionIDInsensitively(input string) (*Providers return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2PolicySetDefinitionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ManagementGroupId, ok = parsed.Parsed["managementGroupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managementGroupId", *parsed) + return &id, nil +} + +func (id *Providers2PolicySetDefinitionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ManagementGroupId, ok = input.Parsed["managementGroupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managementGroupId", input) } - if id.PolicySetDefinitionName, ok = parsed.Parsed["policySetDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policySetDefinitionName", *parsed) + if id.PolicySetDefinitionName, ok = input.Parsed["policySetDefinitionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "policySetDefinitionName", input) } - return &id, nil + return nil } // ValidateProviders2PolicySetDefinitionID checks that 'input' can be parsed as a Providers 2 Policy Set Definition ID diff --git a/resource-manager/resources/2021-07-01/features/id_feature.go b/resource-manager/resources/2021-07-01/features/id_feature.go index 9023d1d5519..66724aafa93 100644 --- a/resource-manager/resources/2021-07-01/features/id_feature.go +++ b/resource-manager/resources/2021-07-01/features/id_feature.go @@ -36,19 +36,9 @@ func ParseFeatureID(input string) (*FeatureId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FeatureId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.ProviderName, ok = parsed.Parsed["providerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "providerName", *parsed) - } - - if id.FeatureName, ok = parsed.Parsed["featureName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "featureName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseFeatureIDInsensitively(input string) (*FeatureId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FeatureId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FeatureId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ProviderName, ok = parsed.Parsed["providerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "providerName", *parsed) + if id.ProviderName, ok = input.Parsed["providerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "providerName", input) } - if id.FeatureName, ok = parsed.Parsed["featureName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "featureName", *parsed) + if id.FeatureName, ok = input.Parsed["featureName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "featureName", input) } - return &id, nil + return nil } // ValidateFeatureID checks that 'input' can be parsed as a Feature ID diff --git a/resource-manager/resources/2021-07-01/features/id_providers2.go b/resource-manager/resources/2021-07-01/features/id_providers2.go index 7345618cb9b..789159676fa 100644 --- a/resource-manager/resources/2021-07-01/features/id_providers2.go +++ b/resource-manager/resources/2021-07-01/features/id_providers2.go @@ -34,15 +34,9 @@ func ParseProviders2ID(input string) (*Providers2Id, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2Id{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.ProviderName, ok = parsed.Parsed["providerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "providerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviders2IDInsensitively(input string) (*Providers2Id, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2Id{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *Providers2Id) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ProviderName, ok = parsed.Parsed["providerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "providerName", *parsed) + if id.ProviderName, ok = input.Parsed["providerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "providerName", input) } - return &id, nil + return nil } // ValidateProviders2ID checks that 'input' can be parsed as a Providers 2 ID diff --git a/resource-manager/resources/2021-07-01/subscriptionfeatureregistrations/id_featureprovider.go b/resource-manager/resources/2021-07-01/subscriptionfeatureregistrations/id_featureprovider.go index 331374770bb..92513561204 100644 --- a/resource-manager/resources/2021-07-01/subscriptionfeatureregistrations/id_featureprovider.go +++ b/resource-manager/resources/2021-07-01/subscriptionfeatureregistrations/id_featureprovider.go @@ -34,15 +34,9 @@ func ParseFeatureProviderID(input string) (*FeatureProviderId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FeatureProviderId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.FeatureProviderName, ok = parsed.Parsed["featureProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "featureProviderName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseFeatureProviderIDInsensitively(input string) (*FeatureProviderId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FeatureProviderId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *FeatureProviderId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.FeatureProviderName, ok = parsed.Parsed["featureProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "featureProviderName", *parsed) + if id.FeatureProviderName, ok = input.Parsed["featureProviderName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "featureProviderName", input) } - return &id, nil + return nil } // ValidateFeatureProviderID checks that 'input' can be parsed as a Feature Provider ID diff --git a/resource-manager/resources/2021-07-01/subscriptionfeatureregistrations/id_subscriptionfeatureregistration.go b/resource-manager/resources/2021-07-01/subscriptionfeatureregistrations/id_subscriptionfeatureregistration.go index 99a03495e81..b6cc0e198a3 100644 --- a/resource-manager/resources/2021-07-01/subscriptionfeatureregistrations/id_subscriptionfeatureregistration.go +++ b/resource-manager/resources/2021-07-01/subscriptionfeatureregistrations/id_subscriptionfeatureregistration.go @@ -36,19 +36,9 @@ func ParseSubscriptionFeatureRegistrationID(input string) (*SubscriptionFeatureR return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SubscriptionFeatureRegistrationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.FeatureProviderName, ok = parsed.Parsed["featureProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "featureProviderName", *parsed) - } - - if id.SubscriptionFeatureRegistrationName, ok = parsed.Parsed["subscriptionFeatureRegistrationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionFeatureRegistrationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSubscriptionFeatureRegistrationIDInsensitively(input string) (*Subscri return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SubscriptionFeatureRegistrationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SubscriptionFeatureRegistrationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.FeatureProviderName, ok = parsed.Parsed["featureProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "featureProviderName", *parsed) + if id.FeatureProviderName, ok = input.Parsed["featureProviderName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "featureProviderName", input) } - if id.SubscriptionFeatureRegistrationName, ok = parsed.Parsed["subscriptionFeatureRegistrationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionFeatureRegistrationName", *parsed) + if id.SubscriptionFeatureRegistrationName, ok = input.Parsed["subscriptionFeatureRegistrationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionFeatureRegistrationName", input) } - return &id, nil + return nil } // ValidateSubscriptionFeatureRegistrationID checks that 'input' can be parsed as a Subscription Feature Registration ID diff --git a/resource-manager/resources/2022-02-01/templatespecs/id_builtintemplatespec.go b/resource-manager/resources/2022-02-01/templatespecs/id_builtintemplatespec.go index 0796334be4b..38eccdd6c7f 100644 --- a/resource-manager/resources/2022-02-01/templatespecs/id_builtintemplatespec.go +++ b/resource-manager/resources/2022-02-01/templatespecs/id_builtintemplatespec.go @@ -32,11 +32,9 @@ func ParseBuiltInTemplateSpecID(input string) (*BuiltInTemplateSpecId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BuiltInTemplateSpecId{} - - if id.BuiltInTemplateSpecName, ok = parsed.Parsed["builtInTemplateSpecName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "builtInTemplateSpecName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseBuiltInTemplateSpecIDInsensitively(input string) (*BuiltInTemplateSpec return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BuiltInTemplateSpecId{} - - if id.BuiltInTemplateSpecName, ok = parsed.Parsed["builtInTemplateSpecName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "builtInTemplateSpecName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *BuiltInTemplateSpecId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BuiltInTemplateSpecName, ok = input.Parsed["builtInTemplateSpecName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "builtInTemplateSpecName", input) + } + + return nil +} + // ValidateBuiltInTemplateSpecID checks that 'input' can be parsed as a Built In Template Spec ID func ValidateBuiltInTemplateSpecID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/resources/2022-02-01/templatespecs/id_templatespec.go b/resource-manager/resources/2022-02-01/templatespecs/id_templatespec.go index d19baae9dfb..adbd354c009 100644 --- a/resource-manager/resources/2022-02-01/templatespecs/id_templatespec.go +++ b/resource-manager/resources/2022-02-01/templatespecs/id_templatespec.go @@ -36,19 +36,9 @@ func ParseTemplateSpecID(input string) (*TemplateSpecId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TemplateSpecId{} - - 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.TemplateSpecName, ok = parsed.Parsed["templateSpecName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "templateSpecName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseTemplateSpecIDInsensitively(input string) (*TemplateSpecId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TemplateSpecId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *TemplateSpecId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.TemplateSpecName, ok = parsed.Parsed["templateSpecName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "templateSpecName", *parsed) + if id.TemplateSpecName, ok = input.Parsed["templateSpecName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "templateSpecName", input) } - return &id, nil + return nil } // ValidateTemplateSpecID checks that 'input' can be parsed as a Template Spec ID diff --git a/resource-manager/resources/2022-02-01/templatespecversions/id_builtintemplatespec.go b/resource-manager/resources/2022-02-01/templatespecversions/id_builtintemplatespec.go index b15fe7c5a64..1581e755299 100644 --- a/resource-manager/resources/2022-02-01/templatespecversions/id_builtintemplatespec.go +++ b/resource-manager/resources/2022-02-01/templatespecversions/id_builtintemplatespec.go @@ -32,11 +32,9 @@ func ParseBuiltInTemplateSpecID(input string) (*BuiltInTemplateSpecId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BuiltInTemplateSpecId{} - - if id.BuiltInTemplateSpecName, ok = parsed.Parsed["builtInTemplateSpecName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "builtInTemplateSpecName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseBuiltInTemplateSpecIDInsensitively(input string) (*BuiltInTemplateSpec return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BuiltInTemplateSpecId{} - - if id.BuiltInTemplateSpecName, ok = parsed.Parsed["builtInTemplateSpecName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "builtInTemplateSpecName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *BuiltInTemplateSpecId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BuiltInTemplateSpecName, ok = input.Parsed["builtInTemplateSpecName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "builtInTemplateSpecName", input) + } + + return nil +} + // ValidateBuiltInTemplateSpecID checks that 'input' can be parsed as a Built In Template Spec ID func ValidateBuiltInTemplateSpecID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/resources/2022-02-01/templatespecversions/id_templatespec.go b/resource-manager/resources/2022-02-01/templatespecversions/id_templatespec.go index 3a93eb9eb3a..c469944dcbc 100644 --- a/resource-manager/resources/2022-02-01/templatespecversions/id_templatespec.go +++ b/resource-manager/resources/2022-02-01/templatespecversions/id_templatespec.go @@ -36,19 +36,9 @@ func ParseTemplateSpecID(input string) (*TemplateSpecId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TemplateSpecId{} - - 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.TemplateSpecName, ok = parsed.Parsed["templateSpecName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "templateSpecName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseTemplateSpecIDInsensitively(input string) (*TemplateSpecId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TemplateSpecId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *TemplateSpecId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.TemplateSpecName, ok = parsed.Parsed["templateSpecName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "templateSpecName", *parsed) + if id.TemplateSpecName, ok = input.Parsed["templateSpecName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "templateSpecName", input) } - return &id, nil + return nil } // ValidateTemplateSpecID checks that 'input' can be parsed as a Template Spec ID diff --git a/resource-manager/resources/2022-02-01/templatespecversions/id_templatespecversion.go b/resource-manager/resources/2022-02-01/templatespecversions/id_templatespecversion.go index 5fb30a5f89c..31aeae60af2 100644 --- a/resource-manager/resources/2022-02-01/templatespecversions/id_templatespecversion.go +++ b/resource-manager/resources/2022-02-01/templatespecversions/id_templatespecversion.go @@ -38,23 +38,9 @@ func ParseTemplateSpecVersionID(input string) (*TemplateSpecVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TemplateSpecVersionId{} - - 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.TemplateSpecName, ok = parsed.Parsed["templateSpecName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "templateSpecName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTemplateSpecVersionIDInsensitively(input string) (*TemplateSpecVersion return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TemplateSpecVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TemplateSpecVersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.TemplateSpecName, ok = parsed.Parsed["templateSpecName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "templateSpecName", *parsed) + if id.TemplateSpecName, ok = input.Parsed["templateSpecName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "templateSpecName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateTemplateSpecVersionID checks that 'input' can be parsed as a Template Spec Version ID diff --git a/resource-manager/resources/2022-02-01/templatespecversions/id_version.go b/resource-manager/resources/2022-02-01/templatespecversions/id_version.go index 64b6b101dcc..31d2b8426fa 100644 --- a/resource-manager/resources/2022-02-01/templatespecversions/id_version.go +++ b/resource-manager/resources/2022-02-01/templatespecversions/id_version.go @@ -34,15 +34,9 @@ func ParseVersionID(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} - - if id.BuiltInTemplateSpecName, ok = parsed.Parsed["builtInTemplateSpecName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "builtInTemplateSpecName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseVersionIDInsensitively(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.BuiltInTemplateSpecName, ok = parsed.Parsed["builtInTemplateSpecName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "builtInTemplateSpecName", *parsed) + return &id, nil +} + +func (id *VersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BuiltInTemplateSpecName, ok = input.Parsed["builtInTemplateSpecName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "builtInTemplateSpecName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateVersionID checks that 'input' can be parsed as a Version ID diff --git a/resource-manager/resources/2022-06-01/policyassignments/id_policyassignmentid.go b/resource-manager/resources/2022-06-01/policyassignments/id_policyassignmentid.go index 08be41779d3..ff9fc39e80c 100644 --- a/resource-manager/resources/2022-06-01/policyassignments/id_policyassignmentid.go +++ b/resource-manager/resources/2022-06-01/policyassignments/id_policyassignmentid.go @@ -32,11 +32,9 @@ func ParsePolicyAssignmentIdID(input string) (*PolicyAssignmentIdId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PolicyAssignmentIdId{} - - if id.PolicyAssignmentId, ok = parsed.Parsed["policyAssignmentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policyAssignmentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParsePolicyAssignmentIdIDInsensitively(input string) (*PolicyAssignmentIdId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PolicyAssignmentIdId{} - - if id.PolicyAssignmentId, ok = parsed.Parsed["policyAssignmentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policyAssignmentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *PolicyAssignmentIdId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.PolicyAssignmentId, ok = input.Parsed["policyAssignmentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "policyAssignmentId", input) + } + + return nil +} + // ValidatePolicyAssignmentIdID checks that 'input' can be parsed as a Policy Assignment Id ID func ValidatePolicyAssignmentIdID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/resources/2022-06-01/policyassignments/id_scopedpolicyassignment.go b/resource-manager/resources/2022-06-01/policyassignments/id_scopedpolicyassignment.go index 3f3e0c84500..da25eae20dd 100644 --- a/resource-manager/resources/2022-06-01/policyassignments/id_scopedpolicyassignment.go +++ b/resource-manager/resources/2022-06-01/policyassignments/id_scopedpolicyassignment.go @@ -34,15 +34,9 @@ func ParseScopedPolicyAssignmentID(input string) (*ScopedPolicyAssignmentId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedPolicyAssignmentId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.PolicyAssignmentName, ok = parsed.Parsed["policyAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policyAssignmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedPolicyAssignmentIDInsensitively(input string) (*ScopedPolicyAssi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedPolicyAssignmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedPolicyAssignmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.PolicyAssignmentName, ok = parsed.Parsed["policyAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policyAssignmentName", *parsed) + if id.PolicyAssignmentName, ok = input.Parsed["policyAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "policyAssignmentName", input) } - return &id, nil + return nil } // ValidateScopedPolicyAssignmentID checks that 'input' can be parsed as a Scoped Policy Assignment ID diff --git a/resource-manager/resources/2022-07-01-preview/policyexemptions/id_scopedpolicyexemption.go b/resource-manager/resources/2022-07-01-preview/policyexemptions/id_scopedpolicyexemption.go index c7af1f3fcf3..8747e499353 100644 --- a/resource-manager/resources/2022-07-01-preview/policyexemptions/id_scopedpolicyexemption.go +++ b/resource-manager/resources/2022-07-01-preview/policyexemptions/id_scopedpolicyexemption.go @@ -34,15 +34,9 @@ func ParseScopedPolicyExemptionID(input string) (*ScopedPolicyExemptionId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedPolicyExemptionId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.PolicyExemptionName, ok = parsed.Parsed["policyExemptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policyExemptionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedPolicyExemptionIDInsensitively(input string) (*ScopedPolicyExemp return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedPolicyExemptionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedPolicyExemptionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.PolicyExemptionName, ok = parsed.Parsed["policyExemptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policyExemptionName", *parsed) + if id.PolicyExemptionName, ok = input.Parsed["policyExemptionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "policyExemptionName", input) } - return &id, nil + return nil } // ValidateScopedPolicyExemptionID checks that 'input' can be parsed as a Scoped Policy Exemption ID diff --git a/resource-manager/resources/2022-09-01/deployments/id_deployment.go b/resource-manager/resources/2022-09-01/deployments/id_deployment.go index 1b8ac9a0b7f..50d8ea2338d 100644 --- a/resource-manager/resources/2022-09-01/deployments/id_deployment.go +++ b/resource-manager/resources/2022-09-01/deployments/id_deployment.go @@ -32,11 +32,9 @@ func ParseDeploymentID(input string) (*DeploymentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeploymentId{} - - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseDeploymentIDInsensitively(input string) (*DeploymentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeploymentId{} - - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *DeploymentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.DeploymentName, ok = input.Parsed["deploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", input) + } + + return nil +} + // ValidateDeploymentID checks that 'input' can be parsed as a Deployment ID func ValidateDeploymentID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/resources/2022-09-01/deployments/id_providerdeployment.go b/resource-manager/resources/2022-09-01/deployments/id_providerdeployment.go index 4bc8c8177b7..6a836679087 100644 --- a/resource-manager/resources/2022-09-01/deployments/id_providerdeployment.go +++ b/resource-manager/resources/2022-09-01/deployments/id_providerdeployment.go @@ -34,15 +34,9 @@ func ParseProviderDeploymentID(input string) (*ProviderDeploymentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderDeploymentId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviderDeploymentIDInsensitively(input string) (*ProviderDeploymentId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderDeploymentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ProviderDeploymentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if id.DeploymentName, ok = input.Parsed["deploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", input) } - return &id, nil + return nil } // ValidateProviderDeploymentID checks that 'input' can be parsed as a Provider Deployment ID diff --git a/resource-manager/resources/2022-09-01/deployments/id_providers2deployment.go b/resource-manager/resources/2022-09-01/deployments/id_providers2deployment.go index 52265051c26..a75fc6f6268 100644 --- a/resource-manager/resources/2022-09-01/deployments/id_providers2deployment.go +++ b/resource-manager/resources/2022-09-01/deployments/id_providers2deployment.go @@ -34,15 +34,9 @@ func ParseProviders2DeploymentID(input string) (*Providers2DeploymentId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2DeploymentId{} - - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) - } - - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviders2DeploymentIDInsensitively(input string) (*Providers2Deployme return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2DeploymentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + return &id, nil +} + +func (id *Providers2DeploymentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.GroupId, ok = input.Parsed["groupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "groupId", input) } - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if id.DeploymentName, ok = input.Parsed["deploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", input) } - return &id, nil + return nil } // ValidateProviders2DeploymentID checks that 'input' can be parsed as a Providers 2 Deployment ID diff --git a/resource-manager/resources/2022-09-01/deployments/id_resourcegroupproviderdeployment.go b/resource-manager/resources/2022-09-01/deployments/id_resourcegroupproviderdeployment.go index 6e631c2aab4..8f17c3193b2 100644 --- a/resource-manager/resources/2022-09-01/deployments/id_resourcegroupproviderdeployment.go +++ b/resource-manager/resources/2022-09-01/deployments/id_resourcegroupproviderdeployment.go @@ -36,19 +36,9 @@ func ParseResourceGroupProviderDeploymentID(input string) (*ResourceGroupProvide return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResourceGroupProviderDeploymentId{} - - 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.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseResourceGroupProviderDeploymentIDInsensitively(input string) (*Resourc return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResourceGroupProviderDeploymentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ResourceGroupProviderDeploymentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if id.DeploymentName, ok = input.Parsed["deploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", input) } - return &id, nil + return nil } // ValidateResourceGroupProviderDeploymentID checks that 'input' can be parsed as a Resource Group Provider Deployment ID diff --git a/resource-manager/resources/2022-09-01/deployments/id_scopeddeployment.go b/resource-manager/resources/2022-09-01/deployments/id_scopeddeployment.go index 88c1e0fa504..ef514418e15 100644 --- a/resource-manager/resources/2022-09-01/deployments/id_scopeddeployment.go +++ b/resource-manager/resources/2022-09-01/deployments/id_scopeddeployment.go @@ -34,15 +34,9 @@ func ParseScopedDeploymentID(input string) (*ScopedDeploymentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedDeploymentId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedDeploymentIDInsensitively(input string) (*ScopedDeploymentId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedDeploymentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedDeploymentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if id.DeploymentName, ok = input.Parsed["deploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", input) } - return &id, nil + return nil } // ValidateScopedDeploymentID checks that 'input' can be parsed as a Scoped Deployment ID diff --git a/resource-manager/resources/2022-09-01/providers/id_provider.go b/resource-manager/resources/2022-09-01/providers/id_provider.go index 07ca7ca6019..0b86127bf7b 100644 --- a/resource-manager/resources/2022-09-01/providers/id_provider.go +++ b/resource-manager/resources/2022-09-01/providers/id_provider.go @@ -32,11 +32,9 @@ func ParseProviderID(input string) (*ProviderId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderId{} - - if id.ProviderName, ok = parsed.Parsed["providerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "providerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseProviderIDInsensitively(input string) (*ProviderId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderId{} - - if id.ProviderName, ok = parsed.Parsed["providerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "providerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *ProviderId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ProviderName, ok = input.Parsed["providerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "providerName", input) + } + + return nil +} + // ValidateProviderID checks that 'input' can be parsed as a Provider ID func ValidateProviderID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/resources/2022-09-01/providers/id_providers2.go b/resource-manager/resources/2022-09-01/providers/id_providers2.go index 58c356b00ef..af2005474ea 100644 --- a/resource-manager/resources/2022-09-01/providers/id_providers2.go +++ b/resource-manager/resources/2022-09-01/providers/id_providers2.go @@ -34,15 +34,9 @@ func ParseProviders2ID(input string) (*Providers2Id, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2Id{} - - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) - } - - if id.ProviderName, ok = parsed.Parsed["providerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "providerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviders2IDInsensitively(input string) (*Providers2Id, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2Id{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + return &id, nil +} + +func (id *Providers2Id) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.GroupId, ok = input.Parsed["groupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "groupId", input) } - if id.ProviderName, ok = parsed.Parsed["providerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "providerName", *parsed) + if id.ProviderName, ok = input.Parsed["providerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "providerName", input) } - return &id, nil + return nil } // ValidateProviders2ID checks that 'input' can be parsed as a Providers 2 ID diff --git a/resource-manager/resources/2022-09-01/providers/id_subscriptionprovider.go b/resource-manager/resources/2022-09-01/providers/id_subscriptionprovider.go index 17226acbe6e..6a3dfa8cc74 100644 --- a/resource-manager/resources/2022-09-01/providers/id_subscriptionprovider.go +++ b/resource-manager/resources/2022-09-01/providers/id_subscriptionprovider.go @@ -34,15 +34,9 @@ func ParseSubscriptionProviderID(input string) (*SubscriptionProviderId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SubscriptionProviderId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.ProviderName, ok = parsed.Parsed["providerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "providerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseSubscriptionProviderIDInsensitively(input string) (*SubscriptionProvid return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SubscriptionProviderId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SubscriptionProviderId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ProviderName, ok = parsed.Parsed["providerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "providerName", *parsed) + if id.ProviderName, ok = input.Parsed["providerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "providerName", input) } - return &id, nil + return nil } // ValidateSubscriptionProviderID checks that 'input' can be parsed as a Subscription Provider ID diff --git a/resource-manager/resources/2023-04-01/policyassignments/id_policyassignmentid.go b/resource-manager/resources/2023-04-01/policyassignments/id_policyassignmentid.go index 08be41779d3..ff9fc39e80c 100644 --- a/resource-manager/resources/2023-04-01/policyassignments/id_policyassignmentid.go +++ b/resource-manager/resources/2023-04-01/policyassignments/id_policyassignmentid.go @@ -32,11 +32,9 @@ func ParsePolicyAssignmentIdID(input string) (*PolicyAssignmentIdId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PolicyAssignmentIdId{} - - if id.PolicyAssignmentId, ok = parsed.Parsed["policyAssignmentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policyAssignmentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParsePolicyAssignmentIdIDInsensitively(input string) (*PolicyAssignmentIdId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PolicyAssignmentIdId{} - - if id.PolicyAssignmentId, ok = parsed.Parsed["policyAssignmentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policyAssignmentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *PolicyAssignmentIdId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.PolicyAssignmentId, ok = input.Parsed["policyAssignmentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "policyAssignmentId", input) + } + + return nil +} + // ValidatePolicyAssignmentIdID checks that 'input' can be parsed as a Policy Assignment Id ID func ValidatePolicyAssignmentIdID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/resources/2023-04-01/policyassignments/id_scopedpolicyassignment.go b/resource-manager/resources/2023-04-01/policyassignments/id_scopedpolicyassignment.go index 3f3e0c84500..da25eae20dd 100644 --- a/resource-manager/resources/2023-04-01/policyassignments/id_scopedpolicyassignment.go +++ b/resource-manager/resources/2023-04-01/policyassignments/id_scopedpolicyassignment.go @@ -34,15 +34,9 @@ func ParseScopedPolicyAssignmentID(input string) (*ScopedPolicyAssignmentId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedPolicyAssignmentId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.PolicyAssignmentName, ok = parsed.Parsed["policyAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policyAssignmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedPolicyAssignmentIDInsensitively(input string) (*ScopedPolicyAssi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedPolicyAssignmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedPolicyAssignmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.PolicyAssignmentName, ok = parsed.Parsed["policyAssignmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policyAssignmentName", *parsed) + if id.PolicyAssignmentName, ok = input.Parsed["policyAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "policyAssignmentName", input) } - return &id, nil + return nil } // ValidateScopedPolicyAssignmentID checks that 'input' can be parsed as a Scoped Policy Assignment ID diff --git a/resource-manager/resources/2023-04-01/policydefinitions/id_policydefinition.go b/resource-manager/resources/2023-04-01/policydefinitions/id_policydefinition.go index 8cfbb2005d7..7c9ace6a986 100644 --- a/resource-manager/resources/2023-04-01/policydefinitions/id_policydefinition.go +++ b/resource-manager/resources/2023-04-01/policydefinitions/id_policydefinition.go @@ -32,11 +32,9 @@ func ParsePolicyDefinitionID(input string) (*PolicyDefinitionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PolicyDefinitionId{} - - if id.PolicyDefinitionName, ok = parsed.Parsed["policyDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policyDefinitionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParsePolicyDefinitionIDInsensitively(input string) (*PolicyDefinitionId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PolicyDefinitionId{} - - if id.PolicyDefinitionName, ok = parsed.Parsed["policyDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policyDefinitionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *PolicyDefinitionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.PolicyDefinitionName, ok = input.Parsed["policyDefinitionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "policyDefinitionName", input) + } + + return nil +} + // ValidatePolicyDefinitionID checks that 'input' can be parsed as a Policy Definition ID func ValidatePolicyDefinitionID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/resources/2023-04-01/policydefinitions/id_providerpolicydefinition.go b/resource-manager/resources/2023-04-01/policydefinitions/id_providerpolicydefinition.go index 0284ff567c0..5d94222e677 100644 --- a/resource-manager/resources/2023-04-01/policydefinitions/id_providerpolicydefinition.go +++ b/resource-manager/resources/2023-04-01/policydefinitions/id_providerpolicydefinition.go @@ -34,15 +34,9 @@ func ParseProviderPolicyDefinitionID(input string) (*ProviderPolicyDefinitionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderPolicyDefinitionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.PolicyDefinitionName, ok = parsed.Parsed["policyDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policyDefinitionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviderPolicyDefinitionIDInsensitively(input string) (*ProviderPolicy return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderPolicyDefinitionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ProviderPolicyDefinitionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.PolicyDefinitionName, ok = parsed.Parsed["policyDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policyDefinitionName", *parsed) + if id.PolicyDefinitionName, ok = input.Parsed["policyDefinitionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "policyDefinitionName", input) } - return &id, nil + return nil } // ValidateProviderPolicyDefinitionID checks that 'input' can be parsed as a Provider Policy Definition ID diff --git a/resource-manager/resources/2023-04-01/policydefinitions/id_providers2policydefinition.go b/resource-manager/resources/2023-04-01/policydefinitions/id_providers2policydefinition.go index d7297fbd762..2c4f8da45f9 100644 --- a/resource-manager/resources/2023-04-01/policydefinitions/id_providers2policydefinition.go +++ b/resource-manager/resources/2023-04-01/policydefinitions/id_providers2policydefinition.go @@ -34,15 +34,9 @@ func ParseProviders2PolicyDefinitionID(input string) (*Providers2PolicyDefinitio return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2PolicyDefinitionId{} - - if id.ManagementGroupName, ok = parsed.Parsed["managementGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managementGroupName", *parsed) - } - - if id.PolicyDefinitionName, ok = parsed.Parsed["policyDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policyDefinitionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviders2PolicyDefinitionIDInsensitively(input string) (*Providers2Po return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2PolicyDefinitionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ManagementGroupName, ok = parsed.Parsed["managementGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managementGroupName", *parsed) + return &id, nil +} + +func (id *Providers2PolicyDefinitionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ManagementGroupName, ok = input.Parsed["managementGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managementGroupName", input) } - if id.PolicyDefinitionName, ok = parsed.Parsed["policyDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policyDefinitionName", *parsed) + if id.PolicyDefinitionName, ok = input.Parsed["policyDefinitionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "policyDefinitionName", input) } - return &id, nil + return nil } // ValidateProviders2PolicyDefinitionID checks that 'input' can be parsed as a Providers 2 Policy Definition ID diff --git a/resource-manager/resources/2023-04-01/policydefinitionversions/id_policydefinition.go b/resource-manager/resources/2023-04-01/policydefinitionversions/id_policydefinition.go index f715cd19674..3adfa42e6e1 100644 --- a/resource-manager/resources/2023-04-01/policydefinitionversions/id_policydefinition.go +++ b/resource-manager/resources/2023-04-01/policydefinitionversions/id_policydefinition.go @@ -32,11 +32,9 @@ func ParsePolicyDefinitionID(input string) (*PolicyDefinitionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PolicyDefinitionId{} - - if id.PolicyDefinitionName, ok = parsed.Parsed["policyDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policyDefinitionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParsePolicyDefinitionIDInsensitively(input string) (*PolicyDefinitionId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PolicyDefinitionId{} - - if id.PolicyDefinitionName, ok = parsed.Parsed["policyDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policyDefinitionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *PolicyDefinitionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.PolicyDefinitionName, ok = input.Parsed["policyDefinitionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "policyDefinitionName", input) + } + + return nil +} + // ValidatePolicyDefinitionID checks that 'input' can be parsed as a Policy Definition ID func ValidatePolicyDefinitionID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/resources/2023-04-01/policydefinitionversions/id_policydefinitionversion.go b/resource-manager/resources/2023-04-01/policydefinitionversions/id_policydefinitionversion.go index 2e31ef6b22d..c28312a885e 100644 --- a/resource-manager/resources/2023-04-01/policydefinitionversions/id_policydefinitionversion.go +++ b/resource-manager/resources/2023-04-01/policydefinitionversions/id_policydefinitionversion.go @@ -36,19 +36,9 @@ func ParsePolicyDefinitionVersionID(input string) (*PolicyDefinitionVersionId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PolicyDefinitionVersionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.PolicyDefinitionName, ok = parsed.Parsed["policyDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policyDefinitionName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePolicyDefinitionVersionIDInsensitively(input string) (*PolicyDefinitio return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PolicyDefinitionVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PolicyDefinitionVersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.PolicyDefinitionName, ok = parsed.Parsed["policyDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policyDefinitionName", *parsed) + if id.PolicyDefinitionName, ok = input.Parsed["policyDefinitionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "policyDefinitionName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidatePolicyDefinitionVersionID checks that 'input' can be parsed as a Policy Definition Version ID diff --git a/resource-manager/resources/2023-04-01/policydefinitionversions/id_providerpolicydefinition.go b/resource-manager/resources/2023-04-01/policydefinitionversions/id_providerpolicydefinition.go index 653cc45662d..bb5206a0ad2 100644 --- a/resource-manager/resources/2023-04-01/policydefinitionversions/id_providerpolicydefinition.go +++ b/resource-manager/resources/2023-04-01/policydefinitionversions/id_providerpolicydefinition.go @@ -34,15 +34,9 @@ func ParseProviderPolicyDefinitionID(input string) (*ProviderPolicyDefinitionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderPolicyDefinitionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.PolicyDefinitionName, ok = parsed.Parsed["policyDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policyDefinitionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviderPolicyDefinitionIDInsensitively(input string) (*ProviderPolicy return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderPolicyDefinitionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ProviderPolicyDefinitionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.PolicyDefinitionName, ok = parsed.Parsed["policyDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policyDefinitionName", *parsed) + if id.PolicyDefinitionName, ok = input.Parsed["policyDefinitionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "policyDefinitionName", input) } - return &id, nil + return nil } // ValidateProviderPolicyDefinitionID checks that 'input' can be parsed as a Provider Policy Definition ID diff --git a/resource-manager/resources/2023-04-01/policydefinitionversions/id_providers2policydefinition.go b/resource-manager/resources/2023-04-01/policydefinitionversions/id_providers2policydefinition.go index 8fc74baf398..f65d07433e2 100644 --- a/resource-manager/resources/2023-04-01/policydefinitionversions/id_providers2policydefinition.go +++ b/resource-manager/resources/2023-04-01/policydefinitionversions/id_providers2policydefinition.go @@ -34,15 +34,9 @@ func ParseProviders2PolicyDefinitionID(input string) (*Providers2PolicyDefinitio return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2PolicyDefinitionId{} - - if id.ManagementGroupName, ok = parsed.Parsed["managementGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managementGroupName", *parsed) - } - - if id.PolicyDefinitionName, ok = parsed.Parsed["policyDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policyDefinitionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviders2PolicyDefinitionIDInsensitively(input string) (*Providers2Po return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2PolicyDefinitionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ManagementGroupName, ok = parsed.Parsed["managementGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managementGroupName", *parsed) + return &id, nil +} + +func (id *Providers2PolicyDefinitionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ManagementGroupName, ok = input.Parsed["managementGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managementGroupName", input) } - if id.PolicyDefinitionName, ok = parsed.Parsed["policyDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policyDefinitionName", *parsed) + if id.PolicyDefinitionName, ok = input.Parsed["policyDefinitionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "policyDefinitionName", input) } - return &id, nil + return nil } // ValidateProviders2PolicyDefinitionID checks that 'input' can be parsed as a Providers 2 Policy Definition ID diff --git a/resource-manager/resources/2023-04-01/policydefinitionversions/id_providers2policydefinitionversion.go b/resource-manager/resources/2023-04-01/policydefinitionversions/id_providers2policydefinitionversion.go index 1cf553f9b43..89a5e9d7dfc 100644 --- a/resource-manager/resources/2023-04-01/policydefinitionversions/id_providers2policydefinitionversion.go +++ b/resource-manager/resources/2023-04-01/policydefinitionversions/id_providers2policydefinitionversion.go @@ -36,19 +36,9 @@ func ParseProviders2PolicyDefinitionVersionID(input string) (*Providers2PolicyDe return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2PolicyDefinitionVersionId{} - - if id.ManagementGroupName, ok = parsed.Parsed["managementGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managementGroupName", *parsed) - } - - if id.PolicyDefinitionName, ok = parsed.Parsed["policyDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policyDefinitionName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviders2PolicyDefinitionVersionIDInsensitively(input string) (*Provi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2PolicyDefinitionVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.ManagementGroupName, ok = parsed.Parsed["managementGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managementGroupName", *parsed) +func (id *Providers2PolicyDefinitionVersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ManagementGroupName, ok = input.Parsed["managementGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managementGroupName", input) } - if id.PolicyDefinitionName, ok = parsed.Parsed["policyDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policyDefinitionName", *parsed) + if id.PolicyDefinitionName, ok = input.Parsed["policyDefinitionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "policyDefinitionName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateProviders2PolicyDefinitionVersionID checks that 'input' can be parsed as a Providers 2 Policy Definition Version ID diff --git a/resource-manager/resources/2023-04-01/policydefinitionversions/id_version.go b/resource-manager/resources/2023-04-01/policydefinitionversions/id_version.go index d1f0f5e1fb6..67af8ac1953 100644 --- a/resource-manager/resources/2023-04-01/policydefinitionversions/id_version.go +++ b/resource-manager/resources/2023-04-01/policydefinitionversions/id_version.go @@ -34,15 +34,9 @@ func ParseVersionID(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} - - if id.PolicyDefinitionName, ok = parsed.Parsed["policyDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policyDefinitionName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseVersionIDInsensitively(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.PolicyDefinitionName, ok = parsed.Parsed["policyDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policyDefinitionName", *parsed) + return &id, nil +} + +func (id *VersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.PolicyDefinitionName, ok = input.Parsed["policyDefinitionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "policyDefinitionName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateVersionID checks that 'input' can be parsed as a Version ID diff --git a/resource-manager/resources/2023-04-01/policysetdefinitions/id_policysetdefinition.go b/resource-manager/resources/2023-04-01/policysetdefinitions/id_policysetdefinition.go index 5e1cff6f7f2..b3e5d30c7fa 100644 --- a/resource-manager/resources/2023-04-01/policysetdefinitions/id_policysetdefinition.go +++ b/resource-manager/resources/2023-04-01/policysetdefinitions/id_policysetdefinition.go @@ -32,11 +32,9 @@ func ParsePolicySetDefinitionID(input string) (*PolicySetDefinitionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PolicySetDefinitionId{} - - if id.PolicySetDefinitionName, ok = parsed.Parsed["policySetDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policySetDefinitionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParsePolicySetDefinitionIDInsensitively(input string) (*PolicySetDefinition return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PolicySetDefinitionId{} - - if id.PolicySetDefinitionName, ok = parsed.Parsed["policySetDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policySetDefinitionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *PolicySetDefinitionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.PolicySetDefinitionName, ok = input.Parsed["policySetDefinitionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "policySetDefinitionName", input) + } + + return nil +} + // ValidatePolicySetDefinitionID checks that 'input' can be parsed as a Policy Set Definition ID func ValidatePolicySetDefinitionID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/resources/2023-04-01/policysetdefinitions/id_providerpolicysetdefinition.go b/resource-manager/resources/2023-04-01/policysetdefinitions/id_providerpolicysetdefinition.go index f1bfea9ad47..0ddfef3946a 100644 --- a/resource-manager/resources/2023-04-01/policysetdefinitions/id_providerpolicysetdefinition.go +++ b/resource-manager/resources/2023-04-01/policysetdefinitions/id_providerpolicysetdefinition.go @@ -34,15 +34,9 @@ func ParseProviderPolicySetDefinitionID(input string) (*ProviderPolicySetDefinit return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderPolicySetDefinitionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.PolicySetDefinitionName, ok = parsed.Parsed["policySetDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policySetDefinitionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviderPolicySetDefinitionIDInsensitively(input string) (*ProviderPol return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderPolicySetDefinitionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ProviderPolicySetDefinitionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.PolicySetDefinitionName, ok = parsed.Parsed["policySetDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policySetDefinitionName", *parsed) + if id.PolicySetDefinitionName, ok = input.Parsed["policySetDefinitionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "policySetDefinitionName", input) } - return &id, nil + return nil } // ValidateProviderPolicySetDefinitionID checks that 'input' can be parsed as a Provider Policy Set Definition ID diff --git a/resource-manager/resources/2023-04-01/policysetdefinitions/id_providers2policysetdefinition.go b/resource-manager/resources/2023-04-01/policysetdefinitions/id_providers2policysetdefinition.go index f21b50c80cf..5ba1dc336dc 100644 --- a/resource-manager/resources/2023-04-01/policysetdefinitions/id_providers2policysetdefinition.go +++ b/resource-manager/resources/2023-04-01/policysetdefinitions/id_providers2policysetdefinition.go @@ -34,15 +34,9 @@ func ParseProviders2PolicySetDefinitionID(input string) (*Providers2PolicySetDef return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2PolicySetDefinitionId{} - - if id.ManagementGroupName, ok = parsed.Parsed["managementGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managementGroupName", *parsed) - } - - if id.PolicySetDefinitionName, ok = parsed.Parsed["policySetDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policySetDefinitionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviders2PolicySetDefinitionIDInsensitively(input string) (*Providers return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2PolicySetDefinitionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ManagementGroupName, ok = parsed.Parsed["managementGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managementGroupName", *parsed) + return &id, nil +} + +func (id *Providers2PolicySetDefinitionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ManagementGroupName, ok = input.Parsed["managementGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managementGroupName", input) } - if id.PolicySetDefinitionName, ok = parsed.Parsed["policySetDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policySetDefinitionName", *parsed) + if id.PolicySetDefinitionName, ok = input.Parsed["policySetDefinitionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "policySetDefinitionName", input) } - return &id, nil + return nil } // ValidateProviders2PolicySetDefinitionID checks that 'input' can be parsed as a Providers 2 Policy Set Definition ID diff --git a/resource-manager/resources/2023-04-01/policysetdefinitionversions/id_policysetdefinition.go b/resource-manager/resources/2023-04-01/policysetdefinitionversions/id_policysetdefinition.go index 68740433874..f9a46998ce8 100644 --- a/resource-manager/resources/2023-04-01/policysetdefinitionversions/id_policysetdefinition.go +++ b/resource-manager/resources/2023-04-01/policysetdefinitionversions/id_policysetdefinition.go @@ -32,11 +32,9 @@ func ParsePolicySetDefinitionID(input string) (*PolicySetDefinitionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PolicySetDefinitionId{} - - if id.PolicySetDefinitionName, ok = parsed.Parsed["policySetDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policySetDefinitionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParsePolicySetDefinitionIDInsensitively(input string) (*PolicySetDefinition return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PolicySetDefinitionId{} - - if id.PolicySetDefinitionName, ok = parsed.Parsed["policySetDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policySetDefinitionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *PolicySetDefinitionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.PolicySetDefinitionName, ok = input.Parsed["policySetDefinitionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "policySetDefinitionName", input) + } + + return nil +} + // ValidatePolicySetDefinitionID checks that 'input' can be parsed as a Policy Set Definition ID func ValidatePolicySetDefinitionID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/resources/2023-04-01/policysetdefinitionversions/id_policysetdefinitionversion.go b/resource-manager/resources/2023-04-01/policysetdefinitionversions/id_policysetdefinitionversion.go index f817a52c86e..2d2827154da 100644 --- a/resource-manager/resources/2023-04-01/policysetdefinitionversions/id_policysetdefinitionversion.go +++ b/resource-manager/resources/2023-04-01/policysetdefinitionversions/id_policysetdefinitionversion.go @@ -34,15 +34,9 @@ func ParsePolicySetDefinitionVersionID(input string) (*PolicySetDefinitionVersio return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PolicySetDefinitionVersionId{} - - if id.PolicySetDefinitionName, ok = parsed.Parsed["policySetDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policySetDefinitionName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParsePolicySetDefinitionVersionIDInsensitively(input string) (*PolicySetDef return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PolicySetDefinitionVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.PolicySetDefinitionName, ok = parsed.Parsed["policySetDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policySetDefinitionName", *parsed) + return &id, nil +} + +func (id *PolicySetDefinitionVersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.PolicySetDefinitionName, ok = input.Parsed["policySetDefinitionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "policySetDefinitionName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidatePolicySetDefinitionVersionID checks that 'input' can be parsed as a Policy Set Definition Version ID diff --git a/resource-manager/resources/2023-04-01/policysetdefinitionversions/id_providerpolicysetdefinition.go b/resource-manager/resources/2023-04-01/policysetdefinitionversions/id_providerpolicysetdefinition.go index feaa5a28ff8..ca15a74917e 100644 --- a/resource-manager/resources/2023-04-01/policysetdefinitionversions/id_providerpolicysetdefinition.go +++ b/resource-manager/resources/2023-04-01/policysetdefinitionversions/id_providerpolicysetdefinition.go @@ -34,15 +34,9 @@ func ParseProviderPolicySetDefinitionID(input string) (*ProviderPolicySetDefinit return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderPolicySetDefinitionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.PolicySetDefinitionName, ok = parsed.Parsed["policySetDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policySetDefinitionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviderPolicySetDefinitionIDInsensitively(input string) (*ProviderPol return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderPolicySetDefinitionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ProviderPolicySetDefinitionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.PolicySetDefinitionName, ok = parsed.Parsed["policySetDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policySetDefinitionName", *parsed) + if id.PolicySetDefinitionName, ok = input.Parsed["policySetDefinitionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "policySetDefinitionName", input) } - return &id, nil + return nil } // ValidateProviderPolicySetDefinitionID checks that 'input' can be parsed as a Provider Policy Set Definition ID diff --git a/resource-manager/resources/2023-04-01/policysetdefinitionversions/id_providerpolicysetdefinitionversion.go b/resource-manager/resources/2023-04-01/policysetdefinitionversions/id_providerpolicysetdefinitionversion.go index a395c3bebe7..5f0ea10e795 100644 --- a/resource-manager/resources/2023-04-01/policysetdefinitionversions/id_providerpolicysetdefinitionversion.go +++ b/resource-manager/resources/2023-04-01/policysetdefinitionversions/id_providerpolicysetdefinitionversion.go @@ -36,19 +36,9 @@ func ParseProviderPolicySetDefinitionVersionID(input string) (*ProviderPolicySet return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderPolicySetDefinitionVersionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.PolicySetDefinitionName, ok = parsed.Parsed["policySetDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policySetDefinitionName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderPolicySetDefinitionVersionIDInsensitively(input string) (*Prov return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderPolicySetDefinitionVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderPolicySetDefinitionVersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.PolicySetDefinitionName, ok = parsed.Parsed["policySetDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policySetDefinitionName", *parsed) + if id.PolicySetDefinitionName, ok = input.Parsed["policySetDefinitionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "policySetDefinitionName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateProviderPolicySetDefinitionVersionID checks that 'input' can be parsed as a Provider Policy Set Definition Version ID diff --git a/resource-manager/resources/2023-04-01/policysetdefinitionversions/id_providers2policysetdefinition.go b/resource-manager/resources/2023-04-01/policysetdefinitionversions/id_providers2policysetdefinition.go index ea4019bd51f..b91bee7471c 100644 --- a/resource-manager/resources/2023-04-01/policysetdefinitionversions/id_providers2policysetdefinition.go +++ b/resource-manager/resources/2023-04-01/policysetdefinitionversions/id_providers2policysetdefinition.go @@ -34,15 +34,9 @@ func ParseProviders2PolicySetDefinitionID(input string) (*Providers2PolicySetDef return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2PolicySetDefinitionId{} - - if id.ManagementGroupName, ok = parsed.Parsed["managementGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managementGroupName", *parsed) - } - - if id.PolicySetDefinitionName, ok = parsed.Parsed["policySetDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policySetDefinitionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviders2PolicySetDefinitionIDInsensitively(input string) (*Providers return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2PolicySetDefinitionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ManagementGroupName, ok = parsed.Parsed["managementGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managementGroupName", *parsed) + return &id, nil +} + +func (id *Providers2PolicySetDefinitionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ManagementGroupName, ok = input.Parsed["managementGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managementGroupName", input) } - if id.PolicySetDefinitionName, ok = parsed.Parsed["policySetDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policySetDefinitionName", *parsed) + if id.PolicySetDefinitionName, ok = input.Parsed["policySetDefinitionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "policySetDefinitionName", input) } - return &id, nil + return nil } // ValidateProviders2PolicySetDefinitionID checks that 'input' can be parsed as a Providers 2 Policy Set Definition ID diff --git a/resource-manager/resources/2023-04-01/policysetdefinitionversions/id_providers2policysetdefinitionversion.go b/resource-manager/resources/2023-04-01/policysetdefinitionversions/id_providers2policysetdefinitionversion.go index b8e39e0f36c..b9ebfda68af 100644 --- a/resource-manager/resources/2023-04-01/policysetdefinitionversions/id_providers2policysetdefinitionversion.go +++ b/resource-manager/resources/2023-04-01/policysetdefinitionversions/id_providers2policysetdefinitionversion.go @@ -36,19 +36,9 @@ func ParseProviders2PolicySetDefinitionVersionID(input string) (*Providers2Polic return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2PolicySetDefinitionVersionId{} - - if id.ManagementGroupName, ok = parsed.Parsed["managementGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managementGroupName", *parsed) - } - - if id.PolicySetDefinitionName, ok = parsed.Parsed["policySetDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policySetDefinitionName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviders2PolicySetDefinitionVersionIDInsensitively(input string) (*Pr return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2PolicySetDefinitionVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.ManagementGroupName, ok = parsed.Parsed["managementGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managementGroupName", *parsed) +func (id *Providers2PolicySetDefinitionVersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ManagementGroupName, ok = input.Parsed["managementGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managementGroupName", input) } - if id.PolicySetDefinitionName, ok = parsed.Parsed["policySetDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "policySetDefinitionName", *parsed) + if id.PolicySetDefinitionName, ok = input.Parsed["policySetDefinitionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "policySetDefinitionName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateProviders2PolicySetDefinitionVersionID checks that 'input' can be parsed as a Providers 2 Policy Set Definition Version ID diff --git a/resource-manager/resources/2023-07-01/deployments/id_deployment.go b/resource-manager/resources/2023-07-01/deployments/id_deployment.go index 1b8ac9a0b7f..50d8ea2338d 100644 --- a/resource-manager/resources/2023-07-01/deployments/id_deployment.go +++ b/resource-manager/resources/2023-07-01/deployments/id_deployment.go @@ -32,11 +32,9 @@ func ParseDeploymentID(input string) (*DeploymentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeploymentId{} - - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseDeploymentIDInsensitively(input string) (*DeploymentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeploymentId{} - - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *DeploymentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.DeploymentName, ok = input.Parsed["deploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", input) + } + + return nil +} + // ValidateDeploymentID checks that 'input' can be parsed as a Deployment ID func ValidateDeploymentID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/resources/2023-07-01/deployments/id_providerdeployment.go b/resource-manager/resources/2023-07-01/deployments/id_providerdeployment.go index 4bc8c8177b7..6a836679087 100644 --- a/resource-manager/resources/2023-07-01/deployments/id_providerdeployment.go +++ b/resource-manager/resources/2023-07-01/deployments/id_providerdeployment.go @@ -34,15 +34,9 @@ func ParseProviderDeploymentID(input string) (*ProviderDeploymentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderDeploymentId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviderDeploymentIDInsensitively(input string) (*ProviderDeploymentId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderDeploymentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ProviderDeploymentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if id.DeploymentName, ok = input.Parsed["deploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", input) } - return &id, nil + return nil } // ValidateProviderDeploymentID checks that 'input' can be parsed as a Provider Deployment ID diff --git a/resource-manager/resources/2023-07-01/deployments/id_providers2deployment.go b/resource-manager/resources/2023-07-01/deployments/id_providers2deployment.go index 52265051c26..a75fc6f6268 100644 --- a/resource-manager/resources/2023-07-01/deployments/id_providers2deployment.go +++ b/resource-manager/resources/2023-07-01/deployments/id_providers2deployment.go @@ -34,15 +34,9 @@ func ParseProviders2DeploymentID(input string) (*Providers2DeploymentId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2DeploymentId{} - - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) - } - - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviders2DeploymentIDInsensitively(input string) (*Providers2Deployme return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2DeploymentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + return &id, nil +} + +func (id *Providers2DeploymentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.GroupId, ok = input.Parsed["groupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "groupId", input) } - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if id.DeploymentName, ok = input.Parsed["deploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", input) } - return &id, nil + return nil } // ValidateProviders2DeploymentID checks that 'input' can be parsed as a Providers 2 Deployment ID diff --git a/resource-manager/resources/2023-07-01/deployments/id_resourcegroupproviderdeployment.go b/resource-manager/resources/2023-07-01/deployments/id_resourcegroupproviderdeployment.go index 6e631c2aab4..8f17c3193b2 100644 --- a/resource-manager/resources/2023-07-01/deployments/id_resourcegroupproviderdeployment.go +++ b/resource-manager/resources/2023-07-01/deployments/id_resourcegroupproviderdeployment.go @@ -36,19 +36,9 @@ func ParseResourceGroupProviderDeploymentID(input string) (*ResourceGroupProvide return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResourceGroupProviderDeploymentId{} - - 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.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseResourceGroupProviderDeploymentIDInsensitively(input string) (*Resourc return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ResourceGroupProviderDeploymentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ResourceGroupProviderDeploymentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if id.DeploymentName, ok = input.Parsed["deploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", input) } - return &id, nil + return nil } // ValidateResourceGroupProviderDeploymentID checks that 'input' can be parsed as a Resource Group Provider Deployment ID diff --git a/resource-manager/resources/2023-07-01/deployments/id_scopeddeployment.go b/resource-manager/resources/2023-07-01/deployments/id_scopeddeployment.go index 88c1e0fa504..ef514418e15 100644 --- a/resource-manager/resources/2023-07-01/deployments/id_scopeddeployment.go +++ b/resource-manager/resources/2023-07-01/deployments/id_scopeddeployment.go @@ -34,15 +34,9 @@ func ParseScopedDeploymentID(input string) (*ScopedDeploymentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedDeploymentId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedDeploymentIDInsensitively(input string) (*ScopedDeploymentId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedDeploymentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedDeploymentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if id.DeploymentName, ok = input.Parsed["deploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", input) } - return &id, nil + return nil } // ValidateScopedDeploymentID checks that 'input' can be parsed as a Scoped Deployment ID diff --git a/resource-manager/resources/2023-07-01/providers/id_provider.go b/resource-manager/resources/2023-07-01/providers/id_provider.go index 07ca7ca6019..0b86127bf7b 100644 --- a/resource-manager/resources/2023-07-01/providers/id_provider.go +++ b/resource-manager/resources/2023-07-01/providers/id_provider.go @@ -32,11 +32,9 @@ func ParseProviderID(input string) (*ProviderId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderId{} - - if id.ProviderName, ok = parsed.Parsed["providerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "providerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseProviderIDInsensitively(input string) (*ProviderId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderId{} - - if id.ProviderName, ok = parsed.Parsed["providerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "providerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *ProviderId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ProviderName, ok = input.Parsed["providerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "providerName", input) + } + + return nil +} + // ValidateProviderID checks that 'input' can be parsed as a Provider ID func ValidateProviderID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/resources/2023-07-01/providers/id_providers2.go b/resource-manager/resources/2023-07-01/providers/id_providers2.go index 58c356b00ef..af2005474ea 100644 --- a/resource-manager/resources/2023-07-01/providers/id_providers2.go +++ b/resource-manager/resources/2023-07-01/providers/id_providers2.go @@ -34,15 +34,9 @@ func ParseProviders2ID(input string) (*Providers2Id, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2Id{} - - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) - } - - if id.ProviderName, ok = parsed.Parsed["providerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "providerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviders2IDInsensitively(input string) (*Providers2Id, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Providers2Id{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.GroupId, ok = parsed.Parsed["groupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "groupId", *parsed) + return &id, nil +} + +func (id *Providers2Id) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.GroupId, ok = input.Parsed["groupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "groupId", input) } - if id.ProviderName, ok = parsed.Parsed["providerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "providerName", *parsed) + if id.ProviderName, ok = input.Parsed["providerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "providerName", input) } - return &id, nil + return nil } // ValidateProviders2ID checks that 'input' can be parsed as a Providers 2 ID diff --git a/resource-manager/resources/2023-07-01/providers/id_subscriptionprovider.go b/resource-manager/resources/2023-07-01/providers/id_subscriptionprovider.go index 17226acbe6e..6a3dfa8cc74 100644 --- a/resource-manager/resources/2023-07-01/providers/id_subscriptionprovider.go +++ b/resource-manager/resources/2023-07-01/providers/id_subscriptionprovider.go @@ -34,15 +34,9 @@ func ParseSubscriptionProviderID(input string) (*SubscriptionProviderId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SubscriptionProviderId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.ProviderName, ok = parsed.Parsed["providerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "providerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseSubscriptionProviderIDInsensitively(input string) (*SubscriptionProvid return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SubscriptionProviderId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SubscriptionProviderId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ProviderName, ok = parsed.Parsed["providerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "providerName", *parsed) + if id.ProviderName, ok = input.Parsed["providerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "providerName", input) } - return &id, nil + return nil } // ValidateSubscriptionProviderID checks that 'input' can be parsed as a Subscription Provider ID diff --git a/resource-manager/resources/2023-08-01/deploymentscripts/id_deploymentscript.go b/resource-manager/resources/2023-08-01/deploymentscripts/id_deploymentscript.go index 984a05168d4..b687535330b 100644 --- a/resource-manager/resources/2023-08-01/deploymentscripts/id_deploymentscript.go +++ b/resource-manager/resources/2023-08-01/deploymentscripts/id_deploymentscript.go @@ -36,19 +36,9 @@ func ParseDeploymentScriptID(input string) (*DeploymentScriptId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeploymentScriptId{} - - 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.DeploymentScriptName, ok = parsed.Parsed["deploymentScriptName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentScriptName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDeploymentScriptIDInsensitively(input string) (*DeploymentScriptId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeploymentScriptId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DeploymentScriptId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DeploymentScriptName, ok = parsed.Parsed["deploymentScriptName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentScriptName", *parsed) + if id.DeploymentScriptName, ok = input.Parsed["deploymentScriptName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deploymentScriptName", input) } - return &id, nil + return nil } // ValidateDeploymentScriptID checks that 'input' can be parsed as a Deployment Script ID diff --git a/resource-manager/search/2022-09-01/adminkeys/id_keykind.go b/resource-manager/search/2022-09-01/adminkeys/id_keykind.go index f5d2c5335cd..b76846ebd53 100644 --- a/resource-manager/search/2022-09-01/adminkeys/id_keykind.go +++ b/resource-manager/search/2022-09-01/adminkeys/id_keykind.go @@ -38,31 +38,9 @@ func ParseKeyKindID(input string) (*KeyKindId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := KeyKindId{} - - 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.SearchServiceName, ok = parsed.Parsed["searchServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", *parsed) - } - - if v, ok := parsed.Parsed["keyKind"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyKind", *parsed) - } - - keyKind, err := parseAdminKeyKind(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.KeyKind = *keyKind + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -77,34 +55,42 @@ func ParseKeyKindIDInsensitively(input string) (*KeyKindId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := KeyKindId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *KeyKindId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SearchServiceName, ok = parsed.Parsed["searchServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", *parsed) + if id.SearchServiceName, ok = input.Parsed["searchServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", input) } - if v, ok := parsed.Parsed["keyKind"]; true { + if v, ok := input.Parsed["keyKind"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyKind", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "keyKind", input) } keyKind, err := parseAdminKeyKind(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.KeyKind = *keyKind } - return &id, nil + return nil } // ValidateKeyKindID checks that 'input' can be parsed as a Key Kind ID diff --git a/resource-manager/search/2022-09-01/adminkeys/id_searchservice.go b/resource-manager/search/2022-09-01/adminkeys/id_searchservice.go index c62719ecaa4..fa5b971e776 100644 --- a/resource-manager/search/2022-09-01/adminkeys/id_searchservice.go +++ b/resource-manager/search/2022-09-01/adminkeys/id_searchservice.go @@ -36,19 +36,9 @@ func ParseSearchServiceID(input string) (*SearchServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SearchServiceId{} - - 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.SearchServiceName, ok = parsed.Parsed["searchServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSearchServiceIDInsensitively(input string) (*SearchServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SearchServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SearchServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SearchServiceName, ok = parsed.Parsed["searchServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", *parsed) + if id.SearchServiceName, ok = input.Parsed["searchServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", input) } - return &id, nil + return nil } // ValidateSearchServiceID checks that 'input' can be parsed as a Search Service ID diff --git a/resource-manager/search/2022-09-01/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/search/2022-09-01/privateendpointconnections/id_privateendpointconnection.go index 578a3f3f66b..86b6788fc9b 100644 --- a/resource-manager/search/2022-09-01/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/search/2022-09-01/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.SearchServiceName, ok = parsed.Parsed["searchServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SearchServiceName, ok = parsed.Parsed["searchServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", *parsed) + if id.SearchServiceName, ok = input.Parsed["searchServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/search/2022-09-01/privateendpointconnections/id_searchservice.go b/resource-manager/search/2022-09-01/privateendpointconnections/id_searchservice.go index 74c2ece5eb1..63947a3b668 100644 --- a/resource-manager/search/2022-09-01/privateendpointconnections/id_searchservice.go +++ b/resource-manager/search/2022-09-01/privateendpointconnections/id_searchservice.go @@ -36,19 +36,9 @@ func ParseSearchServiceID(input string) (*SearchServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SearchServiceId{} - - 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.SearchServiceName, ok = parsed.Parsed["searchServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSearchServiceIDInsensitively(input string) (*SearchServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SearchServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SearchServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SearchServiceName, ok = parsed.Parsed["searchServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", *parsed) + if id.SearchServiceName, ok = input.Parsed["searchServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", input) } - return &id, nil + return nil } // ValidateSearchServiceID checks that 'input' can be parsed as a Search Service ID diff --git a/resource-manager/search/2022-09-01/privatelinkresources/id_searchservice.go b/resource-manager/search/2022-09-01/privatelinkresources/id_searchservice.go index 1990c99b516..59afe6078c5 100644 --- a/resource-manager/search/2022-09-01/privatelinkresources/id_searchservice.go +++ b/resource-manager/search/2022-09-01/privatelinkresources/id_searchservice.go @@ -36,19 +36,9 @@ func ParseSearchServiceID(input string) (*SearchServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SearchServiceId{} - - 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.SearchServiceName, ok = parsed.Parsed["searchServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSearchServiceIDInsensitively(input string) (*SearchServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SearchServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SearchServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SearchServiceName, ok = parsed.Parsed["searchServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", *parsed) + if id.SearchServiceName, ok = input.Parsed["searchServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", input) } - return &id, nil + return nil } // ValidateSearchServiceID checks that 'input' can be parsed as a Search Service ID diff --git a/resource-manager/search/2022-09-01/querykeys/id_createquerykey.go b/resource-manager/search/2022-09-01/querykeys/id_createquerykey.go index 5b47f8aad8c..5ee1bec0053 100644 --- a/resource-manager/search/2022-09-01/querykeys/id_createquerykey.go +++ b/resource-manager/search/2022-09-01/querykeys/id_createquerykey.go @@ -38,23 +38,9 @@ func ParseCreateQueryKeyID(input string) (*CreateQueryKeyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CreateQueryKeyId{} - - 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.SearchServiceName, ok = parsed.Parsed["searchServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", *parsed) - } - - if id.CreateQueryKeyName, ok = parsed.Parsed["createQueryKeyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "createQueryKeyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCreateQueryKeyIDInsensitively(input string) (*CreateQueryKeyId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CreateQueryKeyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CreateQueryKeyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SearchServiceName, ok = parsed.Parsed["searchServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", *parsed) + if id.SearchServiceName, ok = input.Parsed["searchServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", input) } - if id.CreateQueryKeyName, ok = parsed.Parsed["createQueryKeyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "createQueryKeyName", *parsed) + if id.CreateQueryKeyName, ok = input.Parsed["createQueryKeyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "createQueryKeyName", input) } - return &id, nil + return nil } // ValidateCreateQueryKeyID checks that 'input' can be parsed as a Create Query Key ID diff --git a/resource-manager/search/2022-09-01/querykeys/id_deletequerykey.go b/resource-manager/search/2022-09-01/querykeys/id_deletequerykey.go index cbd94213da6..080ddfd6d46 100644 --- a/resource-manager/search/2022-09-01/querykeys/id_deletequerykey.go +++ b/resource-manager/search/2022-09-01/querykeys/id_deletequerykey.go @@ -38,23 +38,9 @@ func ParseDeleteQueryKeyID(input string) (*DeleteQueryKeyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeleteQueryKeyId{} - - 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.SearchServiceName, ok = parsed.Parsed["searchServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", *parsed) - } - - if id.DeleteQueryKeyName, ok = parsed.Parsed["deleteQueryKeyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deleteQueryKeyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDeleteQueryKeyIDInsensitively(input string) (*DeleteQueryKeyId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeleteQueryKeyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DeleteQueryKeyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SearchServiceName, ok = parsed.Parsed["searchServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", *parsed) + if id.SearchServiceName, ok = input.Parsed["searchServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", input) } - if id.DeleteQueryKeyName, ok = parsed.Parsed["deleteQueryKeyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deleteQueryKeyName", *parsed) + if id.DeleteQueryKeyName, ok = input.Parsed["deleteQueryKeyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deleteQueryKeyName", input) } - return &id, nil + return nil } // ValidateDeleteQueryKeyID checks that 'input' can be parsed as a Delete Query Key ID diff --git a/resource-manager/search/2022-09-01/querykeys/id_searchservice.go b/resource-manager/search/2022-09-01/querykeys/id_searchservice.go index 20baa3be416..c37091c17ae 100644 --- a/resource-manager/search/2022-09-01/querykeys/id_searchservice.go +++ b/resource-manager/search/2022-09-01/querykeys/id_searchservice.go @@ -36,19 +36,9 @@ func ParseSearchServiceID(input string) (*SearchServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SearchServiceId{} - - 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.SearchServiceName, ok = parsed.Parsed["searchServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSearchServiceIDInsensitively(input string) (*SearchServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SearchServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SearchServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SearchServiceName, ok = parsed.Parsed["searchServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", *parsed) + if id.SearchServiceName, ok = input.Parsed["searchServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", input) } - return &id, nil + return nil } // ValidateSearchServiceID checks that 'input' can be parsed as a Search Service ID diff --git a/resource-manager/search/2022-09-01/services/id_searchservice.go b/resource-manager/search/2022-09-01/services/id_searchservice.go index 9b7242e2895..d54a4687b89 100644 --- a/resource-manager/search/2022-09-01/services/id_searchservice.go +++ b/resource-manager/search/2022-09-01/services/id_searchservice.go @@ -36,19 +36,9 @@ func ParseSearchServiceID(input string) (*SearchServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SearchServiceId{} - - 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.SearchServiceName, ok = parsed.Parsed["searchServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSearchServiceIDInsensitively(input string) (*SearchServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SearchServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SearchServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SearchServiceName, ok = parsed.Parsed["searchServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", *parsed) + if id.SearchServiceName, ok = input.Parsed["searchServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", input) } - return &id, nil + return nil } // ValidateSearchServiceID checks that 'input' can be parsed as a Search Service ID diff --git a/resource-manager/search/2022-09-01/sharedprivatelinkresources/id_searchservice.go b/resource-manager/search/2022-09-01/sharedprivatelinkresources/id_searchservice.go index c017137b659..e0610981524 100644 --- a/resource-manager/search/2022-09-01/sharedprivatelinkresources/id_searchservice.go +++ b/resource-manager/search/2022-09-01/sharedprivatelinkresources/id_searchservice.go @@ -36,19 +36,9 @@ func ParseSearchServiceID(input string) (*SearchServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SearchServiceId{} - - 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.SearchServiceName, ok = parsed.Parsed["searchServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSearchServiceIDInsensitively(input string) (*SearchServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SearchServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SearchServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SearchServiceName, ok = parsed.Parsed["searchServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", *parsed) + if id.SearchServiceName, ok = input.Parsed["searchServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", input) } - return &id, nil + return nil } // ValidateSearchServiceID checks that 'input' can be parsed as a Search Service ID diff --git a/resource-manager/search/2022-09-01/sharedprivatelinkresources/id_sharedprivatelinkresource.go b/resource-manager/search/2022-09-01/sharedprivatelinkresources/id_sharedprivatelinkresource.go index c2ea84a8c56..6b8edeb6164 100644 --- a/resource-manager/search/2022-09-01/sharedprivatelinkresources/id_sharedprivatelinkresource.go +++ b/resource-manager/search/2022-09-01/sharedprivatelinkresources/id_sharedprivatelinkresource.go @@ -38,23 +38,9 @@ func ParseSharedPrivateLinkResourceID(input string) (*SharedPrivateLinkResourceI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SharedPrivateLinkResourceId{} - - 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.SearchServiceName, ok = parsed.Parsed["searchServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", *parsed) - } - - if id.SharedPrivateLinkResourceName, ok = parsed.Parsed["sharedPrivateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sharedPrivateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSharedPrivateLinkResourceIDInsensitively(input string) (*SharedPrivate return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SharedPrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SharedPrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SearchServiceName, ok = parsed.Parsed["searchServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", *parsed) + if id.SearchServiceName, ok = input.Parsed["searchServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", input) } - if id.SharedPrivateLinkResourceName, ok = parsed.Parsed["sharedPrivateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sharedPrivateLinkResourceName", *parsed) + if id.SharedPrivateLinkResourceName, ok = input.Parsed["sharedPrivateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sharedPrivateLinkResourceName", input) } - return &id, nil + return nil } // ValidateSharedPrivateLinkResourceID checks that 'input' can be parsed as a Shared Private Link Resource ID diff --git a/resource-manager/search/2023-11-01/adminkeys/id_keykind.go b/resource-manager/search/2023-11-01/adminkeys/id_keykind.go index f5d2c5335cd..b76846ebd53 100644 --- a/resource-manager/search/2023-11-01/adminkeys/id_keykind.go +++ b/resource-manager/search/2023-11-01/adminkeys/id_keykind.go @@ -38,31 +38,9 @@ func ParseKeyKindID(input string) (*KeyKindId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := KeyKindId{} - - 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.SearchServiceName, ok = parsed.Parsed["searchServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", *parsed) - } - - if v, ok := parsed.Parsed["keyKind"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyKind", *parsed) - } - - keyKind, err := parseAdminKeyKind(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.KeyKind = *keyKind + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -77,34 +55,42 @@ func ParseKeyKindIDInsensitively(input string) (*KeyKindId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := KeyKindId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *KeyKindId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SearchServiceName, ok = parsed.Parsed["searchServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", *parsed) + if id.SearchServiceName, ok = input.Parsed["searchServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", input) } - if v, ok := parsed.Parsed["keyKind"]; true { + if v, ok := input.Parsed["keyKind"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyKind", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "keyKind", input) } keyKind, err := parseAdminKeyKind(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.KeyKind = *keyKind } - return &id, nil + return nil } // ValidateKeyKindID checks that 'input' can be parsed as a Key Kind ID diff --git a/resource-manager/search/2023-11-01/adminkeys/id_searchservice.go b/resource-manager/search/2023-11-01/adminkeys/id_searchservice.go index c62719ecaa4..fa5b971e776 100644 --- a/resource-manager/search/2023-11-01/adminkeys/id_searchservice.go +++ b/resource-manager/search/2023-11-01/adminkeys/id_searchservice.go @@ -36,19 +36,9 @@ func ParseSearchServiceID(input string) (*SearchServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SearchServiceId{} - - 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.SearchServiceName, ok = parsed.Parsed["searchServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSearchServiceIDInsensitively(input string) (*SearchServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SearchServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SearchServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SearchServiceName, ok = parsed.Parsed["searchServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", *parsed) + if id.SearchServiceName, ok = input.Parsed["searchServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", input) } - return &id, nil + return nil } // ValidateSearchServiceID checks that 'input' can be parsed as a Search Service ID diff --git a/resource-manager/search/2023-11-01/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/search/2023-11-01/privateendpointconnections/id_privateendpointconnection.go index 578a3f3f66b..86b6788fc9b 100644 --- a/resource-manager/search/2023-11-01/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/search/2023-11-01/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.SearchServiceName, ok = parsed.Parsed["searchServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SearchServiceName, ok = parsed.Parsed["searchServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", *parsed) + if id.SearchServiceName, ok = input.Parsed["searchServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/search/2023-11-01/privateendpointconnections/id_searchservice.go b/resource-manager/search/2023-11-01/privateendpointconnections/id_searchservice.go index 74c2ece5eb1..63947a3b668 100644 --- a/resource-manager/search/2023-11-01/privateendpointconnections/id_searchservice.go +++ b/resource-manager/search/2023-11-01/privateendpointconnections/id_searchservice.go @@ -36,19 +36,9 @@ func ParseSearchServiceID(input string) (*SearchServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SearchServiceId{} - - 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.SearchServiceName, ok = parsed.Parsed["searchServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSearchServiceIDInsensitively(input string) (*SearchServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SearchServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SearchServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SearchServiceName, ok = parsed.Parsed["searchServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", *parsed) + if id.SearchServiceName, ok = input.Parsed["searchServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", input) } - return &id, nil + return nil } // ValidateSearchServiceID checks that 'input' can be parsed as a Search Service ID diff --git a/resource-manager/search/2023-11-01/privatelinkresources/id_searchservice.go b/resource-manager/search/2023-11-01/privatelinkresources/id_searchservice.go index 1990c99b516..59afe6078c5 100644 --- a/resource-manager/search/2023-11-01/privatelinkresources/id_searchservice.go +++ b/resource-manager/search/2023-11-01/privatelinkresources/id_searchservice.go @@ -36,19 +36,9 @@ func ParseSearchServiceID(input string) (*SearchServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SearchServiceId{} - - 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.SearchServiceName, ok = parsed.Parsed["searchServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSearchServiceIDInsensitively(input string) (*SearchServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SearchServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SearchServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SearchServiceName, ok = parsed.Parsed["searchServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", *parsed) + if id.SearchServiceName, ok = input.Parsed["searchServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", input) } - return &id, nil + return nil } // ValidateSearchServiceID checks that 'input' can be parsed as a Search Service ID diff --git a/resource-manager/search/2023-11-01/querykeys/id_createquerykey.go b/resource-manager/search/2023-11-01/querykeys/id_createquerykey.go index 5b47f8aad8c..5ee1bec0053 100644 --- a/resource-manager/search/2023-11-01/querykeys/id_createquerykey.go +++ b/resource-manager/search/2023-11-01/querykeys/id_createquerykey.go @@ -38,23 +38,9 @@ func ParseCreateQueryKeyID(input string) (*CreateQueryKeyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CreateQueryKeyId{} - - 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.SearchServiceName, ok = parsed.Parsed["searchServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", *parsed) - } - - if id.CreateQueryKeyName, ok = parsed.Parsed["createQueryKeyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "createQueryKeyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCreateQueryKeyIDInsensitively(input string) (*CreateQueryKeyId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CreateQueryKeyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CreateQueryKeyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SearchServiceName, ok = parsed.Parsed["searchServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", *parsed) + if id.SearchServiceName, ok = input.Parsed["searchServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", input) } - if id.CreateQueryKeyName, ok = parsed.Parsed["createQueryKeyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "createQueryKeyName", *parsed) + if id.CreateQueryKeyName, ok = input.Parsed["createQueryKeyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "createQueryKeyName", input) } - return &id, nil + return nil } // ValidateCreateQueryKeyID checks that 'input' can be parsed as a Create Query Key ID diff --git a/resource-manager/search/2023-11-01/querykeys/id_deletequerykey.go b/resource-manager/search/2023-11-01/querykeys/id_deletequerykey.go index cbd94213da6..080ddfd6d46 100644 --- a/resource-manager/search/2023-11-01/querykeys/id_deletequerykey.go +++ b/resource-manager/search/2023-11-01/querykeys/id_deletequerykey.go @@ -38,23 +38,9 @@ func ParseDeleteQueryKeyID(input string) (*DeleteQueryKeyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeleteQueryKeyId{} - - 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.SearchServiceName, ok = parsed.Parsed["searchServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", *parsed) - } - - if id.DeleteQueryKeyName, ok = parsed.Parsed["deleteQueryKeyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deleteQueryKeyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDeleteQueryKeyIDInsensitively(input string) (*DeleteQueryKeyId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeleteQueryKeyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DeleteQueryKeyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SearchServiceName, ok = parsed.Parsed["searchServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", *parsed) + if id.SearchServiceName, ok = input.Parsed["searchServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", input) } - if id.DeleteQueryKeyName, ok = parsed.Parsed["deleteQueryKeyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deleteQueryKeyName", *parsed) + if id.DeleteQueryKeyName, ok = input.Parsed["deleteQueryKeyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deleteQueryKeyName", input) } - return &id, nil + return nil } // ValidateDeleteQueryKeyID checks that 'input' can be parsed as a Delete Query Key ID diff --git a/resource-manager/search/2023-11-01/querykeys/id_searchservice.go b/resource-manager/search/2023-11-01/querykeys/id_searchservice.go index 20baa3be416..c37091c17ae 100644 --- a/resource-manager/search/2023-11-01/querykeys/id_searchservice.go +++ b/resource-manager/search/2023-11-01/querykeys/id_searchservice.go @@ -36,19 +36,9 @@ func ParseSearchServiceID(input string) (*SearchServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SearchServiceId{} - - 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.SearchServiceName, ok = parsed.Parsed["searchServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSearchServiceIDInsensitively(input string) (*SearchServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SearchServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SearchServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SearchServiceName, ok = parsed.Parsed["searchServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", *parsed) + if id.SearchServiceName, ok = input.Parsed["searchServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", input) } - return &id, nil + return nil } // ValidateSearchServiceID checks that 'input' can be parsed as a Search Service ID diff --git a/resource-manager/search/2023-11-01/services/id_searchservice.go b/resource-manager/search/2023-11-01/services/id_searchservice.go index 9b7242e2895..d54a4687b89 100644 --- a/resource-manager/search/2023-11-01/services/id_searchservice.go +++ b/resource-manager/search/2023-11-01/services/id_searchservice.go @@ -36,19 +36,9 @@ func ParseSearchServiceID(input string) (*SearchServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SearchServiceId{} - - 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.SearchServiceName, ok = parsed.Parsed["searchServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSearchServiceIDInsensitively(input string) (*SearchServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SearchServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SearchServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SearchServiceName, ok = parsed.Parsed["searchServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", *parsed) + if id.SearchServiceName, ok = input.Parsed["searchServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", input) } - return &id, nil + return nil } // ValidateSearchServiceID checks that 'input' can be parsed as a Search Service ID diff --git a/resource-manager/search/2023-11-01/sharedprivatelinkresources/id_searchservice.go b/resource-manager/search/2023-11-01/sharedprivatelinkresources/id_searchservice.go index c017137b659..e0610981524 100644 --- a/resource-manager/search/2023-11-01/sharedprivatelinkresources/id_searchservice.go +++ b/resource-manager/search/2023-11-01/sharedprivatelinkresources/id_searchservice.go @@ -36,19 +36,9 @@ func ParseSearchServiceID(input string) (*SearchServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SearchServiceId{} - - 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.SearchServiceName, ok = parsed.Parsed["searchServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSearchServiceIDInsensitively(input string) (*SearchServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SearchServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SearchServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SearchServiceName, ok = parsed.Parsed["searchServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", *parsed) + if id.SearchServiceName, ok = input.Parsed["searchServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", input) } - return &id, nil + return nil } // ValidateSearchServiceID checks that 'input' can be parsed as a Search Service ID diff --git a/resource-manager/search/2023-11-01/sharedprivatelinkresources/id_sharedprivatelinkresource.go b/resource-manager/search/2023-11-01/sharedprivatelinkresources/id_sharedprivatelinkresource.go index c2ea84a8c56..6b8edeb6164 100644 --- a/resource-manager/search/2023-11-01/sharedprivatelinkresources/id_sharedprivatelinkresource.go +++ b/resource-manager/search/2023-11-01/sharedprivatelinkresources/id_sharedprivatelinkresource.go @@ -38,23 +38,9 @@ func ParseSharedPrivateLinkResourceID(input string) (*SharedPrivateLinkResourceI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SharedPrivateLinkResourceId{} - - 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.SearchServiceName, ok = parsed.Parsed["searchServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", *parsed) - } - - if id.SharedPrivateLinkResourceName, ok = parsed.Parsed["sharedPrivateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sharedPrivateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSharedPrivateLinkResourceIDInsensitively(input string) (*SharedPrivate return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SharedPrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SharedPrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SearchServiceName, ok = parsed.Parsed["searchServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", *parsed) + if id.SearchServiceName, ok = input.Parsed["searchServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "searchServiceName", input) } - if id.SharedPrivateLinkResourceName, ok = parsed.Parsed["sharedPrivateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sharedPrivateLinkResourceName", *parsed) + if id.SharedPrivateLinkResourceName, ok = input.Parsed["sharedPrivateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sharedPrivateLinkResourceName", input) } - return &id, nil + return nil } // ValidateSharedPrivateLinkResourceID checks that 'input' can be parsed as a Shared Private Link Resource ID diff --git a/resource-manager/search/2023-11-01/usages/id_location.go b/resource-manager/search/2023-11-01/usages/id_location.go index 23745f2edf8..5db07669363 100644 --- a/resource-manager/search/2023-11-01/usages/id_location.go +++ b/resource-manager/search/2023-11-01/usages/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/search/2023-11-01/usages/id_usage.go b/resource-manager/search/2023-11-01/usages/id_usage.go index 19f25839335..0e9ba8712d6 100644 --- a/resource-manager/search/2023-11-01/usages/id_usage.go +++ b/resource-manager/search/2023-11-01/usages/id_usage.go @@ -36,19 +36,9 @@ func ParseUsageID(input string) (*UsageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UsageId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.UsageName, ok = parsed.Parsed["usageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "usageName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseUsageIDInsensitively(input string) (*UsageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UsageId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *UsageId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.UsageName, ok = parsed.Parsed["usageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "usageName", *parsed) + if id.UsageName, ok = input.Parsed["usageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "usageName", input) } - return &id, nil + return nil } // ValidateUsageID checks that 'input' can be parsed as a Usage ID diff --git a/resource-manager/security/2017-08-01-preview/autoprovisioningsettings/id_autoprovisioningsetting.go b/resource-manager/security/2017-08-01-preview/autoprovisioningsettings/id_autoprovisioningsetting.go index 8f6ec2c9350..62a0818ce53 100644 --- a/resource-manager/security/2017-08-01-preview/autoprovisioningsettings/id_autoprovisioningsetting.go +++ b/resource-manager/security/2017-08-01-preview/autoprovisioningsettings/id_autoprovisioningsetting.go @@ -34,15 +34,9 @@ func ParseAutoProvisioningSettingID(input string) (*AutoProvisioningSettingId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutoProvisioningSettingId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.AutoProvisioningSettingName, ok = parsed.Parsed["autoProvisioningSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "autoProvisioningSettingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseAutoProvisioningSettingIDInsensitively(input string) (*AutoProvisionin return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutoProvisioningSettingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *AutoProvisioningSettingId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.AutoProvisioningSettingName, ok = parsed.Parsed["autoProvisioningSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "autoProvisioningSettingName", *parsed) + if id.AutoProvisioningSettingName, ok = input.Parsed["autoProvisioningSettingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "autoProvisioningSettingName", input) } - return &id, nil + return nil } // ValidateAutoProvisioningSettingID checks that 'input' can be parsed as a Auto Provisioning Setting ID diff --git a/resource-manager/security/2017-08-01-preview/compliances/id_scopedcompliance.go b/resource-manager/security/2017-08-01-preview/compliances/id_scopedcompliance.go index f29bf4c9ecb..7da308840e9 100644 --- a/resource-manager/security/2017-08-01-preview/compliances/id_scopedcompliance.go +++ b/resource-manager/security/2017-08-01-preview/compliances/id_scopedcompliance.go @@ -34,15 +34,9 @@ func ParseScopedComplianceID(input string) (*ScopedComplianceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedComplianceId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.ComplianceName, ok = parsed.Parsed["complianceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "complianceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedComplianceIDInsensitively(input string) (*ScopedComplianceId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedComplianceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedComplianceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.ComplianceName, ok = parsed.Parsed["complianceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "complianceName", *parsed) + if id.ComplianceName, ok = input.Parsed["complianceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "complianceName", input) } - return &id, nil + return nil } // ValidateScopedComplianceID checks that 'input' can be parsed as a Scoped Compliance ID diff --git a/resource-manager/security/2017-08-01-preview/devicesecuritygroups/id_scopeddevicesecuritygroup.go b/resource-manager/security/2017-08-01-preview/devicesecuritygroups/id_scopeddevicesecuritygroup.go index d7ace5837a0..14bfb490f8f 100644 --- a/resource-manager/security/2017-08-01-preview/devicesecuritygroups/id_scopeddevicesecuritygroup.go +++ b/resource-manager/security/2017-08-01-preview/devicesecuritygroups/id_scopeddevicesecuritygroup.go @@ -34,15 +34,9 @@ func ParseScopedDeviceSecurityGroupID(input string) (*ScopedDeviceSecurityGroupI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedDeviceSecurityGroupId{} - - if id.ResourceId, ok = parsed.Parsed["resourceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceId", *parsed) - } - - if id.DeviceSecurityGroupName, ok = parsed.Parsed["deviceSecurityGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deviceSecurityGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedDeviceSecurityGroupIDInsensitively(input string) (*ScopedDeviceS return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedDeviceSecurityGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ResourceId, ok = parsed.Parsed["resourceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceId", *parsed) + return &id, nil +} + +func (id *ScopedDeviceSecurityGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ResourceId, ok = input.Parsed["resourceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceId", input) } - if id.DeviceSecurityGroupName, ok = parsed.Parsed["deviceSecurityGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deviceSecurityGroupName", *parsed) + if id.DeviceSecurityGroupName, ok = input.Parsed["deviceSecurityGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deviceSecurityGroupName", input) } - return &id, nil + return nil } // ValidateScopedDeviceSecurityGroupID checks that 'input' can be parsed as a Scoped Device Security Group ID diff --git a/resource-manager/security/2017-08-01-preview/informationprotectionpolicies/id_scopedinformationprotectionpolicy.go b/resource-manager/security/2017-08-01-preview/informationprotectionpolicies/id_scopedinformationprotectionpolicy.go index 4a80a4d7a30..59076f170d9 100644 --- a/resource-manager/security/2017-08-01-preview/informationprotectionpolicies/id_scopedinformationprotectionpolicy.go +++ b/resource-manager/security/2017-08-01-preview/informationprotectionpolicies/id_scopedinformationprotectionpolicy.go @@ -34,23 +34,9 @@ func ParseScopedInformationProtectionPolicyID(input string) (*ScopedInformationP return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedInformationProtectionPolicyId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if v, ok := parsed.Parsed["informationProtectionPolicyName"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "informationProtectionPolicyName", *parsed) - } - - informationProtectionPolicyName, err := parseInformationProtectionPolicyName(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.InformationProtectionPolicyName = *informationProtectionPolicyName + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -65,26 +51,34 @@ func ParseScopedInformationProtectionPolicyIDInsensitively(input string) (*Scope return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedInformationProtectionPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedInformationProtectionPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if v, ok := parsed.Parsed["informationProtectionPolicyName"]; true { + if v, ok := input.Parsed["informationProtectionPolicyName"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "informationProtectionPolicyName", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "informationProtectionPolicyName", input) } informationProtectionPolicyName, err := parseInformationProtectionPolicyName(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.InformationProtectionPolicyName = *informationProtectionPolicyName } - return &id, nil + return nil } // ValidateScopedInformationProtectionPolicyID checks that 'input' can be parsed as a Scoped Information Protection Policy ID diff --git a/resource-manager/security/2017-08-01-preview/iotsecuritysolutions/id_iotsecuritysolution.go b/resource-manager/security/2017-08-01-preview/iotsecuritysolutions/id_iotsecuritysolution.go index 5047bf0297b..0b02a6f50fb 100644 --- a/resource-manager/security/2017-08-01-preview/iotsecuritysolutions/id_iotsecuritysolution.go +++ b/resource-manager/security/2017-08-01-preview/iotsecuritysolutions/id_iotsecuritysolution.go @@ -36,19 +36,9 @@ func ParseIotSecuritySolutionID(input string) (*IotSecuritySolutionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IotSecuritySolutionId{} - - 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.IotSecuritySolutionName, ok = parsed.Parsed["iotSecuritySolutionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "iotSecuritySolutionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseIotSecuritySolutionIDInsensitively(input string) (*IotSecuritySolution return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IotSecuritySolutionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *IotSecuritySolutionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.IotSecuritySolutionName, ok = parsed.Parsed["iotSecuritySolutionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "iotSecuritySolutionName", *parsed) + if id.IotSecuritySolutionName, ok = input.Parsed["iotSecuritySolutionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "iotSecuritySolutionName", input) } - return &id, nil + return nil } // ValidateIotSecuritySolutionID checks that 'input' can be parsed as a Iot Security Solution ID diff --git a/resource-manager/security/2017-08-01-preview/iotsecuritysolutionsanalytics/id_aggregatedalert.go b/resource-manager/security/2017-08-01-preview/iotsecuritysolutionsanalytics/id_aggregatedalert.go index fa7d96c2640..58238a72958 100644 --- a/resource-manager/security/2017-08-01-preview/iotsecuritysolutionsanalytics/id_aggregatedalert.go +++ b/resource-manager/security/2017-08-01-preview/iotsecuritysolutionsanalytics/id_aggregatedalert.go @@ -38,23 +38,9 @@ func ParseAggregatedAlertID(input string) (*AggregatedAlertId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AggregatedAlertId{} - - 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.IotSecuritySolutionName, ok = parsed.Parsed["iotSecuritySolutionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "iotSecuritySolutionName", *parsed) - } - - if id.AggregatedAlertName, ok = parsed.Parsed["aggregatedAlertName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "aggregatedAlertName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAggregatedAlertIDInsensitively(input string) (*AggregatedAlertId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AggregatedAlertId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AggregatedAlertId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.IotSecuritySolutionName, ok = parsed.Parsed["iotSecuritySolutionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "iotSecuritySolutionName", *parsed) + if id.IotSecuritySolutionName, ok = input.Parsed["iotSecuritySolutionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "iotSecuritySolutionName", input) } - if id.AggregatedAlertName, ok = parsed.Parsed["aggregatedAlertName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "aggregatedAlertName", *parsed) + if id.AggregatedAlertName, ok = input.Parsed["aggregatedAlertName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "aggregatedAlertName", input) } - return &id, nil + return nil } // ValidateAggregatedAlertID checks that 'input' can be parsed as a Aggregated Alert ID diff --git a/resource-manager/security/2017-08-01-preview/iotsecuritysolutionsanalytics/id_aggregatedrecommendation.go b/resource-manager/security/2017-08-01-preview/iotsecuritysolutionsanalytics/id_aggregatedrecommendation.go index 65ac1759dcf..6091ca6bb56 100644 --- a/resource-manager/security/2017-08-01-preview/iotsecuritysolutionsanalytics/id_aggregatedrecommendation.go +++ b/resource-manager/security/2017-08-01-preview/iotsecuritysolutionsanalytics/id_aggregatedrecommendation.go @@ -38,23 +38,9 @@ func ParseAggregatedRecommendationID(input string) (*AggregatedRecommendationId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AggregatedRecommendationId{} - - 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.IotSecuritySolutionName, ok = parsed.Parsed["iotSecuritySolutionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "iotSecuritySolutionName", *parsed) - } - - if id.AggregatedRecommendationName, ok = parsed.Parsed["aggregatedRecommendationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "aggregatedRecommendationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAggregatedRecommendationIDInsensitively(input string) (*AggregatedReco return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AggregatedRecommendationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AggregatedRecommendationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.IotSecuritySolutionName, ok = parsed.Parsed["iotSecuritySolutionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "iotSecuritySolutionName", *parsed) + if id.IotSecuritySolutionName, ok = input.Parsed["iotSecuritySolutionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "iotSecuritySolutionName", input) } - if id.AggregatedRecommendationName, ok = parsed.Parsed["aggregatedRecommendationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "aggregatedRecommendationName", *parsed) + if id.AggregatedRecommendationName, ok = input.Parsed["aggregatedRecommendationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "aggregatedRecommendationName", input) } - return &id, nil + return nil } // ValidateAggregatedRecommendationID checks that 'input' can be parsed as a Aggregated Recommendation ID diff --git a/resource-manager/security/2017-08-01-preview/iotsecuritysolutionsanalytics/id_iotsecuritysolution.go b/resource-manager/security/2017-08-01-preview/iotsecuritysolutionsanalytics/id_iotsecuritysolution.go index b9ef3f1ca2e..1bbf3f0d3f8 100644 --- a/resource-manager/security/2017-08-01-preview/iotsecuritysolutionsanalytics/id_iotsecuritysolution.go +++ b/resource-manager/security/2017-08-01-preview/iotsecuritysolutionsanalytics/id_iotsecuritysolution.go @@ -36,19 +36,9 @@ func ParseIotSecuritySolutionID(input string) (*IotSecuritySolutionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IotSecuritySolutionId{} - - 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.IotSecuritySolutionName, ok = parsed.Parsed["iotSecuritySolutionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "iotSecuritySolutionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseIotSecuritySolutionIDInsensitively(input string) (*IotSecuritySolution return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IotSecuritySolutionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *IotSecuritySolutionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.IotSecuritySolutionName, ok = parsed.Parsed["iotSecuritySolutionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "iotSecuritySolutionName", *parsed) + if id.IotSecuritySolutionName, ok = input.Parsed["iotSecuritySolutionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "iotSecuritySolutionName", input) } - return &id, nil + return nil } // ValidateIotSecuritySolutionID checks that 'input' can be parsed as a Iot Security Solution ID diff --git a/resource-manager/security/2017-08-01-preview/pricings/id_pricing.go b/resource-manager/security/2017-08-01-preview/pricings/id_pricing.go index 7ad6d7986ca..a13cccd5def 100644 --- a/resource-manager/security/2017-08-01-preview/pricings/id_pricing.go +++ b/resource-manager/security/2017-08-01-preview/pricings/id_pricing.go @@ -34,15 +34,9 @@ func ParsePricingID(input string) (*PricingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PricingId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.PricingName, ok = parsed.Parsed["pricingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "pricingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParsePricingIDInsensitively(input string) (*PricingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PricingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *PricingId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.PricingName, ok = parsed.Parsed["pricingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "pricingName", *parsed) + if id.PricingName, ok = input.Parsed["pricingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "pricingName", input) } - return &id, nil + return nil } // ValidatePricingID checks that 'input' can be parsed as a Pricing ID diff --git a/resource-manager/security/2017-08-01-preview/pricings/id_providerpricing.go b/resource-manager/security/2017-08-01-preview/pricings/id_providerpricing.go index ef8f9035574..82e5bb36d07 100644 --- a/resource-manager/security/2017-08-01-preview/pricings/id_providerpricing.go +++ b/resource-manager/security/2017-08-01-preview/pricings/id_providerpricing.go @@ -36,19 +36,9 @@ func ParseProviderPricingID(input string) (*ProviderPricingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderPricingId{} - - 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.PricingName, ok = parsed.Parsed["pricingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "pricingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderPricingIDInsensitively(input string) (*ProviderPricingId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderPricingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderPricingId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PricingName, ok = parsed.Parsed["pricingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "pricingName", *parsed) + if id.PricingName, ok = input.Parsed["pricingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "pricingName", input) } - return &id, nil + return nil } // ValidateProviderPricingID checks that 'input' can be parsed as a Provider Pricing ID diff --git a/resource-manager/security/2017-08-01-preview/securitycontacts/id_securitycontact.go b/resource-manager/security/2017-08-01-preview/securitycontacts/id_securitycontact.go index 2239910344a..d42ed62e99e 100644 --- a/resource-manager/security/2017-08-01-preview/securitycontacts/id_securitycontact.go +++ b/resource-manager/security/2017-08-01-preview/securitycontacts/id_securitycontact.go @@ -34,15 +34,9 @@ func ParseSecurityContactID(input string) (*SecurityContactId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecurityContactId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.SecurityContactName, ok = parsed.Parsed["securityContactName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityContactName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseSecurityContactIDInsensitively(input string) (*SecurityContactId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecurityContactId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SecurityContactId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.SecurityContactName, ok = parsed.Parsed["securityContactName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityContactName", *parsed) + if id.SecurityContactName, ok = input.Parsed["securityContactName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "securityContactName", input) } - return &id, nil + return nil } // ValidateSecurityContactID checks that 'input' can be parsed as a Security Contact ID diff --git a/resource-manager/security/2017-08-01-preview/settings/id_setting.go b/resource-manager/security/2017-08-01-preview/settings/id_setting.go index 9c46c92d4ae..aee51102cdc 100644 --- a/resource-manager/security/2017-08-01-preview/settings/id_setting.go +++ b/resource-manager/security/2017-08-01-preview/settings/id_setting.go @@ -34,23 +34,9 @@ func ParseSettingID(input string) (*SettingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SettingId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if v, ok := parsed.Parsed["settingName"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "settingName", *parsed) - } - - settingName, err := parseSettingName(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.SettingName = *settingName + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -65,26 +51,34 @@ func ParseSettingIDInsensitively(input string) (*SettingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SettingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SettingId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if v, ok := parsed.Parsed["settingName"]; true { + if v, ok := input.Parsed["settingName"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "settingName", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "settingName", input) } settingName, err := parseSettingName(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.SettingName = *settingName } - return &id, nil + return nil } // ValidateSettingID checks that 'input' can be parsed as a Setting ID diff --git a/resource-manager/security/2017-08-01-preview/workspacesettings/id_workspacesetting.go b/resource-manager/security/2017-08-01-preview/workspacesettings/id_workspacesetting.go index 405d9680ce3..45e01c519b7 100644 --- a/resource-manager/security/2017-08-01-preview/workspacesettings/id_workspacesetting.go +++ b/resource-manager/security/2017-08-01-preview/workspacesettings/id_workspacesetting.go @@ -34,15 +34,9 @@ func ParseWorkspaceSettingID(input string) (*WorkspaceSettingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceSettingId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.WorkspaceSettingName, ok = parsed.Parsed["workspaceSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceSettingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseWorkspaceSettingIDInsensitively(input string) (*WorkspaceSettingId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceSettingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *WorkspaceSettingId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.WorkspaceSettingName, ok = parsed.Parsed["workspaceSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceSettingName", *parsed) + if id.WorkspaceSettingName, ok = input.Parsed["workspaceSettingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceSettingName", input) } - return &id, nil + return nil } // ValidateWorkspaceSettingID checks that 'input' can be parsed as a Workspace Setting ID diff --git a/resource-manager/security/2019-01-01-preview/alertssuppressionrules/id_alertssuppressionrule.go b/resource-manager/security/2019-01-01-preview/alertssuppressionrules/id_alertssuppressionrule.go index bf38677c387..4a20ec3e627 100644 --- a/resource-manager/security/2019-01-01-preview/alertssuppressionrules/id_alertssuppressionrule.go +++ b/resource-manager/security/2019-01-01-preview/alertssuppressionrules/id_alertssuppressionrule.go @@ -34,15 +34,9 @@ func ParseAlertsSuppressionRuleID(input string) (*AlertsSuppressionRuleId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertsSuppressionRuleId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.AlertsSuppressionRuleName, ok = parsed.Parsed["alertsSuppressionRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "alertsSuppressionRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseAlertsSuppressionRuleIDInsensitively(input string) (*AlertsSuppression return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertsSuppressionRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *AlertsSuppressionRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.AlertsSuppressionRuleName, ok = parsed.Parsed["alertsSuppressionRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "alertsSuppressionRuleName", *parsed) + if id.AlertsSuppressionRuleName, ok = input.Parsed["alertsSuppressionRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "alertsSuppressionRuleName", input) } - return &id, nil + return nil } // ValidateAlertsSuppressionRuleID checks that 'input' can be parsed as a Alerts Suppression Rule ID diff --git a/resource-manager/security/2019-01-01-preview/assessments/id_scopedassessment.go b/resource-manager/security/2019-01-01-preview/assessments/id_scopedassessment.go index e2ba146c246..5226a60c5f1 100644 --- a/resource-manager/security/2019-01-01-preview/assessments/id_scopedassessment.go +++ b/resource-manager/security/2019-01-01-preview/assessments/id_scopedassessment.go @@ -34,15 +34,9 @@ func ParseScopedAssessmentID(input string) (*ScopedAssessmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedAssessmentId{} - - if id.ResourceId, ok = parsed.Parsed["resourceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceId", *parsed) - } - - if id.AssessmentName, ok = parsed.Parsed["assessmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "assessmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedAssessmentIDInsensitively(input string) (*ScopedAssessmentId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedAssessmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ResourceId, ok = parsed.Parsed["resourceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceId", *parsed) + return &id, nil +} + +func (id *ScopedAssessmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ResourceId, ok = input.Parsed["resourceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceId", input) } - if id.AssessmentName, ok = parsed.Parsed["assessmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "assessmentName", *parsed) + if id.AssessmentName, ok = input.Parsed["assessmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "assessmentName", input) } - return &id, nil + return nil } // ValidateScopedAssessmentID checks that 'input' can be parsed as a Scoped Assessment ID diff --git a/resource-manager/security/2019-01-01-preview/assessmentsmetadata/id_assessmentmetadata.go b/resource-manager/security/2019-01-01-preview/assessmentsmetadata/id_assessmentmetadata.go index b5fa77a50d3..6445a34e05e 100644 --- a/resource-manager/security/2019-01-01-preview/assessmentsmetadata/id_assessmentmetadata.go +++ b/resource-manager/security/2019-01-01-preview/assessmentsmetadata/id_assessmentmetadata.go @@ -32,11 +32,9 @@ func ParseAssessmentMetadataID(input string) (*AssessmentMetadataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AssessmentMetadataId{} - - if id.AssessmentMetadataName, ok = parsed.Parsed["assessmentMetadataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "assessmentMetadataName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseAssessmentMetadataIDInsensitively(input string) (*AssessmentMetadataId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AssessmentMetadataId{} - - if id.AssessmentMetadataName, ok = parsed.Parsed["assessmentMetadataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "assessmentMetadataName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *AssessmentMetadataId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.AssessmentMetadataName, ok = input.Parsed["assessmentMetadataName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "assessmentMetadataName", input) + } + + return nil +} + // ValidateAssessmentMetadataID checks that 'input' can be parsed as a Assessment Metadata ID func ValidateAssessmentMetadataID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/security/2019-01-01-preview/assessmentsmetadata/id_providerassessmentmetadata.go b/resource-manager/security/2019-01-01-preview/assessmentsmetadata/id_providerassessmentmetadata.go index e0957f9874e..1aebf390200 100644 --- a/resource-manager/security/2019-01-01-preview/assessmentsmetadata/id_providerassessmentmetadata.go +++ b/resource-manager/security/2019-01-01-preview/assessmentsmetadata/id_providerassessmentmetadata.go @@ -34,15 +34,9 @@ func ParseProviderAssessmentMetadataID(input string) (*ProviderAssessmentMetadat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderAssessmentMetadataId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.AssessmentMetadataName, ok = parsed.Parsed["assessmentMetadataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "assessmentMetadataName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviderAssessmentMetadataIDInsensitively(input string) (*ProviderAsse return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderAssessmentMetadataId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ProviderAssessmentMetadataId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.AssessmentMetadataName, ok = parsed.Parsed["assessmentMetadataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "assessmentMetadataName", *parsed) + if id.AssessmentMetadataName, ok = input.Parsed["assessmentMetadataName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "assessmentMetadataName", input) } - return &id, nil + return nil } // ValidateProviderAssessmentMetadataID checks that 'input' can be parsed as a Provider Assessment Metadata ID diff --git a/resource-manager/security/2019-01-01-preview/automations/id_automation.go b/resource-manager/security/2019-01-01-preview/automations/id_automation.go index f8b8200dd47..d4f67769053 100644 --- a/resource-manager/security/2019-01-01-preview/automations/id_automation.go +++ b/resource-manager/security/2019-01-01-preview/automations/id_automation.go @@ -36,19 +36,9 @@ func ParseAutomationID(input string) (*AutomationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationId{} - - 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.AutomationName, ok = parsed.Parsed["automationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAutomationIDInsensitively(input string) (*AutomationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AutomationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AutomationName, ok = parsed.Parsed["automationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationName", *parsed) + if id.AutomationName, ok = input.Parsed["automationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationName", input) } - return &id, nil + return nil } // ValidateAutomationID checks that 'input' can be parsed as a Automation ID diff --git a/resource-manager/security/2019-01-01-preview/regulatorycompliance/id_regulatorycomplianceassessment.go b/resource-manager/security/2019-01-01-preview/regulatorycompliance/id_regulatorycomplianceassessment.go index 368cacc7ea4..6714c2a85b8 100644 --- a/resource-manager/security/2019-01-01-preview/regulatorycompliance/id_regulatorycomplianceassessment.go +++ b/resource-manager/security/2019-01-01-preview/regulatorycompliance/id_regulatorycomplianceassessment.go @@ -38,23 +38,9 @@ func ParseRegulatoryComplianceAssessmentID(input string) (*RegulatoryComplianceA return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegulatoryComplianceAssessmentId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.RegulatoryComplianceStandardName, ok = parsed.Parsed["regulatoryComplianceStandardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "regulatoryComplianceStandardName", *parsed) - } - - if id.RegulatoryComplianceControlName, ok = parsed.Parsed["regulatoryComplianceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "regulatoryComplianceControlName", *parsed) - } - - if id.RegulatoryComplianceAssessmentName, ok = parsed.Parsed["regulatoryComplianceAssessmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "regulatoryComplianceAssessmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRegulatoryComplianceAssessmentIDInsensitively(input string) (*Regulato return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegulatoryComplianceAssessmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RegulatoryComplianceAssessmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.RegulatoryComplianceStandardName, ok = parsed.Parsed["regulatoryComplianceStandardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "regulatoryComplianceStandardName", *parsed) + if id.RegulatoryComplianceStandardName, ok = input.Parsed["regulatoryComplianceStandardName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "regulatoryComplianceStandardName", input) } - if id.RegulatoryComplianceControlName, ok = parsed.Parsed["regulatoryComplianceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "regulatoryComplianceControlName", *parsed) + if id.RegulatoryComplianceControlName, ok = input.Parsed["regulatoryComplianceControlName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "regulatoryComplianceControlName", input) } - if id.RegulatoryComplianceAssessmentName, ok = parsed.Parsed["regulatoryComplianceAssessmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "regulatoryComplianceAssessmentName", *parsed) + if id.RegulatoryComplianceAssessmentName, ok = input.Parsed["regulatoryComplianceAssessmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "regulatoryComplianceAssessmentName", input) } - return &id, nil + return nil } // ValidateRegulatoryComplianceAssessmentID checks that 'input' can be parsed as a Regulatory Compliance Assessment ID diff --git a/resource-manager/security/2019-01-01-preview/regulatorycompliance/id_regulatorycompliancecontrol.go b/resource-manager/security/2019-01-01-preview/regulatorycompliance/id_regulatorycompliancecontrol.go index 1cc0f031a07..08117d40803 100644 --- a/resource-manager/security/2019-01-01-preview/regulatorycompliance/id_regulatorycompliancecontrol.go +++ b/resource-manager/security/2019-01-01-preview/regulatorycompliance/id_regulatorycompliancecontrol.go @@ -36,19 +36,9 @@ func ParseRegulatoryComplianceControlID(input string) (*RegulatoryComplianceCont return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegulatoryComplianceControlId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.RegulatoryComplianceStandardName, ok = parsed.Parsed["regulatoryComplianceStandardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "regulatoryComplianceStandardName", *parsed) - } - - if id.RegulatoryComplianceControlName, ok = parsed.Parsed["regulatoryComplianceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "regulatoryComplianceControlName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseRegulatoryComplianceControlIDInsensitively(input string) (*RegulatoryC return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegulatoryComplianceControlId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RegulatoryComplianceControlId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.RegulatoryComplianceStandardName, ok = parsed.Parsed["regulatoryComplianceStandardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "regulatoryComplianceStandardName", *parsed) + if id.RegulatoryComplianceStandardName, ok = input.Parsed["regulatoryComplianceStandardName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "regulatoryComplianceStandardName", input) } - if id.RegulatoryComplianceControlName, ok = parsed.Parsed["regulatoryComplianceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "regulatoryComplianceControlName", *parsed) + if id.RegulatoryComplianceControlName, ok = input.Parsed["regulatoryComplianceControlName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "regulatoryComplianceControlName", input) } - return &id, nil + return nil } // ValidateRegulatoryComplianceControlID checks that 'input' can be parsed as a Regulatory Compliance Control ID diff --git a/resource-manager/security/2019-01-01-preview/regulatorycompliance/id_regulatorycompliancestandard.go b/resource-manager/security/2019-01-01-preview/regulatorycompliance/id_regulatorycompliancestandard.go index 9575c552c48..7cde0041b27 100644 --- a/resource-manager/security/2019-01-01-preview/regulatorycompliance/id_regulatorycompliancestandard.go +++ b/resource-manager/security/2019-01-01-preview/regulatorycompliance/id_regulatorycompliancestandard.go @@ -34,15 +34,9 @@ func ParseRegulatoryComplianceStandardID(input string) (*RegulatoryComplianceSta return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegulatoryComplianceStandardId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.RegulatoryComplianceStandardName, ok = parsed.Parsed["regulatoryComplianceStandardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "regulatoryComplianceStandardName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseRegulatoryComplianceStandardIDInsensitively(input string) (*Regulatory return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegulatoryComplianceStandardId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RegulatoryComplianceStandardId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.RegulatoryComplianceStandardName, ok = parsed.Parsed["regulatoryComplianceStandardName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "regulatoryComplianceStandardName", *parsed) + if id.RegulatoryComplianceStandardName, ok = input.Parsed["regulatoryComplianceStandardName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "regulatoryComplianceStandardName", input) } - return &id, nil + return nil } // ValidateRegulatoryComplianceStandardID checks that 'input' can be parsed as a Regulatory Compliance Standard ID diff --git a/resource-manager/security/2019-01-01-preview/subassessments/id_scopedassessment.go b/resource-manager/security/2019-01-01-preview/subassessments/id_scopedassessment.go index 6d8a901fd8d..011ce5f7084 100644 --- a/resource-manager/security/2019-01-01-preview/subassessments/id_scopedassessment.go +++ b/resource-manager/security/2019-01-01-preview/subassessments/id_scopedassessment.go @@ -34,15 +34,9 @@ func ParseScopedAssessmentID(input string) (*ScopedAssessmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedAssessmentId{} - - if id.ResourceId, ok = parsed.Parsed["resourceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceId", *parsed) - } - - if id.AssessmentName, ok = parsed.Parsed["assessmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "assessmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedAssessmentIDInsensitively(input string) (*ScopedAssessmentId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedAssessmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ResourceId, ok = parsed.Parsed["resourceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceId", *parsed) + return &id, nil +} + +func (id *ScopedAssessmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ResourceId, ok = input.Parsed["resourceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceId", input) } - if id.AssessmentName, ok = parsed.Parsed["assessmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "assessmentName", *parsed) + if id.AssessmentName, ok = input.Parsed["assessmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "assessmentName", input) } - return &id, nil + return nil } // ValidateScopedAssessmentID checks that 'input' can be parsed as a Scoped Assessment ID diff --git a/resource-manager/security/2019-01-01-preview/subassessments/id_scopedsubassessment.go b/resource-manager/security/2019-01-01-preview/subassessments/id_scopedsubassessment.go index 0a1431ebda1..363a143b6ac 100644 --- a/resource-manager/security/2019-01-01-preview/subassessments/id_scopedsubassessment.go +++ b/resource-manager/security/2019-01-01-preview/subassessments/id_scopedsubassessment.go @@ -36,19 +36,9 @@ func ParseScopedSubAssessmentID(input string) (*ScopedSubAssessmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedSubAssessmentId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.AssessmentName, ok = parsed.Parsed["assessmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "assessmentName", *parsed) - } - - if id.SubAssessmentName, ok = parsed.Parsed["subAssessmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subAssessmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseScopedSubAssessmentIDInsensitively(input string) (*ScopedSubAssessment return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedSubAssessmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) +func (id *ScopedSubAssessmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.AssessmentName, ok = parsed.Parsed["assessmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "assessmentName", *parsed) + if id.AssessmentName, ok = input.Parsed["assessmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "assessmentName", input) } - if id.SubAssessmentName, ok = parsed.Parsed["subAssessmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subAssessmentName", *parsed) + if id.SubAssessmentName, ok = input.Parsed["subAssessmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subAssessmentName", input) } - return &id, nil + return nil } // ValidateScopedSubAssessmentID checks that 'input' can be parsed as a Scoped Sub Assessment ID diff --git a/resource-manager/security/2019-01-01/alerts/id_alert.go b/resource-manager/security/2019-01-01/alerts/id_alert.go index 643d2125f7e..e6d575eda2a 100644 --- a/resource-manager/security/2019-01-01/alerts/id_alert.go +++ b/resource-manager/security/2019-01-01/alerts/id_alert.go @@ -36,19 +36,9 @@ func ParseAlertID(input string) (*AlertId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.AlertName, ok = parsed.Parsed["alertName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "alertName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAlertIDInsensitively(input string) (*AlertId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AlertId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.AlertName, ok = parsed.Parsed["alertName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "alertName", *parsed) + if id.AlertName, ok = input.Parsed["alertName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "alertName", input) } - return &id, nil + return nil } // ValidateAlertID checks that 'input' can be parsed as a Alert ID diff --git a/resource-manager/security/2019-01-01/alerts/id_location.go b/resource-manager/security/2019-01-01/alerts/id_location.go index e76e815307d..06afa59f1d8 100644 --- a/resource-manager/security/2019-01-01/alerts/id_location.go +++ b/resource-manager/security/2019-01-01/alerts/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/security/2019-01-01/alerts/id_locationalert.go b/resource-manager/security/2019-01-01/alerts/id_locationalert.go index b3ca168d86d..cbf8550902a 100644 --- a/resource-manager/security/2019-01-01/alerts/id_locationalert.go +++ b/resource-manager/security/2019-01-01/alerts/id_locationalert.go @@ -38,23 +38,9 @@ func ParseLocationAlertID(input string) (*LocationAlertId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationAlertId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.AlertName, ok = parsed.Parsed["alertName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "alertName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLocationAlertIDInsensitively(input string) (*LocationAlertId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationAlertId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LocationAlertId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.AlertName, ok = parsed.Parsed["alertName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "alertName", *parsed) + if id.AlertName, ok = input.Parsed["alertName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "alertName", input) } - return &id, nil + return nil } // ValidateLocationAlertID checks that 'input' can be parsed as a Location Alert ID diff --git a/resource-manager/security/2019-01-01/alerts/id_providerlocation.go b/resource-manager/security/2019-01-01/alerts/id_providerlocation.go index 7bd3ffc6acc..d8d085ac8dd 100644 --- a/resource-manager/security/2019-01-01/alerts/id_providerlocation.go +++ b/resource-manager/security/2019-01-01/alerts/id_providerlocation.go @@ -36,19 +36,9 @@ func ParseProviderLocationID(input string) (*ProviderLocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderLocationIDInsensitively(input string) (*ProviderLocationId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderLocationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateProviderLocationID checks that 'input' can be parsed as a Provider Location ID diff --git a/resource-manager/security/2019-01-01/settings/id_setting.go b/resource-manager/security/2019-01-01/settings/id_setting.go index 9c46c92d4ae..aee51102cdc 100644 --- a/resource-manager/security/2019-01-01/settings/id_setting.go +++ b/resource-manager/security/2019-01-01/settings/id_setting.go @@ -34,23 +34,9 @@ func ParseSettingID(input string) (*SettingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SettingId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if v, ok := parsed.Parsed["settingName"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "settingName", *parsed) - } - - settingName, err := parseSettingName(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.SettingName = *settingName + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -65,26 +51,34 @@ func ParseSettingIDInsensitively(input string) (*SettingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SettingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SettingId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if v, ok := parsed.Parsed["settingName"]; true { + if v, ok := input.Parsed["settingName"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "settingName", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "settingName", input) } settingName, err := parseSettingName(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.SettingName = *settingName } - return &id, nil + return nil } // ValidateSettingID checks that 'input' can be parsed as a Setting ID diff --git a/resource-manager/security/2020-01-01/adaptivenetworkhardenings/id_scopedadaptivenetworkhardening.go b/resource-manager/security/2020-01-01/adaptivenetworkhardenings/id_scopedadaptivenetworkhardening.go index be8334799ce..b582151d08a 100644 --- a/resource-manager/security/2020-01-01/adaptivenetworkhardenings/id_scopedadaptivenetworkhardening.go +++ b/resource-manager/security/2020-01-01/adaptivenetworkhardenings/id_scopedadaptivenetworkhardening.go @@ -34,15 +34,9 @@ func ParseScopedAdaptiveNetworkHardeningID(input string) (*ScopedAdaptiveNetwork return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedAdaptiveNetworkHardeningId{} - - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) - } - - if id.AdaptiveNetworkHardeningName, ok = parsed.Parsed["adaptiveNetworkHardeningName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "adaptiveNetworkHardeningName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedAdaptiveNetworkHardeningIDInsensitively(input string) (*ScopedAd return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedAdaptiveNetworkHardeningId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.Scope, ok = parsed.Parsed["scope"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scope", *parsed) + return &id, nil +} + +func (id *ScopedAdaptiveNetworkHardeningId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.Scope, ok = input.Parsed["scope"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scope", input) } - if id.AdaptiveNetworkHardeningName, ok = parsed.Parsed["adaptiveNetworkHardeningName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "adaptiveNetworkHardeningName", *parsed) + if id.AdaptiveNetworkHardeningName, ok = input.Parsed["adaptiveNetworkHardeningName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "adaptiveNetworkHardeningName", input) } - return &id, nil + return nil } // ValidateScopedAdaptiveNetworkHardeningID checks that 'input' can be parsed as a Scoped Adaptive Network Hardening ID diff --git a/resource-manager/security/2020-01-01/alerts/id_alert.go b/resource-manager/security/2020-01-01/alerts/id_alert.go index 643d2125f7e..e6d575eda2a 100644 --- a/resource-manager/security/2020-01-01/alerts/id_alert.go +++ b/resource-manager/security/2020-01-01/alerts/id_alert.go @@ -36,19 +36,9 @@ func ParseAlertID(input string) (*AlertId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.AlertName, ok = parsed.Parsed["alertName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "alertName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAlertIDInsensitively(input string) (*AlertId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AlertId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.AlertName, ok = parsed.Parsed["alertName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "alertName", *parsed) + if id.AlertName, ok = input.Parsed["alertName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "alertName", input) } - return &id, nil + return nil } // ValidateAlertID checks that 'input' can be parsed as a Alert ID diff --git a/resource-manager/security/2020-01-01/alerts/id_location.go b/resource-manager/security/2020-01-01/alerts/id_location.go index e76e815307d..06afa59f1d8 100644 --- a/resource-manager/security/2020-01-01/alerts/id_location.go +++ b/resource-manager/security/2020-01-01/alerts/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/security/2020-01-01/alerts/id_locationalert.go b/resource-manager/security/2020-01-01/alerts/id_locationalert.go index b3ca168d86d..cbf8550902a 100644 --- a/resource-manager/security/2020-01-01/alerts/id_locationalert.go +++ b/resource-manager/security/2020-01-01/alerts/id_locationalert.go @@ -38,23 +38,9 @@ func ParseLocationAlertID(input string) (*LocationAlertId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationAlertId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.AlertName, ok = parsed.Parsed["alertName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "alertName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLocationAlertIDInsensitively(input string) (*LocationAlertId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationAlertId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LocationAlertId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.AlertName, ok = parsed.Parsed["alertName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "alertName", *parsed) + if id.AlertName, ok = input.Parsed["alertName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "alertName", input) } - return &id, nil + return nil } // ValidateLocationAlertID checks that 'input' can be parsed as a Location Alert ID diff --git a/resource-manager/security/2020-01-01/alerts/id_providerlocation.go b/resource-manager/security/2020-01-01/alerts/id_providerlocation.go index 7bd3ffc6acc..d8d085ac8dd 100644 --- a/resource-manager/security/2020-01-01/alerts/id_providerlocation.go +++ b/resource-manager/security/2020-01-01/alerts/id_providerlocation.go @@ -36,19 +36,9 @@ func ParseProviderLocationID(input string) (*ProviderLocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderLocationIDInsensitively(input string) (*ProviderLocationId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderLocationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateProviderLocationID checks that 'input' can be parsed as a Provider Location ID diff --git a/resource-manager/security/2020-01-01/allowedconnections/id_connectiontype.go b/resource-manager/security/2020-01-01/allowedconnections/id_connectiontype.go index 785f361e72b..14066fe5062 100644 --- a/resource-manager/security/2020-01-01/allowedconnections/id_connectiontype.go +++ b/resource-manager/security/2020-01-01/allowedconnections/id_connectiontype.go @@ -38,31 +38,9 @@ func ParseConnectionTypeID(input string) (*ConnectionTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionTypeId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if v, ok := parsed.Parsed["connectionType"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionType", *parsed) - } - - connectionType, err := parseConnectionType(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.ConnectionType = *connectionType + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -77,34 +55,42 @@ func ParseConnectionTypeIDInsensitively(input string) (*ConnectionTypeId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ConnectionTypeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if v, ok := parsed.Parsed["connectionType"]; true { + if v, ok := input.Parsed["connectionType"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionType", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "connectionType", input) } connectionType, err := parseConnectionType(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.ConnectionType = *connectionType } - return &id, nil + return nil } // ValidateConnectionTypeID checks that 'input' can be parsed as a Connection Type ID diff --git a/resource-manager/security/2020-01-01/allowedconnections/id_location.go b/resource-manager/security/2020-01-01/allowedconnections/id_location.go index d4c2e907f9a..4339a46f062 100644 --- a/resource-manager/security/2020-01-01/allowedconnections/id_location.go +++ b/resource-manager/security/2020-01-01/allowedconnections/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/security/2020-01-01/applicationwhitelistings/id_applicationwhitelisting.go b/resource-manager/security/2020-01-01/applicationwhitelistings/id_applicationwhitelisting.go index c3290d9a8af..e75115466c5 100644 --- a/resource-manager/security/2020-01-01/applicationwhitelistings/id_applicationwhitelisting.go +++ b/resource-manager/security/2020-01-01/applicationwhitelistings/id_applicationwhitelisting.go @@ -36,19 +36,9 @@ func ParseApplicationWhitelistingID(input string) (*ApplicationWhitelistingId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationWhitelistingId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.ApplicationWhitelistingName, ok = parsed.Parsed["applicationWhitelistingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationWhitelistingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseApplicationWhitelistingIDInsensitively(input string) (*ApplicationWhit return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationWhitelistingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ApplicationWhitelistingId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.ApplicationWhitelistingName, ok = parsed.Parsed["applicationWhitelistingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationWhitelistingName", *parsed) + if id.ApplicationWhitelistingName, ok = input.Parsed["applicationWhitelistingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationWhitelistingName", input) } - return &id, nil + return nil } // ValidateApplicationWhitelistingID checks that 'input' can be parsed as a Application Whitelisting ID diff --git a/resource-manager/security/2020-01-01/assessments/id_scopedassessment.go b/resource-manager/security/2020-01-01/assessments/id_scopedassessment.go index e2ba146c246..5226a60c5f1 100644 --- a/resource-manager/security/2020-01-01/assessments/id_scopedassessment.go +++ b/resource-manager/security/2020-01-01/assessments/id_scopedassessment.go @@ -34,15 +34,9 @@ func ParseScopedAssessmentID(input string) (*ScopedAssessmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedAssessmentId{} - - if id.ResourceId, ok = parsed.Parsed["resourceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceId", *parsed) - } - - if id.AssessmentName, ok = parsed.Parsed["assessmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "assessmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedAssessmentIDInsensitively(input string) (*ScopedAssessmentId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedAssessmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ResourceId, ok = parsed.Parsed["resourceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceId", *parsed) + return &id, nil +} + +func (id *ScopedAssessmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ResourceId, ok = input.Parsed["resourceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceId", input) } - if id.AssessmentName, ok = parsed.Parsed["assessmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "assessmentName", *parsed) + if id.AssessmentName, ok = input.Parsed["assessmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "assessmentName", input) } - return &id, nil + return nil } // ValidateScopedAssessmentID checks that 'input' can be parsed as a Scoped Assessment ID diff --git a/resource-manager/security/2020-01-01/assessmentsmetadata/id_assessmentmetadata.go b/resource-manager/security/2020-01-01/assessmentsmetadata/id_assessmentmetadata.go index b5fa77a50d3..6445a34e05e 100644 --- a/resource-manager/security/2020-01-01/assessmentsmetadata/id_assessmentmetadata.go +++ b/resource-manager/security/2020-01-01/assessmentsmetadata/id_assessmentmetadata.go @@ -32,11 +32,9 @@ func ParseAssessmentMetadataID(input string) (*AssessmentMetadataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AssessmentMetadataId{} - - if id.AssessmentMetadataName, ok = parsed.Parsed["assessmentMetadataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "assessmentMetadataName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseAssessmentMetadataIDInsensitively(input string) (*AssessmentMetadataId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AssessmentMetadataId{} - - if id.AssessmentMetadataName, ok = parsed.Parsed["assessmentMetadataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "assessmentMetadataName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *AssessmentMetadataId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.AssessmentMetadataName, ok = input.Parsed["assessmentMetadataName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "assessmentMetadataName", input) + } + + return nil +} + // ValidateAssessmentMetadataID checks that 'input' can be parsed as a Assessment Metadata ID func ValidateAssessmentMetadataID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/security/2020-01-01/assessmentsmetadata/id_providerassessmentmetadata.go b/resource-manager/security/2020-01-01/assessmentsmetadata/id_providerassessmentmetadata.go index e0957f9874e..1aebf390200 100644 --- a/resource-manager/security/2020-01-01/assessmentsmetadata/id_providerassessmentmetadata.go +++ b/resource-manager/security/2020-01-01/assessmentsmetadata/id_providerassessmentmetadata.go @@ -34,15 +34,9 @@ func ParseProviderAssessmentMetadataID(input string) (*ProviderAssessmentMetadat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderAssessmentMetadataId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.AssessmentMetadataName, ok = parsed.Parsed["assessmentMetadataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "assessmentMetadataName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviderAssessmentMetadataIDInsensitively(input string) (*ProviderAsse return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderAssessmentMetadataId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ProviderAssessmentMetadataId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.AssessmentMetadataName, ok = parsed.Parsed["assessmentMetadataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "assessmentMetadataName", *parsed) + if id.AssessmentMetadataName, ok = input.Parsed["assessmentMetadataName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "assessmentMetadataName", input) } - return &id, nil + return nil } // ValidateProviderAssessmentMetadataID checks that 'input' can be parsed as a Provider Assessment Metadata ID diff --git a/resource-manager/security/2020-01-01/discoveredsecuritysolutions/id_discoveredsecuritysolution.go b/resource-manager/security/2020-01-01/discoveredsecuritysolutions/id_discoveredsecuritysolution.go index 03047ab754b..6ebc4432b54 100644 --- a/resource-manager/security/2020-01-01/discoveredsecuritysolutions/id_discoveredsecuritysolution.go +++ b/resource-manager/security/2020-01-01/discoveredsecuritysolutions/id_discoveredsecuritysolution.go @@ -38,23 +38,9 @@ func ParseDiscoveredSecuritySolutionID(input string) (*DiscoveredSecuritySolutio return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiscoveredSecuritySolutionId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.DiscoveredSecuritySolutionName, ok = parsed.Parsed["discoveredSecuritySolutionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "discoveredSecuritySolutionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDiscoveredSecuritySolutionIDInsensitively(input string) (*DiscoveredSe return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiscoveredSecuritySolutionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DiscoveredSecuritySolutionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.DiscoveredSecuritySolutionName, ok = parsed.Parsed["discoveredSecuritySolutionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "discoveredSecuritySolutionName", *parsed) + if id.DiscoveredSecuritySolutionName, ok = input.Parsed["discoveredSecuritySolutionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "discoveredSecuritySolutionName", input) } - return &id, nil + return nil } // ValidateDiscoveredSecuritySolutionID checks that 'input' can be parsed as a Discovered Security Solution ID diff --git a/resource-manager/security/2020-01-01/discoveredsecuritysolutions/id_location.go b/resource-manager/security/2020-01-01/discoveredsecuritysolutions/id_location.go index 2491ba43f62..9f2ad0e9364 100644 --- a/resource-manager/security/2020-01-01/discoveredsecuritysolutions/id_location.go +++ b/resource-manager/security/2020-01-01/discoveredsecuritysolutions/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/security/2020-01-01/externalsecuritysolutions/id_externalsecuritysolution.go b/resource-manager/security/2020-01-01/externalsecuritysolutions/id_externalsecuritysolution.go index 3a11fafc16c..b2751a923f0 100644 --- a/resource-manager/security/2020-01-01/externalsecuritysolutions/id_externalsecuritysolution.go +++ b/resource-manager/security/2020-01-01/externalsecuritysolutions/id_externalsecuritysolution.go @@ -38,23 +38,9 @@ func ParseExternalSecuritySolutionID(input string) (*ExternalSecuritySolutionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExternalSecuritySolutionId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.ExternalSecuritySolutionName, ok = parsed.Parsed["externalSecuritySolutionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalSecuritySolutionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseExternalSecuritySolutionIDInsensitively(input string) (*ExternalSecuri return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExternalSecuritySolutionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ExternalSecuritySolutionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.ExternalSecuritySolutionName, ok = parsed.Parsed["externalSecuritySolutionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "externalSecuritySolutionName", *parsed) + if id.ExternalSecuritySolutionName, ok = input.Parsed["externalSecuritySolutionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "externalSecuritySolutionName", input) } - return &id, nil + return nil } // ValidateExternalSecuritySolutionID checks that 'input' can be parsed as a External Security Solution ID diff --git a/resource-manager/security/2020-01-01/externalsecuritysolutions/id_location.go b/resource-manager/security/2020-01-01/externalsecuritysolutions/id_location.go index 25beca7f62b..e436af23255 100644 --- a/resource-manager/security/2020-01-01/externalsecuritysolutions/id_location.go +++ b/resource-manager/security/2020-01-01/externalsecuritysolutions/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/security/2020-01-01/jitnetworkaccesspolicies/id_jitnetworkaccesspolicy.go b/resource-manager/security/2020-01-01/jitnetworkaccesspolicies/id_jitnetworkaccesspolicy.go index 71a4a982fda..5e7496f60f5 100644 --- a/resource-manager/security/2020-01-01/jitnetworkaccesspolicies/id_jitnetworkaccesspolicy.go +++ b/resource-manager/security/2020-01-01/jitnetworkaccesspolicies/id_jitnetworkaccesspolicy.go @@ -38,23 +38,9 @@ func ParseJitNetworkAccessPolicyID(input string) (*JitNetworkAccessPolicyId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JitNetworkAccessPolicyId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.JitNetworkAccessPolicyName, ok = parsed.Parsed["jitNetworkAccessPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jitNetworkAccessPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseJitNetworkAccessPolicyIDInsensitively(input string) (*JitNetworkAccess return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JitNetworkAccessPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *JitNetworkAccessPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.JitNetworkAccessPolicyName, ok = parsed.Parsed["jitNetworkAccessPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jitNetworkAccessPolicyName", *parsed) + if id.JitNetworkAccessPolicyName, ok = input.Parsed["jitNetworkAccessPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jitNetworkAccessPolicyName", input) } - return &id, nil + return nil } // ValidateJitNetworkAccessPolicyID checks that 'input' can be parsed as a Jit Network Access Policy ID diff --git a/resource-manager/security/2020-01-01/jitnetworkaccesspolicies/id_location.go b/resource-manager/security/2020-01-01/jitnetworkaccesspolicies/id_location.go index a6d0178ae97..fddb15e2f46 100644 --- a/resource-manager/security/2020-01-01/jitnetworkaccesspolicies/id_location.go +++ b/resource-manager/security/2020-01-01/jitnetworkaccesspolicies/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/security/2020-01-01/jitnetworkaccesspolicies/id_providerlocation.go b/resource-manager/security/2020-01-01/jitnetworkaccesspolicies/id_providerlocation.go index 14b2dcdabed..644fe487f4d 100644 --- a/resource-manager/security/2020-01-01/jitnetworkaccesspolicies/id_providerlocation.go +++ b/resource-manager/security/2020-01-01/jitnetworkaccesspolicies/id_providerlocation.go @@ -36,19 +36,9 @@ func ParseProviderLocationID(input string) (*ProviderLocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderLocationIDInsensitively(input string) (*ProviderLocationId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderLocationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateProviderLocationID checks that 'input' can be parsed as a Provider Location ID diff --git a/resource-manager/security/2020-01-01/securescore/id_securescore.go b/resource-manager/security/2020-01-01/securescore/id_securescore.go index e4dcdd91a0d..cd847bafb5d 100644 --- a/resource-manager/security/2020-01-01/securescore/id_securescore.go +++ b/resource-manager/security/2020-01-01/securescore/id_securescore.go @@ -34,15 +34,9 @@ func ParseSecureScoreID(input string) (*SecureScoreId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecureScoreId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.SecureScoreName, ok = parsed.Parsed["secureScoreName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "secureScoreName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseSecureScoreIDInsensitively(input string) (*SecureScoreId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecureScoreId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SecureScoreId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.SecureScoreName, ok = parsed.Parsed["secureScoreName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "secureScoreName", *parsed) + if id.SecureScoreName, ok = input.Parsed["secureScoreName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "secureScoreName", input) } - return &id, nil + return nil } // ValidateSecureScoreID checks that 'input' can be parsed as a Secure Score ID diff --git a/resource-manager/security/2020-01-01/securitysolutions/id_securitysolution.go b/resource-manager/security/2020-01-01/securitysolutions/id_securitysolution.go index eb1fec21703..02eecb36c49 100644 --- a/resource-manager/security/2020-01-01/securitysolutions/id_securitysolution.go +++ b/resource-manager/security/2020-01-01/securitysolutions/id_securitysolution.go @@ -38,23 +38,9 @@ func ParseSecuritySolutionID(input string) (*SecuritySolutionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecuritySolutionId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.SecuritySolutionName, ok = parsed.Parsed["securitySolutionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securitySolutionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSecuritySolutionIDInsensitively(input string) (*SecuritySolutionId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecuritySolutionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SecuritySolutionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.SecuritySolutionName, ok = parsed.Parsed["securitySolutionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securitySolutionName", *parsed) + if id.SecuritySolutionName, ok = input.Parsed["securitySolutionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "securitySolutionName", input) } - return &id, nil + return nil } // ValidateSecuritySolutionID checks that 'input' can be parsed as a Security Solution ID diff --git a/resource-manager/security/2020-01-01/securitysolutionsreferencedata/id_location.go b/resource-manager/security/2020-01-01/securitysolutionsreferencedata/id_location.go index 53b4b16276b..24a489a7d7c 100644 --- a/resource-manager/security/2020-01-01/securitysolutionsreferencedata/id_location.go +++ b/resource-manager/security/2020-01-01/securitysolutionsreferencedata/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/security/2020-01-01/topology/id_location.go b/resource-manager/security/2020-01-01/topology/id_location.go index 97def759c78..53b90a45f26 100644 --- a/resource-manager/security/2020-01-01/topology/id_location.go +++ b/resource-manager/security/2020-01-01/topology/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/security/2020-01-01/topology/id_topology.go b/resource-manager/security/2020-01-01/topology/id_topology.go index 9f4d72470ae..97a5bf1166c 100644 --- a/resource-manager/security/2020-01-01/topology/id_topology.go +++ b/resource-manager/security/2020-01-01/topology/id_topology.go @@ -38,23 +38,9 @@ func ParseTopologyID(input string) (*TopologyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TopologyId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.TopologyName, ok = parsed.Parsed["topologyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topologyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTopologyIDInsensitively(input string) (*TopologyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TopologyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TopologyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.TopologyName, ok = parsed.Parsed["topologyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topologyName", *parsed) + if id.TopologyName, ok = input.Parsed["topologyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "topologyName", input) } - return &id, nil + return nil } // ValidateTopologyID checks that 'input' can be parsed as a Topology ID diff --git a/resource-manager/security/2021-06-01/assessments/id_scopedassessment.go b/resource-manager/security/2021-06-01/assessments/id_scopedassessment.go index e2ba146c246..5226a60c5f1 100644 --- a/resource-manager/security/2021-06-01/assessments/id_scopedassessment.go +++ b/resource-manager/security/2021-06-01/assessments/id_scopedassessment.go @@ -34,15 +34,9 @@ func ParseScopedAssessmentID(input string) (*ScopedAssessmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedAssessmentId{} - - if id.ResourceId, ok = parsed.Parsed["resourceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceId", *parsed) - } - - if id.AssessmentName, ok = parsed.Parsed["assessmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "assessmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedAssessmentIDInsensitively(input string) (*ScopedAssessmentId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedAssessmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ResourceId, ok = parsed.Parsed["resourceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceId", *parsed) + return &id, nil +} + +func (id *ScopedAssessmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ResourceId, ok = input.Parsed["resourceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceId", input) } - if id.AssessmentName, ok = parsed.Parsed["assessmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "assessmentName", *parsed) + if id.AssessmentName, ok = input.Parsed["assessmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "assessmentName", input) } - return &id, nil + return nil } // ValidateScopedAssessmentID checks that 'input' can be parsed as a Scoped Assessment ID diff --git a/resource-manager/security/2021-06-01/assessmentsmetadata/id_assessmentmetadata.go b/resource-manager/security/2021-06-01/assessmentsmetadata/id_assessmentmetadata.go index b5fa77a50d3..6445a34e05e 100644 --- a/resource-manager/security/2021-06-01/assessmentsmetadata/id_assessmentmetadata.go +++ b/resource-manager/security/2021-06-01/assessmentsmetadata/id_assessmentmetadata.go @@ -32,11 +32,9 @@ func ParseAssessmentMetadataID(input string) (*AssessmentMetadataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AssessmentMetadataId{} - - if id.AssessmentMetadataName, ok = parsed.Parsed["assessmentMetadataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "assessmentMetadataName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseAssessmentMetadataIDInsensitively(input string) (*AssessmentMetadataId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AssessmentMetadataId{} - - if id.AssessmentMetadataName, ok = parsed.Parsed["assessmentMetadataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "assessmentMetadataName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *AssessmentMetadataId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.AssessmentMetadataName, ok = input.Parsed["assessmentMetadataName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "assessmentMetadataName", input) + } + + return nil +} + // ValidateAssessmentMetadataID checks that 'input' can be parsed as a Assessment Metadata ID func ValidateAssessmentMetadataID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/security/2021-06-01/assessmentsmetadata/id_providerassessmentmetadata.go b/resource-manager/security/2021-06-01/assessmentsmetadata/id_providerassessmentmetadata.go index e0957f9874e..1aebf390200 100644 --- a/resource-manager/security/2021-06-01/assessmentsmetadata/id_providerassessmentmetadata.go +++ b/resource-manager/security/2021-06-01/assessmentsmetadata/id_providerassessmentmetadata.go @@ -34,15 +34,9 @@ func ParseProviderAssessmentMetadataID(input string) (*ProviderAssessmentMetadat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderAssessmentMetadataId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.AssessmentMetadataName, ok = parsed.Parsed["assessmentMetadataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "assessmentMetadataName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviderAssessmentMetadataIDInsensitively(input string) (*ProviderAsse return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderAssessmentMetadataId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ProviderAssessmentMetadataId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.AssessmentMetadataName, ok = parsed.Parsed["assessmentMetadataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "assessmentMetadataName", *parsed) + if id.AssessmentMetadataName, ok = input.Parsed["assessmentMetadataName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "assessmentMetadataName", input) } - return &id, nil + return nil } // ValidateProviderAssessmentMetadataID checks that 'input' can be parsed as a Provider Assessment Metadata ID diff --git a/resource-manager/security/2021-06-01/settings/id_setting.go b/resource-manager/security/2021-06-01/settings/id_setting.go index 9c46c92d4ae..aee51102cdc 100644 --- a/resource-manager/security/2021-06-01/settings/id_setting.go +++ b/resource-manager/security/2021-06-01/settings/id_setting.go @@ -34,23 +34,9 @@ func ParseSettingID(input string) (*SettingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SettingId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if v, ok := parsed.Parsed["settingName"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "settingName", *parsed) - } - - settingName, err := parseSettingName(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.SettingName = *settingName + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -65,26 +51,34 @@ func ParseSettingIDInsensitively(input string) (*SettingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SettingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SettingId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if v, ok := parsed.Parsed["settingName"]; true { + if v, ok := input.Parsed["settingName"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "settingName", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "settingName", input) } settingName, err := parseSettingName(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.SettingName = *settingName } - return &id, nil + return nil } // ValidateSettingID checks that 'input' can be parsed as a Setting ID diff --git a/resource-manager/security/2022-03-01/pricings/id_pricing.go b/resource-manager/security/2022-03-01/pricings/id_pricing.go index 7ad6d7986ca..a13cccd5def 100644 --- a/resource-manager/security/2022-03-01/pricings/id_pricing.go +++ b/resource-manager/security/2022-03-01/pricings/id_pricing.go @@ -34,15 +34,9 @@ func ParsePricingID(input string) (*PricingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PricingId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.PricingName, ok = parsed.Parsed["pricingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "pricingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParsePricingIDInsensitively(input string) (*PricingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PricingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *PricingId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.PricingName, ok = parsed.Parsed["pricingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "pricingName", *parsed) + if id.PricingName, ok = input.Parsed["pricingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "pricingName", input) } - return &id, nil + return nil } // ValidatePricingID checks that 'input' can be parsed as a Pricing ID diff --git a/resource-manager/security/2022-05-01/settings/id_setting.go b/resource-manager/security/2022-05-01/settings/id_setting.go index 9c46c92d4ae..aee51102cdc 100644 --- a/resource-manager/security/2022-05-01/settings/id_setting.go +++ b/resource-manager/security/2022-05-01/settings/id_setting.go @@ -34,23 +34,9 @@ func ParseSettingID(input string) (*SettingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SettingId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if v, ok := parsed.Parsed["settingName"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "settingName", *parsed) - } - - settingName, err := parseSettingName(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.SettingName = *settingName + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -65,26 +51,34 @@ func ParseSettingIDInsensitively(input string) (*SettingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SettingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SettingId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if v, ok := parsed.Parsed["settingName"]; true { + if v, ok := input.Parsed["settingName"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "settingName", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "settingName", input) } settingName, err := parseSettingName(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.SettingName = *settingName } - return &id, nil + return nil } // ValidateSettingID checks that 'input' can be parsed as a Setting ID diff --git a/resource-manager/security/2023-01-01/pricings/id_pricing.go b/resource-manager/security/2023-01-01/pricings/id_pricing.go index 7ad6d7986ca..a13cccd5def 100644 --- a/resource-manager/security/2023-01-01/pricings/id_pricing.go +++ b/resource-manager/security/2023-01-01/pricings/id_pricing.go @@ -34,15 +34,9 @@ func ParsePricingID(input string) (*PricingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PricingId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.PricingName, ok = parsed.Parsed["pricingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "pricingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParsePricingIDInsensitively(input string) (*PricingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PricingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *PricingId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.PricingName, ok = parsed.Parsed["pricingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "pricingName", *parsed) + if id.PricingName, ok = input.Parsed["pricingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "pricingName", input) } - return &id, nil + return nil } // ValidatePricingID checks that 'input' can be parsed as a Pricing ID diff --git a/resource-manager/security/2023-11-15/apimconfig/id_apicollection.go b/resource-manager/security/2023-11-15/apimconfig/id_apicollection.go index 5c42d13173c..6fda9f7479e 100644 --- a/resource-manager/security/2023-11-15/apimconfig/id_apicollection.go +++ b/resource-manager/security/2023-11-15/apimconfig/id_apicollection.go @@ -38,23 +38,9 @@ func ParseApiCollectionID(input string) (*ApiCollectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiCollectionId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiCollectionIDInsensitively(input string) (*ApiCollectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiCollectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiCollectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateApiCollectionID checks that 'input' can be parsed as a Api Collection ID diff --git a/resource-manager/security/2023-11-15/apimconfig/id_service.go b/resource-manager/security/2023-11-15/apimconfig/id_service.go index 2052a168e50..820740d66e1 100644 --- a/resource-manager/security/2023-11-15/apimconfig/id_service.go +++ b/resource-manager/security/2023-11-15/apimconfig/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/security/2023-11-15/d4apicollection/id_apicollection.go b/resource-manager/security/2023-11-15/d4apicollection/id_apicollection.go index 531fd4b0aa3..57f491d1ff2 100644 --- a/resource-manager/security/2023-11-15/d4apicollection/id_apicollection.go +++ b/resource-manager/security/2023-11-15/d4apicollection/id_apicollection.go @@ -38,23 +38,9 @@ func ParseApiCollectionID(input string) (*ApiCollectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiCollectionId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiCollectionIDInsensitively(input string) (*ApiCollectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiCollectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiCollectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateApiCollectionID checks that 'input' can be parsed as a Api Collection ID diff --git a/resource-manager/security/2023-11-15/d4apicollectionlist/id_service.go b/resource-manager/security/2023-11-15/d4apicollectionlist/id_service.go index 885f34f974c..ee40dfb4efb 100644 --- a/resource-manager/security/2023-11-15/d4apicollectionlist/id_service.go +++ b/resource-manager/security/2023-11-15/d4apicollectionlist/id_service.go @@ -36,19 +36,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/security/2023-11-15/offboardfromd4api/id_apicollection.go b/resource-manager/security/2023-11-15/offboardfromd4api/id_apicollection.go index d51024e906e..33288d2bdd9 100644 --- a/resource-manager/security/2023-11-15/offboardfromd4api/id_apicollection.go +++ b/resource-manager/security/2023-11-15/offboardfromd4api/id_apicollection.go @@ -38,23 +38,9 @@ func ParseApiCollectionID(input string) (*ApiCollectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiCollectionId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiCollectionIDInsensitively(input string) (*ApiCollectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiCollectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiCollectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateApiCollectionID checks that 'input' can be parsed as a Api Collection ID diff --git a/resource-manager/security/2023-11-15/onboardtod4api/id_apicollection.go b/resource-manager/security/2023-11-15/onboardtod4api/id_apicollection.go index 98f6bdca4c5..edd12cf618e 100644 --- a/resource-manager/security/2023-11-15/onboardtod4api/id_apicollection.go +++ b/resource-manager/security/2023-11-15/onboardtod4api/id_apicollection.go @@ -38,23 +38,9 @@ func ParseApiCollectionID(input string) (*ApiCollectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiCollectionId{} - - 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.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) - } - - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApiCollectionIDInsensitively(input string) (*ApiCollectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApiCollectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApiCollectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - if id.ApiId, ok = parsed.Parsed["apiId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "apiId", *parsed) + if id.ApiId, ok = input.Parsed["apiId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "apiId", input) } - return &id, nil + return nil } // ValidateApiCollectionID checks that 'input' can be parsed as a Api Collection ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/actions/id_action.go b/resource-manager/securityinsights/2021-09-01-preview/actions/id_action.go index 574eb6badaa..683be4d3ea6 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/actions/id_action.go +++ b/resource-manager/securityinsights/2021-09-01-preview/actions/id_action.go @@ -40,27 +40,9 @@ func ParseActionID(input string) (*ActionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ActionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.RuleId, ok = parsed.Parsed["ruleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleId", *parsed) - } - - if id.ActionId, ok = parsed.Parsed["actionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseActionIDInsensitively(input string) (*ActionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ActionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ActionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.RuleId, ok = parsed.Parsed["ruleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleId", *parsed) + if id.RuleId, ok = input.Parsed["ruleId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleId", input) } - if id.ActionId, ok = parsed.Parsed["actionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionId", *parsed) + if id.ActionId, ok = input.Parsed["actionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "actionId", input) } - return &id, nil + return nil } // ValidateActionID checks that 'input' can be parsed as a Action ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/actions/id_alertrule.go b/resource-manager/securityinsights/2021-09-01-preview/actions/id_alertrule.go index 3164d49f702..c93745a84fb 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/actions/id_alertrule.go +++ b/resource-manager/securityinsights/2021-09-01-preview/actions/id_alertrule.go @@ -38,23 +38,9 @@ func ParseAlertRuleID(input string) (*AlertRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertRuleId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.RuleId, ok = parsed.Parsed["ruleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAlertRuleIDInsensitively(input string) (*AlertRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AlertRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.RuleId, ok = parsed.Parsed["ruleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleId", *parsed) + if id.RuleId, ok = input.Parsed["ruleId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleId", input) } - return &id, nil + return nil } // ValidateAlertRuleID checks that 'input' can be parsed as a Alert Rule ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/alertrules/id_alertrule.go b/resource-manager/securityinsights/2021-09-01-preview/alertrules/id_alertrule.go index f7731588a47..5dcc3bbe13f 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/alertrules/id_alertrule.go +++ b/resource-manager/securityinsights/2021-09-01-preview/alertrules/id_alertrule.go @@ -38,23 +38,9 @@ func ParseAlertRuleID(input string) (*AlertRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertRuleId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.RuleId, ok = parsed.Parsed["ruleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAlertRuleIDInsensitively(input string) (*AlertRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AlertRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.RuleId, ok = parsed.Parsed["ruleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleId", *parsed) + if id.RuleId, ok = input.Parsed["ruleId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleId", input) } - return &id, nil + return nil } // ValidateAlertRuleID checks that 'input' can be parsed as a Alert Rule ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/alertrules/id_workspace.go b/resource-manager/securityinsights/2021-09-01-preview/alertrules/id_workspace.go index 0baa3a56a8a..185da699926 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/alertrules/id_workspace.go +++ b/resource-manager/securityinsights/2021-09-01-preview/alertrules/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/alertruletemplates/id_alertruletemplate.go b/resource-manager/securityinsights/2021-09-01-preview/alertruletemplates/id_alertruletemplate.go index 106e81ff68d..d66b4983828 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/alertruletemplates/id_alertruletemplate.go +++ b/resource-manager/securityinsights/2021-09-01-preview/alertruletemplates/id_alertruletemplate.go @@ -38,23 +38,9 @@ func ParseAlertRuleTemplateID(input string) (*AlertRuleTemplateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertRuleTemplateId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.AlertRuleTemplateId, ok = parsed.Parsed["alertRuleTemplateId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "alertRuleTemplateId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAlertRuleTemplateIDInsensitively(input string) (*AlertRuleTemplateId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertRuleTemplateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AlertRuleTemplateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.AlertRuleTemplateId, ok = parsed.Parsed["alertRuleTemplateId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "alertRuleTemplateId", *parsed) + if id.AlertRuleTemplateId, ok = input.Parsed["alertRuleTemplateId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "alertRuleTemplateId", input) } - return &id, nil + return nil } // ValidateAlertRuleTemplateID checks that 'input' can be parsed as a Alert Rule Template ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/alertruletemplates/id_workspace.go b/resource-manager/securityinsights/2021-09-01-preview/alertruletemplates/id_workspace.go index 20a51851397..683f458f8db 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/alertruletemplates/id_workspace.go +++ b/resource-manager/securityinsights/2021-09-01-preview/alertruletemplates/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/automationrule/id_automationrule.go b/resource-manager/securityinsights/2021-09-01-preview/automationrule/id_automationrule.go index 7a3be81878d..976756375d6 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/automationrule/id_automationrule.go +++ b/resource-manager/securityinsights/2021-09-01-preview/automationrule/id_automationrule.go @@ -38,23 +38,9 @@ func ParseAutomationRuleID(input string) (*AutomationRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationRuleId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.AutomationRuleId, ok = parsed.Parsed["automationRuleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationRuleId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAutomationRuleIDInsensitively(input string) (*AutomationRuleId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AutomationRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.AutomationRuleId, ok = parsed.Parsed["automationRuleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationRuleId", *parsed) + if id.AutomationRuleId, ok = input.Parsed["automationRuleId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationRuleId", input) } - return &id, nil + return nil } // ValidateAutomationRuleID checks that 'input' can be parsed as a Automation Rule ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/automationrules/id_automationrule.go b/resource-manager/securityinsights/2021-09-01-preview/automationrules/id_automationrule.go index f69f6c204f2..1364c18fcfd 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/automationrules/id_automationrule.go +++ b/resource-manager/securityinsights/2021-09-01-preview/automationrules/id_automationrule.go @@ -38,23 +38,9 @@ func ParseAutomationRuleID(input string) (*AutomationRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationRuleId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.AutomationRuleId, ok = parsed.Parsed["automationRuleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationRuleId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAutomationRuleIDInsensitively(input string) (*AutomationRuleId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AutomationRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.AutomationRuleId, ok = parsed.Parsed["automationRuleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationRuleId", *parsed) + if id.AutomationRuleId, ok = input.Parsed["automationRuleId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationRuleId", input) } - return &id, nil + return nil } // ValidateAutomationRuleID checks that 'input' can be parsed as a Automation Rule ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/automationrules/id_workspace.go b/resource-manager/securityinsights/2021-09-01-preview/automationrules/id_workspace.go index 70e4df1da20..587424efc39 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/automationrules/id_workspace.go +++ b/resource-manager/securityinsights/2021-09-01-preview/automationrules/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/bookmark/id_bookmark.go b/resource-manager/securityinsights/2021-09-01-preview/bookmark/id_bookmark.go index 7dc45becca9..6c6172a4056 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/bookmark/id_bookmark.go +++ b/resource-manager/securityinsights/2021-09-01-preview/bookmark/id_bookmark.go @@ -38,23 +38,9 @@ func ParseBookmarkID(input string) (*BookmarkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BookmarkId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.BookmarkId, ok = parsed.Parsed["bookmarkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bookmarkId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBookmarkIDInsensitively(input string) (*BookmarkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BookmarkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BookmarkId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.BookmarkId, ok = parsed.Parsed["bookmarkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bookmarkId", *parsed) + if id.BookmarkId, ok = input.Parsed["bookmarkId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "bookmarkId", input) } - return &id, nil + return nil } // ValidateBookmarkID checks that 'input' can be parsed as a Bookmark ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/bookmarkrelations/id_bookmark.go b/resource-manager/securityinsights/2021-09-01-preview/bookmarkrelations/id_bookmark.go index f616eff4150..099a6268b24 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/bookmarkrelations/id_bookmark.go +++ b/resource-manager/securityinsights/2021-09-01-preview/bookmarkrelations/id_bookmark.go @@ -38,23 +38,9 @@ func ParseBookmarkID(input string) (*BookmarkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BookmarkId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.BookmarkId, ok = parsed.Parsed["bookmarkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bookmarkId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBookmarkIDInsensitively(input string) (*BookmarkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BookmarkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BookmarkId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.BookmarkId, ok = parsed.Parsed["bookmarkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bookmarkId", *parsed) + if id.BookmarkId, ok = input.Parsed["bookmarkId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "bookmarkId", input) } - return &id, nil + return nil } // ValidateBookmarkID checks that 'input' can be parsed as a Bookmark ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/bookmarkrelations/id_bookmarkrelation.go b/resource-manager/securityinsights/2021-09-01-preview/bookmarkrelations/id_bookmarkrelation.go index 9ad4708a7d6..7287d80950a 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/bookmarkrelations/id_bookmarkrelation.go +++ b/resource-manager/securityinsights/2021-09-01-preview/bookmarkrelations/id_bookmarkrelation.go @@ -40,27 +40,9 @@ func ParseBookmarkRelationID(input string) (*BookmarkRelationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BookmarkRelationId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.BookmarkId, ok = parsed.Parsed["bookmarkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bookmarkId", *parsed) - } - - if id.RelationName, ok = parsed.Parsed["relationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "relationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseBookmarkRelationIDInsensitively(input string) (*BookmarkRelationId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BookmarkRelationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *BookmarkRelationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.BookmarkId, ok = parsed.Parsed["bookmarkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bookmarkId", *parsed) + if id.BookmarkId, ok = input.Parsed["bookmarkId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "bookmarkId", input) } - if id.RelationName, ok = parsed.Parsed["relationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "relationName", *parsed) + if id.RelationName, ok = input.Parsed["relationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "relationName", input) } - return &id, nil + return nil } // ValidateBookmarkRelationID checks that 'input' can be parsed as a Bookmark Relation ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/bookmarks/id_bookmark.go b/resource-manager/securityinsights/2021-09-01-preview/bookmarks/id_bookmark.go index f59f1661872..370dd3f982d 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/bookmarks/id_bookmark.go +++ b/resource-manager/securityinsights/2021-09-01-preview/bookmarks/id_bookmark.go @@ -38,23 +38,9 @@ func ParseBookmarkID(input string) (*BookmarkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BookmarkId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.BookmarkId, ok = parsed.Parsed["bookmarkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bookmarkId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBookmarkIDInsensitively(input string) (*BookmarkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BookmarkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BookmarkId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.BookmarkId, ok = parsed.Parsed["bookmarkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bookmarkId", *parsed) + if id.BookmarkId, ok = input.Parsed["bookmarkId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "bookmarkId", input) } - return &id, nil + return nil } // ValidateBookmarkID checks that 'input' can be parsed as a Bookmark ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/bookmarks/id_workspace.go b/resource-manager/securityinsights/2021-09-01-preview/bookmarks/id_workspace.go index 440f411034c..f313c6bf04c 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/bookmarks/id_workspace.go +++ b/resource-manager/securityinsights/2021-09-01-preview/bookmarks/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/checkdataconnectorrequirements/id_workspace.go b/resource-manager/securityinsights/2021-09-01-preview/checkdataconnectorrequirements/id_workspace.go index 9ede2d55b21..00c34431db0 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/checkdataconnectorrequirements/id_workspace.go +++ b/resource-manager/securityinsights/2021-09-01-preview/checkdataconnectorrequirements/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/dataconnectors/id_dataconnector.go b/resource-manager/securityinsights/2021-09-01-preview/dataconnectors/id_dataconnector.go index 0b754d6b3c1..03b82a13118 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/dataconnectors/id_dataconnector.go +++ b/resource-manager/securityinsights/2021-09-01-preview/dataconnectors/id_dataconnector.go @@ -38,23 +38,9 @@ func ParseDataConnectorID(input string) (*DataConnectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataConnectorId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.DataConnectorId, ok = parsed.Parsed["dataConnectorId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataConnectorId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDataConnectorIDInsensitively(input string) (*DataConnectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataConnectorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DataConnectorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.DataConnectorId, ok = parsed.Parsed["dataConnectorId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataConnectorId", *parsed) + if id.DataConnectorId, ok = input.Parsed["dataConnectorId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataConnectorId", input) } - return &id, nil + return nil } // ValidateDataConnectorID checks that 'input' can be parsed as a Data Connector ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/dataconnectors/id_workspace.go b/resource-manager/securityinsights/2021-09-01-preview/dataconnectors/id_workspace.go index 16107cbce7b..dff523f5ff4 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/dataconnectors/id_workspace.go +++ b/resource-manager/securityinsights/2021-09-01-preview/dataconnectors/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/dataconnectorsconnect/id_dataconnector.go b/resource-manager/securityinsights/2021-09-01-preview/dataconnectorsconnect/id_dataconnector.go index ca7450f1d8b..e528c20620f 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/dataconnectorsconnect/id_dataconnector.go +++ b/resource-manager/securityinsights/2021-09-01-preview/dataconnectorsconnect/id_dataconnector.go @@ -38,23 +38,9 @@ func ParseDataConnectorID(input string) (*DataConnectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataConnectorId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.DataConnectorId, ok = parsed.Parsed["dataConnectorId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataConnectorId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDataConnectorIDInsensitively(input string) (*DataConnectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataConnectorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DataConnectorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.DataConnectorId, ok = parsed.Parsed["dataConnectorId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataConnectorId", *parsed) + if id.DataConnectorId, ok = input.Parsed["dataConnectorId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataConnectorId", input) } - return &id, nil + return nil } // ValidateDataConnectorID checks that 'input' can be parsed as a Data Connector ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/dataconnectorsdisconnect/id_dataconnector.go b/resource-manager/securityinsights/2021-09-01-preview/dataconnectorsdisconnect/id_dataconnector.go index f520d94d286..2ff583c0c56 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/dataconnectorsdisconnect/id_dataconnector.go +++ b/resource-manager/securityinsights/2021-09-01-preview/dataconnectorsdisconnect/id_dataconnector.go @@ -38,23 +38,9 @@ func ParseDataConnectorID(input string) (*DataConnectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataConnectorId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.DataConnectorId, ok = parsed.Parsed["dataConnectorId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataConnectorId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDataConnectorIDInsensitively(input string) (*DataConnectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataConnectorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DataConnectorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.DataConnectorId, ok = parsed.Parsed["dataConnectorId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataConnectorId", *parsed) + if id.DataConnectorId, ok = input.Parsed["dataConnectorId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataConnectorId", input) } - return &id, nil + return nil } // ValidateDataConnectorID checks that 'input' can be parsed as a Data Connector ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/entities/id_entity.go b/resource-manager/securityinsights/2021-09-01-preview/entities/id_entity.go index 23411d85c04..e7623d53ad9 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/entities/id_entity.go +++ b/resource-manager/securityinsights/2021-09-01-preview/entities/id_entity.go @@ -38,23 +38,9 @@ func ParseEntityID(input string) (*EntityId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EntityId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.EntityId, ok = parsed.Parsed["entityId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "entityId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseEntityIDInsensitively(input string) (*EntityId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EntityId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EntityId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.EntityId, ok = parsed.Parsed["entityId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "entityId", *parsed) + if id.EntityId, ok = input.Parsed["entityId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "entityId", input) } - return &id, nil + return nil } // ValidateEntityID checks that 'input' can be parsed as a Entity ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/entities/id_workspace.go b/resource-manager/securityinsights/2021-09-01-preview/entities/id_workspace.go index 6eb263f8173..49b335e497d 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/entities/id_workspace.go +++ b/resource-manager/securityinsights/2021-09-01-preview/entities/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/entityqueries/id_entityquery.go b/resource-manager/securityinsights/2021-09-01-preview/entityqueries/id_entityquery.go index 86235adc776..ae13b0e0137 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/entityqueries/id_entityquery.go +++ b/resource-manager/securityinsights/2021-09-01-preview/entityqueries/id_entityquery.go @@ -38,23 +38,9 @@ func ParseEntityQueryID(input string) (*EntityQueryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EntityQueryId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.EntityQueryId, ok = parsed.Parsed["entityQueryId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "entityQueryId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseEntityQueryIDInsensitively(input string) (*EntityQueryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EntityQueryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EntityQueryId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.EntityQueryId, ok = parsed.Parsed["entityQueryId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "entityQueryId", *parsed) + if id.EntityQueryId, ok = input.Parsed["entityQueryId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "entityQueryId", input) } - return &id, nil + return nil } // ValidateEntityQueryID checks that 'input' can be parsed as a Entity Query ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/entityqueries/id_entityquerytemplate.go b/resource-manager/securityinsights/2021-09-01-preview/entityqueries/id_entityquerytemplate.go index 603411e02ca..57d318c5b4f 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/entityqueries/id_entityquerytemplate.go +++ b/resource-manager/securityinsights/2021-09-01-preview/entityqueries/id_entityquerytemplate.go @@ -38,23 +38,9 @@ func ParseEntityQueryTemplateID(input string) (*EntityQueryTemplateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EntityQueryTemplateId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.EntityQueryTemplateId, ok = parsed.Parsed["entityQueryTemplateId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "entityQueryTemplateId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseEntityQueryTemplateIDInsensitively(input string) (*EntityQueryTemplate return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EntityQueryTemplateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EntityQueryTemplateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.EntityQueryTemplateId, ok = parsed.Parsed["entityQueryTemplateId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "entityQueryTemplateId", *parsed) + if id.EntityQueryTemplateId, ok = input.Parsed["entityQueryTemplateId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "entityQueryTemplateId", input) } - return &id, nil + return nil } // ValidateEntityQueryTemplateID checks that 'input' can be parsed as a Entity Query Template ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/entityqueries/id_workspace.go b/resource-manager/securityinsights/2021-09-01-preview/entityqueries/id_workspace.go index a31ed46fe0d..e20324205c5 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/entityqueries/id_workspace.go +++ b/resource-manager/securityinsights/2021-09-01-preview/entityqueries/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/entityrelations/id_entity.go b/resource-manager/securityinsights/2021-09-01-preview/entityrelations/id_entity.go index 2fa7a91cb26..6f43944c2ed 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/entityrelations/id_entity.go +++ b/resource-manager/securityinsights/2021-09-01-preview/entityrelations/id_entity.go @@ -38,23 +38,9 @@ func ParseEntityID(input string) (*EntityId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EntityId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.EntityId, ok = parsed.Parsed["entityId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "entityId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseEntityIDInsensitively(input string) (*EntityId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EntityId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EntityId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.EntityId, ok = parsed.Parsed["entityId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "entityId", *parsed) + if id.EntityId, ok = input.Parsed["entityId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "entityId", input) } - return &id, nil + return nil } // ValidateEntityID checks that 'input' can be parsed as a Entity ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/entityrelations/id_relation.go b/resource-manager/securityinsights/2021-09-01-preview/entityrelations/id_relation.go index 8b542ce03a4..39c5216f868 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/entityrelations/id_relation.go +++ b/resource-manager/securityinsights/2021-09-01-preview/entityrelations/id_relation.go @@ -40,27 +40,9 @@ func ParseRelationID(input string) (*RelationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RelationId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.EntityId, ok = parsed.Parsed["entityId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "entityId", *parsed) - } - - if id.RelationName, ok = parsed.Parsed["relationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "relationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseRelationIDInsensitively(input string) (*RelationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RelationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RelationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.EntityId, ok = parsed.Parsed["entityId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "entityId", *parsed) + if id.EntityId, ok = input.Parsed["entityId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "entityId", input) } - if id.RelationName, ok = parsed.Parsed["relationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "relationName", *parsed) + if id.RelationName, ok = input.Parsed["relationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "relationName", input) } - return &id, nil + return nil } // ValidateRelationID checks that 'input' can be parsed as a Relation ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/incidentalerts/id_incident.go b/resource-manager/securityinsights/2021-09-01-preview/incidentalerts/id_incident.go index 442e390eb90..931f3d335bd 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/incidentalerts/id_incident.go +++ b/resource-manager/securityinsights/2021-09-01-preview/incidentalerts/id_incident.go @@ -38,23 +38,9 @@ func ParseIncidentID(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIncidentIDInsensitively(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IncidentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if id.IncidentId, ok = input.Parsed["incidentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentId", input) } - return &id, nil + return nil } // ValidateIncidentID checks that 'input' can be parsed as a Incident ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/incidentbookmarks/id_incident.go b/resource-manager/securityinsights/2021-09-01-preview/incidentbookmarks/id_incident.go index dec3e45f9a0..210a9183811 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/incidentbookmarks/id_incident.go +++ b/resource-manager/securityinsights/2021-09-01-preview/incidentbookmarks/id_incident.go @@ -38,23 +38,9 @@ func ParseIncidentID(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIncidentIDInsensitively(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IncidentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if id.IncidentId, ok = input.Parsed["incidentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentId", input) } - return &id, nil + return nil } // ValidateIncidentID checks that 'input' can be parsed as a Incident ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/incidentcomments/id_comment.go b/resource-manager/securityinsights/2021-09-01-preview/incidentcomments/id_comment.go index b7ef6f3cdf2..3475bc0c083 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/incidentcomments/id_comment.go +++ b/resource-manager/securityinsights/2021-09-01-preview/incidentcomments/id_comment.go @@ -40,27 +40,9 @@ func ParseCommentID(input string) (*CommentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) - } - - if id.IncidentCommentId, ok = parsed.Parsed["incidentCommentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentCommentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseCommentIDInsensitively(input string) (*CommentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *CommentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if id.IncidentId, ok = input.Parsed["incidentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentId", input) } - if id.IncidentCommentId, ok = parsed.Parsed["incidentCommentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentCommentId", *parsed) + if id.IncidentCommentId, ok = input.Parsed["incidentCommentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentCommentId", input) } - return &id, nil + return nil } // ValidateCommentID checks that 'input' can be parsed as a Comment ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/incidentcomments/id_incident.go b/resource-manager/securityinsights/2021-09-01-preview/incidentcomments/id_incident.go index 1b1e84bf184..fda7c4b1408 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/incidentcomments/id_incident.go +++ b/resource-manager/securityinsights/2021-09-01-preview/incidentcomments/id_incident.go @@ -38,23 +38,9 @@ func ParseIncidentID(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIncidentIDInsensitively(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IncidentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if id.IncidentId, ok = input.Parsed["incidentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentId", input) } - return &id, nil + return nil } // ValidateIncidentID checks that 'input' can be parsed as a Incident ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/incidententities/id_incident.go b/resource-manager/securityinsights/2021-09-01-preview/incidententities/id_incident.go index 911487b1578..06ba92dba47 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/incidententities/id_incident.go +++ b/resource-manager/securityinsights/2021-09-01-preview/incidententities/id_incident.go @@ -38,23 +38,9 @@ func ParseIncidentID(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIncidentIDInsensitively(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IncidentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if id.IncidentId, ok = input.Parsed["incidentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentId", input) } - return &id, nil + return nil } // ValidateIncidentID checks that 'input' can be parsed as a Incident ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/incidentrelations/id_incident.go b/resource-manager/securityinsights/2021-09-01-preview/incidentrelations/id_incident.go index 8076f47c748..a1140bfb350 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/incidentrelations/id_incident.go +++ b/resource-manager/securityinsights/2021-09-01-preview/incidentrelations/id_incident.go @@ -38,23 +38,9 @@ func ParseIncidentID(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIncidentIDInsensitively(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IncidentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if id.IncidentId, ok = input.Parsed["incidentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentId", input) } - return &id, nil + return nil } // ValidateIncidentID checks that 'input' can be parsed as a Incident ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/incidentrelations/id_incidentrelation.go b/resource-manager/securityinsights/2021-09-01-preview/incidentrelations/id_incidentrelation.go index d1ad52dc35d..feaa7a706a3 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/incidentrelations/id_incidentrelation.go +++ b/resource-manager/securityinsights/2021-09-01-preview/incidentrelations/id_incidentrelation.go @@ -40,27 +40,9 @@ func ParseIncidentRelationID(input string) (*IncidentRelationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentRelationId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) - } - - if id.RelationName, ok = parsed.Parsed["relationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "relationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseIncidentRelationIDInsensitively(input string) (*IncidentRelationId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentRelationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *IncidentRelationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if id.IncidentId, ok = input.Parsed["incidentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentId", input) } - if id.RelationName, ok = parsed.Parsed["relationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "relationName", *parsed) + if id.RelationName, ok = input.Parsed["relationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "relationName", input) } - return &id, nil + return nil } // ValidateIncidentRelationID checks that 'input' can be parsed as a Incident Relation ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/incidents/id_incident.go b/resource-manager/securityinsights/2021-09-01-preview/incidents/id_incident.go index 80b715f563d..62433520e98 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/incidents/id_incident.go +++ b/resource-manager/securityinsights/2021-09-01-preview/incidents/id_incident.go @@ -38,23 +38,9 @@ func ParseIncidentID(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIncidentIDInsensitively(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IncidentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if id.IncidentId, ok = input.Parsed["incidentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentId", input) } - return &id, nil + return nil } // ValidateIncidentID checks that 'input' can be parsed as a Incident ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/incidents/id_workspace.go b/resource-manager/securityinsights/2021-09-01-preview/incidents/id_workspace.go index 47ad621406d..e06c947fdc9 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/incidents/id_workspace.go +++ b/resource-manager/securityinsights/2021-09-01-preview/incidents/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/incidentteam/id_incident.go b/resource-manager/securityinsights/2021-09-01-preview/incidentteam/id_incident.go index 3668d2bdae7..6db5a601440 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/incidentteam/id_incident.go +++ b/resource-manager/securityinsights/2021-09-01-preview/incidentteam/id_incident.go @@ -38,23 +38,9 @@ func ParseIncidentID(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIncidentIDInsensitively(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IncidentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if id.IncidentId, ok = input.Parsed["incidentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentId", input) } - return &id, nil + return nil } // ValidateIncidentID checks that 'input' can be parsed as a Incident ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/metadata/id_metadata.go b/resource-manager/securityinsights/2021-09-01-preview/metadata/id_metadata.go index 63879af6a87..b6841ed239a 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/metadata/id_metadata.go +++ b/resource-manager/securityinsights/2021-09-01-preview/metadata/id_metadata.go @@ -38,23 +38,9 @@ func ParseMetadataID(input string) (*MetadataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MetadataId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.MetadataName, ok = parsed.Parsed["metadataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "metadataName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseMetadataIDInsensitively(input string) (*MetadataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MetadataId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *MetadataId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.MetadataName, ok = parsed.Parsed["metadataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "metadataName", *parsed) + if id.MetadataName, ok = input.Parsed["metadataName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "metadataName", input) } - return &id, nil + return nil } // ValidateMetadataID checks that 'input' can be parsed as a Metadata ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/metadata/id_workspace.go b/resource-manager/securityinsights/2021-09-01-preview/metadata/id_workspace.go index d3a3931c2b9..7270d5a38ce 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/metadata/id_workspace.go +++ b/resource-manager/securityinsights/2021-09-01-preview/metadata/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/officeconsents/id_officeconsent.go b/resource-manager/securityinsights/2021-09-01-preview/officeconsents/id_officeconsent.go index 8c013ed7a6b..da6d880eff8 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/officeconsents/id_officeconsent.go +++ b/resource-manager/securityinsights/2021-09-01-preview/officeconsents/id_officeconsent.go @@ -38,23 +38,9 @@ func ParseOfficeConsentID(input string) (*OfficeConsentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OfficeConsentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ConsentId, ok = parsed.Parsed["consentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "consentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseOfficeConsentIDInsensitively(input string) (*OfficeConsentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OfficeConsentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OfficeConsentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ConsentId, ok = parsed.Parsed["consentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "consentId", *parsed) + if id.ConsentId, ok = input.Parsed["consentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "consentId", input) } - return &id, nil + return nil } // ValidateOfficeConsentID checks that 'input' can be parsed as a Office Consent ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/officeconsents/id_workspace.go b/resource-manager/securityinsights/2021-09-01-preview/officeconsents/id_workspace.go index 76951154659..65dd9f8e01d 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/officeconsents/id_workspace.go +++ b/resource-manager/securityinsights/2021-09-01-preview/officeconsents/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/repositories/id_workspace.go b/resource-manager/securityinsights/2021-09-01-preview/repositories/id_workspace.go index 5b326add181..a7004ff58a2 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/repositories/id_workspace.go +++ b/resource-manager/securityinsights/2021-09-01-preview/repositories/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/sentinelonboardingstates/id_onboardingstate.go b/resource-manager/securityinsights/2021-09-01-preview/sentinelonboardingstates/id_onboardingstate.go index 2b3c490aeed..b35b4a4b950 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/sentinelonboardingstates/id_onboardingstate.go +++ b/resource-manager/securityinsights/2021-09-01-preview/sentinelonboardingstates/id_onboardingstate.go @@ -38,23 +38,9 @@ func ParseOnboardingStateID(input string) (*OnboardingStateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OnboardingStateId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.OnboardingStateName, ok = parsed.Parsed["onboardingStateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "onboardingStateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseOnboardingStateIDInsensitively(input string) (*OnboardingStateId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OnboardingStateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OnboardingStateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.OnboardingStateName, ok = parsed.Parsed["onboardingStateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "onboardingStateName", *parsed) + if id.OnboardingStateName, ok = input.Parsed["onboardingStateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "onboardingStateName", input) } - return &id, nil + return nil } // ValidateOnboardingStateID checks that 'input' can be parsed as a Onboarding State ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/sentinelonboardingstates/id_workspace.go b/resource-manager/securityinsights/2021-09-01-preview/sentinelonboardingstates/id_workspace.go index 62eb4e2432a..de0041001bd 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/sentinelonboardingstates/id_workspace.go +++ b/resource-manager/securityinsights/2021-09-01-preview/sentinelonboardingstates/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/settings/id_setting.go b/resource-manager/securityinsights/2021-09-01-preview/settings/id_setting.go index 495b198012e..2ff34b69c19 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/settings/id_setting.go +++ b/resource-manager/securityinsights/2021-09-01-preview/settings/id_setting.go @@ -38,23 +38,9 @@ func ParseSettingID(input string) (*SettingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SettingId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.SettingName, ok = parsed.Parsed["settingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "settingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSettingIDInsensitively(input string) (*SettingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SettingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SettingId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.SettingName, ok = parsed.Parsed["settingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "settingName", *parsed) + if id.SettingName, ok = input.Parsed["settingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "settingName", input) } - return &id, nil + return nil } // ValidateSettingID checks that 'input' can be parsed as a Setting ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/settings/id_workspace.go b/resource-manager/securityinsights/2021-09-01-preview/settings/id_workspace.go index ef7f89d5a57..e1f2a969ff1 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/settings/id_workspace.go +++ b/resource-manager/securityinsights/2021-09-01-preview/settings/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/sourcecontrols/id_sourcecontrol.go b/resource-manager/securityinsights/2021-09-01-preview/sourcecontrols/id_sourcecontrol.go index 0e1cca3249e..e990a4e3a6a 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/sourcecontrols/id_sourcecontrol.go +++ b/resource-manager/securityinsights/2021-09-01-preview/sourcecontrols/id_sourcecontrol.go @@ -38,23 +38,9 @@ func ParseSourceControlID(input string) (*SourceControlId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.SourceControlId, ok = parsed.Parsed["sourceControlId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSourceControlIDInsensitively(input string) (*SourceControlId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SourceControlId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.SourceControlId, ok = parsed.Parsed["sourceControlId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlId", *parsed) + if id.SourceControlId, ok = input.Parsed["sourceControlId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sourceControlId", input) } - return &id, nil + return nil } // ValidateSourceControlID checks that 'input' can be parsed as a Source Control ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/sourcecontrols/id_workspace.go b/resource-manager/securityinsights/2021-09-01-preview/sourcecontrols/id_workspace.go index 5d57a8b7d01..faba4055ac0 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/sourcecontrols/id_workspace.go +++ b/resource-manager/securityinsights/2021-09-01-preview/sourcecontrols/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/threatintelligence/id_indicator.go b/resource-manager/securityinsights/2021-09-01-preview/threatintelligence/id_indicator.go index fe680d054de..d5a496589af 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/threatintelligence/id_indicator.go +++ b/resource-manager/securityinsights/2021-09-01-preview/threatintelligence/id_indicator.go @@ -38,23 +38,9 @@ func ParseIndicatorID(input string) (*IndicatorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IndicatorId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IndicatorName, ok = parsed.Parsed["indicatorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "indicatorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIndicatorIDInsensitively(input string) (*IndicatorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IndicatorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IndicatorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IndicatorName, ok = parsed.Parsed["indicatorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "indicatorName", *parsed) + if id.IndicatorName, ok = input.Parsed["indicatorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "indicatorName", input) } - return &id, nil + return nil } // ValidateIndicatorID checks that 'input' can be parsed as a Indicator ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/threatintelligence/id_workspace.go b/resource-manager/securityinsights/2021-09-01-preview/threatintelligence/id_workspace.go index c3245ebd1b3..dedd6c6b5e0 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/threatintelligence/id_workspace.go +++ b/resource-manager/securityinsights/2021-09-01-preview/threatintelligence/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/watchlistitems/id_watchlist.go b/resource-manager/securityinsights/2021-09-01-preview/watchlistitems/id_watchlist.go index c2ad57d7be4..3c33d154f64 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/watchlistitems/id_watchlist.go +++ b/resource-manager/securityinsights/2021-09-01-preview/watchlistitems/id_watchlist.go @@ -38,23 +38,9 @@ func ParseWatchlistID(input string) (*WatchlistId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WatchlistId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.WatchlistAlias, ok = parsed.Parsed["watchlistAlias"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWatchlistIDInsensitively(input string) (*WatchlistId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WatchlistId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WatchlistId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.WatchlistAlias, ok = parsed.Parsed["watchlistAlias"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", *parsed) + if id.WatchlistAlias, ok = input.Parsed["watchlistAlias"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", input) } - return &id, nil + return nil } // ValidateWatchlistID checks that 'input' can be parsed as a Watchlist ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/watchlistitems/id_watchlistitem.go b/resource-manager/securityinsights/2021-09-01-preview/watchlistitems/id_watchlistitem.go index d816793fdbb..25bc1347496 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/watchlistitems/id_watchlistitem.go +++ b/resource-manager/securityinsights/2021-09-01-preview/watchlistitems/id_watchlistitem.go @@ -40,27 +40,9 @@ func ParseWatchlistItemID(input string) (*WatchlistItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WatchlistItemId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.WatchlistAlias, ok = parsed.Parsed["watchlistAlias"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", *parsed) - } - - if id.WatchlistItemId, ok = parsed.Parsed["watchlistItemId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watchlistItemId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseWatchlistItemIDInsensitively(input string) (*WatchlistItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WatchlistItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *WatchlistItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.WatchlistAlias, ok = parsed.Parsed["watchlistAlias"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", *parsed) + if id.WatchlistAlias, ok = input.Parsed["watchlistAlias"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", input) } - if id.WatchlistItemId, ok = parsed.Parsed["watchlistItemId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watchlistItemId", *parsed) + if id.WatchlistItemId, ok = input.Parsed["watchlistItemId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "watchlistItemId", input) } - return &id, nil + return nil } // ValidateWatchlistItemID checks that 'input' can be parsed as a Watchlist Item ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/watchlists/id_watchlist.go b/resource-manager/securityinsights/2021-09-01-preview/watchlists/id_watchlist.go index 7d34645a067..6a04c91dc05 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/watchlists/id_watchlist.go +++ b/resource-manager/securityinsights/2021-09-01-preview/watchlists/id_watchlist.go @@ -38,23 +38,9 @@ func ParseWatchlistID(input string) (*WatchlistId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WatchlistId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.WatchlistAlias, ok = parsed.Parsed["watchlistAlias"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWatchlistIDInsensitively(input string) (*WatchlistId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WatchlistId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WatchlistId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.WatchlistAlias, ok = parsed.Parsed["watchlistAlias"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", *parsed) + if id.WatchlistAlias, ok = input.Parsed["watchlistAlias"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", input) } - return &id, nil + return nil } // ValidateWatchlistID checks that 'input' can be parsed as a Watchlist ID diff --git a/resource-manager/securityinsights/2021-09-01-preview/watchlists/id_workspace.go b/resource-manager/securityinsights/2021-09-01-preview/watchlists/id_workspace.go index 488ed03ba59..0b9bb49429f 100644 --- a/resource-manager/securityinsights/2021-09-01-preview/watchlists/id_workspace.go +++ b/resource-manager/securityinsights/2021-09-01-preview/watchlists/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/actions/id_action.go b/resource-manager/securityinsights/2022-07-01-preview/actions/id_action.go index 574eb6badaa..683be4d3ea6 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/actions/id_action.go +++ b/resource-manager/securityinsights/2022-07-01-preview/actions/id_action.go @@ -40,27 +40,9 @@ func ParseActionID(input string) (*ActionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ActionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.RuleId, ok = parsed.Parsed["ruleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleId", *parsed) - } - - if id.ActionId, ok = parsed.Parsed["actionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseActionIDInsensitively(input string) (*ActionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ActionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ActionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.RuleId, ok = parsed.Parsed["ruleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleId", *parsed) + if id.RuleId, ok = input.Parsed["ruleId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleId", input) } - if id.ActionId, ok = parsed.Parsed["actionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionId", *parsed) + if id.ActionId, ok = input.Parsed["actionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "actionId", input) } - return &id, nil + return nil } // ValidateActionID checks that 'input' can be parsed as a Action ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/actions/id_alertrule.go b/resource-manager/securityinsights/2022-07-01-preview/actions/id_alertrule.go index 3164d49f702..c93745a84fb 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/actions/id_alertrule.go +++ b/resource-manager/securityinsights/2022-07-01-preview/actions/id_alertrule.go @@ -38,23 +38,9 @@ func ParseAlertRuleID(input string) (*AlertRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertRuleId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.RuleId, ok = parsed.Parsed["ruleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAlertRuleIDInsensitively(input string) (*AlertRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AlertRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.RuleId, ok = parsed.Parsed["ruleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleId", *parsed) + if id.RuleId, ok = input.Parsed["ruleId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleId", input) } - return &id, nil + return nil } // ValidateAlertRuleID checks that 'input' can be parsed as a Alert Rule ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/alertrules/id_alertrule.go b/resource-manager/securityinsights/2022-07-01-preview/alertrules/id_alertrule.go index f7731588a47..5dcc3bbe13f 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/alertrules/id_alertrule.go +++ b/resource-manager/securityinsights/2022-07-01-preview/alertrules/id_alertrule.go @@ -38,23 +38,9 @@ func ParseAlertRuleID(input string) (*AlertRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertRuleId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.RuleId, ok = parsed.Parsed["ruleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAlertRuleIDInsensitively(input string) (*AlertRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AlertRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.RuleId, ok = parsed.Parsed["ruleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleId", *parsed) + if id.RuleId, ok = input.Parsed["ruleId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleId", input) } - return &id, nil + return nil } // ValidateAlertRuleID checks that 'input' can be parsed as a Alert Rule ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/alertrules/id_workspace.go b/resource-manager/securityinsights/2022-07-01-preview/alertrules/id_workspace.go index 0baa3a56a8a..185da699926 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/alertrules/id_workspace.go +++ b/resource-manager/securityinsights/2022-07-01-preview/alertrules/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/alertruletemplates/id_alertruletemplate.go b/resource-manager/securityinsights/2022-07-01-preview/alertruletemplates/id_alertruletemplate.go index 106e81ff68d..d66b4983828 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/alertruletemplates/id_alertruletemplate.go +++ b/resource-manager/securityinsights/2022-07-01-preview/alertruletemplates/id_alertruletemplate.go @@ -38,23 +38,9 @@ func ParseAlertRuleTemplateID(input string) (*AlertRuleTemplateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertRuleTemplateId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.AlertRuleTemplateId, ok = parsed.Parsed["alertRuleTemplateId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "alertRuleTemplateId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAlertRuleTemplateIDInsensitively(input string) (*AlertRuleTemplateId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertRuleTemplateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AlertRuleTemplateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.AlertRuleTemplateId, ok = parsed.Parsed["alertRuleTemplateId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "alertRuleTemplateId", *parsed) + if id.AlertRuleTemplateId, ok = input.Parsed["alertRuleTemplateId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "alertRuleTemplateId", input) } - return &id, nil + return nil } // ValidateAlertRuleTemplateID checks that 'input' can be parsed as a Alert Rule Template ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/alertruletemplates/id_workspace.go b/resource-manager/securityinsights/2022-07-01-preview/alertruletemplates/id_workspace.go index 20a51851397..683f458f8db 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/alertruletemplates/id_workspace.go +++ b/resource-manager/securityinsights/2022-07-01-preview/alertruletemplates/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/automationrules/id_automationrule.go b/resource-manager/securityinsights/2022-07-01-preview/automationrules/id_automationrule.go index f69f6c204f2..1364c18fcfd 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/automationrules/id_automationrule.go +++ b/resource-manager/securityinsights/2022-07-01-preview/automationrules/id_automationrule.go @@ -38,23 +38,9 @@ func ParseAutomationRuleID(input string) (*AutomationRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationRuleId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.AutomationRuleId, ok = parsed.Parsed["automationRuleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationRuleId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAutomationRuleIDInsensitively(input string) (*AutomationRuleId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AutomationRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.AutomationRuleId, ok = parsed.Parsed["automationRuleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationRuleId", *parsed) + if id.AutomationRuleId, ok = input.Parsed["automationRuleId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationRuleId", input) } - return &id, nil + return nil } // ValidateAutomationRuleID checks that 'input' can be parsed as a Automation Rule ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/automationrules/id_workspace.go b/resource-manager/securityinsights/2022-07-01-preview/automationrules/id_workspace.go index 70e4df1da20..587424efc39 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/automationrules/id_workspace.go +++ b/resource-manager/securityinsights/2022-07-01-preview/automationrules/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/bookmark/id_bookmark.go b/resource-manager/securityinsights/2022-07-01-preview/bookmark/id_bookmark.go index 7dc45becca9..6c6172a4056 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/bookmark/id_bookmark.go +++ b/resource-manager/securityinsights/2022-07-01-preview/bookmark/id_bookmark.go @@ -38,23 +38,9 @@ func ParseBookmarkID(input string) (*BookmarkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BookmarkId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.BookmarkId, ok = parsed.Parsed["bookmarkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bookmarkId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBookmarkIDInsensitively(input string) (*BookmarkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BookmarkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BookmarkId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.BookmarkId, ok = parsed.Parsed["bookmarkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bookmarkId", *parsed) + if id.BookmarkId, ok = input.Parsed["bookmarkId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "bookmarkId", input) } - return &id, nil + return nil } // ValidateBookmarkID checks that 'input' can be parsed as a Bookmark ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/bookmarkrelations/id_bookmark.go b/resource-manager/securityinsights/2022-07-01-preview/bookmarkrelations/id_bookmark.go index f616eff4150..099a6268b24 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/bookmarkrelations/id_bookmark.go +++ b/resource-manager/securityinsights/2022-07-01-preview/bookmarkrelations/id_bookmark.go @@ -38,23 +38,9 @@ func ParseBookmarkID(input string) (*BookmarkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BookmarkId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.BookmarkId, ok = parsed.Parsed["bookmarkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bookmarkId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBookmarkIDInsensitively(input string) (*BookmarkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BookmarkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BookmarkId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.BookmarkId, ok = parsed.Parsed["bookmarkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bookmarkId", *parsed) + if id.BookmarkId, ok = input.Parsed["bookmarkId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "bookmarkId", input) } - return &id, nil + return nil } // ValidateBookmarkID checks that 'input' can be parsed as a Bookmark ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/bookmarkrelations/id_bookmarkrelation.go b/resource-manager/securityinsights/2022-07-01-preview/bookmarkrelations/id_bookmarkrelation.go index 9ad4708a7d6..7287d80950a 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/bookmarkrelations/id_bookmarkrelation.go +++ b/resource-manager/securityinsights/2022-07-01-preview/bookmarkrelations/id_bookmarkrelation.go @@ -40,27 +40,9 @@ func ParseBookmarkRelationID(input string) (*BookmarkRelationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BookmarkRelationId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.BookmarkId, ok = parsed.Parsed["bookmarkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bookmarkId", *parsed) - } - - if id.RelationName, ok = parsed.Parsed["relationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "relationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseBookmarkRelationIDInsensitively(input string) (*BookmarkRelationId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BookmarkRelationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *BookmarkRelationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.BookmarkId, ok = parsed.Parsed["bookmarkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bookmarkId", *parsed) + if id.BookmarkId, ok = input.Parsed["bookmarkId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "bookmarkId", input) } - if id.RelationName, ok = parsed.Parsed["relationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "relationName", *parsed) + if id.RelationName, ok = input.Parsed["relationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "relationName", input) } - return &id, nil + return nil } // ValidateBookmarkRelationID checks that 'input' can be parsed as a Bookmark Relation ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/bookmarks/id_bookmark.go b/resource-manager/securityinsights/2022-07-01-preview/bookmarks/id_bookmark.go index f59f1661872..370dd3f982d 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/bookmarks/id_bookmark.go +++ b/resource-manager/securityinsights/2022-07-01-preview/bookmarks/id_bookmark.go @@ -38,23 +38,9 @@ func ParseBookmarkID(input string) (*BookmarkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BookmarkId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.BookmarkId, ok = parsed.Parsed["bookmarkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bookmarkId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBookmarkIDInsensitively(input string) (*BookmarkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BookmarkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BookmarkId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.BookmarkId, ok = parsed.Parsed["bookmarkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bookmarkId", *parsed) + if id.BookmarkId, ok = input.Parsed["bookmarkId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "bookmarkId", input) } - return &id, nil + return nil } // ValidateBookmarkID checks that 'input' can be parsed as a Bookmark ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/bookmarks/id_workspace.go b/resource-manager/securityinsights/2022-07-01-preview/bookmarks/id_workspace.go index 440f411034c..f313c6bf04c 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/bookmarks/id_workspace.go +++ b/resource-manager/securityinsights/2022-07-01-preview/bookmarks/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/checkdataconnectorrequirements/id_workspace.go b/resource-manager/securityinsights/2022-07-01-preview/checkdataconnectorrequirements/id_workspace.go index 9ede2d55b21..00c34431db0 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/checkdataconnectorrequirements/id_workspace.go +++ b/resource-manager/securityinsights/2022-07-01-preview/checkdataconnectorrequirements/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/dataconnectors/id_dataconnector.go b/resource-manager/securityinsights/2022-07-01-preview/dataconnectors/id_dataconnector.go index 0b754d6b3c1..03b82a13118 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/dataconnectors/id_dataconnector.go +++ b/resource-manager/securityinsights/2022-07-01-preview/dataconnectors/id_dataconnector.go @@ -38,23 +38,9 @@ func ParseDataConnectorID(input string) (*DataConnectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataConnectorId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.DataConnectorId, ok = parsed.Parsed["dataConnectorId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataConnectorId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDataConnectorIDInsensitively(input string) (*DataConnectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataConnectorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DataConnectorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.DataConnectorId, ok = parsed.Parsed["dataConnectorId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataConnectorId", *parsed) + if id.DataConnectorId, ok = input.Parsed["dataConnectorId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataConnectorId", input) } - return &id, nil + return nil } // ValidateDataConnectorID checks that 'input' can be parsed as a Data Connector ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/dataconnectors/id_workspace.go b/resource-manager/securityinsights/2022-07-01-preview/dataconnectors/id_workspace.go index 16107cbce7b..dff523f5ff4 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/dataconnectors/id_workspace.go +++ b/resource-manager/securityinsights/2022-07-01-preview/dataconnectors/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/dataconnectorsconnect/id_dataconnector.go b/resource-manager/securityinsights/2022-07-01-preview/dataconnectorsconnect/id_dataconnector.go index ca7450f1d8b..e528c20620f 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/dataconnectorsconnect/id_dataconnector.go +++ b/resource-manager/securityinsights/2022-07-01-preview/dataconnectorsconnect/id_dataconnector.go @@ -38,23 +38,9 @@ func ParseDataConnectorID(input string) (*DataConnectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataConnectorId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.DataConnectorId, ok = parsed.Parsed["dataConnectorId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataConnectorId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDataConnectorIDInsensitively(input string) (*DataConnectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataConnectorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DataConnectorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.DataConnectorId, ok = parsed.Parsed["dataConnectorId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataConnectorId", *parsed) + if id.DataConnectorId, ok = input.Parsed["dataConnectorId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataConnectorId", input) } - return &id, nil + return nil } // ValidateDataConnectorID checks that 'input' can be parsed as a Data Connector ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/dataconnectorsdisconnect/id_dataconnector.go b/resource-manager/securityinsights/2022-07-01-preview/dataconnectorsdisconnect/id_dataconnector.go index f520d94d286..2ff583c0c56 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/dataconnectorsdisconnect/id_dataconnector.go +++ b/resource-manager/securityinsights/2022-07-01-preview/dataconnectorsdisconnect/id_dataconnector.go @@ -38,23 +38,9 @@ func ParseDataConnectorID(input string) (*DataConnectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataConnectorId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.DataConnectorId, ok = parsed.Parsed["dataConnectorId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataConnectorId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDataConnectorIDInsensitively(input string) (*DataConnectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataConnectorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DataConnectorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.DataConnectorId, ok = parsed.Parsed["dataConnectorId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataConnectorId", *parsed) + if id.DataConnectorId, ok = input.Parsed["dataConnectorId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataConnectorId", input) } - return &id, nil + return nil } // ValidateDataConnectorID checks that 'input' can be parsed as a Data Connector ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/entities/id_entity.go b/resource-manager/securityinsights/2022-07-01-preview/entities/id_entity.go index 23411d85c04..e7623d53ad9 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/entities/id_entity.go +++ b/resource-manager/securityinsights/2022-07-01-preview/entities/id_entity.go @@ -38,23 +38,9 @@ func ParseEntityID(input string) (*EntityId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EntityId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.EntityId, ok = parsed.Parsed["entityId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "entityId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseEntityIDInsensitively(input string) (*EntityId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EntityId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EntityId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.EntityId, ok = parsed.Parsed["entityId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "entityId", *parsed) + if id.EntityId, ok = input.Parsed["entityId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "entityId", input) } - return &id, nil + return nil } // ValidateEntityID checks that 'input' can be parsed as a Entity ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/entities/id_workspace.go b/resource-manager/securityinsights/2022-07-01-preview/entities/id_workspace.go index 6eb263f8173..49b335e497d 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/entities/id_workspace.go +++ b/resource-manager/securityinsights/2022-07-01-preview/entities/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/entityqueries/id_entityquery.go b/resource-manager/securityinsights/2022-07-01-preview/entityqueries/id_entityquery.go index 86235adc776..ae13b0e0137 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/entityqueries/id_entityquery.go +++ b/resource-manager/securityinsights/2022-07-01-preview/entityqueries/id_entityquery.go @@ -38,23 +38,9 @@ func ParseEntityQueryID(input string) (*EntityQueryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EntityQueryId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.EntityQueryId, ok = parsed.Parsed["entityQueryId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "entityQueryId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseEntityQueryIDInsensitively(input string) (*EntityQueryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EntityQueryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EntityQueryId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.EntityQueryId, ok = parsed.Parsed["entityQueryId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "entityQueryId", *parsed) + if id.EntityQueryId, ok = input.Parsed["entityQueryId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "entityQueryId", input) } - return &id, nil + return nil } // ValidateEntityQueryID checks that 'input' can be parsed as a Entity Query ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/entityqueries/id_entityquerytemplate.go b/resource-manager/securityinsights/2022-07-01-preview/entityqueries/id_entityquerytemplate.go index 603411e02ca..57d318c5b4f 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/entityqueries/id_entityquerytemplate.go +++ b/resource-manager/securityinsights/2022-07-01-preview/entityqueries/id_entityquerytemplate.go @@ -38,23 +38,9 @@ func ParseEntityQueryTemplateID(input string) (*EntityQueryTemplateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EntityQueryTemplateId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.EntityQueryTemplateId, ok = parsed.Parsed["entityQueryTemplateId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "entityQueryTemplateId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseEntityQueryTemplateIDInsensitively(input string) (*EntityQueryTemplate return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EntityQueryTemplateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EntityQueryTemplateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.EntityQueryTemplateId, ok = parsed.Parsed["entityQueryTemplateId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "entityQueryTemplateId", *parsed) + if id.EntityQueryTemplateId, ok = input.Parsed["entityQueryTemplateId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "entityQueryTemplateId", input) } - return &id, nil + return nil } // ValidateEntityQueryTemplateID checks that 'input' can be parsed as a Entity Query Template ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/entityqueries/id_workspace.go b/resource-manager/securityinsights/2022-07-01-preview/entityqueries/id_workspace.go index a31ed46fe0d..e20324205c5 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/entityqueries/id_workspace.go +++ b/resource-manager/securityinsights/2022-07-01-preview/entityqueries/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/entityrelations/id_entity.go b/resource-manager/securityinsights/2022-07-01-preview/entityrelations/id_entity.go index 2fa7a91cb26..6f43944c2ed 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/entityrelations/id_entity.go +++ b/resource-manager/securityinsights/2022-07-01-preview/entityrelations/id_entity.go @@ -38,23 +38,9 @@ func ParseEntityID(input string) (*EntityId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EntityId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.EntityId, ok = parsed.Parsed["entityId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "entityId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseEntityIDInsensitively(input string) (*EntityId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EntityId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EntityId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.EntityId, ok = parsed.Parsed["entityId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "entityId", *parsed) + if id.EntityId, ok = input.Parsed["entityId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "entityId", input) } - return &id, nil + return nil } // ValidateEntityID checks that 'input' can be parsed as a Entity ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/entityrelations/id_relation.go b/resource-manager/securityinsights/2022-07-01-preview/entityrelations/id_relation.go index 8b542ce03a4..39c5216f868 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/entityrelations/id_relation.go +++ b/resource-manager/securityinsights/2022-07-01-preview/entityrelations/id_relation.go @@ -40,27 +40,9 @@ func ParseRelationID(input string) (*RelationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RelationId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.EntityId, ok = parsed.Parsed["entityId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "entityId", *parsed) - } - - if id.RelationName, ok = parsed.Parsed["relationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "relationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseRelationIDInsensitively(input string) (*RelationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RelationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RelationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.EntityId, ok = parsed.Parsed["entityId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "entityId", *parsed) + if id.EntityId, ok = input.Parsed["entityId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "entityId", input) } - if id.RelationName, ok = parsed.Parsed["relationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "relationName", *parsed) + if id.RelationName, ok = input.Parsed["relationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "relationName", input) } - return &id, nil + return nil } // ValidateRelationID checks that 'input' can be parsed as a Relation ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/incidentalerts/id_incident.go b/resource-manager/securityinsights/2022-07-01-preview/incidentalerts/id_incident.go index 4429779e5c7..f1a4b1b8c76 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/incidentalerts/id_incident.go +++ b/resource-manager/securityinsights/2022-07-01-preview/incidentalerts/id_incident.go @@ -38,23 +38,9 @@ func ParseIncidentID(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentIdentifier, ok = parsed.Parsed["incidentIdentifier"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentIdentifier", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIncidentIDInsensitively(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IncidentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentIdentifier, ok = parsed.Parsed["incidentIdentifier"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentIdentifier", *parsed) + if id.IncidentIdentifier, ok = input.Parsed["incidentIdentifier"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentIdentifier", input) } - return &id, nil + return nil } // ValidateIncidentID checks that 'input' can be parsed as a Incident ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/incidentbookmarks/id_incident.go b/resource-manager/securityinsights/2022-07-01-preview/incidentbookmarks/id_incident.go index d769738f208..25d8c98f695 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/incidentbookmarks/id_incident.go +++ b/resource-manager/securityinsights/2022-07-01-preview/incidentbookmarks/id_incident.go @@ -38,23 +38,9 @@ func ParseIncidentID(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentIdentifier, ok = parsed.Parsed["incidentIdentifier"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentIdentifier", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIncidentIDInsensitively(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IncidentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentIdentifier, ok = parsed.Parsed["incidentIdentifier"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentIdentifier", *parsed) + if id.IncidentIdentifier, ok = input.Parsed["incidentIdentifier"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentIdentifier", input) } - return &id, nil + return nil } // ValidateIncidentID checks that 'input' can be parsed as a Incident ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/incidentcomments/id_comment.go b/resource-manager/securityinsights/2022-07-01-preview/incidentcomments/id_comment.go index b7ef6f3cdf2..3475bc0c083 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/incidentcomments/id_comment.go +++ b/resource-manager/securityinsights/2022-07-01-preview/incidentcomments/id_comment.go @@ -40,27 +40,9 @@ func ParseCommentID(input string) (*CommentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) - } - - if id.IncidentCommentId, ok = parsed.Parsed["incidentCommentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentCommentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseCommentIDInsensitively(input string) (*CommentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *CommentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if id.IncidentId, ok = input.Parsed["incidentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentId", input) } - if id.IncidentCommentId, ok = parsed.Parsed["incidentCommentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentCommentId", *parsed) + if id.IncidentCommentId, ok = input.Parsed["incidentCommentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentCommentId", input) } - return &id, nil + return nil } // ValidateCommentID checks that 'input' can be parsed as a Comment ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/incidentcomments/id_incident.go b/resource-manager/securityinsights/2022-07-01-preview/incidentcomments/id_incident.go index 588b471a429..ce68179b424 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/incidentcomments/id_incident.go +++ b/resource-manager/securityinsights/2022-07-01-preview/incidentcomments/id_incident.go @@ -38,23 +38,9 @@ func ParseIncidentID(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentIdentifier, ok = parsed.Parsed["incidentIdentifier"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentIdentifier", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIncidentIDInsensitively(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IncidentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentIdentifier, ok = parsed.Parsed["incidentIdentifier"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentIdentifier", *parsed) + if id.IncidentIdentifier, ok = input.Parsed["incidentIdentifier"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentIdentifier", input) } - return &id, nil + return nil } // ValidateIncidentID checks that 'input' can be parsed as a Incident ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/incidententities/id_incident.go b/resource-manager/securityinsights/2022-07-01-preview/incidententities/id_incident.go index 143a4e3c13c..5967d0b45af 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/incidententities/id_incident.go +++ b/resource-manager/securityinsights/2022-07-01-preview/incidententities/id_incident.go @@ -38,23 +38,9 @@ func ParseIncidentID(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentIdentifier, ok = parsed.Parsed["incidentIdentifier"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentIdentifier", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIncidentIDInsensitively(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IncidentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentIdentifier, ok = parsed.Parsed["incidentIdentifier"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentIdentifier", *parsed) + if id.IncidentIdentifier, ok = input.Parsed["incidentIdentifier"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentIdentifier", input) } - return &id, nil + return nil } // ValidateIncidentID checks that 'input' can be parsed as a Incident ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/incidentrelations/id_incident.go b/resource-manager/securityinsights/2022-07-01-preview/incidentrelations/id_incident.go index 29a2a689df2..dec74f77d38 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/incidentrelations/id_incident.go +++ b/resource-manager/securityinsights/2022-07-01-preview/incidentrelations/id_incident.go @@ -38,23 +38,9 @@ func ParseIncidentID(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentIdentifier, ok = parsed.Parsed["incidentIdentifier"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentIdentifier", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIncidentIDInsensitively(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IncidentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentIdentifier, ok = parsed.Parsed["incidentIdentifier"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentIdentifier", *parsed) + if id.IncidentIdentifier, ok = input.Parsed["incidentIdentifier"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentIdentifier", input) } - return &id, nil + return nil } // ValidateIncidentID checks that 'input' can be parsed as a Incident ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/incidentrelations/id_incidentrelation.go b/resource-manager/securityinsights/2022-07-01-preview/incidentrelations/id_incidentrelation.go index d1ad52dc35d..feaa7a706a3 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/incidentrelations/id_incidentrelation.go +++ b/resource-manager/securityinsights/2022-07-01-preview/incidentrelations/id_incidentrelation.go @@ -40,27 +40,9 @@ func ParseIncidentRelationID(input string) (*IncidentRelationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentRelationId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) - } - - if id.RelationName, ok = parsed.Parsed["relationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "relationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseIncidentRelationIDInsensitively(input string) (*IncidentRelationId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentRelationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *IncidentRelationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if id.IncidentId, ok = input.Parsed["incidentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentId", input) } - if id.RelationName, ok = parsed.Parsed["relationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "relationName", *parsed) + if id.RelationName, ok = input.Parsed["relationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "relationName", input) } - return &id, nil + return nil } // ValidateIncidentRelationID checks that 'input' can be parsed as a Incident Relation ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/incidents/id_incident.go b/resource-manager/securityinsights/2022-07-01-preview/incidents/id_incident.go index 27f622719e1..60e6a5a7ead 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/incidents/id_incident.go +++ b/resource-manager/securityinsights/2022-07-01-preview/incidents/id_incident.go @@ -38,23 +38,9 @@ func ParseIncidentID(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentIdentifier, ok = parsed.Parsed["incidentIdentifier"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentIdentifier", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIncidentIDInsensitively(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IncidentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentIdentifier, ok = parsed.Parsed["incidentIdentifier"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentIdentifier", *parsed) + if id.IncidentIdentifier, ok = input.Parsed["incidentIdentifier"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentIdentifier", input) } - return &id, nil + return nil } // ValidateIncidentID checks that 'input' can be parsed as a Incident ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/incidents/id_workspace.go b/resource-manager/securityinsights/2022-07-01-preview/incidents/id_workspace.go index 47ad621406d..e06c947fdc9 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/incidents/id_workspace.go +++ b/resource-manager/securityinsights/2022-07-01-preview/incidents/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/incidentteam/id_incident.go b/resource-manager/securityinsights/2022-07-01-preview/incidentteam/id_incident.go index 0c5c8030554..0a0c40e6ce0 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/incidentteam/id_incident.go +++ b/resource-manager/securityinsights/2022-07-01-preview/incidentteam/id_incident.go @@ -38,23 +38,9 @@ func ParseIncidentID(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentIdentifier, ok = parsed.Parsed["incidentIdentifier"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentIdentifier", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIncidentIDInsensitively(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IncidentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentIdentifier, ok = parsed.Parsed["incidentIdentifier"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentIdentifier", *parsed) + if id.IncidentIdentifier, ok = input.Parsed["incidentIdentifier"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentIdentifier", input) } - return &id, nil + return nil } // ValidateIncidentID checks that 'input' can be parsed as a Incident ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/manualtrigger/id_incident.go b/resource-manager/securityinsights/2022-07-01-preview/manualtrigger/id_incident.go index 292c42f6cae..9071e71860d 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/manualtrigger/id_incident.go +++ b/resource-manager/securityinsights/2022-07-01-preview/manualtrigger/id_incident.go @@ -38,23 +38,9 @@ func ParseIncidentID(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentIdentifier, ok = parsed.Parsed["incidentIdentifier"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentIdentifier", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIncidentIDInsensitively(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IncidentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentIdentifier, ok = parsed.Parsed["incidentIdentifier"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentIdentifier", *parsed) + if id.IncidentIdentifier, ok = input.Parsed["incidentIdentifier"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentIdentifier", input) } - return &id, nil + return nil } // ValidateIncidentID checks that 'input' can be parsed as a Incident ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/metadata/id_metadata.go b/resource-manager/securityinsights/2022-07-01-preview/metadata/id_metadata.go index 63879af6a87..b6841ed239a 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/metadata/id_metadata.go +++ b/resource-manager/securityinsights/2022-07-01-preview/metadata/id_metadata.go @@ -38,23 +38,9 @@ func ParseMetadataID(input string) (*MetadataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MetadataId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.MetadataName, ok = parsed.Parsed["metadataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "metadataName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseMetadataIDInsensitively(input string) (*MetadataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MetadataId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *MetadataId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.MetadataName, ok = parsed.Parsed["metadataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "metadataName", *parsed) + if id.MetadataName, ok = input.Parsed["metadataName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "metadataName", input) } - return &id, nil + return nil } // ValidateMetadataID checks that 'input' can be parsed as a Metadata ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/metadata/id_workspace.go b/resource-manager/securityinsights/2022-07-01-preview/metadata/id_workspace.go index d3a3931c2b9..7270d5a38ce 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/metadata/id_workspace.go +++ b/resource-manager/securityinsights/2022-07-01-preview/metadata/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/officeconsents/id_officeconsent.go b/resource-manager/securityinsights/2022-07-01-preview/officeconsents/id_officeconsent.go index 8c013ed7a6b..da6d880eff8 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/officeconsents/id_officeconsent.go +++ b/resource-manager/securityinsights/2022-07-01-preview/officeconsents/id_officeconsent.go @@ -38,23 +38,9 @@ func ParseOfficeConsentID(input string) (*OfficeConsentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OfficeConsentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ConsentId, ok = parsed.Parsed["consentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "consentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseOfficeConsentIDInsensitively(input string) (*OfficeConsentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OfficeConsentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OfficeConsentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ConsentId, ok = parsed.Parsed["consentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "consentId", *parsed) + if id.ConsentId, ok = input.Parsed["consentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "consentId", input) } - return &id, nil + return nil } // ValidateOfficeConsentID checks that 'input' can be parsed as a Office Consent ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/officeconsents/id_workspace.go b/resource-manager/securityinsights/2022-07-01-preview/officeconsents/id_workspace.go index 76951154659..65dd9f8e01d 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/officeconsents/id_workspace.go +++ b/resource-manager/securityinsights/2022-07-01-preview/officeconsents/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/repositories/id_workspace.go b/resource-manager/securityinsights/2022-07-01-preview/repositories/id_workspace.go index 5b326add181..a7004ff58a2 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/repositories/id_workspace.go +++ b/resource-manager/securityinsights/2022-07-01-preview/repositories/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/securitymlanalyticssettings/id_securitymlanalyticssetting.go b/resource-manager/securityinsights/2022-07-01-preview/securitymlanalyticssettings/id_securitymlanalyticssetting.go index e67cc6eb48b..7885847c0a2 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/securitymlanalyticssettings/id_securitymlanalyticssetting.go +++ b/resource-manager/securityinsights/2022-07-01-preview/securitymlanalyticssettings/id_securitymlanalyticssetting.go @@ -38,23 +38,9 @@ func ParseSecurityMLAnalyticsSettingID(input string) (*SecurityMLAnalyticsSettin return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecurityMLAnalyticsSettingId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.SecurityMLAnalyticsSettingName, ok = parsed.Parsed["securityMLAnalyticsSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityMLAnalyticsSettingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSecurityMLAnalyticsSettingIDInsensitively(input string) (*SecurityMLAn return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecurityMLAnalyticsSettingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SecurityMLAnalyticsSettingId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.SecurityMLAnalyticsSettingName, ok = parsed.Parsed["securityMLAnalyticsSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityMLAnalyticsSettingName", *parsed) + if id.SecurityMLAnalyticsSettingName, ok = input.Parsed["securityMLAnalyticsSettingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "securityMLAnalyticsSettingName", input) } - return &id, nil + return nil } // ValidateSecurityMLAnalyticsSettingID checks that 'input' can be parsed as a Security M L Analytics Setting ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/securitymlanalyticssettings/id_workspace.go b/resource-manager/securityinsights/2022-07-01-preview/securitymlanalyticssettings/id_workspace.go index 6459961e86c..d1adff70323 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/securitymlanalyticssettings/id_workspace.go +++ b/resource-manager/securityinsights/2022-07-01-preview/securitymlanalyticssettings/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/sentinelonboardingstates/id_onboardingstate.go b/resource-manager/securityinsights/2022-07-01-preview/sentinelonboardingstates/id_onboardingstate.go index 2b3c490aeed..b35b4a4b950 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/sentinelonboardingstates/id_onboardingstate.go +++ b/resource-manager/securityinsights/2022-07-01-preview/sentinelonboardingstates/id_onboardingstate.go @@ -38,23 +38,9 @@ func ParseOnboardingStateID(input string) (*OnboardingStateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OnboardingStateId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.OnboardingStateName, ok = parsed.Parsed["onboardingStateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "onboardingStateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseOnboardingStateIDInsensitively(input string) (*OnboardingStateId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OnboardingStateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OnboardingStateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.OnboardingStateName, ok = parsed.Parsed["onboardingStateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "onboardingStateName", *parsed) + if id.OnboardingStateName, ok = input.Parsed["onboardingStateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "onboardingStateName", input) } - return &id, nil + return nil } // ValidateOnboardingStateID checks that 'input' can be parsed as a Onboarding State ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/sentinelonboardingstates/id_workspace.go b/resource-manager/securityinsights/2022-07-01-preview/sentinelonboardingstates/id_workspace.go index 62eb4e2432a..de0041001bd 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/sentinelonboardingstates/id_workspace.go +++ b/resource-manager/securityinsights/2022-07-01-preview/sentinelonboardingstates/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/settings/id_setting.go b/resource-manager/securityinsights/2022-07-01-preview/settings/id_setting.go index 495b198012e..2ff34b69c19 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/settings/id_setting.go +++ b/resource-manager/securityinsights/2022-07-01-preview/settings/id_setting.go @@ -38,23 +38,9 @@ func ParseSettingID(input string) (*SettingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SettingId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.SettingName, ok = parsed.Parsed["settingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "settingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSettingIDInsensitively(input string) (*SettingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SettingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SettingId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.SettingName, ok = parsed.Parsed["settingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "settingName", *parsed) + if id.SettingName, ok = input.Parsed["settingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "settingName", input) } - return &id, nil + return nil } // ValidateSettingID checks that 'input' can be parsed as a Setting ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/settings/id_workspace.go b/resource-manager/securityinsights/2022-07-01-preview/settings/id_workspace.go index ef7f89d5a57..e1f2a969ff1 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/settings/id_workspace.go +++ b/resource-manager/securityinsights/2022-07-01-preview/settings/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/sourcecontrols/id_sourcecontrol.go b/resource-manager/securityinsights/2022-07-01-preview/sourcecontrols/id_sourcecontrol.go index 0e1cca3249e..e990a4e3a6a 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/sourcecontrols/id_sourcecontrol.go +++ b/resource-manager/securityinsights/2022-07-01-preview/sourcecontrols/id_sourcecontrol.go @@ -38,23 +38,9 @@ func ParseSourceControlID(input string) (*SourceControlId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.SourceControlId, ok = parsed.Parsed["sourceControlId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSourceControlIDInsensitively(input string) (*SourceControlId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SourceControlId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.SourceControlId, ok = parsed.Parsed["sourceControlId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlId", *parsed) + if id.SourceControlId, ok = input.Parsed["sourceControlId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sourceControlId", input) } - return &id, nil + return nil } // ValidateSourceControlID checks that 'input' can be parsed as a Source Control ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/sourcecontrols/id_workspace.go b/resource-manager/securityinsights/2022-07-01-preview/sourcecontrols/id_workspace.go index 5d57a8b7d01..faba4055ac0 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/sourcecontrols/id_workspace.go +++ b/resource-manager/securityinsights/2022-07-01-preview/sourcecontrols/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/threatintelligence/id_indicator.go b/resource-manager/securityinsights/2022-07-01-preview/threatintelligence/id_indicator.go index fe680d054de..d5a496589af 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/threatintelligence/id_indicator.go +++ b/resource-manager/securityinsights/2022-07-01-preview/threatintelligence/id_indicator.go @@ -38,23 +38,9 @@ func ParseIndicatorID(input string) (*IndicatorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IndicatorId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IndicatorName, ok = parsed.Parsed["indicatorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "indicatorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIndicatorIDInsensitively(input string) (*IndicatorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IndicatorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IndicatorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IndicatorName, ok = parsed.Parsed["indicatorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "indicatorName", *parsed) + if id.IndicatorName, ok = input.Parsed["indicatorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "indicatorName", input) } - return &id, nil + return nil } // ValidateIndicatorID checks that 'input' can be parsed as a Indicator ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/threatintelligence/id_workspace.go b/resource-manager/securityinsights/2022-07-01-preview/threatintelligence/id_workspace.go index c3245ebd1b3..dedd6c6b5e0 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/threatintelligence/id_workspace.go +++ b/resource-manager/securityinsights/2022-07-01-preview/threatintelligence/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/watchlistitems/id_watchlist.go b/resource-manager/securityinsights/2022-07-01-preview/watchlistitems/id_watchlist.go index c2ad57d7be4..3c33d154f64 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/watchlistitems/id_watchlist.go +++ b/resource-manager/securityinsights/2022-07-01-preview/watchlistitems/id_watchlist.go @@ -38,23 +38,9 @@ func ParseWatchlistID(input string) (*WatchlistId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WatchlistId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.WatchlistAlias, ok = parsed.Parsed["watchlistAlias"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWatchlistIDInsensitively(input string) (*WatchlistId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WatchlistId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WatchlistId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.WatchlistAlias, ok = parsed.Parsed["watchlistAlias"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", *parsed) + if id.WatchlistAlias, ok = input.Parsed["watchlistAlias"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", input) } - return &id, nil + return nil } // ValidateWatchlistID checks that 'input' can be parsed as a Watchlist ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/watchlistitems/id_watchlistitem.go b/resource-manager/securityinsights/2022-07-01-preview/watchlistitems/id_watchlistitem.go index d816793fdbb..25bc1347496 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/watchlistitems/id_watchlistitem.go +++ b/resource-manager/securityinsights/2022-07-01-preview/watchlistitems/id_watchlistitem.go @@ -40,27 +40,9 @@ func ParseWatchlistItemID(input string) (*WatchlistItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WatchlistItemId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.WatchlistAlias, ok = parsed.Parsed["watchlistAlias"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", *parsed) - } - - if id.WatchlistItemId, ok = parsed.Parsed["watchlistItemId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watchlistItemId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseWatchlistItemIDInsensitively(input string) (*WatchlistItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WatchlistItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *WatchlistItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.WatchlistAlias, ok = parsed.Parsed["watchlistAlias"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", *parsed) + if id.WatchlistAlias, ok = input.Parsed["watchlistAlias"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", input) } - if id.WatchlistItemId, ok = parsed.Parsed["watchlistItemId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watchlistItemId", *parsed) + if id.WatchlistItemId, ok = input.Parsed["watchlistItemId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "watchlistItemId", input) } - return &id, nil + return nil } // ValidateWatchlistItemID checks that 'input' can be parsed as a Watchlist Item ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/watchlists/id_watchlist.go b/resource-manager/securityinsights/2022-07-01-preview/watchlists/id_watchlist.go index 7d34645a067..6a04c91dc05 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/watchlists/id_watchlist.go +++ b/resource-manager/securityinsights/2022-07-01-preview/watchlists/id_watchlist.go @@ -38,23 +38,9 @@ func ParseWatchlistID(input string) (*WatchlistId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WatchlistId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.WatchlistAlias, ok = parsed.Parsed["watchlistAlias"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWatchlistIDInsensitively(input string) (*WatchlistId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WatchlistId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WatchlistId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.WatchlistAlias, ok = parsed.Parsed["watchlistAlias"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", *parsed) + if id.WatchlistAlias, ok = input.Parsed["watchlistAlias"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", input) } - return &id, nil + return nil } // ValidateWatchlistID checks that 'input' can be parsed as a Watchlist ID diff --git a/resource-manager/securityinsights/2022-07-01-preview/watchlists/id_workspace.go b/resource-manager/securityinsights/2022-07-01-preview/watchlists/id_workspace.go index 488ed03ba59..0b9bb49429f 100644 --- a/resource-manager/securityinsights/2022-07-01-preview/watchlists/id_workspace.go +++ b/resource-manager/securityinsights/2022-07-01-preview/watchlists/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-08-01/actions/id_action.go b/resource-manager/securityinsights/2022-08-01/actions/id_action.go index 574eb6badaa..683be4d3ea6 100644 --- a/resource-manager/securityinsights/2022-08-01/actions/id_action.go +++ b/resource-manager/securityinsights/2022-08-01/actions/id_action.go @@ -40,27 +40,9 @@ func ParseActionID(input string) (*ActionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ActionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.RuleId, ok = parsed.Parsed["ruleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleId", *parsed) - } - - if id.ActionId, ok = parsed.Parsed["actionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseActionIDInsensitively(input string) (*ActionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ActionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ActionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.RuleId, ok = parsed.Parsed["ruleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleId", *parsed) + if id.RuleId, ok = input.Parsed["ruleId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleId", input) } - if id.ActionId, ok = parsed.Parsed["actionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionId", *parsed) + if id.ActionId, ok = input.Parsed["actionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "actionId", input) } - return &id, nil + return nil } // ValidateActionID checks that 'input' can be parsed as a Action ID diff --git a/resource-manager/securityinsights/2022-08-01/actions/id_alertrule.go b/resource-manager/securityinsights/2022-08-01/actions/id_alertrule.go index 3164d49f702..c93745a84fb 100644 --- a/resource-manager/securityinsights/2022-08-01/actions/id_alertrule.go +++ b/resource-manager/securityinsights/2022-08-01/actions/id_alertrule.go @@ -38,23 +38,9 @@ func ParseAlertRuleID(input string) (*AlertRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertRuleId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.RuleId, ok = parsed.Parsed["ruleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAlertRuleIDInsensitively(input string) (*AlertRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AlertRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.RuleId, ok = parsed.Parsed["ruleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleId", *parsed) + if id.RuleId, ok = input.Parsed["ruleId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleId", input) } - return &id, nil + return nil } // ValidateAlertRuleID checks that 'input' can be parsed as a Alert Rule ID diff --git a/resource-manager/securityinsights/2022-08-01/alertrules/id_alertrule.go b/resource-manager/securityinsights/2022-08-01/alertrules/id_alertrule.go index f7731588a47..5dcc3bbe13f 100644 --- a/resource-manager/securityinsights/2022-08-01/alertrules/id_alertrule.go +++ b/resource-manager/securityinsights/2022-08-01/alertrules/id_alertrule.go @@ -38,23 +38,9 @@ func ParseAlertRuleID(input string) (*AlertRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertRuleId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.RuleId, ok = parsed.Parsed["ruleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAlertRuleIDInsensitively(input string) (*AlertRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AlertRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.RuleId, ok = parsed.Parsed["ruleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleId", *parsed) + if id.RuleId, ok = input.Parsed["ruleId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleId", input) } - return &id, nil + return nil } // ValidateAlertRuleID checks that 'input' can be parsed as a Alert Rule ID diff --git a/resource-manager/securityinsights/2022-08-01/alertrules/id_workspace.go b/resource-manager/securityinsights/2022-08-01/alertrules/id_workspace.go index 0baa3a56a8a..185da699926 100644 --- a/resource-manager/securityinsights/2022-08-01/alertrules/id_workspace.go +++ b/resource-manager/securityinsights/2022-08-01/alertrules/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-08-01/alertruletemplates/id_alertruletemplate.go b/resource-manager/securityinsights/2022-08-01/alertruletemplates/id_alertruletemplate.go index 106e81ff68d..d66b4983828 100644 --- a/resource-manager/securityinsights/2022-08-01/alertruletemplates/id_alertruletemplate.go +++ b/resource-manager/securityinsights/2022-08-01/alertruletemplates/id_alertruletemplate.go @@ -38,23 +38,9 @@ func ParseAlertRuleTemplateID(input string) (*AlertRuleTemplateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertRuleTemplateId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.AlertRuleTemplateId, ok = parsed.Parsed["alertRuleTemplateId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "alertRuleTemplateId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAlertRuleTemplateIDInsensitively(input string) (*AlertRuleTemplateId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertRuleTemplateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AlertRuleTemplateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.AlertRuleTemplateId, ok = parsed.Parsed["alertRuleTemplateId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "alertRuleTemplateId", *parsed) + if id.AlertRuleTemplateId, ok = input.Parsed["alertRuleTemplateId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "alertRuleTemplateId", input) } - return &id, nil + return nil } // ValidateAlertRuleTemplateID checks that 'input' can be parsed as a Alert Rule Template ID diff --git a/resource-manager/securityinsights/2022-08-01/alertruletemplates/id_workspace.go b/resource-manager/securityinsights/2022-08-01/alertruletemplates/id_workspace.go index 20a51851397..683f458f8db 100644 --- a/resource-manager/securityinsights/2022-08-01/alertruletemplates/id_workspace.go +++ b/resource-manager/securityinsights/2022-08-01/alertruletemplates/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-08-01/automationrules/id_automationrule.go b/resource-manager/securityinsights/2022-08-01/automationrules/id_automationrule.go index f69f6c204f2..1364c18fcfd 100644 --- a/resource-manager/securityinsights/2022-08-01/automationrules/id_automationrule.go +++ b/resource-manager/securityinsights/2022-08-01/automationrules/id_automationrule.go @@ -38,23 +38,9 @@ func ParseAutomationRuleID(input string) (*AutomationRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationRuleId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.AutomationRuleId, ok = parsed.Parsed["automationRuleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationRuleId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAutomationRuleIDInsensitively(input string) (*AutomationRuleId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AutomationRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.AutomationRuleId, ok = parsed.Parsed["automationRuleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationRuleId", *parsed) + if id.AutomationRuleId, ok = input.Parsed["automationRuleId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationRuleId", input) } - return &id, nil + return nil } // ValidateAutomationRuleID checks that 'input' can be parsed as a Automation Rule ID diff --git a/resource-manager/securityinsights/2022-08-01/automationrules/id_workspace.go b/resource-manager/securityinsights/2022-08-01/automationrules/id_workspace.go index 70e4df1da20..587424efc39 100644 --- a/resource-manager/securityinsights/2022-08-01/automationrules/id_workspace.go +++ b/resource-manager/securityinsights/2022-08-01/automationrules/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-08-01/bookmarks/id_bookmark.go b/resource-manager/securityinsights/2022-08-01/bookmarks/id_bookmark.go index f59f1661872..370dd3f982d 100644 --- a/resource-manager/securityinsights/2022-08-01/bookmarks/id_bookmark.go +++ b/resource-manager/securityinsights/2022-08-01/bookmarks/id_bookmark.go @@ -38,23 +38,9 @@ func ParseBookmarkID(input string) (*BookmarkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BookmarkId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.BookmarkId, ok = parsed.Parsed["bookmarkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bookmarkId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBookmarkIDInsensitively(input string) (*BookmarkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BookmarkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BookmarkId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.BookmarkId, ok = parsed.Parsed["bookmarkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bookmarkId", *parsed) + if id.BookmarkId, ok = input.Parsed["bookmarkId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "bookmarkId", input) } - return &id, nil + return nil } // ValidateBookmarkID checks that 'input' can be parsed as a Bookmark ID diff --git a/resource-manager/securityinsights/2022-08-01/bookmarks/id_workspace.go b/resource-manager/securityinsights/2022-08-01/bookmarks/id_workspace.go index 440f411034c..f313c6bf04c 100644 --- a/resource-manager/securityinsights/2022-08-01/bookmarks/id_workspace.go +++ b/resource-manager/securityinsights/2022-08-01/bookmarks/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-08-01/dataconnectors/id_dataconnector.go b/resource-manager/securityinsights/2022-08-01/dataconnectors/id_dataconnector.go index 0b754d6b3c1..03b82a13118 100644 --- a/resource-manager/securityinsights/2022-08-01/dataconnectors/id_dataconnector.go +++ b/resource-manager/securityinsights/2022-08-01/dataconnectors/id_dataconnector.go @@ -38,23 +38,9 @@ func ParseDataConnectorID(input string) (*DataConnectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataConnectorId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.DataConnectorId, ok = parsed.Parsed["dataConnectorId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataConnectorId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDataConnectorIDInsensitively(input string) (*DataConnectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataConnectorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DataConnectorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.DataConnectorId, ok = parsed.Parsed["dataConnectorId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataConnectorId", *parsed) + if id.DataConnectorId, ok = input.Parsed["dataConnectorId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataConnectorId", input) } - return &id, nil + return nil } // ValidateDataConnectorID checks that 'input' can be parsed as a Data Connector ID diff --git a/resource-manager/securityinsights/2022-08-01/dataconnectors/id_workspace.go b/resource-manager/securityinsights/2022-08-01/dataconnectors/id_workspace.go index 16107cbce7b..dff523f5ff4 100644 --- a/resource-manager/securityinsights/2022-08-01/dataconnectors/id_workspace.go +++ b/resource-manager/securityinsights/2022-08-01/dataconnectors/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-08-01/incidentalerts/id_incident.go b/resource-manager/securityinsights/2022-08-01/incidentalerts/id_incident.go index 442e390eb90..931f3d335bd 100644 --- a/resource-manager/securityinsights/2022-08-01/incidentalerts/id_incident.go +++ b/resource-manager/securityinsights/2022-08-01/incidentalerts/id_incident.go @@ -38,23 +38,9 @@ func ParseIncidentID(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIncidentIDInsensitively(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IncidentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if id.IncidentId, ok = input.Parsed["incidentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentId", input) } - return &id, nil + return nil } // ValidateIncidentID checks that 'input' can be parsed as a Incident ID diff --git a/resource-manager/securityinsights/2022-08-01/incidentbookmarks/id_incident.go b/resource-manager/securityinsights/2022-08-01/incidentbookmarks/id_incident.go index dec3e45f9a0..210a9183811 100644 --- a/resource-manager/securityinsights/2022-08-01/incidentbookmarks/id_incident.go +++ b/resource-manager/securityinsights/2022-08-01/incidentbookmarks/id_incident.go @@ -38,23 +38,9 @@ func ParseIncidentID(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIncidentIDInsensitively(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IncidentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if id.IncidentId, ok = input.Parsed["incidentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentId", input) } - return &id, nil + return nil } // ValidateIncidentID checks that 'input' can be parsed as a Incident ID diff --git a/resource-manager/securityinsights/2022-08-01/incidentcomments/id_comment.go b/resource-manager/securityinsights/2022-08-01/incidentcomments/id_comment.go index b7ef6f3cdf2..3475bc0c083 100644 --- a/resource-manager/securityinsights/2022-08-01/incidentcomments/id_comment.go +++ b/resource-manager/securityinsights/2022-08-01/incidentcomments/id_comment.go @@ -40,27 +40,9 @@ func ParseCommentID(input string) (*CommentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) - } - - if id.IncidentCommentId, ok = parsed.Parsed["incidentCommentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentCommentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseCommentIDInsensitively(input string) (*CommentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *CommentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if id.IncidentId, ok = input.Parsed["incidentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentId", input) } - if id.IncidentCommentId, ok = parsed.Parsed["incidentCommentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentCommentId", *parsed) + if id.IncidentCommentId, ok = input.Parsed["incidentCommentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentCommentId", input) } - return &id, nil + return nil } // ValidateCommentID checks that 'input' can be parsed as a Comment ID diff --git a/resource-manager/securityinsights/2022-08-01/incidentcomments/id_incident.go b/resource-manager/securityinsights/2022-08-01/incidentcomments/id_incident.go index 1b1e84bf184..fda7c4b1408 100644 --- a/resource-manager/securityinsights/2022-08-01/incidentcomments/id_incident.go +++ b/resource-manager/securityinsights/2022-08-01/incidentcomments/id_incident.go @@ -38,23 +38,9 @@ func ParseIncidentID(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIncidentIDInsensitively(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IncidentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if id.IncidentId, ok = input.Parsed["incidentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentId", input) } - return &id, nil + return nil } // ValidateIncidentID checks that 'input' can be parsed as a Incident ID diff --git a/resource-manager/securityinsights/2022-08-01/incidententities/id_incident.go b/resource-manager/securityinsights/2022-08-01/incidententities/id_incident.go index 911487b1578..06ba92dba47 100644 --- a/resource-manager/securityinsights/2022-08-01/incidententities/id_incident.go +++ b/resource-manager/securityinsights/2022-08-01/incidententities/id_incident.go @@ -38,23 +38,9 @@ func ParseIncidentID(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIncidentIDInsensitively(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IncidentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if id.IncidentId, ok = input.Parsed["incidentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentId", input) } - return &id, nil + return nil } // ValidateIncidentID checks that 'input' can be parsed as a Incident ID diff --git a/resource-manager/securityinsights/2022-08-01/incidentrelations/id_incident.go b/resource-manager/securityinsights/2022-08-01/incidentrelations/id_incident.go index 8076f47c748..a1140bfb350 100644 --- a/resource-manager/securityinsights/2022-08-01/incidentrelations/id_incident.go +++ b/resource-manager/securityinsights/2022-08-01/incidentrelations/id_incident.go @@ -38,23 +38,9 @@ func ParseIncidentID(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIncidentIDInsensitively(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IncidentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if id.IncidentId, ok = input.Parsed["incidentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentId", input) } - return &id, nil + return nil } // ValidateIncidentID checks that 'input' can be parsed as a Incident ID diff --git a/resource-manager/securityinsights/2022-08-01/incidentrelations/id_relation.go b/resource-manager/securityinsights/2022-08-01/incidentrelations/id_relation.go index 0a59bcf7664..34b4fb46e10 100644 --- a/resource-manager/securityinsights/2022-08-01/incidentrelations/id_relation.go +++ b/resource-manager/securityinsights/2022-08-01/incidentrelations/id_relation.go @@ -40,27 +40,9 @@ func ParseRelationID(input string) (*RelationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RelationId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) - } - - if id.RelationName, ok = parsed.Parsed["relationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "relationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseRelationIDInsensitively(input string) (*RelationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RelationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RelationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if id.IncidentId, ok = input.Parsed["incidentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentId", input) } - if id.RelationName, ok = parsed.Parsed["relationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "relationName", *parsed) + if id.RelationName, ok = input.Parsed["relationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "relationName", input) } - return &id, nil + return nil } // ValidateRelationID checks that 'input' can be parsed as a Relation ID diff --git a/resource-manager/securityinsights/2022-08-01/incidents/id_incident.go b/resource-manager/securityinsights/2022-08-01/incidents/id_incident.go index 80b715f563d..62433520e98 100644 --- a/resource-manager/securityinsights/2022-08-01/incidents/id_incident.go +++ b/resource-manager/securityinsights/2022-08-01/incidents/id_incident.go @@ -38,23 +38,9 @@ func ParseIncidentID(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIncidentIDInsensitively(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IncidentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if id.IncidentId, ok = input.Parsed["incidentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentId", input) } - return &id, nil + return nil } // ValidateIncidentID checks that 'input' can be parsed as a Incident ID diff --git a/resource-manager/securityinsights/2022-08-01/incidents/id_workspace.go b/resource-manager/securityinsights/2022-08-01/incidents/id_workspace.go index 47ad621406d..e06c947fdc9 100644 --- a/resource-manager/securityinsights/2022-08-01/incidents/id_workspace.go +++ b/resource-manager/securityinsights/2022-08-01/incidents/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-08-01/sentinelonboardingstates/id_onboardingstate.go b/resource-manager/securityinsights/2022-08-01/sentinelonboardingstates/id_onboardingstate.go index 2b3c490aeed..b35b4a4b950 100644 --- a/resource-manager/securityinsights/2022-08-01/sentinelonboardingstates/id_onboardingstate.go +++ b/resource-manager/securityinsights/2022-08-01/sentinelonboardingstates/id_onboardingstate.go @@ -38,23 +38,9 @@ func ParseOnboardingStateID(input string) (*OnboardingStateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OnboardingStateId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.OnboardingStateName, ok = parsed.Parsed["onboardingStateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "onboardingStateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseOnboardingStateIDInsensitively(input string) (*OnboardingStateId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OnboardingStateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OnboardingStateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.OnboardingStateName, ok = parsed.Parsed["onboardingStateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "onboardingStateName", *parsed) + if id.OnboardingStateName, ok = input.Parsed["onboardingStateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "onboardingStateName", input) } - return &id, nil + return nil } // ValidateOnboardingStateID checks that 'input' can be parsed as a Onboarding State ID diff --git a/resource-manager/securityinsights/2022-08-01/sentinelonboardingstates/id_workspace.go b/resource-manager/securityinsights/2022-08-01/sentinelonboardingstates/id_workspace.go index 62eb4e2432a..de0041001bd 100644 --- a/resource-manager/securityinsights/2022-08-01/sentinelonboardingstates/id_workspace.go +++ b/resource-manager/securityinsights/2022-08-01/sentinelonboardingstates/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-08-01/threatintelligence/id_indicator.go b/resource-manager/securityinsights/2022-08-01/threatintelligence/id_indicator.go index fe680d054de..d5a496589af 100644 --- a/resource-manager/securityinsights/2022-08-01/threatintelligence/id_indicator.go +++ b/resource-manager/securityinsights/2022-08-01/threatintelligence/id_indicator.go @@ -38,23 +38,9 @@ func ParseIndicatorID(input string) (*IndicatorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IndicatorId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IndicatorName, ok = parsed.Parsed["indicatorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "indicatorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIndicatorIDInsensitively(input string) (*IndicatorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IndicatorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IndicatorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IndicatorName, ok = parsed.Parsed["indicatorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "indicatorName", *parsed) + if id.IndicatorName, ok = input.Parsed["indicatorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "indicatorName", input) } - return &id, nil + return nil } // ValidateIndicatorID checks that 'input' can be parsed as a Indicator ID diff --git a/resource-manager/securityinsights/2022-08-01/threatintelligence/id_workspace.go b/resource-manager/securityinsights/2022-08-01/threatintelligence/id_workspace.go index c3245ebd1b3..dedd6c6b5e0 100644 --- a/resource-manager/securityinsights/2022-08-01/threatintelligence/id_workspace.go +++ b/resource-manager/securityinsights/2022-08-01/threatintelligence/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-08-01/watchlistitems/id_watchlist.go b/resource-manager/securityinsights/2022-08-01/watchlistitems/id_watchlist.go index c2ad57d7be4..3c33d154f64 100644 --- a/resource-manager/securityinsights/2022-08-01/watchlistitems/id_watchlist.go +++ b/resource-manager/securityinsights/2022-08-01/watchlistitems/id_watchlist.go @@ -38,23 +38,9 @@ func ParseWatchlistID(input string) (*WatchlistId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WatchlistId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.WatchlistAlias, ok = parsed.Parsed["watchlistAlias"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWatchlistIDInsensitively(input string) (*WatchlistId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WatchlistId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WatchlistId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.WatchlistAlias, ok = parsed.Parsed["watchlistAlias"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", *parsed) + if id.WatchlistAlias, ok = input.Parsed["watchlistAlias"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", input) } - return &id, nil + return nil } // ValidateWatchlistID checks that 'input' can be parsed as a Watchlist ID diff --git a/resource-manager/securityinsights/2022-08-01/watchlistitems/id_watchlistitem.go b/resource-manager/securityinsights/2022-08-01/watchlistitems/id_watchlistitem.go index d816793fdbb..25bc1347496 100644 --- a/resource-manager/securityinsights/2022-08-01/watchlistitems/id_watchlistitem.go +++ b/resource-manager/securityinsights/2022-08-01/watchlistitems/id_watchlistitem.go @@ -40,27 +40,9 @@ func ParseWatchlistItemID(input string) (*WatchlistItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WatchlistItemId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.WatchlistAlias, ok = parsed.Parsed["watchlistAlias"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", *parsed) - } - - if id.WatchlistItemId, ok = parsed.Parsed["watchlistItemId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watchlistItemId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseWatchlistItemIDInsensitively(input string) (*WatchlistItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WatchlistItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *WatchlistItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.WatchlistAlias, ok = parsed.Parsed["watchlistAlias"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", *parsed) + if id.WatchlistAlias, ok = input.Parsed["watchlistAlias"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", input) } - if id.WatchlistItemId, ok = parsed.Parsed["watchlistItemId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watchlistItemId", *parsed) + if id.WatchlistItemId, ok = input.Parsed["watchlistItemId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "watchlistItemId", input) } - return &id, nil + return nil } // ValidateWatchlistItemID checks that 'input' can be parsed as a Watchlist Item ID diff --git a/resource-manager/securityinsights/2022-08-01/watchlists/id_watchlist.go b/resource-manager/securityinsights/2022-08-01/watchlists/id_watchlist.go index 7d34645a067..6a04c91dc05 100644 --- a/resource-manager/securityinsights/2022-08-01/watchlists/id_watchlist.go +++ b/resource-manager/securityinsights/2022-08-01/watchlists/id_watchlist.go @@ -38,23 +38,9 @@ func ParseWatchlistID(input string) (*WatchlistId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WatchlistId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.WatchlistAlias, ok = parsed.Parsed["watchlistAlias"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWatchlistIDInsensitively(input string) (*WatchlistId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WatchlistId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WatchlistId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.WatchlistAlias, ok = parsed.Parsed["watchlistAlias"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", *parsed) + if id.WatchlistAlias, ok = input.Parsed["watchlistAlias"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", input) } - return &id, nil + return nil } // ValidateWatchlistID checks that 'input' can be parsed as a Watchlist ID diff --git a/resource-manager/securityinsights/2022-08-01/watchlists/id_workspace.go b/resource-manager/securityinsights/2022-08-01/watchlists/id_workspace.go index 488ed03ba59..0b9bb49429f 100644 --- a/resource-manager/securityinsights/2022-08-01/watchlists/id_workspace.go +++ b/resource-manager/securityinsights/2022-08-01/watchlists/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/actions/id_action.go b/resource-manager/securityinsights/2022-10-01-preview/actions/id_action.go index 574eb6badaa..683be4d3ea6 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/actions/id_action.go +++ b/resource-manager/securityinsights/2022-10-01-preview/actions/id_action.go @@ -40,27 +40,9 @@ func ParseActionID(input string) (*ActionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ActionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.RuleId, ok = parsed.Parsed["ruleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleId", *parsed) - } - - if id.ActionId, ok = parsed.Parsed["actionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseActionIDInsensitively(input string) (*ActionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ActionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ActionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.RuleId, ok = parsed.Parsed["ruleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleId", *parsed) + if id.RuleId, ok = input.Parsed["ruleId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleId", input) } - if id.ActionId, ok = parsed.Parsed["actionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionId", *parsed) + if id.ActionId, ok = input.Parsed["actionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "actionId", input) } - return &id, nil + return nil } // ValidateActionID checks that 'input' can be parsed as a Action ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/actions/id_alertrule.go b/resource-manager/securityinsights/2022-10-01-preview/actions/id_alertrule.go index 3164d49f702..c93745a84fb 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/actions/id_alertrule.go +++ b/resource-manager/securityinsights/2022-10-01-preview/actions/id_alertrule.go @@ -38,23 +38,9 @@ func ParseAlertRuleID(input string) (*AlertRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertRuleId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.RuleId, ok = parsed.Parsed["ruleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAlertRuleIDInsensitively(input string) (*AlertRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AlertRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.RuleId, ok = parsed.Parsed["ruleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleId", *parsed) + if id.RuleId, ok = input.Parsed["ruleId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleId", input) } - return &id, nil + return nil } // ValidateAlertRuleID checks that 'input' can be parsed as a Alert Rule ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/alertrules/id_alertrule.go b/resource-manager/securityinsights/2022-10-01-preview/alertrules/id_alertrule.go index f7731588a47..5dcc3bbe13f 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/alertrules/id_alertrule.go +++ b/resource-manager/securityinsights/2022-10-01-preview/alertrules/id_alertrule.go @@ -38,23 +38,9 @@ func ParseAlertRuleID(input string) (*AlertRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertRuleId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.RuleId, ok = parsed.Parsed["ruleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAlertRuleIDInsensitively(input string) (*AlertRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AlertRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.RuleId, ok = parsed.Parsed["ruleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleId", *parsed) + if id.RuleId, ok = input.Parsed["ruleId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleId", input) } - return &id, nil + return nil } // ValidateAlertRuleID checks that 'input' can be parsed as a Alert Rule ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/alertrules/id_workspace.go b/resource-manager/securityinsights/2022-10-01-preview/alertrules/id_workspace.go index 0baa3a56a8a..185da699926 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/alertrules/id_workspace.go +++ b/resource-manager/securityinsights/2022-10-01-preview/alertrules/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/alertruletemplates/id_alertruletemplate.go b/resource-manager/securityinsights/2022-10-01-preview/alertruletemplates/id_alertruletemplate.go index 106e81ff68d..d66b4983828 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/alertruletemplates/id_alertruletemplate.go +++ b/resource-manager/securityinsights/2022-10-01-preview/alertruletemplates/id_alertruletemplate.go @@ -38,23 +38,9 @@ func ParseAlertRuleTemplateID(input string) (*AlertRuleTemplateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertRuleTemplateId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.AlertRuleTemplateId, ok = parsed.Parsed["alertRuleTemplateId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "alertRuleTemplateId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAlertRuleTemplateIDInsensitively(input string) (*AlertRuleTemplateId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertRuleTemplateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AlertRuleTemplateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.AlertRuleTemplateId, ok = parsed.Parsed["alertRuleTemplateId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "alertRuleTemplateId", *parsed) + if id.AlertRuleTemplateId, ok = input.Parsed["alertRuleTemplateId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "alertRuleTemplateId", input) } - return &id, nil + return nil } // ValidateAlertRuleTemplateID checks that 'input' can be parsed as a Alert Rule Template ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/alertruletemplates/id_workspace.go b/resource-manager/securityinsights/2022-10-01-preview/alertruletemplates/id_workspace.go index 20a51851397..683f458f8db 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/alertruletemplates/id_workspace.go +++ b/resource-manager/securityinsights/2022-10-01-preview/alertruletemplates/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/automationrules/id_automationrule.go b/resource-manager/securityinsights/2022-10-01-preview/automationrules/id_automationrule.go index f69f6c204f2..1364c18fcfd 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/automationrules/id_automationrule.go +++ b/resource-manager/securityinsights/2022-10-01-preview/automationrules/id_automationrule.go @@ -38,23 +38,9 @@ func ParseAutomationRuleID(input string) (*AutomationRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationRuleId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.AutomationRuleId, ok = parsed.Parsed["automationRuleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationRuleId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAutomationRuleIDInsensitively(input string) (*AutomationRuleId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AutomationRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.AutomationRuleId, ok = parsed.Parsed["automationRuleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationRuleId", *parsed) + if id.AutomationRuleId, ok = input.Parsed["automationRuleId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationRuleId", input) } - return &id, nil + return nil } // ValidateAutomationRuleID checks that 'input' can be parsed as a Automation Rule ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/automationrules/id_workspace.go b/resource-manager/securityinsights/2022-10-01-preview/automationrules/id_workspace.go index 70e4df1da20..587424efc39 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/automationrules/id_workspace.go +++ b/resource-manager/securityinsights/2022-10-01-preview/automationrules/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/bookmark/id_bookmark.go b/resource-manager/securityinsights/2022-10-01-preview/bookmark/id_bookmark.go index 7dc45becca9..6c6172a4056 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/bookmark/id_bookmark.go +++ b/resource-manager/securityinsights/2022-10-01-preview/bookmark/id_bookmark.go @@ -38,23 +38,9 @@ func ParseBookmarkID(input string) (*BookmarkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BookmarkId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.BookmarkId, ok = parsed.Parsed["bookmarkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bookmarkId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBookmarkIDInsensitively(input string) (*BookmarkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BookmarkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BookmarkId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.BookmarkId, ok = parsed.Parsed["bookmarkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bookmarkId", *parsed) + if id.BookmarkId, ok = input.Parsed["bookmarkId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "bookmarkId", input) } - return &id, nil + return nil } // ValidateBookmarkID checks that 'input' can be parsed as a Bookmark ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/bookmarkrelations/id_bookmark.go b/resource-manager/securityinsights/2022-10-01-preview/bookmarkrelations/id_bookmark.go index f616eff4150..099a6268b24 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/bookmarkrelations/id_bookmark.go +++ b/resource-manager/securityinsights/2022-10-01-preview/bookmarkrelations/id_bookmark.go @@ -38,23 +38,9 @@ func ParseBookmarkID(input string) (*BookmarkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BookmarkId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.BookmarkId, ok = parsed.Parsed["bookmarkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bookmarkId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBookmarkIDInsensitively(input string) (*BookmarkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BookmarkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BookmarkId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.BookmarkId, ok = parsed.Parsed["bookmarkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bookmarkId", *parsed) + if id.BookmarkId, ok = input.Parsed["bookmarkId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "bookmarkId", input) } - return &id, nil + return nil } // ValidateBookmarkID checks that 'input' can be parsed as a Bookmark ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/bookmarkrelations/id_bookmarkrelation.go b/resource-manager/securityinsights/2022-10-01-preview/bookmarkrelations/id_bookmarkrelation.go index 9ad4708a7d6..7287d80950a 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/bookmarkrelations/id_bookmarkrelation.go +++ b/resource-manager/securityinsights/2022-10-01-preview/bookmarkrelations/id_bookmarkrelation.go @@ -40,27 +40,9 @@ func ParseBookmarkRelationID(input string) (*BookmarkRelationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BookmarkRelationId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.BookmarkId, ok = parsed.Parsed["bookmarkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bookmarkId", *parsed) - } - - if id.RelationName, ok = parsed.Parsed["relationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "relationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseBookmarkRelationIDInsensitively(input string) (*BookmarkRelationId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BookmarkRelationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *BookmarkRelationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.BookmarkId, ok = parsed.Parsed["bookmarkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bookmarkId", *parsed) + if id.BookmarkId, ok = input.Parsed["bookmarkId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "bookmarkId", input) } - if id.RelationName, ok = parsed.Parsed["relationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "relationName", *parsed) + if id.RelationName, ok = input.Parsed["relationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "relationName", input) } - return &id, nil + return nil } // ValidateBookmarkRelationID checks that 'input' can be parsed as a Bookmark Relation ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/bookmarks/id_bookmark.go b/resource-manager/securityinsights/2022-10-01-preview/bookmarks/id_bookmark.go index f59f1661872..370dd3f982d 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/bookmarks/id_bookmark.go +++ b/resource-manager/securityinsights/2022-10-01-preview/bookmarks/id_bookmark.go @@ -38,23 +38,9 @@ func ParseBookmarkID(input string) (*BookmarkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BookmarkId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.BookmarkId, ok = parsed.Parsed["bookmarkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bookmarkId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBookmarkIDInsensitively(input string) (*BookmarkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BookmarkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BookmarkId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.BookmarkId, ok = parsed.Parsed["bookmarkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bookmarkId", *parsed) + if id.BookmarkId, ok = input.Parsed["bookmarkId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "bookmarkId", input) } - return &id, nil + return nil } // ValidateBookmarkID checks that 'input' can be parsed as a Bookmark ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/bookmarks/id_workspace.go b/resource-manager/securityinsights/2022-10-01-preview/bookmarks/id_workspace.go index 440f411034c..f313c6bf04c 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/bookmarks/id_workspace.go +++ b/resource-manager/securityinsights/2022-10-01-preview/bookmarks/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/checkdataconnectorrequirements/id_workspace.go b/resource-manager/securityinsights/2022-10-01-preview/checkdataconnectorrequirements/id_workspace.go index 9ede2d55b21..00c34431db0 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/checkdataconnectorrequirements/id_workspace.go +++ b/resource-manager/securityinsights/2022-10-01-preview/checkdataconnectorrequirements/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/dataconnectors/id_dataconnector.go b/resource-manager/securityinsights/2022-10-01-preview/dataconnectors/id_dataconnector.go index 0b754d6b3c1..03b82a13118 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/dataconnectors/id_dataconnector.go +++ b/resource-manager/securityinsights/2022-10-01-preview/dataconnectors/id_dataconnector.go @@ -38,23 +38,9 @@ func ParseDataConnectorID(input string) (*DataConnectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataConnectorId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.DataConnectorId, ok = parsed.Parsed["dataConnectorId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataConnectorId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDataConnectorIDInsensitively(input string) (*DataConnectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataConnectorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DataConnectorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.DataConnectorId, ok = parsed.Parsed["dataConnectorId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataConnectorId", *parsed) + if id.DataConnectorId, ok = input.Parsed["dataConnectorId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataConnectorId", input) } - return &id, nil + return nil } // ValidateDataConnectorID checks that 'input' can be parsed as a Data Connector ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/dataconnectors/id_workspace.go b/resource-manager/securityinsights/2022-10-01-preview/dataconnectors/id_workspace.go index 16107cbce7b..dff523f5ff4 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/dataconnectors/id_workspace.go +++ b/resource-manager/securityinsights/2022-10-01-preview/dataconnectors/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/dataconnectorsconnect/id_dataconnector.go b/resource-manager/securityinsights/2022-10-01-preview/dataconnectorsconnect/id_dataconnector.go index ca7450f1d8b..e528c20620f 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/dataconnectorsconnect/id_dataconnector.go +++ b/resource-manager/securityinsights/2022-10-01-preview/dataconnectorsconnect/id_dataconnector.go @@ -38,23 +38,9 @@ func ParseDataConnectorID(input string) (*DataConnectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataConnectorId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.DataConnectorId, ok = parsed.Parsed["dataConnectorId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataConnectorId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDataConnectorIDInsensitively(input string) (*DataConnectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataConnectorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DataConnectorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.DataConnectorId, ok = parsed.Parsed["dataConnectorId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataConnectorId", *parsed) + if id.DataConnectorId, ok = input.Parsed["dataConnectorId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataConnectorId", input) } - return &id, nil + return nil } // ValidateDataConnectorID checks that 'input' can be parsed as a Data Connector ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/dataconnectorsdisconnect/id_dataconnector.go b/resource-manager/securityinsights/2022-10-01-preview/dataconnectorsdisconnect/id_dataconnector.go index f520d94d286..2ff583c0c56 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/dataconnectorsdisconnect/id_dataconnector.go +++ b/resource-manager/securityinsights/2022-10-01-preview/dataconnectorsdisconnect/id_dataconnector.go @@ -38,23 +38,9 @@ func ParseDataConnectorID(input string) (*DataConnectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataConnectorId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.DataConnectorId, ok = parsed.Parsed["dataConnectorId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataConnectorId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDataConnectorIDInsensitively(input string) (*DataConnectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataConnectorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DataConnectorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.DataConnectorId, ok = parsed.Parsed["dataConnectorId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataConnectorId", *parsed) + if id.DataConnectorId, ok = input.Parsed["dataConnectorId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataConnectorId", input) } - return &id, nil + return nil } // ValidateDataConnectorID checks that 'input' can be parsed as a Data Connector ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/entities/id_entity.go b/resource-manager/securityinsights/2022-10-01-preview/entities/id_entity.go index 23411d85c04..e7623d53ad9 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/entities/id_entity.go +++ b/resource-manager/securityinsights/2022-10-01-preview/entities/id_entity.go @@ -38,23 +38,9 @@ func ParseEntityID(input string) (*EntityId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EntityId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.EntityId, ok = parsed.Parsed["entityId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "entityId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseEntityIDInsensitively(input string) (*EntityId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EntityId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EntityId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.EntityId, ok = parsed.Parsed["entityId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "entityId", *parsed) + if id.EntityId, ok = input.Parsed["entityId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "entityId", input) } - return &id, nil + return nil } // ValidateEntityID checks that 'input' can be parsed as a Entity ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/entities/id_workspace.go b/resource-manager/securityinsights/2022-10-01-preview/entities/id_workspace.go index 6eb263f8173..49b335e497d 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/entities/id_workspace.go +++ b/resource-manager/securityinsights/2022-10-01-preview/entities/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/entityqueries/id_entityquery.go b/resource-manager/securityinsights/2022-10-01-preview/entityqueries/id_entityquery.go index 86235adc776..ae13b0e0137 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/entityqueries/id_entityquery.go +++ b/resource-manager/securityinsights/2022-10-01-preview/entityqueries/id_entityquery.go @@ -38,23 +38,9 @@ func ParseEntityQueryID(input string) (*EntityQueryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EntityQueryId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.EntityQueryId, ok = parsed.Parsed["entityQueryId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "entityQueryId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseEntityQueryIDInsensitively(input string) (*EntityQueryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EntityQueryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EntityQueryId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.EntityQueryId, ok = parsed.Parsed["entityQueryId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "entityQueryId", *parsed) + if id.EntityQueryId, ok = input.Parsed["entityQueryId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "entityQueryId", input) } - return &id, nil + return nil } // ValidateEntityQueryID checks that 'input' can be parsed as a Entity Query ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/entityqueries/id_entityquerytemplate.go b/resource-manager/securityinsights/2022-10-01-preview/entityqueries/id_entityquerytemplate.go index 603411e02ca..57d318c5b4f 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/entityqueries/id_entityquerytemplate.go +++ b/resource-manager/securityinsights/2022-10-01-preview/entityqueries/id_entityquerytemplate.go @@ -38,23 +38,9 @@ func ParseEntityQueryTemplateID(input string) (*EntityQueryTemplateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EntityQueryTemplateId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.EntityQueryTemplateId, ok = parsed.Parsed["entityQueryTemplateId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "entityQueryTemplateId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseEntityQueryTemplateIDInsensitively(input string) (*EntityQueryTemplate return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EntityQueryTemplateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EntityQueryTemplateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.EntityQueryTemplateId, ok = parsed.Parsed["entityQueryTemplateId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "entityQueryTemplateId", *parsed) + if id.EntityQueryTemplateId, ok = input.Parsed["entityQueryTemplateId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "entityQueryTemplateId", input) } - return &id, nil + return nil } // ValidateEntityQueryTemplateID checks that 'input' can be parsed as a Entity Query Template ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/entityqueries/id_workspace.go b/resource-manager/securityinsights/2022-10-01-preview/entityqueries/id_workspace.go index a31ed46fe0d..e20324205c5 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/entityqueries/id_workspace.go +++ b/resource-manager/securityinsights/2022-10-01-preview/entityqueries/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/entityrelations/id_entity.go b/resource-manager/securityinsights/2022-10-01-preview/entityrelations/id_entity.go index 2fa7a91cb26..6f43944c2ed 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/entityrelations/id_entity.go +++ b/resource-manager/securityinsights/2022-10-01-preview/entityrelations/id_entity.go @@ -38,23 +38,9 @@ func ParseEntityID(input string) (*EntityId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EntityId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.EntityId, ok = parsed.Parsed["entityId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "entityId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseEntityIDInsensitively(input string) (*EntityId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EntityId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EntityId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.EntityId, ok = parsed.Parsed["entityId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "entityId", *parsed) + if id.EntityId, ok = input.Parsed["entityId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "entityId", input) } - return &id, nil + return nil } // ValidateEntityID checks that 'input' can be parsed as a Entity ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/entityrelations/id_relation.go b/resource-manager/securityinsights/2022-10-01-preview/entityrelations/id_relation.go index 8b542ce03a4..39c5216f868 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/entityrelations/id_relation.go +++ b/resource-manager/securityinsights/2022-10-01-preview/entityrelations/id_relation.go @@ -40,27 +40,9 @@ func ParseRelationID(input string) (*RelationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RelationId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.EntityId, ok = parsed.Parsed["entityId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "entityId", *parsed) - } - - if id.RelationName, ok = parsed.Parsed["relationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "relationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseRelationIDInsensitively(input string) (*RelationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RelationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RelationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.EntityId, ok = parsed.Parsed["entityId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "entityId", *parsed) + if id.EntityId, ok = input.Parsed["entityId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "entityId", input) } - if id.RelationName, ok = parsed.Parsed["relationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "relationName", *parsed) + if id.RelationName, ok = input.Parsed["relationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "relationName", input) } - return &id, nil + return nil } // ValidateRelationID checks that 'input' can be parsed as a Relation ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/fileimports/id_fileimport.go b/resource-manager/securityinsights/2022-10-01-preview/fileimports/id_fileimport.go index 00b92c8508f..3677eee30d7 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/fileimports/id_fileimport.go +++ b/resource-manager/securityinsights/2022-10-01-preview/fileimports/id_fileimport.go @@ -38,23 +38,9 @@ func ParseFileImportID(input string) (*FileImportId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FileImportId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.FileImportId, ok = parsed.Parsed["fileImportId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fileImportId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFileImportIDInsensitively(input string) (*FileImportId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FileImportId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FileImportId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.FileImportId, ok = parsed.Parsed["fileImportId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "fileImportId", *parsed) + if id.FileImportId, ok = input.Parsed["fileImportId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "fileImportId", input) } - return &id, nil + return nil } // ValidateFileImportID checks that 'input' can be parsed as a File Import ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/fileimports/id_workspace.go b/resource-manager/securityinsights/2022-10-01-preview/fileimports/id_workspace.go index 73eaf2d7bd1..94952f0c389 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/fileimports/id_workspace.go +++ b/resource-manager/securityinsights/2022-10-01-preview/fileimports/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/incidentalerts/id_incident.go b/resource-manager/securityinsights/2022-10-01-preview/incidentalerts/id_incident.go index 4429779e5c7..f1a4b1b8c76 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/incidentalerts/id_incident.go +++ b/resource-manager/securityinsights/2022-10-01-preview/incidentalerts/id_incident.go @@ -38,23 +38,9 @@ func ParseIncidentID(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentIdentifier, ok = parsed.Parsed["incidentIdentifier"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentIdentifier", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIncidentIDInsensitively(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IncidentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentIdentifier, ok = parsed.Parsed["incidentIdentifier"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentIdentifier", *parsed) + if id.IncidentIdentifier, ok = input.Parsed["incidentIdentifier"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentIdentifier", input) } - return &id, nil + return nil } // ValidateIncidentID checks that 'input' can be parsed as a Incident ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/incidentbookmarks/id_incident.go b/resource-manager/securityinsights/2022-10-01-preview/incidentbookmarks/id_incident.go index d769738f208..25d8c98f695 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/incidentbookmarks/id_incident.go +++ b/resource-manager/securityinsights/2022-10-01-preview/incidentbookmarks/id_incident.go @@ -38,23 +38,9 @@ func ParseIncidentID(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentIdentifier, ok = parsed.Parsed["incidentIdentifier"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentIdentifier", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIncidentIDInsensitively(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IncidentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentIdentifier, ok = parsed.Parsed["incidentIdentifier"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentIdentifier", *parsed) + if id.IncidentIdentifier, ok = input.Parsed["incidentIdentifier"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentIdentifier", input) } - return &id, nil + return nil } // ValidateIncidentID checks that 'input' can be parsed as a Incident ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/incidentcomments/id_comment.go b/resource-manager/securityinsights/2022-10-01-preview/incidentcomments/id_comment.go index b7ef6f3cdf2..3475bc0c083 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/incidentcomments/id_comment.go +++ b/resource-manager/securityinsights/2022-10-01-preview/incidentcomments/id_comment.go @@ -40,27 +40,9 @@ func ParseCommentID(input string) (*CommentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) - } - - if id.IncidentCommentId, ok = parsed.Parsed["incidentCommentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentCommentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseCommentIDInsensitively(input string) (*CommentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *CommentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if id.IncidentId, ok = input.Parsed["incidentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentId", input) } - if id.IncidentCommentId, ok = parsed.Parsed["incidentCommentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentCommentId", *parsed) + if id.IncidentCommentId, ok = input.Parsed["incidentCommentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentCommentId", input) } - return &id, nil + return nil } // ValidateCommentID checks that 'input' can be parsed as a Comment ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/incidentcomments/id_incident.go b/resource-manager/securityinsights/2022-10-01-preview/incidentcomments/id_incident.go index 588b471a429..ce68179b424 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/incidentcomments/id_incident.go +++ b/resource-manager/securityinsights/2022-10-01-preview/incidentcomments/id_incident.go @@ -38,23 +38,9 @@ func ParseIncidentID(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentIdentifier, ok = parsed.Parsed["incidentIdentifier"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentIdentifier", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIncidentIDInsensitively(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IncidentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentIdentifier, ok = parsed.Parsed["incidentIdentifier"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentIdentifier", *parsed) + if id.IncidentIdentifier, ok = input.Parsed["incidentIdentifier"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentIdentifier", input) } - return &id, nil + return nil } // ValidateIncidentID checks that 'input' can be parsed as a Incident ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/incidententities/id_incident.go b/resource-manager/securityinsights/2022-10-01-preview/incidententities/id_incident.go index 143a4e3c13c..5967d0b45af 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/incidententities/id_incident.go +++ b/resource-manager/securityinsights/2022-10-01-preview/incidententities/id_incident.go @@ -38,23 +38,9 @@ func ParseIncidentID(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentIdentifier, ok = parsed.Parsed["incidentIdentifier"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentIdentifier", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIncidentIDInsensitively(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IncidentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentIdentifier, ok = parsed.Parsed["incidentIdentifier"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentIdentifier", *parsed) + if id.IncidentIdentifier, ok = input.Parsed["incidentIdentifier"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentIdentifier", input) } - return &id, nil + return nil } // ValidateIncidentID checks that 'input' can be parsed as a Incident ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/incidentrelations/id_incident.go b/resource-manager/securityinsights/2022-10-01-preview/incidentrelations/id_incident.go index 29a2a689df2..dec74f77d38 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/incidentrelations/id_incident.go +++ b/resource-manager/securityinsights/2022-10-01-preview/incidentrelations/id_incident.go @@ -38,23 +38,9 @@ func ParseIncidentID(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentIdentifier, ok = parsed.Parsed["incidentIdentifier"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentIdentifier", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIncidentIDInsensitively(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IncidentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentIdentifier, ok = parsed.Parsed["incidentIdentifier"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentIdentifier", *parsed) + if id.IncidentIdentifier, ok = input.Parsed["incidentIdentifier"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentIdentifier", input) } - return &id, nil + return nil } // ValidateIncidentID checks that 'input' can be parsed as a Incident ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/incidentrelations/id_incidentrelation.go b/resource-manager/securityinsights/2022-10-01-preview/incidentrelations/id_incidentrelation.go index d1ad52dc35d..feaa7a706a3 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/incidentrelations/id_incidentrelation.go +++ b/resource-manager/securityinsights/2022-10-01-preview/incidentrelations/id_incidentrelation.go @@ -40,27 +40,9 @@ func ParseIncidentRelationID(input string) (*IncidentRelationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentRelationId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) - } - - if id.RelationName, ok = parsed.Parsed["relationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "relationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseIncidentRelationIDInsensitively(input string) (*IncidentRelationId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentRelationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *IncidentRelationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if id.IncidentId, ok = input.Parsed["incidentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentId", input) } - if id.RelationName, ok = parsed.Parsed["relationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "relationName", *parsed) + if id.RelationName, ok = input.Parsed["relationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "relationName", input) } - return &id, nil + return nil } // ValidateIncidentRelationID checks that 'input' can be parsed as a Incident Relation ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/incidents/id_incident.go b/resource-manager/securityinsights/2022-10-01-preview/incidents/id_incident.go index 27f622719e1..60e6a5a7ead 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/incidents/id_incident.go +++ b/resource-manager/securityinsights/2022-10-01-preview/incidents/id_incident.go @@ -38,23 +38,9 @@ func ParseIncidentID(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentIdentifier, ok = parsed.Parsed["incidentIdentifier"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentIdentifier", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIncidentIDInsensitively(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IncidentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentIdentifier, ok = parsed.Parsed["incidentIdentifier"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentIdentifier", *parsed) + if id.IncidentIdentifier, ok = input.Parsed["incidentIdentifier"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentIdentifier", input) } - return &id, nil + return nil } // ValidateIncidentID checks that 'input' can be parsed as a Incident ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/incidents/id_workspace.go b/resource-manager/securityinsights/2022-10-01-preview/incidents/id_workspace.go index 47ad621406d..e06c947fdc9 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/incidents/id_workspace.go +++ b/resource-manager/securityinsights/2022-10-01-preview/incidents/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/incidentteam/id_incident.go b/resource-manager/securityinsights/2022-10-01-preview/incidentteam/id_incident.go index 0c5c8030554..0a0c40e6ce0 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/incidentteam/id_incident.go +++ b/resource-manager/securityinsights/2022-10-01-preview/incidentteam/id_incident.go @@ -38,23 +38,9 @@ func ParseIncidentID(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentIdentifier, ok = parsed.Parsed["incidentIdentifier"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentIdentifier", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIncidentIDInsensitively(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IncidentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentIdentifier, ok = parsed.Parsed["incidentIdentifier"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentIdentifier", *parsed) + if id.IncidentIdentifier, ok = input.Parsed["incidentIdentifier"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentIdentifier", input) } - return &id, nil + return nil } // ValidateIncidentID checks that 'input' can be parsed as a Incident ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/manualtrigger/id_incident.go b/resource-manager/securityinsights/2022-10-01-preview/manualtrigger/id_incident.go index 292c42f6cae..9071e71860d 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/manualtrigger/id_incident.go +++ b/resource-manager/securityinsights/2022-10-01-preview/manualtrigger/id_incident.go @@ -38,23 +38,9 @@ func ParseIncidentID(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentIdentifier, ok = parsed.Parsed["incidentIdentifier"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentIdentifier", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIncidentIDInsensitively(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IncidentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentIdentifier, ok = parsed.Parsed["incidentIdentifier"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentIdentifier", *parsed) + if id.IncidentIdentifier, ok = input.Parsed["incidentIdentifier"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentIdentifier", input) } - return &id, nil + return nil } // ValidateIncidentID checks that 'input' can be parsed as a Incident ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/metadata/id_metadata.go b/resource-manager/securityinsights/2022-10-01-preview/metadata/id_metadata.go index 63879af6a87..b6841ed239a 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/metadata/id_metadata.go +++ b/resource-manager/securityinsights/2022-10-01-preview/metadata/id_metadata.go @@ -38,23 +38,9 @@ func ParseMetadataID(input string) (*MetadataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MetadataId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.MetadataName, ok = parsed.Parsed["metadataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "metadataName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseMetadataIDInsensitively(input string) (*MetadataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MetadataId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *MetadataId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.MetadataName, ok = parsed.Parsed["metadataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "metadataName", *parsed) + if id.MetadataName, ok = input.Parsed["metadataName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "metadataName", input) } - return &id, nil + return nil } // ValidateMetadataID checks that 'input' can be parsed as a Metadata ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/metadata/id_workspace.go b/resource-manager/securityinsights/2022-10-01-preview/metadata/id_workspace.go index d3a3931c2b9..7270d5a38ce 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/metadata/id_workspace.go +++ b/resource-manager/securityinsights/2022-10-01-preview/metadata/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/officeconsents/id_officeconsent.go b/resource-manager/securityinsights/2022-10-01-preview/officeconsents/id_officeconsent.go index 8c013ed7a6b..da6d880eff8 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/officeconsents/id_officeconsent.go +++ b/resource-manager/securityinsights/2022-10-01-preview/officeconsents/id_officeconsent.go @@ -38,23 +38,9 @@ func ParseOfficeConsentID(input string) (*OfficeConsentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OfficeConsentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.ConsentId, ok = parsed.Parsed["consentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "consentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseOfficeConsentIDInsensitively(input string) (*OfficeConsentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OfficeConsentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OfficeConsentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.ConsentId, ok = parsed.Parsed["consentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "consentId", *parsed) + if id.ConsentId, ok = input.Parsed["consentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "consentId", input) } - return &id, nil + return nil } // ValidateOfficeConsentID checks that 'input' can be parsed as a Office Consent ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/officeconsents/id_workspace.go b/resource-manager/securityinsights/2022-10-01-preview/officeconsents/id_workspace.go index 76951154659..65dd9f8e01d 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/officeconsents/id_workspace.go +++ b/resource-manager/securityinsights/2022-10-01-preview/officeconsents/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/repositories/id_workspace.go b/resource-manager/securityinsights/2022-10-01-preview/repositories/id_workspace.go index 5b326add181..a7004ff58a2 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/repositories/id_workspace.go +++ b/resource-manager/securityinsights/2022-10-01-preview/repositories/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/securitymlanalyticssettings/id_securitymlanalyticssetting.go b/resource-manager/securityinsights/2022-10-01-preview/securitymlanalyticssettings/id_securitymlanalyticssetting.go index e67cc6eb48b..7885847c0a2 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/securitymlanalyticssettings/id_securitymlanalyticssetting.go +++ b/resource-manager/securityinsights/2022-10-01-preview/securitymlanalyticssettings/id_securitymlanalyticssetting.go @@ -38,23 +38,9 @@ func ParseSecurityMLAnalyticsSettingID(input string) (*SecurityMLAnalyticsSettin return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecurityMLAnalyticsSettingId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.SecurityMLAnalyticsSettingName, ok = parsed.Parsed["securityMLAnalyticsSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityMLAnalyticsSettingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSecurityMLAnalyticsSettingIDInsensitively(input string) (*SecurityMLAn return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecurityMLAnalyticsSettingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SecurityMLAnalyticsSettingId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.SecurityMLAnalyticsSettingName, ok = parsed.Parsed["securityMLAnalyticsSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityMLAnalyticsSettingName", *parsed) + if id.SecurityMLAnalyticsSettingName, ok = input.Parsed["securityMLAnalyticsSettingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "securityMLAnalyticsSettingName", input) } - return &id, nil + return nil } // ValidateSecurityMLAnalyticsSettingID checks that 'input' can be parsed as a Security M L Analytics Setting ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/securitymlanalyticssettings/id_workspace.go b/resource-manager/securityinsights/2022-10-01-preview/securitymlanalyticssettings/id_workspace.go index 6459961e86c..d1adff70323 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/securitymlanalyticssettings/id_workspace.go +++ b/resource-manager/securityinsights/2022-10-01-preview/securitymlanalyticssettings/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/sentinelonboardingstates/id_onboardingstate.go b/resource-manager/securityinsights/2022-10-01-preview/sentinelonboardingstates/id_onboardingstate.go index 2b3c490aeed..b35b4a4b950 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/sentinelonboardingstates/id_onboardingstate.go +++ b/resource-manager/securityinsights/2022-10-01-preview/sentinelonboardingstates/id_onboardingstate.go @@ -38,23 +38,9 @@ func ParseOnboardingStateID(input string) (*OnboardingStateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OnboardingStateId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.OnboardingStateName, ok = parsed.Parsed["onboardingStateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "onboardingStateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseOnboardingStateIDInsensitively(input string) (*OnboardingStateId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OnboardingStateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OnboardingStateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.OnboardingStateName, ok = parsed.Parsed["onboardingStateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "onboardingStateName", *parsed) + if id.OnboardingStateName, ok = input.Parsed["onboardingStateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "onboardingStateName", input) } - return &id, nil + return nil } // ValidateOnboardingStateID checks that 'input' can be parsed as a Onboarding State ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/sentinelonboardingstates/id_workspace.go b/resource-manager/securityinsights/2022-10-01-preview/sentinelonboardingstates/id_workspace.go index 62eb4e2432a..de0041001bd 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/sentinelonboardingstates/id_workspace.go +++ b/resource-manager/securityinsights/2022-10-01-preview/sentinelonboardingstates/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/settings/id_setting.go b/resource-manager/securityinsights/2022-10-01-preview/settings/id_setting.go index 495b198012e..2ff34b69c19 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/settings/id_setting.go +++ b/resource-manager/securityinsights/2022-10-01-preview/settings/id_setting.go @@ -38,23 +38,9 @@ func ParseSettingID(input string) (*SettingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SettingId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.SettingName, ok = parsed.Parsed["settingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "settingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSettingIDInsensitively(input string) (*SettingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SettingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SettingId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.SettingName, ok = parsed.Parsed["settingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "settingName", *parsed) + if id.SettingName, ok = input.Parsed["settingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "settingName", input) } - return &id, nil + return nil } // ValidateSettingID checks that 'input' can be parsed as a Setting ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/settings/id_workspace.go b/resource-manager/securityinsights/2022-10-01-preview/settings/id_workspace.go index ef7f89d5a57..e1f2a969ff1 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/settings/id_workspace.go +++ b/resource-manager/securityinsights/2022-10-01-preview/settings/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/sourcecontrols/id_sourcecontrol.go b/resource-manager/securityinsights/2022-10-01-preview/sourcecontrols/id_sourcecontrol.go index 0e1cca3249e..e990a4e3a6a 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/sourcecontrols/id_sourcecontrol.go +++ b/resource-manager/securityinsights/2022-10-01-preview/sourcecontrols/id_sourcecontrol.go @@ -38,23 +38,9 @@ func ParseSourceControlID(input string) (*SourceControlId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.SourceControlId, ok = parsed.Parsed["sourceControlId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSourceControlIDInsensitively(input string) (*SourceControlId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SourceControlId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.SourceControlId, ok = parsed.Parsed["sourceControlId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlId", *parsed) + if id.SourceControlId, ok = input.Parsed["sourceControlId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sourceControlId", input) } - return &id, nil + return nil } // ValidateSourceControlID checks that 'input' can be parsed as a Source Control ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/sourcecontrols/id_workspace.go b/resource-manager/securityinsights/2022-10-01-preview/sourcecontrols/id_workspace.go index 5d57a8b7d01..faba4055ac0 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/sourcecontrols/id_workspace.go +++ b/resource-manager/securityinsights/2022-10-01-preview/sourcecontrols/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/threatintelligence/id_indicator.go b/resource-manager/securityinsights/2022-10-01-preview/threatintelligence/id_indicator.go index fe680d054de..d5a496589af 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/threatintelligence/id_indicator.go +++ b/resource-manager/securityinsights/2022-10-01-preview/threatintelligence/id_indicator.go @@ -38,23 +38,9 @@ func ParseIndicatorID(input string) (*IndicatorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IndicatorId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IndicatorName, ok = parsed.Parsed["indicatorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "indicatorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIndicatorIDInsensitively(input string) (*IndicatorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IndicatorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IndicatorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IndicatorName, ok = parsed.Parsed["indicatorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "indicatorName", *parsed) + if id.IndicatorName, ok = input.Parsed["indicatorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "indicatorName", input) } - return &id, nil + return nil } // ValidateIndicatorID checks that 'input' can be parsed as a Indicator ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/threatintelligence/id_workspace.go b/resource-manager/securityinsights/2022-10-01-preview/threatintelligence/id_workspace.go index c3245ebd1b3..dedd6c6b5e0 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/threatintelligence/id_workspace.go +++ b/resource-manager/securityinsights/2022-10-01-preview/threatintelligence/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/watchlistitems/id_watchlist.go b/resource-manager/securityinsights/2022-10-01-preview/watchlistitems/id_watchlist.go index c2ad57d7be4..3c33d154f64 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/watchlistitems/id_watchlist.go +++ b/resource-manager/securityinsights/2022-10-01-preview/watchlistitems/id_watchlist.go @@ -38,23 +38,9 @@ func ParseWatchlistID(input string) (*WatchlistId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WatchlistId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.WatchlistAlias, ok = parsed.Parsed["watchlistAlias"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWatchlistIDInsensitively(input string) (*WatchlistId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WatchlistId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WatchlistId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.WatchlistAlias, ok = parsed.Parsed["watchlistAlias"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", *parsed) + if id.WatchlistAlias, ok = input.Parsed["watchlistAlias"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", input) } - return &id, nil + return nil } // ValidateWatchlistID checks that 'input' can be parsed as a Watchlist ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/watchlistitems/id_watchlistitem.go b/resource-manager/securityinsights/2022-10-01-preview/watchlistitems/id_watchlistitem.go index d816793fdbb..25bc1347496 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/watchlistitems/id_watchlistitem.go +++ b/resource-manager/securityinsights/2022-10-01-preview/watchlistitems/id_watchlistitem.go @@ -40,27 +40,9 @@ func ParseWatchlistItemID(input string) (*WatchlistItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WatchlistItemId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.WatchlistAlias, ok = parsed.Parsed["watchlistAlias"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", *parsed) - } - - if id.WatchlistItemId, ok = parsed.Parsed["watchlistItemId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watchlistItemId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseWatchlistItemIDInsensitively(input string) (*WatchlistItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WatchlistItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *WatchlistItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.WatchlistAlias, ok = parsed.Parsed["watchlistAlias"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", *parsed) + if id.WatchlistAlias, ok = input.Parsed["watchlistAlias"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", input) } - if id.WatchlistItemId, ok = parsed.Parsed["watchlistItemId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watchlistItemId", *parsed) + if id.WatchlistItemId, ok = input.Parsed["watchlistItemId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "watchlistItemId", input) } - return &id, nil + return nil } // ValidateWatchlistItemID checks that 'input' can be parsed as a Watchlist Item ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/watchlists/id_watchlist.go b/resource-manager/securityinsights/2022-10-01-preview/watchlists/id_watchlist.go index 7d34645a067..6a04c91dc05 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/watchlists/id_watchlist.go +++ b/resource-manager/securityinsights/2022-10-01-preview/watchlists/id_watchlist.go @@ -38,23 +38,9 @@ func ParseWatchlistID(input string) (*WatchlistId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WatchlistId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.WatchlistAlias, ok = parsed.Parsed["watchlistAlias"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWatchlistIDInsensitively(input string) (*WatchlistId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WatchlistId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WatchlistId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.WatchlistAlias, ok = parsed.Parsed["watchlistAlias"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", *parsed) + if id.WatchlistAlias, ok = input.Parsed["watchlistAlias"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", input) } - return &id, nil + return nil } // ValidateWatchlistID checks that 'input' can be parsed as a Watchlist ID diff --git a/resource-manager/securityinsights/2022-10-01-preview/watchlists/id_workspace.go b/resource-manager/securityinsights/2022-10-01-preview/watchlists/id_workspace.go index 488ed03ba59..0b9bb49429f 100644 --- a/resource-manager/securityinsights/2022-10-01-preview/watchlists/id_workspace.go +++ b/resource-manager/securityinsights/2022-10-01-preview/watchlists/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-11-01/actions/id_action.go b/resource-manager/securityinsights/2022-11-01/actions/id_action.go index 574eb6badaa..683be4d3ea6 100644 --- a/resource-manager/securityinsights/2022-11-01/actions/id_action.go +++ b/resource-manager/securityinsights/2022-11-01/actions/id_action.go @@ -40,27 +40,9 @@ func ParseActionID(input string) (*ActionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ActionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.RuleId, ok = parsed.Parsed["ruleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleId", *parsed) - } - - if id.ActionId, ok = parsed.Parsed["actionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseActionIDInsensitively(input string) (*ActionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ActionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ActionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.RuleId, ok = parsed.Parsed["ruleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleId", *parsed) + if id.RuleId, ok = input.Parsed["ruleId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleId", input) } - if id.ActionId, ok = parsed.Parsed["actionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionId", *parsed) + if id.ActionId, ok = input.Parsed["actionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "actionId", input) } - return &id, nil + return nil } // ValidateActionID checks that 'input' can be parsed as a Action ID diff --git a/resource-manager/securityinsights/2022-11-01/actions/id_alertrule.go b/resource-manager/securityinsights/2022-11-01/actions/id_alertrule.go index 3164d49f702..c93745a84fb 100644 --- a/resource-manager/securityinsights/2022-11-01/actions/id_alertrule.go +++ b/resource-manager/securityinsights/2022-11-01/actions/id_alertrule.go @@ -38,23 +38,9 @@ func ParseAlertRuleID(input string) (*AlertRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertRuleId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.RuleId, ok = parsed.Parsed["ruleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAlertRuleIDInsensitively(input string) (*AlertRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AlertRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.RuleId, ok = parsed.Parsed["ruleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleId", *parsed) + if id.RuleId, ok = input.Parsed["ruleId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleId", input) } - return &id, nil + return nil } // ValidateAlertRuleID checks that 'input' can be parsed as a Alert Rule ID diff --git a/resource-manager/securityinsights/2022-11-01/alertrules/id_alertrule.go b/resource-manager/securityinsights/2022-11-01/alertrules/id_alertrule.go index f7731588a47..5dcc3bbe13f 100644 --- a/resource-manager/securityinsights/2022-11-01/alertrules/id_alertrule.go +++ b/resource-manager/securityinsights/2022-11-01/alertrules/id_alertrule.go @@ -38,23 +38,9 @@ func ParseAlertRuleID(input string) (*AlertRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertRuleId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.RuleId, ok = parsed.Parsed["ruleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAlertRuleIDInsensitively(input string) (*AlertRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AlertRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.RuleId, ok = parsed.Parsed["ruleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleId", *parsed) + if id.RuleId, ok = input.Parsed["ruleId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleId", input) } - return &id, nil + return nil } // ValidateAlertRuleID checks that 'input' can be parsed as a Alert Rule ID diff --git a/resource-manager/securityinsights/2022-11-01/alertrules/id_workspace.go b/resource-manager/securityinsights/2022-11-01/alertrules/id_workspace.go index 0baa3a56a8a..185da699926 100644 --- a/resource-manager/securityinsights/2022-11-01/alertrules/id_workspace.go +++ b/resource-manager/securityinsights/2022-11-01/alertrules/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-11-01/alertruletemplates/id_alertruletemplate.go b/resource-manager/securityinsights/2022-11-01/alertruletemplates/id_alertruletemplate.go index 106e81ff68d..d66b4983828 100644 --- a/resource-manager/securityinsights/2022-11-01/alertruletemplates/id_alertruletemplate.go +++ b/resource-manager/securityinsights/2022-11-01/alertruletemplates/id_alertruletemplate.go @@ -38,23 +38,9 @@ func ParseAlertRuleTemplateID(input string) (*AlertRuleTemplateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertRuleTemplateId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.AlertRuleTemplateId, ok = parsed.Parsed["alertRuleTemplateId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "alertRuleTemplateId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAlertRuleTemplateIDInsensitively(input string) (*AlertRuleTemplateId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertRuleTemplateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AlertRuleTemplateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.AlertRuleTemplateId, ok = parsed.Parsed["alertRuleTemplateId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "alertRuleTemplateId", *parsed) + if id.AlertRuleTemplateId, ok = input.Parsed["alertRuleTemplateId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "alertRuleTemplateId", input) } - return &id, nil + return nil } // ValidateAlertRuleTemplateID checks that 'input' can be parsed as a Alert Rule Template ID diff --git a/resource-manager/securityinsights/2022-11-01/alertruletemplates/id_workspace.go b/resource-manager/securityinsights/2022-11-01/alertruletemplates/id_workspace.go index 20a51851397..683f458f8db 100644 --- a/resource-manager/securityinsights/2022-11-01/alertruletemplates/id_workspace.go +++ b/resource-manager/securityinsights/2022-11-01/alertruletemplates/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-11-01/automationrules/id_automationrule.go b/resource-manager/securityinsights/2022-11-01/automationrules/id_automationrule.go index f69f6c204f2..1364c18fcfd 100644 --- a/resource-manager/securityinsights/2022-11-01/automationrules/id_automationrule.go +++ b/resource-manager/securityinsights/2022-11-01/automationrules/id_automationrule.go @@ -38,23 +38,9 @@ func ParseAutomationRuleID(input string) (*AutomationRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationRuleId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.AutomationRuleId, ok = parsed.Parsed["automationRuleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationRuleId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAutomationRuleIDInsensitively(input string) (*AutomationRuleId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AutomationRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.AutomationRuleId, ok = parsed.Parsed["automationRuleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationRuleId", *parsed) + if id.AutomationRuleId, ok = input.Parsed["automationRuleId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationRuleId", input) } - return &id, nil + return nil } // ValidateAutomationRuleID checks that 'input' can be parsed as a Automation Rule ID diff --git a/resource-manager/securityinsights/2022-11-01/automationrules/id_workspace.go b/resource-manager/securityinsights/2022-11-01/automationrules/id_workspace.go index 70e4df1da20..587424efc39 100644 --- a/resource-manager/securityinsights/2022-11-01/automationrules/id_workspace.go +++ b/resource-manager/securityinsights/2022-11-01/automationrules/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-11-01/bookmarks/id_bookmark.go b/resource-manager/securityinsights/2022-11-01/bookmarks/id_bookmark.go index f59f1661872..370dd3f982d 100644 --- a/resource-manager/securityinsights/2022-11-01/bookmarks/id_bookmark.go +++ b/resource-manager/securityinsights/2022-11-01/bookmarks/id_bookmark.go @@ -38,23 +38,9 @@ func ParseBookmarkID(input string) (*BookmarkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BookmarkId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.BookmarkId, ok = parsed.Parsed["bookmarkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bookmarkId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBookmarkIDInsensitively(input string) (*BookmarkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BookmarkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BookmarkId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.BookmarkId, ok = parsed.Parsed["bookmarkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bookmarkId", *parsed) + if id.BookmarkId, ok = input.Parsed["bookmarkId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "bookmarkId", input) } - return &id, nil + return nil } // ValidateBookmarkID checks that 'input' can be parsed as a Bookmark ID diff --git a/resource-manager/securityinsights/2022-11-01/bookmarks/id_workspace.go b/resource-manager/securityinsights/2022-11-01/bookmarks/id_workspace.go index 440f411034c..f313c6bf04c 100644 --- a/resource-manager/securityinsights/2022-11-01/bookmarks/id_workspace.go +++ b/resource-manager/securityinsights/2022-11-01/bookmarks/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-11-01/dataconnectors/id_dataconnector.go b/resource-manager/securityinsights/2022-11-01/dataconnectors/id_dataconnector.go index 0b754d6b3c1..03b82a13118 100644 --- a/resource-manager/securityinsights/2022-11-01/dataconnectors/id_dataconnector.go +++ b/resource-manager/securityinsights/2022-11-01/dataconnectors/id_dataconnector.go @@ -38,23 +38,9 @@ func ParseDataConnectorID(input string) (*DataConnectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataConnectorId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.DataConnectorId, ok = parsed.Parsed["dataConnectorId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataConnectorId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDataConnectorIDInsensitively(input string) (*DataConnectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataConnectorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DataConnectorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.DataConnectorId, ok = parsed.Parsed["dataConnectorId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataConnectorId", *parsed) + if id.DataConnectorId, ok = input.Parsed["dataConnectorId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataConnectorId", input) } - return &id, nil + return nil } // ValidateDataConnectorID checks that 'input' can be parsed as a Data Connector ID diff --git a/resource-manager/securityinsights/2022-11-01/dataconnectors/id_workspace.go b/resource-manager/securityinsights/2022-11-01/dataconnectors/id_workspace.go index 16107cbce7b..dff523f5ff4 100644 --- a/resource-manager/securityinsights/2022-11-01/dataconnectors/id_workspace.go +++ b/resource-manager/securityinsights/2022-11-01/dataconnectors/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-11-01/incidentalerts/id_incident.go b/resource-manager/securityinsights/2022-11-01/incidentalerts/id_incident.go index 442e390eb90..931f3d335bd 100644 --- a/resource-manager/securityinsights/2022-11-01/incidentalerts/id_incident.go +++ b/resource-manager/securityinsights/2022-11-01/incidentalerts/id_incident.go @@ -38,23 +38,9 @@ func ParseIncidentID(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIncidentIDInsensitively(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IncidentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if id.IncidentId, ok = input.Parsed["incidentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentId", input) } - return &id, nil + return nil } // ValidateIncidentID checks that 'input' can be parsed as a Incident ID diff --git a/resource-manager/securityinsights/2022-11-01/incidentbookmarks/id_incident.go b/resource-manager/securityinsights/2022-11-01/incidentbookmarks/id_incident.go index dec3e45f9a0..210a9183811 100644 --- a/resource-manager/securityinsights/2022-11-01/incidentbookmarks/id_incident.go +++ b/resource-manager/securityinsights/2022-11-01/incidentbookmarks/id_incident.go @@ -38,23 +38,9 @@ func ParseIncidentID(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIncidentIDInsensitively(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IncidentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if id.IncidentId, ok = input.Parsed["incidentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentId", input) } - return &id, nil + return nil } // ValidateIncidentID checks that 'input' can be parsed as a Incident ID diff --git a/resource-manager/securityinsights/2022-11-01/incidentcomments/id_comment.go b/resource-manager/securityinsights/2022-11-01/incidentcomments/id_comment.go index b7ef6f3cdf2..3475bc0c083 100644 --- a/resource-manager/securityinsights/2022-11-01/incidentcomments/id_comment.go +++ b/resource-manager/securityinsights/2022-11-01/incidentcomments/id_comment.go @@ -40,27 +40,9 @@ func ParseCommentID(input string) (*CommentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) - } - - if id.IncidentCommentId, ok = parsed.Parsed["incidentCommentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentCommentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseCommentIDInsensitively(input string) (*CommentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *CommentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if id.IncidentId, ok = input.Parsed["incidentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentId", input) } - if id.IncidentCommentId, ok = parsed.Parsed["incidentCommentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentCommentId", *parsed) + if id.IncidentCommentId, ok = input.Parsed["incidentCommentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentCommentId", input) } - return &id, nil + return nil } // ValidateCommentID checks that 'input' can be parsed as a Comment ID diff --git a/resource-manager/securityinsights/2022-11-01/incidentcomments/id_incident.go b/resource-manager/securityinsights/2022-11-01/incidentcomments/id_incident.go index 1b1e84bf184..fda7c4b1408 100644 --- a/resource-manager/securityinsights/2022-11-01/incidentcomments/id_incident.go +++ b/resource-manager/securityinsights/2022-11-01/incidentcomments/id_incident.go @@ -38,23 +38,9 @@ func ParseIncidentID(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIncidentIDInsensitively(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IncidentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if id.IncidentId, ok = input.Parsed["incidentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentId", input) } - return &id, nil + return nil } // ValidateIncidentID checks that 'input' can be parsed as a Incident ID diff --git a/resource-manager/securityinsights/2022-11-01/incidententities/id_incident.go b/resource-manager/securityinsights/2022-11-01/incidententities/id_incident.go index 911487b1578..06ba92dba47 100644 --- a/resource-manager/securityinsights/2022-11-01/incidententities/id_incident.go +++ b/resource-manager/securityinsights/2022-11-01/incidententities/id_incident.go @@ -38,23 +38,9 @@ func ParseIncidentID(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIncidentIDInsensitively(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IncidentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if id.IncidentId, ok = input.Parsed["incidentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentId", input) } - return &id, nil + return nil } // ValidateIncidentID checks that 'input' can be parsed as a Incident ID diff --git a/resource-manager/securityinsights/2022-11-01/incidentrelations/id_incident.go b/resource-manager/securityinsights/2022-11-01/incidentrelations/id_incident.go index 8076f47c748..a1140bfb350 100644 --- a/resource-manager/securityinsights/2022-11-01/incidentrelations/id_incident.go +++ b/resource-manager/securityinsights/2022-11-01/incidentrelations/id_incident.go @@ -38,23 +38,9 @@ func ParseIncidentID(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIncidentIDInsensitively(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IncidentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if id.IncidentId, ok = input.Parsed["incidentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentId", input) } - return &id, nil + return nil } // ValidateIncidentID checks that 'input' can be parsed as a Incident ID diff --git a/resource-manager/securityinsights/2022-11-01/incidentrelations/id_relation.go b/resource-manager/securityinsights/2022-11-01/incidentrelations/id_relation.go index 0a59bcf7664..34b4fb46e10 100644 --- a/resource-manager/securityinsights/2022-11-01/incidentrelations/id_relation.go +++ b/resource-manager/securityinsights/2022-11-01/incidentrelations/id_relation.go @@ -40,27 +40,9 @@ func ParseRelationID(input string) (*RelationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RelationId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) - } - - if id.RelationName, ok = parsed.Parsed["relationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "relationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseRelationIDInsensitively(input string) (*RelationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RelationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RelationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if id.IncidentId, ok = input.Parsed["incidentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentId", input) } - if id.RelationName, ok = parsed.Parsed["relationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "relationName", *parsed) + if id.RelationName, ok = input.Parsed["relationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "relationName", input) } - return &id, nil + return nil } // ValidateRelationID checks that 'input' can be parsed as a Relation ID diff --git a/resource-manager/securityinsights/2022-11-01/incidents/id_incident.go b/resource-manager/securityinsights/2022-11-01/incidents/id_incident.go index 80b715f563d..62433520e98 100644 --- a/resource-manager/securityinsights/2022-11-01/incidents/id_incident.go +++ b/resource-manager/securityinsights/2022-11-01/incidents/id_incident.go @@ -38,23 +38,9 @@ func ParseIncidentID(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIncidentIDInsensitively(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IncidentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if id.IncidentId, ok = input.Parsed["incidentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentId", input) } - return &id, nil + return nil } // ValidateIncidentID checks that 'input' can be parsed as a Incident ID diff --git a/resource-manager/securityinsights/2022-11-01/incidents/id_workspace.go b/resource-manager/securityinsights/2022-11-01/incidents/id_workspace.go index 47ad621406d..e06c947fdc9 100644 --- a/resource-manager/securityinsights/2022-11-01/incidents/id_workspace.go +++ b/resource-manager/securityinsights/2022-11-01/incidents/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-11-01/securitymlanalyticssettings/id_securitymlanalyticssetting.go b/resource-manager/securityinsights/2022-11-01/securitymlanalyticssettings/id_securitymlanalyticssetting.go index e67cc6eb48b..7885847c0a2 100644 --- a/resource-manager/securityinsights/2022-11-01/securitymlanalyticssettings/id_securitymlanalyticssetting.go +++ b/resource-manager/securityinsights/2022-11-01/securitymlanalyticssettings/id_securitymlanalyticssetting.go @@ -38,23 +38,9 @@ func ParseSecurityMLAnalyticsSettingID(input string) (*SecurityMLAnalyticsSettin return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecurityMLAnalyticsSettingId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.SecurityMLAnalyticsSettingName, ok = parsed.Parsed["securityMLAnalyticsSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityMLAnalyticsSettingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSecurityMLAnalyticsSettingIDInsensitively(input string) (*SecurityMLAn return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecurityMLAnalyticsSettingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SecurityMLAnalyticsSettingId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.SecurityMLAnalyticsSettingName, ok = parsed.Parsed["securityMLAnalyticsSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityMLAnalyticsSettingName", *parsed) + if id.SecurityMLAnalyticsSettingName, ok = input.Parsed["securityMLAnalyticsSettingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "securityMLAnalyticsSettingName", input) } - return &id, nil + return nil } // ValidateSecurityMLAnalyticsSettingID checks that 'input' can be parsed as a Security M L Analytics Setting ID diff --git a/resource-manager/securityinsights/2022-11-01/securitymlanalyticssettings/id_workspace.go b/resource-manager/securityinsights/2022-11-01/securitymlanalyticssettings/id_workspace.go index 6459961e86c..d1adff70323 100644 --- a/resource-manager/securityinsights/2022-11-01/securitymlanalyticssettings/id_workspace.go +++ b/resource-manager/securityinsights/2022-11-01/securitymlanalyticssettings/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates/id_onboardingstate.go b/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates/id_onboardingstate.go index 2b3c490aeed..b35b4a4b950 100644 --- a/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates/id_onboardingstate.go +++ b/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates/id_onboardingstate.go @@ -38,23 +38,9 @@ func ParseOnboardingStateID(input string) (*OnboardingStateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OnboardingStateId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.OnboardingStateName, ok = parsed.Parsed["onboardingStateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "onboardingStateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseOnboardingStateIDInsensitively(input string) (*OnboardingStateId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OnboardingStateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OnboardingStateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.OnboardingStateName, ok = parsed.Parsed["onboardingStateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "onboardingStateName", *parsed) + if id.OnboardingStateName, ok = input.Parsed["onboardingStateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "onboardingStateName", input) } - return &id, nil + return nil } // ValidateOnboardingStateID checks that 'input' can be parsed as a Onboarding State ID diff --git a/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates/id_workspace.go b/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates/id_workspace.go index 62eb4e2432a..de0041001bd 100644 --- a/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates/id_workspace.go +++ b/resource-manager/securityinsights/2022-11-01/sentinelonboardingstates/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-11-01/threatintelligence/id_indicator.go b/resource-manager/securityinsights/2022-11-01/threatintelligence/id_indicator.go index fe680d054de..d5a496589af 100644 --- a/resource-manager/securityinsights/2022-11-01/threatintelligence/id_indicator.go +++ b/resource-manager/securityinsights/2022-11-01/threatintelligence/id_indicator.go @@ -38,23 +38,9 @@ func ParseIndicatorID(input string) (*IndicatorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IndicatorId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IndicatorName, ok = parsed.Parsed["indicatorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "indicatorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIndicatorIDInsensitively(input string) (*IndicatorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IndicatorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IndicatorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IndicatorName, ok = parsed.Parsed["indicatorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "indicatorName", *parsed) + if id.IndicatorName, ok = input.Parsed["indicatorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "indicatorName", input) } - return &id, nil + return nil } // ValidateIndicatorID checks that 'input' can be parsed as a Indicator ID diff --git a/resource-manager/securityinsights/2022-11-01/threatintelligence/id_workspace.go b/resource-manager/securityinsights/2022-11-01/threatintelligence/id_workspace.go index c3245ebd1b3..dedd6c6b5e0 100644 --- a/resource-manager/securityinsights/2022-11-01/threatintelligence/id_workspace.go +++ b/resource-manager/securityinsights/2022-11-01/threatintelligence/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2022-11-01/watchlistitems/id_watchlist.go b/resource-manager/securityinsights/2022-11-01/watchlistitems/id_watchlist.go index c2ad57d7be4..3c33d154f64 100644 --- a/resource-manager/securityinsights/2022-11-01/watchlistitems/id_watchlist.go +++ b/resource-manager/securityinsights/2022-11-01/watchlistitems/id_watchlist.go @@ -38,23 +38,9 @@ func ParseWatchlistID(input string) (*WatchlistId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WatchlistId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.WatchlistAlias, ok = parsed.Parsed["watchlistAlias"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWatchlistIDInsensitively(input string) (*WatchlistId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WatchlistId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WatchlistId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.WatchlistAlias, ok = parsed.Parsed["watchlistAlias"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", *parsed) + if id.WatchlistAlias, ok = input.Parsed["watchlistAlias"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", input) } - return &id, nil + return nil } // ValidateWatchlistID checks that 'input' can be parsed as a Watchlist ID diff --git a/resource-manager/securityinsights/2022-11-01/watchlistitems/id_watchlistitem.go b/resource-manager/securityinsights/2022-11-01/watchlistitems/id_watchlistitem.go index d816793fdbb..25bc1347496 100644 --- a/resource-manager/securityinsights/2022-11-01/watchlistitems/id_watchlistitem.go +++ b/resource-manager/securityinsights/2022-11-01/watchlistitems/id_watchlistitem.go @@ -40,27 +40,9 @@ func ParseWatchlistItemID(input string) (*WatchlistItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WatchlistItemId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.WatchlistAlias, ok = parsed.Parsed["watchlistAlias"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", *parsed) - } - - if id.WatchlistItemId, ok = parsed.Parsed["watchlistItemId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watchlistItemId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseWatchlistItemIDInsensitively(input string) (*WatchlistItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WatchlistItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *WatchlistItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.WatchlistAlias, ok = parsed.Parsed["watchlistAlias"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", *parsed) + if id.WatchlistAlias, ok = input.Parsed["watchlistAlias"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", input) } - if id.WatchlistItemId, ok = parsed.Parsed["watchlistItemId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watchlistItemId", *parsed) + if id.WatchlistItemId, ok = input.Parsed["watchlistItemId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "watchlistItemId", input) } - return &id, nil + return nil } // ValidateWatchlistItemID checks that 'input' can be parsed as a Watchlist Item ID diff --git a/resource-manager/securityinsights/2022-11-01/watchlists/id_watchlist.go b/resource-manager/securityinsights/2022-11-01/watchlists/id_watchlist.go index 7d34645a067..6a04c91dc05 100644 --- a/resource-manager/securityinsights/2022-11-01/watchlists/id_watchlist.go +++ b/resource-manager/securityinsights/2022-11-01/watchlists/id_watchlist.go @@ -38,23 +38,9 @@ func ParseWatchlistID(input string) (*WatchlistId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WatchlistId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.WatchlistAlias, ok = parsed.Parsed["watchlistAlias"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWatchlistIDInsensitively(input string) (*WatchlistId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WatchlistId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WatchlistId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.WatchlistAlias, ok = parsed.Parsed["watchlistAlias"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", *parsed) + if id.WatchlistAlias, ok = input.Parsed["watchlistAlias"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", input) } - return &id, nil + return nil } // ValidateWatchlistID checks that 'input' can be parsed as a Watchlist ID diff --git a/resource-manager/securityinsights/2022-11-01/watchlists/id_workspace.go b/resource-manager/securityinsights/2022-11-01/watchlists/id_workspace.go index 488ed03ba59..0b9bb49429f 100644 --- a/resource-manager/securityinsights/2022-11-01/watchlists/id_workspace.go +++ b/resource-manager/securityinsights/2022-11-01/watchlists/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2023-02-01/actions/id_action.go b/resource-manager/securityinsights/2023-02-01/actions/id_action.go index 574eb6badaa..683be4d3ea6 100644 --- a/resource-manager/securityinsights/2023-02-01/actions/id_action.go +++ b/resource-manager/securityinsights/2023-02-01/actions/id_action.go @@ -40,27 +40,9 @@ func ParseActionID(input string) (*ActionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ActionId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.RuleId, ok = parsed.Parsed["ruleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleId", *parsed) - } - - if id.ActionId, ok = parsed.Parsed["actionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseActionIDInsensitively(input string) (*ActionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ActionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ActionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.RuleId, ok = parsed.Parsed["ruleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleId", *parsed) + if id.RuleId, ok = input.Parsed["ruleId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleId", input) } - if id.ActionId, ok = parsed.Parsed["actionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionId", *parsed) + if id.ActionId, ok = input.Parsed["actionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "actionId", input) } - return &id, nil + return nil } // ValidateActionID checks that 'input' can be parsed as a Action ID diff --git a/resource-manager/securityinsights/2023-02-01/actions/id_alertrule.go b/resource-manager/securityinsights/2023-02-01/actions/id_alertrule.go index 3164d49f702..c93745a84fb 100644 --- a/resource-manager/securityinsights/2023-02-01/actions/id_alertrule.go +++ b/resource-manager/securityinsights/2023-02-01/actions/id_alertrule.go @@ -38,23 +38,9 @@ func ParseAlertRuleID(input string) (*AlertRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertRuleId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.RuleId, ok = parsed.Parsed["ruleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAlertRuleIDInsensitively(input string) (*AlertRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AlertRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.RuleId, ok = parsed.Parsed["ruleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleId", *parsed) + if id.RuleId, ok = input.Parsed["ruleId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleId", input) } - return &id, nil + return nil } // ValidateAlertRuleID checks that 'input' can be parsed as a Alert Rule ID diff --git a/resource-manager/securityinsights/2023-02-01/alertrules/id_alertrule.go b/resource-manager/securityinsights/2023-02-01/alertrules/id_alertrule.go index f7731588a47..5dcc3bbe13f 100644 --- a/resource-manager/securityinsights/2023-02-01/alertrules/id_alertrule.go +++ b/resource-manager/securityinsights/2023-02-01/alertrules/id_alertrule.go @@ -38,23 +38,9 @@ func ParseAlertRuleID(input string) (*AlertRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertRuleId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.RuleId, ok = parsed.Parsed["ruleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAlertRuleIDInsensitively(input string) (*AlertRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AlertRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.RuleId, ok = parsed.Parsed["ruleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleId", *parsed) + if id.RuleId, ok = input.Parsed["ruleId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleId", input) } - return &id, nil + return nil } // ValidateAlertRuleID checks that 'input' can be parsed as a Alert Rule ID diff --git a/resource-manager/securityinsights/2023-02-01/alertrules/id_workspace.go b/resource-manager/securityinsights/2023-02-01/alertrules/id_workspace.go index 0baa3a56a8a..185da699926 100644 --- a/resource-manager/securityinsights/2023-02-01/alertrules/id_workspace.go +++ b/resource-manager/securityinsights/2023-02-01/alertrules/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2023-02-01/alertruletemplates/id_alertruletemplate.go b/resource-manager/securityinsights/2023-02-01/alertruletemplates/id_alertruletemplate.go index 106e81ff68d..d66b4983828 100644 --- a/resource-manager/securityinsights/2023-02-01/alertruletemplates/id_alertruletemplate.go +++ b/resource-manager/securityinsights/2023-02-01/alertruletemplates/id_alertruletemplate.go @@ -38,23 +38,9 @@ func ParseAlertRuleTemplateID(input string) (*AlertRuleTemplateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertRuleTemplateId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.AlertRuleTemplateId, ok = parsed.Parsed["alertRuleTemplateId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "alertRuleTemplateId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAlertRuleTemplateIDInsensitively(input string) (*AlertRuleTemplateId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AlertRuleTemplateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AlertRuleTemplateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.AlertRuleTemplateId, ok = parsed.Parsed["alertRuleTemplateId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "alertRuleTemplateId", *parsed) + if id.AlertRuleTemplateId, ok = input.Parsed["alertRuleTemplateId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "alertRuleTemplateId", input) } - return &id, nil + return nil } // ValidateAlertRuleTemplateID checks that 'input' can be parsed as a Alert Rule Template ID diff --git a/resource-manager/securityinsights/2023-02-01/alertruletemplates/id_workspace.go b/resource-manager/securityinsights/2023-02-01/alertruletemplates/id_workspace.go index 20a51851397..683f458f8db 100644 --- a/resource-manager/securityinsights/2023-02-01/alertruletemplates/id_workspace.go +++ b/resource-manager/securityinsights/2023-02-01/alertruletemplates/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2023-02-01/automationrules/id_automationrule.go b/resource-manager/securityinsights/2023-02-01/automationrules/id_automationrule.go index f69f6c204f2..1364c18fcfd 100644 --- a/resource-manager/securityinsights/2023-02-01/automationrules/id_automationrule.go +++ b/resource-manager/securityinsights/2023-02-01/automationrules/id_automationrule.go @@ -38,23 +38,9 @@ func ParseAutomationRuleID(input string) (*AutomationRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationRuleId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.AutomationRuleId, ok = parsed.Parsed["automationRuleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationRuleId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAutomationRuleIDInsensitively(input string) (*AutomationRuleId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AutomationRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AutomationRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.AutomationRuleId, ok = parsed.Parsed["automationRuleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "automationRuleId", *parsed) + if id.AutomationRuleId, ok = input.Parsed["automationRuleId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "automationRuleId", input) } - return &id, nil + return nil } // ValidateAutomationRuleID checks that 'input' can be parsed as a Automation Rule ID diff --git a/resource-manager/securityinsights/2023-02-01/automationrules/id_workspace.go b/resource-manager/securityinsights/2023-02-01/automationrules/id_workspace.go index 70e4df1da20..587424efc39 100644 --- a/resource-manager/securityinsights/2023-02-01/automationrules/id_workspace.go +++ b/resource-manager/securityinsights/2023-02-01/automationrules/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2023-02-01/bookmarks/id_bookmark.go b/resource-manager/securityinsights/2023-02-01/bookmarks/id_bookmark.go index f59f1661872..370dd3f982d 100644 --- a/resource-manager/securityinsights/2023-02-01/bookmarks/id_bookmark.go +++ b/resource-manager/securityinsights/2023-02-01/bookmarks/id_bookmark.go @@ -38,23 +38,9 @@ func ParseBookmarkID(input string) (*BookmarkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BookmarkId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.BookmarkId, ok = parsed.Parsed["bookmarkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bookmarkId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBookmarkIDInsensitively(input string) (*BookmarkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BookmarkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BookmarkId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.BookmarkId, ok = parsed.Parsed["bookmarkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "bookmarkId", *parsed) + if id.BookmarkId, ok = input.Parsed["bookmarkId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "bookmarkId", input) } - return &id, nil + return nil } // ValidateBookmarkID checks that 'input' can be parsed as a Bookmark ID diff --git a/resource-manager/securityinsights/2023-02-01/bookmarks/id_workspace.go b/resource-manager/securityinsights/2023-02-01/bookmarks/id_workspace.go index 440f411034c..f313c6bf04c 100644 --- a/resource-manager/securityinsights/2023-02-01/bookmarks/id_workspace.go +++ b/resource-manager/securityinsights/2023-02-01/bookmarks/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2023-02-01/dataconnectors/id_dataconnector.go b/resource-manager/securityinsights/2023-02-01/dataconnectors/id_dataconnector.go index 0b754d6b3c1..03b82a13118 100644 --- a/resource-manager/securityinsights/2023-02-01/dataconnectors/id_dataconnector.go +++ b/resource-manager/securityinsights/2023-02-01/dataconnectors/id_dataconnector.go @@ -38,23 +38,9 @@ func ParseDataConnectorID(input string) (*DataConnectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataConnectorId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.DataConnectorId, ok = parsed.Parsed["dataConnectorId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataConnectorId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDataConnectorIDInsensitively(input string) (*DataConnectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataConnectorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DataConnectorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.DataConnectorId, ok = parsed.Parsed["dataConnectorId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataConnectorId", *parsed) + if id.DataConnectorId, ok = input.Parsed["dataConnectorId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataConnectorId", input) } - return &id, nil + return nil } // ValidateDataConnectorID checks that 'input' can be parsed as a Data Connector ID diff --git a/resource-manager/securityinsights/2023-02-01/dataconnectors/id_workspace.go b/resource-manager/securityinsights/2023-02-01/dataconnectors/id_workspace.go index 16107cbce7b..dff523f5ff4 100644 --- a/resource-manager/securityinsights/2023-02-01/dataconnectors/id_workspace.go +++ b/resource-manager/securityinsights/2023-02-01/dataconnectors/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2023-02-01/incidentalerts/id_incident.go b/resource-manager/securityinsights/2023-02-01/incidentalerts/id_incident.go index 442e390eb90..931f3d335bd 100644 --- a/resource-manager/securityinsights/2023-02-01/incidentalerts/id_incident.go +++ b/resource-manager/securityinsights/2023-02-01/incidentalerts/id_incident.go @@ -38,23 +38,9 @@ func ParseIncidentID(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIncidentIDInsensitively(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IncidentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if id.IncidentId, ok = input.Parsed["incidentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentId", input) } - return &id, nil + return nil } // ValidateIncidentID checks that 'input' can be parsed as a Incident ID diff --git a/resource-manager/securityinsights/2023-02-01/incidentbookmarks/id_incident.go b/resource-manager/securityinsights/2023-02-01/incidentbookmarks/id_incident.go index dec3e45f9a0..210a9183811 100644 --- a/resource-manager/securityinsights/2023-02-01/incidentbookmarks/id_incident.go +++ b/resource-manager/securityinsights/2023-02-01/incidentbookmarks/id_incident.go @@ -38,23 +38,9 @@ func ParseIncidentID(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIncidentIDInsensitively(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IncidentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if id.IncidentId, ok = input.Parsed["incidentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentId", input) } - return &id, nil + return nil } // ValidateIncidentID checks that 'input' can be parsed as a Incident ID diff --git a/resource-manager/securityinsights/2023-02-01/incidentcomments/id_comment.go b/resource-manager/securityinsights/2023-02-01/incidentcomments/id_comment.go index b7ef6f3cdf2..3475bc0c083 100644 --- a/resource-manager/securityinsights/2023-02-01/incidentcomments/id_comment.go +++ b/resource-manager/securityinsights/2023-02-01/incidentcomments/id_comment.go @@ -40,27 +40,9 @@ func ParseCommentID(input string) (*CommentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) - } - - if id.IncidentCommentId, ok = parsed.Parsed["incidentCommentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentCommentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseCommentIDInsensitively(input string) (*CommentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *CommentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if id.IncidentId, ok = input.Parsed["incidentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentId", input) } - if id.IncidentCommentId, ok = parsed.Parsed["incidentCommentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentCommentId", *parsed) + if id.IncidentCommentId, ok = input.Parsed["incidentCommentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentCommentId", input) } - return &id, nil + return nil } // ValidateCommentID checks that 'input' can be parsed as a Comment ID diff --git a/resource-manager/securityinsights/2023-02-01/incidentcomments/id_incident.go b/resource-manager/securityinsights/2023-02-01/incidentcomments/id_incident.go index 1b1e84bf184..fda7c4b1408 100644 --- a/resource-manager/securityinsights/2023-02-01/incidentcomments/id_incident.go +++ b/resource-manager/securityinsights/2023-02-01/incidentcomments/id_incident.go @@ -38,23 +38,9 @@ func ParseIncidentID(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIncidentIDInsensitively(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IncidentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if id.IncidentId, ok = input.Parsed["incidentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentId", input) } - return &id, nil + return nil } // ValidateIncidentID checks that 'input' can be parsed as a Incident ID diff --git a/resource-manager/securityinsights/2023-02-01/incidententities/id_incident.go b/resource-manager/securityinsights/2023-02-01/incidententities/id_incident.go index 911487b1578..06ba92dba47 100644 --- a/resource-manager/securityinsights/2023-02-01/incidententities/id_incident.go +++ b/resource-manager/securityinsights/2023-02-01/incidententities/id_incident.go @@ -38,23 +38,9 @@ func ParseIncidentID(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIncidentIDInsensitively(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IncidentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if id.IncidentId, ok = input.Parsed["incidentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentId", input) } - return &id, nil + return nil } // ValidateIncidentID checks that 'input' can be parsed as a Incident ID diff --git a/resource-manager/securityinsights/2023-02-01/incidentrelations/id_incident.go b/resource-manager/securityinsights/2023-02-01/incidentrelations/id_incident.go index 8076f47c748..a1140bfb350 100644 --- a/resource-manager/securityinsights/2023-02-01/incidentrelations/id_incident.go +++ b/resource-manager/securityinsights/2023-02-01/incidentrelations/id_incident.go @@ -38,23 +38,9 @@ func ParseIncidentID(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIncidentIDInsensitively(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IncidentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if id.IncidentId, ok = input.Parsed["incidentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentId", input) } - return &id, nil + return nil } // ValidateIncidentID checks that 'input' can be parsed as a Incident ID diff --git a/resource-manager/securityinsights/2023-02-01/incidentrelations/id_relation.go b/resource-manager/securityinsights/2023-02-01/incidentrelations/id_relation.go index 0a59bcf7664..34b4fb46e10 100644 --- a/resource-manager/securityinsights/2023-02-01/incidentrelations/id_relation.go +++ b/resource-manager/securityinsights/2023-02-01/incidentrelations/id_relation.go @@ -40,27 +40,9 @@ func ParseRelationID(input string) (*RelationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RelationId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) - } - - if id.RelationName, ok = parsed.Parsed["relationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "relationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseRelationIDInsensitively(input string) (*RelationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RelationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RelationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if id.IncidentId, ok = input.Parsed["incidentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentId", input) } - if id.RelationName, ok = parsed.Parsed["relationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "relationName", *parsed) + if id.RelationName, ok = input.Parsed["relationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "relationName", input) } - return &id, nil + return nil } // ValidateRelationID checks that 'input' can be parsed as a Relation ID diff --git a/resource-manager/securityinsights/2023-02-01/incidents/id_incident.go b/resource-manager/securityinsights/2023-02-01/incidents/id_incident.go index 80b715f563d..62433520e98 100644 --- a/resource-manager/securityinsights/2023-02-01/incidents/id_incident.go +++ b/resource-manager/securityinsights/2023-02-01/incidents/id_incident.go @@ -38,23 +38,9 @@ func ParseIncidentID(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIncidentIDInsensitively(input string) (*IncidentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IncidentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IncidentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IncidentId, ok = parsed.Parsed["incidentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "incidentId", *parsed) + if id.IncidentId, ok = input.Parsed["incidentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "incidentId", input) } - return &id, nil + return nil } // ValidateIncidentID checks that 'input' can be parsed as a Incident ID diff --git a/resource-manager/securityinsights/2023-02-01/incidents/id_workspace.go b/resource-manager/securityinsights/2023-02-01/incidents/id_workspace.go index 47ad621406d..e06c947fdc9 100644 --- a/resource-manager/securityinsights/2023-02-01/incidents/id_workspace.go +++ b/resource-manager/securityinsights/2023-02-01/incidents/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2023-02-01/metadata/id_metadata.go b/resource-manager/securityinsights/2023-02-01/metadata/id_metadata.go index 63879af6a87..b6841ed239a 100644 --- a/resource-manager/securityinsights/2023-02-01/metadata/id_metadata.go +++ b/resource-manager/securityinsights/2023-02-01/metadata/id_metadata.go @@ -38,23 +38,9 @@ func ParseMetadataID(input string) (*MetadataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MetadataId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.MetadataName, ok = parsed.Parsed["metadataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "metadataName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseMetadataIDInsensitively(input string) (*MetadataId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MetadataId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *MetadataId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.MetadataName, ok = parsed.Parsed["metadataName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "metadataName", *parsed) + if id.MetadataName, ok = input.Parsed["metadataName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "metadataName", input) } - return &id, nil + return nil } // ValidateMetadataID checks that 'input' can be parsed as a Metadata ID diff --git a/resource-manager/securityinsights/2023-02-01/metadata/id_workspace.go b/resource-manager/securityinsights/2023-02-01/metadata/id_workspace.go index d3a3931c2b9..7270d5a38ce 100644 --- a/resource-manager/securityinsights/2023-02-01/metadata/id_workspace.go +++ b/resource-manager/securityinsights/2023-02-01/metadata/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2023-02-01/securitymlanalyticssettings/id_securitymlanalyticssetting.go b/resource-manager/securityinsights/2023-02-01/securitymlanalyticssettings/id_securitymlanalyticssetting.go index e67cc6eb48b..7885847c0a2 100644 --- a/resource-manager/securityinsights/2023-02-01/securitymlanalyticssettings/id_securitymlanalyticssetting.go +++ b/resource-manager/securityinsights/2023-02-01/securitymlanalyticssettings/id_securitymlanalyticssetting.go @@ -38,23 +38,9 @@ func ParseSecurityMLAnalyticsSettingID(input string) (*SecurityMLAnalyticsSettin return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecurityMLAnalyticsSettingId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.SecurityMLAnalyticsSettingName, ok = parsed.Parsed["securityMLAnalyticsSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityMLAnalyticsSettingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSecurityMLAnalyticsSettingIDInsensitively(input string) (*SecurityMLAn return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SecurityMLAnalyticsSettingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SecurityMLAnalyticsSettingId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.SecurityMLAnalyticsSettingName, ok = parsed.Parsed["securityMLAnalyticsSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "securityMLAnalyticsSettingName", *parsed) + if id.SecurityMLAnalyticsSettingName, ok = input.Parsed["securityMLAnalyticsSettingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "securityMLAnalyticsSettingName", input) } - return &id, nil + return nil } // ValidateSecurityMLAnalyticsSettingID checks that 'input' can be parsed as a Security M L Analytics Setting ID diff --git a/resource-manager/securityinsights/2023-02-01/securitymlanalyticssettings/id_workspace.go b/resource-manager/securityinsights/2023-02-01/securitymlanalyticssettings/id_workspace.go index 6459961e86c..d1adff70323 100644 --- a/resource-manager/securityinsights/2023-02-01/securitymlanalyticssettings/id_workspace.go +++ b/resource-manager/securityinsights/2023-02-01/securitymlanalyticssettings/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2023-02-01/sentinelonboardingstates/id_onboardingstate.go b/resource-manager/securityinsights/2023-02-01/sentinelonboardingstates/id_onboardingstate.go index 2b3c490aeed..b35b4a4b950 100644 --- a/resource-manager/securityinsights/2023-02-01/sentinelonboardingstates/id_onboardingstate.go +++ b/resource-manager/securityinsights/2023-02-01/sentinelonboardingstates/id_onboardingstate.go @@ -38,23 +38,9 @@ func ParseOnboardingStateID(input string) (*OnboardingStateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OnboardingStateId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.OnboardingStateName, ok = parsed.Parsed["onboardingStateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "onboardingStateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseOnboardingStateIDInsensitively(input string) (*OnboardingStateId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OnboardingStateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OnboardingStateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.OnboardingStateName, ok = parsed.Parsed["onboardingStateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "onboardingStateName", *parsed) + if id.OnboardingStateName, ok = input.Parsed["onboardingStateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "onboardingStateName", input) } - return &id, nil + return nil } // ValidateOnboardingStateID checks that 'input' can be parsed as a Onboarding State ID diff --git a/resource-manager/securityinsights/2023-02-01/sentinelonboardingstates/id_workspace.go b/resource-manager/securityinsights/2023-02-01/sentinelonboardingstates/id_workspace.go index 62eb4e2432a..de0041001bd 100644 --- a/resource-manager/securityinsights/2023-02-01/sentinelonboardingstates/id_workspace.go +++ b/resource-manager/securityinsights/2023-02-01/sentinelonboardingstates/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2023-02-01/threatintelligence/id_indicator.go b/resource-manager/securityinsights/2023-02-01/threatintelligence/id_indicator.go index fe680d054de..d5a496589af 100644 --- a/resource-manager/securityinsights/2023-02-01/threatintelligence/id_indicator.go +++ b/resource-manager/securityinsights/2023-02-01/threatintelligence/id_indicator.go @@ -38,23 +38,9 @@ func ParseIndicatorID(input string) (*IndicatorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IndicatorId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.IndicatorName, ok = parsed.Parsed["indicatorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "indicatorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIndicatorIDInsensitively(input string) (*IndicatorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IndicatorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IndicatorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.IndicatorName, ok = parsed.Parsed["indicatorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "indicatorName", *parsed) + if id.IndicatorName, ok = input.Parsed["indicatorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "indicatorName", input) } - return &id, nil + return nil } // ValidateIndicatorID checks that 'input' can be parsed as a Indicator ID diff --git a/resource-manager/securityinsights/2023-02-01/threatintelligence/id_workspace.go b/resource-manager/securityinsights/2023-02-01/threatintelligence/id_workspace.go index c3245ebd1b3..dedd6c6b5e0 100644 --- a/resource-manager/securityinsights/2023-02-01/threatintelligence/id_workspace.go +++ b/resource-manager/securityinsights/2023-02-01/threatintelligence/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/securityinsights/2023-02-01/watchlistitems/id_watchlist.go b/resource-manager/securityinsights/2023-02-01/watchlistitems/id_watchlist.go index c2ad57d7be4..3c33d154f64 100644 --- a/resource-manager/securityinsights/2023-02-01/watchlistitems/id_watchlist.go +++ b/resource-manager/securityinsights/2023-02-01/watchlistitems/id_watchlist.go @@ -38,23 +38,9 @@ func ParseWatchlistID(input string) (*WatchlistId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WatchlistId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.WatchlistAlias, ok = parsed.Parsed["watchlistAlias"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWatchlistIDInsensitively(input string) (*WatchlistId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WatchlistId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WatchlistId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.WatchlistAlias, ok = parsed.Parsed["watchlistAlias"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", *parsed) + if id.WatchlistAlias, ok = input.Parsed["watchlistAlias"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", input) } - return &id, nil + return nil } // ValidateWatchlistID checks that 'input' can be parsed as a Watchlist ID diff --git a/resource-manager/securityinsights/2023-02-01/watchlistitems/id_watchlistitem.go b/resource-manager/securityinsights/2023-02-01/watchlistitems/id_watchlistitem.go index d816793fdbb..25bc1347496 100644 --- a/resource-manager/securityinsights/2023-02-01/watchlistitems/id_watchlistitem.go +++ b/resource-manager/securityinsights/2023-02-01/watchlistitems/id_watchlistitem.go @@ -40,27 +40,9 @@ func ParseWatchlistItemID(input string) (*WatchlistItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WatchlistItemId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.WatchlistAlias, ok = parsed.Parsed["watchlistAlias"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", *parsed) - } - - if id.WatchlistItemId, ok = parsed.Parsed["watchlistItemId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watchlistItemId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseWatchlistItemIDInsensitively(input string) (*WatchlistItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WatchlistItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *WatchlistItemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.WatchlistAlias, ok = parsed.Parsed["watchlistAlias"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", *parsed) + if id.WatchlistAlias, ok = input.Parsed["watchlistAlias"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", input) } - if id.WatchlistItemId, ok = parsed.Parsed["watchlistItemId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watchlistItemId", *parsed) + if id.WatchlistItemId, ok = input.Parsed["watchlistItemId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "watchlistItemId", input) } - return &id, nil + return nil } // ValidateWatchlistItemID checks that 'input' can be parsed as a Watchlist Item ID diff --git a/resource-manager/securityinsights/2023-02-01/watchlists/id_watchlist.go b/resource-manager/securityinsights/2023-02-01/watchlists/id_watchlist.go index 7d34645a067..6a04c91dc05 100644 --- a/resource-manager/securityinsights/2023-02-01/watchlists/id_watchlist.go +++ b/resource-manager/securityinsights/2023-02-01/watchlists/id_watchlist.go @@ -38,23 +38,9 @@ func ParseWatchlistID(input string) (*WatchlistId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WatchlistId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) - } - - if id.WatchlistAlias, ok = parsed.Parsed["watchlistAlias"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWatchlistIDInsensitively(input string) (*WatchlistId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WatchlistId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WatchlistId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - if id.WatchlistAlias, ok = parsed.Parsed["watchlistAlias"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", *parsed) + if id.WatchlistAlias, ok = input.Parsed["watchlistAlias"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "watchlistAlias", input) } - return &id, nil + return nil } // ValidateWatchlistID checks that 'input' can be parsed as a Watchlist ID diff --git a/resource-manager/securityinsights/2023-02-01/watchlists/id_workspace.go b/resource-manager/securityinsights/2023-02-01/watchlists/id_workspace.go index 488ed03ba59..0b9bb49429f 100644 --- a/resource-manager/securityinsights/2023-02-01/watchlists/id_workspace.go +++ b/resource-manager/securityinsights/2023-02-01/watchlists/id_workspace.go @@ -36,19 +36,9 @@ func ParseWorkspaceID(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} - - 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.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWorkspaceIDInsensitively(input string) (*WorkspaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkspaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkspaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WorkspaceName, ok = parsed.Parsed["workspaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", *parsed) + if id.WorkspaceName, ok = input.Parsed["workspaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workspaceName", input) } - return &id, nil + return nil } // ValidateWorkspaceID checks that 'input' can be parsed as a Workspace ID diff --git a/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/id_disasterrecoveryconfig.go b/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/id_disasterrecoveryconfig.go index a92302146e1..cf12ba2d6a8 100644 --- a/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/id_disasterrecoveryconfig.go +++ b/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/id_disasterrecoveryconfig.go @@ -38,23 +38,9 @@ func ParseDisasterRecoveryConfigID(input string) (*DisasterRecoveryConfigId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DisasterRecoveryConfigId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.DisasterRecoveryConfigName, ok = parsed.Parsed["disasterRecoveryConfigName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "disasterRecoveryConfigName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDisasterRecoveryConfigIDInsensitively(input string) (*DisasterRecovery return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DisasterRecoveryConfigId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DisasterRecoveryConfigId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.DisasterRecoveryConfigName, ok = parsed.Parsed["disasterRecoveryConfigName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "disasterRecoveryConfigName", *parsed) + if id.DisasterRecoveryConfigName, ok = input.Parsed["disasterRecoveryConfigName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "disasterRecoveryConfigName", input) } - return &id, nil + return nil } // ValidateDisasterRecoveryConfigID checks that 'input' can be parsed as a Disaster Recovery Config ID diff --git a/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/id_disasterrecoveryconfigauthorizationrule.go b/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/id_disasterrecoveryconfigauthorizationrule.go index 303919d360f..3d722d5c40a 100644 --- a/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/id_disasterrecoveryconfigauthorizationrule.go +++ b/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/id_disasterrecoveryconfigauthorizationrule.go @@ -40,27 +40,9 @@ func ParseDisasterRecoveryConfigAuthorizationRuleID(input string) (*DisasterReco return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DisasterRecoveryConfigAuthorizationRuleId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.DisasterRecoveryConfigName, ok = parsed.Parsed["disasterRecoveryConfigName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "disasterRecoveryConfigName", *parsed) - } - - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseDisasterRecoveryConfigAuthorizationRuleIDInsensitively(input string) ( return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DisasterRecoveryConfigAuthorizationRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DisasterRecoveryConfigAuthorizationRuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.DisasterRecoveryConfigName, ok = parsed.Parsed["disasterRecoveryConfigName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "disasterRecoveryConfigName", *parsed) + if id.DisasterRecoveryConfigName, ok = input.Parsed["disasterRecoveryConfigName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "disasterRecoveryConfigName", input) } - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if id.AuthorizationRuleName, ok = input.Parsed["authorizationRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", input) } - return &id, nil + return nil } // ValidateDisasterRecoveryConfigAuthorizationRuleID checks that 'input' can be parsed as a Disaster Recovery Config Authorization Rule ID diff --git a/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/id_namespace.go b/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/id_namespace.go index 4d69695f309..33cc170a839 100644 --- a/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/id_namespace.go +++ b/resource-manager/servicebus/2021-06-01-preview/disasterrecoveryconfigs/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/servicebus/2021-06-01-preview/migrationconfigs/id_namespace.go b/resource-manager/servicebus/2021-06-01-preview/migrationconfigs/id_namespace.go index 425e2f7f243..db0af157b3a 100644 --- a/resource-manager/servicebus/2021-06-01-preview/migrationconfigs/id_namespace.go +++ b/resource-manager/servicebus/2021-06-01-preview/migrationconfigs/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/servicebus/2021-06-01-preview/namespaces/id_namespace.go b/resource-manager/servicebus/2021-06-01-preview/namespaces/id_namespace.go index 7fcca1198a8..c01beabeef4 100644 --- a/resource-manager/servicebus/2021-06-01-preview/namespaces/id_namespace.go +++ b/resource-manager/servicebus/2021-06-01-preview/namespaces/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/id_authorizationrule.go b/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/id_authorizationrule.go index 64322aa236d..681f4ec8232 100644 --- a/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/id_authorizationrule.go +++ b/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/id_authorizationrule.go @@ -38,23 +38,9 @@ func ParseAuthorizationRuleID(input string) (*AuthorizationRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationRuleId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAuthorizationRuleIDInsensitively(input string) (*AuthorizationRuleId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AuthorizationRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if id.AuthorizationRuleName, ok = input.Parsed["authorizationRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", input) } - return &id, nil + return nil } // ValidateAuthorizationRuleID checks that 'input' can be parsed as a Authorization Rule ID diff --git a/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/id_namespace.go b/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/id_namespace.go index 9b51ad2b6e6..8658cd576ea 100644 --- a/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/id_namespace.go +++ b/resource-manager/servicebus/2021-06-01-preview/namespacesauthorizationrule/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/servicebus/2021-06-01-preview/namespacesprivateendpointconnections/id_namespace.go b/resource-manager/servicebus/2021-06-01-preview/namespacesprivateendpointconnections/id_namespace.go index 4d0c5477fb6..9f93804aa05 100644 --- a/resource-manager/servicebus/2021-06-01-preview/namespacesprivateendpointconnections/id_namespace.go +++ b/resource-manager/servicebus/2021-06-01-preview/namespacesprivateendpointconnections/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/servicebus/2021-06-01-preview/namespacesprivateendpointconnections/id_privateendpointconnection.go b/resource-manager/servicebus/2021-06-01-preview/namespacesprivateendpointconnections/id_privateendpointconnection.go index 3a14db43455..08769f2478b 100644 --- a/resource-manager/servicebus/2021-06-01-preview/namespacesprivateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/servicebus/2021-06-01-preview/namespacesprivateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/servicebus/2021-06-01-preview/namespacesprivatelinkresources/id_namespace.go b/resource-manager/servicebus/2021-06-01-preview/namespacesprivatelinkresources/id_namespace.go index b9039f21e31..c7a6ceb6165 100644 --- a/resource-manager/servicebus/2021-06-01-preview/namespacesprivatelinkresources/id_namespace.go +++ b/resource-manager/servicebus/2021-06-01-preview/namespacesprivatelinkresources/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/servicebus/2021-06-01-preview/queues/id_namespace.go b/resource-manager/servicebus/2021-06-01-preview/queues/id_namespace.go index 67a0908584b..255b1b339e5 100644 --- a/resource-manager/servicebus/2021-06-01-preview/queues/id_namespace.go +++ b/resource-manager/servicebus/2021-06-01-preview/queues/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/servicebus/2021-06-01-preview/queues/id_queue.go b/resource-manager/servicebus/2021-06-01-preview/queues/id_queue.go index 848018d12db..34b652098a2 100644 --- a/resource-manager/servicebus/2021-06-01-preview/queues/id_queue.go +++ b/resource-manager/servicebus/2021-06-01-preview/queues/id_queue.go @@ -38,23 +38,9 @@ func ParseQueueID(input string) (*QueueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QueueId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.QueueName, ok = parsed.Parsed["queueName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "queueName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseQueueIDInsensitively(input string) (*QueueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QueueId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *QueueId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.QueueName, ok = parsed.Parsed["queueName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "queueName", *parsed) + if id.QueueName, ok = input.Parsed["queueName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "queueName", input) } - return &id, nil + return nil } // ValidateQueueID checks that 'input' can be parsed as a Queue ID diff --git a/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/id_queue.go b/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/id_queue.go index 7e7b1def535..de1e9a946d8 100644 --- a/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/id_queue.go +++ b/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/id_queue.go @@ -38,23 +38,9 @@ func ParseQueueID(input string) (*QueueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QueueId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.QueueName, ok = parsed.Parsed["queueName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "queueName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseQueueIDInsensitively(input string) (*QueueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QueueId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *QueueId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.QueueName, ok = parsed.Parsed["queueName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "queueName", *parsed) + if id.QueueName, ok = input.Parsed["queueName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "queueName", input) } - return &id, nil + return nil } // ValidateQueueID checks that 'input' can be parsed as a Queue ID diff --git a/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/id_queueauthorizationrule.go b/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/id_queueauthorizationrule.go index 2c5d813f355..d0b0d85e535 100644 --- a/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/id_queueauthorizationrule.go +++ b/resource-manager/servicebus/2021-06-01-preview/queuesauthorizationrule/id_queueauthorizationrule.go @@ -40,27 +40,9 @@ func ParseQueueAuthorizationRuleID(input string) (*QueueAuthorizationRuleId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QueueAuthorizationRuleId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.QueueName, ok = parsed.Parsed["queueName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "queueName", *parsed) - } - - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseQueueAuthorizationRuleIDInsensitively(input string) (*QueueAuthorizati return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QueueAuthorizationRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *QueueAuthorizationRuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.QueueName, ok = parsed.Parsed["queueName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "queueName", *parsed) + if id.QueueName, ok = input.Parsed["queueName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "queueName", input) } - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if id.AuthorizationRuleName, ok = input.Parsed["authorizationRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", input) } - return &id, nil + return nil } // ValidateQueueAuthorizationRuleID checks that 'input' can be parsed as a Queue Authorization Rule ID diff --git a/resource-manager/servicebus/2021-06-01-preview/rules/id_rule.go b/resource-manager/servicebus/2021-06-01-preview/rules/id_rule.go index 75b5c4685c2..be243db643e 100644 --- a/resource-manager/servicebus/2021-06-01-preview/rules/id_rule.go +++ b/resource-manager/servicebus/2021-06-01-preview/rules/id_rule.go @@ -42,31 +42,9 @@ func ParseRuleID(input string) (*RuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RuleId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) - } - - if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", *parsed) - } - - if id.RuleName, ok = parsed.Parsed["ruleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseRuleIDInsensitively(input string) (*RuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) + if id.TopicName, ok = input.Parsed["topicName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "topicName", input) } - if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", *parsed) + if id.SubscriptionName, ok = input.Parsed["subscriptionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", input) } - if id.RuleName, ok = parsed.Parsed["ruleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleName", *parsed) + if id.RuleName, ok = input.Parsed["ruleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleName", input) } - return &id, nil + return nil } // ValidateRuleID checks that 'input' can be parsed as a Rule ID diff --git a/resource-manager/servicebus/2021-06-01-preview/rules/id_subscriptions2.go b/resource-manager/servicebus/2021-06-01-preview/rules/id_subscriptions2.go index 82ab917e49f..0bfa80e2976 100644 --- a/resource-manager/servicebus/2021-06-01-preview/rules/id_subscriptions2.go +++ b/resource-manager/servicebus/2021-06-01-preview/rules/id_subscriptions2.go @@ -40,27 +40,9 @@ func ParseSubscriptions2ID(input string) (*Subscriptions2Id, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Subscriptions2Id{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) - } - - if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSubscriptions2IDInsensitively(input string) (*Subscriptions2Id, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Subscriptions2Id{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *Subscriptions2Id) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) + if id.TopicName, ok = input.Parsed["topicName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "topicName", input) } - if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", *parsed) + if id.SubscriptionName, ok = input.Parsed["subscriptionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", input) } - return &id, nil + return nil } // ValidateSubscriptions2ID checks that 'input' can be parsed as a Subscriptions 2 ID diff --git a/resource-manager/servicebus/2021-06-01-preview/subscriptions/id_rule.go b/resource-manager/servicebus/2021-06-01-preview/subscriptions/id_rule.go index 0b6ed31a168..08f779cc463 100644 --- a/resource-manager/servicebus/2021-06-01-preview/subscriptions/id_rule.go +++ b/resource-manager/servicebus/2021-06-01-preview/subscriptions/id_rule.go @@ -42,31 +42,9 @@ func ParseRuleID(input string) (*RuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RuleId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) - } - - if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", *parsed) - } - - if id.RuleName, ok = parsed.Parsed["ruleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseRuleIDInsensitively(input string) (*RuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) + if id.TopicName, ok = input.Parsed["topicName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "topicName", input) } - if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", *parsed) + if id.SubscriptionName, ok = input.Parsed["subscriptionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", input) } - if id.RuleName, ok = parsed.Parsed["ruleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleName", *parsed) + if id.RuleName, ok = input.Parsed["ruleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleName", input) } - return &id, nil + return nil } // ValidateRuleID checks that 'input' can be parsed as a Rule ID diff --git a/resource-manager/servicebus/2021-06-01-preview/subscriptions/id_subscriptions2.go b/resource-manager/servicebus/2021-06-01-preview/subscriptions/id_subscriptions2.go index 593edab6203..4b8c9e658ba 100644 --- a/resource-manager/servicebus/2021-06-01-preview/subscriptions/id_subscriptions2.go +++ b/resource-manager/servicebus/2021-06-01-preview/subscriptions/id_subscriptions2.go @@ -40,27 +40,9 @@ func ParseSubscriptions2ID(input string) (*Subscriptions2Id, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Subscriptions2Id{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) - } - - if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSubscriptions2IDInsensitively(input string) (*Subscriptions2Id, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Subscriptions2Id{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *Subscriptions2Id) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) + if id.TopicName, ok = input.Parsed["topicName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "topicName", input) } - if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", *parsed) + if id.SubscriptionName, ok = input.Parsed["subscriptionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", input) } - return &id, nil + return nil } // ValidateSubscriptions2ID checks that 'input' can be parsed as a Subscriptions 2 ID diff --git a/resource-manager/servicebus/2021-06-01-preview/subscriptions/id_topic.go b/resource-manager/servicebus/2021-06-01-preview/subscriptions/id_topic.go index 221ab83019f..d5d7209b582 100644 --- a/resource-manager/servicebus/2021-06-01-preview/subscriptions/id_topic.go +++ b/resource-manager/servicebus/2021-06-01-preview/subscriptions/id_topic.go @@ -38,23 +38,9 @@ func ParseTopicID(input string) (*TopicId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TopicId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTopicIDInsensitively(input string) (*TopicId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TopicId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TopicId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) + if id.TopicName, ok = input.Parsed["topicName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "topicName", input) } - return &id, nil + return nil } // ValidateTopicID checks that 'input' can be parsed as a Topic ID diff --git a/resource-manager/servicebus/2021-06-01-preview/topics/id_namespace.go b/resource-manager/servicebus/2021-06-01-preview/topics/id_namespace.go index 87dc792fd92..e495261108e 100644 --- a/resource-manager/servicebus/2021-06-01-preview/topics/id_namespace.go +++ b/resource-manager/servicebus/2021-06-01-preview/topics/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/servicebus/2021-06-01-preview/topics/id_topic.go b/resource-manager/servicebus/2021-06-01-preview/topics/id_topic.go index a3b6c932618..bba4a71f8a3 100644 --- a/resource-manager/servicebus/2021-06-01-preview/topics/id_topic.go +++ b/resource-manager/servicebus/2021-06-01-preview/topics/id_topic.go @@ -38,23 +38,9 @@ func ParseTopicID(input string) (*TopicId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TopicId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTopicIDInsensitively(input string) (*TopicId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TopicId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TopicId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) + if id.TopicName, ok = input.Parsed["topicName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "topicName", input) } - return &id, nil + return nil } // ValidateTopicID checks that 'input' can be parsed as a Topic ID diff --git a/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/id_topic.go b/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/id_topic.go index 953b74da019..f5fbf6da299 100644 --- a/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/id_topic.go +++ b/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/id_topic.go @@ -38,23 +38,9 @@ func ParseTopicID(input string) (*TopicId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TopicId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTopicIDInsensitively(input string) (*TopicId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TopicId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TopicId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) + if id.TopicName, ok = input.Parsed["topicName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "topicName", input) } - return &id, nil + return nil } // ValidateTopicID checks that 'input' can be parsed as a Topic ID diff --git a/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/id_topicauthorizationrule.go b/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/id_topicauthorizationrule.go index 8de5466ad9c..72254933103 100644 --- a/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/id_topicauthorizationrule.go +++ b/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule/id_topicauthorizationrule.go @@ -40,27 +40,9 @@ func ParseTopicAuthorizationRuleID(input string) (*TopicAuthorizationRuleId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TopicAuthorizationRuleId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) - } - - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseTopicAuthorizationRuleIDInsensitively(input string) (*TopicAuthorizati return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TopicAuthorizationRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TopicAuthorizationRuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) + if id.TopicName, ok = input.Parsed["topicName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "topicName", input) } - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if id.AuthorizationRuleName, ok = input.Parsed["authorizationRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", input) } - return &id, nil + return nil } // ValidateTopicAuthorizationRuleID checks that 'input' can be parsed as a Topic Authorization Rule ID diff --git a/resource-manager/servicebus/2021-11-01/disasterrecoveryconfigs/id_disasterrecoveryconfig.go b/resource-manager/servicebus/2021-11-01/disasterrecoveryconfigs/id_disasterrecoveryconfig.go index a92302146e1..cf12ba2d6a8 100644 --- a/resource-manager/servicebus/2021-11-01/disasterrecoveryconfigs/id_disasterrecoveryconfig.go +++ b/resource-manager/servicebus/2021-11-01/disasterrecoveryconfigs/id_disasterrecoveryconfig.go @@ -38,23 +38,9 @@ func ParseDisasterRecoveryConfigID(input string) (*DisasterRecoveryConfigId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DisasterRecoveryConfigId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.DisasterRecoveryConfigName, ok = parsed.Parsed["disasterRecoveryConfigName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "disasterRecoveryConfigName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDisasterRecoveryConfigIDInsensitively(input string) (*DisasterRecovery return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DisasterRecoveryConfigId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DisasterRecoveryConfigId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.DisasterRecoveryConfigName, ok = parsed.Parsed["disasterRecoveryConfigName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "disasterRecoveryConfigName", *parsed) + if id.DisasterRecoveryConfigName, ok = input.Parsed["disasterRecoveryConfigName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "disasterRecoveryConfigName", input) } - return &id, nil + return nil } // ValidateDisasterRecoveryConfigID checks that 'input' can be parsed as a Disaster Recovery Config ID diff --git a/resource-manager/servicebus/2021-11-01/disasterrecoveryconfigs/id_disasterrecoveryconfigauthorizationrule.go b/resource-manager/servicebus/2021-11-01/disasterrecoveryconfigs/id_disasterrecoveryconfigauthorizationrule.go index 303919d360f..3d722d5c40a 100644 --- a/resource-manager/servicebus/2021-11-01/disasterrecoveryconfigs/id_disasterrecoveryconfigauthorizationrule.go +++ b/resource-manager/servicebus/2021-11-01/disasterrecoveryconfigs/id_disasterrecoveryconfigauthorizationrule.go @@ -40,27 +40,9 @@ func ParseDisasterRecoveryConfigAuthorizationRuleID(input string) (*DisasterReco return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DisasterRecoveryConfigAuthorizationRuleId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.DisasterRecoveryConfigName, ok = parsed.Parsed["disasterRecoveryConfigName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "disasterRecoveryConfigName", *parsed) - } - - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseDisasterRecoveryConfigAuthorizationRuleIDInsensitively(input string) ( return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DisasterRecoveryConfigAuthorizationRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DisasterRecoveryConfigAuthorizationRuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.DisasterRecoveryConfigName, ok = parsed.Parsed["disasterRecoveryConfigName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "disasterRecoveryConfigName", *parsed) + if id.DisasterRecoveryConfigName, ok = input.Parsed["disasterRecoveryConfigName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "disasterRecoveryConfigName", input) } - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if id.AuthorizationRuleName, ok = input.Parsed["authorizationRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", input) } - return &id, nil + return nil } // ValidateDisasterRecoveryConfigAuthorizationRuleID checks that 'input' can be parsed as a Disaster Recovery Config Authorization Rule ID diff --git a/resource-manager/servicebus/2021-11-01/disasterrecoveryconfigs/id_namespace.go b/resource-manager/servicebus/2021-11-01/disasterrecoveryconfigs/id_namespace.go index 4d69695f309..33cc170a839 100644 --- a/resource-manager/servicebus/2021-11-01/disasterrecoveryconfigs/id_namespace.go +++ b/resource-manager/servicebus/2021-11-01/disasterrecoveryconfigs/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/servicebus/2021-11-01/migrationconfigs/id_namespace.go b/resource-manager/servicebus/2021-11-01/migrationconfigs/id_namespace.go index 425e2f7f243..db0af157b3a 100644 --- a/resource-manager/servicebus/2021-11-01/migrationconfigs/id_namespace.go +++ b/resource-manager/servicebus/2021-11-01/migrationconfigs/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/servicebus/2021-11-01/namespaces/id_namespace.go b/resource-manager/servicebus/2021-11-01/namespaces/id_namespace.go index 7fcca1198a8..c01beabeef4 100644 --- a/resource-manager/servicebus/2021-11-01/namespaces/id_namespace.go +++ b/resource-manager/servicebus/2021-11-01/namespaces/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/servicebus/2021-11-01/namespacesauthorizationrule/id_authorizationrule.go b/resource-manager/servicebus/2021-11-01/namespacesauthorizationrule/id_authorizationrule.go index 64322aa236d..681f4ec8232 100644 --- a/resource-manager/servicebus/2021-11-01/namespacesauthorizationrule/id_authorizationrule.go +++ b/resource-manager/servicebus/2021-11-01/namespacesauthorizationrule/id_authorizationrule.go @@ -38,23 +38,9 @@ func ParseAuthorizationRuleID(input string) (*AuthorizationRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationRuleId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAuthorizationRuleIDInsensitively(input string) (*AuthorizationRuleId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AuthorizationRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if id.AuthorizationRuleName, ok = input.Parsed["authorizationRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", input) } - return &id, nil + return nil } // ValidateAuthorizationRuleID checks that 'input' can be parsed as a Authorization Rule ID diff --git a/resource-manager/servicebus/2021-11-01/namespacesauthorizationrule/id_namespace.go b/resource-manager/servicebus/2021-11-01/namespacesauthorizationrule/id_namespace.go index 9b51ad2b6e6..8658cd576ea 100644 --- a/resource-manager/servicebus/2021-11-01/namespacesauthorizationrule/id_namespace.go +++ b/resource-manager/servicebus/2021-11-01/namespacesauthorizationrule/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/servicebus/2021-11-01/namespacesprivateendpointconnections/id_namespace.go b/resource-manager/servicebus/2021-11-01/namespacesprivateendpointconnections/id_namespace.go index 4d0c5477fb6..9f93804aa05 100644 --- a/resource-manager/servicebus/2021-11-01/namespacesprivateendpointconnections/id_namespace.go +++ b/resource-manager/servicebus/2021-11-01/namespacesprivateendpointconnections/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/servicebus/2021-11-01/namespacesprivateendpointconnections/id_privateendpointconnection.go b/resource-manager/servicebus/2021-11-01/namespacesprivateendpointconnections/id_privateendpointconnection.go index 3a14db43455..08769f2478b 100644 --- a/resource-manager/servicebus/2021-11-01/namespacesprivateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/servicebus/2021-11-01/namespacesprivateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/servicebus/2021-11-01/namespacesprivatelinkresources/id_namespace.go b/resource-manager/servicebus/2021-11-01/namespacesprivatelinkresources/id_namespace.go index b9039f21e31..c7a6ceb6165 100644 --- a/resource-manager/servicebus/2021-11-01/namespacesprivatelinkresources/id_namespace.go +++ b/resource-manager/servicebus/2021-11-01/namespacesprivatelinkresources/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/servicebus/2021-11-01/queues/id_namespace.go b/resource-manager/servicebus/2021-11-01/queues/id_namespace.go index 67a0908584b..255b1b339e5 100644 --- a/resource-manager/servicebus/2021-11-01/queues/id_namespace.go +++ b/resource-manager/servicebus/2021-11-01/queues/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/servicebus/2021-11-01/queues/id_queue.go b/resource-manager/servicebus/2021-11-01/queues/id_queue.go index 848018d12db..34b652098a2 100644 --- a/resource-manager/servicebus/2021-11-01/queues/id_queue.go +++ b/resource-manager/servicebus/2021-11-01/queues/id_queue.go @@ -38,23 +38,9 @@ func ParseQueueID(input string) (*QueueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QueueId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.QueueName, ok = parsed.Parsed["queueName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "queueName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseQueueIDInsensitively(input string) (*QueueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QueueId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *QueueId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.QueueName, ok = parsed.Parsed["queueName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "queueName", *parsed) + if id.QueueName, ok = input.Parsed["queueName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "queueName", input) } - return &id, nil + return nil } // ValidateQueueID checks that 'input' can be parsed as a Queue ID diff --git a/resource-manager/servicebus/2021-11-01/queuesauthorizationrule/id_queue.go b/resource-manager/servicebus/2021-11-01/queuesauthorizationrule/id_queue.go index 7e7b1def535..de1e9a946d8 100644 --- a/resource-manager/servicebus/2021-11-01/queuesauthorizationrule/id_queue.go +++ b/resource-manager/servicebus/2021-11-01/queuesauthorizationrule/id_queue.go @@ -38,23 +38,9 @@ func ParseQueueID(input string) (*QueueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QueueId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.QueueName, ok = parsed.Parsed["queueName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "queueName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseQueueIDInsensitively(input string) (*QueueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QueueId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *QueueId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.QueueName, ok = parsed.Parsed["queueName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "queueName", *parsed) + if id.QueueName, ok = input.Parsed["queueName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "queueName", input) } - return &id, nil + return nil } // ValidateQueueID checks that 'input' can be parsed as a Queue ID diff --git a/resource-manager/servicebus/2021-11-01/queuesauthorizationrule/id_queueauthorizationrule.go b/resource-manager/servicebus/2021-11-01/queuesauthorizationrule/id_queueauthorizationrule.go index 2c5d813f355..d0b0d85e535 100644 --- a/resource-manager/servicebus/2021-11-01/queuesauthorizationrule/id_queueauthorizationrule.go +++ b/resource-manager/servicebus/2021-11-01/queuesauthorizationrule/id_queueauthorizationrule.go @@ -40,27 +40,9 @@ func ParseQueueAuthorizationRuleID(input string) (*QueueAuthorizationRuleId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QueueAuthorizationRuleId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.QueueName, ok = parsed.Parsed["queueName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "queueName", *parsed) - } - - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseQueueAuthorizationRuleIDInsensitively(input string) (*QueueAuthorizati return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QueueAuthorizationRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *QueueAuthorizationRuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.QueueName, ok = parsed.Parsed["queueName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "queueName", *parsed) + if id.QueueName, ok = input.Parsed["queueName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "queueName", input) } - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if id.AuthorizationRuleName, ok = input.Parsed["authorizationRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", input) } - return &id, nil + return nil } // ValidateQueueAuthorizationRuleID checks that 'input' can be parsed as a Queue Authorization Rule ID diff --git a/resource-manager/servicebus/2021-11-01/rules/id_rule.go b/resource-manager/servicebus/2021-11-01/rules/id_rule.go index 75b5c4685c2..be243db643e 100644 --- a/resource-manager/servicebus/2021-11-01/rules/id_rule.go +++ b/resource-manager/servicebus/2021-11-01/rules/id_rule.go @@ -42,31 +42,9 @@ func ParseRuleID(input string) (*RuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RuleId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) - } - - if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", *parsed) - } - - if id.RuleName, ok = parsed.Parsed["ruleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseRuleIDInsensitively(input string) (*RuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) + if id.TopicName, ok = input.Parsed["topicName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "topicName", input) } - if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", *parsed) + if id.SubscriptionName, ok = input.Parsed["subscriptionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", input) } - if id.RuleName, ok = parsed.Parsed["ruleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleName", *parsed) + if id.RuleName, ok = input.Parsed["ruleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleName", input) } - return &id, nil + return nil } // ValidateRuleID checks that 'input' can be parsed as a Rule ID diff --git a/resource-manager/servicebus/2021-11-01/rules/id_subscriptions2.go b/resource-manager/servicebus/2021-11-01/rules/id_subscriptions2.go index 82ab917e49f..0bfa80e2976 100644 --- a/resource-manager/servicebus/2021-11-01/rules/id_subscriptions2.go +++ b/resource-manager/servicebus/2021-11-01/rules/id_subscriptions2.go @@ -40,27 +40,9 @@ func ParseSubscriptions2ID(input string) (*Subscriptions2Id, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Subscriptions2Id{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) - } - - if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSubscriptions2IDInsensitively(input string) (*Subscriptions2Id, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Subscriptions2Id{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *Subscriptions2Id) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) + if id.TopicName, ok = input.Parsed["topicName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "topicName", input) } - if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", *parsed) + if id.SubscriptionName, ok = input.Parsed["subscriptionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", input) } - return &id, nil + return nil } // ValidateSubscriptions2ID checks that 'input' can be parsed as a Subscriptions 2 ID diff --git a/resource-manager/servicebus/2021-11-01/subscriptions/id_rule.go b/resource-manager/servicebus/2021-11-01/subscriptions/id_rule.go index 0b6ed31a168..08f779cc463 100644 --- a/resource-manager/servicebus/2021-11-01/subscriptions/id_rule.go +++ b/resource-manager/servicebus/2021-11-01/subscriptions/id_rule.go @@ -42,31 +42,9 @@ func ParseRuleID(input string) (*RuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RuleId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) - } - - if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", *parsed) - } - - if id.RuleName, ok = parsed.Parsed["ruleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseRuleIDInsensitively(input string) (*RuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) + if id.TopicName, ok = input.Parsed["topicName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "topicName", input) } - if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", *parsed) + if id.SubscriptionName, ok = input.Parsed["subscriptionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", input) } - if id.RuleName, ok = parsed.Parsed["ruleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleName", *parsed) + if id.RuleName, ok = input.Parsed["ruleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleName", input) } - return &id, nil + return nil } // ValidateRuleID checks that 'input' can be parsed as a Rule ID diff --git a/resource-manager/servicebus/2021-11-01/subscriptions/id_subscriptions2.go b/resource-manager/servicebus/2021-11-01/subscriptions/id_subscriptions2.go index 593edab6203..4b8c9e658ba 100644 --- a/resource-manager/servicebus/2021-11-01/subscriptions/id_subscriptions2.go +++ b/resource-manager/servicebus/2021-11-01/subscriptions/id_subscriptions2.go @@ -40,27 +40,9 @@ func ParseSubscriptions2ID(input string) (*Subscriptions2Id, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Subscriptions2Id{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) - } - - if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSubscriptions2IDInsensitively(input string) (*Subscriptions2Id, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Subscriptions2Id{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *Subscriptions2Id) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) + if id.TopicName, ok = input.Parsed["topicName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "topicName", input) } - if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", *parsed) + if id.SubscriptionName, ok = input.Parsed["subscriptionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", input) } - return &id, nil + return nil } // ValidateSubscriptions2ID checks that 'input' can be parsed as a Subscriptions 2 ID diff --git a/resource-manager/servicebus/2021-11-01/subscriptions/id_topic.go b/resource-manager/servicebus/2021-11-01/subscriptions/id_topic.go index 221ab83019f..d5d7209b582 100644 --- a/resource-manager/servicebus/2021-11-01/subscriptions/id_topic.go +++ b/resource-manager/servicebus/2021-11-01/subscriptions/id_topic.go @@ -38,23 +38,9 @@ func ParseTopicID(input string) (*TopicId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TopicId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTopicIDInsensitively(input string) (*TopicId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TopicId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TopicId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) + if id.TopicName, ok = input.Parsed["topicName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "topicName", input) } - return &id, nil + return nil } // ValidateTopicID checks that 'input' can be parsed as a Topic ID diff --git a/resource-manager/servicebus/2021-11-01/topics/id_namespace.go b/resource-manager/servicebus/2021-11-01/topics/id_namespace.go index 87dc792fd92..e495261108e 100644 --- a/resource-manager/servicebus/2021-11-01/topics/id_namespace.go +++ b/resource-manager/servicebus/2021-11-01/topics/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/servicebus/2021-11-01/topics/id_topic.go b/resource-manager/servicebus/2021-11-01/topics/id_topic.go index a3b6c932618..bba4a71f8a3 100644 --- a/resource-manager/servicebus/2021-11-01/topics/id_topic.go +++ b/resource-manager/servicebus/2021-11-01/topics/id_topic.go @@ -38,23 +38,9 @@ func ParseTopicID(input string) (*TopicId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TopicId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTopicIDInsensitively(input string) (*TopicId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TopicId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TopicId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) + if id.TopicName, ok = input.Parsed["topicName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "topicName", input) } - return &id, nil + return nil } // ValidateTopicID checks that 'input' can be parsed as a Topic ID diff --git a/resource-manager/servicebus/2021-11-01/topicsauthorizationrule/id_topic.go b/resource-manager/servicebus/2021-11-01/topicsauthorizationrule/id_topic.go index 953b74da019..f5fbf6da299 100644 --- a/resource-manager/servicebus/2021-11-01/topicsauthorizationrule/id_topic.go +++ b/resource-manager/servicebus/2021-11-01/topicsauthorizationrule/id_topic.go @@ -38,23 +38,9 @@ func ParseTopicID(input string) (*TopicId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TopicId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTopicIDInsensitively(input string) (*TopicId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TopicId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TopicId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) + if id.TopicName, ok = input.Parsed["topicName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "topicName", input) } - return &id, nil + return nil } // ValidateTopicID checks that 'input' can be parsed as a Topic ID diff --git a/resource-manager/servicebus/2021-11-01/topicsauthorizationrule/id_topicauthorizationrule.go b/resource-manager/servicebus/2021-11-01/topicsauthorizationrule/id_topicauthorizationrule.go index 8de5466ad9c..72254933103 100644 --- a/resource-manager/servicebus/2021-11-01/topicsauthorizationrule/id_topicauthorizationrule.go +++ b/resource-manager/servicebus/2021-11-01/topicsauthorizationrule/id_topicauthorizationrule.go @@ -40,27 +40,9 @@ func ParseTopicAuthorizationRuleID(input string) (*TopicAuthorizationRuleId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TopicAuthorizationRuleId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) - } - - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseTopicAuthorizationRuleIDInsensitively(input string) (*TopicAuthorizati return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TopicAuthorizationRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TopicAuthorizationRuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) + if id.TopicName, ok = input.Parsed["topicName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "topicName", input) } - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if id.AuthorizationRuleName, ok = input.Parsed["authorizationRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", input) } - return &id, nil + return nil } // ValidateTopicAuthorizationRuleID checks that 'input' can be parsed as a Topic Authorization Rule ID diff --git a/resource-manager/servicebus/2022-01-01-preview/disasterrecoveryconfigs/id_disasterrecoveryconfig.go b/resource-manager/servicebus/2022-01-01-preview/disasterrecoveryconfigs/id_disasterrecoveryconfig.go index a92302146e1..cf12ba2d6a8 100644 --- a/resource-manager/servicebus/2022-01-01-preview/disasterrecoveryconfigs/id_disasterrecoveryconfig.go +++ b/resource-manager/servicebus/2022-01-01-preview/disasterrecoveryconfigs/id_disasterrecoveryconfig.go @@ -38,23 +38,9 @@ func ParseDisasterRecoveryConfigID(input string) (*DisasterRecoveryConfigId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DisasterRecoveryConfigId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.DisasterRecoveryConfigName, ok = parsed.Parsed["disasterRecoveryConfigName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "disasterRecoveryConfigName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDisasterRecoveryConfigIDInsensitively(input string) (*DisasterRecovery return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DisasterRecoveryConfigId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DisasterRecoveryConfigId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.DisasterRecoveryConfigName, ok = parsed.Parsed["disasterRecoveryConfigName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "disasterRecoveryConfigName", *parsed) + if id.DisasterRecoveryConfigName, ok = input.Parsed["disasterRecoveryConfigName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "disasterRecoveryConfigName", input) } - return &id, nil + return nil } // ValidateDisasterRecoveryConfigID checks that 'input' can be parsed as a Disaster Recovery Config ID diff --git a/resource-manager/servicebus/2022-01-01-preview/disasterrecoveryconfigs/id_disasterrecoveryconfigauthorizationrule.go b/resource-manager/servicebus/2022-01-01-preview/disasterrecoveryconfigs/id_disasterrecoveryconfigauthorizationrule.go index 303919d360f..3d722d5c40a 100644 --- a/resource-manager/servicebus/2022-01-01-preview/disasterrecoveryconfigs/id_disasterrecoveryconfigauthorizationrule.go +++ b/resource-manager/servicebus/2022-01-01-preview/disasterrecoveryconfigs/id_disasterrecoveryconfigauthorizationrule.go @@ -40,27 +40,9 @@ func ParseDisasterRecoveryConfigAuthorizationRuleID(input string) (*DisasterReco return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DisasterRecoveryConfigAuthorizationRuleId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.DisasterRecoveryConfigName, ok = parsed.Parsed["disasterRecoveryConfigName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "disasterRecoveryConfigName", *parsed) - } - - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseDisasterRecoveryConfigAuthorizationRuleIDInsensitively(input string) ( return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DisasterRecoveryConfigAuthorizationRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DisasterRecoveryConfigAuthorizationRuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.DisasterRecoveryConfigName, ok = parsed.Parsed["disasterRecoveryConfigName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "disasterRecoveryConfigName", *parsed) + if id.DisasterRecoveryConfigName, ok = input.Parsed["disasterRecoveryConfigName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "disasterRecoveryConfigName", input) } - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if id.AuthorizationRuleName, ok = input.Parsed["authorizationRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", input) } - return &id, nil + return nil } // ValidateDisasterRecoveryConfigAuthorizationRuleID checks that 'input' can be parsed as a Disaster Recovery Config Authorization Rule ID diff --git a/resource-manager/servicebus/2022-01-01-preview/disasterrecoveryconfigs/id_namespace.go b/resource-manager/servicebus/2022-01-01-preview/disasterrecoveryconfigs/id_namespace.go index 4d69695f309..33cc170a839 100644 --- a/resource-manager/servicebus/2022-01-01-preview/disasterrecoveryconfigs/id_namespace.go +++ b/resource-manager/servicebus/2022-01-01-preview/disasterrecoveryconfigs/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/servicebus/2022-01-01-preview/migrationconfigs/id_namespace.go b/resource-manager/servicebus/2022-01-01-preview/migrationconfigs/id_namespace.go index 425e2f7f243..db0af157b3a 100644 --- a/resource-manager/servicebus/2022-01-01-preview/migrationconfigs/id_namespace.go +++ b/resource-manager/servicebus/2022-01-01-preview/migrationconfigs/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/servicebus/2022-01-01-preview/namespaces/id_namespace.go b/resource-manager/servicebus/2022-01-01-preview/namespaces/id_namespace.go index 7fcca1198a8..c01beabeef4 100644 --- a/resource-manager/servicebus/2022-01-01-preview/namespaces/id_namespace.go +++ b/resource-manager/servicebus/2022-01-01-preview/namespaces/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/servicebus/2022-01-01-preview/namespacesauthorizationrule/id_authorizationrule.go b/resource-manager/servicebus/2022-01-01-preview/namespacesauthorizationrule/id_authorizationrule.go index 64322aa236d..681f4ec8232 100644 --- a/resource-manager/servicebus/2022-01-01-preview/namespacesauthorizationrule/id_authorizationrule.go +++ b/resource-manager/servicebus/2022-01-01-preview/namespacesauthorizationrule/id_authorizationrule.go @@ -38,23 +38,9 @@ func ParseAuthorizationRuleID(input string) (*AuthorizationRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationRuleId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAuthorizationRuleIDInsensitively(input string) (*AuthorizationRuleId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AuthorizationRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if id.AuthorizationRuleName, ok = input.Parsed["authorizationRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", input) } - return &id, nil + return nil } // ValidateAuthorizationRuleID checks that 'input' can be parsed as a Authorization Rule ID diff --git a/resource-manager/servicebus/2022-01-01-preview/namespacesauthorizationrule/id_namespace.go b/resource-manager/servicebus/2022-01-01-preview/namespacesauthorizationrule/id_namespace.go index 9b51ad2b6e6..8658cd576ea 100644 --- a/resource-manager/servicebus/2022-01-01-preview/namespacesauthorizationrule/id_namespace.go +++ b/resource-manager/servicebus/2022-01-01-preview/namespacesauthorizationrule/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/servicebus/2022-01-01-preview/namespacesprivateendpointconnections/id_namespace.go b/resource-manager/servicebus/2022-01-01-preview/namespacesprivateendpointconnections/id_namespace.go index 4d0c5477fb6..9f93804aa05 100644 --- a/resource-manager/servicebus/2022-01-01-preview/namespacesprivateendpointconnections/id_namespace.go +++ b/resource-manager/servicebus/2022-01-01-preview/namespacesprivateendpointconnections/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/servicebus/2022-01-01-preview/namespacesprivateendpointconnections/id_privateendpointconnection.go b/resource-manager/servicebus/2022-01-01-preview/namespacesprivateendpointconnections/id_privateendpointconnection.go index 3a14db43455..08769f2478b 100644 --- a/resource-manager/servicebus/2022-01-01-preview/namespacesprivateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/servicebus/2022-01-01-preview/namespacesprivateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/servicebus/2022-01-01-preview/namespacesprivatelinkresources/id_namespace.go b/resource-manager/servicebus/2022-01-01-preview/namespacesprivatelinkresources/id_namespace.go index b9039f21e31..c7a6ceb6165 100644 --- a/resource-manager/servicebus/2022-01-01-preview/namespacesprivatelinkresources/id_namespace.go +++ b/resource-manager/servicebus/2022-01-01-preview/namespacesprivatelinkresources/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/servicebus/2022-01-01-preview/queues/id_namespace.go b/resource-manager/servicebus/2022-01-01-preview/queues/id_namespace.go index 67a0908584b..255b1b339e5 100644 --- a/resource-manager/servicebus/2022-01-01-preview/queues/id_namespace.go +++ b/resource-manager/servicebus/2022-01-01-preview/queues/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/servicebus/2022-01-01-preview/queues/id_queue.go b/resource-manager/servicebus/2022-01-01-preview/queues/id_queue.go index 848018d12db..34b652098a2 100644 --- a/resource-manager/servicebus/2022-01-01-preview/queues/id_queue.go +++ b/resource-manager/servicebus/2022-01-01-preview/queues/id_queue.go @@ -38,23 +38,9 @@ func ParseQueueID(input string) (*QueueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QueueId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.QueueName, ok = parsed.Parsed["queueName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "queueName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseQueueIDInsensitively(input string) (*QueueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QueueId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *QueueId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.QueueName, ok = parsed.Parsed["queueName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "queueName", *parsed) + if id.QueueName, ok = input.Parsed["queueName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "queueName", input) } - return &id, nil + return nil } // ValidateQueueID checks that 'input' can be parsed as a Queue ID diff --git a/resource-manager/servicebus/2022-01-01-preview/queuesauthorizationrule/id_queue.go b/resource-manager/servicebus/2022-01-01-preview/queuesauthorizationrule/id_queue.go index 7e7b1def535..de1e9a946d8 100644 --- a/resource-manager/servicebus/2022-01-01-preview/queuesauthorizationrule/id_queue.go +++ b/resource-manager/servicebus/2022-01-01-preview/queuesauthorizationrule/id_queue.go @@ -38,23 +38,9 @@ func ParseQueueID(input string) (*QueueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QueueId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.QueueName, ok = parsed.Parsed["queueName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "queueName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseQueueIDInsensitively(input string) (*QueueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QueueId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *QueueId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.QueueName, ok = parsed.Parsed["queueName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "queueName", *parsed) + if id.QueueName, ok = input.Parsed["queueName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "queueName", input) } - return &id, nil + return nil } // ValidateQueueID checks that 'input' can be parsed as a Queue ID diff --git a/resource-manager/servicebus/2022-01-01-preview/queuesauthorizationrule/id_queueauthorizationrule.go b/resource-manager/servicebus/2022-01-01-preview/queuesauthorizationrule/id_queueauthorizationrule.go index 2c5d813f355..d0b0d85e535 100644 --- a/resource-manager/servicebus/2022-01-01-preview/queuesauthorizationrule/id_queueauthorizationrule.go +++ b/resource-manager/servicebus/2022-01-01-preview/queuesauthorizationrule/id_queueauthorizationrule.go @@ -40,27 +40,9 @@ func ParseQueueAuthorizationRuleID(input string) (*QueueAuthorizationRuleId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QueueAuthorizationRuleId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.QueueName, ok = parsed.Parsed["queueName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "queueName", *parsed) - } - - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseQueueAuthorizationRuleIDInsensitively(input string) (*QueueAuthorizati return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QueueAuthorizationRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *QueueAuthorizationRuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.QueueName, ok = parsed.Parsed["queueName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "queueName", *parsed) + if id.QueueName, ok = input.Parsed["queueName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "queueName", input) } - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if id.AuthorizationRuleName, ok = input.Parsed["authorizationRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", input) } - return &id, nil + return nil } // ValidateQueueAuthorizationRuleID checks that 'input' can be parsed as a Queue Authorization Rule ID diff --git a/resource-manager/servicebus/2022-01-01-preview/rules/id_rule.go b/resource-manager/servicebus/2022-01-01-preview/rules/id_rule.go index 75b5c4685c2..be243db643e 100644 --- a/resource-manager/servicebus/2022-01-01-preview/rules/id_rule.go +++ b/resource-manager/servicebus/2022-01-01-preview/rules/id_rule.go @@ -42,31 +42,9 @@ func ParseRuleID(input string) (*RuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RuleId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) - } - - if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", *parsed) - } - - if id.RuleName, ok = parsed.Parsed["ruleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseRuleIDInsensitively(input string) (*RuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) + if id.TopicName, ok = input.Parsed["topicName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "topicName", input) } - if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", *parsed) + if id.SubscriptionName, ok = input.Parsed["subscriptionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", input) } - if id.RuleName, ok = parsed.Parsed["ruleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleName", *parsed) + if id.RuleName, ok = input.Parsed["ruleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleName", input) } - return &id, nil + return nil } // ValidateRuleID checks that 'input' can be parsed as a Rule ID diff --git a/resource-manager/servicebus/2022-01-01-preview/rules/id_subscriptions2.go b/resource-manager/servicebus/2022-01-01-preview/rules/id_subscriptions2.go index 82ab917e49f..0bfa80e2976 100644 --- a/resource-manager/servicebus/2022-01-01-preview/rules/id_subscriptions2.go +++ b/resource-manager/servicebus/2022-01-01-preview/rules/id_subscriptions2.go @@ -40,27 +40,9 @@ func ParseSubscriptions2ID(input string) (*Subscriptions2Id, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Subscriptions2Id{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) - } - - if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSubscriptions2IDInsensitively(input string) (*Subscriptions2Id, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Subscriptions2Id{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *Subscriptions2Id) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) + if id.TopicName, ok = input.Parsed["topicName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "topicName", input) } - if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", *parsed) + if id.SubscriptionName, ok = input.Parsed["subscriptionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", input) } - return &id, nil + return nil } // ValidateSubscriptions2ID checks that 'input' can be parsed as a Subscriptions 2 ID diff --git a/resource-manager/servicebus/2022-01-01-preview/subscriptions/id_rule.go b/resource-manager/servicebus/2022-01-01-preview/subscriptions/id_rule.go index 0b6ed31a168..08f779cc463 100644 --- a/resource-manager/servicebus/2022-01-01-preview/subscriptions/id_rule.go +++ b/resource-manager/servicebus/2022-01-01-preview/subscriptions/id_rule.go @@ -42,31 +42,9 @@ func ParseRuleID(input string) (*RuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RuleId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) - } - - if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", *parsed) - } - - if id.RuleName, ok = parsed.Parsed["ruleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseRuleIDInsensitively(input string) (*RuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) + if id.TopicName, ok = input.Parsed["topicName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "topicName", input) } - if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", *parsed) + if id.SubscriptionName, ok = input.Parsed["subscriptionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", input) } - if id.RuleName, ok = parsed.Parsed["ruleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleName", *parsed) + if id.RuleName, ok = input.Parsed["ruleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleName", input) } - return &id, nil + return nil } // ValidateRuleID checks that 'input' can be parsed as a Rule ID diff --git a/resource-manager/servicebus/2022-01-01-preview/subscriptions/id_subscriptions2.go b/resource-manager/servicebus/2022-01-01-preview/subscriptions/id_subscriptions2.go index 593edab6203..4b8c9e658ba 100644 --- a/resource-manager/servicebus/2022-01-01-preview/subscriptions/id_subscriptions2.go +++ b/resource-manager/servicebus/2022-01-01-preview/subscriptions/id_subscriptions2.go @@ -40,27 +40,9 @@ func ParseSubscriptions2ID(input string) (*Subscriptions2Id, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Subscriptions2Id{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) - } - - if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSubscriptions2IDInsensitively(input string) (*Subscriptions2Id, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := Subscriptions2Id{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *Subscriptions2Id) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) + if id.TopicName, ok = input.Parsed["topicName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "topicName", input) } - if id.SubscriptionName, ok = parsed.Parsed["subscriptionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", *parsed) + if id.SubscriptionName, ok = input.Parsed["subscriptionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionName", input) } - return &id, nil + return nil } // ValidateSubscriptions2ID checks that 'input' can be parsed as a Subscriptions 2 ID diff --git a/resource-manager/servicebus/2022-01-01-preview/subscriptions/id_topic.go b/resource-manager/servicebus/2022-01-01-preview/subscriptions/id_topic.go index 221ab83019f..d5d7209b582 100644 --- a/resource-manager/servicebus/2022-01-01-preview/subscriptions/id_topic.go +++ b/resource-manager/servicebus/2022-01-01-preview/subscriptions/id_topic.go @@ -38,23 +38,9 @@ func ParseTopicID(input string) (*TopicId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TopicId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTopicIDInsensitively(input string) (*TopicId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TopicId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TopicId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) + if id.TopicName, ok = input.Parsed["topicName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "topicName", input) } - return &id, nil + return nil } // ValidateTopicID checks that 'input' can be parsed as a Topic ID diff --git a/resource-manager/servicebus/2022-01-01-preview/topics/id_namespace.go b/resource-manager/servicebus/2022-01-01-preview/topics/id_namespace.go index 87dc792fd92..e495261108e 100644 --- a/resource-manager/servicebus/2022-01-01-preview/topics/id_namespace.go +++ b/resource-manager/servicebus/2022-01-01-preview/topics/id_namespace.go @@ -36,19 +36,9 @@ func ParseNamespaceID(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseNamespaceIDInsensitively(input string) (*NamespaceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NamespaceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *NamespaceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - return &id, nil + return nil } // ValidateNamespaceID checks that 'input' can be parsed as a Namespace ID diff --git a/resource-manager/servicebus/2022-01-01-preview/topics/id_topic.go b/resource-manager/servicebus/2022-01-01-preview/topics/id_topic.go index a3b6c932618..bba4a71f8a3 100644 --- a/resource-manager/servicebus/2022-01-01-preview/topics/id_topic.go +++ b/resource-manager/servicebus/2022-01-01-preview/topics/id_topic.go @@ -38,23 +38,9 @@ func ParseTopicID(input string) (*TopicId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TopicId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTopicIDInsensitively(input string) (*TopicId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TopicId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TopicId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) + if id.TopicName, ok = input.Parsed["topicName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "topicName", input) } - return &id, nil + return nil } // ValidateTopicID checks that 'input' can be parsed as a Topic ID diff --git a/resource-manager/servicebus/2022-01-01-preview/topicsauthorizationrule/id_topic.go b/resource-manager/servicebus/2022-01-01-preview/topicsauthorizationrule/id_topic.go index 953b74da019..f5fbf6da299 100644 --- a/resource-manager/servicebus/2022-01-01-preview/topicsauthorizationrule/id_topic.go +++ b/resource-manager/servicebus/2022-01-01-preview/topicsauthorizationrule/id_topic.go @@ -38,23 +38,9 @@ func ParseTopicID(input string) (*TopicId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TopicId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTopicIDInsensitively(input string) (*TopicId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TopicId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TopicId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) + if id.TopicName, ok = input.Parsed["topicName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "topicName", input) } - return &id, nil + return nil } // ValidateTopicID checks that 'input' can be parsed as a Topic ID diff --git a/resource-manager/servicebus/2022-01-01-preview/topicsauthorizationrule/id_topicauthorizationrule.go b/resource-manager/servicebus/2022-01-01-preview/topicsauthorizationrule/id_topicauthorizationrule.go index 8de5466ad9c..72254933103 100644 --- a/resource-manager/servicebus/2022-01-01-preview/topicsauthorizationrule/id_topicauthorizationrule.go +++ b/resource-manager/servicebus/2022-01-01-preview/topicsauthorizationrule/id_topicauthorizationrule.go @@ -40,27 +40,9 @@ func ParseTopicAuthorizationRuleID(input string) (*TopicAuthorizationRuleId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TopicAuthorizationRuleId{} - - 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.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) - } - - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) - } - - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseTopicAuthorizationRuleIDInsensitively(input string) (*TopicAuthorizati return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TopicAuthorizationRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TopicAuthorizationRuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.NamespaceName, ok = parsed.Parsed["namespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", *parsed) + if id.NamespaceName, ok = input.Parsed["namespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "namespaceName", input) } - if id.TopicName, ok = parsed.Parsed["topicName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topicName", *parsed) + if id.TopicName, ok = input.Parsed["topicName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "topicName", input) } - if id.AuthorizationRuleName, ok = parsed.Parsed["authorizationRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", *parsed) + if id.AuthorizationRuleName, ok = input.Parsed["authorizationRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationRuleName", input) } - return &id, nil + return nil } // ValidateTopicAuthorizationRuleID checks that 'input' can be parsed as a Topic Authorization Rule ID diff --git a/resource-manager/servicefabric/2021-06-01/application/id_application.go b/resource-manager/servicefabric/2021-06-01/application/id_application.go index 5c1eff2537a..cabc325a1e3 100644 --- a/resource-manager/servicefabric/2021-06-01/application/id_application.go +++ b/resource-manager/servicefabric/2021-06-01/application/id_application.go @@ -38,23 +38,9 @@ func ParseApplicationID(input string) (*ApplicationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApplicationIDInsensitively(input string) (*ApplicationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApplicationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) + if id.ApplicationName, ok = input.Parsed["applicationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationName", input) } - return &id, nil + return nil } // ValidateApplicationID checks that 'input' can be parsed as a Application ID diff --git a/resource-manager/servicefabric/2021-06-01/application/id_cluster.go b/resource-manager/servicefabric/2021-06-01/application/id_cluster.go index b1d43a32b3c..583712188c4 100644 --- a/resource-manager/servicefabric/2021-06-01/application/id_cluster.go +++ b/resource-manager/servicefabric/2021-06-01/application/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/servicefabric/2021-06-01/applicationtype/id_applicationtype.go b/resource-manager/servicefabric/2021-06-01/applicationtype/id_applicationtype.go index a0dc846fdc6..d9a64518d6a 100644 --- a/resource-manager/servicefabric/2021-06-01/applicationtype/id_applicationtype.go +++ b/resource-manager/servicefabric/2021-06-01/applicationtype/id_applicationtype.go @@ -38,23 +38,9 @@ func ParseApplicationTypeID(input string) (*ApplicationTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationTypeId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.ApplicationTypeName, ok = parsed.Parsed["applicationTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationTypeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApplicationTypeIDInsensitively(input string) (*ApplicationTypeId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApplicationTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.ApplicationTypeName, ok = parsed.Parsed["applicationTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationTypeName", *parsed) + if id.ApplicationTypeName, ok = input.Parsed["applicationTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationTypeName", input) } - return &id, nil + return nil } // ValidateApplicationTypeID checks that 'input' can be parsed as a Application Type ID diff --git a/resource-manager/servicefabric/2021-06-01/applicationtype/id_cluster.go b/resource-manager/servicefabric/2021-06-01/applicationtype/id_cluster.go index 7b510aa985c..02337144c26 100644 --- a/resource-manager/servicefabric/2021-06-01/applicationtype/id_cluster.go +++ b/resource-manager/servicefabric/2021-06-01/applicationtype/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/servicefabric/2021-06-01/applicationtypeversion/id_applicationtype.go b/resource-manager/servicefabric/2021-06-01/applicationtypeversion/id_applicationtype.go index 63a32745b2a..ead6339125b 100644 --- a/resource-manager/servicefabric/2021-06-01/applicationtypeversion/id_applicationtype.go +++ b/resource-manager/servicefabric/2021-06-01/applicationtypeversion/id_applicationtype.go @@ -38,23 +38,9 @@ func ParseApplicationTypeID(input string) (*ApplicationTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationTypeId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.ApplicationTypeName, ok = parsed.Parsed["applicationTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationTypeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApplicationTypeIDInsensitively(input string) (*ApplicationTypeId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApplicationTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.ApplicationTypeName, ok = parsed.Parsed["applicationTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationTypeName", *parsed) + if id.ApplicationTypeName, ok = input.Parsed["applicationTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationTypeName", input) } - return &id, nil + return nil } // ValidateApplicationTypeID checks that 'input' can be parsed as a Application Type ID diff --git a/resource-manager/servicefabric/2021-06-01/applicationtypeversion/id_version.go b/resource-manager/servicefabric/2021-06-01/applicationtypeversion/id_version.go index 3343bc994e8..307b5b3baf3 100644 --- a/resource-manager/servicefabric/2021-06-01/applicationtypeversion/id_version.go +++ b/resource-manager/servicefabric/2021-06-01/applicationtypeversion/id_version.go @@ -40,27 +40,9 @@ func ParseVersionID(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.ApplicationTypeName, ok = parsed.Parsed["applicationTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationTypeName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVersionIDInsensitively(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.ApplicationTypeName, ok = parsed.Parsed["applicationTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationTypeName", *parsed) + if id.ApplicationTypeName, ok = input.Parsed["applicationTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationTypeName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateVersionID checks that 'input' can be parsed as a Version ID diff --git a/resource-manager/servicefabric/2021-06-01/cluster/id_cluster.go b/resource-manager/servicefabric/2021-06-01/cluster/id_cluster.go index 55d741f3bed..8153bd524a6 100644 --- a/resource-manager/servicefabric/2021-06-01/cluster/id_cluster.go +++ b/resource-manager/servicefabric/2021-06-01/cluster/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/servicefabric/2021-06-01/clusterversion/id_clusterversion.go b/resource-manager/servicefabric/2021-06-01/clusterversion/id_clusterversion.go index b8c6abe511b..8803e314a4f 100644 --- a/resource-manager/servicefabric/2021-06-01/clusterversion/id_clusterversion.go +++ b/resource-manager/servicefabric/2021-06-01/clusterversion/id_clusterversion.go @@ -36,19 +36,9 @@ func ParseClusterVersionID(input string) (*ClusterVersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterVersionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.ClusterVersionName, ok = parsed.Parsed["clusterVersionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterVersionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterVersionIDInsensitively(input string) (*ClusterVersionId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterVersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.ClusterVersionName, ok = parsed.Parsed["clusterVersionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterVersionName", *parsed) + if id.ClusterVersionName, ok = input.Parsed["clusterVersionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterVersionName", input) } - return &id, nil + return nil } // ValidateClusterVersionID checks that 'input' can be parsed as a Cluster Version ID diff --git a/resource-manager/servicefabric/2021-06-01/clusterversion/id_environment.go b/resource-manager/servicefabric/2021-06-01/clusterversion/id_environment.go index 726523b1fd5..e2c1c427a3a 100644 --- a/resource-manager/servicefabric/2021-06-01/clusterversion/id_environment.go +++ b/resource-manager/servicefabric/2021-06-01/clusterversion/id_environment.go @@ -36,27 +36,9 @@ func ParseEnvironmentID(input string) (*EnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if v, ok := parsed.Parsed["environment"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environment", *parsed) - } - - environment, err := parseClusterVersionsEnvironment(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.Environment = *environment + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -71,30 +53,38 @@ func ParseEnvironmentIDInsensitively(input string) (*EnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *EnvironmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if v, ok := parsed.Parsed["environment"]; true { + if v, ok := input.Parsed["environment"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environment", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "environment", input) } environment, err := parseClusterVersionsEnvironment(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.Environment = *environment } - return &id, nil + return nil } // ValidateEnvironmentID checks that 'input' can be parsed as a Environment ID diff --git a/resource-manager/servicefabric/2021-06-01/clusterversion/id_environmentclusterversion.go b/resource-manager/servicefabric/2021-06-01/clusterversion/id_environmentclusterversion.go index bceb94756f1..984f8cd473e 100644 --- a/resource-manager/servicefabric/2021-06-01/clusterversion/id_environmentclusterversion.go +++ b/resource-manager/servicefabric/2021-06-01/clusterversion/id_environmentclusterversion.go @@ -38,31 +38,9 @@ func ParseEnvironmentClusterVersionID(input string) (*EnvironmentClusterVersionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentClusterVersionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if v, ok := parsed.Parsed["environment"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environment", *parsed) - } - - environment, err := parseClusterVersionsEnvironment(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.Environment = *environment - } - - if id.ClusterVersionName, ok = parsed.Parsed["clusterVersionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterVersionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -77,34 +55,42 @@ func ParseEnvironmentClusterVersionIDInsensitively(input string) (*EnvironmentCl return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentClusterVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *EnvironmentClusterVersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if v, ok := parsed.Parsed["environment"]; true { + if v, ok := input.Parsed["environment"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environment", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "environment", input) } environment, err := parseClusterVersionsEnvironment(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.Environment = *environment } - if id.ClusterVersionName, ok = parsed.Parsed["clusterVersionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterVersionName", *parsed) + if id.ClusterVersionName, ok = input.Parsed["clusterVersionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterVersionName", input) } - return &id, nil + return nil } // ValidateEnvironmentClusterVersionID checks that 'input' can be parsed as a Environment Cluster Version ID diff --git a/resource-manager/servicefabric/2021-06-01/clusterversion/id_location.go b/resource-manager/servicefabric/2021-06-01/clusterversion/id_location.go index 1cebb3307c0..839af9c4807 100644 --- a/resource-manager/servicefabric/2021-06-01/clusterversion/id_location.go +++ b/resource-manager/servicefabric/2021-06-01/clusterversion/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/servicefabric/2021-06-01/listupgradableversions/id_cluster.go b/resource-manager/servicefabric/2021-06-01/listupgradableversions/id_cluster.go index caded6ce783..cb086d6d598 100644 --- a/resource-manager/servicefabric/2021-06-01/listupgradableversions/id_cluster.go +++ b/resource-manager/servicefabric/2021-06-01/listupgradableversions/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/servicefabric/2021-06-01/service/id_application.go b/resource-manager/servicefabric/2021-06-01/service/id_application.go index 29aef90e7ce..74900be4811 100644 --- a/resource-manager/servicefabric/2021-06-01/service/id_application.go +++ b/resource-manager/servicefabric/2021-06-01/service/id_application.go @@ -38,23 +38,9 @@ func ParseApplicationID(input string) (*ApplicationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApplicationIDInsensitively(input string) (*ApplicationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApplicationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) + if id.ApplicationName, ok = input.Parsed["applicationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationName", input) } - return &id, nil + return nil } // ValidateApplicationID checks that 'input' can be parsed as a Application ID diff --git a/resource-manager/servicefabric/2021-06-01/service/id_service.go b/resource-manager/servicefabric/2021-06-01/service/id_service.go index 4edc94584a9..2ad06213f9c 100644 --- a/resource-manager/servicefabric/2021-06-01/service/id_service.go +++ b/resource-manager/servicefabric/2021-06-01/service/id_service.go @@ -40,27 +40,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) - } - - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) + if id.ApplicationName, ok = input.Parsed["applicationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/servicefabricmanagedcluster/2021-05-01/application/id_application.go b/resource-manager/servicefabricmanagedcluster/2021-05-01/application/id_application.go index 0b014a47f82..a16a7b4f988 100644 --- a/resource-manager/servicefabricmanagedcluster/2021-05-01/application/id_application.go +++ b/resource-manager/servicefabricmanagedcluster/2021-05-01/application/id_application.go @@ -38,23 +38,9 @@ func ParseApplicationID(input string) (*ApplicationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationId{} - - 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.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) - } - - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApplicationIDInsensitively(input string) (*ApplicationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApplicationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if id.ManagedClusterName, ok = input.Parsed["managedClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", input) } - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) + if id.ApplicationName, ok = input.Parsed["applicationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationName", input) } - return &id, nil + return nil } // ValidateApplicationID checks that 'input' can be parsed as a Application ID diff --git a/resource-manager/servicefabricmanagedcluster/2021-05-01/application/id_managedcluster.go b/resource-manager/servicefabricmanagedcluster/2021-05-01/application/id_managedcluster.go index 4005db84f0f..e062b3535cc 100644 --- a/resource-manager/servicefabricmanagedcluster/2021-05-01/application/id_managedcluster.go +++ b/resource-manager/servicefabricmanagedcluster/2021-05-01/application/id_managedcluster.go @@ -36,19 +36,9 @@ func ParseManagedClusterID(input string) (*ManagedClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedClusterId{} - - 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.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagedClusterIDInsensitively(input string) (*ManagedClusterId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagedClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if id.ManagedClusterName, ok = input.Parsed["managedClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", input) } - return &id, nil + return nil } // ValidateManagedClusterID checks that 'input' can be parsed as a Managed Cluster ID diff --git a/resource-manager/servicefabricmanagedcluster/2021-05-01/applicationtype/id_applicationtype.go b/resource-manager/servicefabricmanagedcluster/2021-05-01/applicationtype/id_applicationtype.go index 5003e4bb710..5a53761ec1d 100644 --- a/resource-manager/servicefabricmanagedcluster/2021-05-01/applicationtype/id_applicationtype.go +++ b/resource-manager/servicefabricmanagedcluster/2021-05-01/applicationtype/id_applicationtype.go @@ -38,23 +38,9 @@ func ParseApplicationTypeID(input string) (*ApplicationTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationTypeId{} - - 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.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) - } - - if id.ApplicationTypeName, ok = parsed.Parsed["applicationTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationTypeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApplicationTypeIDInsensitively(input string) (*ApplicationTypeId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApplicationTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if id.ManagedClusterName, ok = input.Parsed["managedClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", input) } - if id.ApplicationTypeName, ok = parsed.Parsed["applicationTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationTypeName", *parsed) + if id.ApplicationTypeName, ok = input.Parsed["applicationTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationTypeName", input) } - return &id, nil + return nil } // ValidateApplicationTypeID checks that 'input' can be parsed as a Application Type ID diff --git a/resource-manager/servicefabricmanagedcluster/2021-05-01/applicationtype/id_managedcluster.go b/resource-manager/servicefabricmanagedcluster/2021-05-01/applicationtype/id_managedcluster.go index 4bed31bbe11..60c570d7e94 100644 --- a/resource-manager/servicefabricmanagedcluster/2021-05-01/applicationtype/id_managedcluster.go +++ b/resource-manager/servicefabricmanagedcluster/2021-05-01/applicationtype/id_managedcluster.go @@ -36,19 +36,9 @@ func ParseManagedClusterID(input string) (*ManagedClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedClusterId{} - - 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.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagedClusterIDInsensitively(input string) (*ManagedClusterId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagedClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if id.ManagedClusterName, ok = input.Parsed["managedClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", input) } - return &id, nil + return nil } // ValidateManagedClusterID checks that 'input' can be parsed as a Managed Cluster ID diff --git a/resource-manager/servicefabricmanagedcluster/2021-05-01/applicationtypeversion/id_applicationtype.go b/resource-manager/servicefabricmanagedcluster/2021-05-01/applicationtypeversion/id_applicationtype.go index 3e4b46f2c9f..2dde723526e 100644 --- a/resource-manager/servicefabricmanagedcluster/2021-05-01/applicationtypeversion/id_applicationtype.go +++ b/resource-manager/servicefabricmanagedcluster/2021-05-01/applicationtypeversion/id_applicationtype.go @@ -38,23 +38,9 @@ func ParseApplicationTypeID(input string) (*ApplicationTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationTypeId{} - - 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.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) - } - - if id.ApplicationTypeName, ok = parsed.Parsed["applicationTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationTypeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApplicationTypeIDInsensitively(input string) (*ApplicationTypeId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApplicationTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if id.ManagedClusterName, ok = input.Parsed["managedClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", input) } - if id.ApplicationTypeName, ok = parsed.Parsed["applicationTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationTypeName", *parsed) + if id.ApplicationTypeName, ok = input.Parsed["applicationTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationTypeName", input) } - return &id, nil + return nil } // ValidateApplicationTypeID checks that 'input' can be parsed as a Application Type ID diff --git a/resource-manager/servicefabricmanagedcluster/2021-05-01/applicationtypeversion/id_version.go b/resource-manager/servicefabricmanagedcluster/2021-05-01/applicationtypeversion/id_version.go index 1b346a8803c..8b610338620 100644 --- a/resource-manager/servicefabricmanagedcluster/2021-05-01/applicationtypeversion/id_version.go +++ b/resource-manager/servicefabricmanagedcluster/2021-05-01/applicationtypeversion/id_version.go @@ -40,27 +40,9 @@ func ParseVersionID(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} - - 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.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) - } - - if id.ApplicationTypeName, ok = parsed.Parsed["applicationTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationTypeName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVersionIDInsensitively(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if id.ManagedClusterName, ok = input.Parsed["managedClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", input) } - if id.ApplicationTypeName, ok = parsed.Parsed["applicationTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationTypeName", *parsed) + if id.ApplicationTypeName, ok = input.Parsed["applicationTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationTypeName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateVersionID checks that 'input' can be parsed as a Version ID diff --git a/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/id_managedcluster.go b/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/id_managedcluster.go index 927e73b856a..913563355d4 100644 --- a/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/id_managedcluster.go +++ b/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster/id_managedcluster.go @@ -36,19 +36,9 @@ func ParseManagedClusterID(input string) (*ManagedClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedClusterId{} - - 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.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagedClusterIDInsensitively(input string) (*ManagedClusterId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagedClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if id.ManagedClusterName, ok = input.Parsed["managedClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", input) } - return &id, nil + return nil } // ValidateManagedClusterID checks that 'input' can be parsed as a Managed Cluster ID diff --git a/resource-manager/servicefabricmanagedcluster/2021-05-01/managedclusterversion/id_environmentmanagedclusterversion.go b/resource-manager/servicefabricmanagedcluster/2021-05-01/managedclusterversion/id_environmentmanagedclusterversion.go index c37e734c297..63876b17644 100644 --- a/resource-manager/servicefabricmanagedcluster/2021-05-01/managedclusterversion/id_environmentmanagedclusterversion.go +++ b/resource-manager/servicefabricmanagedcluster/2021-05-01/managedclusterversion/id_environmentmanagedclusterversion.go @@ -36,19 +36,9 @@ func ParseEnvironmentManagedClusterVersionID(input string) (*EnvironmentManagedC return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentManagedClusterVersionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.ManagedClusterVersionName, ok = parsed.Parsed["managedClusterVersionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterVersionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseEnvironmentManagedClusterVersionIDInsensitively(input string) (*Enviro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentManagedClusterVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *EnvironmentManagedClusterVersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.ManagedClusterVersionName, ok = parsed.Parsed["managedClusterVersionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterVersionName", *parsed) + if id.ManagedClusterVersionName, ok = input.Parsed["managedClusterVersionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterVersionName", input) } - return &id, nil + return nil } // ValidateEnvironmentManagedClusterVersionID checks that 'input' can be parsed as a Environment Managed Cluster Version ID diff --git a/resource-manager/servicefabricmanagedcluster/2021-05-01/managedclusterversion/id_location.go b/resource-manager/servicefabricmanagedcluster/2021-05-01/managedclusterversion/id_location.go index 081a8f8f446..837cd71168f 100644 --- a/resource-manager/servicefabricmanagedcluster/2021-05-01/managedclusterversion/id_location.go +++ b/resource-manager/servicefabricmanagedcluster/2021-05-01/managedclusterversion/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/servicefabricmanagedcluster/2021-05-01/managedclusterversion/id_managedclusterversion.go b/resource-manager/servicefabricmanagedcluster/2021-05-01/managedclusterversion/id_managedclusterversion.go index 7784065f32a..b57aaff4834 100644 --- a/resource-manager/servicefabricmanagedcluster/2021-05-01/managedclusterversion/id_managedclusterversion.go +++ b/resource-manager/servicefabricmanagedcluster/2021-05-01/managedclusterversion/id_managedclusterversion.go @@ -36,19 +36,9 @@ func ParseManagedClusterVersionID(input string) (*ManagedClusterVersionId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedClusterVersionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.ManagedClusterVersionName, ok = parsed.Parsed["managedClusterVersionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterVersionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagedClusterVersionIDInsensitively(input string) (*ManagedClusterVer return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedClusterVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagedClusterVersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.ManagedClusterVersionName, ok = parsed.Parsed["managedClusterVersionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterVersionName", *parsed) + if id.ManagedClusterVersionName, ok = input.Parsed["managedClusterVersionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterVersionName", input) } - return &id, nil + return nil } // ValidateManagedClusterVersionID checks that 'input' can be parsed as a Managed Cluster Version ID diff --git a/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/id_managedcluster.go b/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/id_managedcluster.go index f39389e7985..90d876cc53e 100644 --- a/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/id_managedcluster.go +++ b/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/id_managedcluster.go @@ -36,19 +36,9 @@ func ParseManagedClusterID(input string) (*ManagedClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedClusterId{} - - 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.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagedClusterIDInsensitively(input string) (*ManagedClusterId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagedClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if id.ManagedClusterName, ok = input.Parsed["managedClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", input) } - return &id, nil + return nil } // ValidateManagedClusterID checks that 'input' can be parsed as a Managed Cluster ID diff --git a/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/id_nodetype.go b/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/id_nodetype.go index f9a96739205..0a7caddb96c 100644 --- a/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/id_nodetype.go +++ b/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype/id_nodetype.go @@ -38,23 +38,9 @@ func ParseNodeTypeID(input string) (*NodeTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NodeTypeId{} - - 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.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) - } - - if id.NodeTypeName, ok = parsed.Parsed["nodeTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nodeTypeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseNodeTypeIDInsensitively(input string) (*NodeTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NodeTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *NodeTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if id.ManagedClusterName, ok = input.Parsed["managedClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", input) } - if id.NodeTypeName, ok = parsed.Parsed["nodeTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nodeTypeName", *parsed) + if id.NodeTypeName, ok = input.Parsed["nodeTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "nodeTypeName", input) } - return &id, nil + return nil } // ValidateNodeTypeID checks that 'input' can be parsed as a Node Type ID diff --git a/resource-manager/servicefabricmanagedcluster/2021-05-01/service/id_application.go b/resource-manager/servicefabricmanagedcluster/2021-05-01/service/id_application.go index b0f80974a46..bff0446859c 100644 --- a/resource-manager/servicefabricmanagedcluster/2021-05-01/service/id_application.go +++ b/resource-manager/servicefabricmanagedcluster/2021-05-01/service/id_application.go @@ -38,23 +38,9 @@ func ParseApplicationID(input string) (*ApplicationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationId{} - - 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.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) - } - - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApplicationIDInsensitively(input string) (*ApplicationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApplicationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if id.ManagedClusterName, ok = input.Parsed["managedClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", input) } - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) + if id.ApplicationName, ok = input.Parsed["applicationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationName", input) } - return &id, nil + return nil } // ValidateApplicationID checks that 'input' can be parsed as a Application ID diff --git a/resource-manager/servicefabricmanagedcluster/2021-05-01/service/id_service.go b/resource-manager/servicefabricmanagedcluster/2021-05-01/service/id_service.go index d2fa722baa6..cf1de449dcc 100644 --- a/resource-manager/servicefabricmanagedcluster/2021-05-01/service/id_service.go +++ b/resource-manager/servicefabricmanagedcluster/2021-05-01/service/id_service.go @@ -40,27 +40,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) - } - - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) - } - - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if id.ManagedClusterName, ok = input.Parsed["managedClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", input) } - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) + if id.ApplicationName, ok = input.Parsed["applicationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/servicefabricmanagedcluster/2021-05-01/services/id_service.go b/resource-manager/servicefabricmanagedcluster/2021-05-01/services/id_service.go index 7a31ad25895..c32683efcb5 100644 --- a/resource-manager/servicefabricmanagedcluster/2021-05-01/services/id_service.go +++ b/resource-manager/servicefabricmanagedcluster/2021-05-01/services/id_service.go @@ -40,27 +40,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) - } - - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) - } - - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if id.ManagedClusterName, ok = input.Parsed["managedClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", input) } - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) + if id.ApplicationName, ok = input.Parsed["applicationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/servicefabricmanagedcluster/2022-01-01/application/id_application.go b/resource-manager/servicefabricmanagedcluster/2022-01-01/application/id_application.go index 0b014a47f82..a16a7b4f988 100644 --- a/resource-manager/servicefabricmanagedcluster/2022-01-01/application/id_application.go +++ b/resource-manager/servicefabricmanagedcluster/2022-01-01/application/id_application.go @@ -38,23 +38,9 @@ func ParseApplicationID(input string) (*ApplicationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationId{} - - 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.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) - } - - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApplicationIDInsensitively(input string) (*ApplicationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApplicationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if id.ManagedClusterName, ok = input.Parsed["managedClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", input) } - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) + if id.ApplicationName, ok = input.Parsed["applicationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationName", input) } - return &id, nil + return nil } // ValidateApplicationID checks that 'input' can be parsed as a Application ID diff --git a/resource-manager/servicefabricmanagedcluster/2022-01-01/application/id_managedcluster.go b/resource-manager/servicefabricmanagedcluster/2022-01-01/application/id_managedcluster.go index 4005db84f0f..e062b3535cc 100644 --- a/resource-manager/servicefabricmanagedcluster/2022-01-01/application/id_managedcluster.go +++ b/resource-manager/servicefabricmanagedcluster/2022-01-01/application/id_managedcluster.go @@ -36,19 +36,9 @@ func ParseManagedClusterID(input string) (*ManagedClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedClusterId{} - - 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.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagedClusterIDInsensitively(input string) (*ManagedClusterId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagedClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if id.ManagedClusterName, ok = input.Parsed["managedClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", input) } - return &id, nil + return nil } // ValidateManagedClusterID checks that 'input' can be parsed as a Managed Cluster ID diff --git a/resource-manager/servicefabricmanagedcluster/2022-01-01/applicationtype/id_applicationtype.go b/resource-manager/servicefabricmanagedcluster/2022-01-01/applicationtype/id_applicationtype.go index 5003e4bb710..5a53761ec1d 100644 --- a/resource-manager/servicefabricmanagedcluster/2022-01-01/applicationtype/id_applicationtype.go +++ b/resource-manager/servicefabricmanagedcluster/2022-01-01/applicationtype/id_applicationtype.go @@ -38,23 +38,9 @@ func ParseApplicationTypeID(input string) (*ApplicationTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationTypeId{} - - 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.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) - } - - if id.ApplicationTypeName, ok = parsed.Parsed["applicationTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationTypeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApplicationTypeIDInsensitively(input string) (*ApplicationTypeId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApplicationTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if id.ManagedClusterName, ok = input.Parsed["managedClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", input) } - if id.ApplicationTypeName, ok = parsed.Parsed["applicationTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationTypeName", *parsed) + if id.ApplicationTypeName, ok = input.Parsed["applicationTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationTypeName", input) } - return &id, nil + return nil } // ValidateApplicationTypeID checks that 'input' can be parsed as a Application Type ID diff --git a/resource-manager/servicefabricmanagedcluster/2022-01-01/applicationtype/id_managedcluster.go b/resource-manager/servicefabricmanagedcluster/2022-01-01/applicationtype/id_managedcluster.go index 4bed31bbe11..60c570d7e94 100644 --- a/resource-manager/servicefabricmanagedcluster/2022-01-01/applicationtype/id_managedcluster.go +++ b/resource-manager/servicefabricmanagedcluster/2022-01-01/applicationtype/id_managedcluster.go @@ -36,19 +36,9 @@ func ParseManagedClusterID(input string) (*ManagedClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedClusterId{} - - 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.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagedClusterIDInsensitively(input string) (*ManagedClusterId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagedClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if id.ManagedClusterName, ok = input.Parsed["managedClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", input) } - return &id, nil + return nil } // ValidateManagedClusterID checks that 'input' can be parsed as a Managed Cluster ID diff --git a/resource-manager/servicefabricmanagedcluster/2022-01-01/applicationtypeversion/id_applicationtype.go b/resource-manager/servicefabricmanagedcluster/2022-01-01/applicationtypeversion/id_applicationtype.go index 3e4b46f2c9f..2dde723526e 100644 --- a/resource-manager/servicefabricmanagedcluster/2022-01-01/applicationtypeversion/id_applicationtype.go +++ b/resource-manager/servicefabricmanagedcluster/2022-01-01/applicationtypeversion/id_applicationtype.go @@ -38,23 +38,9 @@ func ParseApplicationTypeID(input string) (*ApplicationTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationTypeId{} - - 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.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) - } - - if id.ApplicationTypeName, ok = parsed.Parsed["applicationTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationTypeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApplicationTypeIDInsensitively(input string) (*ApplicationTypeId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApplicationTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if id.ManagedClusterName, ok = input.Parsed["managedClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", input) } - if id.ApplicationTypeName, ok = parsed.Parsed["applicationTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationTypeName", *parsed) + if id.ApplicationTypeName, ok = input.Parsed["applicationTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationTypeName", input) } - return &id, nil + return nil } // ValidateApplicationTypeID checks that 'input' can be parsed as a Application Type ID diff --git a/resource-manager/servicefabricmanagedcluster/2022-01-01/applicationtypeversion/id_version.go b/resource-manager/servicefabricmanagedcluster/2022-01-01/applicationtypeversion/id_version.go index 1b346a8803c..8b610338620 100644 --- a/resource-manager/servicefabricmanagedcluster/2022-01-01/applicationtypeversion/id_version.go +++ b/resource-manager/servicefabricmanagedcluster/2022-01-01/applicationtypeversion/id_version.go @@ -40,27 +40,9 @@ func ParseVersionID(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} - - 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.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) - } - - if id.ApplicationTypeName, ok = parsed.Parsed["applicationTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationTypeName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVersionIDInsensitively(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if id.ManagedClusterName, ok = input.Parsed["managedClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", input) } - if id.ApplicationTypeName, ok = parsed.Parsed["applicationTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationTypeName", *parsed) + if id.ApplicationTypeName, ok = input.Parsed["applicationTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationTypeName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateVersionID checks that 'input' can be parsed as a Version ID diff --git a/resource-manager/servicefabricmanagedcluster/2022-01-01/managedcluster/id_managedcluster.go b/resource-manager/servicefabricmanagedcluster/2022-01-01/managedcluster/id_managedcluster.go index 927e73b856a..913563355d4 100644 --- a/resource-manager/servicefabricmanagedcluster/2022-01-01/managedcluster/id_managedcluster.go +++ b/resource-manager/servicefabricmanagedcluster/2022-01-01/managedcluster/id_managedcluster.go @@ -36,19 +36,9 @@ func ParseManagedClusterID(input string) (*ManagedClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedClusterId{} - - 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.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagedClusterIDInsensitively(input string) (*ManagedClusterId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagedClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if id.ManagedClusterName, ok = input.Parsed["managedClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", input) } - return &id, nil + return nil } // ValidateManagedClusterID checks that 'input' can be parsed as a Managed Cluster ID diff --git a/resource-manager/servicefabricmanagedcluster/2022-01-01/managedclusterversion/id_environmentmanagedclusterversion.go b/resource-manager/servicefabricmanagedcluster/2022-01-01/managedclusterversion/id_environmentmanagedclusterversion.go index c37e734c297..63876b17644 100644 --- a/resource-manager/servicefabricmanagedcluster/2022-01-01/managedclusterversion/id_environmentmanagedclusterversion.go +++ b/resource-manager/servicefabricmanagedcluster/2022-01-01/managedclusterversion/id_environmentmanagedclusterversion.go @@ -36,19 +36,9 @@ func ParseEnvironmentManagedClusterVersionID(input string) (*EnvironmentManagedC return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentManagedClusterVersionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.ManagedClusterVersionName, ok = parsed.Parsed["managedClusterVersionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterVersionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseEnvironmentManagedClusterVersionIDInsensitively(input string) (*Enviro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentManagedClusterVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *EnvironmentManagedClusterVersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.ManagedClusterVersionName, ok = parsed.Parsed["managedClusterVersionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterVersionName", *parsed) + if id.ManagedClusterVersionName, ok = input.Parsed["managedClusterVersionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterVersionName", input) } - return &id, nil + return nil } // ValidateEnvironmentManagedClusterVersionID checks that 'input' can be parsed as a Environment Managed Cluster Version ID diff --git a/resource-manager/servicefabricmanagedcluster/2022-01-01/managedclusterversion/id_location.go b/resource-manager/servicefabricmanagedcluster/2022-01-01/managedclusterversion/id_location.go index 081a8f8f446..837cd71168f 100644 --- a/resource-manager/servicefabricmanagedcluster/2022-01-01/managedclusterversion/id_location.go +++ b/resource-manager/servicefabricmanagedcluster/2022-01-01/managedclusterversion/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/servicefabricmanagedcluster/2022-01-01/managedclusterversion/id_managedclusterversion.go b/resource-manager/servicefabricmanagedcluster/2022-01-01/managedclusterversion/id_managedclusterversion.go index 7784065f32a..b57aaff4834 100644 --- a/resource-manager/servicefabricmanagedcluster/2022-01-01/managedclusterversion/id_managedclusterversion.go +++ b/resource-manager/servicefabricmanagedcluster/2022-01-01/managedclusterversion/id_managedclusterversion.go @@ -36,19 +36,9 @@ func ParseManagedClusterVersionID(input string) (*ManagedClusterVersionId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedClusterVersionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.ManagedClusterVersionName, ok = parsed.Parsed["managedClusterVersionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterVersionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagedClusterVersionIDInsensitively(input string) (*ManagedClusterVer return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedClusterVersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagedClusterVersionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.ManagedClusterVersionName, ok = parsed.Parsed["managedClusterVersionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterVersionName", *parsed) + if id.ManagedClusterVersionName, ok = input.Parsed["managedClusterVersionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterVersionName", input) } - return &id, nil + return nil } // ValidateManagedClusterVersionID checks that 'input' can be parsed as a Managed Cluster Version ID diff --git a/resource-manager/servicefabricmanagedcluster/2022-01-01/managedvmsizes/id_location.go b/resource-manager/servicefabricmanagedcluster/2022-01-01/managedvmsizes/id_location.go index 6a5efc93dff..f45bc5646d5 100644 --- a/resource-manager/servicefabricmanagedcluster/2022-01-01/managedvmsizes/id_location.go +++ b/resource-manager/servicefabricmanagedcluster/2022-01-01/managedvmsizes/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/servicefabricmanagedcluster/2022-01-01/managedvmsizes/id_managedunsupportedvmsize.go b/resource-manager/servicefabricmanagedcluster/2022-01-01/managedvmsizes/id_managedunsupportedvmsize.go index 181f0858138..7d43aa04ecd 100644 --- a/resource-manager/servicefabricmanagedcluster/2022-01-01/managedvmsizes/id_managedunsupportedvmsize.go +++ b/resource-manager/servicefabricmanagedcluster/2022-01-01/managedvmsizes/id_managedunsupportedvmsize.go @@ -36,19 +36,9 @@ func ParseManagedUnsupportedVMSizeID(input string) (*ManagedUnsupportedVMSizeId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedUnsupportedVMSizeId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.ManagedUnsupportedVMSizeName, ok = parsed.Parsed["managedUnsupportedVMSizeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedUnsupportedVMSizeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagedUnsupportedVMSizeIDInsensitively(input string) (*ManagedUnsuppo return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedUnsupportedVMSizeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagedUnsupportedVMSizeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.ManagedUnsupportedVMSizeName, ok = parsed.Parsed["managedUnsupportedVMSizeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedUnsupportedVMSizeName", *parsed) + if id.ManagedUnsupportedVMSizeName, ok = input.Parsed["managedUnsupportedVMSizeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedUnsupportedVMSizeName", input) } - return &id, nil + return nil } // ValidateManagedUnsupportedVMSizeID checks that 'input' can be parsed as a Managed Unsupported V M Size ID diff --git a/resource-manager/servicefabricmanagedcluster/2022-01-01/nodetype/id_managedcluster.go b/resource-manager/servicefabricmanagedcluster/2022-01-01/nodetype/id_managedcluster.go index f39389e7985..90d876cc53e 100644 --- a/resource-manager/servicefabricmanagedcluster/2022-01-01/nodetype/id_managedcluster.go +++ b/resource-manager/servicefabricmanagedcluster/2022-01-01/nodetype/id_managedcluster.go @@ -36,19 +36,9 @@ func ParseManagedClusterID(input string) (*ManagedClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedClusterId{} - - 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.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagedClusterIDInsensitively(input string) (*ManagedClusterId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagedClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if id.ManagedClusterName, ok = input.Parsed["managedClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", input) } - return &id, nil + return nil } // ValidateManagedClusterID checks that 'input' can be parsed as a Managed Cluster ID diff --git a/resource-manager/servicefabricmanagedcluster/2022-01-01/nodetype/id_nodetype.go b/resource-manager/servicefabricmanagedcluster/2022-01-01/nodetype/id_nodetype.go index f9a96739205..0a7caddb96c 100644 --- a/resource-manager/servicefabricmanagedcluster/2022-01-01/nodetype/id_nodetype.go +++ b/resource-manager/servicefabricmanagedcluster/2022-01-01/nodetype/id_nodetype.go @@ -38,23 +38,9 @@ func ParseNodeTypeID(input string) (*NodeTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NodeTypeId{} - - 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.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) - } - - if id.NodeTypeName, ok = parsed.Parsed["nodeTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nodeTypeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseNodeTypeIDInsensitively(input string) (*NodeTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NodeTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *NodeTypeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if id.ManagedClusterName, ok = input.Parsed["managedClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", input) } - if id.NodeTypeName, ok = parsed.Parsed["nodeTypeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "nodeTypeName", *parsed) + if id.NodeTypeName, ok = input.Parsed["nodeTypeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "nodeTypeName", input) } - return &id, nil + return nil } // ValidateNodeTypeID checks that 'input' can be parsed as a Node Type ID diff --git a/resource-manager/servicefabricmanagedcluster/2022-01-01/service/id_application.go b/resource-manager/servicefabricmanagedcluster/2022-01-01/service/id_application.go index b0f80974a46..bff0446859c 100644 --- a/resource-manager/servicefabricmanagedcluster/2022-01-01/service/id_application.go +++ b/resource-manager/servicefabricmanagedcluster/2022-01-01/service/id_application.go @@ -38,23 +38,9 @@ func ParseApplicationID(input string) (*ApplicationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationId{} - - 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.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) - } - - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApplicationIDInsensitively(input string) (*ApplicationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApplicationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if id.ManagedClusterName, ok = input.Parsed["managedClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", input) } - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) + if id.ApplicationName, ok = input.Parsed["applicationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationName", input) } - return &id, nil + return nil } // ValidateApplicationID checks that 'input' can be parsed as a Application ID diff --git a/resource-manager/servicefabricmanagedcluster/2022-01-01/service/id_service.go b/resource-manager/servicefabricmanagedcluster/2022-01-01/service/id_service.go index d2fa722baa6..cf1de449dcc 100644 --- a/resource-manager/servicefabricmanagedcluster/2022-01-01/service/id_service.go +++ b/resource-manager/servicefabricmanagedcluster/2022-01-01/service/id_service.go @@ -40,27 +40,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) - } - - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) - } - - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if id.ManagedClusterName, ok = input.Parsed["managedClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", input) } - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) + if id.ApplicationName, ok = input.Parsed["applicationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/servicefabricmanagedcluster/2022-01-01/services/id_service.go b/resource-manager/servicefabricmanagedcluster/2022-01-01/services/id_service.go index 7a31ad25895..c32683efcb5 100644 --- a/resource-manager/servicefabricmanagedcluster/2022-01-01/services/id_service.go +++ b/resource-manager/servicefabricmanagedcluster/2022-01-01/services/id_service.go @@ -40,27 +40,9 @@ func ParseServiceID(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} - - 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.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) - } - - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) - } - - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseServiceIDInsensitively(input string) (*ServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedClusterName, ok = parsed.Parsed["managedClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", *parsed) + if id.ManagedClusterName, ok = input.Parsed["managedClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedClusterName", input) } - if id.ApplicationName, ok = parsed.Parsed["applicationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationName", *parsed) + if id.ApplicationName, ok = input.Parsed["applicationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationName", input) } - if id.ServiceName, ok = parsed.Parsed["serviceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serviceName", *parsed) + if id.ServiceName, ok = input.Parsed["serviceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serviceName", input) } - return &id, nil + return nil } // ValidateServiceID checks that 'input' can be parsed as a Service ID diff --git a/resource-manager/servicelinker/2022-05-01/links/id_scopedlinker.go b/resource-manager/servicelinker/2022-05-01/links/id_scopedlinker.go index 7d1699e1648..59c74d4def9 100644 --- a/resource-manager/servicelinker/2022-05-01/links/id_scopedlinker.go +++ b/resource-manager/servicelinker/2022-05-01/links/id_scopedlinker.go @@ -34,15 +34,9 @@ func ParseScopedLinkerID(input string) (*ScopedLinkerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedLinkerId{} - - if id.ResourceUri, ok = parsed.Parsed["resourceUri"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceUri", *parsed) - } - - if id.LinkerName, ok = parsed.Parsed["linkerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "linkerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedLinkerIDInsensitively(input string) (*ScopedLinkerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedLinkerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ResourceUri, ok = parsed.Parsed["resourceUri"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceUri", *parsed) + return &id, nil +} + +func (id *ScopedLinkerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ResourceUri, ok = input.Parsed["resourceUri"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceUri", input) } - if id.LinkerName, ok = parsed.Parsed["linkerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "linkerName", *parsed) + if id.LinkerName, ok = input.Parsed["linkerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "linkerName", input) } - return &id, nil + return nil } // ValidateScopedLinkerID checks that 'input' can be parsed as a Scoped Linker ID diff --git a/resource-manager/servicelinker/2022-05-01/servicelinker/id_scopedlinker.go b/resource-manager/servicelinker/2022-05-01/servicelinker/id_scopedlinker.go index ecf9ae4abc5..b2df806fc4d 100644 --- a/resource-manager/servicelinker/2022-05-01/servicelinker/id_scopedlinker.go +++ b/resource-manager/servicelinker/2022-05-01/servicelinker/id_scopedlinker.go @@ -34,15 +34,9 @@ func ParseScopedLinkerID(input string) (*ScopedLinkerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedLinkerId{} - - if id.ResourceUri, ok = parsed.Parsed["resourceUri"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceUri", *parsed) - } - - if id.LinkerName, ok = parsed.Parsed["linkerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "linkerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseScopedLinkerIDInsensitively(input string) (*ScopedLinkerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopedLinkerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.ResourceUri, ok = parsed.Parsed["resourceUri"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceUri", *parsed) + return &id, nil +} + +func (id *ScopedLinkerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.ResourceUri, ok = input.Parsed["resourceUri"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceUri", input) } - if id.LinkerName, ok = parsed.Parsed["linkerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "linkerName", *parsed) + if id.LinkerName, ok = input.Parsed["linkerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "linkerName", input) } - return &id, nil + return nil } // ValidateScopedLinkerID checks that 'input' can be parsed as a Scoped Linker ID diff --git a/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/id_association.go b/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/id_association.go index 4d1f84f46dd..91742745b6a 100644 --- a/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/id_association.go +++ b/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/id_association.go @@ -38,23 +38,9 @@ func ParseAssociationID(input string) (*AssociationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AssociationId{} - - 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.TrafficControllerName, ok = parsed.Parsed["trafficControllerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "trafficControllerName", *parsed) - } - - if id.AssociationName, ok = parsed.Parsed["associationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "associationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAssociationIDInsensitively(input string) (*AssociationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AssociationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AssociationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.TrafficControllerName, ok = parsed.Parsed["trafficControllerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "trafficControllerName", *parsed) + if id.TrafficControllerName, ok = input.Parsed["trafficControllerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "trafficControllerName", input) } - if id.AssociationName, ok = parsed.Parsed["associationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "associationName", *parsed) + if id.AssociationName, ok = input.Parsed["associationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "associationName", input) } - return &id, nil + return nil } // ValidateAssociationID checks that 'input' can be parsed as a Association ID diff --git a/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/id_trafficcontroller.go b/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/id_trafficcontroller.go index 11c2580cb1a..74a603e04a3 100644 --- a/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/id_trafficcontroller.go +++ b/resource-manager/servicenetworking/2023-05-01-preview/associationsinterface/id_trafficcontroller.go @@ -36,19 +36,9 @@ func ParseTrafficControllerID(input string) (*TrafficControllerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TrafficControllerId{} - - 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.TrafficControllerName, ok = parsed.Parsed["trafficControllerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "trafficControllerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseTrafficControllerIDInsensitively(input string) (*TrafficControllerId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TrafficControllerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *TrafficControllerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.TrafficControllerName, ok = parsed.Parsed["trafficControllerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "trafficControllerName", *parsed) + if id.TrafficControllerName, ok = input.Parsed["trafficControllerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "trafficControllerName", input) } - return &id, nil + return nil } // ValidateTrafficControllerID checks that 'input' can be parsed as a Traffic Controller ID diff --git a/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/id_frontend.go b/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/id_frontend.go index b7e579d0a72..809da87fc19 100644 --- a/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/id_frontend.go +++ b/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/id_frontend.go @@ -38,23 +38,9 @@ func ParseFrontendID(input string) (*FrontendId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FrontendId{} - - 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.TrafficControllerName, ok = parsed.Parsed["trafficControllerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "trafficControllerName", *parsed) - } - - if id.FrontendName, ok = parsed.Parsed["frontendName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "frontendName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFrontendIDInsensitively(input string) (*FrontendId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FrontendId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FrontendId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.TrafficControllerName, ok = parsed.Parsed["trafficControllerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "trafficControllerName", *parsed) + if id.TrafficControllerName, ok = input.Parsed["trafficControllerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "trafficControllerName", input) } - if id.FrontendName, ok = parsed.Parsed["frontendName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "frontendName", *parsed) + if id.FrontendName, ok = input.Parsed["frontendName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "frontendName", input) } - return &id, nil + return nil } // ValidateFrontendID checks that 'input' can be parsed as a Frontend ID diff --git a/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/id_trafficcontroller.go b/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/id_trafficcontroller.go index 8b8821e6174..182e5b0dffd 100644 --- a/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/id_trafficcontroller.go +++ b/resource-manager/servicenetworking/2023-05-01-preview/frontendsinterface/id_trafficcontroller.go @@ -36,19 +36,9 @@ func ParseTrafficControllerID(input string) (*TrafficControllerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TrafficControllerId{} - - 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.TrafficControllerName, ok = parsed.Parsed["trafficControllerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "trafficControllerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseTrafficControllerIDInsensitively(input string) (*TrafficControllerId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TrafficControllerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *TrafficControllerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.TrafficControllerName, ok = parsed.Parsed["trafficControllerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "trafficControllerName", *parsed) + if id.TrafficControllerName, ok = input.Parsed["trafficControllerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "trafficControllerName", input) } - return &id, nil + return nil } // ValidateTrafficControllerID checks that 'input' can be parsed as a Traffic Controller ID diff --git a/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/id_trafficcontroller.go b/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/id_trafficcontroller.go index 785e137e845..dfcd4f99e5f 100644 --- a/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/id_trafficcontroller.go +++ b/resource-manager/servicenetworking/2023-05-01-preview/trafficcontrollerinterface/id_trafficcontroller.go @@ -36,19 +36,9 @@ func ParseTrafficControllerID(input string) (*TrafficControllerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TrafficControllerId{} - - 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.TrafficControllerName, ok = parsed.Parsed["trafficControllerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "trafficControllerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseTrafficControllerIDInsensitively(input string) (*TrafficControllerId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TrafficControllerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *TrafficControllerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.TrafficControllerName, ok = parsed.Parsed["trafficControllerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "trafficControllerName", *parsed) + if id.TrafficControllerName, ok = input.Parsed["trafficControllerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "trafficControllerName", input) } - return &id, nil + return nil } // ValidateTrafficControllerID checks that 'input' can be parsed as a Traffic Controller ID diff --git a/resource-manager/servicenetworking/2023-11-01/associationsinterface/id_association.go b/resource-manager/servicenetworking/2023-11-01/associationsinterface/id_association.go index 4d1f84f46dd..91742745b6a 100644 --- a/resource-manager/servicenetworking/2023-11-01/associationsinterface/id_association.go +++ b/resource-manager/servicenetworking/2023-11-01/associationsinterface/id_association.go @@ -38,23 +38,9 @@ func ParseAssociationID(input string) (*AssociationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AssociationId{} - - 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.TrafficControllerName, ok = parsed.Parsed["trafficControllerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "trafficControllerName", *parsed) - } - - if id.AssociationName, ok = parsed.Parsed["associationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "associationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAssociationIDInsensitively(input string) (*AssociationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AssociationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AssociationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.TrafficControllerName, ok = parsed.Parsed["trafficControllerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "trafficControllerName", *parsed) + if id.TrafficControllerName, ok = input.Parsed["trafficControllerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "trafficControllerName", input) } - if id.AssociationName, ok = parsed.Parsed["associationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "associationName", *parsed) + if id.AssociationName, ok = input.Parsed["associationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "associationName", input) } - return &id, nil + return nil } // ValidateAssociationID checks that 'input' can be parsed as a Association ID diff --git a/resource-manager/servicenetworking/2023-11-01/associationsinterface/id_trafficcontroller.go b/resource-manager/servicenetworking/2023-11-01/associationsinterface/id_trafficcontroller.go index 11c2580cb1a..74a603e04a3 100644 --- a/resource-manager/servicenetworking/2023-11-01/associationsinterface/id_trafficcontroller.go +++ b/resource-manager/servicenetworking/2023-11-01/associationsinterface/id_trafficcontroller.go @@ -36,19 +36,9 @@ func ParseTrafficControllerID(input string) (*TrafficControllerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TrafficControllerId{} - - 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.TrafficControllerName, ok = parsed.Parsed["trafficControllerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "trafficControllerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseTrafficControllerIDInsensitively(input string) (*TrafficControllerId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TrafficControllerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *TrafficControllerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.TrafficControllerName, ok = parsed.Parsed["trafficControllerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "trafficControllerName", *parsed) + if id.TrafficControllerName, ok = input.Parsed["trafficControllerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "trafficControllerName", input) } - return &id, nil + return nil } // ValidateTrafficControllerID checks that 'input' can be parsed as a Traffic Controller ID diff --git a/resource-manager/servicenetworking/2023-11-01/frontendsinterface/id_frontend.go b/resource-manager/servicenetworking/2023-11-01/frontendsinterface/id_frontend.go index b7e579d0a72..809da87fc19 100644 --- a/resource-manager/servicenetworking/2023-11-01/frontendsinterface/id_frontend.go +++ b/resource-manager/servicenetworking/2023-11-01/frontendsinterface/id_frontend.go @@ -38,23 +38,9 @@ func ParseFrontendID(input string) (*FrontendId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FrontendId{} - - 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.TrafficControllerName, ok = parsed.Parsed["trafficControllerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "trafficControllerName", *parsed) - } - - if id.FrontendName, ok = parsed.Parsed["frontendName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "frontendName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFrontendIDInsensitively(input string) (*FrontendId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FrontendId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FrontendId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.TrafficControllerName, ok = parsed.Parsed["trafficControllerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "trafficControllerName", *parsed) + if id.TrafficControllerName, ok = input.Parsed["trafficControllerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "trafficControllerName", input) } - if id.FrontendName, ok = parsed.Parsed["frontendName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "frontendName", *parsed) + if id.FrontendName, ok = input.Parsed["frontendName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "frontendName", input) } - return &id, nil + return nil } // ValidateFrontendID checks that 'input' can be parsed as a Frontend ID diff --git a/resource-manager/servicenetworking/2023-11-01/frontendsinterface/id_trafficcontroller.go b/resource-manager/servicenetworking/2023-11-01/frontendsinterface/id_trafficcontroller.go index 8b8821e6174..182e5b0dffd 100644 --- a/resource-manager/servicenetworking/2023-11-01/frontendsinterface/id_trafficcontroller.go +++ b/resource-manager/servicenetworking/2023-11-01/frontendsinterface/id_trafficcontroller.go @@ -36,19 +36,9 @@ func ParseTrafficControllerID(input string) (*TrafficControllerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TrafficControllerId{} - - 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.TrafficControllerName, ok = parsed.Parsed["trafficControllerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "trafficControllerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseTrafficControllerIDInsensitively(input string) (*TrafficControllerId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TrafficControllerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *TrafficControllerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.TrafficControllerName, ok = parsed.Parsed["trafficControllerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "trafficControllerName", *parsed) + if id.TrafficControllerName, ok = input.Parsed["trafficControllerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "trafficControllerName", input) } - return &id, nil + return nil } // ValidateTrafficControllerID checks that 'input' can be parsed as a Traffic Controller ID diff --git a/resource-manager/servicenetworking/2023-11-01/trafficcontrollerinterface/id_trafficcontroller.go b/resource-manager/servicenetworking/2023-11-01/trafficcontrollerinterface/id_trafficcontroller.go index 785e137e845..dfcd4f99e5f 100644 --- a/resource-manager/servicenetworking/2023-11-01/trafficcontrollerinterface/id_trafficcontroller.go +++ b/resource-manager/servicenetworking/2023-11-01/trafficcontrollerinterface/id_trafficcontroller.go @@ -36,19 +36,9 @@ func ParseTrafficControllerID(input string) (*TrafficControllerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TrafficControllerId{} - - 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.TrafficControllerName, ok = parsed.Parsed["trafficControllerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "trafficControllerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseTrafficControllerIDInsensitively(input string) (*TrafficControllerId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TrafficControllerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *TrafficControllerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.TrafficControllerName, ok = parsed.Parsed["trafficControllerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "trafficControllerName", *parsed) + if id.TrafficControllerName, ok = input.Parsed["trafficControllerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "trafficControllerName", input) } - return &id, nil + return nil } // ValidateTrafficControllerID checks that 'input' can be parsed as a Traffic Controller ID diff --git a/resource-manager/signalr/2023-02-01/signalr/id_customcertificate.go b/resource-manager/signalr/2023-02-01/signalr/id_customcertificate.go index 6424254251d..38ea1784daa 100644 --- a/resource-manager/signalr/2023-02-01/signalr/id_customcertificate.go +++ b/resource-manager/signalr/2023-02-01/signalr/id_customcertificate.go @@ -38,23 +38,9 @@ func ParseCustomCertificateID(input string) (*CustomCertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CustomCertificateId{} - - 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.SignalRName, ok = parsed.Parsed["signalRName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "signalRName", *parsed) - } - - if id.CustomCertificateName, ok = parsed.Parsed["customCertificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "customCertificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCustomCertificateIDInsensitively(input string) (*CustomCertificateId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CustomCertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CustomCertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SignalRName, ok = parsed.Parsed["signalRName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "signalRName", *parsed) + if id.SignalRName, ok = input.Parsed["signalRName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "signalRName", input) } - if id.CustomCertificateName, ok = parsed.Parsed["customCertificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "customCertificateName", *parsed) + if id.CustomCertificateName, ok = input.Parsed["customCertificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "customCertificateName", input) } - return &id, nil + return nil } // ValidateCustomCertificateID checks that 'input' can be parsed as a Custom Certificate ID diff --git a/resource-manager/signalr/2023-02-01/signalr/id_customdomain.go b/resource-manager/signalr/2023-02-01/signalr/id_customdomain.go index 25482a5f7b1..123492a05da 100644 --- a/resource-manager/signalr/2023-02-01/signalr/id_customdomain.go +++ b/resource-manager/signalr/2023-02-01/signalr/id_customdomain.go @@ -38,23 +38,9 @@ func ParseCustomDomainID(input string) (*CustomDomainId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CustomDomainId{} - - 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.SignalRName, ok = parsed.Parsed["signalRName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "signalRName", *parsed) - } - - if id.CustomDomainName, ok = parsed.Parsed["customDomainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "customDomainName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCustomDomainIDInsensitively(input string) (*CustomDomainId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CustomDomainId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CustomDomainId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SignalRName, ok = parsed.Parsed["signalRName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "signalRName", *parsed) + if id.SignalRName, ok = input.Parsed["signalRName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "signalRName", input) } - if id.CustomDomainName, ok = parsed.Parsed["customDomainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "customDomainName", *parsed) + if id.CustomDomainName, ok = input.Parsed["customDomainName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "customDomainName", input) } - return &id, nil + return nil } // ValidateCustomDomainID checks that 'input' can be parsed as a Custom Domain ID diff --git a/resource-manager/signalr/2023-02-01/signalr/id_location.go b/resource-manager/signalr/2023-02-01/signalr/id_location.go index dac4b26bdf4..5ddab9b3ca8 100644 --- a/resource-manager/signalr/2023-02-01/signalr/id_location.go +++ b/resource-manager/signalr/2023-02-01/signalr/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/signalr/2023-02-01/signalr/id_privateendpointconnection.go b/resource-manager/signalr/2023-02-01/signalr/id_privateendpointconnection.go index 32d06a6eb4a..d555ded5a8b 100644 --- a/resource-manager/signalr/2023-02-01/signalr/id_privateendpointconnection.go +++ b/resource-manager/signalr/2023-02-01/signalr/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.SignalRName, ok = parsed.Parsed["signalRName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "signalRName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SignalRName, ok = parsed.Parsed["signalRName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "signalRName", *parsed) + if id.SignalRName, ok = input.Parsed["signalRName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "signalRName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/signalr/2023-02-01/signalr/id_sharedprivatelinkresource.go b/resource-manager/signalr/2023-02-01/signalr/id_sharedprivatelinkresource.go index dfa3f093c6a..c7cbd49245d 100644 --- a/resource-manager/signalr/2023-02-01/signalr/id_sharedprivatelinkresource.go +++ b/resource-manager/signalr/2023-02-01/signalr/id_sharedprivatelinkresource.go @@ -38,23 +38,9 @@ func ParseSharedPrivateLinkResourceID(input string) (*SharedPrivateLinkResourceI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SharedPrivateLinkResourceId{} - - 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.SignalRName, ok = parsed.Parsed["signalRName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "signalRName", *parsed) - } - - if id.SharedPrivateLinkResourceName, ok = parsed.Parsed["sharedPrivateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sharedPrivateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSharedPrivateLinkResourceIDInsensitively(input string) (*SharedPrivate return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SharedPrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SharedPrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SignalRName, ok = parsed.Parsed["signalRName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "signalRName", *parsed) + if id.SignalRName, ok = input.Parsed["signalRName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "signalRName", input) } - if id.SharedPrivateLinkResourceName, ok = parsed.Parsed["sharedPrivateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sharedPrivateLinkResourceName", *parsed) + if id.SharedPrivateLinkResourceName, ok = input.Parsed["sharedPrivateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sharedPrivateLinkResourceName", input) } - return &id, nil + return nil } // ValidateSharedPrivateLinkResourceID checks that 'input' can be parsed as a Shared Private Link Resource ID diff --git a/resource-manager/signalr/2023-02-01/signalr/id_signalr.go b/resource-manager/signalr/2023-02-01/signalr/id_signalr.go index 92adc9f8eb5..4fb596db605 100644 --- a/resource-manager/signalr/2023-02-01/signalr/id_signalr.go +++ b/resource-manager/signalr/2023-02-01/signalr/id_signalr.go @@ -36,19 +36,9 @@ func ParseSignalRID(input string) (*SignalRId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SignalRId{} - - 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.SignalRName, ok = parsed.Parsed["signalRName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "signalRName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSignalRIDInsensitively(input string) (*SignalRId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SignalRId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SignalRId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SignalRName, ok = parsed.Parsed["signalRName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "signalRName", *parsed) + if id.SignalRName, ok = input.Parsed["signalRName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "signalRName", input) } - return &id, nil + return nil } // ValidateSignalRID checks that 'input' can be parsed as a Signal R ID diff --git a/resource-manager/sql/2021-11-01/databaseadvisors/id_databaseadvisor.go b/resource-manager/sql/2021-11-01/databaseadvisors/id_databaseadvisor.go index 7bbad5a0869..95915da7095 100644 --- a/resource-manager/sql/2021-11-01/databaseadvisors/id_databaseadvisor.go +++ b/resource-manager/sql/2021-11-01/databaseadvisors/id_databaseadvisor.go @@ -40,27 +40,9 @@ func ParseDatabaseAdvisorID(input string) (*DatabaseAdvisorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAdvisorId{} - - 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) - } - - if id.AdvisorName, ok = parsed.Parsed["advisorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "advisorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseDatabaseAdvisorIDInsensitively(input string) (*DatabaseAdvisorId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAdvisorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DatabaseAdvisorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.AdvisorName, ok = parsed.Parsed["advisorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "advisorName", *parsed) + if id.AdvisorName, ok = input.Parsed["advisorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "advisorName", input) } - return &id, nil + return nil } // ValidateDatabaseAdvisorID checks that 'input' can be parsed as a Database Advisor ID diff --git a/resource-manager/sql/2021-11-01/databasecolumns/id_column.go b/resource-manager/sql/2021-11-01/databasecolumns/id_column.go index 6aab1c96373..0841a75866e 100644 --- a/resource-manager/sql/2021-11-01/databasecolumns/id_column.go +++ b/resource-manager/sql/2021-11-01/databasecolumns/id_column.go @@ -44,35 +44,9 @@ func ParseColumnID(input string) (*ColumnId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ColumnId{} - - 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) - } - - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) - } - - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) - } - - if id.ColumnName, ok = parsed.Parsed["columnName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "columnName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseColumnIDInsensitively(input string) (*ColumnId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ColumnId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ColumnId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) + if id.SchemaName, ok = input.Parsed["schemaName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "schemaName", input) } - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if id.TableName, ok = input.Parsed["tableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tableName", input) } - if id.ColumnName, ok = parsed.Parsed["columnName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "columnName", *parsed) + if id.ColumnName, ok = input.Parsed["columnName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "columnName", input) } - return &id, nil + return nil } // ValidateColumnID checks that 'input' can be parsed as a Column ID diff --git a/resource-manager/sql/2021-11-01/databasecolumns/id_table.go b/resource-manager/sql/2021-11-01/databasecolumns/id_table.go index a1bff6ab2dd..b1026f98b99 100644 --- a/resource-manager/sql/2021-11-01/databasecolumns/id_table.go +++ b/resource-manager/sql/2021-11-01/databasecolumns/id_table.go @@ -42,31 +42,9 @@ func ParseTableID(input string) (*TableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TableId{} - - 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) - } - - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) - } - - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseTableIDInsensitively(input string) (*TableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *TableId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) + if id.SchemaName, ok = input.Parsed["schemaName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "schemaName", input) } - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if id.TableName, ok = input.Parsed["tableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tableName", input) } - return &id, nil + return nil } // ValidateTableID checks that 'input' can be parsed as a Table ID diff --git a/resource-manager/sql/2021-11-01/databaseextensions/id_extension.go b/resource-manager/sql/2021-11-01/databaseextensions/id_extension.go index 3c4d31a5a55..f7f5c9a3ad5 100644 --- a/resource-manager/sql/2021-11-01/databaseextensions/id_extension.go +++ b/resource-manager/sql/2021-11-01/databaseextensions/id_extension.go @@ -40,27 +40,9 @@ func ParseExtensionID(input string) (*ExtensionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExtensionId{} - - 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) - } - - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseExtensionIDInsensitively(input string) (*ExtensionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExtensionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ExtensionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if id.ExtensionName, ok = input.Parsed["extensionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "extensionName", input) } - return &id, nil + return nil } // ValidateExtensionID checks that 'input' can be parsed as a Extension ID diff --git a/resource-manager/sql/2021-11-01/databaserecommendedactions/id_databaseadvisor.go b/resource-manager/sql/2021-11-01/databaserecommendedactions/id_databaseadvisor.go index cb647628efd..c74c1d97348 100644 --- a/resource-manager/sql/2021-11-01/databaserecommendedactions/id_databaseadvisor.go +++ b/resource-manager/sql/2021-11-01/databaserecommendedactions/id_databaseadvisor.go @@ -40,27 +40,9 @@ func ParseDatabaseAdvisorID(input string) (*DatabaseAdvisorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAdvisorId{} - - 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) - } - - if id.AdvisorName, ok = parsed.Parsed["advisorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "advisorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseDatabaseAdvisorIDInsensitively(input string) (*DatabaseAdvisorId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAdvisorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DatabaseAdvisorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.AdvisorName, ok = parsed.Parsed["advisorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "advisorName", *parsed) + if id.AdvisorName, ok = input.Parsed["advisorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "advisorName", input) } - return &id, nil + return nil } // ValidateDatabaseAdvisorID checks that 'input' can be parsed as a Database Advisor ID diff --git a/resource-manager/sql/2021-11-01/databaserecommendedactions/id_recommendedaction.go b/resource-manager/sql/2021-11-01/databaserecommendedactions/id_recommendedaction.go index f025c3d3e6c..6ff68601de6 100644 --- a/resource-manager/sql/2021-11-01/databaserecommendedactions/id_recommendedaction.go +++ b/resource-manager/sql/2021-11-01/databaserecommendedactions/id_recommendedaction.go @@ -42,31 +42,9 @@ func ParseRecommendedActionID(input string) (*RecommendedActionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecommendedActionId{} - - 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) - } - - if id.AdvisorName, ok = parsed.Parsed["advisorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "advisorName", *parsed) - } - - if id.RecommendedActionName, ok = parsed.Parsed["recommendedActionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recommendedActionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseRecommendedActionIDInsensitively(input string) (*RecommendedActionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecommendedActionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RecommendedActionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.AdvisorName, ok = parsed.Parsed["advisorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "advisorName", *parsed) + if id.AdvisorName, ok = input.Parsed["advisorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "advisorName", input) } - if id.RecommendedActionName, ok = parsed.Parsed["recommendedActionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recommendedActionName", *parsed) + if id.RecommendedActionName, ok = input.Parsed["recommendedActionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "recommendedActionName", input) } - return &id, nil + return nil } // ValidateRecommendedActionID checks that 'input' can be parsed as a Recommended Action ID diff --git a/resource-manager/sql/2021-11-01/databaseschemas/id_schema.go b/resource-manager/sql/2021-11-01/databaseschemas/id_schema.go index 0317ff6e2a6..da4ae40e2d2 100644 --- a/resource-manager/sql/2021-11-01/databaseschemas/id_schema.go +++ b/resource-manager/sql/2021-11-01/databaseschemas/id_schema.go @@ -40,27 +40,9 @@ func ParseSchemaID(input string) (*SchemaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SchemaId{} - - 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) - } - - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSchemaIDInsensitively(input string) (*SchemaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SchemaId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SchemaId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) + if id.SchemaName, ok = input.Parsed["schemaName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "schemaName", input) } - return &id, nil + return nil } // ValidateSchemaID checks that 'input' can be parsed as a Schema ID diff --git a/resource-manager/sql/2021-11-01/databasetables/id_schema.go b/resource-manager/sql/2021-11-01/databasetables/id_schema.go index bb7f80f2495..0a9c112885e 100644 --- a/resource-manager/sql/2021-11-01/databasetables/id_schema.go +++ b/resource-manager/sql/2021-11-01/databasetables/id_schema.go @@ -40,27 +40,9 @@ func ParseSchemaID(input string) (*SchemaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SchemaId{} - - 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) - } - - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSchemaIDInsensitively(input string) (*SchemaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SchemaId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SchemaId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) + if id.SchemaName, ok = input.Parsed["schemaName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "schemaName", input) } - return &id, nil + return nil } // ValidateSchemaID checks that 'input' can be parsed as a Schema ID diff --git a/resource-manager/sql/2021-11-01/databasetables/id_table.go b/resource-manager/sql/2021-11-01/databasetables/id_table.go index 5db1b4b5fe0..49f51937cf2 100644 --- a/resource-manager/sql/2021-11-01/databasetables/id_table.go +++ b/resource-manager/sql/2021-11-01/databasetables/id_table.go @@ -42,31 +42,9 @@ func ParseTableID(input string) (*TableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TableId{} - - 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) - } - - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) - } - - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseTableIDInsensitively(input string) (*TableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *TableId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) + if id.SchemaName, ok = input.Parsed["schemaName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "schemaName", input) } - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if id.TableName, ok = input.Parsed["tableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tableName", input) } - return &id, nil + return nil } // ValidateTableID checks that 'input' can be parsed as a Table ID diff --git a/resource-manager/sql/2021-11-01/databasevulnerabilityassessmentrulebaselines/id_baseline.go b/resource-manager/sql/2021-11-01/databasevulnerabilityassessmentrulebaselines/id_baseline.go index c706dc0c356..2355545f048 100644 --- a/resource-manager/sql/2021-11-01/databasevulnerabilityassessmentrulebaselines/id_baseline.go +++ b/resource-manager/sql/2021-11-01/databasevulnerabilityassessmentrulebaselines/id_baseline.go @@ -42,39 +42,9 @@ func ParseBaselineID(input string) (*BaselineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BaselineId{} - - 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) - } - - if id.RuleId, ok = parsed.Parsed["ruleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleId", *parsed) - } - - if v, ok := parsed.Parsed["baselineName"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "baselineName", *parsed) - } - - baselineName, err := parseVulnerabilityAssessmentPolicyBaselineName(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.BaselineName = *baselineName + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -89,42 +59,50 @@ func ParseBaselineIDInsensitively(input string) (*BaselineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BaselineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *BaselineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.RuleId, ok = parsed.Parsed["ruleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleId", *parsed) + if id.RuleId, ok = input.Parsed["ruleId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleId", input) } - if v, ok := parsed.Parsed["baselineName"]; true { + if v, ok := input.Parsed["baselineName"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "baselineName", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "baselineName", input) } baselineName, err := parseVulnerabilityAssessmentPolicyBaselineName(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.BaselineName = *baselineName } - return &id, nil + return nil } // ValidateBaselineID checks that 'input' can be parsed as a Baseline ID diff --git a/resource-manager/sql/2021-11-01/databasevulnerabilityassessmentscans/id_scan.go b/resource-manager/sql/2021-11-01/databasevulnerabilityassessmentscans/id_scan.go index daa3daa10fa..5f5c85d021f 100644 --- a/resource-manager/sql/2021-11-01/databasevulnerabilityassessmentscans/id_scan.go +++ b/resource-manager/sql/2021-11-01/databasevulnerabilityassessmentscans/id_scan.go @@ -40,27 +40,9 @@ func ParseScanID(input string) (*ScanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScanId{} - - 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) - } - - if id.ScanId, ok = parsed.Parsed["scanId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scanId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseScanIDInsensitively(input string) (*ScanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScanId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ScanId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.ScanId, ok = parsed.Parsed["scanId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scanId", *parsed) + if id.ScanId, ok = input.Parsed["scanId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scanId", input) } - return &id, nil + return nil } // ValidateScanID checks that 'input' can be parsed as a Scan ID diff --git a/resource-manager/sql/2021-11-01/datamaskingrules/id_rule.go b/resource-manager/sql/2021-11-01/datamaskingrules/id_rule.go index af9bad3a429..2542a80459d 100644 --- a/resource-manager/sql/2021-11-01/datamaskingrules/id_rule.go +++ b/resource-manager/sql/2021-11-01/datamaskingrules/id_rule.go @@ -40,27 +40,9 @@ func ParseRuleID(input string) (*RuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RuleId{} - - 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) - } - - if id.RuleName, ok = parsed.Parsed["ruleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseRuleIDInsensitively(input string) (*RuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.RuleName, ok = parsed.Parsed["ruleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleName", *parsed) + if id.RuleName, ok = input.Parsed["ruleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleName", input) } - return &id, nil + return nil } // ValidateRuleID checks that 'input' can be parsed as a Rule ID diff --git a/resource-manager/sql/2021-11-01/deletedservers/id_deletedserver.go b/resource-manager/sql/2021-11-01/deletedservers/id_deletedserver.go index 6a0a52caefa..81956e4971a 100644 --- a/resource-manager/sql/2021-11-01/deletedservers/id_deletedserver.go +++ b/resource-manager/sql/2021-11-01/deletedservers/id_deletedserver.go @@ -36,19 +36,9 @@ func ParseDeletedServerID(input string) (*DeletedServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeletedServerId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.DeletedServerName, ok = parsed.Parsed["deletedServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDeletedServerIDInsensitively(input string) (*DeletedServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeletedServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DeletedServerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.DeletedServerName, ok = parsed.Parsed["deletedServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedServerName", *parsed) + if id.DeletedServerName, ok = input.Parsed["deletedServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deletedServerName", input) } - return &id, nil + return nil } // ValidateDeletedServerID checks that 'input' can be parsed as a Deleted Server ID diff --git a/resource-manager/sql/2021-11-01/deletedservers/id_location.go b/resource-manager/sql/2021-11-01/deletedservers/id_location.go index 1dbc2d270c9..df476453a48 100644 --- a/resource-manager/sql/2021-11-01/deletedservers/id_location.go +++ b/resource-manager/sql/2021-11-01/deletedservers/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/sql/2021-11-01/distributedavailabilitygroups/id_distributedavailabilitygroup.go b/resource-manager/sql/2021-11-01/distributedavailabilitygroups/id_distributedavailabilitygroup.go index 376709da1e0..b9e014fc53a 100644 --- a/resource-manager/sql/2021-11-01/distributedavailabilitygroups/id_distributedavailabilitygroup.go +++ b/resource-manager/sql/2021-11-01/distributedavailabilitygroups/id_distributedavailabilitygroup.go @@ -38,23 +38,9 @@ func ParseDistributedAvailabilityGroupID(input string) (*DistributedAvailability return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DistributedAvailabilityGroupId{} - - 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.DistributedAvailabilityGroupName, ok = parsed.Parsed["distributedAvailabilityGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "distributedAvailabilityGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDistributedAvailabilityGroupIDInsensitively(input string) (*Distribute return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DistributedAvailabilityGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DistributedAvailabilityGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedInstanceName, ok = parsed.Parsed["managedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", *parsed) + if id.ManagedInstanceName, ok = input.Parsed["managedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", input) } - if id.DistributedAvailabilityGroupName, ok = parsed.Parsed["distributedAvailabilityGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "distributedAvailabilityGroupName", *parsed) + if id.DistributedAvailabilityGroupName, ok = input.Parsed["distributedAvailabilityGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "distributedAvailabilityGroupName", input) } - return &id, nil + return nil } // ValidateDistributedAvailabilityGroupID checks that 'input' can be parsed as a Distributed Availability Group ID diff --git a/resource-manager/sql/2021-11-01/elasticpooloperations/id_operation.go b/resource-manager/sql/2021-11-01/elasticpooloperations/id_operation.go index 0aa5b08c901..3951bc61430 100644 --- a/resource-manager/sql/2021-11-01/elasticpooloperations/id_operation.go +++ b/resource-manager/sql/2021-11-01/elasticpooloperations/id_operation.go @@ -40,27 +40,9 @@ func ParseOperationID(input string) (*OperationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationId{} - - 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) - } - - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseOperationIDInsensitively(input string) (*OperationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *OperationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.ElasticPoolName, ok = parsed.Parsed["elasticPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "elasticPoolName", *parsed) + if id.ElasticPoolName, ok = input.Parsed["elasticPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "elasticPoolName", input) } - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if id.OperationId, ok = input.Parsed["operationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "operationId", input) } - return &id, nil + return nil } // ValidateOperationID checks that 'input' can be parsed as a Operation ID diff --git a/resource-manager/sql/2021-11-01/endpointcertificates/id_endpointcertificate.go b/resource-manager/sql/2021-11-01/endpointcertificates/id_endpointcertificate.go index 1c05991669a..be67667cb2c 100644 --- a/resource-manager/sql/2021-11-01/endpointcertificates/id_endpointcertificate.go +++ b/resource-manager/sql/2021-11-01/endpointcertificates/id_endpointcertificate.go @@ -38,23 +38,9 @@ func ParseEndpointCertificateID(input string) (*EndpointCertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EndpointCertificateId{} - - 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.EndpointCertificateName, ok = parsed.Parsed["endpointCertificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "endpointCertificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseEndpointCertificateIDInsensitively(input string) (*EndpointCertificate return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EndpointCertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EndpointCertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedInstanceName, ok = parsed.Parsed["managedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", *parsed) + if id.ManagedInstanceName, ok = input.Parsed["managedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", input) } - if id.EndpointCertificateName, ok = parsed.Parsed["endpointCertificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "endpointCertificateName", *parsed) + if id.EndpointCertificateName, ok = input.Parsed["endpointCertificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "endpointCertificateName", input) } - return &id, nil + return nil } // ValidateEndpointCertificateID checks that 'input' can be parsed as a Endpoint Certificate ID diff --git a/resource-manager/sql/2021-11-01/failovergroups/id_failovergroup.go b/resource-manager/sql/2021-11-01/failovergroups/id_failovergroup.go index 30da65a54d4..412ec2c90fb 100644 --- a/resource-manager/sql/2021-11-01/failovergroups/id_failovergroup.go +++ b/resource-manager/sql/2021-11-01/failovergroups/id_failovergroup.go @@ -38,23 +38,9 @@ func ParseFailoverGroupID(input string) (*FailoverGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FailoverGroupId{} - - 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.FailoverGroupName, ok = parsed.Parsed["failoverGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "failoverGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFailoverGroupIDInsensitively(input string) (*FailoverGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FailoverGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FailoverGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.FailoverGroupName, ok = parsed.Parsed["failoverGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "failoverGroupName", *parsed) + if id.FailoverGroupName, ok = input.Parsed["failoverGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "failoverGroupName", input) } - return &id, nil + return nil } // ValidateFailoverGroupID checks that 'input' can be parsed as a Failover Group ID diff --git a/resource-manager/sql/2021-11-01/firewallrules/id_firewallrule.go b/resource-manager/sql/2021-11-01/firewallrules/id_firewallrule.go index c3791ac27f5..4f3a4ff143e 100644 --- a/resource-manager/sql/2021-11-01/firewallrules/id_firewallrule.go +++ b/resource-manager/sql/2021-11-01/firewallrules/id_firewallrule.go @@ -38,23 +38,9 @@ func ParseFirewallRuleID(input string) (*FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallRuleId{} - - 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.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFirewallRuleIDInsensitively(input string) (*FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FirewallRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + if id.FirewallRuleName, ok = input.Parsed["firewallRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", input) } - return &id, nil + return nil } // ValidateFirewallRuleID checks that 'input' can be parsed as a Firewall Rule ID diff --git a/resource-manager/sql/2021-11-01/instancefailovergroups/id_instancefailovergroup.go b/resource-manager/sql/2021-11-01/instancefailovergroups/id_instancefailovergroup.go index b4c603bee51..098e76f3b16 100644 --- a/resource-manager/sql/2021-11-01/instancefailovergroups/id_instancefailovergroup.go +++ b/resource-manager/sql/2021-11-01/instancefailovergroups/id_instancefailovergroup.go @@ -38,23 +38,9 @@ func ParseInstanceFailoverGroupID(input string) (*InstanceFailoverGroupId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InstanceFailoverGroupId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.InstanceFailoverGroupName, ok = parsed.Parsed["instanceFailoverGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceFailoverGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseInstanceFailoverGroupIDInsensitively(input string) (*InstanceFailoverG return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InstanceFailoverGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *InstanceFailoverGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.InstanceFailoverGroupName, ok = parsed.Parsed["instanceFailoverGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceFailoverGroupName", *parsed) + if id.InstanceFailoverGroupName, ok = input.Parsed["instanceFailoverGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceFailoverGroupName", input) } - return &id, nil + return nil } // ValidateInstanceFailoverGroupID checks that 'input' can be parsed as a Instance Failover Group ID diff --git a/resource-manager/sql/2021-11-01/instancefailovergroups/id_providerlocation.go b/resource-manager/sql/2021-11-01/instancefailovergroups/id_providerlocation.go index a53e9150fe9..5d86c376322 100644 --- a/resource-manager/sql/2021-11-01/instancefailovergroups/id_providerlocation.go +++ b/resource-manager/sql/2021-11-01/instancefailovergroups/id_providerlocation.go @@ -36,19 +36,9 @@ func ParseProviderLocationID(input string) (*ProviderLocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderLocationIDInsensitively(input string) (*ProviderLocationId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderLocationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateProviderLocationID checks that 'input' can be parsed as a Provider Location ID diff --git a/resource-manager/sql/2021-11-01/instancepools/id_instancepool.go b/resource-manager/sql/2021-11-01/instancepools/id_instancepool.go index f6bb0b27def..d46dc46b651 100644 --- a/resource-manager/sql/2021-11-01/instancepools/id_instancepool.go +++ b/resource-manager/sql/2021-11-01/instancepools/id_instancepool.go @@ -36,19 +36,9 @@ func ParseInstancePoolID(input string) (*InstancePoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InstancePoolId{} - - 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.InstancePoolName, ok = parsed.Parsed["instancePoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instancePoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseInstancePoolIDInsensitively(input string) (*InstancePoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InstancePoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *InstancePoolId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.InstancePoolName, ok = parsed.Parsed["instancePoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instancePoolName", *parsed) + if id.InstancePoolName, ok = input.Parsed["instancePoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instancePoolName", input) } - return &id, nil + return nil } // ValidateInstancePoolID checks that 'input' can be parsed as a Instance Pool ID diff --git a/resource-manager/sql/2021-11-01/ipv6firewallrules/id_ipv6firewallrule.go b/resource-manager/sql/2021-11-01/ipv6firewallrules/id_ipv6firewallrule.go index 017dac13277..5b3114eff94 100644 --- a/resource-manager/sql/2021-11-01/ipv6firewallrules/id_ipv6firewallrule.go +++ b/resource-manager/sql/2021-11-01/ipv6firewallrules/id_ipv6firewallrule.go @@ -38,23 +38,9 @@ func ParseIPv6FirewallRuleID(input string) (*IPv6FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IPv6FirewallRuleId{} - - 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.Ipv6FirewallRuleName, ok = parsed.Parsed["ipv6FirewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ipv6FirewallRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIPv6FirewallRuleIDInsensitively(input string) (*IPv6FirewallRuleId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IPv6FirewallRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IPv6FirewallRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.Ipv6FirewallRuleName, ok = parsed.Parsed["ipv6FirewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ipv6FirewallRuleName", *parsed) + if id.Ipv6FirewallRuleName, ok = input.Parsed["ipv6FirewallRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ipv6FirewallRuleName", input) } - return &id, nil + return nil } // ValidateIPv6FirewallRuleID checks that 'input' can be parsed as a I Pv 6 Firewall Rule ID diff --git a/resource-manager/sql/2021-11-01/jobagents/id_jobagent.go b/resource-manager/sql/2021-11-01/jobagents/id_jobagent.go index 6e081491cc8..cc7b6f1d7af 100644 --- a/resource-manager/sql/2021-11-01/jobagents/id_jobagent.go +++ b/resource-manager/sql/2021-11-01/jobagents/id_jobagent.go @@ -38,23 +38,9 @@ func ParseJobAgentID(input string) (*JobAgentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobAgentId{} - - 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.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseJobAgentIDInsensitively(input string) (*JobAgentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobAgentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *JobAgentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if id.JobAgentName, ok = input.Parsed["jobAgentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", input) } - return &id, nil + return nil } // ValidateJobAgentID checks that 'input' can be parsed as a Job Agent ID diff --git a/resource-manager/sql/2021-11-01/jobcredentials/id_credential.go b/resource-manager/sql/2021-11-01/jobcredentials/id_credential.go index 260240e02a9..bf3b1f5d3d0 100644 --- a/resource-manager/sql/2021-11-01/jobcredentials/id_credential.go +++ b/resource-manager/sql/2021-11-01/jobcredentials/id_credential.go @@ -40,27 +40,9 @@ func ParseCredentialID(input string) (*CredentialId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CredentialId{} - - 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.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) - } - - if id.CredentialName, ok = parsed.Parsed["credentialName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "credentialName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseCredentialIDInsensitively(input string) (*CredentialId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CredentialId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *CredentialId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if id.JobAgentName, ok = input.Parsed["jobAgentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", input) } - if id.CredentialName, ok = parsed.Parsed["credentialName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "credentialName", *parsed) + if id.CredentialName, ok = input.Parsed["credentialName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "credentialName", input) } - return &id, nil + return nil } // ValidateCredentialID checks that 'input' can be parsed as a Credential ID diff --git a/resource-manager/sql/2021-11-01/jobcredentials/id_jobagent.go b/resource-manager/sql/2021-11-01/jobcredentials/id_jobagent.go index 9c24ea9ee8d..c962a930918 100644 --- a/resource-manager/sql/2021-11-01/jobcredentials/id_jobagent.go +++ b/resource-manager/sql/2021-11-01/jobcredentials/id_jobagent.go @@ -38,23 +38,9 @@ func ParseJobAgentID(input string) (*JobAgentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobAgentId{} - - 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.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseJobAgentIDInsensitively(input string) (*JobAgentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobAgentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *JobAgentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if id.JobAgentName, ok = input.Parsed["jobAgentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", input) } - return &id, nil + return nil } // ValidateJobAgentID checks that 'input' can be parsed as a Job Agent ID diff --git a/resource-manager/sql/2021-11-01/jobexecutions/id_execution.go b/resource-manager/sql/2021-11-01/jobexecutions/id_execution.go index 4e636e504d9..79ebd882159 100644 --- a/resource-manager/sql/2021-11-01/jobexecutions/id_execution.go +++ b/resource-manager/sql/2021-11-01/jobexecutions/id_execution.go @@ -42,31 +42,9 @@ func ParseExecutionID(input string) (*ExecutionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExecutionId{} - - 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.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) - } - - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) - } - - if id.JobExecutionId, ok = parsed.Parsed["jobExecutionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobExecutionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseExecutionIDInsensitively(input string) (*ExecutionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExecutionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ExecutionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if id.JobAgentName, ok = input.Parsed["jobAgentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - if id.JobExecutionId, ok = parsed.Parsed["jobExecutionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobExecutionId", *parsed) + if id.JobExecutionId, ok = input.Parsed["jobExecutionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobExecutionId", input) } - return &id, nil + return nil } // ValidateExecutionID checks that 'input' can be parsed as a Execution ID diff --git a/resource-manager/sql/2021-11-01/jobexecutions/id_job.go b/resource-manager/sql/2021-11-01/jobexecutions/id_job.go index 8c1502f0ffe..44b61a66530 100644 --- a/resource-manager/sql/2021-11-01/jobexecutions/id_job.go +++ b/resource-manager/sql/2021-11-01/jobexecutions/id_job.go @@ -40,27 +40,9 @@ func ParseJobID(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} - - 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.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) - } - - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseJobIDInsensitively(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *JobId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if id.JobAgentName, ok = input.Parsed["jobAgentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - return &id, nil + return nil } // ValidateJobID checks that 'input' can be parsed as a Job ID diff --git a/resource-manager/sql/2021-11-01/jobexecutions/id_jobagent.go b/resource-manager/sql/2021-11-01/jobexecutions/id_jobagent.go index 375b86657b8..36dabd8303b 100644 --- a/resource-manager/sql/2021-11-01/jobexecutions/id_jobagent.go +++ b/resource-manager/sql/2021-11-01/jobexecutions/id_jobagent.go @@ -38,23 +38,9 @@ func ParseJobAgentID(input string) (*JobAgentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobAgentId{} - - 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.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseJobAgentIDInsensitively(input string) (*JobAgentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobAgentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *JobAgentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if id.JobAgentName, ok = input.Parsed["jobAgentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", input) } - return &id, nil + return nil } // ValidateJobAgentID checks that 'input' can be parsed as a Job Agent ID diff --git a/resource-manager/sql/2021-11-01/jobs/id_job.go b/resource-manager/sql/2021-11-01/jobs/id_job.go index c30a974c9d7..1ff5c9230f2 100644 --- a/resource-manager/sql/2021-11-01/jobs/id_job.go +++ b/resource-manager/sql/2021-11-01/jobs/id_job.go @@ -40,27 +40,9 @@ func ParseJobID(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} - - 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.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) - } - - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseJobIDInsensitively(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *JobId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if id.JobAgentName, ok = input.Parsed["jobAgentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - return &id, nil + return nil } // ValidateJobID checks that 'input' can be parsed as a Job ID diff --git a/resource-manager/sql/2021-11-01/jobs/id_jobagent.go b/resource-manager/sql/2021-11-01/jobs/id_jobagent.go index 49ca167521e..3c9765d9e25 100644 --- a/resource-manager/sql/2021-11-01/jobs/id_jobagent.go +++ b/resource-manager/sql/2021-11-01/jobs/id_jobagent.go @@ -38,23 +38,9 @@ func ParseJobAgentID(input string) (*JobAgentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobAgentId{} - - 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.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseJobAgentIDInsensitively(input string) (*JobAgentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobAgentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *JobAgentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if id.JobAgentName, ok = input.Parsed["jobAgentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", input) } - return &id, nil + return nil } // ValidateJobAgentID checks that 'input' can be parsed as a Job Agent ID diff --git a/resource-manager/sql/2021-11-01/jobstepexecutions/id_execution.go b/resource-manager/sql/2021-11-01/jobstepexecutions/id_execution.go index 57d800bb53b..98f382c105b 100644 --- a/resource-manager/sql/2021-11-01/jobstepexecutions/id_execution.go +++ b/resource-manager/sql/2021-11-01/jobstepexecutions/id_execution.go @@ -42,31 +42,9 @@ func ParseExecutionID(input string) (*ExecutionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExecutionId{} - - 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.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) - } - - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) - } - - if id.JobExecutionId, ok = parsed.Parsed["jobExecutionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobExecutionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseExecutionIDInsensitively(input string) (*ExecutionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExecutionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ExecutionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if id.JobAgentName, ok = input.Parsed["jobAgentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - if id.JobExecutionId, ok = parsed.Parsed["jobExecutionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobExecutionId", *parsed) + if id.JobExecutionId, ok = input.Parsed["jobExecutionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobExecutionId", input) } - return &id, nil + return nil } // ValidateExecutionID checks that 'input' can be parsed as a Execution ID diff --git a/resource-manager/sql/2021-11-01/jobstepexecutions/id_executionstep.go b/resource-manager/sql/2021-11-01/jobstepexecutions/id_executionstep.go index e153906687b..fd80ece7e18 100644 --- a/resource-manager/sql/2021-11-01/jobstepexecutions/id_executionstep.go +++ b/resource-manager/sql/2021-11-01/jobstepexecutions/id_executionstep.go @@ -44,35 +44,9 @@ func ParseExecutionStepID(input string) (*ExecutionStepId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExecutionStepId{} - - 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.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) - } - - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) - } - - if id.JobExecutionId, ok = parsed.Parsed["jobExecutionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobExecutionId", *parsed) - } - - if id.StepName, ok = parsed.Parsed["stepName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "stepName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseExecutionStepIDInsensitively(input string) (*ExecutionStepId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExecutionStepId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ExecutionStepId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if id.JobAgentName, ok = input.Parsed["jobAgentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - if id.JobExecutionId, ok = parsed.Parsed["jobExecutionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobExecutionId", *parsed) + if id.JobExecutionId, ok = input.Parsed["jobExecutionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobExecutionId", input) } - if id.StepName, ok = parsed.Parsed["stepName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "stepName", *parsed) + if id.StepName, ok = input.Parsed["stepName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "stepName", input) } - return &id, nil + return nil } // ValidateExecutionStepID checks that 'input' can be parsed as a Execution Step ID diff --git a/resource-manager/sql/2021-11-01/jobsteps/id_job.go b/resource-manager/sql/2021-11-01/jobsteps/id_job.go index 7a6984cdfef..0230ed0405c 100644 --- a/resource-manager/sql/2021-11-01/jobsteps/id_job.go +++ b/resource-manager/sql/2021-11-01/jobsteps/id_job.go @@ -40,27 +40,9 @@ func ParseJobID(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} - - 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.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) - } - - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseJobIDInsensitively(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *JobId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if id.JobAgentName, ok = input.Parsed["jobAgentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - return &id, nil + return nil } // ValidateJobID checks that 'input' can be parsed as a Job ID diff --git a/resource-manager/sql/2021-11-01/jobsteps/id_step.go b/resource-manager/sql/2021-11-01/jobsteps/id_step.go index b41baf4450b..ce20fcc63fa 100644 --- a/resource-manager/sql/2021-11-01/jobsteps/id_step.go +++ b/resource-manager/sql/2021-11-01/jobsteps/id_step.go @@ -42,31 +42,9 @@ func ParseStepID(input string) (*StepId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StepId{} - - 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.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) - } - - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) - } - - if id.StepName, ok = parsed.Parsed["stepName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "stepName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseStepIDInsensitively(input string) (*StepId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StepId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *StepId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if id.JobAgentName, ok = input.Parsed["jobAgentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - if id.StepName, ok = parsed.Parsed["stepName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "stepName", *parsed) + if id.StepName, ok = input.Parsed["stepName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "stepName", input) } - return &id, nil + return nil } // ValidateStepID checks that 'input' can be parsed as a Step ID diff --git a/resource-manager/sql/2021-11-01/jobsteps/id_version.go b/resource-manager/sql/2021-11-01/jobsteps/id_version.go index 8cc2401e1cf..aae15caeb59 100644 --- a/resource-manager/sql/2021-11-01/jobsteps/id_version.go +++ b/resource-manager/sql/2021-11-01/jobsteps/id_version.go @@ -42,31 +42,9 @@ func ParseVersionID(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} - - 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.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) - } - - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseVersionIDInsensitively(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if id.JobAgentName, ok = input.Parsed["jobAgentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateVersionID checks that 'input' can be parsed as a Version ID diff --git a/resource-manager/sql/2021-11-01/jobsteps/id_versionstep.go b/resource-manager/sql/2021-11-01/jobsteps/id_versionstep.go index 06e3e42e5d6..395ba0da99a 100644 --- a/resource-manager/sql/2021-11-01/jobsteps/id_versionstep.go +++ b/resource-manager/sql/2021-11-01/jobsteps/id_versionstep.go @@ -44,35 +44,9 @@ func ParseVersionStepID(input string) (*VersionStepId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionStepId{} - - 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.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) - } - - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) - } - - if id.StepName, ok = parsed.Parsed["stepName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "stepName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseVersionStepIDInsensitively(input string) (*VersionStepId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionStepId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VersionStepId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if id.JobAgentName, ok = input.Parsed["jobAgentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - if id.StepName, ok = parsed.Parsed["stepName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "stepName", *parsed) + if id.StepName, ok = input.Parsed["stepName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "stepName", input) } - return &id, nil + return nil } // ValidateVersionStepID checks that 'input' can be parsed as a Version Step ID diff --git a/resource-manager/sql/2021-11-01/jobtargetexecutions/id_execution.go b/resource-manager/sql/2021-11-01/jobtargetexecutions/id_execution.go index 0ca99d6605e..00ead3132ff 100644 --- a/resource-manager/sql/2021-11-01/jobtargetexecutions/id_execution.go +++ b/resource-manager/sql/2021-11-01/jobtargetexecutions/id_execution.go @@ -42,31 +42,9 @@ func ParseExecutionID(input string) (*ExecutionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExecutionId{} - - 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.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) - } - - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) - } - - if id.JobExecutionId, ok = parsed.Parsed["jobExecutionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobExecutionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseExecutionIDInsensitively(input string) (*ExecutionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExecutionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ExecutionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if id.JobAgentName, ok = input.Parsed["jobAgentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - if id.JobExecutionId, ok = parsed.Parsed["jobExecutionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobExecutionId", *parsed) + if id.JobExecutionId, ok = input.Parsed["jobExecutionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobExecutionId", input) } - return &id, nil + return nil } // ValidateExecutionID checks that 'input' can be parsed as a Execution ID diff --git a/resource-manager/sql/2021-11-01/jobtargetexecutions/id_executionstep.go b/resource-manager/sql/2021-11-01/jobtargetexecutions/id_executionstep.go index 6437aade732..61dfa3ed73b 100644 --- a/resource-manager/sql/2021-11-01/jobtargetexecutions/id_executionstep.go +++ b/resource-manager/sql/2021-11-01/jobtargetexecutions/id_executionstep.go @@ -44,35 +44,9 @@ func ParseExecutionStepID(input string) (*ExecutionStepId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExecutionStepId{} - - 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.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) - } - - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) - } - - if id.JobExecutionId, ok = parsed.Parsed["jobExecutionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobExecutionId", *parsed) - } - - if id.StepName, ok = parsed.Parsed["stepName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "stepName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseExecutionStepIDInsensitively(input string) (*ExecutionStepId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExecutionStepId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ExecutionStepId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if id.JobAgentName, ok = input.Parsed["jobAgentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - if id.JobExecutionId, ok = parsed.Parsed["jobExecutionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobExecutionId", *parsed) + if id.JobExecutionId, ok = input.Parsed["jobExecutionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobExecutionId", input) } - if id.StepName, ok = parsed.Parsed["stepName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "stepName", *parsed) + if id.StepName, ok = input.Parsed["stepName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "stepName", input) } - return &id, nil + return nil } // ValidateExecutionStepID checks that 'input' can be parsed as a Execution Step ID diff --git a/resource-manager/sql/2021-11-01/jobtargetexecutions/id_target.go b/resource-manager/sql/2021-11-01/jobtargetexecutions/id_target.go index 8040ae7a9c0..963bccf9a33 100644 --- a/resource-manager/sql/2021-11-01/jobtargetexecutions/id_target.go +++ b/resource-manager/sql/2021-11-01/jobtargetexecutions/id_target.go @@ -46,39 +46,9 @@ func ParseTargetID(input string) (*TargetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TargetId{} - - 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.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) - } - - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) - } - - if id.JobExecutionId, ok = parsed.Parsed["jobExecutionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobExecutionId", *parsed) - } - - if id.StepName, ok = parsed.Parsed["stepName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "stepName", *parsed) - } - - if id.TargetId, ok = parsed.Parsed["targetId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -93,42 +63,50 @@ func ParseTargetIDInsensitively(input string) (*TargetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TargetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TargetId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if id.JobAgentName, ok = input.Parsed["jobAgentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - if id.JobExecutionId, ok = parsed.Parsed["jobExecutionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobExecutionId", *parsed) + if id.JobExecutionId, ok = input.Parsed["jobExecutionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobExecutionId", input) } - if id.StepName, ok = parsed.Parsed["stepName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "stepName", *parsed) + if id.StepName, ok = input.Parsed["stepName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "stepName", input) } - if id.TargetId, ok = parsed.Parsed["targetId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetId", *parsed) + if id.TargetId, ok = input.Parsed["targetId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "targetId", input) } - return &id, nil + return nil } // ValidateTargetID checks that 'input' can be parsed as a Target ID diff --git a/resource-manager/sql/2021-11-01/jobtargetgroups/id_jobagent.go b/resource-manager/sql/2021-11-01/jobtargetgroups/id_jobagent.go index e3782714a5c..fff60d47a40 100644 --- a/resource-manager/sql/2021-11-01/jobtargetgroups/id_jobagent.go +++ b/resource-manager/sql/2021-11-01/jobtargetgroups/id_jobagent.go @@ -38,23 +38,9 @@ func ParseJobAgentID(input string) (*JobAgentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobAgentId{} - - 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.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseJobAgentIDInsensitively(input string) (*JobAgentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobAgentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *JobAgentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if id.JobAgentName, ok = input.Parsed["jobAgentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", input) } - return &id, nil + return nil } // ValidateJobAgentID checks that 'input' can be parsed as a Job Agent ID diff --git a/resource-manager/sql/2021-11-01/jobtargetgroups/id_targetgroup.go b/resource-manager/sql/2021-11-01/jobtargetgroups/id_targetgroup.go index 8d72b92e637..44a9c50857d 100644 --- a/resource-manager/sql/2021-11-01/jobtargetgroups/id_targetgroup.go +++ b/resource-manager/sql/2021-11-01/jobtargetgroups/id_targetgroup.go @@ -40,27 +40,9 @@ func ParseTargetGroupID(input string) (*TargetGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TargetGroupId{} - - 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.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) - } - - if id.TargetGroupName, ok = parsed.Parsed["targetGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseTargetGroupIDInsensitively(input string) (*TargetGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TargetGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TargetGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if id.JobAgentName, ok = input.Parsed["jobAgentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", input) } - if id.TargetGroupName, ok = parsed.Parsed["targetGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetGroupName", *parsed) + if id.TargetGroupName, ok = input.Parsed["targetGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "targetGroupName", input) } - return &id, nil + return nil } // ValidateTargetGroupID checks that 'input' can be parsed as a Target Group ID diff --git a/resource-manager/sql/2021-11-01/jobversions/id_job.go b/resource-manager/sql/2021-11-01/jobversions/id_job.go index ad2863199b3..cc50e4d781a 100644 --- a/resource-manager/sql/2021-11-01/jobversions/id_job.go +++ b/resource-manager/sql/2021-11-01/jobversions/id_job.go @@ -40,27 +40,9 @@ func ParseJobID(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} - - 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.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) - } - - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseJobIDInsensitively(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *JobId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if id.JobAgentName, ok = input.Parsed["jobAgentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - return &id, nil + return nil } // ValidateJobID checks that 'input' can be parsed as a Job ID diff --git a/resource-manager/sql/2021-11-01/jobversions/id_version.go b/resource-manager/sql/2021-11-01/jobversions/id_version.go index 2cfdb9539ea..57232de2789 100644 --- a/resource-manager/sql/2021-11-01/jobversions/id_version.go +++ b/resource-manager/sql/2021-11-01/jobversions/id_version.go @@ -42,31 +42,9 @@ func ParseVersionID(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} - - 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.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) - } - - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseVersionIDInsensitively(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if id.JobAgentName, ok = input.Parsed["jobAgentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateVersionID checks that 'input' can be parsed as a Version ID diff --git a/resource-manager/sql/2021-11-01/locationcapabilities/id_location.go b/resource-manager/sql/2021-11-01/locationcapabilities/id_location.go index a1aaa6b22d6..acab89ca2e2 100644 --- a/resource-manager/sql/2021-11-01/locationcapabilities/id_location.go +++ b/resource-manager/sql/2021-11-01/locationcapabilities/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/sql/2021-11-01/longtermretentionbackups/id_location.go b/resource-manager/sql/2021-11-01/longtermretentionbackups/id_location.go index 7cb367c9946..840d99c04c8 100644 --- a/resource-manager/sql/2021-11-01/longtermretentionbackups/id_location.go +++ b/resource-manager/sql/2021-11-01/longtermretentionbackups/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/sql/2021-11-01/longtermretentionbackups/id_locationlongtermretentionserver.go b/resource-manager/sql/2021-11-01/longtermretentionbackups/id_locationlongtermretentionserver.go index bfd048f5f10..dbbd58e977e 100644 --- a/resource-manager/sql/2021-11-01/longtermretentionbackups/id_locationlongtermretentionserver.go +++ b/resource-manager/sql/2021-11-01/longtermretentionbackups/id_locationlongtermretentionserver.go @@ -38,23 +38,9 @@ func ParseLocationLongTermRetentionServerID(input string) (*LocationLongTermRete return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationLongTermRetentionServerId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.LongTermRetentionServerName, ok = parsed.Parsed["longTermRetentionServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLocationLongTermRetentionServerIDInsensitively(input string) (*Locatio return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationLongTermRetentionServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LocationLongTermRetentionServerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.LongTermRetentionServerName, ok = parsed.Parsed["longTermRetentionServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionServerName", *parsed) + if id.LongTermRetentionServerName, ok = input.Parsed["longTermRetentionServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionServerName", input) } - return &id, nil + return nil } // ValidateLocationLongTermRetentionServerID checks that 'input' can be parsed as a Location Long Term Retention Server ID diff --git a/resource-manager/sql/2021-11-01/longtermretentionbackups/id_locationlongtermretentionserverlongtermretentiondatabase.go b/resource-manager/sql/2021-11-01/longtermretentionbackups/id_locationlongtermretentionserverlongtermretentiondatabase.go index dd1e6dae17b..bd19cc9a11e 100644 --- a/resource-manager/sql/2021-11-01/longtermretentionbackups/id_locationlongtermretentionserverlongtermretentiondatabase.go +++ b/resource-manager/sql/2021-11-01/longtermretentionbackups/id_locationlongtermretentionserverlongtermretentiondatabase.go @@ -40,27 +40,9 @@ func ParseLocationLongTermRetentionServerLongTermRetentionDatabaseID(input strin return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationLongTermRetentionServerLongTermRetentionDatabaseId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.LongTermRetentionServerName, ok = parsed.Parsed["longTermRetentionServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionServerName", *parsed) - } - - if id.LongTermRetentionDatabaseName, ok = parsed.Parsed["longTermRetentionDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionDatabaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseLocationLongTermRetentionServerLongTermRetentionDatabaseIDInsensitivel return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationLongTermRetentionServerLongTermRetentionDatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationLongTermRetentionServerLongTermRetentionDatabaseId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.LongTermRetentionServerName, ok = parsed.Parsed["longTermRetentionServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionServerName", *parsed) + if id.LongTermRetentionServerName, ok = input.Parsed["longTermRetentionServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionServerName", input) } - if id.LongTermRetentionDatabaseName, ok = parsed.Parsed["longTermRetentionDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionDatabaseName", *parsed) + if id.LongTermRetentionDatabaseName, ok = input.Parsed["longTermRetentionDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionDatabaseName", input) } - return &id, nil + return nil } // ValidateLocationLongTermRetentionServerLongTermRetentionDatabaseID checks that 'input' can be parsed as a Location Long Term Retention Server Long Term Retention Database ID diff --git a/resource-manager/sql/2021-11-01/longtermretentionbackups/id_longtermretentionbackup.go b/resource-manager/sql/2021-11-01/longtermretentionbackups/id_longtermretentionbackup.go index 2dcf5c6f491..39bb5a345e4 100644 --- a/resource-manager/sql/2021-11-01/longtermretentionbackups/id_longtermretentionbackup.go +++ b/resource-manager/sql/2021-11-01/longtermretentionbackups/id_longtermretentionbackup.go @@ -40,27 +40,9 @@ func ParseLongTermRetentionBackupID(input string) (*LongTermRetentionBackupId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LongTermRetentionBackupId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.LongTermRetentionServerName, ok = parsed.Parsed["longTermRetentionServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionServerName", *parsed) - } - - if id.LongTermRetentionDatabaseName, ok = parsed.Parsed["longTermRetentionDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionDatabaseName", *parsed) - } - - if id.LongTermRetentionBackupName, ok = parsed.Parsed["longTermRetentionBackupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionBackupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseLongTermRetentionBackupIDInsensitively(input string) (*LongTermRetenti return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LongTermRetentionBackupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LongTermRetentionBackupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.LongTermRetentionServerName, ok = parsed.Parsed["longTermRetentionServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionServerName", *parsed) + if id.LongTermRetentionServerName, ok = input.Parsed["longTermRetentionServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionServerName", input) } - if id.LongTermRetentionDatabaseName, ok = parsed.Parsed["longTermRetentionDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionDatabaseName", *parsed) + if id.LongTermRetentionDatabaseName, ok = input.Parsed["longTermRetentionDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionDatabaseName", input) } - if id.LongTermRetentionBackupName, ok = parsed.Parsed["longTermRetentionBackupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionBackupName", *parsed) + if id.LongTermRetentionBackupName, ok = input.Parsed["longTermRetentionBackupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionBackupName", input) } - return &id, nil + return nil } // ValidateLongTermRetentionBackupID checks that 'input' can be parsed as a Long Term Retention Backup ID diff --git a/resource-manager/sql/2021-11-01/longtermretentionbackups/id_longtermretentiondatabaselongtermretentionbackup.go b/resource-manager/sql/2021-11-01/longtermretentionbackups/id_longtermretentiondatabaselongtermretentionbackup.go index 269dea67d81..474c5dfe854 100644 --- a/resource-manager/sql/2021-11-01/longtermretentionbackups/id_longtermretentiondatabaselongtermretentionbackup.go +++ b/resource-manager/sql/2021-11-01/longtermretentionbackups/id_longtermretentiondatabaselongtermretentionbackup.go @@ -42,31 +42,9 @@ func ParseLongTermRetentionDatabaseLongTermRetentionBackupID(input string) (*Lon return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LongTermRetentionDatabaseLongTermRetentionBackupId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.LongTermRetentionServerName, ok = parsed.Parsed["longTermRetentionServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionServerName", *parsed) - } - - if id.LongTermRetentionDatabaseName, ok = parsed.Parsed["longTermRetentionDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionDatabaseName", *parsed) - } - - if id.LongTermRetentionBackupName, ok = parsed.Parsed["longTermRetentionBackupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionBackupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseLongTermRetentionDatabaseLongTermRetentionBackupIDInsensitively(input return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LongTermRetentionDatabaseLongTermRetentionBackupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LongTermRetentionDatabaseLongTermRetentionBackupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.LongTermRetentionServerName, ok = parsed.Parsed["longTermRetentionServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionServerName", *parsed) + if id.LongTermRetentionServerName, ok = input.Parsed["longTermRetentionServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionServerName", input) } - if id.LongTermRetentionDatabaseName, ok = parsed.Parsed["longTermRetentionDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionDatabaseName", *parsed) + if id.LongTermRetentionDatabaseName, ok = input.Parsed["longTermRetentionDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionDatabaseName", input) } - if id.LongTermRetentionBackupName, ok = parsed.Parsed["longTermRetentionBackupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionBackupName", *parsed) + if id.LongTermRetentionBackupName, ok = input.Parsed["longTermRetentionBackupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionBackupName", input) } - return &id, nil + return nil } // ValidateLongTermRetentionDatabaseLongTermRetentionBackupID checks that 'input' can be parsed as a Long Term Retention Database Long Term Retention Backup ID diff --git a/resource-manager/sql/2021-11-01/longtermretentionbackups/id_longtermretentionserver.go b/resource-manager/sql/2021-11-01/longtermretentionbackups/id_longtermretentionserver.go index 5f0e048ebcc..157701e361c 100644 --- a/resource-manager/sql/2021-11-01/longtermretentionbackups/id_longtermretentionserver.go +++ b/resource-manager/sql/2021-11-01/longtermretentionbackups/id_longtermretentionserver.go @@ -36,19 +36,9 @@ func ParseLongTermRetentionServerID(input string) (*LongTermRetentionServerId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LongTermRetentionServerId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.LongTermRetentionServerName, ok = parsed.Parsed["longTermRetentionServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLongTermRetentionServerIDInsensitively(input string) (*LongTermRetenti return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LongTermRetentionServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LongTermRetentionServerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.LongTermRetentionServerName, ok = parsed.Parsed["longTermRetentionServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionServerName", *parsed) + if id.LongTermRetentionServerName, ok = input.Parsed["longTermRetentionServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionServerName", input) } - return &id, nil + return nil } // ValidateLongTermRetentionServerID checks that 'input' can be parsed as a Long Term Retention Server ID diff --git a/resource-manager/sql/2021-11-01/longtermretentionbackups/id_longtermretentionserverlongtermretentiondatabase.go b/resource-manager/sql/2021-11-01/longtermretentionbackups/id_longtermretentionserverlongtermretentiondatabase.go index bf77fcee189..30ae16ec466 100644 --- a/resource-manager/sql/2021-11-01/longtermretentionbackups/id_longtermretentionserverlongtermretentiondatabase.go +++ b/resource-manager/sql/2021-11-01/longtermretentionbackups/id_longtermretentionserverlongtermretentiondatabase.go @@ -38,23 +38,9 @@ func ParseLongTermRetentionServerLongTermRetentionDatabaseID(input string) (*Lon return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LongTermRetentionServerLongTermRetentionDatabaseId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.LongTermRetentionServerName, ok = parsed.Parsed["longTermRetentionServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionServerName", *parsed) - } - - if id.LongTermRetentionDatabaseName, ok = parsed.Parsed["longTermRetentionDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionDatabaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLongTermRetentionServerLongTermRetentionDatabaseIDInsensitively(input return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LongTermRetentionServerLongTermRetentionDatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LongTermRetentionServerLongTermRetentionDatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.LongTermRetentionServerName, ok = parsed.Parsed["longTermRetentionServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionServerName", *parsed) + if id.LongTermRetentionServerName, ok = input.Parsed["longTermRetentionServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionServerName", input) } - if id.LongTermRetentionDatabaseName, ok = parsed.Parsed["longTermRetentionDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionDatabaseName", *parsed) + if id.LongTermRetentionDatabaseName, ok = input.Parsed["longTermRetentionDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionDatabaseName", input) } - return &id, nil + return nil } // ValidateLongTermRetentionServerLongTermRetentionDatabaseID checks that 'input' can be parsed as a Long Term Retention Server Long Term Retention Database ID diff --git a/resource-manager/sql/2021-11-01/longtermretentionbackups/id_providerlocation.go b/resource-manager/sql/2021-11-01/longtermretentionbackups/id_providerlocation.go index 446c5de599c..5e34cda01b9 100644 --- a/resource-manager/sql/2021-11-01/longtermretentionbackups/id_providerlocation.go +++ b/resource-manager/sql/2021-11-01/longtermretentionbackups/id_providerlocation.go @@ -36,19 +36,9 @@ func ParseProviderLocationID(input string) (*ProviderLocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderLocationIDInsensitively(input string) (*ProviderLocationId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderLocationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateProviderLocationID checks that 'input' can be parsed as a Provider Location ID diff --git a/resource-manager/sql/2021-11-01/longtermretentionmanagedinstancebackups/id_location.go b/resource-manager/sql/2021-11-01/longtermretentionmanagedinstancebackups/id_location.go index a1d658d1e4d..b5b9cd3d778 100644 --- a/resource-manager/sql/2021-11-01/longtermretentionmanagedinstancebackups/id_location.go +++ b/resource-manager/sql/2021-11-01/longtermretentionmanagedinstancebackups/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/sql/2021-11-01/longtermretentionmanagedinstancebackups/id_locationlongtermretentionmanagedinstance.go b/resource-manager/sql/2021-11-01/longtermretentionmanagedinstancebackups/id_locationlongtermretentionmanagedinstance.go index 07acca9ea62..6d23d43c429 100644 --- a/resource-manager/sql/2021-11-01/longtermretentionmanagedinstancebackups/id_locationlongtermretentionmanagedinstance.go +++ b/resource-manager/sql/2021-11-01/longtermretentionmanagedinstancebackups/id_locationlongtermretentionmanagedinstance.go @@ -38,23 +38,9 @@ func ParseLocationLongTermRetentionManagedInstanceID(input string) (*LocationLon return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationLongTermRetentionManagedInstanceId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.LongTermRetentionManagedInstanceName, ok = parsed.Parsed["longTermRetentionManagedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionManagedInstanceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLocationLongTermRetentionManagedInstanceIDInsensitively(input string) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationLongTermRetentionManagedInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LocationLongTermRetentionManagedInstanceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.LongTermRetentionManagedInstanceName, ok = parsed.Parsed["longTermRetentionManagedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionManagedInstanceName", *parsed) + if id.LongTermRetentionManagedInstanceName, ok = input.Parsed["longTermRetentionManagedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionManagedInstanceName", input) } - return &id, nil + return nil } // ValidateLocationLongTermRetentionManagedInstanceID checks that 'input' can be parsed as a Location Long Term Retention Managed Instance ID diff --git a/resource-manager/sql/2021-11-01/longtermretentionmanagedinstancebackups/id_longtermretentiondatabase.go b/resource-manager/sql/2021-11-01/longtermretentionmanagedinstancebackups/id_longtermretentiondatabase.go index 33d87805778..a3bcd5b1ffb 100644 --- a/resource-manager/sql/2021-11-01/longtermretentionmanagedinstancebackups/id_longtermretentiondatabase.go +++ b/resource-manager/sql/2021-11-01/longtermretentionmanagedinstancebackups/id_longtermretentiondatabase.go @@ -38,23 +38,9 @@ func ParseLongTermRetentionDatabaseID(input string) (*LongTermRetentionDatabaseI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LongTermRetentionDatabaseId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.LongTermRetentionManagedInstanceName, ok = parsed.Parsed["longTermRetentionManagedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionManagedInstanceName", *parsed) - } - - if id.LongTermRetentionDatabaseName, ok = parsed.Parsed["longTermRetentionDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionDatabaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLongTermRetentionDatabaseIDInsensitively(input string) (*LongTermReten return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LongTermRetentionDatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LongTermRetentionDatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.LongTermRetentionManagedInstanceName, ok = parsed.Parsed["longTermRetentionManagedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionManagedInstanceName", *parsed) + if id.LongTermRetentionManagedInstanceName, ok = input.Parsed["longTermRetentionManagedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionManagedInstanceName", input) } - if id.LongTermRetentionDatabaseName, ok = parsed.Parsed["longTermRetentionDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionDatabaseName", *parsed) + if id.LongTermRetentionDatabaseName, ok = input.Parsed["longTermRetentionDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionDatabaseName", input) } - return &id, nil + return nil } // ValidateLongTermRetentionDatabaseID checks that 'input' can be parsed as a Long Term Retention Database ID diff --git a/resource-manager/sql/2021-11-01/longtermretentionmanagedinstancebackups/id_longtermretentiondatabaselongtermretentionmanagedinstancebackup.go b/resource-manager/sql/2021-11-01/longtermretentionmanagedinstancebackups/id_longtermretentiondatabaselongtermretentionmanagedinstancebackup.go index 7af5965f78c..819b033b98f 100644 --- a/resource-manager/sql/2021-11-01/longtermretentionmanagedinstancebackups/id_longtermretentiondatabaselongtermretentionmanagedinstancebackup.go +++ b/resource-manager/sql/2021-11-01/longtermretentionmanagedinstancebackups/id_longtermretentiondatabaselongtermretentionmanagedinstancebackup.go @@ -42,31 +42,9 @@ func ParseLongTermRetentionDatabaseLongTermRetentionManagedInstanceBackupID(inpu return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LongTermRetentionDatabaseLongTermRetentionManagedInstanceBackupId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.LongTermRetentionManagedInstanceName, ok = parsed.Parsed["longTermRetentionManagedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionManagedInstanceName", *parsed) - } - - if id.LongTermRetentionDatabaseName, ok = parsed.Parsed["longTermRetentionDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionDatabaseName", *parsed) - } - - if id.LongTermRetentionManagedInstanceBackupName, ok = parsed.Parsed["longTermRetentionManagedInstanceBackupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionManagedInstanceBackupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseLongTermRetentionDatabaseLongTermRetentionManagedInstanceBackupIDInsen return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LongTermRetentionDatabaseLongTermRetentionManagedInstanceBackupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LongTermRetentionDatabaseLongTermRetentionManagedInstanceBackupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.LongTermRetentionManagedInstanceName, ok = parsed.Parsed["longTermRetentionManagedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionManagedInstanceName", *parsed) + if id.LongTermRetentionManagedInstanceName, ok = input.Parsed["longTermRetentionManagedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionManagedInstanceName", input) } - if id.LongTermRetentionDatabaseName, ok = parsed.Parsed["longTermRetentionDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionDatabaseName", *parsed) + if id.LongTermRetentionDatabaseName, ok = input.Parsed["longTermRetentionDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionDatabaseName", input) } - if id.LongTermRetentionManagedInstanceBackupName, ok = parsed.Parsed["longTermRetentionManagedInstanceBackupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionManagedInstanceBackupName", *parsed) + if id.LongTermRetentionManagedInstanceBackupName, ok = input.Parsed["longTermRetentionManagedInstanceBackupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionManagedInstanceBackupName", input) } - return &id, nil + return nil } // ValidateLongTermRetentionDatabaseLongTermRetentionManagedInstanceBackupID checks that 'input' can be parsed as a Long Term Retention Database Long Term Retention Managed Instance Backup ID diff --git a/resource-manager/sql/2021-11-01/longtermretentionmanagedinstancebackups/id_longtermretentionmanagedinstance.go b/resource-manager/sql/2021-11-01/longtermretentionmanagedinstancebackups/id_longtermretentionmanagedinstance.go index 150b1d1797d..98dadeccfee 100644 --- a/resource-manager/sql/2021-11-01/longtermretentionmanagedinstancebackups/id_longtermretentionmanagedinstance.go +++ b/resource-manager/sql/2021-11-01/longtermretentionmanagedinstancebackups/id_longtermretentionmanagedinstance.go @@ -36,19 +36,9 @@ func ParseLongTermRetentionManagedInstanceID(input string) (*LongTermRetentionMa return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LongTermRetentionManagedInstanceId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.LongTermRetentionManagedInstanceName, ok = parsed.Parsed["longTermRetentionManagedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionManagedInstanceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLongTermRetentionManagedInstanceIDInsensitively(input string) (*LongTe return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LongTermRetentionManagedInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LongTermRetentionManagedInstanceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.LongTermRetentionManagedInstanceName, ok = parsed.Parsed["longTermRetentionManagedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionManagedInstanceName", *parsed) + if id.LongTermRetentionManagedInstanceName, ok = input.Parsed["longTermRetentionManagedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionManagedInstanceName", input) } - return &id, nil + return nil } // ValidateLongTermRetentionManagedInstanceID checks that 'input' can be parsed as a Long Term Retention Managed Instance ID diff --git a/resource-manager/sql/2021-11-01/longtermretentionmanagedinstancebackups/id_longtermretentionmanagedinstancebackup.go b/resource-manager/sql/2021-11-01/longtermretentionmanagedinstancebackups/id_longtermretentionmanagedinstancebackup.go index 25f9c738702..8045528d90b 100644 --- a/resource-manager/sql/2021-11-01/longtermretentionmanagedinstancebackups/id_longtermretentionmanagedinstancebackup.go +++ b/resource-manager/sql/2021-11-01/longtermretentionmanagedinstancebackups/id_longtermretentionmanagedinstancebackup.go @@ -40,27 +40,9 @@ func ParseLongTermRetentionManagedInstanceBackupID(input string) (*LongTermReten return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LongTermRetentionManagedInstanceBackupId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.LongTermRetentionManagedInstanceName, ok = parsed.Parsed["longTermRetentionManagedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionManagedInstanceName", *parsed) - } - - if id.LongTermRetentionDatabaseName, ok = parsed.Parsed["longTermRetentionDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionDatabaseName", *parsed) - } - - if id.LongTermRetentionManagedInstanceBackupName, ok = parsed.Parsed["longTermRetentionManagedInstanceBackupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionManagedInstanceBackupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseLongTermRetentionManagedInstanceBackupIDInsensitively(input string) (* return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LongTermRetentionManagedInstanceBackupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LongTermRetentionManagedInstanceBackupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.LongTermRetentionManagedInstanceName, ok = parsed.Parsed["longTermRetentionManagedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionManagedInstanceName", *parsed) + if id.LongTermRetentionManagedInstanceName, ok = input.Parsed["longTermRetentionManagedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionManagedInstanceName", input) } - if id.LongTermRetentionDatabaseName, ok = parsed.Parsed["longTermRetentionDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionDatabaseName", *parsed) + if id.LongTermRetentionDatabaseName, ok = input.Parsed["longTermRetentionDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionDatabaseName", input) } - if id.LongTermRetentionManagedInstanceBackupName, ok = parsed.Parsed["longTermRetentionManagedInstanceBackupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionManagedInstanceBackupName", *parsed) + if id.LongTermRetentionManagedInstanceBackupName, ok = input.Parsed["longTermRetentionManagedInstanceBackupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionManagedInstanceBackupName", input) } - return &id, nil + return nil } // ValidateLongTermRetentionManagedInstanceBackupID checks that 'input' can be parsed as a Long Term Retention Managed Instance Backup ID diff --git a/resource-manager/sql/2021-11-01/longtermretentionmanagedinstancebackups/id_longtermretentionmanagedinstancelongtermretentiondatabase.go b/resource-manager/sql/2021-11-01/longtermretentionmanagedinstancebackups/id_longtermretentionmanagedinstancelongtermretentiondatabase.go index c437a42c2bf..9eff01937e8 100644 --- a/resource-manager/sql/2021-11-01/longtermretentionmanagedinstancebackups/id_longtermretentionmanagedinstancelongtermretentiondatabase.go +++ b/resource-manager/sql/2021-11-01/longtermretentionmanagedinstancebackups/id_longtermretentionmanagedinstancelongtermretentiondatabase.go @@ -40,27 +40,9 @@ func ParseLongTermRetentionManagedInstanceLongTermRetentionDatabaseID(input stri return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LongTermRetentionManagedInstanceLongTermRetentionDatabaseId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.LongTermRetentionManagedInstanceName, ok = parsed.Parsed["longTermRetentionManagedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionManagedInstanceName", *parsed) - } - - if id.LongTermRetentionDatabaseName, ok = parsed.Parsed["longTermRetentionDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionDatabaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseLongTermRetentionManagedInstanceLongTermRetentionDatabaseIDInsensitive return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LongTermRetentionManagedInstanceLongTermRetentionDatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LongTermRetentionManagedInstanceLongTermRetentionDatabaseId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.LongTermRetentionManagedInstanceName, ok = parsed.Parsed["longTermRetentionManagedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionManagedInstanceName", *parsed) + if id.LongTermRetentionManagedInstanceName, ok = input.Parsed["longTermRetentionManagedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionManagedInstanceName", input) } - if id.LongTermRetentionDatabaseName, ok = parsed.Parsed["longTermRetentionDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionDatabaseName", *parsed) + if id.LongTermRetentionDatabaseName, ok = input.Parsed["longTermRetentionDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionDatabaseName", input) } - return &id, nil + return nil } // ValidateLongTermRetentionManagedInstanceLongTermRetentionDatabaseID checks that 'input' can be parsed as a Long Term Retention Managed Instance Long Term Retention Database ID diff --git a/resource-manager/sql/2021-11-01/longtermretentionmanagedinstancebackups/id_providerlocation.go b/resource-manager/sql/2021-11-01/longtermretentionmanagedinstancebackups/id_providerlocation.go index 1491e708c81..6640f3ebf7c 100644 --- a/resource-manager/sql/2021-11-01/longtermretentionmanagedinstancebackups/id_providerlocation.go +++ b/resource-manager/sql/2021-11-01/longtermretentionmanagedinstancebackups/id_providerlocation.go @@ -36,19 +36,9 @@ func ParseProviderLocationID(input string) (*ProviderLocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderLocationIDInsensitively(input string) (*ProviderLocationId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderLocationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateProviderLocationID checks that 'input' can be parsed as a Provider Location ID diff --git a/resource-manager/sql/2021-11-01/manageddatabasecolumns/id_schematable.go b/resource-manager/sql/2021-11-01/manageddatabasecolumns/id_schematable.go index 18152ffbe22..3cd50557a17 100644 --- a/resource-manager/sql/2021-11-01/manageddatabasecolumns/id_schematable.go +++ b/resource-manager/sql/2021-11-01/manageddatabasecolumns/id_schematable.go @@ -42,31 +42,9 @@ func ParseSchemaTableID(input string) (*SchemaTableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SchemaTableId{} - - 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) - } - - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) - } - - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseSchemaTableIDInsensitively(input string) (*SchemaTableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SchemaTableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SchemaTableId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedInstanceName, ok = parsed.Parsed["managedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", *parsed) + if id.ManagedInstanceName, ok = input.Parsed["managedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) + if id.SchemaName, ok = input.Parsed["schemaName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "schemaName", input) } - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if id.TableName, ok = input.Parsed["tableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tableName", input) } - return &id, nil + return nil } // ValidateSchemaTableID checks that 'input' can be parsed as a Schema Table ID diff --git a/resource-manager/sql/2021-11-01/manageddatabasecolumns/id_tablecolumn.go b/resource-manager/sql/2021-11-01/manageddatabasecolumns/id_tablecolumn.go index 044aed8adac..99ba89e56ab 100644 --- a/resource-manager/sql/2021-11-01/manageddatabasecolumns/id_tablecolumn.go +++ b/resource-manager/sql/2021-11-01/manageddatabasecolumns/id_tablecolumn.go @@ -44,35 +44,9 @@ func ParseTableColumnID(input string) (*TableColumnId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TableColumnId{} - - 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) - } - - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) - } - - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) - } - - if id.ColumnName, ok = parsed.Parsed["columnName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "columnName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseTableColumnIDInsensitively(input string) (*TableColumnId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TableColumnId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TableColumnId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedInstanceName, ok = parsed.Parsed["managedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", *parsed) + if id.ManagedInstanceName, ok = input.Parsed["managedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) + if id.SchemaName, ok = input.Parsed["schemaName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "schemaName", input) } - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if id.TableName, ok = input.Parsed["tableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tableName", input) } - if id.ColumnName, ok = parsed.Parsed["columnName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "columnName", *parsed) + if id.ColumnName, ok = input.Parsed["columnName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "columnName", input) } - return &id, nil + return nil } // ValidateTableColumnID checks that 'input' can be parsed as a Table Column ID diff --git a/resource-manager/sql/2021-11-01/manageddatabasequeries/id_query.go b/resource-manager/sql/2021-11-01/manageddatabasequeries/id_query.go index 3df716d0195..6b1486e8e30 100644 --- a/resource-manager/sql/2021-11-01/manageddatabasequeries/id_query.go +++ b/resource-manager/sql/2021-11-01/manageddatabasequeries/id_query.go @@ -40,27 +40,9 @@ func ParseQueryID(input string) (*QueryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QueryId{} - - 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) - } - - if id.QueryId, ok = parsed.Parsed["queryId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "queryId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseQueryIDInsensitively(input string) (*QueryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QueryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *QueryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedInstanceName, ok = parsed.Parsed["managedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", *parsed) + if id.ManagedInstanceName, ok = input.Parsed["managedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.QueryId, ok = parsed.Parsed["queryId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "queryId", *parsed) + if id.QueryId, ok = input.Parsed["queryId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "queryId", input) } - return &id, nil + return nil } // ValidateQueryID checks that 'input' can be parsed as a Query ID diff --git a/resource-manager/sql/2021-11-01/manageddatabaseschemas/id_databaseschema.go b/resource-manager/sql/2021-11-01/manageddatabaseschemas/id_databaseschema.go index e94d1a6da74..338f42b9e00 100644 --- a/resource-manager/sql/2021-11-01/manageddatabaseschemas/id_databaseschema.go +++ b/resource-manager/sql/2021-11-01/manageddatabaseschemas/id_databaseschema.go @@ -40,27 +40,9 @@ func ParseDatabaseSchemaID(input string) (*DatabaseSchemaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseSchemaId{} - - 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) - } - - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseDatabaseSchemaIDInsensitively(input string) (*DatabaseSchemaId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseSchemaId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DatabaseSchemaId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedInstanceName, ok = parsed.Parsed["managedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", *parsed) + if id.ManagedInstanceName, ok = input.Parsed["managedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) + if id.SchemaName, ok = input.Parsed["schemaName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "schemaName", input) } - return &id, nil + return nil } // ValidateDatabaseSchemaID checks that 'input' can be parsed as a Database Schema ID diff --git a/resource-manager/sql/2021-11-01/manageddatabasesensitivitylabels/id_sensitivitylabelsensitivitylabelsource.go b/resource-manager/sql/2021-11-01/manageddatabasesensitivitylabels/id_sensitivitylabelsensitivitylabelsource.go index 421b5e44c5e..86204c06959 100644 --- a/resource-manager/sql/2021-11-01/manageddatabasesensitivitylabels/id_sensitivitylabelsensitivitylabelsource.go +++ b/resource-manager/sql/2021-11-01/manageddatabasesensitivitylabels/id_sensitivitylabelsensitivitylabelsource.go @@ -46,47 +46,9 @@ func ParseSensitivityLabelSensitivityLabelSourceID(input string) (*SensitivityLa return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SensitivityLabelSensitivityLabelSourceId{} - - 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) - } - - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) - } - - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) - } - - if id.ColumnName, ok = parsed.Parsed["columnName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "columnName", *parsed) - } - - if v, ok := parsed.Parsed["sensitivityLabelSource"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sensitivityLabelSource", *parsed) - } - - sensitivityLabelSource, err := parseSensitivityLabelSource(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.SensitivityLabelSource = *sensitivityLabelSource + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -101,50 +63,58 @@ func ParseSensitivityLabelSensitivityLabelSourceIDInsensitively(input string) (* return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SensitivityLabelSensitivityLabelSourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SensitivityLabelSensitivityLabelSourceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedInstanceName, ok = parsed.Parsed["managedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", *parsed) + if id.ManagedInstanceName, ok = input.Parsed["managedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) + if id.SchemaName, ok = input.Parsed["schemaName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "schemaName", input) } - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if id.TableName, ok = input.Parsed["tableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tableName", input) } - if id.ColumnName, ok = parsed.Parsed["columnName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "columnName", *parsed) + if id.ColumnName, ok = input.Parsed["columnName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "columnName", input) } - if v, ok := parsed.Parsed["sensitivityLabelSource"]; true { + if v, ok := input.Parsed["sensitivityLabelSource"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sensitivityLabelSource", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "sensitivityLabelSource", input) } sensitivityLabelSource, err := parseSensitivityLabelSource(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.SensitivityLabelSource = *sensitivityLabelSource } - return &id, nil + return nil } // ValidateSensitivityLabelSensitivityLabelSourceID checks that 'input' can be parsed as a Sensitivity Label Sensitivity Label Source ID diff --git a/resource-manager/sql/2021-11-01/manageddatabasesensitivitylabels/id_tablecolumn.go b/resource-manager/sql/2021-11-01/manageddatabasesensitivitylabels/id_tablecolumn.go index 632286a770c..768782a4900 100644 --- a/resource-manager/sql/2021-11-01/manageddatabasesensitivitylabels/id_tablecolumn.go +++ b/resource-manager/sql/2021-11-01/manageddatabasesensitivitylabels/id_tablecolumn.go @@ -44,35 +44,9 @@ func ParseTableColumnID(input string) (*TableColumnId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TableColumnId{} - - 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) - } - - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) - } - - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) - } - - if id.ColumnName, ok = parsed.Parsed["columnName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "columnName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseTableColumnIDInsensitively(input string) (*TableColumnId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TableColumnId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TableColumnId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedInstanceName, ok = parsed.Parsed["managedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", *parsed) + if id.ManagedInstanceName, ok = input.Parsed["managedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) + if id.SchemaName, ok = input.Parsed["schemaName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "schemaName", input) } - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if id.TableName, ok = input.Parsed["tableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tableName", input) } - if id.ColumnName, ok = parsed.Parsed["columnName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "columnName", *parsed) + if id.ColumnName, ok = input.Parsed["columnName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "columnName", input) } - return &id, nil + return nil } // ValidateTableColumnID checks that 'input' can be parsed as a Table Column ID diff --git a/resource-manager/sql/2021-11-01/manageddatabasetables/id_databaseschema.go b/resource-manager/sql/2021-11-01/manageddatabasetables/id_databaseschema.go index 66f9af6d784..29ef8994802 100644 --- a/resource-manager/sql/2021-11-01/manageddatabasetables/id_databaseschema.go +++ b/resource-manager/sql/2021-11-01/manageddatabasetables/id_databaseschema.go @@ -40,27 +40,9 @@ func ParseDatabaseSchemaID(input string) (*DatabaseSchemaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseSchemaId{} - - 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) - } - - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseDatabaseSchemaIDInsensitively(input string) (*DatabaseSchemaId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseSchemaId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DatabaseSchemaId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedInstanceName, ok = parsed.Parsed["managedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", *parsed) + if id.ManagedInstanceName, ok = input.Parsed["managedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) + if id.SchemaName, ok = input.Parsed["schemaName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "schemaName", input) } - return &id, nil + return nil } // ValidateDatabaseSchemaID checks that 'input' can be parsed as a Database Schema ID diff --git a/resource-manager/sql/2021-11-01/manageddatabasetables/id_schematable.go b/resource-manager/sql/2021-11-01/manageddatabasetables/id_schematable.go index 379c0015345..455be6ab639 100644 --- a/resource-manager/sql/2021-11-01/manageddatabasetables/id_schematable.go +++ b/resource-manager/sql/2021-11-01/manageddatabasetables/id_schematable.go @@ -42,31 +42,9 @@ func ParseSchemaTableID(input string) (*SchemaTableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SchemaTableId{} - - 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) - } - - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) - } - - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseSchemaTableIDInsensitively(input string) (*SchemaTableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SchemaTableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SchemaTableId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedInstanceName, ok = parsed.Parsed["managedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", *parsed) + if id.ManagedInstanceName, ok = input.Parsed["managedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) + if id.SchemaName, ok = input.Parsed["schemaName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "schemaName", input) } - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if id.TableName, ok = input.Parsed["tableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tableName", input) } - return &id, nil + return nil } // ValidateSchemaTableID checks that 'input' can be parsed as a Schema Table ID diff --git a/resource-manager/sql/2021-11-01/manageddatabasevulnerabilityassessmentrulebaselines/id_baselinebaseline.go b/resource-manager/sql/2021-11-01/manageddatabasevulnerabilityassessmentrulebaselines/id_baselinebaseline.go index 4fd038f58da..69eeb23548d 100644 --- a/resource-manager/sql/2021-11-01/manageddatabasevulnerabilityassessmentrulebaselines/id_baselinebaseline.go +++ b/resource-manager/sql/2021-11-01/manageddatabasevulnerabilityassessmentrulebaselines/id_baselinebaseline.go @@ -42,39 +42,9 @@ func ParseBaselineBaselineID(input string) (*BaselineBaselineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BaselineBaselineId{} - - 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) - } - - if id.RuleId, ok = parsed.Parsed["ruleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleId", *parsed) - } - - if v, ok := parsed.Parsed["baselineName"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "baselineName", *parsed) - } - - baselineName, err := parseVulnerabilityAssessmentPolicyBaselineName(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.BaselineName = *baselineName + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -89,42 +59,50 @@ func ParseBaselineBaselineIDInsensitively(input string) (*BaselineBaselineId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BaselineBaselineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *BaselineBaselineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedInstanceName, ok = parsed.Parsed["managedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", *parsed) + if id.ManagedInstanceName, ok = input.Parsed["managedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.RuleId, ok = parsed.Parsed["ruleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleId", *parsed) + if id.RuleId, ok = input.Parsed["ruleId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleId", input) } - if v, ok := parsed.Parsed["baselineName"]; true { + if v, ok := input.Parsed["baselineName"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "baselineName", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "baselineName", input) } baselineName, err := parseVulnerabilityAssessmentPolicyBaselineName(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.BaselineName = *baselineName } - return &id, nil + return nil } // ValidateBaselineBaselineID checks that 'input' can be parsed as a Baseline Baseline ID diff --git a/resource-manager/sql/2021-11-01/manageddatabasevulnerabilityassessmentscans/id_vulnerabilityassessmentscan.go b/resource-manager/sql/2021-11-01/manageddatabasevulnerabilityassessmentscans/id_vulnerabilityassessmentscan.go index e7b5aa669b0..e5635f7ab10 100644 --- a/resource-manager/sql/2021-11-01/manageddatabasevulnerabilityassessmentscans/id_vulnerabilityassessmentscan.go +++ b/resource-manager/sql/2021-11-01/manageddatabasevulnerabilityassessmentscans/id_vulnerabilityassessmentscan.go @@ -40,27 +40,9 @@ func ParseVulnerabilityAssessmentScanID(input string) (*VulnerabilityAssessmentS return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VulnerabilityAssessmentScanId{} - - 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) - } - - if id.ScanId, ok = parsed.Parsed["scanId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scanId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVulnerabilityAssessmentScanIDInsensitively(input string) (*Vulnerabili return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VulnerabilityAssessmentScanId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VulnerabilityAssessmentScanId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedInstanceName, ok = parsed.Parsed["managedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", *parsed) + if id.ManagedInstanceName, ok = input.Parsed["managedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.ScanId, ok = parsed.Parsed["scanId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scanId", *parsed) + if id.ScanId, ok = input.Parsed["scanId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scanId", input) } - return &id, nil + return nil } // ValidateVulnerabilityAssessmentScanID checks that 'input' can be parsed as a Vulnerability Assessment Scan ID diff --git a/resource-manager/sql/2021-11-01/managedinstancekeys/id_managedinstancekey.go b/resource-manager/sql/2021-11-01/managedinstancekeys/id_managedinstancekey.go index 3172e7deec9..4ec41a392ad 100644 --- a/resource-manager/sql/2021-11-01/managedinstancekeys/id_managedinstancekey.go +++ b/resource-manager/sql/2021-11-01/managedinstancekeys/id_managedinstancekey.go @@ -38,23 +38,9 @@ func ParseManagedInstanceKeyID(input string) (*ManagedInstanceKeyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedInstanceKeyId{} - - 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.KeyName, ok = parsed.Parsed["keyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseManagedInstanceKeyIDInsensitively(input string) (*ManagedInstanceKeyId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedInstanceKeyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ManagedInstanceKeyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedInstanceName, ok = parsed.Parsed["managedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", *parsed) + if id.ManagedInstanceName, ok = input.Parsed["managedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", input) } - if id.KeyName, ok = parsed.Parsed["keyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyName", *parsed) + if id.KeyName, ok = input.Parsed["keyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "keyName", input) } - return &id, nil + return nil } // ValidateManagedInstanceKeyID checks that 'input' can be parsed as a Managed Instance Key ID diff --git a/resource-manager/sql/2021-11-01/managedinstanceprivateendpointconnections/id_managedinstanceprivateendpointconnection.go b/resource-manager/sql/2021-11-01/managedinstanceprivateendpointconnections/id_managedinstanceprivateendpointconnection.go index addd26fc90f..55bfb52fba4 100644 --- a/resource-manager/sql/2021-11-01/managedinstanceprivateendpointconnections/id_managedinstanceprivateendpointconnection.go +++ b/resource-manager/sql/2021-11-01/managedinstanceprivateendpointconnections/id_managedinstanceprivateendpointconnection.go @@ -38,23 +38,9 @@ func ParseManagedInstancePrivateEndpointConnectionID(input string) (*ManagedInst return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedInstancePrivateEndpointConnectionId{} - - 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.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseManagedInstancePrivateEndpointConnectionIDInsensitively(input string) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedInstancePrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ManagedInstancePrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedInstanceName, ok = parsed.Parsed["managedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", *parsed) + if id.ManagedInstanceName, ok = input.Parsed["managedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidateManagedInstancePrivateEndpointConnectionID checks that 'input' can be parsed as a Managed Instance Private Endpoint Connection ID diff --git a/resource-manager/sql/2021-11-01/managedinstanceprivatelinkresources/id_managedinstanceprivatelinkresource.go b/resource-manager/sql/2021-11-01/managedinstanceprivatelinkresources/id_managedinstanceprivatelinkresource.go index d33dcc1c364..940aba153f3 100644 --- a/resource-manager/sql/2021-11-01/managedinstanceprivatelinkresources/id_managedinstanceprivatelinkresource.go +++ b/resource-manager/sql/2021-11-01/managedinstanceprivatelinkresources/id_managedinstanceprivatelinkresource.go @@ -38,23 +38,9 @@ func ParseManagedInstancePrivateLinkResourceID(input string) (*ManagedInstancePr return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedInstancePrivateLinkResourceId{} - - 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.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseManagedInstancePrivateLinkResourceIDInsensitively(input string) (*Mana return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedInstancePrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ManagedInstancePrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedInstanceName, ok = parsed.Parsed["managedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", *parsed) + if id.ManagedInstanceName, ok = input.Parsed["managedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidateManagedInstancePrivateLinkResourceID checks that 'input' can be parsed as a Managed Instance Private Link Resource ID diff --git a/resource-manager/sql/2021-11-01/managedinstances/id_instancepool.go b/resource-manager/sql/2021-11-01/managedinstances/id_instancepool.go index 0e487a0561b..e13cb30db31 100644 --- a/resource-manager/sql/2021-11-01/managedinstances/id_instancepool.go +++ b/resource-manager/sql/2021-11-01/managedinstances/id_instancepool.go @@ -36,19 +36,9 @@ func ParseInstancePoolID(input string) (*InstancePoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InstancePoolId{} - - 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.InstancePoolName, ok = parsed.Parsed["instancePoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instancePoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseInstancePoolIDInsensitively(input string) (*InstancePoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InstancePoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *InstancePoolId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.InstancePoolName, ok = parsed.Parsed["instancePoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instancePoolName", *parsed) + if id.InstancePoolName, ok = input.Parsed["instancePoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instancePoolName", input) } - return &id, nil + return nil } // ValidateInstancePoolID checks that 'input' can be parsed as a Instance Pool ID diff --git a/resource-manager/sql/2021-11-01/managedrestorabledroppeddatabasebackupshorttermretentionpolicies/id_managedinstancerestorabledroppeddatabase.go b/resource-manager/sql/2021-11-01/managedrestorabledroppeddatabasebackupshorttermretentionpolicies/id_managedinstancerestorabledroppeddatabase.go index 13cf3f3c408..a485a28da49 100644 --- a/resource-manager/sql/2021-11-01/managedrestorabledroppeddatabasebackupshorttermretentionpolicies/id_managedinstancerestorabledroppeddatabase.go +++ b/resource-manager/sql/2021-11-01/managedrestorabledroppeddatabasebackupshorttermretentionpolicies/id_managedinstancerestorabledroppeddatabase.go @@ -38,23 +38,9 @@ func ParseManagedInstanceRestorableDroppedDatabaseID(input string) (*ManagedInst return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedInstanceRestorableDroppedDatabaseId{} - - 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.RestorableDroppedDatabaseId, ok = parsed.Parsed["restorableDroppedDatabaseId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorableDroppedDatabaseId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseManagedInstanceRestorableDroppedDatabaseIDInsensitively(input string) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedInstanceRestorableDroppedDatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ManagedInstanceRestorableDroppedDatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedInstanceName, ok = parsed.Parsed["managedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", *parsed) + if id.ManagedInstanceName, ok = input.Parsed["managedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", input) } - if id.RestorableDroppedDatabaseId, ok = parsed.Parsed["restorableDroppedDatabaseId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorableDroppedDatabaseId", *parsed) + if id.RestorableDroppedDatabaseId, ok = input.Parsed["restorableDroppedDatabaseId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "restorableDroppedDatabaseId", input) } - return &id, nil + return nil } // ValidateManagedInstanceRestorableDroppedDatabaseID checks that 'input' can be parsed as a Managed Instance Restorable Dropped Database ID diff --git a/resource-manager/sql/2021-11-01/managedserverdnsaliases/id_managedinstancednsalias.go b/resource-manager/sql/2021-11-01/managedserverdnsaliases/id_managedinstancednsalias.go index d65ecaf8868..93e6bd9546f 100644 --- a/resource-manager/sql/2021-11-01/managedserverdnsaliases/id_managedinstancednsalias.go +++ b/resource-manager/sql/2021-11-01/managedserverdnsaliases/id_managedinstancednsalias.go @@ -38,23 +38,9 @@ func ParseManagedInstanceDnsAliasID(input string) (*ManagedInstanceDnsAliasId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedInstanceDnsAliasId{} - - 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.DnsAliasName, ok = parsed.Parsed["dnsAliasName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dnsAliasName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseManagedInstanceDnsAliasIDInsensitively(input string) (*ManagedInstance return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedInstanceDnsAliasId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ManagedInstanceDnsAliasId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedInstanceName, ok = parsed.Parsed["managedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", *parsed) + if id.ManagedInstanceName, ok = input.Parsed["managedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", input) } - if id.DnsAliasName, ok = parsed.Parsed["dnsAliasName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dnsAliasName", *parsed) + if id.DnsAliasName, ok = input.Parsed["dnsAliasName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dnsAliasName", input) } - return &id, nil + return nil } // ValidateManagedInstanceDnsAliasID checks that 'input' can be parsed as a Managed Instance Dns Alias ID diff --git a/resource-manager/sql/2021-11-01/outboundfirewallrules/id_outboundfirewallrule.go b/resource-manager/sql/2021-11-01/outboundfirewallrules/id_outboundfirewallrule.go index 7a99e8f4b30..5f0d7c0a0a7 100644 --- a/resource-manager/sql/2021-11-01/outboundfirewallrules/id_outboundfirewallrule.go +++ b/resource-manager/sql/2021-11-01/outboundfirewallrules/id_outboundfirewallrule.go @@ -38,23 +38,9 @@ func ParseOutboundFirewallRuleID(input string) (*OutboundFirewallRuleId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OutboundFirewallRuleId{} - - 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.OutboundFirewallRuleName, ok = parsed.Parsed["outboundFirewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "outboundFirewallRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseOutboundFirewallRuleIDInsensitively(input string) (*OutboundFirewallRu return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OutboundFirewallRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OutboundFirewallRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.OutboundFirewallRuleName, ok = parsed.Parsed["outboundFirewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "outboundFirewallRuleName", *parsed) + if id.OutboundFirewallRuleName, ok = input.Parsed["outboundFirewallRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "outboundFirewallRuleName", input) } - return &id, nil + return nil } // ValidateOutboundFirewallRuleID checks that 'input' can be parsed as a Outbound Firewall Rule ID diff --git a/resource-manager/sql/2021-11-01/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/sql/2021-11-01/privateendpointconnections/id_privateendpointconnection.go index c999025c9bd..6dd2c18860a 100644 --- a/resource-manager/sql/2021-11-01/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/sql/2021-11-01/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/sql/2021-11-01/privatelinkresources/id_privatelinkresource.go b/resource-manager/sql/2021-11-01/privatelinkresources/id_privatelinkresource.go index 321724cd4a5..0480d25b0b9 100644 --- a/resource-manager/sql/2021-11-01/privatelinkresources/id_privatelinkresource.go +++ b/resource-manager/sql/2021-11-01/privatelinkresources/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/sql/2021-11-01/recoverabledatabases/id_recoverabledatabase.go b/resource-manager/sql/2021-11-01/recoverabledatabases/id_recoverabledatabase.go index 33e5ab1a439..c18ba97a78f 100644 --- a/resource-manager/sql/2021-11-01/recoverabledatabases/id_recoverabledatabase.go +++ b/resource-manager/sql/2021-11-01/recoverabledatabases/id_recoverabledatabase.go @@ -38,23 +38,9 @@ func ParseRecoverableDatabaseID(input string) (*RecoverableDatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecoverableDatabaseId{} - - 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.RecoverableDatabaseName, ok = parsed.Parsed["recoverableDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoverableDatabaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRecoverableDatabaseIDInsensitively(input string) (*RecoverableDatabase return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecoverableDatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RecoverableDatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.RecoverableDatabaseName, ok = parsed.Parsed["recoverableDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoverableDatabaseName", *parsed) + if id.RecoverableDatabaseName, ok = input.Parsed["recoverableDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "recoverableDatabaseName", input) } - return &id, nil + return nil } // ValidateRecoverableDatabaseID checks that 'input' can be parsed as a Recoverable Database ID diff --git a/resource-manager/sql/2021-11-01/recoverablemanageddatabases/id_managedinstancerecoverabledatabase.go b/resource-manager/sql/2021-11-01/recoverablemanageddatabases/id_managedinstancerecoverabledatabase.go index 5234802e686..bd315387c0e 100644 --- a/resource-manager/sql/2021-11-01/recoverablemanageddatabases/id_managedinstancerecoverabledatabase.go +++ b/resource-manager/sql/2021-11-01/recoverablemanageddatabases/id_managedinstancerecoverabledatabase.go @@ -38,23 +38,9 @@ func ParseManagedInstanceRecoverableDatabaseID(input string) (*ManagedInstanceRe return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedInstanceRecoverableDatabaseId{} - - 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.RecoverableDatabaseName, ok = parsed.Parsed["recoverableDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoverableDatabaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseManagedInstanceRecoverableDatabaseIDInsensitively(input string) (*Mana return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedInstanceRecoverableDatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ManagedInstanceRecoverableDatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedInstanceName, ok = parsed.Parsed["managedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", *parsed) + if id.ManagedInstanceName, ok = input.Parsed["managedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", input) } - if id.RecoverableDatabaseName, ok = parsed.Parsed["recoverableDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoverableDatabaseName", *parsed) + if id.RecoverableDatabaseName, ok = input.Parsed["recoverableDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "recoverableDatabaseName", input) } - return &id, nil + return nil } // ValidateManagedInstanceRecoverableDatabaseID checks that 'input' can be parsed as a Managed Instance Recoverable Database ID diff --git a/resource-manager/sql/2021-11-01/replicationlinks/id_replicationlink.go b/resource-manager/sql/2021-11-01/replicationlinks/id_replicationlink.go index b52b0a8cdde..53030897c0c 100644 --- a/resource-manager/sql/2021-11-01/replicationlinks/id_replicationlink.go +++ b/resource-manager/sql/2021-11-01/replicationlinks/id_replicationlink.go @@ -40,27 +40,9 @@ func ParseReplicationLinkID(input string) (*ReplicationLinkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationLinkId{} - - 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) - } - - if id.LinkId, ok = parsed.Parsed["linkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "linkId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationLinkIDInsensitively(input string) (*ReplicationLinkId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationLinkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationLinkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.LinkId, ok = parsed.Parsed["linkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "linkId", *parsed) + if id.LinkId, ok = input.Parsed["linkId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "linkId", input) } - return &id, nil + return nil } // ValidateReplicationLinkID checks that 'input' can be parsed as a Replication Link ID diff --git a/resource-manager/sql/2021-11-01/restorabledroppeddatabases/id_restorabledroppeddatabase.go b/resource-manager/sql/2021-11-01/restorabledroppeddatabases/id_restorabledroppeddatabase.go index e74c7485a1a..24938893ff8 100644 --- a/resource-manager/sql/2021-11-01/restorabledroppeddatabases/id_restorabledroppeddatabase.go +++ b/resource-manager/sql/2021-11-01/restorabledroppeddatabases/id_restorabledroppeddatabase.go @@ -38,23 +38,9 @@ func ParseRestorableDroppedDatabaseID(input string) (*RestorableDroppedDatabaseI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RestorableDroppedDatabaseId{} - - 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.RestorableDroppedDatabaseId, ok = parsed.Parsed["restorableDroppedDatabaseId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorableDroppedDatabaseId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRestorableDroppedDatabaseIDInsensitively(input string) (*RestorableDro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RestorableDroppedDatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RestorableDroppedDatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.RestorableDroppedDatabaseId, ok = parsed.Parsed["restorableDroppedDatabaseId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorableDroppedDatabaseId", *parsed) + if id.RestorableDroppedDatabaseId, ok = input.Parsed["restorableDroppedDatabaseId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "restorableDroppedDatabaseId", input) } - return &id, nil + return nil } // ValidateRestorableDroppedDatabaseID checks that 'input' can be parsed as a Restorable Dropped Database ID diff --git a/resource-manager/sql/2021-11-01/restorabledroppedmanageddatabases/id_managedinstancerestorabledroppeddatabase.go b/resource-manager/sql/2021-11-01/restorabledroppedmanageddatabases/id_managedinstancerestorabledroppeddatabase.go index d1d18d16cdf..0183af9c3f2 100644 --- a/resource-manager/sql/2021-11-01/restorabledroppedmanageddatabases/id_managedinstancerestorabledroppeddatabase.go +++ b/resource-manager/sql/2021-11-01/restorabledroppedmanageddatabases/id_managedinstancerestorabledroppeddatabase.go @@ -38,23 +38,9 @@ func ParseManagedInstanceRestorableDroppedDatabaseID(input string) (*ManagedInst return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedInstanceRestorableDroppedDatabaseId{} - - 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.RestorableDroppedDatabaseId, ok = parsed.Parsed["restorableDroppedDatabaseId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorableDroppedDatabaseId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseManagedInstanceRestorableDroppedDatabaseIDInsensitively(input string) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedInstanceRestorableDroppedDatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ManagedInstanceRestorableDroppedDatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedInstanceName, ok = parsed.Parsed["managedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", *parsed) + if id.ManagedInstanceName, ok = input.Parsed["managedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", input) } - if id.RestorableDroppedDatabaseId, ok = parsed.Parsed["restorableDroppedDatabaseId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorableDroppedDatabaseId", *parsed) + if id.RestorableDroppedDatabaseId, ok = input.Parsed["restorableDroppedDatabaseId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "restorableDroppedDatabaseId", input) } - return &id, nil + return nil } // ValidateManagedInstanceRestorableDroppedDatabaseID checks that 'input' can be parsed as a Managed Instance Restorable Dropped Database ID diff --git a/resource-manager/sql/2021-11-01/restorepoints/id_restorepoint.go b/resource-manager/sql/2021-11-01/restorepoints/id_restorepoint.go index 39d6aad5f63..69c13f7e650 100644 --- a/resource-manager/sql/2021-11-01/restorepoints/id_restorepoint.go +++ b/resource-manager/sql/2021-11-01/restorepoints/id_restorepoint.go @@ -40,27 +40,9 @@ func ParseRestorePointID(input string) (*RestorePointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RestorePointId{} - - 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) - } - - if id.RestorePointName, ok = parsed.Parsed["restorePointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorePointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseRestorePointIDInsensitively(input string) (*RestorePointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RestorePointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RestorePointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.RestorePointName, ok = parsed.Parsed["restorePointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorePointName", *parsed) + if id.RestorePointName, ok = input.Parsed["restorePointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "restorePointName", input) } - return &id, nil + return nil } // ValidateRestorePointID checks that 'input' can be parsed as a Restore Point ID diff --git a/resource-manager/sql/2021-11-01/sensitivitylabels/id_column.go b/resource-manager/sql/2021-11-01/sensitivitylabels/id_column.go index fbc50969030..5c7a543cc0f 100644 --- a/resource-manager/sql/2021-11-01/sensitivitylabels/id_column.go +++ b/resource-manager/sql/2021-11-01/sensitivitylabels/id_column.go @@ -44,35 +44,9 @@ func ParseColumnID(input string) (*ColumnId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ColumnId{} - - 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) - } - - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) - } - - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) - } - - if id.ColumnName, ok = parsed.Parsed["columnName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "columnName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseColumnIDInsensitively(input string) (*ColumnId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ColumnId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ColumnId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) + if id.SchemaName, ok = input.Parsed["schemaName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "schemaName", input) } - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if id.TableName, ok = input.Parsed["tableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tableName", input) } - if id.ColumnName, ok = parsed.Parsed["columnName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "columnName", *parsed) + if id.ColumnName, ok = input.Parsed["columnName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "columnName", input) } - return &id, nil + return nil } // ValidateColumnID checks that 'input' can be parsed as a Column ID diff --git a/resource-manager/sql/2021-11-01/sensitivitylabels/id_sensitivitylabelsource.go b/resource-manager/sql/2021-11-01/sensitivitylabels/id_sensitivitylabelsource.go index 3bf8e29fd73..6f8c60339a5 100644 --- a/resource-manager/sql/2021-11-01/sensitivitylabels/id_sensitivitylabelsource.go +++ b/resource-manager/sql/2021-11-01/sensitivitylabels/id_sensitivitylabelsource.go @@ -46,47 +46,9 @@ func ParseSensitivityLabelSourceID(input string) (*SensitivityLabelSourceId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SensitivityLabelSourceId{} - - 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) - } - - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) - } - - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) - } - - if id.ColumnName, ok = parsed.Parsed["columnName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "columnName", *parsed) - } - - if v, ok := parsed.Parsed["sensitivityLabelSource"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sensitivityLabelSource", *parsed) - } - - sensitivityLabelSource, err := parseSensitivityLabelSource(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.SensitivityLabelSource = *sensitivityLabelSource + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -101,50 +63,58 @@ func ParseSensitivityLabelSourceIDInsensitively(input string) (*SensitivityLabel return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SensitivityLabelSourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SensitivityLabelSourceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) + if id.SchemaName, ok = input.Parsed["schemaName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "schemaName", input) } - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if id.TableName, ok = input.Parsed["tableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tableName", input) } - if id.ColumnName, ok = parsed.Parsed["columnName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "columnName", *parsed) + if id.ColumnName, ok = input.Parsed["columnName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "columnName", input) } - if v, ok := parsed.Parsed["sensitivityLabelSource"]; true { + if v, ok := input.Parsed["sensitivityLabelSource"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sensitivityLabelSource", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "sensitivityLabelSource", input) } sensitivityLabelSource, err := parseSensitivityLabelSource(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.SensitivityLabelSource = *sensitivityLabelSource } - return &id, nil + return nil } // ValidateSensitivityLabelSourceID checks that 'input' can be parsed as a Sensitivity Label Source ID diff --git a/resource-manager/sql/2021-11-01/serveradvisors/id_advisor.go b/resource-manager/sql/2021-11-01/serveradvisors/id_advisor.go index 9cd05831438..c5bde2e23d2 100644 --- a/resource-manager/sql/2021-11-01/serveradvisors/id_advisor.go +++ b/resource-manager/sql/2021-11-01/serveradvisors/id_advisor.go @@ -38,23 +38,9 @@ func ParseAdvisorID(input string) (*AdvisorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AdvisorId{} - - 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.AdvisorName, ok = parsed.Parsed["advisorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "advisorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAdvisorIDInsensitively(input string) (*AdvisorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AdvisorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AdvisorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.AdvisorName, ok = parsed.Parsed["advisorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "advisorName", *parsed) + if id.AdvisorName, ok = input.Parsed["advisorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "advisorName", input) } - return &id, nil + return nil } // ValidateAdvisorID checks that 'input' can be parsed as a Advisor ID diff --git a/resource-manager/sql/2021-11-01/serverdevopsaudit/id_devopsauditingsetting.go b/resource-manager/sql/2021-11-01/serverdevopsaudit/id_devopsauditingsetting.go index 1ef22a3b56d..e3187480549 100644 --- a/resource-manager/sql/2021-11-01/serverdevopsaudit/id_devopsauditingsetting.go +++ b/resource-manager/sql/2021-11-01/serverdevopsaudit/id_devopsauditingsetting.go @@ -38,23 +38,9 @@ func ParseDevOpsAuditingSettingID(input string) (*DevOpsAuditingSettingId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DevOpsAuditingSettingId{} - - 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.DevOpsAuditingSettingName, ok = parsed.Parsed["devOpsAuditingSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "devOpsAuditingSettingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDevOpsAuditingSettingIDInsensitively(input string) (*DevOpsAuditingSet return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DevOpsAuditingSettingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DevOpsAuditingSettingId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DevOpsAuditingSettingName, ok = parsed.Parsed["devOpsAuditingSettingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "devOpsAuditingSettingName", *parsed) + if id.DevOpsAuditingSettingName, ok = input.Parsed["devOpsAuditingSettingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "devOpsAuditingSettingName", input) } - return &id, nil + return nil } // ValidateDevOpsAuditingSettingID checks that 'input' can be parsed as a Dev Ops Auditing Setting ID diff --git a/resource-manager/sql/2021-11-01/serverdnsaliases/id_dnsalias.go b/resource-manager/sql/2021-11-01/serverdnsaliases/id_dnsalias.go index 889fd9aaa1c..3e81d19204f 100644 --- a/resource-manager/sql/2021-11-01/serverdnsaliases/id_dnsalias.go +++ b/resource-manager/sql/2021-11-01/serverdnsaliases/id_dnsalias.go @@ -38,23 +38,9 @@ func ParseDnsAliasID(input string) (*DnsAliasId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DnsAliasId{} - - 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.DnsAliasName, ok = parsed.Parsed["dnsAliasName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dnsAliasName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDnsAliasIDInsensitively(input string) (*DnsAliasId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DnsAliasId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DnsAliasId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DnsAliasName, ok = parsed.Parsed["dnsAliasName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dnsAliasName", *parsed) + if id.DnsAliasName, ok = input.Parsed["dnsAliasName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dnsAliasName", input) } - return &id, nil + return nil } // ValidateDnsAliasID checks that 'input' can be parsed as a Dns Alias ID diff --git a/resource-manager/sql/2021-11-01/serverkeys/id_key.go b/resource-manager/sql/2021-11-01/serverkeys/id_key.go index e354e8fdcf4..8dbe212e996 100644 --- a/resource-manager/sql/2021-11-01/serverkeys/id_key.go +++ b/resource-manager/sql/2021-11-01/serverkeys/id_key.go @@ -38,23 +38,9 @@ func ParseKeyID(input string) (*KeyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := KeyId{} - - 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.KeyName, ok = parsed.Parsed["keyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseKeyIDInsensitively(input string) (*KeyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := KeyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *KeyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.KeyName, ok = parsed.Parsed["keyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyName", *parsed) + if id.KeyName, ok = input.Parsed["keyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "keyName", input) } - return &id, nil + return nil } // ValidateKeyID checks that 'input' can be parsed as a Key ID diff --git a/resource-manager/sql/2021-11-01/servertrustcertificates/id_servertrustcertificate.go b/resource-manager/sql/2021-11-01/servertrustcertificates/id_servertrustcertificate.go index cd245ff1bc6..d79dc7ca621 100644 --- a/resource-manager/sql/2021-11-01/servertrustcertificates/id_servertrustcertificate.go +++ b/resource-manager/sql/2021-11-01/servertrustcertificates/id_servertrustcertificate.go @@ -38,23 +38,9 @@ func ParseServerTrustCertificateID(input string) (*ServerTrustCertificateId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerTrustCertificateId{} - - 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.ServerTrustCertificateName, ok = parsed.Parsed["serverTrustCertificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverTrustCertificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseServerTrustCertificateIDInsensitively(input string) (*ServerTrustCerti return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerTrustCertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ServerTrustCertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedInstanceName, ok = parsed.Parsed["managedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", *parsed) + if id.ManagedInstanceName, ok = input.Parsed["managedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", input) } - if id.ServerTrustCertificateName, ok = parsed.Parsed["serverTrustCertificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverTrustCertificateName", *parsed) + if id.ServerTrustCertificateName, ok = input.Parsed["serverTrustCertificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverTrustCertificateName", input) } - return &id, nil + return nil } // ValidateServerTrustCertificateID checks that 'input' can be parsed as a Server Trust Certificate ID diff --git a/resource-manager/sql/2021-11-01/servertrustgroups/id_providerlocation.go b/resource-manager/sql/2021-11-01/servertrustgroups/id_providerlocation.go index d0b84fe7264..8708637d822 100644 --- a/resource-manager/sql/2021-11-01/servertrustgroups/id_providerlocation.go +++ b/resource-manager/sql/2021-11-01/servertrustgroups/id_providerlocation.go @@ -36,19 +36,9 @@ func ParseProviderLocationID(input string) (*ProviderLocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderLocationIDInsensitively(input string) (*ProviderLocationId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderLocationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateProviderLocationID checks that 'input' can be parsed as a Provider Location ID diff --git a/resource-manager/sql/2021-11-01/servertrustgroups/id_servertrustgroup.go b/resource-manager/sql/2021-11-01/servertrustgroups/id_servertrustgroup.go index f223ee13fbb..30ef83c526b 100644 --- a/resource-manager/sql/2021-11-01/servertrustgroups/id_servertrustgroup.go +++ b/resource-manager/sql/2021-11-01/servertrustgroups/id_servertrustgroup.go @@ -38,23 +38,9 @@ func ParseServerTrustGroupID(input string) (*ServerTrustGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerTrustGroupId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.ServerTrustGroupName, ok = parsed.Parsed["serverTrustGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverTrustGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseServerTrustGroupIDInsensitively(input string) (*ServerTrustGroupId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerTrustGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ServerTrustGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.ServerTrustGroupName, ok = parsed.Parsed["serverTrustGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverTrustGroupName", *parsed) + if id.ServerTrustGroupName, ok = input.Parsed["serverTrustGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverTrustGroupName", input) } - return &id, nil + return nil } // ValidateServerTrustGroupID checks that 'input' can be parsed as a Server Trust Group ID diff --git a/resource-manager/sql/2021-11-01/subscriptionusages/id_location.go b/resource-manager/sql/2021-11-01/subscriptionusages/id_location.go index c365f439611..9c89f1c7c1f 100644 --- a/resource-manager/sql/2021-11-01/subscriptionusages/id_location.go +++ b/resource-manager/sql/2021-11-01/subscriptionusages/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/sql/2021-11-01/subscriptionusages/id_usage.go b/resource-manager/sql/2021-11-01/subscriptionusages/id_usage.go index 3a594d6884a..8ae1ff46fba 100644 --- a/resource-manager/sql/2021-11-01/subscriptionusages/id_usage.go +++ b/resource-manager/sql/2021-11-01/subscriptionusages/id_usage.go @@ -36,19 +36,9 @@ func ParseUsageID(input string) (*UsageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UsageId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.UsageName, ok = parsed.Parsed["usageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "usageName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseUsageIDInsensitively(input string) (*UsageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UsageId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *UsageId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.UsageName, ok = parsed.Parsed["usageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "usageName", *parsed) + if id.UsageName, ok = input.Parsed["usageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "usageName", input) } - return &id, nil + return nil } // ValidateUsageID checks that 'input' can be parsed as a Usage ID diff --git a/resource-manager/sql/2021-11-01/syncagents/id_syncagent.go b/resource-manager/sql/2021-11-01/syncagents/id_syncagent.go index 309a3696373..579f4fa1953 100644 --- a/resource-manager/sql/2021-11-01/syncagents/id_syncagent.go +++ b/resource-manager/sql/2021-11-01/syncagents/id_syncagent.go @@ -38,23 +38,9 @@ func ParseSyncAgentID(input string) (*SyncAgentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SyncAgentId{} - - 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.SyncAgentName, ok = parsed.Parsed["syncAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncAgentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSyncAgentIDInsensitively(input string) (*SyncAgentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SyncAgentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SyncAgentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.SyncAgentName, ok = parsed.Parsed["syncAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncAgentName", *parsed) + if id.SyncAgentName, ok = input.Parsed["syncAgentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "syncAgentName", input) } - return &id, nil + return nil } // ValidateSyncAgentID checks that 'input' can be parsed as a Sync Agent ID diff --git a/resource-manager/sql/2021-11-01/syncgroups/id_location.go b/resource-manager/sql/2021-11-01/syncgroups/id_location.go index 99320a4b748..8d6855fb698 100644 --- a/resource-manager/sql/2021-11-01/syncgroups/id_location.go +++ b/resource-manager/sql/2021-11-01/syncgroups/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/sql/2021-11-01/syncgroups/id_syncgroup.go b/resource-manager/sql/2021-11-01/syncgroups/id_syncgroup.go index 99a5ea85741..eb28cbfc930 100644 --- a/resource-manager/sql/2021-11-01/syncgroups/id_syncgroup.go +++ b/resource-manager/sql/2021-11-01/syncgroups/id_syncgroup.go @@ -40,27 +40,9 @@ func ParseSyncGroupID(input string) (*SyncGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SyncGroupId{} - - 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) - } - - if id.SyncGroupName, ok = parsed.Parsed["syncGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSyncGroupIDInsensitively(input string) (*SyncGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SyncGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SyncGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.SyncGroupName, ok = parsed.Parsed["syncGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", *parsed) + if id.SyncGroupName, ok = input.Parsed["syncGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", input) } - return &id, nil + return nil } // ValidateSyncGroupID checks that 'input' can be parsed as a Sync Group ID diff --git a/resource-manager/sql/2021-11-01/syncmembers/id_syncgroup.go b/resource-manager/sql/2021-11-01/syncmembers/id_syncgroup.go index 5e3a4d1c4b3..a1ec68a6155 100644 --- a/resource-manager/sql/2021-11-01/syncmembers/id_syncgroup.go +++ b/resource-manager/sql/2021-11-01/syncmembers/id_syncgroup.go @@ -40,27 +40,9 @@ func ParseSyncGroupID(input string) (*SyncGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SyncGroupId{} - - 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) - } - - if id.SyncGroupName, ok = parsed.Parsed["syncGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSyncGroupIDInsensitively(input string) (*SyncGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SyncGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SyncGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.SyncGroupName, ok = parsed.Parsed["syncGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", *parsed) + if id.SyncGroupName, ok = input.Parsed["syncGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", input) } - return &id, nil + return nil } // ValidateSyncGroupID checks that 'input' can be parsed as a Sync Group ID diff --git a/resource-manager/sql/2021-11-01/syncmembers/id_syncmember.go b/resource-manager/sql/2021-11-01/syncmembers/id_syncmember.go index 3f142cff96e..30f1146ce1c 100644 --- a/resource-manager/sql/2021-11-01/syncmembers/id_syncmember.go +++ b/resource-manager/sql/2021-11-01/syncmembers/id_syncmember.go @@ -42,31 +42,9 @@ func ParseSyncMemberID(input string) (*SyncMemberId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SyncMemberId{} - - 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) - } - - if id.SyncGroupName, ok = parsed.Parsed["syncGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", *parsed) - } - - if id.SyncMemberName, ok = parsed.Parsed["syncMemberName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncMemberName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseSyncMemberIDInsensitively(input string) (*SyncMemberId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SyncMemberId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SyncMemberId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.SyncGroupName, ok = parsed.Parsed["syncGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", *parsed) + if id.SyncGroupName, ok = input.Parsed["syncGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", input) } - if id.SyncMemberName, ok = parsed.Parsed["syncMemberName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncMemberName", *parsed) + if id.SyncMemberName, ok = input.Parsed["syncMemberName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "syncMemberName", input) } - return &id, nil + return nil } // ValidateSyncMemberID checks that 'input' can be parsed as a Sync Member ID diff --git a/resource-manager/sql/2021-11-01/timezones/id_location.go b/resource-manager/sql/2021-11-01/timezones/id_location.go index c458979247c..45d7ef239e0 100644 --- a/resource-manager/sql/2021-11-01/timezones/id_location.go +++ b/resource-manager/sql/2021-11-01/timezones/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/sql/2021-11-01/timezones/id_timezone.go b/resource-manager/sql/2021-11-01/timezones/id_timezone.go index 28d86caf162..14701f9c549 100644 --- a/resource-manager/sql/2021-11-01/timezones/id_timezone.go +++ b/resource-manager/sql/2021-11-01/timezones/id_timezone.go @@ -36,19 +36,9 @@ func ParseTimeZoneID(input string) (*TimeZoneId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TimeZoneId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.TimeZoneId, ok = parsed.Parsed["timeZoneId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "timeZoneId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseTimeZoneIDInsensitively(input string) (*TimeZoneId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TimeZoneId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *TimeZoneId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.TimeZoneId, ok = parsed.Parsed["timeZoneId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "timeZoneId", *parsed) + if id.TimeZoneId, ok = input.Parsed["timeZoneId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "timeZoneId", input) } - return &id, nil + return nil } // ValidateTimeZoneID checks that 'input' can be parsed as a Time Zone ID diff --git a/resource-manager/sql/2021-11-01/usages/id_instancepool.go b/resource-manager/sql/2021-11-01/usages/id_instancepool.go index 37c7c0cff4b..ce455dfd17e 100644 --- a/resource-manager/sql/2021-11-01/usages/id_instancepool.go +++ b/resource-manager/sql/2021-11-01/usages/id_instancepool.go @@ -36,19 +36,9 @@ func ParseInstancePoolID(input string) (*InstancePoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InstancePoolId{} - - 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.InstancePoolName, ok = parsed.Parsed["instancePoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instancePoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseInstancePoolIDInsensitively(input string) (*InstancePoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InstancePoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *InstancePoolId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.InstancePoolName, ok = parsed.Parsed["instancePoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instancePoolName", *parsed) + if id.InstancePoolName, ok = input.Parsed["instancePoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instancePoolName", input) } - return &id, nil + return nil } // ValidateInstancePoolID checks that 'input' can be parsed as a Instance Pool ID diff --git a/resource-manager/sql/2021-11-01/virtualclusters/id_virtualcluster.go b/resource-manager/sql/2021-11-01/virtualclusters/id_virtualcluster.go index 301fa5cb8d0..9e8d9d4ae69 100644 --- a/resource-manager/sql/2021-11-01/virtualclusters/id_virtualcluster.go +++ b/resource-manager/sql/2021-11-01/virtualclusters/id_virtualcluster.go @@ -36,19 +36,9 @@ func ParseVirtualClusterID(input string) (*VirtualClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualClusterId{} - - 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.VirtualClusterName, ok = parsed.Parsed["virtualClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualClusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualClusterIDInsensitively(input string) (*VirtualClusterId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualClusterName, ok = parsed.Parsed["virtualClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualClusterName", *parsed) + if id.VirtualClusterName, ok = input.Parsed["virtualClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualClusterName", input) } - return &id, nil + return nil } // ValidateVirtualClusterID checks that 'input' can be parsed as a Virtual Cluster ID diff --git a/resource-manager/sql/2021-11-01/virtualnetworkrules/id_virtualnetworkrule.go b/resource-manager/sql/2021-11-01/virtualnetworkrules/id_virtualnetworkrule.go index 56119519199..5f887f1eef5 100644 --- a/resource-manager/sql/2021-11-01/virtualnetworkrules/id_virtualnetworkrule.go +++ b/resource-manager/sql/2021-11-01/virtualnetworkrules/id_virtualnetworkrule.go @@ -38,23 +38,9 @@ func ParseVirtualNetworkRuleID(input string) (*VirtualNetworkRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkRuleId{} - - 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.VirtualNetworkRuleName, ok = parsed.Parsed["virtualNetworkRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualNetworkRuleIDInsensitively(input string) (*VirtualNetworkRuleId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualNetworkRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.VirtualNetworkRuleName, ok = parsed.Parsed["virtualNetworkRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkRuleName", *parsed) + if id.VirtualNetworkRuleName, ok = input.Parsed["virtualNetworkRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkRuleName", input) } - return &id, nil + return nil } // ValidateVirtualNetworkRuleID checks that 'input' can be parsed as a Virtual Network Rule ID diff --git a/resource-manager/sql/2021-11-01/workloadclassifiers/id_workloadclassifier.go b/resource-manager/sql/2021-11-01/workloadclassifiers/id_workloadclassifier.go index 1587ca03498..679145863c5 100644 --- a/resource-manager/sql/2021-11-01/workloadclassifiers/id_workloadclassifier.go +++ b/resource-manager/sql/2021-11-01/workloadclassifiers/id_workloadclassifier.go @@ -42,31 +42,9 @@ func ParseWorkloadClassifierID(input string) (*WorkloadClassifierId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkloadClassifierId{} - - 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) - } - - if id.WorkloadGroupName, ok = parsed.Parsed["workloadGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workloadGroupName", *parsed) - } - - if id.WorkloadClassifierName, ok = parsed.Parsed["workloadClassifierName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workloadClassifierName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseWorkloadClassifierIDInsensitively(input string) (*WorkloadClassifierId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkloadClassifierId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkloadClassifierId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.WorkloadGroupName, ok = parsed.Parsed["workloadGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workloadGroupName", *parsed) + if id.WorkloadGroupName, ok = input.Parsed["workloadGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workloadGroupName", input) } - if id.WorkloadClassifierName, ok = parsed.Parsed["workloadClassifierName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workloadClassifierName", *parsed) + if id.WorkloadClassifierName, ok = input.Parsed["workloadClassifierName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workloadClassifierName", input) } - return &id, nil + return nil } // ValidateWorkloadClassifierID checks that 'input' can be parsed as a Workload Classifier ID diff --git a/resource-manager/sql/2021-11-01/workloadclassifiers/id_workloadgroup.go b/resource-manager/sql/2021-11-01/workloadclassifiers/id_workloadgroup.go index 14006637775..3069a043cce 100644 --- a/resource-manager/sql/2021-11-01/workloadclassifiers/id_workloadgroup.go +++ b/resource-manager/sql/2021-11-01/workloadclassifiers/id_workloadgroup.go @@ -40,27 +40,9 @@ func ParseWorkloadGroupID(input string) (*WorkloadGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkloadGroupId{} - - 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) - } - - if id.WorkloadGroupName, ok = parsed.Parsed["workloadGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workloadGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseWorkloadGroupIDInsensitively(input string) (*WorkloadGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkloadGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *WorkloadGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.WorkloadGroupName, ok = parsed.Parsed["workloadGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workloadGroupName", *parsed) + if id.WorkloadGroupName, ok = input.Parsed["workloadGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workloadGroupName", input) } - return &id, nil + return nil } // ValidateWorkloadGroupID checks that 'input' can be parsed as a Workload Group ID diff --git a/resource-manager/sql/2021-11-01/workloadgroups/id_workloadgroup.go b/resource-manager/sql/2021-11-01/workloadgroups/id_workloadgroup.go index 2cf47c08df6..007ed3921aa 100644 --- a/resource-manager/sql/2021-11-01/workloadgroups/id_workloadgroup.go +++ b/resource-manager/sql/2021-11-01/workloadgroups/id_workloadgroup.go @@ -40,27 +40,9 @@ func ParseWorkloadGroupID(input string) (*WorkloadGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkloadGroupId{} - - 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) - } - - if id.WorkloadGroupName, ok = parsed.Parsed["workloadGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workloadGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseWorkloadGroupIDInsensitively(input string) (*WorkloadGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkloadGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *WorkloadGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.WorkloadGroupName, ok = parsed.Parsed["workloadGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workloadGroupName", *parsed) + if id.WorkloadGroupName, ok = input.Parsed["workloadGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workloadGroupName", input) } - return &id, nil + return nil } // ValidateWorkloadGroupID checks that 'input' can be parsed as a Workload Group ID diff --git a/resource-manager/sql/2023-02-01-preview/databaseadvisors/id_databaseadvisor.go b/resource-manager/sql/2023-02-01-preview/databaseadvisors/id_databaseadvisor.go index 7bbad5a0869..95915da7095 100644 --- a/resource-manager/sql/2023-02-01-preview/databaseadvisors/id_databaseadvisor.go +++ b/resource-manager/sql/2023-02-01-preview/databaseadvisors/id_databaseadvisor.go @@ -40,27 +40,9 @@ func ParseDatabaseAdvisorID(input string) (*DatabaseAdvisorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAdvisorId{} - - 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) - } - - if id.AdvisorName, ok = parsed.Parsed["advisorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "advisorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseDatabaseAdvisorIDInsensitively(input string) (*DatabaseAdvisorId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAdvisorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DatabaseAdvisorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.AdvisorName, ok = parsed.Parsed["advisorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "advisorName", *parsed) + if id.AdvisorName, ok = input.Parsed["advisorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "advisorName", input) } - return &id, nil + return nil } // ValidateDatabaseAdvisorID checks that 'input' can be parsed as a Database Advisor ID diff --git a/resource-manager/sql/2023-02-01-preview/databasecolumns/id_column.go b/resource-manager/sql/2023-02-01-preview/databasecolumns/id_column.go index 6aab1c96373..0841a75866e 100644 --- a/resource-manager/sql/2023-02-01-preview/databasecolumns/id_column.go +++ b/resource-manager/sql/2023-02-01-preview/databasecolumns/id_column.go @@ -44,35 +44,9 @@ func ParseColumnID(input string) (*ColumnId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ColumnId{} - - 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) - } - - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) - } - - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) - } - - if id.ColumnName, ok = parsed.Parsed["columnName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "columnName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseColumnIDInsensitively(input string) (*ColumnId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ColumnId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ColumnId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) + if id.SchemaName, ok = input.Parsed["schemaName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "schemaName", input) } - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if id.TableName, ok = input.Parsed["tableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tableName", input) } - if id.ColumnName, ok = parsed.Parsed["columnName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "columnName", *parsed) + if id.ColumnName, ok = input.Parsed["columnName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "columnName", input) } - return &id, nil + return nil } // ValidateColumnID checks that 'input' can be parsed as a Column ID diff --git a/resource-manager/sql/2023-02-01-preview/databasecolumns/id_table.go b/resource-manager/sql/2023-02-01-preview/databasecolumns/id_table.go index a1bff6ab2dd..b1026f98b99 100644 --- a/resource-manager/sql/2023-02-01-preview/databasecolumns/id_table.go +++ b/resource-manager/sql/2023-02-01-preview/databasecolumns/id_table.go @@ -42,31 +42,9 @@ func ParseTableID(input string) (*TableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TableId{} - - 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) - } - - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) - } - - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseTableIDInsensitively(input string) (*TableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *TableId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) + if id.SchemaName, ok = input.Parsed["schemaName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "schemaName", input) } - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if id.TableName, ok = input.Parsed["tableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tableName", input) } - return &id, nil + return nil } // ValidateTableID checks that 'input' can be parsed as a Table ID diff --git a/resource-manager/sql/2023-02-01-preview/databaseextensions/id_extension.go b/resource-manager/sql/2023-02-01-preview/databaseextensions/id_extension.go index 3c4d31a5a55..f7f5c9a3ad5 100644 --- a/resource-manager/sql/2023-02-01-preview/databaseextensions/id_extension.go +++ b/resource-manager/sql/2023-02-01-preview/databaseextensions/id_extension.go @@ -40,27 +40,9 @@ func ParseExtensionID(input string) (*ExtensionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExtensionId{} - - 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) - } - - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseExtensionIDInsensitively(input string) (*ExtensionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExtensionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ExtensionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.ExtensionName, ok = parsed.Parsed["extensionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "extensionName", *parsed) + if id.ExtensionName, ok = input.Parsed["extensionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "extensionName", input) } - return &id, nil + return nil } // ValidateExtensionID checks that 'input' can be parsed as a Extension ID diff --git a/resource-manager/sql/2023-02-01-preview/databaserecommendedactions/id_databaseadvisor.go b/resource-manager/sql/2023-02-01-preview/databaserecommendedactions/id_databaseadvisor.go index cb647628efd..c74c1d97348 100644 --- a/resource-manager/sql/2023-02-01-preview/databaserecommendedactions/id_databaseadvisor.go +++ b/resource-manager/sql/2023-02-01-preview/databaserecommendedactions/id_databaseadvisor.go @@ -40,27 +40,9 @@ func ParseDatabaseAdvisorID(input string) (*DatabaseAdvisorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAdvisorId{} - - 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) - } - - if id.AdvisorName, ok = parsed.Parsed["advisorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "advisorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseDatabaseAdvisorIDInsensitively(input string) (*DatabaseAdvisorId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseAdvisorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DatabaseAdvisorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.AdvisorName, ok = parsed.Parsed["advisorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "advisorName", *parsed) + if id.AdvisorName, ok = input.Parsed["advisorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "advisorName", input) } - return &id, nil + return nil } // ValidateDatabaseAdvisorID checks that 'input' can be parsed as a Database Advisor ID diff --git a/resource-manager/sql/2023-02-01-preview/databaserecommendedactions/id_recommendedaction.go b/resource-manager/sql/2023-02-01-preview/databaserecommendedactions/id_recommendedaction.go index f025c3d3e6c..6ff68601de6 100644 --- a/resource-manager/sql/2023-02-01-preview/databaserecommendedactions/id_recommendedaction.go +++ b/resource-manager/sql/2023-02-01-preview/databaserecommendedactions/id_recommendedaction.go @@ -42,31 +42,9 @@ func ParseRecommendedActionID(input string) (*RecommendedActionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecommendedActionId{} - - 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) - } - - if id.AdvisorName, ok = parsed.Parsed["advisorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "advisorName", *parsed) - } - - if id.RecommendedActionName, ok = parsed.Parsed["recommendedActionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recommendedActionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseRecommendedActionIDInsensitively(input string) (*RecommendedActionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecommendedActionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *RecommendedActionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.AdvisorName, ok = parsed.Parsed["advisorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "advisorName", *parsed) + if id.AdvisorName, ok = input.Parsed["advisorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "advisorName", input) } - if id.RecommendedActionName, ok = parsed.Parsed["recommendedActionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recommendedActionName", *parsed) + if id.RecommendedActionName, ok = input.Parsed["recommendedActionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "recommendedActionName", input) } - return &id, nil + return nil } // ValidateRecommendedActionID checks that 'input' can be parsed as a Recommended Action ID diff --git a/resource-manager/sql/2023-02-01-preview/databaseschemas/id_schema.go b/resource-manager/sql/2023-02-01-preview/databaseschemas/id_schema.go index 0317ff6e2a6..da4ae40e2d2 100644 --- a/resource-manager/sql/2023-02-01-preview/databaseschemas/id_schema.go +++ b/resource-manager/sql/2023-02-01-preview/databaseschemas/id_schema.go @@ -40,27 +40,9 @@ func ParseSchemaID(input string) (*SchemaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SchemaId{} - - 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) - } - - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSchemaIDInsensitively(input string) (*SchemaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SchemaId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SchemaId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) + if id.SchemaName, ok = input.Parsed["schemaName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "schemaName", input) } - return &id, nil + return nil } // ValidateSchemaID checks that 'input' can be parsed as a Schema ID diff --git a/resource-manager/sql/2023-02-01-preview/databasesqlvulnerabilityassessmentrulebaselines/id_baselinerule.go b/resource-manager/sql/2023-02-01-preview/databasesqlvulnerabilityassessmentrulebaselines/id_baselinerule.go index a62f328c94a..083cf583dbf 100644 --- a/resource-manager/sql/2023-02-01-preview/databasesqlvulnerabilityassessmentrulebaselines/id_baselinerule.go +++ b/resource-manager/sql/2023-02-01-preview/databasesqlvulnerabilityassessmentrulebaselines/id_baselinerule.go @@ -40,27 +40,9 @@ func ParseBaselineRuleID(input string) (*BaselineRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BaselineRuleId{} - - 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) - } - - if id.RuleId, ok = parsed.Parsed["ruleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseBaselineRuleIDInsensitively(input string) (*BaselineRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BaselineRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *BaselineRuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.RuleId, ok = parsed.Parsed["ruleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleId", *parsed) + if id.RuleId, ok = input.Parsed["ruleId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleId", input) } - return &id, nil + return nil } // ValidateBaselineRuleID checks that 'input' can be parsed as a Baseline Rule ID diff --git a/resource-manager/sql/2023-02-01-preview/databasesqlvulnerabilityassessmentscanresult/id_scanscanresult.go b/resource-manager/sql/2023-02-01-preview/databasesqlvulnerabilityassessmentscanresult/id_scanscanresult.go index 909d74d5b28..ffa891f5055 100644 --- a/resource-manager/sql/2023-02-01-preview/databasesqlvulnerabilityassessmentscanresult/id_scanscanresult.go +++ b/resource-manager/sql/2023-02-01-preview/databasesqlvulnerabilityassessmentscanresult/id_scanscanresult.go @@ -42,31 +42,9 @@ func ParseScanScanResultID(input string) (*ScanScanResultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScanScanResultId{} - - 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) - } - - if id.ScanId, ok = parsed.Parsed["scanId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scanId", *parsed) - } - - if id.ScanResultId, ok = parsed.Parsed["scanResultId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scanResultId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseScanScanResultIDInsensitively(input string) (*ScanScanResultId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScanScanResultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ScanScanResultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.ScanId, ok = parsed.Parsed["scanId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scanId", *parsed) + if id.ScanId, ok = input.Parsed["scanId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scanId", input) } - if id.ScanResultId, ok = parsed.Parsed["scanResultId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scanResultId", *parsed) + if id.ScanResultId, ok = input.Parsed["scanResultId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scanResultId", input) } - return &id, nil + return nil } // ValidateScanScanResultID checks that 'input' can be parsed as a Scan Scan Result ID diff --git a/resource-manager/sql/2023-02-01-preview/databasesqlvulnerabilityassessmentscanresult/id_sqlvulnerabilityassessmentvulnerabilityassessmentscan.go b/resource-manager/sql/2023-02-01-preview/databasesqlvulnerabilityassessmentscanresult/id_sqlvulnerabilityassessmentvulnerabilityassessmentscan.go index b49dd979964..00e1aa4ea32 100644 --- a/resource-manager/sql/2023-02-01-preview/databasesqlvulnerabilityassessmentscanresult/id_sqlvulnerabilityassessmentvulnerabilityassessmentscan.go +++ b/resource-manager/sql/2023-02-01-preview/databasesqlvulnerabilityassessmentscanresult/id_sqlvulnerabilityassessmentvulnerabilityassessmentscan.go @@ -40,27 +40,9 @@ func ParseSqlVulnerabilityAssessmentVulnerabilityAssessmentScanID(input string) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SqlVulnerabilityAssessmentVulnerabilityAssessmentScanId{} - - 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) - } - - if id.ScanId, ok = parsed.Parsed["scanId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scanId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSqlVulnerabilityAssessmentVulnerabilityAssessmentScanIDInsensitively(i return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SqlVulnerabilityAssessmentVulnerabilityAssessmentScanId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SqlVulnerabilityAssessmentVulnerabilityAssessmentScanId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.ScanId, ok = parsed.Parsed["scanId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scanId", *parsed) + if id.ScanId, ok = input.Parsed["scanId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scanId", input) } - return &id, nil + return nil } // ValidateSqlVulnerabilityAssessmentVulnerabilityAssessmentScanID checks that 'input' can be parsed as a Sql Vulnerability Assessment Vulnerability Assessment Scan ID diff --git a/resource-manager/sql/2023-02-01-preview/databasesqlvulnerabilityassessmentscans/id_sqlvulnerabilityassessmentvulnerabilityassessmentscan.go b/resource-manager/sql/2023-02-01-preview/databasesqlvulnerabilityassessmentscans/id_sqlvulnerabilityassessmentvulnerabilityassessmentscan.go index 13a024643ae..8bb889b6377 100644 --- a/resource-manager/sql/2023-02-01-preview/databasesqlvulnerabilityassessmentscans/id_sqlvulnerabilityassessmentvulnerabilityassessmentscan.go +++ b/resource-manager/sql/2023-02-01-preview/databasesqlvulnerabilityassessmentscans/id_sqlvulnerabilityassessmentvulnerabilityassessmentscan.go @@ -40,27 +40,9 @@ func ParseSqlVulnerabilityAssessmentVulnerabilityAssessmentScanID(input string) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SqlVulnerabilityAssessmentVulnerabilityAssessmentScanId{} - - 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) - } - - if id.ScanId, ok = parsed.Parsed["scanId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scanId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSqlVulnerabilityAssessmentVulnerabilityAssessmentScanIDInsensitively(i return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SqlVulnerabilityAssessmentVulnerabilityAssessmentScanId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SqlVulnerabilityAssessmentVulnerabilityAssessmentScanId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.ScanId, ok = parsed.Parsed["scanId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scanId", *parsed) + if id.ScanId, ok = input.Parsed["scanId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scanId", input) } - return &id, nil + return nil } // ValidateSqlVulnerabilityAssessmentVulnerabilityAssessmentScanID checks that 'input' can be parsed as a Sql Vulnerability Assessment Vulnerability Assessment Scan ID diff --git a/resource-manager/sql/2023-02-01-preview/databasetables/id_schema.go b/resource-manager/sql/2023-02-01-preview/databasetables/id_schema.go index bb7f80f2495..0a9c112885e 100644 --- a/resource-manager/sql/2023-02-01-preview/databasetables/id_schema.go +++ b/resource-manager/sql/2023-02-01-preview/databasetables/id_schema.go @@ -40,27 +40,9 @@ func ParseSchemaID(input string) (*SchemaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SchemaId{} - - 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) - } - - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSchemaIDInsensitively(input string) (*SchemaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SchemaId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SchemaId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) + if id.SchemaName, ok = input.Parsed["schemaName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "schemaName", input) } - return &id, nil + return nil } // ValidateSchemaID checks that 'input' can be parsed as a Schema ID diff --git a/resource-manager/sql/2023-02-01-preview/databasetables/id_table.go b/resource-manager/sql/2023-02-01-preview/databasetables/id_table.go index 5db1b4b5fe0..49f51937cf2 100644 --- a/resource-manager/sql/2023-02-01-preview/databasetables/id_table.go +++ b/resource-manager/sql/2023-02-01-preview/databasetables/id_table.go @@ -42,31 +42,9 @@ func ParseTableID(input string) (*TableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TableId{} - - 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) - } - - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) - } - - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseTableIDInsensitively(input string) (*TableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *TableId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) + if id.SchemaName, ok = input.Parsed["schemaName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "schemaName", input) } - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if id.TableName, ok = input.Parsed["tableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tableName", input) } - return &id, nil + return nil } // ValidateTableID checks that 'input' can be parsed as a Table ID diff --git a/resource-manager/sql/2023-02-01-preview/databasevulnerabilityassessmentrulebaselines/id_baseline.go b/resource-manager/sql/2023-02-01-preview/databasevulnerabilityassessmentrulebaselines/id_baseline.go index c706dc0c356..2355545f048 100644 --- a/resource-manager/sql/2023-02-01-preview/databasevulnerabilityassessmentrulebaselines/id_baseline.go +++ b/resource-manager/sql/2023-02-01-preview/databasevulnerabilityassessmentrulebaselines/id_baseline.go @@ -42,39 +42,9 @@ func ParseBaselineID(input string) (*BaselineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BaselineId{} - - 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) - } - - if id.RuleId, ok = parsed.Parsed["ruleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleId", *parsed) - } - - if v, ok := parsed.Parsed["baselineName"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "baselineName", *parsed) - } - - baselineName, err := parseVulnerabilityAssessmentPolicyBaselineName(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.BaselineName = *baselineName + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -89,42 +59,50 @@ func ParseBaselineIDInsensitively(input string) (*BaselineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BaselineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *BaselineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.RuleId, ok = parsed.Parsed["ruleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleId", *parsed) + if id.RuleId, ok = input.Parsed["ruleId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleId", input) } - if v, ok := parsed.Parsed["baselineName"]; true { + if v, ok := input.Parsed["baselineName"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "baselineName", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "baselineName", input) } baselineName, err := parseVulnerabilityAssessmentPolicyBaselineName(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.BaselineName = *baselineName } - return &id, nil + return nil } // ValidateBaselineID checks that 'input' can be parsed as a Baseline ID diff --git a/resource-manager/sql/2023-02-01-preview/databasevulnerabilityassessmentscans/id_vulnerabilityassessmentscan.go b/resource-manager/sql/2023-02-01-preview/databasevulnerabilityassessmentscans/id_vulnerabilityassessmentscan.go index 30eb171c3c4..aa649af832d 100644 --- a/resource-manager/sql/2023-02-01-preview/databasevulnerabilityassessmentscans/id_vulnerabilityassessmentscan.go +++ b/resource-manager/sql/2023-02-01-preview/databasevulnerabilityassessmentscans/id_vulnerabilityassessmentscan.go @@ -40,27 +40,9 @@ func ParseVulnerabilityAssessmentScanID(input string) (*VulnerabilityAssessmentS return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VulnerabilityAssessmentScanId{} - - 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) - } - - if id.ScanId, ok = parsed.Parsed["scanId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scanId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVulnerabilityAssessmentScanIDInsensitively(input string) (*Vulnerabili return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VulnerabilityAssessmentScanId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VulnerabilityAssessmentScanId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.ScanId, ok = parsed.Parsed["scanId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scanId", *parsed) + if id.ScanId, ok = input.Parsed["scanId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scanId", input) } - return &id, nil + return nil } // ValidateVulnerabilityAssessmentScanID checks that 'input' can be parsed as a Vulnerability Assessment Scan ID diff --git a/resource-manager/sql/2023-02-01-preview/datamaskingrules/id_datamaskingpolicyrule.go b/resource-manager/sql/2023-02-01-preview/datamaskingrules/id_datamaskingpolicyrule.go index b97a33bf33e..1ba892a7d03 100644 --- a/resource-manager/sql/2023-02-01-preview/datamaskingrules/id_datamaskingpolicyrule.go +++ b/resource-manager/sql/2023-02-01-preview/datamaskingrules/id_datamaskingpolicyrule.go @@ -40,27 +40,9 @@ func ParseDataMaskingPolicyRuleID(input string) (*DataMaskingPolicyRuleId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataMaskingPolicyRuleId{} - - 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) - } - - if id.RuleName, ok = parsed.Parsed["ruleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseDataMaskingPolicyRuleIDInsensitively(input string) (*DataMaskingPolicy return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataMaskingPolicyRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DataMaskingPolicyRuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.RuleName, ok = parsed.Parsed["ruleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleName", *parsed) + if id.RuleName, ok = input.Parsed["ruleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleName", input) } - return &id, nil + return nil } // ValidateDataMaskingPolicyRuleID checks that 'input' can be parsed as a Data Masking Policy Rule ID diff --git a/resource-manager/sql/2023-02-01-preview/deletedservers/id_deletedserver.go b/resource-manager/sql/2023-02-01-preview/deletedservers/id_deletedserver.go index 6a0a52caefa..81956e4971a 100644 --- a/resource-manager/sql/2023-02-01-preview/deletedservers/id_deletedserver.go +++ b/resource-manager/sql/2023-02-01-preview/deletedservers/id_deletedserver.go @@ -36,19 +36,9 @@ func ParseDeletedServerID(input string) (*DeletedServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeletedServerId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.DeletedServerName, ok = parsed.Parsed["deletedServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDeletedServerIDInsensitively(input string) (*DeletedServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeletedServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DeletedServerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.DeletedServerName, ok = parsed.Parsed["deletedServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedServerName", *parsed) + if id.DeletedServerName, ok = input.Parsed["deletedServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deletedServerName", input) } - return &id, nil + return nil } // ValidateDeletedServerID checks that 'input' can be parsed as a Deleted Server ID diff --git a/resource-manager/sql/2023-02-01-preview/deletedservers/id_location.go b/resource-manager/sql/2023-02-01-preview/deletedservers/id_location.go index 1dbc2d270c9..df476453a48 100644 --- a/resource-manager/sql/2023-02-01-preview/deletedservers/id_location.go +++ b/resource-manager/sql/2023-02-01-preview/deletedservers/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/sql/2023-02-01-preview/distributedavailabilitygroups/id_distributedavailabilitygroup.go b/resource-manager/sql/2023-02-01-preview/distributedavailabilitygroups/id_distributedavailabilitygroup.go index 376709da1e0..b9e014fc53a 100644 --- a/resource-manager/sql/2023-02-01-preview/distributedavailabilitygroups/id_distributedavailabilitygroup.go +++ b/resource-manager/sql/2023-02-01-preview/distributedavailabilitygroups/id_distributedavailabilitygroup.go @@ -38,23 +38,9 @@ func ParseDistributedAvailabilityGroupID(input string) (*DistributedAvailability return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DistributedAvailabilityGroupId{} - - 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.DistributedAvailabilityGroupName, ok = parsed.Parsed["distributedAvailabilityGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "distributedAvailabilityGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDistributedAvailabilityGroupIDInsensitively(input string) (*Distribute return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DistributedAvailabilityGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DistributedAvailabilityGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedInstanceName, ok = parsed.Parsed["managedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", *parsed) + if id.ManagedInstanceName, ok = input.Parsed["managedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", input) } - if id.DistributedAvailabilityGroupName, ok = parsed.Parsed["distributedAvailabilityGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "distributedAvailabilityGroupName", *parsed) + if id.DistributedAvailabilityGroupName, ok = input.Parsed["distributedAvailabilityGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "distributedAvailabilityGroupName", input) } - return &id, nil + return nil } // ValidateDistributedAvailabilityGroupID checks that 'input' can be parsed as a Distributed Availability Group ID diff --git a/resource-manager/sql/2023-02-01-preview/elasticpooloperations/id_operation.go b/resource-manager/sql/2023-02-01-preview/elasticpooloperations/id_operation.go index 0aa5b08c901..3951bc61430 100644 --- a/resource-manager/sql/2023-02-01-preview/elasticpooloperations/id_operation.go +++ b/resource-manager/sql/2023-02-01-preview/elasticpooloperations/id_operation.go @@ -40,27 +40,9 @@ func ParseOperationID(input string) (*OperationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationId{} - - 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) - } - - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseOperationIDInsensitively(input string) (*OperationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *OperationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.ElasticPoolName, ok = parsed.Parsed["elasticPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "elasticPoolName", *parsed) + if id.ElasticPoolName, ok = input.Parsed["elasticPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "elasticPoolName", input) } - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if id.OperationId, ok = input.Parsed["operationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "operationId", input) } - return &id, nil + return nil } // ValidateOperationID checks that 'input' can be parsed as a Operation ID diff --git a/resource-manager/sql/2023-02-01-preview/endpointcertificates/id_endpointcertificate.go b/resource-manager/sql/2023-02-01-preview/endpointcertificates/id_endpointcertificate.go index 1c05991669a..be67667cb2c 100644 --- a/resource-manager/sql/2023-02-01-preview/endpointcertificates/id_endpointcertificate.go +++ b/resource-manager/sql/2023-02-01-preview/endpointcertificates/id_endpointcertificate.go @@ -38,23 +38,9 @@ func ParseEndpointCertificateID(input string) (*EndpointCertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EndpointCertificateId{} - - 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.EndpointCertificateName, ok = parsed.Parsed["endpointCertificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "endpointCertificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseEndpointCertificateIDInsensitively(input string) (*EndpointCertificate return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EndpointCertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EndpointCertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedInstanceName, ok = parsed.Parsed["managedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", *parsed) + if id.ManagedInstanceName, ok = input.Parsed["managedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", input) } - if id.EndpointCertificateName, ok = parsed.Parsed["endpointCertificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "endpointCertificateName", *parsed) + if id.EndpointCertificateName, ok = input.Parsed["endpointCertificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "endpointCertificateName", input) } - return &id, nil + return nil } // ValidateEndpointCertificateID checks that 'input' can be parsed as a Endpoint Certificate ID diff --git a/resource-manager/sql/2023-02-01-preview/failovergroups/id_failovergroup.go b/resource-manager/sql/2023-02-01-preview/failovergroups/id_failovergroup.go index 30da65a54d4..412ec2c90fb 100644 --- a/resource-manager/sql/2023-02-01-preview/failovergroups/id_failovergroup.go +++ b/resource-manager/sql/2023-02-01-preview/failovergroups/id_failovergroup.go @@ -38,23 +38,9 @@ func ParseFailoverGroupID(input string) (*FailoverGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FailoverGroupId{} - - 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.FailoverGroupName, ok = parsed.Parsed["failoverGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "failoverGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFailoverGroupIDInsensitively(input string) (*FailoverGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FailoverGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FailoverGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.FailoverGroupName, ok = parsed.Parsed["failoverGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "failoverGroupName", *parsed) + if id.FailoverGroupName, ok = input.Parsed["failoverGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "failoverGroupName", input) } - return &id, nil + return nil } // ValidateFailoverGroupID checks that 'input' can be parsed as a Failover Group ID diff --git a/resource-manager/sql/2023-02-01-preview/firewallrules/id_firewallrule.go b/resource-manager/sql/2023-02-01-preview/firewallrules/id_firewallrule.go index c3791ac27f5..4f3a4ff143e 100644 --- a/resource-manager/sql/2023-02-01-preview/firewallrules/id_firewallrule.go +++ b/resource-manager/sql/2023-02-01-preview/firewallrules/id_firewallrule.go @@ -38,23 +38,9 @@ func ParseFirewallRuleID(input string) (*FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallRuleId{} - - 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.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFirewallRuleIDInsensitively(input string) (*FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FirewallRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FirewallRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.FirewallRuleName, ok = parsed.Parsed["firewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", *parsed) + if id.FirewallRuleName, ok = input.Parsed["firewallRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "firewallRuleName", input) } - return &id, nil + return nil } // ValidateFirewallRuleID checks that 'input' can be parsed as a Firewall Rule ID diff --git a/resource-manager/sql/2023-02-01-preview/instancefailovergroups/id_instancefailovergroup.go b/resource-manager/sql/2023-02-01-preview/instancefailovergroups/id_instancefailovergroup.go index b4c603bee51..098e76f3b16 100644 --- a/resource-manager/sql/2023-02-01-preview/instancefailovergroups/id_instancefailovergroup.go +++ b/resource-manager/sql/2023-02-01-preview/instancefailovergroups/id_instancefailovergroup.go @@ -38,23 +38,9 @@ func ParseInstanceFailoverGroupID(input string) (*InstanceFailoverGroupId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InstanceFailoverGroupId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.InstanceFailoverGroupName, ok = parsed.Parsed["instanceFailoverGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceFailoverGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseInstanceFailoverGroupIDInsensitively(input string) (*InstanceFailoverG return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InstanceFailoverGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *InstanceFailoverGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.InstanceFailoverGroupName, ok = parsed.Parsed["instanceFailoverGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceFailoverGroupName", *parsed) + if id.InstanceFailoverGroupName, ok = input.Parsed["instanceFailoverGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceFailoverGroupName", input) } - return &id, nil + return nil } // ValidateInstanceFailoverGroupID checks that 'input' can be parsed as a Instance Failover Group ID diff --git a/resource-manager/sql/2023-02-01-preview/instancefailovergroups/id_providerlocation.go b/resource-manager/sql/2023-02-01-preview/instancefailovergroups/id_providerlocation.go index a53e9150fe9..5d86c376322 100644 --- a/resource-manager/sql/2023-02-01-preview/instancefailovergroups/id_providerlocation.go +++ b/resource-manager/sql/2023-02-01-preview/instancefailovergroups/id_providerlocation.go @@ -36,19 +36,9 @@ func ParseProviderLocationID(input string) (*ProviderLocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderLocationIDInsensitively(input string) (*ProviderLocationId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderLocationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateProviderLocationID checks that 'input' can be parsed as a Provider Location ID diff --git a/resource-manager/sql/2023-02-01-preview/instancepools/id_instancepool.go b/resource-manager/sql/2023-02-01-preview/instancepools/id_instancepool.go index f6bb0b27def..d46dc46b651 100644 --- a/resource-manager/sql/2023-02-01-preview/instancepools/id_instancepool.go +++ b/resource-manager/sql/2023-02-01-preview/instancepools/id_instancepool.go @@ -36,19 +36,9 @@ func ParseInstancePoolID(input string) (*InstancePoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InstancePoolId{} - - 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.InstancePoolName, ok = parsed.Parsed["instancePoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instancePoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseInstancePoolIDInsensitively(input string) (*InstancePoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InstancePoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *InstancePoolId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.InstancePoolName, ok = parsed.Parsed["instancePoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instancePoolName", *parsed) + if id.InstancePoolName, ok = input.Parsed["instancePoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instancePoolName", input) } - return &id, nil + return nil } // ValidateInstancePoolID checks that 'input' can be parsed as a Instance Pool ID diff --git a/resource-manager/sql/2023-02-01-preview/ipv6firewallrules/id_ipv6firewallrule.go b/resource-manager/sql/2023-02-01-preview/ipv6firewallrules/id_ipv6firewallrule.go index 017dac13277..5b3114eff94 100644 --- a/resource-manager/sql/2023-02-01-preview/ipv6firewallrules/id_ipv6firewallrule.go +++ b/resource-manager/sql/2023-02-01-preview/ipv6firewallrules/id_ipv6firewallrule.go @@ -38,23 +38,9 @@ func ParseIPv6FirewallRuleID(input string) (*IPv6FirewallRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IPv6FirewallRuleId{} - - 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.Ipv6FirewallRuleName, ok = parsed.Parsed["ipv6FirewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ipv6FirewallRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIPv6FirewallRuleIDInsensitively(input string) (*IPv6FirewallRuleId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IPv6FirewallRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IPv6FirewallRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.Ipv6FirewallRuleName, ok = parsed.Parsed["ipv6FirewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ipv6FirewallRuleName", *parsed) + if id.Ipv6FirewallRuleName, ok = input.Parsed["ipv6FirewallRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ipv6FirewallRuleName", input) } - return &id, nil + return nil } // ValidateIPv6FirewallRuleID checks that 'input' can be parsed as a I Pv 6 Firewall Rule ID diff --git a/resource-manager/sql/2023-02-01-preview/jobagents/id_jobagent.go b/resource-manager/sql/2023-02-01-preview/jobagents/id_jobagent.go index 6e081491cc8..cc7b6f1d7af 100644 --- a/resource-manager/sql/2023-02-01-preview/jobagents/id_jobagent.go +++ b/resource-manager/sql/2023-02-01-preview/jobagents/id_jobagent.go @@ -38,23 +38,9 @@ func ParseJobAgentID(input string) (*JobAgentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobAgentId{} - - 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.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseJobAgentIDInsensitively(input string) (*JobAgentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobAgentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *JobAgentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if id.JobAgentName, ok = input.Parsed["jobAgentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", input) } - return &id, nil + return nil } // ValidateJobAgentID checks that 'input' can be parsed as a Job Agent ID diff --git a/resource-manager/sql/2023-02-01-preview/jobcredentials/id_credential.go b/resource-manager/sql/2023-02-01-preview/jobcredentials/id_credential.go index 260240e02a9..bf3b1f5d3d0 100644 --- a/resource-manager/sql/2023-02-01-preview/jobcredentials/id_credential.go +++ b/resource-manager/sql/2023-02-01-preview/jobcredentials/id_credential.go @@ -40,27 +40,9 @@ func ParseCredentialID(input string) (*CredentialId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CredentialId{} - - 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.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) - } - - if id.CredentialName, ok = parsed.Parsed["credentialName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "credentialName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseCredentialIDInsensitively(input string) (*CredentialId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CredentialId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *CredentialId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if id.JobAgentName, ok = input.Parsed["jobAgentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", input) } - if id.CredentialName, ok = parsed.Parsed["credentialName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "credentialName", *parsed) + if id.CredentialName, ok = input.Parsed["credentialName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "credentialName", input) } - return &id, nil + return nil } // ValidateCredentialID checks that 'input' can be parsed as a Credential ID diff --git a/resource-manager/sql/2023-02-01-preview/jobcredentials/id_jobagent.go b/resource-manager/sql/2023-02-01-preview/jobcredentials/id_jobagent.go index 9c24ea9ee8d..c962a930918 100644 --- a/resource-manager/sql/2023-02-01-preview/jobcredentials/id_jobagent.go +++ b/resource-manager/sql/2023-02-01-preview/jobcredentials/id_jobagent.go @@ -38,23 +38,9 @@ func ParseJobAgentID(input string) (*JobAgentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobAgentId{} - - 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.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseJobAgentIDInsensitively(input string) (*JobAgentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobAgentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *JobAgentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if id.JobAgentName, ok = input.Parsed["jobAgentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", input) } - return &id, nil + return nil } // ValidateJobAgentID checks that 'input' can be parsed as a Job Agent ID diff --git a/resource-manager/sql/2023-02-01-preview/jobexecutions/id_execution.go b/resource-manager/sql/2023-02-01-preview/jobexecutions/id_execution.go index 4e636e504d9..79ebd882159 100644 --- a/resource-manager/sql/2023-02-01-preview/jobexecutions/id_execution.go +++ b/resource-manager/sql/2023-02-01-preview/jobexecutions/id_execution.go @@ -42,31 +42,9 @@ func ParseExecutionID(input string) (*ExecutionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExecutionId{} - - 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.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) - } - - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) - } - - if id.JobExecutionId, ok = parsed.Parsed["jobExecutionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobExecutionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseExecutionIDInsensitively(input string) (*ExecutionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExecutionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ExecutionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if id.JobAgentName, ok = input.Parsed["jobAgentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - if id.JobExecutionId, ok = parsed.Parsed["jobExecutionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobExecutionId", *parsed) + if id.JobExecutionId, ok = input.Parsed["jobExecutionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobExecutionId", input) } - return &id, nil + return nil } // ValidateExecutionID checks that 'input' can be parsed as a Execution ID diff --git a/resource-manager/sql/2023-02-01-preview/jobexecutions/id_job.go b/resource-manager/sql/2023-02-01-preview/jobexecutions/id_job.go index 8c1502f0ffe..44b61a66530 100644 --- a/resource-manager/sql/2023-02-01-preview/jobexecutions/id_job.go +++ b/resource-manager/sql/2023-02-01-preview/jobexecutions/id_job.go @@ -40,27 +40,9 @@ func ParseJobID(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} - - 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.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) - } - - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseJobIDInsensitively(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *JobId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if id.JobAgentName, ok = input.Parsed["jobAgentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - return &id, nil + return nil } // ValidateJobID checks that 'input' can be parsed as a Job ID diff --git a/resource-manager/sql/2023-02-01-preview/jobexecutions/id_jobagent.go b/resource-manager/sql/2023-02-01-preview/jobexecutions/id_jobagent.go index 375b86657b8..36dabd8303b 100644 --- a/resource-manager/sql/2023-02-01-preview/jobexecutions/id_jobagent.go +++ b/resource-manager/sql/2023-02-01-preview/jobexecutions/id_jobagent.go @@ -38,23 +38,9 @@ func ParseJobAgentID(input string) (*JobAgentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobAgentId{} - - 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.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseJobAgentIDInsensitively(input string) (*JobAgentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobAgentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *JobAgentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if id.JobAgentName, ok = input.Parsed["jobAgentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", input) } - return &id, nil + return nil } // ValidateJobAgentID checks that 'input' can be parsed as a Job Agent ID diff --git a/resource-manager/sql/2023-02-01-preview/jobs/id_job.go b/resource-manager/sql/2023-02-01-preview/jobs/id_job.go index c30a974c9d7..1ff5c9230f2 100644 --- a/resource-manager/sql/2023-02-01-preview/jobs/id_job.go +++ b/resource-manager/sql/2023-02-01-preview/jobs/id_job.go @@ -40,27 +40,9 @@ func ParseJobID(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} - - 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.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) - } - - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseJobIDInsensitively(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *JobId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if id.JobAgentName, ok = input.Parsed["jobAgentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - return &id, nil + return nil } // ValidateJobID checks that 'input' can be parsed as a Job ID diff --git a/resource-manager/sql/2023-02-01-preview/jobs/id_jobagent.go b/resource-manager/sql/2023-02-01-preview/jobs/id_jobagent.go index 49ca167521e..3c9765d9e25 100644 --- a/resource-manager/sql/2023-02-01-preview/jobs/id_jobagent.go +++ b/resource-manager/sql/2023-02-01-preview/jobs/id_jobagent.go @@ -38,23 +38,9 @@ func ParseJobAgentID(input string) (*JobAgentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobAgentId{} - - 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.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseJobAgentIDInsensitively(input string) (*JobAgentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobAgentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *JobAgentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if id.JobAgentName, ok = input.Parsed["jobAgentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", input) } - return &id, nil + return nil } // ValidateJobAgentID checks that 'input' can be parsed as a Job Agent ID diff --git a/resource-manager/sql/2023-02-01-preview/jobstepexecutions/id_execution.go b/resource-manager/sql/2023-02-01-preview/jobstepexecutions/id_execution.go index 57d800bb53b..98f382c105b 100644 --- a/resource-manager/sql/2023-02-01-preview/jobstepexecutions/id_execution.go +++ b/resource-manager/sql/2023-02-01-preview/jobstepexecutions/id_execution.go @@ -42,31 +42,9 @@ func ParseExecutionID(input string) (*ExecutionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExecutionId{} - - 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.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) - } - - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) - } - - if id.JobExecutionId, ok = parsed.Parsed["jobExecutionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobExecutionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseExecutionIDInsensitively(input string) (*ExecutionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExecutionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ExecutionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if id.JobAgentName, ok = input.Parsed["jobAgentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - if id.JobExecutionId, ok = parsed.Parsed["jobExecutionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobExecutionId", *parsed) + if id.JobExecutionId, ok = input.Parsed["jobExecutionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobExecutionId", input) } - return &id, nil + return nil } // ValidateExecutionID checks that 'input' can be parsed as a Execution ID diff --git a/resource-manager/sql/2023-02-01-preview/jobstepexecutions/id_executionstep.go b/resource-manager/sql/2023-02-01-preview/jobstepexecutions/id_executionstep.go index e153906687b..fd80ece7e18 100644 --- a/resource-manager/sql/2023-02-01-preview/jobstepexecutions/id_executionstep.go +++ b/resource-manager/sql/2023-02-01-preview/jobstepexecutions/id_executionstep.go @@ -44,35 +44,9 @@ func ParseExecutionStepID(input string) (*ExecutionStepId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExecutionStepId{} - - 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.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) - } - - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) - } - - if id.JobExecutionId, ok = parsed.Parsed["jobExecutionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobExecutionId", *parsed) - } - - if id.StepName, ok = parsed.Parsed["stepName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "stepName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseExecutionStepIDInsensitively(input string) (*ExecutionStepId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExecutionStepId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ExecutionStepId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if id.JobAgentName, ok = input.Parsed["jobAgentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - if id.JobExecutionId, ok = parsed.Parsed["jobExecutionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobExecutionId", *parsed) + if id.JobExecutionId, ok = input.Parsed["jobExecutionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobExecutionId", input) } - if id.StepName, ok = parsed.Parsed["stepName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "stepName", *parsed) + if id.StepName, ok = input.Parsed["stepName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "stepName", input) } - return &id, nil + return nil } // ValidateExecutionStepID checks that 'input' can be parsed as a Execution Step ID diff --git a/resource-manager/sql/2023-02-01-preview/jobsteps/id_job.go b/resource-manager/sql/2023-02-01-preview/jobsteps/id_job.go index 7a6984cdfef..0230ed0405c 100644 --- a/resource-manager/sql/2023-02-01-preview/jobsteps/id_job.go +++ b/resource-manager/sql/2023-02-01-preview/jobsteps/id_job.go @@ -40,27 +40,9 @@ func ParseJobID(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} - - 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.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) - } - - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseJobIDInsensitively(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *JobId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if id.JobAgentName, ok = input.Parsed["jobAgentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - return &id, nil + return nil } // ValidateJobID checks that 'input' can be parsed as a Job ID diff --git a/resource-manager/sql/2023-02-01-preview/jobsteps/id_step.go b/resource-manager/sql/2023-02-01-preview/jobsteps/id_step.go index b41baf4450b..ce20fcc63fa 100644 --- a/resource-manager/sql/2023-02-01-preview/jobsteps/id_step.go +++ b/resource-manager/sql/2023-02-01-preview/jobsteps/id_step.go @@ -42,31 +42,9 @@ func ParseStepID(input string) (*StepId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StepId{} - - 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.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) - } - - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) - } - - if id.StepName, ok = parsed.Parsed["stepName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "stepName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseStepIDInsensitively(input string) (*StepId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StepId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *StepId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if id.JobAgentName, ok = input.Parsed["jobAgentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - if id.StepName, ok = parsed.Parsed["stepName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "stepName", *parsed) + if id.StepName, ok = input.Parsed["stepName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "stepName", input) } - return &id, nil + return nil } // ValidateStepID checks that 'input' can be parsed as a Step ID diff --git a/resource-manager/sql/2023-02-01-preview/jobsteps/id_version.go b/resource-manager/sql/2023-02-01-preview/jobsteps/id_version.go index 8cc2401e1cf..aae15caeb59 100644 --- a/resource-manager/sql/2023-02-01-preview/jobsteps/id_version.go +++ b/resource-manager/sql/2023-02-01-preview/jobsteps/id_version.go @@ -42,31 +42,9 @@ func ParseVersionID(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} - - 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.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) - } - - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseVersionIDInsensitively(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if id.JobAgentName, ok = input.Parsed["jobAgentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateVersionID checks that 'input' can be parsed as a Version ID diff --git a/resource-manager/sql/2023-02-01-preview/jobsteps/id_versionstep.go b/resource-manager/sql/2023-02-01-preview/jobsteps/id_versionstep.go index 06e3e42e5d6..395ba0da99a 100644 --- a/resource-manager/sql/2023-02-01-preview/jobsteps/id_versionstep.go +++ b/resource-manager/sql/2023-02-01-preview/jobsteps/id_versionstep.go @@ -44,35 +44,9 @@ func ParseVersionStepID(input string) (*VersionStepId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionStepId{} - - 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.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) - } - - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) - } - - if id.StepName, ok = parsed.Parsed["stepName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "stepName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseVersionStepIDInsensitively(input string) (*VersionStepId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionStepId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VersionStepId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if id.JobAgentName, ok = input.Parsed["jobAgentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - if id.StepName, ok = parsed.Parsed["stepName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "stepName", *parsed) + if id.StepName, ok = input.Parsed["stepName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "stepName", input) } - return &id, nil + return nil } // ValidateVersionStepID checks that 'input' can be parsed as a Version Step ID diff --git a/resource-manager/sql/2023-02-01-preview/jobtargetexecutions/id_execution.go b/resource-manager/sql/2023-02-01-preview/jobtargetexecutions/id_execution.go index 0ca99d6605e..00ead3132ff 100644 --- a/resource-manager/sql/2023-02-01-preview/jobtargetexecutions/id_execution.go +++ b/resource-manager/sql/2023-02-01-preview/jobtargetexecutions/id_execution.go @@ -42,31 +42,9 @@ func ParseExecutionID(input string) (*ExecutionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExecutionId{} - - 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.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) - } - - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) - } - - if id.JobExecutionId, ok = parsed.Parsed["jobExecutionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobExecutionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseExecutionIDInsensitively(input string) (*ExecutionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExecutionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ExecutionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if id.JobAgentName, ok = input.Parsed["jobAgentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - if id.JobExecutionId, ok = parsed.Parsed["jobExecutionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobExecutionId", *parsed) + if id.JobExecutionId, ok = input.Parsed["jobExecutionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobExecutionId", input) } - return &id, nil + return nil } // ValidateExecutionID checks that 'input' can be parsed as a Execution ID diff --git a/resource-manager/sql/2023-02-01-preview/jobtargetexecutions/id_executionstep.go b/resource-manager/sql/2023-02-01-preview/jobtargetexecutions/id_executionstep.go index 6437aade732..61dfa3ed73b 100644 --- a/resource-manager/sql/2023-02-01-preview/jobtargetexecutions/id_executionstep.go +++ b/resource-manager/sql/2023-02-01-preview/jobtargetexecutions/id_executionstep.go @@ -44,35 +44,9 @@ func ParseExecutionStepID(input string) (*ExecutionStepId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExecutionStepId{} - - 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.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) - } - - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) - } - - if id.JobExecutionId, ok = parsed.Parsed["jobExecutionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobExecutionId", *parsed) - } - - if id.StepName, ok = parsed.Parsed["stepName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "stepName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseExecutionStepIDInsensitively(input string) (*ExecutionStepId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ExecutionStepId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ExecutionStepId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if id.JobAgentName, ok = input.Parsed["jobAgentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - if id.JobExecutionId, ok = parsed.Parsed["jobExecutionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobExecutionId", *parsed) + if id.JobExecutionId, ok = input.Parsed["jobExecutionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobExecutionId", input) } - if id.StepName, ok = parsed.Parsed["stepName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "stepName", *parsed) + if id.StepName, ok = input.Parsed["stepName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "stepName", input) } - return &id, nil + return nil } // ValidateExecutionStepID checks that 'input' can be parsed as a Execution Step ID diff --git a/resource-manager/sql/2023-02-01-preview/jobtargetexecutions/id_target.go b/resource-manager/sql/2023-02-01-preview/jobtargetexecutions/id_target.go index 8040ae7a9c0..963bccf9a33 100644 --- a/resource-manager/sql/2023-02-01-preview/jobtargetexecutions/id_target.go +++ b/resource-manager/sql/2023-02-01-preview/jobtargetexecutions/id_target.go @@ -46,39 +46,9 @@ func ParseTargetID(input string) (*TargetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TargetId{} - - 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.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) - } - - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) - } - - if id.JobExecutionId, ok = parsed.Parsed["jobExecutionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobExecutionId", *parsed) - } - - if id.StepName, ok = parsed.Parsed["stepName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "stepName", *parsed) - } - - if id.TargetId, ok = parsed.Parsed["targetId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -93,42 +63,50 @@ func ParseTargetIDInsensitively(input string) (*TargetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TargetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TargetId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if id.JobAgentName, ok = input.Parsed["jobAgentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - if id.JobExecutionId, ok = parsed.Parsed["jobExecutionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobExecutionId", *parsed) + if id.JobExecutionId, ok = input.Parsed["jobExecutionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobExecutionId", input) } - if id.StepName, ok = parsed.Parsed["stepName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "stepName", *parsed) + if id.StepName, ok = input.Parsed["stepName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "stepName", input) } - if id.TargetId, ok = parsed.Parsed["targetId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetId", *parsed) + if id.TargetId, ok = input.Parsed["targetId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "targetId", input) } - return &id, nil + return nil } // ValidateTargetID checks that 'input' can be parsed as a Target ID diff --git a/resource-manager/sql/2023-02-01-preview/jobtargetgroups/id_jobagent.go b/resource-manager/sql/2023-02-01-preview/jobtargetgroups/id_jobagent.go index e3782714a5c..fff60d47a40 100644 --- a/resource-manager/sql/2023-02-01-preview/jobtargetgroups/id_jobagent.go +++ b/resource-manager/sql/2023-02-01-preview/jobtargetgroups/id_jobagent.go @@ -38,23 +38,9 @@ func ParseJobAgentID(input string) (*JobAgentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobAgentId{} - - 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.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseJobAgentIDInsensitively(input string) (*JobAgentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobAgentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *JobAgentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if id.JobAgentName, ok = input.Parsed["jobAgentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", input) } - return &id, nil + return nil } // ValidateJobAgentID checks that 'input' can be parsed as a Job Agent ID diff --git a/resource-manager/sql/2023-02-01-preview/jobtargetgroups/id_targetgroup.go b/resource-manager/sql/2023-02-01-preview/jobtargetgroups/id_targetgroup.go index 8d72b92e637..44a9c50857d 100644 --- a/resource-manager/sql/2023-02-01-preview/jobtargetgroups/id_targetgroup.go +++ b/resource-manager/sql/2023-02-01-preview/jobtargetgroups/id_targetgroup.go @@ -40,27 +40,9 @@ func ParseTargetGroupID(input string) (*TargetGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TargetGroupId{} - - 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.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) - } - - if id.TargetGroupName, ok = parsed.Parsed["targetGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseTargetGroupIDInsensitively(input string) (*TargetGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TargetGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TargetGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if id.JobAgentName, ok = input.Parsed["jobAgentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", input) } - if id.TargetGroupName, ok = parsed.Parsed["targetGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "targetGroupName", *parsed) + if id.TargetGroupName, ok = input.Parsed["targetGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "targetGroupName", input) } - return &id, nil + return nil } // ValidateTargetGroupID checks that 'input' can be parsed as a Target Group ID diff --git a/resource-manager/sql/2023-02-01-preview/jobversions/id_job.go b/resource-manager/sql/2023-02-01-preview/jobversions/id_job.go index ad2863199b3..cc50e4d781a 100644 --- a/resource-manager/sql/2023-02-01-preview/jobversions/id_job.go +++ b/resource-manager/sql/2023-02-01-preview/jobversions/id_job.go @@ -40,27 +40,9 @@ func ParseJobID(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} - - 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.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) - } - - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseJobIDInsensitively(input string) (*JobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *JobId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if id.JobAgentName, ok = input.Parsed["jobAgentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - return &id, nil + return nil } // ValidateJobID checks that 'input' can be parsed as a Job ID diff --git a/resource-manager/sql/2023-02-01-preview/jobversions/id_version.go b/resource-manager/sql/2023-02-01-preview/jobversions/id_version.go index 2cfdb9539ea..57232de2789 100644 --- a/resource-manager/sql/2023-02-01-preview/jobversions/id_version.go +++ b/resource-manager/sql/2023-02-01-preview/jobversions/id_version.go @@ -42,31 +42,9 @@ func ParseVersionID(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} - - 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.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) - } - - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) - } - - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseVersionIDInsensitively(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.JobAgentName, ok = parsed.Parsed["jobAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", *parsed) + if id.JobAgentName, ok = input.Parsed["jobAgentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobAgentName", input) } - if id.JobName, ok = parsed.Parsed["jobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobName", *parsed) + if id.JobName, ok = input.Parsed["jobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobName", input) } - if id.VersionName, ok = parsed.Parsed["versionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionName", *parsed) + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) } - return &id, nil + return nil } // ValidateVersionID checks that 'input' can be parsed as a Version ID diff --git a/resource-manager/sql/2023-02-01-preview/locationcapabilities/id_location.go b/resource-manager/sql/2023-02-01-preview/locationcapabilities/id_location.go index a1aaa6b22d6..acab89ca2e2 100644 --- a/resource-manager/sql/2023-02-01-preview/locationcapabilities/id_location.go +++ b/resource-manager/sql/2023-02-01-preview/locationcapabilities/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/sql/2023-02-01-preview/longtermretentionbackups/id_location.go b/resource-manager/sql/2023-02-01-preview/longtermretentionbackups/id_location.go index 7cb367c9946..840d99c04c8 100644 --- a/resource-manager/sql/2023-02-01-preview/longtermretentionbackups/id_location.go +++ b/resource-manager/sql/2023-02-01-preview/longtermretentionbackups/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/sql/2023-02-01-preview/longtermretentionbackups/id_locationlongtermretentionserver.go b/resource-manager/sql/2023-02-01-preview/longtermretentionbackups/id_locationlongtermretentionserver.go index bfd048f5f10..dbbd58e977e 100644 --- a/resource-manager/sql/2023-02-01-preview/longtermretentionbackups/id_locationlongtermretentionserver.go +++ b/resource-manager/sql/2023-02-01-preview/longtermretentionbackups/id_locationlongtermretentionserver.go @@ -38,23 +38,9 @@ func ParseLocationLongTermRetentionServerID(input string) (*LocationLongTermRete return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationLongTermRetentionServerId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.LongTermRetentionServerName, ok = parsed.Parsed["longTermRetentionServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLocationLongTermRetentionServerIDInsensitively(input string) (*Locatio return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationLongTermRetentionServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LocationLongTermRetentionServerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.LongTermRetentionServerName, ok = parsed.Parsed["longTermRetentionServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionServerName", *parsed) + if id.LongTermRetentionServerName, ok = input.Parsed["longTermRetentionServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionServerName", input) } - return &id, nil + return nil } // ValidateLocationLongTermRetentionServerID checks that 'input' can be parsed as a Location Long Term Retention Server ID diff --git a/resource-manager/sql/2023-02-01-preview/longtermretentionbackups/id_locationlongtermretentionserverlongtermretentiondatabase.go b/resource-manager/sql/2023-02-01-preview/longtermretentionbackups/id_locationlongtermretentionserverlongtermretentiondatabase.go index dd1e6dae17b..bd19cc9a11e 100644 --- a/resource-manager/sql/2023-02-01-preview/longtermretentionbackups/id_locationlongtermretentionserverlongtermretentiondatabase.go +++ b/resource-manager/sql/2023-02-01-preview/longtermretentionbackups/id_locationlongtermretentionserverlongtermretentiondatabase.go @@ -40,27 +40,9 @@ func ParseLocationLongTermRetentionServerLongTermRetentionDatabaseID(input strin return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationLongTermRetentionServerLongTermRetentionDatabaseId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.LongTermRetentionServerName, ok = parsed.Parsed["longTermRetentionServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionServerName", *parsed) - } - - if id.LongTermRetentionDatabaseName, ok = parsed.Parsed["longTermRetentionDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionDatabaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseLocationLongTermRetentionServerLongTermRetentionDatabaseIDInsensitivel return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationLongTermRetentionServerLongTermRetentionDatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationLongTermRetentionServerLongTermRetentionDatabaseId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.LongTermRetentionServerName, ok = parsed.Parsed["longTermRetentionServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionServerName", *parsed) + if id.LongTermRetentionServerName, ok = input.Parsed["longTermRetentionServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionServerName", input) } - if id.LongTermRetentionDatabaseName, ok = parsed.Parsed["longTermRetentionDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionDatabaseName", *parsed) + if id.LongTermRetentionDatabaseName, ok = input.Parsed["longTermRetentionDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionDatabaseName", input) } - return &id, nil + return nil } // ValidateLocationLongTermRetentionServerLongTermRetentionDatabaseID checks that 'input' can be parsed as a Location Long Term Retention Server Long Term Retention Database ID diff --git a/resource-manager/sql/2023-02-01-preview/longtermretentionbackups/id_longtermretentionbackup.go b/resource-manager/sql/2023-02-01-preview/longtermretentionbackups/id_longtermretentionbackup.go index 2dcf5c6f491..39bb5a345e4 100644 --- a/resource-manager/sql/2023-02-01-preview/longtermretentionbackups/id_longtermretentionbackup.go +++ b/resource-manager/sql/2023-02-01-preview/longtermretentionbackups/id_longtermretentionbackup.go @@ -40,27 +40,9 @@ func ParseLongTermRetentionBackupID(input string) (*LongTermRetentionBackupId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LongTermRetentionBackupId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.LongTermRetentionServerName, ok = parsed.Parsed["longTermRetentionServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionServerName", *parsed) - } - - if id.LongTermRetentionDatabaseName, ok = parsed.Parsed["longTermRetentionDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionDatabaseName", *parsed) - } - - if id.LongTermRetentionBackupName, ok = parsed.Parsed["longTermRetentionBackupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionBackupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseLongTermRetentionBackupIDInsensitively(input string) (*LongTermRetenti return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LongTermRetentionBackupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LongTermRetentionBackupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.LongTermRetentionServerName, ok = parsed.Parsed["longTermRetentionServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionServerName", *parsed) + if id.LongTermRetentionServerName, ok = input.Parsed["longTermRetentionServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionServerName", input) } - if id.LongTermRetentionDatabaseName, ok = parsed.Parsed["longTermRetentionDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionDatabaseName", *parsed) + if id.LongTermRetentionDatabaseName, ok = input.Parsed["longTermRetentionDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionDatabaseName", input) } - if id.LongTermRetentionBackupName, ok = parsed.Parsed["longTermRetentionBackupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionBackupName", *parsed) + if id.LongTermRetentionBackupName, ok = input.Parsed["longTermRetentionBackupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionBackupName", input) } - return &id, nil + return nil } // ValidateLongTermRetentionBackupID checks that 'input' can be parsed as a Long Term Retention Backup ID diff --git a/resource-manager/sql/2023-02-01-preview/longtermretentionbackups/id_longtermretentiondatabaselongtermretentionbackup.go b/resource-manager/sql/2023-02-01-preview/longtermretentionbackups/id_longtermretentiondatabaselongtermretentionbackup.go index 269dea67d81..474c5dfe854 100644 --- a/resource-manager/sql/2023-02-01-preview/longtermretentionbackups/id_longtermretentiondatabaselongtermretentionbackup.go +++ b/resource-manager/sql/2023-02-01-preview/longtermretentionbackups/id_longtermretentiondatabaselongtermretentionbackup.go @@ -42,31 +42,9 @@ func ParseLongTermRetentionDatabaseLongTermRetentionBackupID(input string) (*Lon return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LongTermRetentionDatabaseLongTermRetentionBackupId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.LongTermRetentionServerName, ok = parsed.Parsed["longTermRetentionServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionServerName", *parsed) - } - - if id.LongTermRetentionDatabaseName, ok = parsed.Parsed["longTermRetentionDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionDatabaseName", *parsed) - } - - if id.LongTermRetentionBackupName, ok = parsed.Parsed["longTermRetentionBackupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionBackupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseLongTermRetentionDatabaseLongTermRetentionBackupIDInsensitively(input return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LongTermRetentionDatabaseLongTermRetentionBackupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LongTermRetentionDatabaseLongTermRetentionBackupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.LongTermRetentionServerName, ok = parsed.Parsed["longTermRetentionServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionServerName", *parsed) + if id.LongTermRetentionServerName, ok = input.Parsed["longTermRetentionServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionServerName", input) } - if id.LongTermRetentionDatabaseName, ok = parsed.Parsed["longTermRetentionDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionDatabaseName", *parsed) + if id.LongTermRetentionDatabaseName, ok = input.Parsed["longTermRetentionDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionDatabaseName", input) } - if id.LongTermRetentionBackupName, ok = parsed.Parsed["longTermRetentionBackupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionBackupName", *parsed) + if id.LongTermRetentionBackupName, ok = input.Parsed["longTermRetentionBackupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionBackupName", input) } - return &id, nil + return nil } // ValidateLongTermRetentionDatabaseLongTermRetentionBackupID checks that 'input' can be parsed as a Long Term Retention Database Long Term Retention Backup ID diff --git a/resource-manager/sql/2023-02-01-preview/longtermretentionbackups/id_longtermretentionserver.go b/resource-manager/sql/2023-02-01-preview/longtermretentionbackups/id_longtermretentionserver.go index 5f0e048ebcc..157701e361c 100644 --- a/resource-manager/sql/2023-02-01-preview/longtermretentionbackups/id_longtermretentionserver.go +++ b/resource-manager/sql/2023-02-01-preview/longtermretentionbackups/id_longtermretentionserver.go @@ -36,19 +36,9 @@ func ParseLongTermRetentionServerID(input string) (*LongTermRetentionServerId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LongTermRetentionServerId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.LongTermRetentionServerName, ok = parsed.Parsed["longTermRetentionServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLongTermRetentionServerIDInsensitively(input string) (*LongTermRetenti return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LongTermRetentionServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LongTermRetentionServerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.LongTermRetentionServerName, ok = parsed.Parsed["longTermRetentionServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionServerName", *parsed) + if id.LongTermRetentionServerName, ok = input.Parsed["longTermRetentionServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionServerName", input) } - return &id, nil + return nil } // ValidateLongTermRetentionServerID checks that 'input' can be parsed as a Long Term Retention Server ID diff --git a/resource-manager/sql/2023-02-01-preview/longtermretentionbackups/id_longtermretentionserverlongtermretentiondatabase.go b/resource-manager/sql/2023-02-01-preview/longtermretentionbackups/id_longtermretentionserverlongtermretentiondatabase.go index bf77fcee189..30ae16ec466 100644 --- a/resource-manager/sql/2023-02-01-preview/longtermretentionbackups/id_longtermretentionserverlongtermretentiondatabase.go +++ b/resource-manager/sql/2023-02-01-preview/longtermretentionbackups/id_longtermretentionserverlongtermretentiondatabase.go @@ -38,23 +38,9 @@ func ParseLongTermRetentionServerLongTermRetentionDatabaseID(input string) (*Lon return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LongTermRetentionServerLongTermRetentionDatabaseId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.LongTermRetentionServerName, ok = parsed.Parsed["longTermRetentionServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionServerName", *parsed) - } - - if id.LongTermRetentionDatabaseName, ok = parsed.Parsed["longTermRetentionDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionDatabaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLongTermRetentionServerLongTermRetentionDatabaseIDInsensitively(input return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LongTermRetentionServerLongTermRetentionDatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LongTermRetentionServerLongTermRetentionDatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.LongTermRetentionServerName, ok = parsed.Parsed["longTermRetentionServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionServerName", *parsed) + if id.LongTermRetentionServerName, ok = input.Parsed["longTermRetentionServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionServerName", input) } - if id.LongTermRetentionDatabaseName, ok = parsed.Parsed["longTermRetentionDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionDatabaseName", *parsed) + if id.LongTermRetentionDatabaseName, ok = input.Parsed["longTermRetentionDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionDatabaseName", input) } - return &id, nil + return nil } // ValidateLongTermRetentionServerLongTermRetentionDatabaseID checks that 'input' can be parsed as a Long Term Retention Server Long Term Retention Database ID diff --git a/resource-manager/sql/2023-02-01-preview/longtermretentionbackups/id_providerlocation.go b/resource-manager/sql/2023-02-01-preview/longtermretentionbackups/id_providerlocation.go index 446c5de599c..5e34cda01b9 100644 --- a/resource-manager/sql/2023-02-01-preview/longtermretentionbackups/id_providerlocation.go +++ b/resource-manager/sql/2023-02-01-preview/longtermretentionbackups/id_providerlocation.go @@ -36,19 +36,9 @@ func ParseProviderLocationID(input string) (*ProviderLocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderLocationIDInsensitively(input string) (*ProviderLocationId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderLocationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateProviderLocationID checks that 'input' can be parsed as a Provider Location ID diff --git a/resource-manager/sql/2023-02-01-preview/longtermretentionmanagedinstancebackups/id_location.go b/resource-manager/sql/2023-02-01-preview/longtermretentionmanagedinstancebackups/id_location.go index a1d658d1e4d..b5b9cd3d778 100644 --- a/resource-manager/sql/2023-02-01-preview/longtermretentionmanagedinstancebackups/id_location.go +++ b/resource-manager/sql/2023-02-01-preview/longtermretentionmanagedinstancebackups/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/sql/2023-02-01-preview/longtermretentionmanagedinstancebackups/id_locationlongtermretentionmanagedinstance.go b/resource-manager/sql/2023-02-01-preview/longtermretentionmanagedinstancebackups/id_locationlongtermretentionmanagedinstance.go index 07acca9ea62..6d23d43c429 100644 --- a/resource-manager/sql/2023-02-01-preview/longtermretentionmanagedinstancebackups/id_locationlongtermretentionmanagedinstance.go +++ b/resource-manager/sql/2023-02-01-preview/longtermretentionmanagedinstancebackups/id_locationlongtermretentionmanagedinstance.go @@ -38,23 +38,9 @@ func ParseLocationLongTermRetentionManagedInstanceID(input string) (*LocationLon return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationLongTermRetentionManagedInstanceId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.LongTermRetentionManagedInstanceName, ok = parsed.Parsed["longTermRetentionManagedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionManagedInstanceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLocationLongTermRetentionManagedInstanceIDInsensitively(input string) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationLongTermRetentionManagedInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LocationLongTermRetentionManagedInstanceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.LongTermRetentionManagedInstanceName, ok = parsed.Parsed["longTermRetentionManagedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionManagedInstanceName", *parsed) + if id.LongTermRetentionManagedInstanceName, ok = input.Parsed["longTermRetentionManagedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionManagedInstanceName", input) } - return &id, nil + return nil } // ValidateLocationLongTermRetentionManagedInstanceID checks that 'input' can be parsed as a Location Long Term Retention Managed Instance ID diff --git a/resource-manager/sql/2023-02-01-preview/longtermretentionmanagedinstancebackups/id_longtermretentiondatabase.go b/resource-manager/sql/2023-02-01-preview/longtermretentionmanagedinstancebackups/id_longtermretentiondatabase.go index 33d87805778..a3bcd5b1ffb 100644 --- a/resource-manager/sql/2023-02-01-preview/longtermretentionmanagedinstancebackups/id_longtermretentiondatabase.go +++ b/resource-manager/sql/2023-02-01-preview/longtermretentionmanagedinstancebackups/id_longtermretentiondatabase.go @@ -38,23 +38,9 @@ func ParseLongTermRetentionDatabaseID(input string) (*LongTermRetentionDatabaseI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LongTermRetentionDatabaseId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.LongTermRetentionManagedInstanceName, ok = parsed.Parsed["longTermRetentionManagedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionManagedInstanceName", *parsed) - } - - if id.LongTermRetentionDatabaseName, ok = parsed.Parsed["longTermRetentionDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionDatabaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLongTermRetentionDatabaseIDInsensitively(input string) (*LongTermReten return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LongTermRetentionDatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LongTermRetentionDatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.LongTermRetentionManagedInstanceName, ok = parsed.Parsed["longTermRetentionManagedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionManagedInstanceName", *parsed) + if id.LongTermRetentionManagedInstanceName, ok = input.Parsed["longTermRetentionManagedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionManagedInstanceName", input) } - if id.LongTermRetentionDatabaseName, ok = parsed.Parsed["longTermRetentionDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionDatabaseName", *parsed) + if id.LongTermRetentionDatabaseName, ok = input.Parsed["longTermRetentionDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionDatabaseName", input) } - return &id, nil + return nil } // ValidateLongTermRetentionDatabaseID checks that 'input' can be parsed as a Long Term Retention Database ID diff --git a/resource-manager/sql/2023-02-01-preview/longtermretentionmanagedinstancebackups/id_longtermretentiondatabaselongtermretentionmanagedinstancebackup.go b/resource-manager/sql/2023-02-01-preview/longtermretentionmanagedinstancebackups/id_longtermretentiondatabaselongtermretentionmanagedinstancebackup.go index 7af5965f78c..819b033b98f 100644 --- a/resource-manager/sql/2023-02-01-preview/longtermretentionmanagedinstancebackups/id_longtermretentiondatabaselongtermretentionmanagedinstancebackup.go +++ b/resource-manager/sql/2023-02-01-preview/longtermretentionmanagedinstancebackups/id_longtermretentiondatabaselongtermretentionmanagedinstancebackup.go @@ -42,31 +42,9 @@ func ParseLongTermRetentionDatabaseLongTermRetentionManagedInstanceBackupID(inpu return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LongTermRetentionDatabaseLongTermRetentionManagedInstanceBackupId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.LongTermRetentionManagedInstanceName, ok = parsed.Parsed["longTermRetentionManagedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionManagedInstanceName", *parsed) - } - - if id.LongTermRetentionDatabaseName, ok = parsed.Parsed["longTermRetentionDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionDatabaseName", *parsed) - } - - if id.LongTermRetentionManagedInstanceBackupName, ok = parsed.Parsed["longTermRetentionManagedInstanceBackupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionManagedInstanceBackupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseLongTermRetentionDatabaseLongTermRetentionManagedInstanceBackupIDInsen return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LongTermRetentionDatabaseLongTermRetentionManagedInstanceBackupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LongTermRetentionDatabaseLongTermRetentionManagedInstanceBackupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.LongTermRetentionManagedInstanceName, ok = parsed.Parsed["longTermRetentionManagedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionManagedInstanceName", *parsed) + if id.LongTermRetentionManagedInstanceName, ok = input.Parsed["longTermRetentionManagedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionManagedInstanceName", input) } - if id.LongTermRetentionDatabaseName, ok = parsed.Parsed["longTermRetentionDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionDatabaseName", *parsed) + if id.LongTermRetentionDatabaseName, ok = input.Parsed["longTermRetentionDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionDatabaseName", input) } - if id.LongTermRetentionManagedInstanceBackupName, ok = parsed.Parsed["longTermRetentionManagedInstanceBackupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionManagedInstanceBackupName", *parsed) + if id.LongTermRetentionManagedInstanceBackupName, ok = input.Parsed["longTermRetentionManagedInstanceBackupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionManagedInstanceBackupName", input) } - return &id, nil + return nil } // ValidateLongTermRetentionDatabaseLongTermRetentionManagedInstanceBackupID checks that 'input' can be parsed as a Long Term Retention Database Long Term Retention Managed Instance Backup ID diff --git a/resource-manager/sql/2023-02-01-preview/longtermretentionmanagedinstancebackups/id_longtermretentionmanagedinstance.go b/resource-manager/sql/2023-02-01-preview/longtermretentionmanagedinstancebackups/id_longtermretentionmanagedinstance.go index 150b1d1797d..98dadeccfee 100644 --- a/resource-manager/sql/2023-02-01-preview/longtermretentionmanagedinstancebackups/id_longtermretentionmanagedinstance.go +++ b/resource-manager/sql/2023-02-01-preview/longtermretentionmanagedinstancebackups/id_longtermretentionmanagedinstance.go @@ -36,19 +36,9 @@ func ParseLongTermRetentionManagedInstanceID(input string) (*LongTermRetentionMa return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LongTermRetentionManagedInstanceId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.LongTermRetentionManagedInstanceName, ok = parsed.Parsed["longTermRetentionManagedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionManagedInstanceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLongTermRetentionManagedInstanceIDInsensitively(input string) (*LongTe return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LongTermRetentionManagedInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LongTermRetentionManagedInstanceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.LongTermRetentionManagedInstanceName, ok = parsed.Parsed["longTermRetentionManagedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionManagedInstanceName", *parsed) + if id.LongTermRetentionManagedInstanceName, ok = input.Parsed["longTermRetentionManagedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionManagedInstanceName", input) } - return &id, nil + return nil } // ValidateLongTermRetentionManagedInstanceID checks that 'input' can be parsed as a Long Term Retention Managed Instance ID diff --git a/resource-manager/sql/2023-02-01-preview/longtermretentionmanagedinstancebackups/id_longtermretentionmanagedinstancebackup.go b/resource-manager/sql/2023-02-01-preview/longtermretentionmanagedinstancebackups/id_longtermretentionmanagedinstancebackup.go index 25f9c738702..8045528d90b 100644 --- a/resource-manager/sql/2023-02-01-preview/longtermretentionmanagedinstancebackups/id_longtermretentionmanagedinstancebackup.go +++ b/resource-manager/sql/2023-02-01-preview/longtermretentionmanagedinstancebackups/id_longtermretentionmanagedinstancebackup.go @@ -40,27 +40,9 @@ func ParseLongTermRetentionManagedInstanceBackupID(input string) (*LongTermReten return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LongTermRetentionManagedInstanceBackupId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.LongTermRetentionManagedInstanceName, ok = parsed.Parsed["longTermRetentionManagedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionManagedInstanceName", *parsed) - } - - if id.LongTermRetentionDatabaseName, ok = parsed.Parsed["longTermRetentionDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionDatabaseName", *parsed) - } - - if id.LongTermRetentionManagedInstanceBackupName, ok = parsed.Parsed["longTermRetentionManagedInstanceBackupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionManagedInstanceBackupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseLongTermRetentionManagedInstanceBackupIDInsensitively(input string) (* return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LongTermRetentionManagedInstanceBackupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LongTermRetentionManagedInstanceBackupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.LongTermRetentionManagedInstanceName, ok = parsed.Parsed["longTermRetentionManagedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionManagedInstanceName", *parsed) + if id.LongTermRetentionManagedInstanceName, ok = input.Parsed["longTermRetentionManagedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionManagedInstanceName", input) } - if id.LongTermRetentionDatabaseName, ok = parsed.Parsed["longTermRetentionDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionDatabaseName", *parsed) + if id.LongTermRetentionDatabaseName, ok = input.Parsed["longTermRetentionDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionDatabaseName", input) } - if id.LongTermRetentionManagedInstanceBackupName, ok = parsed.Parsed["longTermRetentionManagedInstanceBackupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionManagedInstanceBackupName", *parsed) + if id.LongTermRetentionManagedInstanceBackupName, ok = input.Parsed["longTermRetentionManagedInstanceBackupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionManagedInstanceBackupName", input) } - return &id, nil + return nil } // ValidateLongTermRetentionManagedInstanceBackupID checks that 'input' can be parsed as a Long Term Retention Managed Instance Backup ID diff --git a/resource-manager/sql/2023-02-01-preview/longtermretentionmanagedinstancebackups/id_longtermretentionmanagedinstancelongtermretentiondatabase.go b/resource-manager/sql/2023-02-01-preview/longtermretentionmanagedinstancebackups/id_longtermretentionmanagedinstancelongtermretentiondatabase.go index c437a42c2bf..9eff01937e8 100644 --- a/resource-manager/sql/2023-02-01-preview/longtermretentionmanagedinstancebackups/id_longtermretentionmanagedinstancelongtermretentiondatabase.go +++ b/resource-manager/sql/2023-02-01-preview/longtermretentionmanagedinstancebackups/id_longtermretentionmanagedinstancelongtermretentiondatabase.go @@ -40,27 +40,9 @@ func ParseLongTermRetentionManagedInstanceLongTermRetentionDatabaseID(input stri return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LongTermRetentionManagedInstanceLongTermRetentionDatabaseId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.LongTermRetentionManagedInstanceName, ok = parsed.Parsed["longTermRetentionManagedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionManagedInstanceName", *parsed) - } - - if id.LongTermRetentionDatabaseName, ok = parsed.Parsed["longTermRetentionDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionDatabaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseLongTermRetentionManagedInstanceLongTermRetentionDatabaseIDInsensitive return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LongTermRetentionManagedInstanceLongTermRetentionDatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LongTermRetentionManagedInstanceLongTermRetentionDatabaseId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.LongTermRetentionManagedInstanceName, ok = parsed.Parsed["longTermRetentionManagedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionManagedInstanceName", *parsed) + if id.LongTermRetentionManagedInstanceName, ok = input.Parsed["longTermRetentionManagedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionManagedInstanceName", input) } - if id.LongTermRetentionDatabaseName, ok = parsed.Parsed["longTermRetentionDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionDatabaseName", *parsed) + if id.LongTermRetentionDatabaseName, ok = input.Parsed["longTermRetentionDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "longTermRetentionDatabaseName", input) } - return &id, nil + return nil } // ValidateLongTermRetentionManagedInstanceLongTermRetentionDatabaseID checks that 'input' can be parsed as a Long Term Retention Managed Instance Long Term Retention Database ID diff --git a/resource-manager/sql/2023-02-01-preview/longtermretentionmanagedinstancebackups/id_providerlocation.go b/resource-manager/sql/2023-02-01-preview/longtermretentionmanagedinstancebackups/id_providerlocation.go index 1491e708c81..6640f3ebf7c 100644 --- a/resource-manager/sql/2023-02-01-preview/longtermretentionmanagedinstancebackups/id_providerlocation.go +++ b/resource-manager/sql/2023-02-01-preview/longtermretentionmanagedinstancebackups/id_providerlocation.go @@ -36,19 +36,9 @@ func ParseProviderLocationID(input string) (*ProviderLocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderLocationIDInsensitively(input string) (*ProviderLocationId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderLocationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateProviderLocationID checks that 'input' can be parsed as a Provider Location ID diff --git a/resource-manager/sql/2023-02-01-preview/manageddatabasecolumns/id_schematable.go b/resource-manager/sql/2023-02-01-preview/manageddatabasecolumns/id_schematable.go index 18152ffbe22..3cd50557a17 100644 --- a/resource-manager/sql/2023-02-01-preview/manageddatabasecolumns/id_schematable.go +++ b/resource-manager/sql/2023-02-01-preview/manageddatabasecolumns/id_schematable.go @@ -42,31 +42,9 @@ func ParseSchemaTableID(input string) (*SchemaTableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SchemaTableId{} - - 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) - } - - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) - } - - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseSchemaTableIDInsensitively(input string) (*SchemaTableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SchemaTableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SchemaTableId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedInstanceName, ok = parsed.Parsed["managedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", *parsed) + if id.ManagedInstanceName, ok = input.Parsed["managedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) + if id.SchemaName, ok = input.Parsed["schemaName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "schemaName", input) } - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if id.TableName, ok = input.Parsed["tableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tableName", input) } - return &id, nil + return nil } // ValidateSchemaTableID checks that 'input' can be parsed as a Schema Table ID diff --git a/resource-manager/sql/2023-02-01-preview/manageddatabasecolumns/id_tablecolumn.go b/resource-manager/sql/2023-02-01-preview/manageddatabasecolumns/id_tablecolumn.go index 044aed8adac..99ba89e56ab 100644 --- a/resource-manager/sql/2023-02-01-preview/manageddatabasecolumns/id_tablecolumn.go +++ b/resource-manager/sql/2023-02-01-preview/manageddatabasecolumns/id_tablecolumn.go @@ -44,35 +44,9 @@ func ParseTableColumnID(input string) (*TableColumnId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TableColumnId{} - - 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) - } - - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) - } - - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) - } - - if id.ColumnName, ok = parsed.Parsed["columnName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "columnName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseTableColumnIDInsensitively(input string) (*TableColumnId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TableColumnId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TableColumnId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedInstanceName, ok = parsed.Parsed["managedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", *parsed) + if id.ManagedInstanceName, ok = input.Parsed["managedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) + if id.SchemaName, ok = input.Parsed["schemaName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "schemaName", input) } - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if id.TableName, ok = input.Parsed["tableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tableName", input) } - if id.ColumnName, ok = parsed.Parsed["columnName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "columnName", *parsed) + if id.ColumnName, ok = input.Parsed["columnName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "columnName", input) } - return &id, nil + return nil } // ValidateTableColumnID checks that 'input' can be parsed as a Table Column ID diff --git a/resource-manager/sql/2023-02-01-preview/manageddatabasemoveoperations/id_providerlocation.go b/resource-manager/sql/2023-02-01-preview/manageddatabasemoveoperations/id_providerlocation.go index f7c5d0ce78a..775a8ecaf47 100644 --- a/resource-manager/sql/2023-02-01-preview/manageddatabasemoveoperations/id_providerlocation.go +++ b/resource-manager/sql/2023-02-01-preview/manageddatabasemoveoperations/id_providerlocation.go @@ -36,19 +36,9 @@ func ParseProviderLocationID(input string) (*ProviderLocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderLocationIDInsensitively(input string) (*ProviderLocationId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderLocationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateProviderLocationID checks that 'input' can be parsed as a Provider Location ID diff --git a/resource-manager/sql/2023-02-01-preview/manageddatabasequeries/id_query.go b/resource-manager/sql/2023-02-01-preview/manageddatabasequeries/id_query.go index 3df716d0195..6b1486e8e30 100644 --- a/resource-manager/sql/2023-02-01-preview/manageddatabasequeries/id_query.go +++ b/resource-manager/sql/2023-02-01-preview/manageddatabasequeries/id_query.go @@ -40,27 +40,9 @@ func ParseQueryID(input string) (*QueryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QueryId{} - - 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) - } - - if id.QueryId, ok = parsed.Parsed["queryId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "queryId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseQueryIDInsensitively(input string) (*QueryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QueryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *QueryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedInstanceName, ok = parsed.Parsed["managedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", *parsed) + if id.ManagedInstanceName, ok = input.Parsed["managedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.QueryId, ok = parsed.Parsed["queryId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "queryId", *parsed) + if id.QueryId, ok = input.Parsed["queryId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "queryId", input) } - return &id, nil + return nil } // ValidateQueryID checks that 'input' can be parsed as a Query ID diff --git a/resource-manager/sql/2023-02-01-preview/manageddatabaseschemas/id_databaseschema.go b/resource-manager/sql/2023-02-01-preview/manageddatabaseschemas/id_databaseschema.go index e94d1a6da74..338f42b9e00 100644 --- a/resource-manager/sql/2023-02-01-preview/manageddatabaseschemas/id_databaseschema.go +++ b/resource-manager/sql/2023-02-01-preview/manageddatabaseschemas/id_databaseschema.go @@ -40,27 +40,9 @@ func ParseDatabaseSchemaID(input string) (*DatabaseSchemaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseSchemaId{} - - 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) - } - - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseDatabaseSchemaIDInsensitively(input string) (*DatabaseSchemaId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseSchemaId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DatabaseSchemaId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedInstanceName, ok = parsed.Parsed["managedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", *parsed) + if id.ManagedInstanceName, ok = input.Parsed["managedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) + if id.SchemaName, ok = input.Parsed["schemaName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "schemaName", input) } - return &id, nil + return nil } // ValidateDatabaseSchemaID checks that 'input' can be parsed as a Database Schema ID diff --git a/resource-manager/sql/2023-02-01-preview/manageddatabasesensitivitylabels/id_sensitivitylabelsensitivitylabelsource.go b/resource-manager/sql/2023-02-01-preview/manageddatabasesensitivitylabels/id_sensitivitylabelsensitivitylabelsource.go index 421b5e44c5e..86204c06959 100644 --- a/resource-manager/sql/2023-02-01-preview/manageddatabasesensitivitylabels/id_sensitivitylabelsensitivitylabelsource.go +++ b/resource-manager/sql/2023-02-01-preview/manageddatabasesensitivitylabels/id_sensitivitylabelsensitivitylabelsource.go @@ -46,47 +46,9 @@ func ParseSensitivityLabelSensitivityLabelSourceID(input string) (*SensitivityLa return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SensitivityLabelSensitivityLabelSourceId{} - - 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) - } - - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) - } - - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) - } - - if id.ColumnName, ok = parsed.Parsed["columnName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "columnName", *parsed) - } - - if v, ok := parsed.Parsed["sensitivityLabelSource"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sensitivityLabelSource", *parsed) - } - - sensitivityLabelSource, err := parseSensitivityLabelSource(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.SensitivityLabelSource = *sensitivityLabelSource + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -101,50 +63,58 @@ func ParseSensitivityLabelSensitivityLabelSourceIDInsensitively(input string) (* return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SensitivityLabelSensitivityLabelSourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SensitivityLabelSensitivityLabelSourceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedInstanceName, ok = parsed.Parsed["managedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", *parsed) + if id.ManagedInstanceName, ok = input.Parsed["managedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) + if id.SchemaName, ok = input.Parsed["schemaName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "schemaName", input) } - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if id.TableName, ok = input.Parsed["tableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tableName", input) } - if id.ColumnName, ok = parsed.Parsed["columnName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "columnName", *parsed) + if id.ColumnName, ok = input.Parsed["columnName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "columnName", input) } - if v, ok := parsed.Parsed["sensitivityLabelSource"]; true { + if v, ok := input.Parsed["sensitivityLabelSource"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sensitivityLabelSource", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "sensitivityLabelSource", input) } sensitivityLabelSource, err := parseSensitivityLabelSource(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.SensitivityLabelSource = *sensitivityLabelSource } - return &id, nil + return nil } // ValidateSensitivityLabelSensitivityLabelSourceID checks that 'input' can be parsed as a Sensitivity Label Sensitivity Label Source ID diff --git a/resource-manager/sql/2023-02-01-preview/manageddatabasesensitivitylabels/id_tablecolumn.go b/resource-manager/sql/2023-02-01-preview/manageddatabasesensitivitylabels/id_tablecolumn.go index 632286a770c..768782a4900 100644 --- a/resource-manager/sql/2023-02-01-preview/manageddatabasesensitivitylabels/id_tablecolumn.go +++ b/resource-manager/sql/2023-02-01-preview/manageddatabasesensitivitylabels/id_tablecolumn.go @@ -44,35 +44,9 @@ func ParseTableColumnID(input string) (*TableColumnId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TableColumnId{} - - 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) - } - - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) - } - - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) - } - - if id.ColumnName, ok = parsed.Parsed["columnName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "columnName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseTableColumnIDInsensitively(input string) (*TableColumnId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TableColumnId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TableColumnId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedInstanceName, ok = parsed.Parsed["managedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", *parsed) + if id.ManagedInstanceName, ok = input.Parsed["managedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) + if id.SchemaName, ok = input.Parsed["schemaName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "schemaName", input) } - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if id.TableName, ok = input.Parsed["tableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tableName", input) } - if id.ColumnName, ok = parsed.Parsed["columnName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "columnName", *parsed) + if id.ColumnName, ok = input.Parsed["columnName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "columnName", input) } - return &id, nil + return nil } // ValidateTableColumnID checks that 'input' can be parsed as a Table Column ID diff --git a/resource-manager/sql/2023-02-01-preview/manageddatabasetables/id_databaseschema.go b/resource-manager/sql/2023-02-01-preview/manageddatabasetables/id_databaseschema.go index 66f9af6d784..29ef8994802 100644 --- a/resource-manager/sql/2023-02-01-preview/manageddatabasetables/id_databaseschema.go +++ b/resource-manager/sql/2023-02-01-preview/manageddatabasetables/id_databaseschema.go @@ -40,27 +40,9 @@ func ParseDatabaseSchemaID(input string) (*DatabaseSchemaId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseSchemaId{} - - 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) - } - - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseDatabaseSchemaIDInsensitively(input string) (*DatabaseSchemaId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseSchemaId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DatabaseSchemaId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedInstanceName, ok = parsed.Parsed["managedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", *parsed) + if id.ManagedInstanceName, ok = input.Parsed["managedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) + if id.SchemaName, ok = input.Parsed["schemaName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "schemaName", input) } - return &id, nil + return nil } // ValidateDatabaseSchemaID checks that 'input' can be parsed as a Database Schema ID diff --git a/resource-manager/sql/2023-02-01-preview/manageddatabasetables/id_schematable.go b/resource-manager/sql/2023-02-01-preview/manageddatabasetables/id_schematable.go index 379c0015345..455be6ab639 100644 --- a/resource-manager/sql/2023-02-01-preview/manageddatabasetables/id_schematable.go +++ b/resource-manager/sql/2023-02-01-preview/manageddatabasetables/id_schematable.go @@ -42,31 +42,9 @@ func ParseSchemaTableID(input string) (*SchemaTableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SchemaTableId{} - - 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) - } - - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) - } - - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseSchemaTableIDInsensitively(input string) (*SchemaTableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SchemaTableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SchemaTableId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedInstanceName, ok = parsed.Parsed["managedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", *parsed) + if id.ManagedInstanceName, ok = input.Parsed["managedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) + if id.SchemaName, ok = input.Parsed["schemaName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "schemaName", input) } - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if id.TableName, ok = input.Parsed["tableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tableName", input) } - return &id, nil + return nil } // ValidateSchemaTableID checks that 'input' can be parsed as a Schema Table ID diff --git a/resource-manager/sql/2023-02-01-preview/manageddatabasevulnerabilityassessmentrulebaselines/id_baselinebaseline.go b/resource-manager/sql/2023-02-01-preview/manageddatabasevulnerabilityassessmentrulebaselines/id_baselinebaseline.go index 4fd038f58da..69eeb23548d 100644 --- a/resource-manager/sql/2023-02-01-preview/manageddatabasevulnerabilityassessmentrulebaselines/id_baselinebaseline.go +++ b/resource-manager/sql/2023-02-01-preview/manageddatabasevulnerabilityassessmentrulebaselines/id_baselinebaseline.go @@ -42,39 +42,9 @@ func ParseBaselineBaselineID(input string) (*BaselineBaselineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BaselineBaselineId{} - - 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) - } - - if id.RuleId, ok = parsed.Parsed["ruleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleId", *parsed) - } - - if v, ok := parsed.Parsed["baselineName"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "baselineName", *parsed) - } - - baselineName, err := parseVulnerabilityAssessmentPolicyBaselineName(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.BaselineName = *baselineName + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -89,42 +59,50 @@ func ParseBaselineBaselineIDInsensitively(input string) (*BaselineBaselineId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BaselineBaselineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *BaselineBaselineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedInstanceName, ok = parsed.Parsed["managedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", *parsed) + if id.ManagedInstanceName, ok = input.Parsed["managedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.RuleId, ok = parsed.Parsed["ruleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleId", *parsed) + if id.RuleId, ok = input.Parsed["ruleId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleId", input) } - if v, ok := parsed.Parsed["baselineName"]; true { + if v, ok := input.Parsed["baselineName"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "baselineName", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "baselineName", input) } baselineName, err := parseVulnerabilityAssessmentPolicyBaselineName(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.BaselineName = *baselineName } - return &id, nil + return nil } // ValidateBaselineBaselineID checks that 'input' can be parsed as a Baseline Baseline ID diff --git a/resource-manager/sql/2023-02-01-preview/manageddatabasevulnerabilityassessmentscans/id_vulnerabilityassessmentvulnerabilityassessmentscan.go b/resource-manager/sql/2023-02-01-preview/manageddatabasevulnerabilityassessmentscans/id_vulnerabilityassessmentvulnerabilityassessmentscan.go index 1ff2a0ae7c1..edbdcbe4267 100644 --- a/resource-manager/sql/2023-02-01-preview/manageddatabasevulnerabilityassessmentscans/id_vulnerabilityassessmentvulnerabilityassessmentscan.go +++ b/resource-manager/sql/2023-02-01-preview/manageddatabasevulnerabilityassessmentscans/id_vulnerabilityassessmentvulnerabilityassessmentscan.go @@ -40,27 +40,9 @@ func ParseVulnerabilityAssessmentVulnerabilityAssessmentScanID(input string) (*V return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VulnerabilityAssessmentVulnerabilityAssessmentScanId{} - - 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) - } - - if id.ScanId, ok = parsed.Parsed["scanId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scanId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVulnerabilityAssessmentVulnerabilityAssessmentScanIDInsensitively(inpu return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VulnerabilityAssessmentVulnerabilityAssessmentScanId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VulnerabilityAssessmentVulnerabilityAssessmentScanId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedInstanceName, ok = parsed.Parsed["managedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", *parsed) + if id.ManagedInstanceName, ok = input.Parsed["managedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.ScanId, ok = parsed.Parsed["scanId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scanId", *parsed) + if id.ScanId, ok = input.Parsed["scanId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scanId", input) } - return &id, nil + return nil } // ValidateVulnerabilityAssessmentVulnerabilityAssessmentScanID checks that 'input' can be parsed as a Vulnerability Assessment Vulnerability Assessment Scan ID diff --git a/resource-manager/sql/2023-02-01-preview/managedinstancekeys/id_managedinstancekey.go b/resource-manager/sql/2023-02-01-preview/managedinstancekeys/id_managedinstancekey.go index 3172e7deec9..4ec41a392ad 100644 --- a/resource-manager/sql/2023-02-01-preview/managedinstancekeys/id_managedinstancekey.go +++ b/resource-manager/sql/2023-02-01-preview/managedinstancekeys/id_managedinstancekey.go @@ -38,23 +38,9 @@ func ParseManagedInstanceKeyID(input string) (*ManagedInstanceKeyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedInstanceKeyId{} - - 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.KeyName, ok = parsed.Parsed["keyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseManagedInstanceKeyIDInsensitively(input string) (*ManagedInstanceKeyId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedInstanceKeyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ManagedInstanceKeyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedInstanceName, ok = parsed.Parsed["managedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", *parsed) + if id.ManagedInstanceName, ok = input.Parsed["managedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", input) } - if id.KeyName, ok = parsed.Parsed["keyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyName", *parsed) + if id.KeyName, ok = input.Parsed["keyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "keyName", input) } - return &id, nil + return nil } // ValidateManagedInstanceKeyID checks that 'input' can be parsed as a Managed Instance Key ID diff --git a/resource-manager/sql/2023-02-01-preview/managedinstanceprivateendpointconnections/id_managedinstanceprivateendpointconnection.go b/resource-manager/sql/2023-02-01-preview/managedinstanceprivateendpointconnections/id_managedinstanceprivateendpointconnection.go index addd26fc90f..55bfb52fba4 100644 --- a/resource-manager/sql/2023-02-01-preview/managedinstanceprivateendpointconnections/id_managedinstanceprivateendpointconnection.go +++ b/resource-manager/sql/2023-02-01-preview/managedinstanceprivateendpointconnections/id_managedinstanceprivateendpointconnection.go @@ -38,23 +38,9 @@ func ParseManagedInstancePrivateEndpointConnectionID(input string) (*ManagedInst return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedInstancePrivateEndpointConnectionId{} - - 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.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseManagedInstancePrivateEndpointConnectionIDInsensitively(input string) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedInstancePrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ManagedInstancePrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedInstanceName, ok = parsed.Parsed["managedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", *parsed) + if id.ManagedInstanceName, ok = input.Parsed["managedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidateManagedInstancePrivateEndpointConnectionID checks that 'input' can be parsed as a Managed Instance Private Endpoint Connection ID diff --git a/resource-manager/sql/2023-02-01-preview/managedinstanceprivatelinkresources/id_managedinstanceprivatelinkresource.go b/resource-manager/sql/2023-02-01-preview/managedinstanceprivatelinkresources/id_managedinstanceprivatelinkresource.go index d33dcc1c364..940aba153f3 100644 --- a/resource-manager/sql/2023-02-01-preview/managedinstanceprivatelinkresources/id_managedinstanceprivatelinkresource.go +++ b/resource-manager/sql/2023-02-01-preview/managedinstanceprivatelinkresources/id_managedinstanceprivatelinkresource.go @@ -38,23 +38,9 @@ func ParseManagedInstancePrivateLinkResourceID(input string) (*ManagedInstancePr return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedInstancePrivateLinkResourceId{} - - 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.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseManagedInstancePrivateLinkResourceIDInsensitively(input string) (*Mana return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedInstancePrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ManagedInstancePrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedInstanceName, ok = parsed.Parsed["managedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", *parsed) + if id.ManagedInstanceName, ok = input.Parsed["managedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidateManagedInstancePrivateLinkResourceID checks that 'input' can be parsed as a Managed Instance Private Link Resource ID diff --git a/resource-manager/sql/2023-02-01-preview/managedinstances/id_instancepool.go b/resource-manager/sql/2023-02-01-preview/managedinstances/id_instancepool.go index 0e487a0561b..e13cb30db31 100644 --- a/resource-manager/sql/2023-02-01-preview/managedinstances/id_instancepool.go +++ b/resource-manager/sql/2023-02-01-preview/managedinstances/id_instancepool.go @@ -36,19 +36,9 @@ func ParseInstancePoolID(input string) (*InstancePoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InstancePoolId{} - - 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.InstancePoolName, ok = parsed.Parsed["instancePoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instancePoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseInstancePoolIDInsensitively(input string) (*InstancePoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InstancePoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *InstancePoolId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.InstancePoolName, ok = parsed.Parsed["instancePoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instancePoolName", *parsed) + if id.InstancePoolName, ok = input.Parsed["instancePoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instancePoolName", input) } - return &id, nil + return nil } // ValidateInstancePoolID checks that 'input' can be parsed as a Instance Pool ID diff --git a/resource-manager/sql/2023-02-01-preview/managedrestorabledroppeddatabasebackupshorttermretentionpolicies/id_managedinstancerestorabledroppeddatabase.go b/resource-manager/sql/2023-02-01-preview/managedrestorabledroppeddatabasebackupshorttermretentionpolicies/id_managedinstancerestorabledroppeddatabase.go index 13cf3f3c408..a485a28da49 100644 --- a/resource-manager/sql/2023-02-01-preview/managedrestorabledroppeddatabasebackupshorttermretentionpolicies/id_managedinstancerestorabledroppeddatabase.go +++ b/resource-manager/sql/2023-02-01-preview/managedrestorabledroppeddatabasebackupshorttermretentionpolicies/id_managedinstancerestorabledroppeddatabase.go @@ -38,23 +38,9 @@ func ParseManagedInstanceRestorableDroppedDatabaseID(input string) (*ManagedInst return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedInstanceRestorableDroppedDatabaseId{} - - 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.RestorableDroppedDatabaseId, ok = parsed.Parsed["restorableDroppedDatabaseId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorableDroppedDatabaseId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseManagedInstanceRestorableDroppedDatabaseIDInsensitively(input string) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedInstanceRestorableDroppedDatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ManagedInstanceRestorableDroppedDatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedInstanceName, ok = parsed.Parsed["managedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", *parsed) + if id.ManagedInstanceName, ok = input.Parsed["managedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", input) } - if id.RestorableDroppedDatabaseId, ok = parsed.Parsed["restorableDroppedDatabaseId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorableDroppedDatabaseId", *parsed) + if id.RestorableDroppedDatabaseId, ok = input.Parsed["restorableDroppedDatabaseId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "restorableDroppedDatabaseId", input) } - return &id, nil + return nil } // ValidateManagedInstanceRestorableDroppedDatabaseID checks that 'input' can be parsed as a Managed Instance Restorable Dropped Database ID diff --git a/resource-manager/sql/2023-02-01-preview/managedserverdnsaliases/id_managedinstancednsalias.go b/resource-manager/sql/2023-02-01-preview/managedserverdnsaliases/id_managedinstancednsalias.go index d65ecaf8868..93e6bd9546f 100644 --- a/resource-manager/sql/2023-02-01-preview/managedserverdnsaliases/id_managedinstancednsalias.go +++ b/resource-manager/sql/2023-02-01-preview/managedserverdnsaliases/id_managedinstancednsalias.go @@ -38,23 +38,9 @@ func ParseManagedInstanceDnsAliasID(input string) (*ManagedInstanceDnsAliasId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedInstanceDnsAliasId{} - - 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.DnsAliasName, ok = parsed.Parsed["dnsAliasName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dnsAliasName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseManagedInstanceDnsAliasIDInsensitively(input string) (*ManagedInstance return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedInstanceDnsAliasId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ManagedInstanceDnsAliasId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedInstanceName, ok = parsed.Parsed["managedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", *parsed) + if id.ManagedInstanceName, ok = input.Parsed["managedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", input) } - if id.DnsAliasName, ok = parsed.Parsed["dnsAliasName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dnsAliasName", *parsed) + if id.DnsAliasName, ok = input.Parsed["dnsAliasName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dnsAliasName", input) } - return &id, nil + return nil } // ValidateManagedInstanceDnsAliasID checks that 'input' can be parsed as a Managed Instance Dns Alias ID diff --git a/resource-manager/sql/2023-02-01-preview/networksecurityperimeterconfigurations/id_networksecurityperimeterconfiguration.go b/resource-manager/sql/2023-02-01-preview/networksecurityperimeterconfigurations/id_networksecurityperimeterconfiguration.go index c52102bf91b..b0bd421c9e4 100644 --- a/resource-manager/sql/2023-02-01-preview/networksecurityperimeterconfigurations/id_networksecurityperimeterconfiguration.go +++ b/resource-manager/sql/2023-02-01-preview/networksecurityperimeterconfigurations/id_networksecurityperimeterconfiguration.go @@ -38,23 +38,9 @@ func ParseNetworkSecurityPerimeterConfigurationID(input string) (*NetworkSecurit return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkSecurityPerimeterConfigurationId{} - - 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.NetworkSecurityPerimeterConfigurationName, ok = parsed.Parsed["networkSecurityPerimeterConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkSecurityPerimeterConfigurationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseNetworkSecurityPerimeterConfigurationIDInsensitively(input string) (*N return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkSecurityPerimeterConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *NetworkSecurityPerimeterConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.NetworkSecurityPerimeterConfigurationName, ok = parsed.Parsed["networkSecurityPerimeterConfigurationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkSecurityPerimeterConfigurationName", *parsed) + if id.NetworkSecurityPerimeterConfigurationName, ok = input.Parsed["networkSecurityPerimeterConfigurationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkSecurityPerimeterConfigurationName", input) } - return &id, nil + return nil } // ValidateNetworkSecurityPerimeterConfigurationID checks that 'input' can be parsed as a Network Security Perimeter Configuration ID diff --git a/resource-manager/sql/2023-02-01-preview/outboundfirewallrules/id_outboundfirewallrule.go b/resource-manager/sql/2023-02-01-preview/outboundfirewallrules/id_outboundfirewallrule.go index 7a99e8f4b30..5f0d7c0a0a7 100644 --- a/resource-manager/sql/2023-02-01-preview/outboundfirewallrules/id_outboundfirewallrule.go +++ b/resource-manager/sql/2023-02-01-preview/outboundfirewallrules/id_outboundfirewallrule.go @@ -38,23 +38,9 @@ func ParseOutboundFirewallRuleID(input string) (*OutboundFirewallRuleId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OutboundFirewallRuleId{} - - 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.OutboundFirewallRuleName, ok = parsed.Parsed["outboundFirewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "outboundFirewallRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseOutboundFirewallRuleIDInsensitively(input string) (*OutboundFirewallRu return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OutboundFirewallRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OutboundFirewallRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.OutboundFirewallRuleName, ok = parsed.Parsed["outboundFirewallRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "outboundFirewallRuleName", *parsed) + if id.OutboundFirewallRuleName, ok = input.Parsed["outboundFirewallRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "outboundFirewallRuleName", input) } - return &id, nil + return nil } // ValidateOutboundFirewallRuleID checks that 'input' can be parsed as a Outbound Firewall Rule ID diff --git a/resource-manager/sql/2023-02-01-preview/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/sql/2023-02-01-preview/privateendpointconnections/id_privateendpointconnection.go index c999025c9bd..6dd2c18860a 100644 --- a/resource-manager/sql/2023-02-01-preview/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/sql/2023-02-01-preview/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/sql/2023-02-01-preview/privatelinkresources/id_privatelinkresource.go b/resource-manager/sql/2023-02-01-preview/privatelinkresources/id_privatelinkresource.go index 321724cd4a5..0480d25b0b9 100644 --- a/resource-manager/sql/2023-02-01-preview/privatelinkresources/id_privatelinkresource.go +++ b/resource-manager/sql/2023-02-01-preview/privatelinkresources/id_privatelinkresource.go @@ -38,23 +38,9 @@ func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} - - 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.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResource return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.PrivateLinkResourceName, ok = parsed.Parsed["privateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", *parsed) + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) } - return &id, nil + return nil } // ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID diff --git a/resource-manager/sql/2023-02-01-preview/recoverabledatabases/id_recoverabledatabase.go b/resource-manager/sql/2023-02-01-preview/recoverabledatabases/id_recoverabledatabase.go index 33e5ab1a439..c18ba97a78f 100644 --- a/resource-manager/sql/2023-02-01-preview/recoverabledatabases/id_recoverabledatabase.go +++ b/resource-manager/sql/2023-02-01-preview/recoverabledatabases/id_recoverabledatabase.go @@ -38,23 +38,9 @@ func ParseRecoverableDatabaseID(input string) (*RecoverableDatabaseId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecoverableDatabaseId{} - - 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.RecoverableDatabaseName, ok = parsed.Parsed["recoverableDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoverableDatabaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRecoverableDatabaseIDInsensitively(input string) (*RecoverableDatabase return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecoverableDatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RecoverableDatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.RecoverableDatabaseName, ok = parsed.Parsed["recoverableDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoverableDatabaseName", *parsed) + if id.RecoverableDatabaseName, ok = input.Parsed["recoverableDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "recoverableDatabaseName", input) } - return &id, nil + return nil } // ValidateRecoverableDatabaseID checks that 'input' can be parsed as a Recoverable Database ID diff --git a/resource-manager/sql/2023-02-01-preview/recoverablemanageddatabases/id_managedinstancerecoverabledatabase.go b/resource-manager/sql/2023-02-01-preview/recoverablemanageddatabases/id_managedinstancerecoverabledatabase.go index 5234802e686..bd315387c0e 100644 --- a/resource-manager/sql/2023-02-01-preview/recoverablemanageddatabases/id_managedinstancerecoverabledatabase.go +++ b/resource-manager/sql/2023-02-01-preview/recoverablemanageddatabases/id_managedinstancerecoverabledatabase.go @@ -38,23 +38,9 @@ func ParseManagedInstanceRecoverableDatabaseID(input string) (*ManagedInstanceRe return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedInstanceRecoverableDatabaseId{} - - 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.RecoverableDatabaseName, ok = parsed.Parsed["recoverableDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoverableDatabaseName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseManagedInstanceRecoverableDatabaseIDInsensitively(input string) (*Mana return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedInstanceRecoverableDatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ManagedInstanceRecoverableDatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedInstanceName, ok = parsed.Parsed["managedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", *parsed) + if id.ManagedInstanceName, ok = input.Parsed["managedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", input) } - if id.RecoverableDatabaseName, ok = parsed.Parsed["recoverableDatabaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recoverableDatabaseName", *parsed) + if id.RecoverableDatabaseName, ok = input.Parsed["recoverableDatabaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "recoverableDatabaseName", input) } - return &id, nil + return nil } // ValidateManagedInstanceRecoverableDatabaseID checks that 'input' can be parsed as a Managed Instance Recoverable Database ID diff --git a/resource-manager/sql/2023-02-01-preview/replicationlinks/id_replicationlink.go b/resource-manager/sql/2023-02-01-preview/replicationlinks/id_replicationlink.go index b52b0a8cdde..53030897c0c 100644 --- a/resource-manager/sql/2023-02-01-preview/replicationlinks/id_replicationlink.go +++ b/resource-manager/sql/2023-02-01-preview/replicationlinks/id_replicationlink.go @@ -40,27 +40,9 @@ func ParseReplicationLinkID(input string) (*ReplicationLinkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationLinkId{} - - 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) - } - - if id.LinkId, ok = parsed.Parsed["linkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "linkId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseReplicationLinkIDInsensitively(input string) (*ReplicationLinkId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReplicationLinkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ReplicationLinkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.LinkId, ok = parsed.Parsed["linkId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "linkId", *parsed) + if id.LinkId, ok = input.Parsed["linkId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "linkId", input) } - return &id, nil + return nil } // ValidateReplicationLinkID checks that 'input' can be parsed as a Replication Link ID diff --git a/resource-manager/sql/2023-02-01-preview/restorabledroppeddatabases/id_restorabledroppeddatabase.go b/resource-manager/sql/2023-02-01-preview/restorabledroppeddatabases/id_restorabledroppeddatabase.go index e74c7485a1a..24938893ff8 100644 --- a/resource-manager/sql/2023-02-01-preview/restorabledroppeddatabases/id_restorabledroppeddatabase.go +++ b/resource-manager/sql/2023-02-01-preview/restorabledroppeddatabases/id_restorabledroppeddatabase.go @@ -38,23 +38,9 @@ func ParseRestorableDroppedDatabaseID(input string) (*RestorableDroppedDatabaseI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RestorableDroppedDatabaseId{} - - 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.RestorableDroppedDatabaseId, ok = parsed.Parsed["restorableDroppedDatabaseId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorableDroppedDatabaseId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRestorableDroppedDatabaseIDInsensitively(input string) (*RestorableDro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RestorableDroppedDatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RestorableDroppedDatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.RestorableDroppedDatabaseId, ok = parsed.Parsed["restorableDroppedDatabaseId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorableDroppedDatabaseId", *parsed) + if id.RestorableDroppedDatabaseId, ok = input.Parsed["restorableDroppedDatabaseId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "restorableDroppedDatabaseId", input) } - return &id, nil + return nil } // ValidateRestorableDroppedDatabaseID checks that 'input' can be parsed as a Restorable Dropped Database ID diff --git a/resource-manager/sql/2023-02-01-preview/restorabledroppedmanageddatabases/id_managedinstancerestorabledroppeddatabase.go b/resource-manager/sql/2023-02-01-preview/restorabledroppedmanageddatabases/id_managedinstancerestorabledroppeddatabase.go index d1d18d16cdf..0183af9c3f2 100644 --- a/resource-manager/sql/2023-02-01-preview/restorabledroppedmanageddatabases/id_managedinstancerestorabledroppeddatabase.go +++ b/resource-manager/sql/2023-02-01-preview/restorabledroppedmanageddatabases/id_managedinstancerestorabledroppeddatabase.go @@ -38,23 +38,9 @@ func ParseManagedInstanceRestorableDroppedDatabaseID(input string) (*ManagedInst return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedInstanceRestorableDroppedDatabaseId{} - - 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.RestorableDroppedDatabaseId, ok = parsed.Parsed["restorableDroppedDatabaseId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorableDroppedDatabaseId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseManagedInstanceRestorableDroppedDatabaseIDInsensitively(input string) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedInstanceRestorableDroppedDatabaseId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ManagedInstanceRestorableDroppedDatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedInstanceName, ok = parsed.Parsed["managedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", *parsed) + if id.ManagedInstanceName, ok = input.Parsed["managedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", input) } - if id.RestorableDroppedDatabaseId, ok = parsed.Parsed["restorableDroppedDatabaseId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorableDroppedDatabaseId", *parsed) + if id.RestorableDroppedDatabaseId, ok = input.Parsed["restorableDroppedDatabaseId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "restorableDroppedDatabaseId", input) } - return &id, nil + return nil } // ValidateManagedInstanceRestorableDroppedDatabaseID checks that 'input' can be parsed as a Managed Instance Restorable Dropped Database ID diff --git a/resource-manager/sql/2023-02-01-preview/restorepoints/id_restorepoint.go b/resource-manager/sql/2023-02-01-preview/restorepoints/id_restorepoint.go index 39d6aad5f63..69c13f7e650 100644 --- a/resource-manager/sql/2023-02-01-preview/restorepoints/id_restorepoint.go +++ b/resource-manager/sql/2023-02-01-preview/restorepoints/id_restorepoint.go @@ -40,27 +40,9 @@ func ParseRestorePointID(input string) (*RestorePointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RestorePointId{} - - 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) - } - - if id.RestorePointName, ok = parsed.Parsed["restorePointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorePointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseRestorePointIDInsensitively(input string) (*RestorePointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RestorePointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RestorePointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.RestorePointName, ok = parsed.Parsed["restorePointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "restorePointName", *parsed) + if id.RestorePointName, ok = input.Parsed["restorePointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "restorePointName", input) } - return &id, nil + return nil } // ValidateRestorePointID checks that 'input' can be parsed as a Restore Point ID diff --git a/resource-manager/sql/2023-02-01-preview/sensitivitylabels/id_column.go b/resource-manager/sql/2023-02-01-preview/sensitivitylabels/id_column.go index fbc50969030..5c7a543cc0f 100644 --- a/resource-manager/sql/2023-02-01-preview/sensitivitylabels/id_column.go +++ b/resource-manager/sql/2023-02-01-preview/sensitivitylabels/id_column.go @@ -44,35 +44,9 @@ func ParseColumnID(input string) (*ColumnId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ColumnId{} - - 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) - } - - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) - } - - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) - } - - if id.ColumnName, ok = parsed.Parsed["columnName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "columnName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseColumnIDInsensitively(input string) (*ColumnId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ColumnId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ColumnId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) + if id.SchemaName, ok = input.Parsed["schemaName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "schemaName", input) } - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if id.TableName, ok = input.Parsed["tableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tableName", input) } - if id.ColumnName, ok = parsed.Parsed["columnName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "columnName", *parsed) + if id.ColumnName, ok = input.Parsed["columnName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "columnName", input) } - return &id, nil + return nil } // ValidateColumnID checks that 'input' can be parsed as a Column ID diff --git a/resource-manager/sql/2023-02-01-preview/sensitivitylabels/id_sensitivitylabelsource.go b/resource-manager/sql/2023-02-01-preview/sensitivitylabels/id_sensitivitylabelsource.go index 3bf8e29fd73..6f8c60339a5 100644 --- a/resource-manager/sql/2023-02-01-preview/sensitivitylabels/id_sensitivitylabelsource.go +++ b/resource-manager/sql/2023-02-01-preview/sensitivitylabels/id_sensitivitylabelsource.go @@ -46,47 +46,9 @@ func ParseSensitivityLabelSourceID(input string) (*SensitivityLabelSourceId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SensitivityLabelSourceId{} - - 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) - } - - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) - } - - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) - } - - if id.ColumnName, ok = parsed.Parsed["columnName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "columnName", *parsed) - } - - if v, ok := parsed.Parsed["sensitivityLabelSource"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sensitivityLabelSource", *parsed) - } - - sensitivityLabelSource, err := parseSensitivityLabelSource(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.SensitivityLabelSource = *sensitivityLabelSource + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -101,50 +63,58 @@ func ParseSensitivityLabelSourceIDInsensitively(input string) (*SensitivityLabel return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SensitivityLabelSourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SensitivityLabelSourceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.SchemaName, ok = parsed.Parsed["schemaName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "schemaName", *parsed) + if id.SchemaName, ok = input.Parsed["schemaName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "schemaName", input) } - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if id.TableName, ok = input.Parsed["tableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tableName", input) } - if id.ColumnName, ok = parsed.Parsed["columnName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "columnName", *parsed) + if id.ColumnName, ok = input.Parsed["columnName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "columnName", input) } - if v, ok := parsed.Parsed["sensitivityLabelSource"]; true { + if v, ok := input.Parsed["sensitivityLabelSource"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sensitivityLabelSource", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "sensitivityLabelSource", input) } sensitivityLabelSource, err := parseSensitivityLabelSource(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.SensitivityLabelSource = *sensitivityLabelSource } - return &id, nil + return nil } // ValidateSensitivityLabelSourceID checks that 'input' can be parsed as a Sensitivity Label Source ID diff --git a/resource-manager/sql/2023-02-01-preview/serveradvisors/id_advisor.go b/resource-manager/sql/2023-02-01-preview/serveradvisors/id_advisor.go index 9cd05831438..c5bde2e23d2 100644 --- a/resource-manager/sql/2023-02-01-preview/serveradvisors/id_advisor.go +++ b/resource-manager/sql/2023-02-01-preview/serveradvisors/id_advisor.go @@ -38,23 +38,9 @@ func ParseAdvisorID(input string) (*AdvisorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AdvisorId{} - - 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.AdvisorName, ok = parsed.Parsed["advisorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "advisorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAdvisorIDInsensitively(input string) (*AdvisorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AdvisorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AdvisorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.AdvisorName, ok = parsed.Parsed["advisorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "advisorName", *parsed) + if id.AdvisorName, ok = input.Parsed["advisorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "advisorName", input) } - return &id, nil + return nil } // ValidateAdvisorID checks that 'input' can be parsed as a Advisor ID diff --git a/resource-manager/sql/2023-02-01-preview/serverdnsaliases/id_dnsalias.go b/resource-manager/sql/2023-02-01-preview/serverdnsaliases/id_dnsalias.go index 889fd9aaa1c..3e81d19204f 100644 --- a/resource-manager/sql/2023-02-01-preview/serverdnsaliases/id_dnsalias.go +++ b/resource-manager/sql/2023-02-01-preview/serverdnsaliases/id_dnsalias.go @@ -38,23 +38,9 @@ func ParseDnsAliasID(input string) (*DnsAliasId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DnsAliasId{} - - 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.DnsAliasName, ok = parsed.Parsed["dnsAliasName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dnsAliasName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDnsAliasIDInsensitively(input string) (*DnsAliasId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DnsAliasId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DnsAliasId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DnsAliasName, ok = parsed.Parsed["dnsAliasName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dnsAliasName", *parsed) + if id.DnsAliasName, ok = input.Parsed["dnsAliasName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dnsAliasName", input) } - return &id, nil + return nil } // ValidateDnsAliasID checks that 'input' can be parsed as a Dns Alias ID diff --git a/resource-manager/sql/2023-02-01-preview/serverkeys/id_key.go b/resource-manager/sql/2023-02-01-preview/serverkeys/id_key.go index e354e8fdcf4..8dbe212e996 100644 --- a/resource-manager/sql/2023-02-01-preview/serverkeys/id_key.go +++ b/resource-manager/sql/2023-02-01-preview/serverkeys/id_key.go @@ -38,23 +38,9 @@ func ParseKeyID(input string) (*KeyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := KeyId{} - - 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.KeyName, ok = parsed.Parsed["keyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseKeyIDInsensitively(input string) (*KeyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := KeyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *KeyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.KeyName, ok = parsed.Parsed["keyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyName", *parsed) + if id.KeyName, ok = input.Parsed["keyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "keyName", input) } - return &id, nil + return nil } // ValidateKeyID checks that 'input' can be parsed as a Key ID diff --git a/resource-manager/sql/2023-02-01-preview/servertrustcertificates/id_servertrustcertificate.go b/resource-manager/sql/2023-02-01-preview/servertrustcertificates/id_servertrustcertificate.go index cd245ff1bc6..d79dc7ca621 100644 --- a/resource-manager/sql/2023-02-01-preview/servertrustcertificates/id_servertrustcertificate.go +++ b/resource-manager/sql/2023-02-01-preview/servertrustcertificates/id_servertrustcertificate.go @@ -38,23 +38,9 @@ func ParseServerTrustCertificateID(input string) (*ServerTrustCertificateId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerTrustCertificateId{} - - 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.ServerTrustCertificateName, ok = parsed.Parsed["serverTrustCertificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverTrustCertificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseServerTrustCertificateIDInsensitively(input string) (*ServerTrustCerti return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerTrustCertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ServerTrustCertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ManagedInstanceName, ok = parsed.Parsed["managedInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", *parsed) + if id.ManagedInstanceName, ok = input.Parsed["managedInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedInstanceName", input) } - if id.ServerTrustCertificateName, ok = parsed.Parsed["serverTrustCertificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverTrustCertificateName", *parsed) + if id.ServerTrustCertificateName, ok = input.Parsed["serverTrustCertificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverTrustCertificateName", input) } - return &id, nil + return nil } // ValidateServerTrustCertificateID checks that 'input' can be parsed as a Server Trust Certificate ID diff --git a/resource-manager/sql/2023-02-01-preview/servertrustgroups/id_providerlocation.go b/resource-manager/sql/2023-02-01-preview/servertrustgroups/id_providerlocation.go index d0b84fe7264..8708637d822 100644 --- a/resource-manager/sql/2023-02-01-preview/servertrustgroups/id_providerlocation.go +++ b/resource-manager/sql/2023-02-01-preview/servertrustgroups/id_providerlocation.go @@ -36,19 +36,9 @@ func ParseProviderLocationID(input string) (*ProviderLocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderLocationIDInsensitively(input string) (*ProviderLocationId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderLocationId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateProviderLocationID checks that 'input' can be parsed as a Provider Location ID diff --git a/resource-manager/sql/2023-02-01-preview/servertrustgroups/id_servertrustgroup.go b/resource-manager/sql/2023-02-01-preview/servertrustgroups/id_servertrustgroup.go index f223ee13fbb..30ef83c526b 100644 --- a/resource-manager/sql/2023-02-01-preview/servertrustgroups/id_servertrustgroup.go +++ b/resource-manager/sql/2023-02-01-preview/servertrustgroups/id_servertrustgroup.go @@ -38,23 +38,9 @@ func ParseServerTrustGroupID(input string) (*ServerTrustGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerTrustGroupId{} - - 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.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.ServerTrustGroupName, ok = parsed.Parsed["serverTrustGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverTrustGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseServerTrustGroupIDInsensitively(input string) (*ServerTrustGroupId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerTrustGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ServerTrustGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.ServerTrustGroupName, ok = parsed.Parsed["serverTrustGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverTrustGroupName", *parsed) + if id.ServerTrustGroupName, ok = input.Parsed["serverTrustGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverTrustGroupName", input) } - return &id, nil + return nil } // ValidateServerTrustGroupID checks that 'input' can be parsed as a Server Trust Group ID diff --git a/resource-manager/sql/2023-02-01-preview/sqlvulnerabilityassessmentrulebaseline/id_rule.go b/resource-manager/sql/2023-02-01-preview/sqlvulnerabilityassessmentrulebaseline/id_rule.go index 17794d3c381..f7c701e1b94 100644 --- a/resource-manager/sql/2023-02-01-preview/sqlvulnerabilityassessmentrulebaseline/id_rule.go +++ b/resource-manager/sql/2023-02-01-preview/sqlvulnerabilityassessmentrulebaseline/id_rule.go @@ -38,23 +38,9 @@ func ParseRuleID(input string) (*RuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RuleId{} - - 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.RuleId, ok = parsed.Parsed["ruleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRuleIDInsensitively(input string) (*RuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.RuleId, ok = parsed.Parsed["ruleId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "ruleId", *parsed) + if id.RuleId, ok = input.Parsed["ruleId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "ruleId", input) } - return &id, nil + return nil } // ValidateRuleID checks that 'input' can be parsed as a Rule ID diff --git a/resource-manager/sql/2023-02-01-preview/sqlvulnerabilityassessmentscanresult/id_scan.go b/resource-manager/sql/2023-02-01-preview/sqlvulnerabilityassessmentscanresult/id_scan.go index dcafb78bb3f..0a2ef362972 100644 --- a/resource-manager/sql/2023-02-01-preview/sqlvulnerabilityassessmentscanresult/id_scan.go +++ b/resource-manager/sql/2023-02-01-preview/sqlvulnerabilityassessmentscanresult/id_scan.go @@ -38,23 +38,9 @@ func ParseScanID(input string) (*ScanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScanId{} - - 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.ScanId, ok = parsed.Parsed["scanId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scanId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseScanIDInsensitively(input string) (*ScanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScanId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ScanId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.ScanId, ok = parsed.Parsed["scanId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scanId", *parsed) + if id.ScanId, ok = input.Parsed["scanId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scanId", input) } - return &id, nil + return nil } // ValidateScanID checks that 'input' can be parsed as a Scan ID diff --git a/resource-manager/sql/2023-02-01-preview/sqlvulnerabilityassessmentscanresult/id_scanresult.go b/resource-manager/sql/2023-02-01-preview/sqlvulnerabilityassessmentscanresult/id_scanresult.go index fe94241a383..9e5185f8c10 100644 --- a/resource-manager/sql/2023-02-01-preview/sqlvulnerabilityassessmentscanresult/id_scanresult.go +++ b/resource-manager/sql/2023-02-01-preview/sqlvulnerabilityassessmentscanresult/id_scanresult.go @@ -40,27 +40,9 @@ func ParseScanResultID(input string) (*ScanResultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScanResultId{} - - 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.ScanId, ok = parsed.Parsed["scanId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scanId", *parsed) - } - - if id.ScanResultId, ok = parsed.Parsed["scanResultId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scanResultId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseScanResultIDInsensitively(input string) (*ScanResultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScanResultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ScanResultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.ScanId, ok = parsed.Parsed["scanId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scanId", *parsed) + if id.ScanId, ok = input.Parsed["scanId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scanId", input) } - if id.ScanResultId, ok = parsed.Parsed["scanResultId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scanResultId", *parsed) + if id.ScanResultId, ok = input.Parsed["scanResultId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scanResultId", input) } - return &id, nil + return nil } // ValidateScanResultID checks that 'input' can be parsed as a Scan Result ID diff --git a/resource-manager/sql/2023-02-01-preview/sqlvulnerabilityassessmentscans/id_scan.go b/resource-manager/sql/2023-02-01-preview/sqlvulnerabilityassessmentscans/id_scan.go index 933b1642a3d..228006b23d8 100644 --- a/resource-manager/sql/2023-02-01-preview/sqlvulnerabilityassessmentscans/id_scan.go +++ b/resource-manager/sql/2023-02-01-preview/sqlvulnerabilityassessmentscans/id_scan.go @@ -38,23 +38,9 @@ func ParseScanID(input string) (*ScanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScanId{} - - 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.ScanId, ok = parsed.Parsed["scanId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scanId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseScanIDInsensitively(input string) (*ScanId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScanId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ScanId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.ScanId, ok = parsed.Parsed["scanId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scanId", *parsed) + if id.ScanId, ok = input.Parsed["scanId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scanId", input) } - return &id, nil + return nil } // ValidateScanID checks that 'input' can be parsed as a Scan ID diff --git a/resource-manager/sql/2023-02-01-preview/subscriptionusages/id_location.go b/resource-manager/sql/2023-02-01-preview/subscriptionusages/id_location.go index c365f439611..9c89f1c7c1f 100644 --- a/resource-manager/sql/2023-02-01-preview/subscriptionusages/id_location.go +++ b/resource-manager/sql/2023-02-01-preview/subscriptionusages/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/sql/2023-02-01-preview/subscriptionusages/id_usage.go b/resource-manager/sql/2023-02-01-preview/subscriptionusages/id_usage.go index 3a594d6884a..8ae1ff46fba 100644 --- a/resource-manager/sql/2023-02-01-preview/subscriptionusages/id_usage.go +++ b/resource-manager/sql/2023-02-01-preview/subscriptionusages/id_usage.go @@ -36,19 +36,9 @@ func ParseUsageID(input string) (*UsageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UsageId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.UsageName, ok = parsed.Parsed["usageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "usageName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseUsageIDInsensitively(input string) (*UsageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UsageId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *UsageId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.UsageName, ok = parsed.Parsed["usageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "usageName", *parsed) + if id.UsageName, ok = input.Parsed["usageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "usageName", input) } - return &id, nil + return nil } // ValidateUsageID checks that 'input' can be parsed as a Usage ID diff --git a/resource-manager/sql/2023-02-01-preview/syncagents/id_syncagent.go b/resource-manager/sql/2023-02-01-preview/syncagents/id_syncagent.go index 309a3696373..579f4fa1953 100644 --- a/resource-manager/sql/2023-02-01-preview/syncagents/id_syncagent.go +++ b/resource-manager/sql/2023-02-01-preview/syncagents/id_syncagent.go @@ -38,23 +38,9 @@ func ParseSyncAgentID(input string) (*SyncAgentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SyncAgentId{} - - 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.SyncAgentName, ok = parsed.Parsed["syncAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncAgentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSyncAgentIDInsensitively(input string) (*SyncAgentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SyncAgentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SyncAgentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.SyncAgentName, ok = parsed.Parsed["syncAgentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncAgentName", *parsed) + if id.SyncAgentName, ok = input.Parsed["syncAgentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "syncAgentName", input) } - return &id, nil + return nil } // ValidateSyncAgentID checks that 'input' can be parsed as a Sync Agent ID diff --git a/resource-manager/sql/2023-02-01-preview/syncgroups/id_location.go b/resource-manager/sql/2023-02-01-preview/syncgroups/id_location.go index 99320a4b748..8d6855fb698 100644 --- a/resource-manager/sql/2023-02-01-preview/syncgroups/id_location.go +++ b/resource-manager/sql/2023-02-01-preview/syncgroups/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/sql/2023-02-01-preview/syncgroups/id_syncgroup.go b/resource-manager/sql/2023-02-01-preview/syncgroups/id_syncgroup.go index 99a5ea85741..eb28cbfc930 100644 --- a/resource-manager/sql/2023-02-01-preview/syncgroups/id_syncgroup.go +++ b/resource-manager/sql/2023-02-01-preview/syncgroups/id_syncgroup.go @@ -40,27 +40,9 @@ func ParseSyncGroupID(input string) (*SyncGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SyncGroupId{} - - 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) - } - - if id.SyncGroupName, ok = parsed.Parsed["syncGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSyncGroupIDInsensitively(input string) (*SyncGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SyncGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SyncGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.SyncGroupName, ok = parsed.Parsed["syncGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", *parsed) + if id.SyncGroupName, ok = input.Parsed["syncGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", input) } - return &id, nil + return nil } // ValidateSyncGroupID checks that 'input' can be parsed as a Sync Group ID diff --git a/resource-manager/sql/2023-02-01-preview/syncmembers/id_syncgroup.go b/resource-manager/sql/2023-02-01-preview/syncmembers/id_syncgroup.go index 5e3a4d1c4b3..a1ec68a6155 100644 --- a/resource-manager/sql/2023-02-01-preview/syncmembers/id_syncgroup.go +++ b/resource-manager/sql/2023-02-01-preview/syncmembers/id_syncgroup.go @@ -40,27 +40,9 @@ func ParseSyncGroupID(input string) (*SyncGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SyncGroupId{} - - 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) - } - - if id.SyncGroupName, ok = parsed.Parsed["syncGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSyncGroupIDInsensitively(input string) (*SyncGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SyncGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SyncGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.SyncGroupName, ok = parsed.Parsed["syncGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", *parsed) + if id.SyncGroupName, ok = input.Parsed["syncGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", input) } - return &id, nil + return nil } // ValidateSyncGroupID checks that 'input' can be parsed as a Sync Group ID diff --git a/resource-manager/sql/2023-02-01-preview/syncmembers/id_syncmember.go b/resource-manager/sql/2023-02-01-preview/syncmembers/id_syncmember.go index 3f142cff96e..30f1146ce1c 100644 --- a/resource-manager/sql/2023-02-01-preview/syncmembers/id_syncmember.go +++ b/resource-manager/sql/2023-02-01-preview/syncmembers/id_syncmember.go @@ -42,31 +42,9 @@ func ParseSyncMemberID(input string) (*SyncMemberId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SyncMemberId{} - - 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) - } - - if id.SyncGroupName, ok = parsed.Parsed["syncGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", *parsed) - } - - if id.SyncMemberName, ok = parsed.Parsed["syncMemberName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncMemberName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseSyncMemberIDInsensitively(input string) (*SyncMemberId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SyncMemberId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SyncMemberId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.SyncGroupName, ok = parsed.Parsed["syncGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", *parsed) + if id.SyncGroupName, ok = input.Parsed["syncGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", input) } - if id.SyncMemberName, ok = parsed.Parsed["syncMemberName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncMemberName", *parsed) + if id.SyncMemberName, ok = input.Parsed["syncMemberName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "syncMemberName", input) } - return &id, nil + return nil } // ValidateSyncMemberID checks that 'input' can be parsed as a Sync Member ID diff --git a/resource-manager/sql/2023-02-01-preview/timezones/id_location.go b/resource-manager/sql/2023-02-01-preview/timezones/id_location.go index c458979247c..45d7ef239e0 100644 --- a/resource-manager/sql/2023-02-01-preview/timezones/id_location.go +++ b/resource-manager/sql/2023-02-01-preview/timezones/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/sql/2023-02-01-preview/timezones/id_timezone.go b/resource-manager/sql/2023-02-01-preview/timezones/id_timezone.go index 28d86caf162..14701f9c549 100644 --- a/resource-manager/sql/2023-02-01-preview/timezones/id_timezone.go +++ b/resource-manager/sql/2023-02-01-preview/timezones/id_timezone.go @@ -36,19 +36,9 @@ func ParseTimeZoneID(input string) (*TimeZoneId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TimeZoneId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.TimeZoneId, ok = parsed.Parsed["timeZoneId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "timeZoneId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseTimeZoneIDInsensitively(input string) (*TimeZoneId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TimeZoneId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *TimeZoneId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.TimeZoneId, ok = parsed.Parsed["timeZoneId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "timeZoneId", *parsed) + if id.TimeZoneId, ok = input.Parsed["timeZoneId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "timeZoneId", input) } - return &id, nil + return nil } // ValidateTimeZoneID checks that 'input' can be parsed as a Time Zone ID diff --git a/resource-manager/sql/2023-02-01-preview/usages/id_instancepool.go b/resource-manager/sql/2023-02-01-preview/usages/id_instancepool.go index 37c7c0cff4b..ce455dfd17e 100644 --- a/resource-manager/sql/2023-02-01-preview/usages/id_instancepool.go +++ b/resource-manager/sql/2023-02-01-preview/usages/id_instancepool.go @@ -36,19 +36,9 @@ func ParseInstancePoolID(input string) (*InstancePoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InstancePoolId{} - - 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.InstancePoolName, ok = parsed.Parsed["instancePoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instancePoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseInstancePoolIDInsensitively(input string) (*InstancePoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InstancePoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *InstancePoolId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.InstancePoolName, ok = parsed.Parsed["instancePoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instancePoolName", *parsed) + if id.InstancePoolName, ok = input.Parsed["instancePoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instancePoolName", input) } - return &id, nil + return nil } // ValidateInstancePoolID checks that 'input' can be parsed as a Instance Pool ID diff --git a/resource-manager/sql/2023-02-01-preview/virtualclusters/id_virtualcluster.go b/resource-manager/sql/2023-02-01-preview/virtualclusters/id_virtualcluster.go index 301fa5cb8d0..9e8d9d4ae69 100644 --- a/resource-manager/sql/2023-02-01-preview/virtualclusters/id_virtualcluster.go +++ b/resource-manager/sql/2023-02-01-preview/virtualclusters/id_virtualcluster.go @@ -36,19 +36,9 @@ func ParseVirtualClusterID(input string) (*VirtualClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualClusterId{} - - 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.VirtualClusterName, ok = parsed.Parsed["virtualClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualClusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualClusterIDInsensitively(input string) (*VirtualClusterId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualClusterName, ok = parsed.Parsed["virtualClusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualClusterName", *parsed) + if id.VirtualClusterName, ok = input.Parsed["virtualClusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualClusterName", input) } - return &id, nil + return nil } // ValidateVirtualClusterID checks that 'input' can be parsed as a Virtual Cluster ID diff --git a/resource-manager/sql/2023-02-01-preview/virtualnetworkrules/id_virtualnetworkrule.go b/resource-manager/sql/2023-02-01-preview/virtualnetworkrules/id_virtualnetworkrule.go index 56119519199..5f887f1eef5 100644 --- a/resource-manager/sql/2023-02-01-preview/virtualnetworkrules/id_virtualnetworkrule.go +++ b/resource-manager/sql/2023-02-01-preview/virtualnetworkrules/id_virtualnetworkrule.go @@ -38,23 +38,9 @@ func ParseVirtualNetworkRuleID(input string) (*VirtualNetworkRuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkRuleId{} - - 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.VirtualNetworkRuleName, ok = parsed.Parsed["virtualNetworkRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkRuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualNetworkRuleIDInsensitively(input string) (*VirtualNetworkRuleId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkRuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualNetworkRuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.VirtualNetworkRuleName, ok = parsed.Parsed["virtualNetworkRuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkRuleName", *parsed) + if id.VirtualNetworkRuleName, ok = input.Parsed["virtualNetworkRuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkRuleName", input) } - return &id, nil + return nil } // ValidateVirtualNetworkRuleID checks that 'input' can be parsed as a Virtual Network Rule ID diff --git a/resource-manager/sql/2023-02-01-preview/workloadclassifiers/id_workloadclassifier.go b/resource-manager/sql/2023-02-01-preview/workloadclassifiers/id_workloadclassifier.go index 1587ca03498..679145863c5 100644 --- a/resource-manager/sql/2023-02-01-preview/workloadclassifiers/id_workloadclassifier.go +++ b/resource-manager/sql/2023-02-01-preview/workloadclassifiers/id_workloadclassifier.go @@ -42,31 +42,9 @@ func ParseWorkloadClassifierID(input string) (*WorkloadClassifierId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkloadClassifierId{} - - 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) - } - - if id.WorkloadGroupName, ok = parsed.Parsed["workloadGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workloadGroupName", *parsed) - } - - if id.WorkloadClassifierName, ok = parsed.Parsed["workloadClassifierName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workloadClassifierName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseWorkloadClassifierIDInsensitively(input string) (*WorkloadClassifierId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkloadClassifierId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WorkloadClassifierId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.WorkloadGroupName, ok = parsed.Parsed["workloadGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workloadGroupName", *parsed) + if id.WorkloadGroupName, ok = input.Parsed["workloadGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workloadGroupName", input) } - if id.WorkloadClassifierName, ok = parsed.Parsed["workloadClassifierName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workloadClassifierName", *parsed) + if id.WorkloadClassifierName, ok = input.Parsed["workloadClassifierName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workloadClassifierName", input) } - return &id, nil + return nil } // ValidateWorkloadClassifierID checks that 'input' can be parsed as a Workload Classifier ID diff --git a/resource-manager/sql/2023-02-01-preview/workloadclassifiers/id_workloadgroup.go b/resource-manager/sql/2023-02-01-preview/workloadclassifiers/id_workloadgroup.go index 14006637775..3069a043cce 100644 --- a/resource-manager/sql/2023-02-01-preview/workloadclassifiers/id_workloadgroup.go +++ b/resource-manager/sql/2023-02-01-preview/workloadclassifiers/id_workloadgroup.go @@ -40,27 +40,9 @@ func ParseWorkloadGroupID(input string) (*WorkloadGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkloadGroupId{} - - 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) - } - - if id.WorkloadGroupName, ok = parsed.Parsed["workloadGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workloadGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseWorkloadGroupIDInsensitively(input string) (*WorkloadGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkloadGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *WorkloadGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.WorkloadGroupName, ok = parsed.Parsed["workloadGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workloadGroupName", *parsed) + if id.WorkloadGroupName, ok = input.Parsed["workloadGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workloadGroupName", input) } - return &id, nil + return nil } // ValidateWorkloadGroupID checks that 'input' can be parsed as a Workload Group ID diff --git a/resource-manager/sql/2023-02-01-preview/workloadgroups/id_workloadgroup.go b/resource-manager/sql/2023-02-01-preview/workloadgroups/id_workloadgroup.go index 2cf47c08df6..007ed3921aa 100644 --- a/resource-manager/sql/2023-02-01-preview/workloadgroups/id_workloadgroup.go +++ b/resource-manager/sql/2023-02-01-preview/workloadgroups/id_workloadgroup.go @@ -40,27 +40,9 @@ func ParseWorkloadGroupID(input string) (*WorkloadGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkloadGroupId{} - - 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) - } - - if id.WorkloadGroupName, ok = parsed.Parsed["workloadGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workloadGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseWorkloadGroupIDInsensitively(input string) (*WorkloadGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkloadGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *WorkloadGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerName, ok = parsed.Parsed["serverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverName", *parsed) + if id.ServerName, ok = input.Parsed["serverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverName", input) } - if id.DatabaseName, ok = parsed.Parsed["databaseName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseName", *parsed) + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) } - if id.WorkloadGroupName, ok = parsed.Parsed["workloadGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workloadGroupName", *parsed) + if id.WorkloadGroupName, ok = input.Parsed["workloadGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workloadGroupName", input) } - return &id, nil + return nil } // ValidateWorkloadGroupID checks that 'input' can be parsed as a Workload Group ID diff --git a/resource-manager/sqlvirtualmachine/2022-02-01/availabilitygrouplisteners/id_availabilitygrouplistener.go b/resource-manager/sqlvirtualmachine/2022-02-01/availabilitygrouplisteners/id_availabilitygrouplistener.go index 4836dca5df5..bdbc8e2ef36 100644 --- a/resource-manager/sqlvirtualmachine/2022-02-01/availabilitygrouplisteners/id_availabilitygrouplistener.go +++ b/resource-manager/sqlvirtualmachine/2022-02-01/availabilitygrouplisteners/id_availabilitygrouplistener.go @@ -38,23 +38,9 @@ func ParseAvailabilityGroupListenerID(input string) (*AvailabilityGroupListenerI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AvailabilityGroupListenerId{} - - 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.SqlVirtualMachineGroupName, ok = parsed.Parsed["sqlVirtualMachineGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlVirtualMachineGroupName", *parsed) - } - - if id.AvailabilityGroupListenerName, ok = parsed.Parsed["availabilityGroupListenerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "availabilityGroupListenerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAvailabilityGroupListenerIDInsensitively(input string) (*AvailabilityG return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AvailabilityGroupListenerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AvailabilityGroupListenerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SqlVirtualMachineGroupName, ok = parsed.Parsed["sqlVirtualMachineGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlVirtualMachineGroupName", *parsed) + if id.SqlVirtualMachineGroupName, ok = input.Parsed["sqlVirtualMachineGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sqlVirtualMachineGroupName", input) } - if id.AvailabilityGroupListenerName, ok = parsed.Parsed["availabilityGroupListenerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "availabilityGroupListenerName", *parsed) + if id.AvailabilityGroupListenerName, ok = input.Parsed["availabilityGroupListenerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "availabilityGroupListenerName", input) } - return &id, nil + return nil } // ValidateAvailabilityGroupListenerID checks that 'input' can be parsed as a Availability Group Listener ID diff --git a/resource-manager/sqlvirtualmachine/2022-02-01/availabilitygrouplisteners/id_sqlvirtualmachinegroup.go b/resource-manager/sqlvirtualmachine/2022-02-01/availabilitygrouplisteners/id_sqlvirtualmachinegroup.go index b2f7143c89f..953aee5c76a 100644 --- a/resource-manager/sqlvirtualmachine/2022-02-01/availabilitygrouplisteners/id_sqlvirtualmachinegroup.go +++ b/resource-manager/sqlvirtualmachine/2022-02-01/availabilitygrouplisteners/id_sqlvirtualmachinegroup.go @@ -36,19 +36,9 @@ func ParseSqlVirtualMachineGroupID(input string) (*SqlVirtualMachineGroupId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SqlVirtualMachineGroupId{} - - 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.SqlVirtualMachineGroupName, ok = parsed.Parsed["sqlVirtualMachineGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlVirtualMachineGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSqlVirtualMachineGroupIDInsensitively(input string) (*SqlVirtualMachin return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SqlVirtualMachineGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SqlVirtualMachineGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SqlVirtualMachineGroupName, ok = parsed.Parsed["sqlVirtualMachineGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlVirtualMachineGroupName", *parsed) + if id.SqlVirtualMachineGroupName, ok = input.Parsed["sqlVirtualMachineGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sqlVirtualMachineGroupName", input) } - return &id, nil + return nil } // ValidateSqlVirtualMachineGroupID checks that 'input' can be parsed as a Sql Virtual Machine Group ID diff --git a/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachinegroups/id_sqlvirtualmachinegroup.go b/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachinegroups/id_sqlvirtualmachinegroup.go index 9893b19ac61..ee4e2e02038 100644 --- a/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachinegroups/id_sqlvirtualmachinegroup.go +++ b/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachinegroups/id_sqlvirtualmachinegroup.go @@ -36,19 +36,9 @@ func ParseSqlVirtualMachineGroupID(input string) (*SqlVirtualMachineGroupId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SqlVirtualMachineGroupId{} - - 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.SqlVirtualMachineGroupName, ok = parsed.Parsed["sqlVirtualMachineGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlVirtualMachineGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSqlVirtualMachineGroupIDInsensitively(input string) (*SqlVirtualMachin return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SqlVirtualMachineGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SqlVirtualMachineGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SqlVirtualMachineGroupName, ok = parsed.Parsed["sqlVirtualMachineGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlVirtualMachineGroupName", *parsed) + if id.SqlVirtualMachineGroupName, ok = input.Parsed["sqlVirtualMachineGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sqlVirtualMachineGroupName", input) } - return &id, nil + return nil } // ValidateSqlVirtualMachineGroupID checks that 'input' can be parsed as a Sql Virtual Machine Group ID diff --git a/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/id_sqlvirtualmachine.go b/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/id_sqlvirtualmachine.go index cc893b1911d..6b344a86c29 100644 --- a/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/id_sqlvirtualmachine.go +++ b/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/id_sqlvirtualmachine.go @@ -36,19 +36,9 @@ func ParseSqlVirtualMachineID(input string) (*SqlVirtualMachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SqlVirtualMachineId{} - - 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.SqlVirtualMachineName, ok = parsed.Parsed["sqlVirtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlVirtualMachineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSqlVirtualMachineIDInsensitively(input string) (*SqlVirtualMachineId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SqlVirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SqlVirtualMachineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SqlVirtualMachineName, ok = parsed.Parsed["sqlVirtualMachineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlVirtualMachineName", *parsed) + if id.SqlVirtualMachineName, ok = input.Parsed["sqlVirtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sqlVirtualMachineName", input) } - return &id, nil + return nil } // ValidateSqlVirtualMachineID checks that 'input' can be parsed as a Sql Virtual Machine ID diff --git a/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/id_sqlvirtualmachinegroup.go b/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/id_sqlvirtualmachinegroup.go index f13e46a78c0..1c438a89b17 100644 --- a/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/id_sqlvirtualmachinegroup.go +++ b/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines/id_sqlvirtualmachinegroup.go @@ -36,19 +36,9 @@ func ParseSqlVirtualMachineGroupID(input string) (*SqlVirtualMachineGroupId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SqlVirtualMachineGroupId{} - - 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.SqlVirtualMachineGroupName, ok = parsed.Parsed["sqlVirtualMachineGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlVirtualMachineGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSqlVirtualMachineGroupIDInsensitively(input string) (*SqlVirtualMachin return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SqlVirtualMachineGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SqlVirtualMachineGroupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SqlVirtualMachineGroupName, ok = parsed.Parsed["sqlVirtualMachineGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sqlVirtualMachineGroupName", *parsed) + if id.SqlVirtualMachineGroupName, ok = input.Parsed["sqlVirtualMachineGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sqlVirtualMachineGroupName", input) } - return &id, nil + return nil } // ValidateSqlVirtualMachineGroupID checks that 'input' can be parsed as a Sql Virtual Machine Group ID diff --git a/resource-manager/storage/2022-05-01/deletedaccounts/id_deletedaccount.go b/resource-manager/storage/2022-05-01/deletedaccounts/id_deletedaccount.go index b3972fbbe05..2323db580a4 100644 --- a/resource-manager/storage/2022-05-01/deletedaccounts/id_deletedaccount.go +++ b/resource-manager/storage/2022-05-01/deletedaccounts/id_deletedaccount.go @@ -36,19 +36,9 @@ func ParseDeletedAccountID(input string) (*DeletedAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeletedAccountId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.DeletedAccountName, ok = parsed.Parsed["deletedAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDeletedAccountIDInsensitively(input string) (*DeletedAccountId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeletedAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DeletedAccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.DeletedAccountName, ok = parsed.Parsed["deletedAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedAccountName", *parsed) + if id.DeletedAccountName, ok = input.Parsed["deletedAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deletedAccountName", input) } - return &id, nil + return nil } // ValidateDeletedAccountID checks that 'input' can be parsed as a Deleted Account ID diff --git a/resource-manager/storage/2022-05-01/encryptionscopes/id_encryptionscope.go b/resource-manager/storage/2022-05-01/encryptionscopes/id_encryptionscope.go index 54b7e381534..da98ff39db3 100644 --- a/resource-manager/storage/2022-05-01/encryptionscopes/id_encryptionscope.go +++ b/resource-manager/storage/2022-05-01/encryptionscopes/id_encryptionscope.go @@ -38,23 +38,9 @@ func ParseEncryptionScopeID(input string) (*EncryptionScopeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EncryptionScopeId{} - - 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.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) - } - - if id.EncryptionScopeName, ok = parsed.Parsed["encryptionScopeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "encryptionScopeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseEncryptionScopeIDInsensitively(input string) (*EncryptionScopeId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EncryptionScopeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EncryptionScopeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) + if id.StorageAccountName, ok = input.Parsed["storageAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", input) } - if id.EncryptionScopeName, ok = parsed.Parsed["encryptionScopeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "encryptionScopeName", *parsed) + if id.EncryptionScopeName, ok = input.Parsed["encryptionScopeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "encryptionScopeName", input) } - return &id, nil + return nil } // ValidateEncryptionScopeID checks that 'input' can be parsed as a Encryption Scope ID diff --git a/resource-manager/storage/2022-05-01/fileshares/id_share.go b/resource-manager/storage/2022-05-01/fileshares/id_share.go index 9f7c310e506..df8a4e04b33 100644 --- a/resource-manager/storage/2022-05-01/fileshares/id_share.go +++ b/resource-manager/storage/2022-05-01/fileshares/id_share.go @@ -38,23 +38,9 @@ func ParseShareID(input string) (*ShareId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ShareId{} - - 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.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) - } - - if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseShareIDInsensitively(input string) (*ShareId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ShareId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ShareId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) + if id.StorageAccountName, ok = input.Parsed["storageAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", input) } - if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareName", *parsed) + if id.ShareName, ok = input.Parsed["shareName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "shareName", input) } - return &id, nil + return nil } // ValidateShareID checks that 'input' can be parsed as a Share ID diff --git a/resource-manager/storage/2022-05-01/localusers/id_localuser.go b/resource-manager/storage/2022-05-01/localusers/id_localuser.go index 8bf0d0be80c..660b8c50cde 100644 --- a/resource-manager/storage/2022-05-01/localusers/id_localuser.go +++ b/resource-manager/storage/2022-05-01/localusers/id_localuser.go @@ -38,23 +38,9 @@ func ParseLocalUserID(input string) (*LocalUserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocalUserId{} - - 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.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) - } - - if id.LocalUserName, ok = parsed.Parsed["localUserName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localUserName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLocalUserIDInsensitively(input string) (*LocalUserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocalUserId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LocalUserId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) + if id.StorageAccountName, ok = input.Parsed["storageAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", input) } - if id.LocalUserName, ok = parsed.Parsed["localUserName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localUserName", *parsed) + if id.LocalUserName, ok = input.Parsed["localUserName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "localUserName", input) } - return &id, nil + return nil } // ValidateLocalUserID checks that 'input' can be parsed as a Local User ID diff --git a/resource-manager/storage/2022-05-01/objectreplicationpolicies/id_objectreplicationpolicy.go b/resource-manager/storage/2022-05-01/objectreplicationpolicies/id_objectreplicationpolicy.go index f15bc667eb2..9dceb5dc620 100644 --- a/resource-manager/storage/2022-05-01/objectreplicationpolicies/id_objectreplicationpolicy.go +++ b/resource-manager/storage/2022-05-01/objectreplicationpolicies/id_objectreplicationpolicy.go @@ -38,23 +38,9 @@ func ParseObjectReplicationPolicyID(input string) (*ObjectReplicationPolicyId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ObjectReplicationPolicyId{} - - 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.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) - } - - if id.ObjectReplicationPolicyId, ok = parsed.Parsed["objectReplicationPolicyId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "objectReplicationPolicyId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseObjectReplicationPolicyIDInsensitively(input string) (*ObjectReplicati return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ObjectReplicationPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ObjectReplicationPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) + if id.StorageAccountName, ok = input.Parsed["storageAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", input) } - if id.ObjectReplicationPolicyId, ok = parsed.Parsed["objectReplicationPolicyId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "objectReplicationPolicyId", *parsed) + if id.ObjectReplicationPolicyId, ok = input.Parsed["objectReplicationPolicyId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "objectReplicationPolicyId", input) } - return &id, nil + return nil } // ValidateObjectReplicationPolicyID checks that 'input' can be parsed as a Object Replication Policy ID diff --git a/resource-manager/storage/2022-05-01/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/storage/2022-05-01/privateendpointconnections/id_privateendpointconnection.go index dda42ec8351..af8c3251a31 100644 --- a/resource-manager/storage/2022-05-01/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/storage/2022-05-01/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) + if id.StorageAccountName, ok = input.Parsed["storageAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/storage/2022-05-01/queueservice/id_queue.go b/resource-manager/storage/2022-05-01/queueservice/id_queue.go index 235b1d4c421..a2b92fe8d00 100644 --- a/resource-manager/storage/2022-05-01/queueservice/id_queue.go +++ b/resource-manager/storage/2022-05-01/queueservice/id_queue.go @@ -38,23 +38,9 @@ func ParseQueueID(input string) (*QueueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QueueId{} - - 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.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) - } - - if id.QueueName, ok = parsed.Parsed["queueName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "queueName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseQueueIDInsensitively(input string) (*QueueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QueueId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *QueueId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) + if id.StorageAccountName, ok = input.Parsed["storageAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", input) } - if id.QueueName, ok = parsed.Parsed["queueName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "queueName", *parsed) + if id.QueueName, ok = input.Parsed["queueName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "queueName", input) } - return &id, nil + return nil } // ValidateQueueID checks that 'input' can be parsed as a Queue ID diff --git a/resource-manager/storage/2022-05-01/tableservice/id_table.go b/resource-manager/storage/2022-05-01/tableservice/id_table.go index a7265389f20..012aaa4d06c 100644 --- a/resource-manager/storage/2022-05-01/tableservice/id_table.go +++ b/resource-manager/storage/2022-05-01/tableservice/id_table.go @@ -38,23 +38,9 @@ func ParseTableID(input string) (*TableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TableId{} - - 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.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) - } - - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTableIDInsensitively(input string) (*TableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TableId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) + if id.StorageAccountName, ok = input.Parsed["storageAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", input) } - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if id.TableName, ok = input.Parsed["tableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tableName", input) } - return &id, nil + return nil } // ValidateTableID checks that 'input' can be parsed as a Table ID diff --git a/resource-manager/storage/2022-09-01/deletedaccounts/id_deletedaccount.go b/resource-manager/storage/2022-09-01/deletedaccounts/id_deletedaccount.go index b3972fbbe05..2323db580a4 100644 --- a/resource-manager/storage/2022-09-01/deletedaccounts/id_deletedaccount.go +++ b/resource-manager/storage/2022-09-01/deletedaccounts/id_deletedaccount.go @@ -36,19 +36,9 @@ func ParseDeletedAccountID(input string) (*DeletedAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeletedAccountId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.DeletedAccountName, ok = parsed.Parsed["deletedAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDeletedAccountIDInsensitively(input string) (*DeletedAccountId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeletedAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DeletedAccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.DeletedAccountName, ok = parsed.Parsed["deletedAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedAccountName", *parsed) + if id.DeletedAccountName, ok = input.Parsed["deletedAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deletedAccountName", input) } - return &id, nil + return nil } // ValidateDeletedAccountID checks that 'input' can be parsed as a Deleted Account ID diff --git a/resource-manager/storage/2022-09-01/encryptionscopes/id_encryptionscope.go b/resource-manager/storage/2022-09-01/encryptionscopes/id_encryptionscope.go index 54b7e381534..da98ff39db3 100644 --- a/resource-manager/storage/2022-09-01/encryptionscopes/id_encryptionscope.go +++ b/resource-manager/storage/2022-09-01/encryptionscopes/id_encryptionscope.go @@ -38,23 +38,9 @@ func ParseEncryptionScopeID(input string) (*EncryptionScopeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EncryptionScopeId{} - - 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.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) - } - - if id.EncryptionScopeName, ok = parsed.Parsed["encryptionScopeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "encryptionScopeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseEncryptionScopeIDInsensitively(input string) (*EncryptionScopeId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EncryptionScopeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EncryptionScopeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) + if id.StorageAccountName, ok = input.Parsed["storageAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", input) } - if id.EncryptionScopeName, ok = parsed.Parsed["encryptionScopeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "encryptionScopeName", *parsed) + if id.EncryptionScopeName, ok = input.Parsed["encryptionScopeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "encryptionScopeName", input) } - return &id, nil + return nil } // ValidateEncryptionScopeID checks that 'input' can be parsed as a Encryption Scope ID diff --git a/resource-manager/storage/2022-09-01/fileshares/id_share.go b/resource-manager/storage/2022-09-01/fileshares/id_share.go index 9f7c310e506..df8a4e04b33 100644 --- a/resource-manager/storage/2022-09-01/fileshares/id_share.go +++ b/resource-manager/storage/2022-09-01/fileshares/id_share.go @@ -38,23 +38,9 @@ func ParseShareID(input string) (*ShareId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ShareId{} - - 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.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) - } - - if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseShareIDInsensitively(input string) (*ShareId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ShareId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ShareId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) + if id.StorageAccountName, ok = input.Parsed["storageAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", input) } - if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareName", *parsed) + if id.ShareName, ok = input.Parsed["shareName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "shareName", input) } - return &id, nil + return nil } // ValidateShareID checks that 'input' can be parsed as a Share ID diff --git a/resource-manager/storage/2022-09-01/localusers/id_localuser.go b/resource-manager/storage/2022-09-01/localusers/id_localuser.go index 8bf0d0be80c..660b8c50cde 100644 --- a/resource-manager/storage/2022-09-01/localusers/id_localuser.go +++ b/resource-manager/storage/2022-09-01/localusers/id_localuser.go @@ -38,23 +38,9 @@ func ParseLocalUserID(input string) (*LocalUserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocalUserId{} - - 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.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) - } - - if id.LocalUserName, ok = parsed.Parsed["localUserName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localUserName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLocalUserIDInsensitively(input string) (*LocalUserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocalUserId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LocalUserId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) + if id.StorageAccountName, ok = input.Parsed["storageAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", input) } - if id.LocalUserName, ok = parsed.Parsed["localUserName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localUserName", *parsed) + if id.LocalUserName, ok = input.Parsed["localUserName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "localUserName", input) } - return &id, nil + return nil } // ValidateLocalUserID checks that 'input' can be parsed as a Local User ID diff --git a/resource-manager/storage/2022-09-01/objectreplicationpolicies/id_objectreplicationpolicy.go b/resource-manager/storage/2022-09-01/objectreplicationpolicies/id_objectreplicationpolicy.go index f15bc667eb2..9dceb5dc620 100644 --- a/resource-manager/storage/2022-09-01/objectreplicationpolicies/id_objectreplicationpolicy.go +++ b/resource-manager/storage/2022-09-01/objectreplicationpolicies/id_objectreplicationpolicy.go @@ -38,23 +38,9 @@ func ParseObjectReplicationPolicyID(input string) (*ObjectReplicationPolicyId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ObjectReplicationPolicyId{} - - 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.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) - } - - if id.ObjectReplicationPolicyId, ok = parsed.Parsed["objectReplicationPolicyId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "objectReplicationPolicyId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseObjectReplicationPolicyIDInsensitively(input string) (*ObjectReplicati return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ObjectReplicationPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ObjectReplicationPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) + if id.StorageAccountName, ok = input.Parsed["storageAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", input) } - if id.ObjectReplicationPolicyId, ok = parsed.Parsed["objectReplicationPolicyId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "objectReplicationPolicyId", *parsed) + if id.ObjectReplicationPolicyId, ok = input.Parsed["objectReplicationPolicyId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "objectReplicationPolicyId", input) } - return &id, nil + return nil } // ValidateObjectReplicationPolicyID checks that 'input' can be parsed as a Object Replication Policy ID diff --git a/resource-manager/storage/2022-09-01/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/storage/2022-09-01/privateendpointconnections/id_privateendpointconnection.go index dda42ec8351..af8c3251a31 100644 --- a/resource-manager/storage/2022-09-01/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/storage/2022-09-01/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) + if id.StorageAccountName, ok = input.Parsed["storageAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/storage/2022-09-01/queueservice/id_queue.go b/resource-manager/storage/2022-09-01/queueservice/id_queue.go index 235b1d4c421..a2b92fe8d00 100644 --- a/resource-manager/storage/2022-09-01/queueservice/id_queue.go +++ b/resource-manager/storage/2022-09-01/queueservice/id_queue.go @@ -38,23 +38,9 @@ func ParseQueueID(input string) (*QueueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QueueId{} - - 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.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) - } - - if id.QueueName, ok = parsed.Parsed["queueName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "queueName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseQueueIDInsensitively(input string) (*QueueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QueueId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *QueueId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) + if id.StorageAccountName, ok = input.Parsed["storageAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", input) } - if id.QueueName, ok = parsed.Parsed["queueName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "queueName", *parsed) + if id.QueueName, ok = input.Parsed["queueName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "queueName", input) } - return &id, nil + return nil } // ValidateQueueID checks that 'input' can be parsed as a Queue ID diff --git a/resource-manager/storage/2022-09-01/tableservice/id_table.go b/resource-manager/storage/2022-09-01/tableservice/id_table.go index a7265389f20..012aaa4d06c 100644 --- a/resource-manager/storage/2022-09-01/tableservice/id_table.go +++ b/resource-manager/storage/2022-09-01/tableservice/id_table.go @@ -38,23 +38,9 @@ func ParseTableID(input string) (*TableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TableId{} - - 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.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) - } - - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTableIDInsensitively(input string) (*TableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TableId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) + if id.StorageAccountName, ok = input.Parsed["storageAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", input) } - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if id.TableName, ok = input.Parsed["tableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tableName", input) } - return &id, nil + return nil } // ValidateTableID checks that 'input' can be parsed as a Table ID diff --git a/resource-manager/storage/2023-01-01/deletedaccounts/id_deletedaccount.go b/resource-manager/storage/2023-01-01/deletedaccounts/id_deletedaccount.go index b3972fbbe05..2323db580a4 100644 --- a/resource-manager/storage/2023-01-01/deletedaccounts/id_deletedaccount.go +++ b/resource-manager/storage/2023-01-01/deletedaccounts/id_deletedaccount.go @@ -36,19 +36,9 @@ func ParseDeletedAccountID(input string) (*DeletedAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeletedAccountId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.DeletedAccountName, ok = parsed.Parsed["deletedAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedAccountName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDeletedAccountIDInsensitively(input string) (*DeletedAccountId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeletedAccountId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DeletedAccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.DeletedAccountName, ok = parsed.Parsed["deletedAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedAccountName", *parsed) + if id.DeletedAccountName, ok = input.Parsed["deletedAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deletedAccountName", input) } - return &id, nil + return nil } // ValidateDeletedAccountID checks that 'input' can be parsed as a Deleted Account ID diff --git a/resource-manager/storage/2023-01-01/encryptionscopes/id_encryptionscope.go b/resource-manager/storage/2023-01-01/encryptionscopes/id_encryptionscope.go index 54b7e381534..da98ff39db3 100644 --- a/resource-manager/storage/2023-01-01/encryptionscopes/id_encryptionscope.go +++ b/resource-manager/storage/2023-01-01/encryptionscopes/id_encryptionscope.go @@ -38,23 +38,9 @@ func ParseEncryptionScopeID(input string) (*EncryptionScopeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EncryptionScopeId{} - - 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.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) - } - - if id.EncryptionScopeName, ok = parsed.Parsed["encryptionScopeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "encryptionScopeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseEncryptionScopeIDInsensitively(input string) (*EncryptionScopeId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EncryptionScopeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EncryptionScopeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) + if id.StorageAccountName, ok = input.Parsed["storageAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", input) } - if id.EncryptionScopeName, ok = parsed.Parsed["encryptionScopeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "encryptionScopeName", *parsed) + if id.EncryptionScopeName, ok = input.Parsed["encryptionScopeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "encryptionScopeName", input) } - return &id, nil + return nil } // ValidateEncryptionScopeID checks that 'input' can be parsed as a Encryption Scope ID diff --git a/resource-manager/storage/2023-01-01/fileshares/id_share.go b/resource-manager/storage/2023-01-01/fileshares/id_share.go index 9f7c310e506..df8a4e04b33 100644 --- a/resource-manager/storage/2023-01-01/fileshares/id_share.go +++ b/resource-manager/storage/2023-01-01/fileshares/id_share.go @@ -38,23 +38,9 @@ func ParseShareID(input string) (*ShareId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ShareId{} - - 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.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) - } - - if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseShareIDInsensitively(input string) (*ShareId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ShareId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ShareId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) + if id.StorageAccountName, ok = input.Parsed["storageAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", input) } - if id.ShareName, ok = parsed.Parsed["shareName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "shareName", *parsed) + if id.ShareName, ok = input.Parsed["shareName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "shareName", input) } - return &id, nil + return nil } // ValidateShareID checks that 'input' can be parsed as a Share ID diff --git a/resource-manager/storage/2023-01-01/localusers/id_localuser.go b/resource-manager/storage/2023-01-01/localusers/id_localuser.go index 8bf0d0be80c..660b8c50cde 100644 --- a/resource-manager/storage/2023-01-01/localusers/id_localuser.go +++ b/resource-manager/storage/2023-01-01/localusers/id_localuser.go @@ -38,23 +38,9 @@ func ParseLocalUserID(input string) (*LocalUserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocalUserId{} - - 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.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) - } - - if id.LocalUserName, ok = parsed.Parsed["localUserName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localUserName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLocalUserIDInsensitively(input string) (*LocalUserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocalUserId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LocalUserId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) + if id.StorageAccountName, ok = input.Parsed["storageAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", input) } - if id.LocalUserName, ok = parsed.Parsed["localUserName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "localUserName", *parsed) + if id.LocalUserName, ok = input.Parsed["localUserName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "localUserName", input) } - return &id, nil + return nil } // ValidateLocalUserID checks that 'input' can be parsed as a Local User ID diff --git a/resource-manager/storage/2023-01-01/objectreplicationpolicies/id_objectreplicationpolicy.go b/resource-manager/storage/2023-01-01/objectreplicationpolicies/id_objectreplicationpolicy.go index f15bc667eb2..9dceb5dc620 100644 --- a/resource-manager/storage/2023-01-01/objectreplicationpolicies/id_objectreplicationpolicy.go +++ b/resource-manager/storage/2023-01-01/objectreplicationpolicies/id_objectreplicationpolicy.go @@ -38,23 +38,9 @@ func ParseObjectReplicationPolicyID(input string) (*ObjectReplicationPolicyId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ObjectReplicationPolicyId{} - - 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.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) - } - - if id.ObjectReplicationPolicyId, ok = parsed.Parsed["objectReplicationPolicyId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "objectReplicationPolicyId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseObjectReplicationPolicyIDInsensitively(input string) (*ObjectReplicati return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ObjectReplicationPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ObjectReplicationPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) + if id.StorageAccountName, ok = input.Parsed["storageAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", input) } - if id.ObjectReplicationPolicyId, ok = parsed.Parsed["objectReplicationPolicyId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "objectReplicationPolicyId", *parsed) + if id.ObjectReplicationPolicyId, ok = input.Parsed["objectReplicationPolicyId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "objectReplicationPolicyId", input) } - return &id, nil + return nil } // ValidateObjectReplicationPolicyID checks that 'input' can be parsed as a Object Replication Policy ID diff --git a/resource-manager/storage/2023-01-01/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/storage/2023-01-01/privateendpointconnections/id_privateendpointconnection.go index dda42ec8351..af8c3251a31 100644 --- a/resource-manager/storage/2023-01-01/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/storage/2023-01-01/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) + if id.StorageAccountName, ok = input.Parsed["storageAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/storage/2023-01-01/queueservice/id_queue.go b/resource-manager/storage/2023-01-01/queueservice/id_queue.go index 235b1d4c421..a2b92fe8d00 100644 --- a/resource-manager/storage/2023-01-01/queueservice/id_queue.go +++ b/resource-manager/storage/2023-01-01/queueservice/id_queue.go @@ -38,23 +38,9 @@ func ParseQueueID(input string) (*QueueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QueueId{} - - 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.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) - } - - if id.QueueName, ok = parsed.Parsed["queueName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "queueName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseQueueIDInsensitively(input string) (*QueueId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := QueueId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *QueueId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) + if id.StorageAccountName, ok = input.Parsed["storageAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", input) } - if id.QueueName, ok = parsed.Parsed["queueName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "queueName", *parsed) + if id.QueueName, ok = input.Parsed["queueName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "queueName", input) } - return &id, nil + return nil } // ValidateQueueID checks that 'input' can be parsed as a Queue ID diff --git a/resource-manager/storage/2023-01-01/tableservice/id_table.go b/resource-manager/storage/2023-01-01/tableservice/id_table.go index a7265389f20..012aaa4d06c 100644 --- a/resource-manager/storage/2023-01-01/tableservice/id_table.go +++ b/resource-manager/storage/2023-01-01/tableservice/id_table.go @@ -38,23 +38,9 @@ func ParseTableID(input string) (*TableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TableId{} - - 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.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) - } - - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTableIDInsensitively(input string) (*TableId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TableId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TableId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageAccountName, ok = parsed.Parsed["storageAccountName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", *parsed) + if id.StorageAccountName, ok = input.Parsed["storageAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageAccountName", input) } - if id.TableName, ok = parsed.Parsed["tableName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "tableName", *parsed) + if id.TableName, ok = input.Parsed["tableName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "tableName", input) } - return &id, nil + return nil } // ValidateTableID checks that 'input' can be parsed as a Table ID diff --git a/resource-manager/storagecache/2023-01-01/ascusages/id_location.go b/resource-manager/storagecache/2023-01-01/ascusages/id_location.go index 7d9cec58eb0..ed19710dd77 100644 --- a/resource-manager/storagecache/2023-01-01/ascusages/id_location.go +++ b/resource-manager/storagecache/2023-01-01/ascusages/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/storagecache/2023-01-01/caches/id_cache.go b/resource-manager/storagecache/2023-01-01/caches/id_cache.go index d048b1a7ff5..8787aa06353 100644 --- a/resource-manager/storagecache/2023-01-01/caches/id_cache.go +++ b/resource-manager/storagecache/2023-01-01/caches/id_cache.go @@ -36,19 +36,9 @@ func ParseCacheID(input string) (*CacheId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CacheId{} - - 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.CacheName, ok = parsed.Parsed["cacheName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cacheName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseCacheIDInsensitively(input string) (*CacheId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CacheId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CacheId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CacheName, ok = parsed.Parsed["cacheName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cacheName", *parsed) + if id.CacheName, ok = input.Parsed["cacheName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cacheName", input) } - return &id, nil + return nil } // ValidateCacheID checks that 'input' can be parsed as a Cache ID diff --git a/resource-manager/storagecache/2023-01-01/storagetargets/id_cache.go b/resource-manager/storagecache/2023-01-01/storagetargets/id_cache.go index 383376c605b..86a1a0d01de 100644 --- a/resource-manager/storagecache/2023-01-01/storagetargets/id_cache.go +++ b/resource-manager/storagecache/2023-01-01/storagetargets/id_cache.go @@ -36,19 +36,9 @@ func ParseCacheID(input string) (*CacheId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CacheId{} - - 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.CacheName, ok = parsed.Parsed["cacheName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cacheName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseCacheIDInsensitively(input string) (*CacheId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CacheId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CacheId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CacheName, ok = parsed.Parsed["cacheName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cacheName", *parsed) + if id.CacheName, ok = input.Parsed["cacheName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cacheName", input) } - return &id, nil + return nil } // ValidateCacheID checks that 'input' can be parsed as a Cache ID diff --git a/resource-manager/storagecache/2023-01-01/storagetargets/id_storagetarget.go b/resource-manager/storagecache/2023-01-01/storagetargets/id_storagetarget.go index d3b75b75d47..76884f74260 100644 --- a/resource-manager/storagecache/2023-01-01/storagetargets/id_storagetarget.go +++ b/resource-manager/storagecache/2023-01-01/storagetargets/id_storagetarget.go @@ -38,23 +38,9 @@ func ParseStorageTargetID(input string) (*StorageTargetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageTargetId{} - - 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.CacheName, ok = parsed.Parsed["cacheName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cacheName", *parsed) - } - - if id.StorageTargetName, ok = parsed.Parsed["storageTargetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageTargetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseStorageTargetIDInsensitively(input string) (*StorageTargetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageTargetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *StorageTargetId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CacheName, ok = parsed.Parsed["cacheName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cacheName", *parsed) + if id.CacheName, ok = input.Parsed["cacheName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cacheName", input) } - if id.StorageTargetName, ok = parsed.Parsed["storageTargetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageTargetName", *parsed) + if id.StorageTargetName, ok = input.Parsed["storageTargetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageTargetName", input) } - return &id, nil + return nil } // ValidateStorageTargetID checks that 'input' can be parsed as a Storage Target ID diff --git a/resource-manager/storagecache/2023-05-01/amlfilesystems/id_amlfilesystem.go b/resource-manager/storagecache/2023-05-01/amlfilesystems/id_amlfilesystem.go index 5fa1aedf9eb..49a9013ccbf 100644 --- a/resource-manager/storagecache/2023-05-01/amlfilesystems/id_amlfilesystem.go +++ b/resource-manager/storagecache/2023-05-01/amlfilesystems/id_amlfilesystem.go @@ -36,19 +36,9 @@ func ParseAmlFilesystemID(input string) (*AmlFilesystemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AmlFilesystemId{} - - 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.AmlFilesystemName, ok = parsed.Parsed["amlFilesystemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "amlFilesystemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAmlFilesystemIDInsensitively(input string) (*AmlFilesystemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AmlFilesystemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AmlFilesystemId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AmlFilesystemName, ok = parsed.Parsed["amlFilesystemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "amlFilesystemName", *parsed) + if id.AmlFilesystemName, ok = input.Parsed["amlFilesystemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "amlFilesystemName", input) } - return &id, nil + return nil } // ValidateAmlFilesystemID checks that 'input' can be parsed as a Aml Filesystem ID diff --git a/resource-manager/storagecache/2023-05-01/ascusages/id_location.go b/resource-manager/storagecache/2023-05-01/ascusages/id_location.go index 7d9cec58eb0..ed19710dd77 100644 --- a/resource-manager/storagecache/2023-05-01/ascusages/id_location.go +++ b/resource-manager/storagecache/2023-05-01/ascusages/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/storagecache/2023-05-01/caches/id_cache.go b/resource-manager/storagecache/2023-05-01/caches/id_cache.go index d048b1a7ff5..8787aa06353 100644 --- a/resource-manager/storagecache/2023-05-01/caches/id_cache.go +++ b/resource-manager/storagecache/2023-05-01/caches/id_cache.go @@ -36,19 +36,9 @@ func ParseCacheID(input string) (*CacheId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CacheId{} - - 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.CacheName, ok = parsed.Parsed["cacheName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cacheName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseCacheIDInsensitively(input string) (*CacheId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CacheId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CacheId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CacheName, ok = parsed.Parsed["cacheName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cacheName", *parsed) + if id.CacheName, ok = input.Parsed["cacheName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cacheName", input) } - return &id, nil + return nil } // ValidateCacheID checks that 'input' can be parsed as a Cache ID diff --git a/resource-manager/storagecache/2023-05-01/storagetargets/id_cache.go b/resource-manager/storagecache/2023-05-01/storagetargets/id_cache.go index 383376c605b..86a1a0d01de 100644 --- a/resource-manager/storagecache/2023-05-01/storagetargets/id_cache.go +++ b/resource-manager/storagecache/2023-05-01/storagetargets/id_cache.go @@ -36,19 +36,9 @@ func ParseCacheID(input string) (*CacheId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CacheId{} - - 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.CacheName, ok = parsed.Parsed["cacheName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cacheName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseCacheIDInsensitively(input string) (*CacheId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CacheId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CacheId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CacheName, ok = parsed.Parsed["cacheName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cacheName", *parsed) + if id.CacheName, ok = input.Parsed["cacheName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cacheName", input) } - return &id, nil + return nil } // ValidateCacheID checks that 'input' can be parsed as a Cache ID diff --git a/resource-manager/storagecache/2023-05-01/storagetargets/id_storagetarget.go b/resource-manager/storagecache/2023-05-01/storagetargets/id_storagetarget.go index d3b75b75d47..76884f74260 100644 --- a/resource-manager/storagecache/2023-05-01/storagetargets/id_storagetarget.go +++ b/resource-manager/storagecache/2023-05-01/storagetargets/id_storagetarget.go @@ -38,23 +38,9 @@ func ParseStorageTargetID(input string) (*StorageTargetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageTargetId{} - - 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.CacheName, ok = parsed.Parsed["cacheName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cacheName", *parsed) - } - - if id.StorageTargetName, ok = parsed.Parsed["storageTargetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageTargetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseStorageTargetIDInsensitively(input string) (*StorageTargetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageTargetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *StorageTargetId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CacheName, ok = parsed.Parsed["cacheName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cacheName", *parsed) + if id.CacheName, ok = input.Parsed["cacheName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cacheName", input) } - if id.StorageTargetName, ok = parsed.Parsed["storageTargetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageTargetName", *parsed) + if id.StorageTargetName, ok = input.Parsed["storageTargetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageTargetName", input) } - return &id, nil + return nil } // ValidateStorageTargetID checks that 'input' can be parsed as a Storage Target ID diff --git a/resource-manager/storagemover/2023-03-01/agents/id_agent.go b/resource-manager/storagemover/2023-03-01/agents/id_agent.go index 2552f15788f..f9bf01d3e46 100644 --- a/resource-manager/storagemover/2023-03-01/agents/id_agent.go +++ b/resource-manager/storagemover/2023-03-01/agents/id_agent.go @@ -38,23 +38,9 @@ func ParseAgentID(input string) (*AgentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AgentId{} - - 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.StorageMoverName, ok = parsed.Parsed["storageMoverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", *parsed) - } - - if id.AgentName, ok = parsed.Parsed["agentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "agentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAgentIDInsensitively(input string) (*AgentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AgentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AgentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageMoverName, ok = parsed.Parsed["storageMoverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", *parsed) + if id.StorageMoverName, ok = input.Parsed["storageMoverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", input) } - if id.AgentName, ok = parsed.Parsed["agentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "agentName", *parsed) + if id.AgentName, ok = input.Parsed["agentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "agentName", input) } - return &id, nil + return nil } // ValidateAgentID checks that 'input' can be parsed as a Agent ID diff --git a/resource-manager/storagemover/2023-03-01/agents/id_storagemover.go b/resource-manager/storagemover/2023-03-01/agents/id_storagemover.go index b3a746d8bd6..5806023a36c 100644 --- a/resource-manager/storagemover/2023-03-01/agents/id_storagemover.go +++ b/resource-manager/storagemover/2023-03-01/agents/id_storagemover.go @@ -36,19 +36,9 @@ func ParseStorageMoverID(input string) (*StorageMoverId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageMoverId{} - - 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.StorageMoverName, ok = parsed.Parsed["storageMoverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseStorageMoverIDInsensitively(input string) (*StorageMoverId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageMoverId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *StorageMoverId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageMoverName, ok = parsed.Parsed["storageMoverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", *parsed) + if id.StorageMoverName, ok = input.Parsed["storageMoverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", input) } - return &id, nil + return nil } // ValidateStorageMoverID checks that 'input' can be parsed as a Storage Mover ID diff --git a/resource-manager/storagemover/2023-03-01/endpoints/id_endpoint.go b/resource-manager/storagemover/2023-03-01/endpoints/id_endpoint.go index a20df103b0f..58fdfeb2413 100644 --- a/resource-manager/storagemover/2023-03-01/endpoints/id_endpoint.go +++ b/resource-manager/storagemover/2023-03-01/endpoints/id_endpoint.go @@ -38,23 +38,9 @@ func ParseEndpointID(input string) (*EndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EndpointId{} - - 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.StorageMoverName, ok = parsed.Parsed["storageMoverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", *parsed) - } - - if id.EndpointName, ok = parsed.Parsed["endpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "endpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseEndpointIDInsensitively(input string) (*EndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EndpointId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageMoverName, ok = parsed.Parsed["storageMoverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", *parsed) + if id.StorageMoverName, ok = input.Parsed["storageMoverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", input) } - if id.EndpointName, ok = parsed.Parsed["endpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "endpointName", *parsed) + if id.EndpointName, ok = input.Parsed["endpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "endpointName", input) } - return &id, nil + return nil } // ValidateEndpointID checks that 'input' can be parsed as a Endpoint ID diff --git a/resource-manager/storagemover/2023-03-01/endpoints/id_storagemover.go b/resource-manager/storagemover/2023-03-01/endpoints/id_storagemover.go index dea7c53831a..1fbaa237963 100644 --- a/resource-manager/storagemover/2023-03-01/endpoints/id_storagemover.go +++ b/resource-manager/storagemover/2023-03-01/endpoints/id_storagemover.go @@ -36,19 +36,9 @@ func ParseStorageMoverID(input string) (*StorageMoverId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageMoverId{} - - 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.StorageMoverName, ok = parsed.Parsed["storageMoverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseStorageMoverIDInsensitively(input string) (*StorageMoverId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageMoverId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *StorageMoverId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageMoverName, ok = parsed.Parsed["storageMoverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", *parsed) + if id.StorageMoverName, ok = input.Parsed["storageMoverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", input) } - return &id, nil + return nil } // ValidateStorageMoverID checks that 'input' can be parsed as a Storage Mover ID diff --git a/resource-manager/storagemover/2023-03-01/jobdefinitions/id_jobdefinition.go b/resource-manager/storagemover/2023-03-01/jobdefinitions/id_jobdefinition.go index cea846be374..7bf0fe8ccf1 100644 --- a/resource-manager/storagemover/2023-03-01/jobdefinitions/id_jobdefinition.go +++ b/resource-manager/storagemover/2023-03-01/jobdefinitions/id_jobdefinition.go @@ -40,27 +40,9 @@ func ParseJobDefinitionID(input string) (*JobDefinitionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobDefinitionId{} - - 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.StorageMoverName, ok = parsed.Parsed["storageMoverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) - } - - if id.JobDefinitionName, ok = parsed.Parsed["jobDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobDefinitionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseJobDefinitionIDInsensitively(input string) (*JobDefinitionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobDefinitionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *JobDefinitionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageMoverName, ok = parsed.Parsed["storageMoverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", *parsed) + if id.StorageMoverName, ok = input.Parsed["storageMoverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - if id.JobDefinitionName, ok = parsed.Parsed["jobDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobDefinitionName", *parsed) + if id.JobDefinitionName, ok = input.Parsed["jobDefinitionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobDefinitionName", input) } - return &id, nil + return nil } // ValidateJobDefinitionID checks that 'input' can be parsed as a Job Definition ID diff --git a/resource-manager/storagemover/2023-03-01/jobdefinitions/id_project.go b/resource-manager/storagemover/2023-03-01/jobdefinitions/id_project.go index 45d9648fe50..b80a07235b0 100644 --- a/resource-manager/storagemover/2023-03-01/jobdefinitions/id_project.go +++ b/resource-manager/storagemover/2023-03-01/jobdefinitions/id_project.go @@ -38,23 +38,9 @@ func ParseProjectID(input string) (*ProjectId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProjectId{} - - 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.StorageMoverName, ok = parsed.Parsed["storageMoverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProjectIDInsensitively(input string) (*ProjectId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProjectId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProjectId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageMoverName, ok = parsed.Parsed["storageMoverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", *parsed) + if id.StorageMoverName, ok = input.Parsed["storageMoverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - return &id, nil + return nil } // ValidateProjectID checks that 'input' can be parsed as a Project ID diff --git a/resource-manager/storagemover/2023-03-01/jobruns/id_jobdefinition.go b/resource-manager/storagemover/2023-03-01/jobruns/id_jobdefinition.go index f469a7a2bb8..5eeae8dc4d1 100644 --- a/resource-manager/storagemover/2023-03-01/jobruns/id_jobdefinition.go +++ b/resource-manager/storagemover/2023-03-01/jobruns/id_jobdefinition.go @@ -40,27 +40,9 @@ func ParseJobDefinitionID(input string) (*JobDefinitionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobDefinitionId{} - - 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.StorageMoverName, ok = parsed.Parsed["storageMoverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) - } - - if id.JobDefinitionName, ok = parsed.Parsed["jobDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobDefinitionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseJobDefinitionIDInsensitively(input string) (*JobDefinitionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobDefinitionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *JobDefinitionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageMoverName, ok = parsed.Parsed["storageMoverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", *parsed) + if id.StorageMoverName, ok = input.Parsed["storageMoverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - if id.JobDefinitionName, ok = parsed.Parsed["jobDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobDefinitionName", *parsed) + if id.JobDefinitionName, ok = input.Parsed["jobDefinitionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobDefinitionName", input) } - return &id, nil + return nil } // ValidateJobDefinitionID checks that 'input' can be parsed as a Job Definition ID diff --git a/resource-manager/storagemover/2023-03-01/jobruns/id_jobrun.go b/resource-manager/storagemover/2023-03-01/jobruns/id_jobrun.go index 1e1cccf897a..706fbd7c735 100644 --- a/resource-manager/storagemover/2023-03-01/jobruns/id_jobrun.go +++ b/resource-manager/storagemover/2023-03-01/jobruns/id_jobrun.go @@ -42,31 +42,9 @@ func ParseJobRunID(input string) (*JobRunId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobRunId{} - - 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.StorageMoverName, ok = parsed.Parsed["storageMoverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) - } - - if id.JobDefinitionName, ok = parsed.Parsed["jobDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobDefinitionName", *parsed) - } - - if id.JobRunName, ok = parsed.Parsed["jobRunName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobRunName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseJobRunIDInsensitively(input string) (*JobRunId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobRunId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *JobRunId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageMoverName, ok = parsed.Parsed["storageMoverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", *parsed) + if id.StorageMoverName, ok = input.Parsed["storageMoverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - if id.JobDefinitionName, ok = parsed.Parsed["jobDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobDefinitionName", *parsed) + if id.JobDefinitionName, ok = input.Parsed["jobDefinitionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobDefinitionName", input) } - if id.JobRunName, ok = parsed.Parsed["jobRunName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobRunName", *parsed) + if id.JobRunName, ok = input.Parsed["jobRunName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobRunName", input) } - return &id, nil + return nil } // ValidateJobRunID checks that 'input' can be parsed as a Job Run ID diff --git a/resource-manager/storagemover/2023-03-01/projects/id_project.go b/resource-manager/storagemover/2023-03-01/projects/id_project.go index c32f6421bdc..fbb30d075e4 100644 --- a/resource-manager/storagemover/2023-03-01/projects/id_project.go +++ b/resource-manager/storagemover/2023-03-01/projects/id_project.go @@ -38,23 +38,9 @@ func ParseProjectID(input string) (*ProjectId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProjectId{} - - 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.StorageMoverName, ok = parsed.Parsed["storageMoverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProjectIDInsensitively(input string) (*ProjectId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProjectId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProjectId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageMoverName, ok = parsed.Parsed["storageMoverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", *parsed) + if id.StorageMoverName, ok = input.Parsed["storageMoverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - return &id, nil + return nil } // ValidateProjectID checks that 'input' can be parsed as a Project ID diff --git a/resource-manager/storagemover/2023-03-01/projects/id_storagemover.go b/resource-manager/storagemover/2023-03-01/projects/id_storagemover.go index 23054ca367b..7f7cafcd59e 100644 --- a/resource-manager/storagemover/2023-03-01/projects/id_storagemover.go +++ b/resource-manager/storagemover/2023-03-01/projects/id_storagemover.go @@ -36,19 +36,9 @@ func ParseStorageMoverID(input string) (*StorageMoverId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageMoverId{} - - 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.StorageMoverName, ok = parsed.Parsed["storageMoverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseStorageMoverIDInsensitively(input string) (*StorageMoverId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageMoverId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *StorageMoverId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageMoverName, ok = parsed.Parsed["storageMoverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", *parsed) + if id.StorageMoverName, ok = input.Parsed["storageMoverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", input) } - return &id, nil + return nil } // ValidateStorageMoverID checks that 'input' can be parsed as a Storage Mover ID diff --git a/resource-manager/storagemover/2023-03-01/storagemovers/id_storagemover.go b/resource-manager/storagemover/2023-03-01/storagemovers/id_storagemover.go index aa5244fb596..70627784b69 100644 --- a/resource-manager/storagemover/2023-03-01/storagemovers/id_storagemover.go +++ b/resource-manager/storagemover/2023-03-01/storagemovers/id_storagemover.go @@ -36,19 +36,9 @@ func ParseStorageMoverID(input string) (*StorageMoverId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageMoverId{} - - 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.StorageMoverName, ok = parsed.Parsed["storageMoverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseStorageMoverIDInsensitively(input string) (*StorageMoverId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageMoverId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *StorageMoverId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageMoverName, ok = parsed.Parsed["storageMoverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", *parsed) + if id.StorageMoverName, ok = input.Parsed["storageMoverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", input) } - return &id, nil + return nil } // ValidateStorageMoverID checks that 'input' can be parsed as a Storage Mover ID diff --git a/resource-manager/storagemover/2023-10-01/agents/id_agent.go b/resource-manager/storagemover/2023-10-01/agents/id_agent.go index 2552f15788f..f9bf01d3e46 100644 --- a/resource-manager/storagemover/2023-10-01/agents/id_agent.go +++ b/resource-manager/storagemover/2023-10-01/agents/id_agent.go @@ -38,23 +38,9 @@ func ParseAgentID(input string) (*AgentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AgentId{} - - 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.StorageMoverName, ok = parsed.Parsed["storageMoverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", *parsed) - } - - if id.AgentName, ok = parsed.Parsed["agentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "agentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAgentIDInsensitively(input string) (*AgentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AgentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AgentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageMoverName, ok = parsed.Parsed["storageMoverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", *parsed) + if id.StorageMoverName, ok = input.Parsed["storageMoverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", input) } - if id.AgentName, ok = parsed.Parsed["agentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "agentName", *parsed) + if id.AgentName, ok = input.Parsed["agentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "agentName", input) } - return &id, nil + return nil } // ValidateAgentID checks that 'input' can be parsed as a Agent ID diff --git a/resource-manager/storagemover/2023-10-01/agents/id_storagemover.go b/resource-manager/storagemover/2023-10-01/agents/id_storagemover.go index b3a746d8bd6..5806023a36c 100644 --- a/resource-manager/storagemover/2023-10-01/agents/id_storagemover.go +++ b/resource-manager/storagemover/2023-10-01/agents/id_storagemover.go @@ -36,19 +36,9 @@ func ParseStorageMoverID(input string) (*StorageMoverId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageMoverId{} - - 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.StorageMoverName, ok = parsed.Parsed["storageMoverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseStorageMoverIDInsensitively(input string) (*StorageMoverId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageMoverId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *StorageMoverId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageMoverName, ok = parsed.Parsed["storageMoverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", *parsed) + if id.StorageMoverName, ok = input.Parsed["storageMoverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", input) } - return &id, nil + return nil } // ValidateStorageMoverID checks that 'input' can be parsed as a Storage Mover ID diff --git a/resource-manager/storagemover/2023-10-01/endpoints/id_endpoint.go b/resource-manager/storagemover/2023-10-01/endpoints/id_endpoint.go index a20df103b0f..58fdfeb2413 100644 --- a/resource-manager/storagemover/2023-10-01/endpoints/id_endpoint.go +++ b/resource-manager/storagemover/2023-10-01/endpoints/id_endpoint.go @@ -38,23 +38,9 @@ func ParseEndpointID(input string) (*EndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EndpointId{} - - 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.StorageMoverName, ok = parsed.Parsed["storageMoverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", *parsed) - } - - if id.EndpointName, ok = parsed.Parsed["endpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "endpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseEndpointIDInsensitively(input string) (*EndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EndpointId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageMoverName, ok = parsed.Parsed["storageMoverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", *parsed) + if id.StorageMoverName, ok = input.Parsed["storageMoverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", input) } - if id.EndpointName, ok = parsed.Parsed["endpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "endpointName", *parsed) + if id.EndpointName, ok = input.Parsed["endpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "endpointName", input) } - return &id, nil + return nil } // ValidateEndpointID checks that 'input' can be parsed as a Endpoint ID diff --git a/resource-manager/storagemover/2023-10-01/endpoints/id_storagemover.go b/resource-manager/storagemover/2023-10-01/endpoints/id_storagemover.go index dea7c53831a..1fbaa237963 100644 --- a/resource-manager/storagemover/2023-10-01/endpoints/id_storagemover.go +++ b/resource-manager/storagemover/2023-10-01/endpoints/id_storagemover.go @@ -36,19 +36,9 @@ func ParseStorageMoverID(input string) (*StorageMoverId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageMoverId{} - - 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.StorageMoverName, ok = parsed.Parsed["storageMoverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseStorageMoverIDInsensitively(input string) (*StorageMoverId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageMoverId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *StorageMoverId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageMoverName, ok = parsed.Parsed["storageMoverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", *parsed) + if id.StorageMoverName, ok = input.Parsed["storageMoverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", input) } - return &id, nil + return nil } // ValidateStorageMoverID checks that 'input' can be parsed as a Storage Mover ID diff --git a/resource-manager/storagemover/2023-10-01/jobdefinitions/id_jobdefinition.go b/resource-manager/storagemover/2023-10-01/jobdefinitions/id_jobdefinition.go index cea846be374..7bf0fe8ccf1 100644 --- a/resource-manager/storagemover/2023-10-01/jobdefinitions/id_jobdefinition.go +++ b/resource-manager/storagemover/2023-10-01/jobdefinitions/id_jobdefinition.go @@ -40,27 +40,9 @@ func ParseJobDefinitionID(input string) (*JobDefinitionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobDefinitionId{} - - 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.StorageMoverName, ok = parsed.Parsed["storageMoverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) - } - - if id.JobDefinitionName, ok = parsed.Parsed["jobDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobDefinitionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseJobDefinitionIDInsensitively(input string) (*JobDefinitionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobDefinitionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *JobDefinitionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageMoverName, ok = parsed.Parsed["storageMoverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", *parsed) + if id.StorageMoverName, ok = input.Parsed["storageMoverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - if id.JobDefinitionName, ok = parsed.Parsed["jobDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobDefinitionName", *parsed) + if id.JobDefinitionName, ok = input.Parsed["jobDefinitionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobDefinitionName", input) } - return &id, nil + return nil } // ValidateJobDefinitionID checks that 'input' can be parsed as a Job Definition ID diff --git a/resource-manager/storagemover/2023-10-01/jobdefinitions/id_project.go b/resource-manager/storagemover/2023-10-01/jobdefinitions/id_project.go index 45d9648fe50..b80a07235b0 100644 --- a/resource-manager/storagemover/2023-10-01/jobdefinitions/id_project.go +++ b/resource-manager/storagemover/2023-10-01/jobdefinitions/id_project.go @@ -38,23 +38,9 @@ func ParseProjectID(input string) (*ProjectId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProjectId{} - - 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.StorageMoverName, ok = parsed.Parsed["storageMoverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProjectIDInsensitively(input string) (*ProjectId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProjectId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProjectId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageMoverName, ok = parsed.Parsed["storageMoverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", *parsed) + if id.StorageMoverName, ok = input.Parsed["storageMoverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - return &id, nil + return nil } // ValidateProjectID checks that 'input' can be parsed as a Project ID diff --git a/resource-manager/storagemover/2023-10-01/jobruns/id_jobdefinition.go b/resource-manager/storagemover/2023-10-01/jobruns/id_jobdefinition.go index f469a7a2bb8..5eeae8dc4d1 100644 --- a/resource-manager/storagemover/2023-10-01/jobruns/id_jobdefinition.go +++ b/resource-manager/storagemover/2023-10-01/jobruns/id_jobdefinition.go @@ -40,27 +40,9 @@ func ParseJobDefinitionID(input string) (*JobDefinitionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobDefinitionId{} - - 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.StorageMoverName, ok = parsed.Parsed["storageMoverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) - } - - if id.JobDefinitionName, ok = parsed.Parsed["jobDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobDefinitionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseJobDefinitionIDInsensitively(input string) (*JobDefinitionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobDefinitionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *JobDefinitionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageMoverName, ok = parsed.Parsed["storageMoverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", *parsed) + if id.StorageMoverName, ok = input.Parsed["storageMoverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - if id.JobDefinitionName, ok = parsed.Parsed["jobDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobDefinitionName", *parsed) + if id.JobDefinitionName, ok = input.Parsed["jobDefinitionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobDefinitionName", input) } - return &id, nil + return nil } // ValidateJobDefinitionID checks that 'input' can be parsed as a Job Definition ID diff --git a/resource-manager/storagemover/2023-10-01/jobruns/id_jobrun.go b/resource-manager/storagemover/2023-10-01/jobruns/id_jobrun.go index 1e1cccf897a..706fbd7c735 100644 --- a/resource-manager/storagemover/2023-10-01/jobruns/id_jobrun.go +++ b/resource-manager/storagemover/2023-10-01/jobruns/id_jobrun.go @@ -42,31 +42,9 @@ func ParseJobRunID(input string) (*JobRunId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobRunId{} - - 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.StorageMoverName, ok = parsed.Parsed["storageMoverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) - } - - if id.JobDefinitionName, ok = parsed.Parsed["jobDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobDefinitionName", *parsed) - } - - if id.JobRunName, ok = parsed.Parsed["jobRunName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobRunName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseJobRunIDInsensitively(input string) (*JobRunId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := JobRunId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *JobRunId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageMoverName, ok = parsed.Parsed["storageMoverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", *parsed) + if id.StorageMoverName, ok = input.Parsed["storageMoverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - if id.JobDefinitionName, ok = parsed.Parsed["jobDefinitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobDefinitionName", *parsed) + if id.JobDefinitionName, ok = input.Parsed["jobDefinitionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobDefinitionName", input) } - if id.JobRunName, ok = parsed.Parsed["jobRunName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "jobRunName", *parsed) + if id.JobRunName, ok = input.Parsed["jobRunName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "jobRunName", input) } - return &id, nil + return nil } // ValidateJobRunID checks that 'input' can be parsed as a Job Run ID diff --git a/resource-manager/storagemover/2023-10-01/projects/id_project.go b/resource-manager/storagemover/2023-10-01/projects/id_project.go index c32f6421bdc..fbb30d075e4 100644 --- a/resource-manager/storagemover/2023-10-01/projects/id_project.go +++ b/resource-manager/storagemover/2023-10-01/projects/id_project.go @@ -38,23 +38,9 @@ func ParseProjectID(input string) (*ProjectId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProjectId{} - - 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.StorageMoverName, ok = parsed.Parsed["storageMoverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", *parsed) - } - - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProjectIDInsensitively(input string) (*ProjectId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProjectId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProjectId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageMoverName, ok = parsed.Parsed["storageMoverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", *parsed) + if id.StorageMoverName, ok = input.Parsed["storageMoverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", input) } - if id.ProjectName, ok = parsed.Parsed["projectName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "projectName", *parsed) + if id.ProjectName, ok = input.Parsed["projectName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "projectName", input) } - return &id, nil + return nil } // ValidateProjectID checks that 'input' can be parsed as a Project ID diff --git a/resource-manager/storagemover/2023-10-01/projects/id_storagemover.go b/resource-manager/storagemover/2023-10-01/projects/id_storagemover.go index 23054ca367b..7f7cafcd59e 100644 --- a/resource-manager/storagemover/2023-10-01/projects/id_storagemover.go +++ b/resource-manager/storagemover/2023-10-01/projects/id_storagemover.go @@ -36,19 +36,9 @@ func ParseStorageMoverID(input string) (*StorageMoverId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageMoverId{} - - 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.StorageMoverName, ok = parsed.Parsed["storageMoverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseStorageMoverIDInsensitively(input string) (*StorageMoverId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageMoverId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *StorageMoverId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageMoverName, ok = parsed.Parsed["storageMoverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", *parsed) + if id.StorageMoverName, ok = input.Parsed["storageMoverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", input) } - return &id, nil + return nil } // ValidateStorageMoverID checks that 'input' can be parsed as a Storage Mover ID diff --git a/resource-manager/storagemover/2023-10-01/storagemovers/id_storagemover.go b/resource-manager/storagemover/2023-10-01/storagemovers/id_storagemover.go index aa5244fb596..70627784b69 100644 --- a/resource-manager/storagemover/2023-10-01/storagemovers/id_storagemover.go +++ b/resource-manager/storagemover/2023-10-01/storagemovers/id_storagemover.go @@ -36,19 +36,9 @@ func ParseStorageMoverID(input string) (*StorageMoverId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageMoverId{} - - 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.StorageMoverName, ok = parsed.Parsed["storageMoverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseStorageMoverIDInsensitively(input string) (*StorageMoverId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageMoverId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *StorageMoverId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageMoverName, ok = parsed.Parsed["storageMoverName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", *parsed) + if id.StorageMoverName, ok = input.Parsed["storageMoverName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageMoverName", input) } - return &id, nil + return nil } // ValidateStorageMoverID checks that 'input' can be parsed as a Storage Mover ID diff --git a/resource-manager/storagepool/2021-08-01/diskpools/id_diskpool.go b/resource-manager/storagepool/2021-08-01/diskpools/id_diskpool.go index 4854368d1a8..00b7a1a2bbf 100644 --- a/resource-manager/storagepool/2021-08-01/diskpools/id_diskpool.go +++ b/resource-manager/storagepool/2021-08-01/diskpools/id_diskpool.go @@ -36,19 +36,9 @@ func ParseDiskPoolID(input string) (*DiskPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiskPoolId{} - - 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.DiskPoolName, ok = parsed.Parsed["diskPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diskPoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDiskPoolIDInsensitively(input string) (*DiskPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiskPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DiskPoolId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DiskPoolName, ok = parsed.Parsed["diskPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diskPoolName", *parsed) + if id.DiskPoolName, ok = input.Parsed["diskPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "diskPoolName", input) } - return &id, nil + return nil } // ValidateDiskPoolID checks that 'input' can be parsed as a Disk Pool ID diff --git a/resource-manager/storagepool/2021-08-01/diskpoolzones/id_location.go b/resource-manager/storagepool/2021-08-01/diskpoolzones/id_location.go index 6b5aa21b143..227aea93596 100644 --- a/resource-manager/storagepool/2021-08-01/diskpoolzones/id_location.go +++ b/resource-manager/storagepool/2021-08-01/diskpoolzones/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/storagepool/2021-08-01/iscsitargets/id_diskpool.go b/resource-manager/storagepool/2021-08-01/iscsitargets/id_diskpool.go index a4ced72ce56..7a0bcce57c1 100644 --- a/resource-manager/storagepool/2021-08-01/iscsitargets/id_diskpool.go +++ b/resource-manager/storagepool/2021-08-01/iscsitargets/id_diskpool.go @@ -36,19 +36,9 @@ func ParseDiskPoolID(input string) (*DiskPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiskPoolId{} - - 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.DiskPoolName, ok = parsed.Parsed["diskPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diskPoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDiskPoolIDInsensitively(input string) (*DiskPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiskPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DiskPoolId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DiskPoolName, ok = parsed.Parsed["diskPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diskPoolName", *parsed) + if id.DiskPoolName, ok = input.Parsed["diskPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "diskPoolName", input) } - return &id, nil + return nil } // ValidateDiskPoolID checks that 'input' can be parsed as a Disk Pool ID diff --git a/resource-manager/storagepool/2021-08-01/iscsitargets/id_iscsitarget.go b/resource-manager/storagepool/2021-08-01/iscsitargets/id_iscsitarget.go index f851d9ec977..81287a59635 100644 --- a/resource-manager/storagepool/2021-08-01/iscsitargets/id_iscsitarget.go +++ b/resource-manager/storagepool/2021-08-01/iscsitargets/id_iscsitarget.go @@ -38,23 +38,9 @@ func ParseIscsiTargetID(input string) (*IscsiTargetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IscsiTargetId{} - - 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.DiskPoolName, ok = parsed.Parsed["diskPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diskPoolName", *parsed) - } - - if id.IscsiTargetName, ok = parsed.Parsed["iscsiTargetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "iscsiTargetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseIscsiTargetIDInsensitively(input string) (*IscsiTargetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := IscsiTargetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *IscsiTargetId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DiskPoolName, ok = parsed.Parsed["diskPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diskPoolName", *parsed) + if id.DiskPoolName, ok = input.Parsed["diskPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "diskPoolName", input) } - if id.IscsiTargetName, ok = parsed.Parsed["iscsiTargetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "iscsiTargetName", *parsed) + if id.IscsiTargetName, ok = input.Parsed["iscsiTargetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "iscsiTargetName", input) } - return &id, nil + return nil } // ValidateIscsiTargetID checks that 'input' can be parsed as a Iscsi Target ID diff --git a/resource-manager/storagepool/2021-08-01/resourceskus/id_location.go b/resource-manager/storagepool/2021-08-01/resourceskus/id_location.go index a57ad41ceb3..299b75fd401 100644 --- a/resource-manager/storagepool/2021-08-01/resourceskus/id_location.go +++ b/resource-manager/storagepool/2021-08-01/resourceskus/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/storagesync/2020-03-01/actions/id_cloudendpoint.go b/resource-manager/storagesync/2020-03-01/actions/id_cloudendpoint.go index f87b13ea957..e772aac4e86 100644 --- a/resource-manager/storagesync/2020-03-01/actions/id_cloudendpoint.go +++ b/resource-manager/storagesync/2020-03-01/actions/id_cloudendpoint.go @@ -40,27 +40,9 @@ func ParseCloudEndpointID(input string) (*CloudEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CloudEndpointId{} - - 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.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) - } - - if id.SyncGroupName, ok = parsed.Parsed["syncGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", *parsed) - } - - if id.CloudEndpointName, ok = parsed.Parsed["cloudEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseCloudEndpointIDInsensitively(input string) (*CloudEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CloudEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *CloudEndpointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if id.StorageSyncServiceName, ok = input.Parsed["storageSyncServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", input) } - if id.SyncGroupName, ok = parsed.Parsed["syncGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", *parsed) + if id.SyncGroupName, ok = input.Parsed["syncGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", input) } - if id.CloudEndpointName, ok = parsed.Parsed["cloudEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudEndpointName", *parsed) + if id.CloudEndpointName, ok = input.Parsed["cloudEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cloudEndpointName", input) } - return &id, nil + return nil } // ValidateCloudEndpointID checks that 'input' can be parsed as a Cloud Endpoint ID diff --git a/resource-manager/storagesync/2020-03-01/actions/id_registeredserver.go b/resource-manager/storagesync/2020-03-01/actions/id_registeredserver.go index b5e0b132cba..85df688687e 100644 --- a/resource-manager/storagesync/2020-03-01/actions/id_registeredserver.go +++ b/resource-manager/storagesync/2020-03-01/actions/id_registeredserver.go @@ -38,23 +38,9 @@ func ParseRegisteredServerID(input string) (*RegisteredServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegisteredServerId{} - - 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.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) - } - - if id.ServerId, ok = parsed.Parsed["serverId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRegisteredServerIDInsensitively(input string) (*RegisteredServerId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegisteredServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RegisteredServerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if id.StorageSyncServiceName, ok = input.Parsed["storageSyncServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", input) } - if id.ServerId, ok = parsed.Parsed["serverId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverId", *parsed) + if id.ServerId, ok = input.Parsed["serverId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverId", input) } - return &id, nil + return nil } // ValidateRegisteredServerID checks that 'input' can be parsed as a Registered Server ID diff --git a/resource-manager/storagesync/2020-03-01/actions/id_serverendpoint.go b/resource-manager/storagesync/2020-03-01/actions/id_serverendpoint.go index 17e5e10c3ca..78659d7ee33 100644 --- a/resource-manager/storagesync/2020-03-01/actions/id_serverendpoint.go +++ b/resource-manager/storagesync/2020-03-01/actions/id_serverendpoint.go @@ -40,27 +40,9 @@ func ParseServerEndpointID(input string) (*ServerEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerEndpointId{} - - 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.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) - } - - if id.SyncGroupName, ok = parsed.Parsed["syncGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", *parsed) - } - - if id.ServerEndpointName, ok = parsed.Parsed["serverEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseServerEndpointIDInsensitively(input string) (*ServerEndpointId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ServerEndpointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if id.StorageSyncServiceName, ok = input.Parsed["storageSyncServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", input) } - if id.SyncGroupName, ok = parsed.Parsed["syncGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", *parsed) + if id.SyncGroupName, ok = input.Parsed["syncGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", input) } - if id.ServerEndpointName, ok = parsed.Parsed["serverEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverEndpointName", *parsed) + if id.ServerEndpointName, ok = input.Parsed["serverEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverEndpointName", input) } - return &id, nil + return nil } // ValidateServerEndpointID checks that 'input' can be parsed as a Server Endpoint ID diff --git a/resource-manager/storagesync/2020-03-01/actions/id_workflow.go b/resource-manager/storagesync/2020-03-01/actions/id_workflow.go index d125d75c8e1..c332a44d2f5 100644 --- a/resource-manager/storagesync/2020-03-01/actions/id_workflow.go +++ b/resource-manager/storagesync/2020-03-01/actions/id_workflow.go @@ -38,23 +38,9 @@ func ParseWorkflowID(input string) (*WorkflowId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkflowId{} - - 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.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) - } - - if id.WorkflowId, ok = parsed.Parsed["workflowId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWorkflowIDInsensitively(input string) (*WorkflowId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkflowId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WorkflowId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if id.StorageSyncServiceName, ok = input.Parsed["storageSyncServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", input) } - if id.WorkflowId, ok = parsed.Parsed["workflowId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowId", *parsed) + if id.WorkflowId, ok = input.Parsed["workflowId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowId", input) } - return &id, nil + return nil } // ValidateWorkflowID checks that 'input' can be parsed as a Workflow ID diff --git a/resource-manager/storagesync/2020-03-01/backuprestore/id_cloudendpoint.go b/resource-manager/storagesync/2020-03-01/backuprestore/id_cloudendpoint.go index f6a4587e64b..f8dfaba5fc3 100644 --- a/resource-manager/storagesync/2020-03-01/backuprestore/id_cloudendpoint.go +++ b/resource-manager/storagesync/2020-03-01/backuprestore/id_cloudendpoint.go @@ -40,27 +40,9 @@ func ParseCloudEndpointID(input string) (*CloudEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CloudEndpointId{} - - 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.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) - } - - if id.SyncGroupName, ok = parsed.Parsed["syncGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", *parsed) - } - - if id.CloudEndpointName, ok = parsed.Parsed["cloudEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseCloudEndpointIDInsensitively(input string) (*CloudEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CloudEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *CloudEndpointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if id.StorageSyncServiceName, ok = input.Parsed["storageSyncServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", input) } - if id.SyncGroupName, ok = parsed.Parsed["syncGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", *parsed) + if id.SyncGroupName, ok = input.Parsed["syncGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", input) } - if id.CloudEndpointName, ok = parsed.Parsed["cloudEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudEndpointName", *parsed) + if id.CloudEndpointName, ok = input.Parsed["cloudEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cloudEndpointName", input) } - return &id, nil + return nil } // ValidateCloudEndpointID checks that 'input' can be parsed as a Cloud Endpoint ID diff --git a/resource-manager/storagesync/2020-03-01/changedetection/id_cloudendpoint.go b/resource-manager/storagesync/2020-03-01/changedetection/id_cloudendpoint.go index f5cadada991..cfda791f505 100644 --- a/resource-manager/storagesync/2020-03-01/changedetection/id_cloudendpoint.go +++ b/resource-manager/storagesync/2020-03-01/changedetection/id_cloudendpoint.go @@ -40,27 +40,9 @@ func ParseCloudEndpointID(input string) (*CloudEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CloudEndpointId{} - - 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.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) - } - - if id.SyncGroupName, ok = parsed.Parsed["syncGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", *parsed) - } - - if id.CloudEndpointName, ok = parsed.Parsed["cloudEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseCloudEndpointIDInsensitively(input string) (*CloudEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CloudEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *CloudEndpointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if id.StorageSyncServiceName, ok = input.Parsed["storageSyncServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", input) } - if id.SyncGroupName, ok = parsed.Parsed["syncGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", *parsed) + if id.SyncGroupName, ok = input.Parsed["syncGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", input) } - if id.CloudEndpointName, ok = parsed.Parsed["cloudEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudEndpointName", *parsed) + if id.CloudEndpointName, ok = input.Parsed["cloudEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cloudEndpointName", input) } - return &id, nil + return nil } // ValidateCloudEndpointID checks that 'input' can be parsed as a Cloud Endpoint ID diff --git a/resource-manager/storagesync/2020-03-01/cloudendpointresource/id_cloudendpoint.go b/resource-manager/storagesync/2020-03-01/cloudendpointresource/id_cloudendpoint.go index 2baff1c23a4..2e90d872202 100644 --- a/resource-manager/storagesync/2020-03-01/cloudendpointresource/id_cloudendpoint.go +++ b/resource-manager/storagesync/2020-03-01/cloudendpointresource/id_cloudendpoint.go @@ -40,27 +40,9 @@ func ParseCloudEndpointID(input string) (*CloudEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CloudEndpointId{} - - 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.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) - } - - if id.SyncGroupName, ok = parsed.Parsed["syncGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", *parsed) - } - - if id.CloudEndpointName, ok = parsed.Parsed["cloudEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseCloudEndpointIDInsensitively(input string) (*CloudEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CloudEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *CloudEndpointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if id.StorageSyncServiceName, ok = input.Parsed["storageSyncServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", input) } - if id.SyncGroupName, ok = parsed.Parsed["syncGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", *parsed) + if id.SyncGroupName, ok = input.Parsed["syncGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", input) } - if id.CloudEndpointName, ok = parsed.Parsed["cloudEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudEndpointName", *parsed) + if id.CloudEndpointName, ok = input.Parsed["cloudEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cloudEndpointName", input) } - return &id, nil + return nil } // ValidateCloudEndpointID checks that 'input' can be parsed as a Cloud Endpoint ID diff --git a/resource-manager/storagesync/2020-03-01/cloudendpointresource/id_syncgroup.go b/resource-manager/storagesync/2020-03-01/cloudendpointresource/id_syncgroup.go index 544c9d0cddc..aad0297ae0d 100644 --- a/resource-manager/storagesync/2020-03-01/cloudendpointresource/id_syncgroup.go +++ b/resource-manager/storagesync/2020-03-01/cloudendpointresource/id_syncgroup.go @@ -38,23 +38,9 @@ func ParseSyncGroupID(input string) (*SyncGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SyncGroupId{} - - 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.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) - } - - if id.SyncGroupName, ok = parsed.Parsed["syncGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSyncGroupIDInsensitively(input string) (*SyncGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SyncGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SyncGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if id.StorageSyncServiceName, ok = input.Parsed["storageSyncServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", input) } - if id.SyncGroupName, ok = parsed.Parsed["syncGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", *parsed) + if id.SyncGroupName, ok = input.Parsed["syncGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", input) } - return &id, nil + return nil } // ValidateSyncGroupID checks that 'input' can be parsed as a Sync Group ID diff --git a/resource-manager/storagesync/2020-03-01/operationstatus/id_operation.go b/resource-manager/storagesync/2020-03-01/operationstatus/id_operation.go index bdc9ed5740b..eb6e1112032 100644 --- a/resource-manager/storagesync/2020-03-01/operationstatus/id_operation.go +++ b/resource-manager/storagesync/2020-03-01/operationstatus/id_operation.go @@ -36,19 +36,9 @@ func ParseOperationID(input string) (*OperationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseOperationIDInsensitively(input string) (*OperationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *OperationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if id.OperationId, ok = input.Parsed["operationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "operationId", input) } - return &id, nil + return nil } // ValidateOperationID checks that 'input' can be parsed as a Operation ID diff --git a/resource-manager/storagesync/2020-03-01/privateendpointconnectionresource/id_storagesyncservice.go b/resource-manager/storagesync/2020-03-01/privateendpointconnectionresource/id_storagesyncservice.go index a48af7233c3..ddb7c1ddf85 100644 --- a/resource-manager/storagesync/2020-03-01/privateendpointconnectionresource/id_storagesyncservice.go +++ b/resource-manager/storagesync/2020-03-01/privateendpointconnectionresource/id_storagesyncservice.go @@ -36,19 +36,9 @@ func ParseStorageSyncServiceID(input string) (*StorageSyncServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageSyncServiceId{} - - 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.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseStorageSyncServiceIDInsensitively(input string) (*StorageSyncServiceId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageSyncServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *StorageSyncServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if id.StorageSyncServiceName, ok = input.Parsed["storageSyncServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", input) } - return &id, nil + return nil } // ValidateStorageSyncServiceID checks that 'input' can be parsed as a Storage Sync Service ID diff --git a/resource-manager/storagesync/2020-03-01/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/storagesync/2020-03-01/privateendpointconnections/id_privateendpointconnection.go index 171574e64bc..3623df37ead 100644 --- a/resource-manager/storagesync/2020-03-01/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/storagesync/2020-03-01/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if id.StorageSyncServiceName, ok = input.Parsed["storageSyncServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/storagesync/2020-03-01/privatelinkresources/id_storagesyncservice.go b/resource-manager/storagesync/2020-03-01/privatelinkresources/id_storagesyncservice.go index d89fc89f3ed..1d908137988 100644 --- a/resource-manager/storagesync/2020-03-01/privatelinkresources/id_storagesyncservice.go +++ b/resource-manager/storagesync/2020-03-01/privatelinkresources/id_storagesyncservice.go @@ -36,19 +36,9 @@ func ParseStorageSyncServiceID(input string) (*StorageSyncServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageSyncServiceId{} - - 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.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseStorageSyncServiceIDInsensitively(input string) (*StorageSyncServiceId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageSyncServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *StorageSyncServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if id.StorageSyncServiceName, ok = input.Parsed["storageSyncServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", input) } - return &id, nil + return nil } // ValidateStorageSyncServiceID checks that 'input' can be parsed as a Storage Sync Service ID diff --git a/resource-manager/storagesync/2020-03-01/registeredserverresource/id_registeredserver.go b/resource-manager/storagesync/2020-03-01/registeredserverresource/id_registeredserver.go index 9d68c3364cf..2231d13c5a3 100644 --- a/resource-manager/storagesync/2020-03-01/registeredserverresource/id_registeredserver.go +++ b/resource-manager/storagesync/2020-03-01/registeredserverresource/id_registeredserver.go @@ -38,23 +38,9 @@ func ParseRegisteredServerID(input string) (*RegisteredServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegisteredServerId{} - - 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.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) - } - - if id.ServerId, ok = parsed.Parsed["serverId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRegisteredServerIDInsensitively(input string) (*RegisteredServerId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegisteredServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RegisteredServerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if id.StorageSyncServiceName, ok = input.Parsed["storageSyncServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", input) } - if id.ServerId, ok = parsed.Parsed["serverId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverId", *parsed) + if id.ServerId, ok = input.Parsed["serverId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverId", input) } - return &id, nil + return nil } // ValidateRegisteredServerID checks that 'input' can be parsed as a Registered Server ID diff --git a/resource-manager/storagesync/2020-03-01/registeredserverresource/id_storagesyncservice.go b/resource-manager/storagesync/2020-03-01/registeredserverresource/id_storagesyncservice.go index a620483e1d1..05c894c45fa 100644 --- a/resource-manager/storagesync/2020-03-01/registeredserverresource/id_storagesyncservice.go +++ b/resource-manager/storagesync/2020-03-01/registeredserverresource/id_storagesyncservice.go @@ -36,19 +36,9 @@ func ParseStorageSyncServiceID(input string) (*StorageSyncServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageSyncServiceId{} - - 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.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseStorageSyncServiceIDInsensitively(input string) (*StorageSyncServiceId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageSyncServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *StorageSyncServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if id.StorageSyncServiceName, ok = input.Parsed["storageSyncServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", input) } - return &id, nil + return nil } // ValidateStorageSyncServiceID checks that 'input' can be parsed as a Storage Sync Service ID diff --git a/resource-manager/storagesync/2020-03-01/serverendpointresource/id_serverendpoint.go b/resource-manager/storagesync/2020-03-01/serverendpointresource/id_serverendpoint.go index 8ab9a254bb4..a32443b95a3 100644 --- a/resource-manager/storagesync/2020-03-01/serverendpointresource/id_serverendpoint.go +++ b/resource-manager/storagesync/2020-03-01/serverendpointresource/id_serverendpoint.go @@ -40,27 +40,9 @@ func ParseServerEndpointID(input string) (*ServerEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerEndpointId{} - - 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.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) - } - - if id.SyncGroupName, ok = parsed.Parsed["syncGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", *parsed) - } - - if id.ServerEndpointName, ok = parsed.Parsed["serverEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseServerEndpointIDInsensitively(input string) (*ServerEndpointId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ServerEndpointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if id.StorageSyncServiceName, ok = input.Parsed["storageSyncServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", input) } - if id.SyncGroupName, ok = parsed.Parsed["syncGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", *parsed) + if id.SyncGroupName, ok = input.Parsed["syncGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", input) } - if id.ServerEndpointName, ok = parsed.Parsed["serverEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverEndpointName", *parsed) + if id.ServerEndpointName, ok = input.Parsed["serverEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverEndpointName", input) } - return &id, nil + return nil } // ValidateServerEndpointID checks that 'input' can be parsed as a Server Endpoint ID diff --git a/resource-manager/storagesync/2020-03-01/serverendpointresource/id_syncgroup.go b/resource-manager/storagesync/2020-03-01/serverendpointresource/id_syncgroup.go index c4eedf6ea1d..4b8ee7ca8fd 100644 --- a/resource-manager/storagesync/2020-03-01/serverendpointresource/id_syncgroup.go +++ b/resource-manager/storagesync/2020-03-01/serverendpointresource/id_syncgroup.go @@ -38,23 +38,9 @@ func ParseSyncGroupID(input string) (*SyncGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SyncGroupId{} - - 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.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) - } - - if id.SyncGroupName, ok = parsed.Parsed["syncGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSyncGroupIDInsensitively(input string) (*SyncGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SyncGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SyncGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if id.StorageSyncServiceName, ok = input.Parsed["storageSyncServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", input) } - if id.SyncGroupName, ok = parsed.Parsed["syncGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", *parsed) + if id.SyncGroupName, ok = input.Parsed["syncGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", input) } - return &id, nil + return nil } // ValidateSyncGroupID checks that 'input' can be parsed as a Sync Group ID diff --git a/resource-manager/storagesync/2020-03-01/storagesyncservice/id_location.go b/resource-manager/storagesync/2020-03-01/storagesyncservice/id_location.go index 6a3f665cc3d..d3d95e3f93d 100644 --- a/resource-manager/storagesync/2020-03-01/storagesyncservice/id_location.go +++ b/resource-manager/storagesync/2020-03-01/storagesyncservice/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/storagesync/2020-03-01/storagesyncservicesresource/id_storagesyncservice.go b/resource-manager/storagesync/2020-03-01/storagesyncservicesresource/id_storagesyncservice.go index 60b30adc518..2641624bebd 100644 --- a/resource-manager/storagesync/2020-03-01/storagesyncservicesresource/id_storagesyncservice.go +++ b/resource-manager/storagesync/2020-03-01/storagesyncservicesresource/id_storagesyncservice.go @@ -36,19 +36,9 @@ func ParseStorageSyncServiceID(input string) (*StorageSyncServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageSyncServiceId{} - - 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.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseStorageSyncServiceIDInsensitively(input string) (*StorageSyncServiceId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageSyncServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *StorageSyncServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if id.StorageSyncServiceName, ok = input.Parsed["storageSyncServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", input) } - return &id, nil + return nil } // ValidateStorageSyncServiceID checks that 'input' can be parsed as a Storage Sync Service ID diff --git a/resource-manager/storagesync/2020-03-01/syncgroupresource/id_storagesyncservice.go b/resource-manager/storagesync/2020-03-01/syncgroupresource/id_storagesyncservice.go index 5e4494208ea..c9fd0ab9122 100644 --- a/resource-manager/storagesync/2020-03-01/syncgroupresource/id_storagesyncservice.go +++ b/resource-manager/storagesync/2020-03-01/syncgroupresource/id_storagesyncservice.go @@ -36,19 +36,9 @@ func ParseStorageSyncServiceID(input string) (*StorageSyncServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageSyncServiceId{} - - 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.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseStorageSyncServiceIDInsensitively(input string) (*StorageSyncServiceId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageSyncServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *StorageSyncServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if id.StorageSyncServiceName, ok = input.Parsed["storageSyncServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", input) } - return &id, nil + return nil } // ValidateStorageSyncServiceID checks that 'input' can be parsed as a Storage Sync Service ID diff --git a/resource-manager/storagesync/2020-03-01/syncgroupresource/id_syncgroup.go b/resource-manager/storagesync/2020-03-01/syncgroupresource/id_syncgroup.go index a792ed1dca3..6356505ac80 100644 --- a/resource-manager/storagesync/2020-03-01/syncgroupresource/id_syncgroup.go +++ b/resource-manager/storagesync/2020-03-01/syncgroupresource/id_syncgroup.go @@ -38,23 +38,9 @@ func ParseSyncGroupID(input string) (*SyncGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SyncGroupId{} - - 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.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) - } - - if id.SyncGroupName, ok = parsed.Parsed["syncGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSyncGroupIDInsensitively(input string) (*SyncGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SyncGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SyncGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if id.StorageSyncServiceName, ok = input.Parsed["storageSyncServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", input) } - if id.SyncGroupName, ok = parsed.Parsed["syncGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", *parsed) + if id.SyncGroupName, ok = input.Parsed["syncGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", input) } - return &id, nil + return nil } // ValidateSyncGroupID checks that 'input' can be parsed as a Sync Group ID diff --git a/resource-manager/storagesync/2020-03-01/workflowresource/id_storagesyncservice.go b/resource-manager/storagesync/2020-03-01/workflowresource/id_storagesyncservice.go index 6fe675678b9..a09e1e5faaa 100644 --- a/resource-manager/storagesync/2020-03-01/workflowresource/id_storagesyncservice.go +++ b/resource-manager/storagesync/2020-03-01/workflowresource/id_storagesyncservice.go @@ -36,19 +36,9 @@ func ParseStorageSyncServiceID(input string) (*StorageSyncServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageSyncServiceId{} - - 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.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseStorageSyncServiceIDInsensitively(input string) (*StorageSyncServiceId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageSyncServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *StorageSyncServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if id.StorageSyncServiceName, ok = input.Parsed["storageSyncServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", input) } - return &id, nil + return nil } // ValidateStorageSyncServiceID checks that 'input' can be parsed as a Storage Sync Service ID diff --git a/resource-manager/storagesync/2020-03-01/workflowresource/id_workflow.go b/resource-manager/storagesync/2020-03-01/workflowresource/id_workflow.go index e55f941418d..ac4597bf3d6 100644 --- a/resource-manager/storagesync/2020-03-01/workflowresource/id_workflow.go +++ b/resource-manager/storagesync/2020-03-01/workflowresource/id_workflow.go @@ -38,23 +38,9 @@ func ParseWorkflowID(input string) (*WorkflowId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkflowId{} - - 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.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) - } - - if id.WorkflowId, ok = parsed.Parsed["workflowId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWorkflowIDInsensitively(input string) (*WorkflowId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkflowId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WorkflowId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if id.StorageSyncServiceName, ok = input.Parsed["storageSyncServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", input) } - if id.WorkflowId, ok = parsed.Parsed["workflowId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowId", *parsed) + if id.WorkflowId, ok = input.Parsed["workflowId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowId", input) } - return &id, nil + return nil } // ValidateWorkflowID checks that 'input' can be parsed as a Workflow ID diff --git a/resource-manager/storagesync/2022-09-01/actions/id_cloudendpoint.go b/resource-manager/storagesync/2022-09-01/actions/id_cloudendpoint.go index f87b13ea957..e772aac4e86 100644 --- a/resource-manager/storagesync/2022-09-01/actions/id_cloudendpoint.go +++ b/resource-manager/storagesync/2022-09-01/actions/id_cloudendpoint.go @@ -40,27 +40,9 @@ func ParseCloudEndpointID(input string) (*CloudEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CloudEndpointId{} - - 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.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) - } - - if id.SyncGroupName, ok = parsed.Parsed["syncGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", *parsed) - } - - if id.CloudEndpointName, ok = parsed.Parsed["cloudEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseCloudEndpointIDInsensitively(input string) (*CloudEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CloudEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *CloudEndpointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if id.StorageSyncServiceName, ok = input.Parsed["storageSyncServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", input) } - if id.SyncGroupName, ok = parsed.Parsed["syncGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", *parsed) + if id.SyncGroupName, ok = input.Parsed["syncGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", input) } - if id.CloudEndpointName, ok = parsed.Parsed["cloudEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudEndpointName", *parsed) + if id.CloudEndpointName, ok = input.Parsed["cloudEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cloudEndpointName", input) } - return &id, nil + return nil } // ValidateCloudEndpointID checks that 'input' can be parsed as a Cloud Endpoint ID diff --git a/resource-manager/storagesync/2022-09-01/actions/id_registeredserver.go b/resource-manager/storagesync/2022-09-01/actions/id_registeredserver.go index b5e0b132cba..85df688687e 100644 --- a/resource-manager/storagesync/2022-09-01/actions/id_registeredserver.go +++ b/resource-manager/storagesync/2022-09-01/actions/id_registeredserver.go @@ -38,23 +38,9 @@ func ParseRegisteredServerID(input string) (*RegisteredServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegisteredServerId{} - - 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.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) - } - - if id.ServerId, ok = parsed.Parsed["serverId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRegisteredServerIDInsensitively(input string) (*RegisteredServerId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegisteredServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RegisteredServerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if id.StorageSyncServiceName, ok = input.Parsed["storageSyncServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", input) } - if id.ServerId, ok = parsed.Parsed["serverId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverId", *parsed) + if id.ServerId, ok = input.Parsed["serverId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverId", input) } - return &id, nil + return nil } // ValidateRegisteredServerID checks that 'input' can be parsed as a Registered Server ID diff --git a/resource-manager/storagesync/2022-09-01/actions/id_serverendpoint.go b/resource-manager/storagesync/2022-09-01/actions/id_serverendpoint.go index 17e5e10c3ca..78659d7ee33 100644 --- a/resource-manager/storagesync/2022-09-01/actions/id_serverendpoint.go +++ b/resource-manager/storagesync/2022-09-01/actions/id_serverendpoint.go @@ -40,27 +40,9 @@ func ParseServerEndpointID(input string) (*ServerEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerEndpointId{} - - 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.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) - } - - if id.SyncGroupName, ok = parsed.Parsed["syncGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", *parsed) - } - - if id.ServerEndpointName, ok = parsed.Parsed["serverEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseServerEndpointIDInsensitively(input string) (*ServerEndpointId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ServerEndpointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if id.StorageSyncServiceName, ok = input.Parsed["storageSyncServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", input) } - if id.SyncGroupName, ok = parsed.Parsed["syncGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", *parsed) + if id.SyncGroupName, ok = input.Parsed["syncGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", input) } - if id.ServerEndpointName, ok = parsed.Parsed["serverEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverEndpointName", *parsed) + if id.ServerEndpointName, ok = input.Parsed["serverEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverEndpointName", input) } - return &id, nil + return nil } // ValidateServerEndpointID checks that 'input' can be parsed as a Server Endpoint ID diff --git a/resource-manager/storagesync/2022-09-01/actions/id_workflow.go b/resource-manager/storagesync/2022-09-01/actions/id_workflow.go index d125d75c8e1..c332a44d2f5 100644 --- a/resource-manager/storagesync/2022-09-01/actions/id_workflow.go +++ b/resource-manager/storagesync/2022-09-01/actions/id_workflow.go @@ -38,23 +38,9 @@ func ParseWorkflowID(input string) (*WorkflowId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkflowId{} - - 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.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) - } - - if id.WorkflowId, ok = parsed.Parsed["workflowId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWorkflowIDInsensitively(input string) (*WorkflowId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkflowId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WorkflowId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if id.StorageSyncServiceName, ok = input.Parsed["storageSyncServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", input) } - if id.WorkflowId, ok = parsed.Parsed["workflowId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowId", *parsed) + if id.WorkflowId, ok = input.Parsed["workflowId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowId", input) } - return &id, nil + return nil } // ValidateWorkflowID checks that 'input' can be parsed as a Workflow ID diff --git a/resource-manager/storagesync/2022-09-01/backuprestore/id_cloudendpoint.go b/resource-manager/storagesync/2022-09-01/backuprestore/id_cloudendpoint.go index f6a4587e64b..f8dfaba5fc3 100644 --- a/resource-manager/storagesync/2022-09-01/backuprestore/id_cloudendpoint.go +++ b/resource-manager/storagesync/2022-09-01/backuprestore/id_cloudendpoint.go @@ -40,27 +40,9 @@ func ParseCloudEndpointID(input string) (*CloudEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CloudEndpointId{} - - 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.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) - } - - if id.SyncGroupName, ok = parsed.Parsed["syncGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", *parsed) - } - - if id.CloudEndpointName, ok = parsed.Parsed["cloudEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseCloudEndpointIDInsensitively(input string) (*CloudEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CloudEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *CloudEndpointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if id.StorageSyncServiceName, ok = input.Parsed["storageSyncServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", input) } - if id.SyncGroupName, ok = parsed.Parsed["syncGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", *parsed) + if id.SyncGroupName, ok = input.Parsed["syncGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", input) } - if id.CloudEndpointName, ok = parsed.Parsed["cloudEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudEndpointName", *parsed) + if id.CloudEndpointName, ok = input.Parsed["cloudEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cloudEndpointName", input) } - return &id, nil + return nil } // ValidateCloudEndpointID checks that 'input' can be parsed as a Cloud Endpoint ID diff --git a/resource-manager/storagesync/2022-09-01/changedetection/id_cloudendpoint.go b/resource-manager/storagesync/2022-09-01/changedetection/id_cloudendpoint.go index f5cadada991..cfda791f505 100644 --- a/resource-manager/storagesync/2022-09-01/changedetection/id_cloudendpoint.go +++ b/resource-manager/storagesync/2022-09-01/changedetection/id_cloudendpoint.go @@ -40,27 +40,9 @@ func ParseCloudEndpointID(input string) (*CloudEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CloudEndpointId{} - - 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.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) - } - - if id.SyncGroupName, ok = parsed.Parsed["syncGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", *parsed) - } - - if id.CloudEndpointName, ok = parsed.Parsed["cloudEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseCloudEndpointIDInsensitively(input string) (*CloudEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CloudEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *CloudEndpointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if id.StorageSyncServiceName, ok = input.Parsed["storageSyncServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", input) } - if id.SyncGroupName, ok = parsed.Parsed["syncGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", *parsed) + if id.SyncGroupName, ok = input.Parsed["syncGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", input) } - if id.CloudEndpointName, ok = parsed.Parsed["cloudEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudEndpointName", *parsed) + if id.CloudEndpointName, ok = input.Parsed["cloudEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cloudEndpointName", input) } - return &id, nil + return nil } // ValidateCloudEndpointID checks that 'input' can be parsed as a Cloud Endpoint ID diff --git a/resource-manager/storagesync/2022-09-01/cloudendpointresource/id_cloudendpoint.go b/resource-manager/storagesync/2022-09-01/cloudendpointresource/id_cloudendpoint.go index 2baff1c23a4..2e90d872202 100644 --- a/resource-manager/storagesync/2022-09-01/cloudendpointresource/id_cloudendpoint.go +++ b/resource-manager/storagesync/2022-09-01/cloudendpointresource/id_cloudendpoint.go @@ -40,27 +40,9 @@ func ParseCloudEndpointID(input string) (*CloudEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CloudEndpointId{} - - 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.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) - } - - if id.SyncGroupName, ok = parsed.Parsed["syncGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", *parsed) - } - - if id.CloudEndpointName, ok = parsed.Parsed["cloudEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseCloudEndpointIDInsensitively(input string) (*CloudEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CloudEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *CloudEndpointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if id.StorageSyncServiceName, ok = input.Parsed["storageSyncServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", input) } - if id.SyncGroupName, ok = parsed.Parsed["syncGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", *parsed) + if id.SyncGroupName, ok = input.Parsed["syncGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", input) } - if id.CloudEndpointName, ok = parsed.Parsed["cloudEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudEndpointName", *parsed) + if id.CloudEndpointName, ok = input.Parsed["cloudEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cloudEndpointName", input) } - return &id, nil + return nil } // ValidateCloudEndpointID checks that 'input' can be parsed as a Cloud Endpoint ID diff --git a/resource-manager/storagesync/2022-09-01/cloudendpointresource/id_syncgroup.go b/resource-manager/storagesync/2022-09-01/cloudendpointresource/id_syncgroup.go index 544c9d0cddc..aad0297ae0d 100644 --- a/resource-manager/storagesync/2022-09-01/cloudendpointresource/id_syncgroup.go +++ b/resource-manager/storagesync/2022-09-01/cloudendpointresource/id_syncgroup.go @@ -38,23 +38,9 @@ func ParseSyncGroupID(input string) (*SyncGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SyncGroupId{} - - 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.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) - } - - if id.SyncGroupName, ok = parsed.Parsed["syncGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSyncGroupIDInsensitively(input string) (*SyncGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SyncGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SyncGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if id.StorageSyncServiceName, ok = input.Parsed["storageSyncServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", input) } - if id.SyncGroupName, ok = parsed.Parsed["syncGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", *parsed) + if id.SyncGroupName, ok = input.Parsed["syncGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", input) } - return &id, nil + return nil } // ValidateSyncGroupID checks that 'input' can be parsed as a Sync Group ID diff --git a/resource-manager/storagesync/2022-09-01/operationstatus/id_operation.go b/resource-manager/storagesync/2022-09-01/operationstatus/id_operation.go index bdc9ed5740b..eb6e1112032 100644 --- a/resource-manager/storagesync/2022-09-01/operationstatus/id_operation.go +++ b/resource-manager/storagesync/2022-09-01/operationstatus/id_operation.go @@ -36,19 +36,9 @@ func ParseOperationID(input string) (*OperationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseOperationIDInsensitively(input string) (*OperationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OperationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *OperationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if id.OperationId, ok = input.Parsed["operationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "operationId", input) } - return &id, nil + return nil } // ValidateOperationID checks that 'input' can be parsed as a Operation ID diff --git a/resource-manager/storagesync/2022-09-01/privateendpointconnectionresource/id_storagesyncservice.go b/resource-manager/storagesync/2022-09-01/privateendpointconnectionresource/id_storagesyncservice.go index a48af7233c3..ddb7c1ddf85 100644 --- a/resource-manager/storagesync/2022-09-01/privateendpointconnectionresource/id_storagesyncservice.go +++ b/resource-manager/storagesync/2022-09-01/privateendpointconnectionresource/id_storagesyncservice.go @@ -36,19 +36,9 @@ func ParseStorageSyncServiceID(input string) (*StorageSyncServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageSyncServiceId{} - - 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.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseStorageSyncServiceIDInsensitively(input string) (*StorageSyncServiceId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageSyncServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *StorageSyncServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if id.StorageSyncServiceName, ok = input.Parsed["storageSyncServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", input) } - return &id, nil + return nil } // ValidateStorageSyncServiceID checks that 'input' can be parsed as a Storage Sync Service ID diff --git a/resource-manager/storagesync/2022-09-01/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/storagesync/2022-09-01/privateendpointconnections/id_privateendpointconnection.go index 171574e64bc..3623df37ead 100644 --- a/resource-manager/storagesync/2022-09-01/privateendpointconnections/id_privateendpointconnection.go +++ b/resource-manager/storagesync/2022-09-01/privateendpointconnections/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if id.StorageSyncServiceName, ok = input.Parsed["storageSyncServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/storagesync/2022-09-01/privatelinkresources/id_storagesyncservice.go b/resource-manager/storagesync/2022-09-01/privatelinkresources/id_storagesyncservice.go index d89fc89f3ed..1d908137988 100644 --- a/resource-manager/storagesync/2022-09-01/privatelinkresources/id_storagesyncservice.go +++ b/resource-manager/storagesync/2022-09-01/privatelinkresources/id_storagesyncservice.go @@ -36,19 +36,9 @@ func ParseStorageSyncServiceID(input string) (*StorageSyncServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageSyncServiceId{} - - 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.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseStorageSyncServiceIDInsensitively(input string) (*StorageSyncServiceId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageSyncServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *StorageSyncServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if id.StorageSyncServiceName, ok = input.Parsed["storageSyncServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", input) } - return &id, nil + return nil } // ValidateStorageSyncServiceID checks that 'input' can be parsed as a Storage Sync Service ID diff --git a/resource-manager/storagesync/2022-09-01/registeredserverresource/id_registeredserver.go b/resource-manager/storagesync/2022-09-01/registeredserverresource/id_registeredserver.go index 9d68c3364cf..2231d13c5a3 100644 --- a/resource-manager/storagesync/2022-09-01/registeredserverresource/id_registeredserver.go +++ b/resource-manager/storagesync/2022-09-01/registeredserverresource/id_registeredserver.go @@ -38,23 +38,9 @@ func ParseRegisteredServerID(input string) (*RegisteredServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegisteredServerId{} - - 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.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) - } - - if id.ServerId, ok = parsed.Parsed["serverId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRegisteredServerIDInsensitively(input string) (*RegisteredServerId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RegisteredServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RegisteredServerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if id.StorageSyncServiceName, ok = input.Parsed["storageSyncServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", input) } - if id.ServerId, ok = parsed.Parsed["serverId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverId", *parsed) + if id.ServerId, ok = input.Parsed["serverId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverId", input) } - return &id, nil + return nil } // ValidateRegisteredServerID checks that 'input' can be parsed as a Registered Server ID diff --git a/resource-manager/storagesync/2022-09-01/registeredserverresource/id_storagesyncservice.go b/resource-manager/storagesync/2022-09-01/registeredserverresource/id_storagesyncservice.go index a620483e1d1..05c894c45fa 100644 --- a/resource-manager/storagesync/2022-09-01/registeredserverresource/id_storagesyncservice.go +++ b/resource-manager/storagesync/2022-09-01/registeredserverresource/id_storagesyncservice.go @@ -36,19 +36,9 @@ func ParseStorageSyncServiceID(input string) (*StorageSyncServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageSyncServiceId{} - - 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.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseStorageSyncServiceIDInsensitively(input string) (*StorageSyncServiceId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageSyncServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *StorageSyncServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if id.StorageSyncServiceName, ok = input.Parsed["storageSyncServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", input) } - return &id, nil + return nil } // ValidateStorageSyncServiceID checks that 'input' can be parsed as a Storage Sync Service ID diff --git a/resource-manager/storagesync/2022-09-01/serverendpointresource/id_serverendpoint.go b/resource-manager/storagesync/2022-09-01/serverendpointresource/id_serverendpoint.go index 8ab9a254bb4..a32443b95a3 100644 --- a/resource-manager/storagesync/2022-09-01/serverendpointresource/id_serverendpoint.go +++ b/resource-manager/storagesync/2022-09-01/serverendpointresource/id_serverendpoint.go @@ -40,27 +40,9 @@ func ParseServerEndpointID(input string) (*ServerEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerEndpointId{} - - 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.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) - } - - if id.SyncGroupName, ok = parsed.Parsed["syncGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", *parsed) - } - - if id.ServerEndpointName, ok = parsed.Parsed["serverEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseServerEndpointIDInsensitively(input string) (*ServerEndpointId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ServerEndpointId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if id.StorageSyncServiceName, ok = input.Parsed["storageSyncServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", input) } - if id.SyncGroupName, ok = parsed.Parsed["syncGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", *parsed) + if id.SyncGroupName, ok = input.Parsed["syncGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", input) } - if id.ServerEndpointName, ok = parsed.Parsed["serverEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverEndpointName", *parsed) + if id.ServerEndpointName, ok = input.Parsed["serverEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverEndpointName", input) } - return &id, nil + return nil } // ValidateServerEndpointID checks that 'input' can be parsed as a Server Endpoint ID diff --git a/resource-manager/storagesync/2022-09-01/serverendpointresource/id_syncgroup.go b/resource-manager/storagesync/2022-09-01/serverendpointresource/id_syncgroup.go index c4eedf6ea1d..4b8ee7ca8fd 100644 --- a/resource-manager/storagesync/2022-09-01/serverendpointresource/id_syncgroup.go +++ b/resource-manager/storagesync/2022-09-01/serverendpointresource/id_syncgroup.go @@ -38,23 +38,9 @@ func ParseSyncGroupID(input string) (*SyncGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SyncGroupId{} - - 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.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) - } - - if id.SyncGroupName, ok = parsed.Parsed["syncGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSyncGroupIDInsensitively(input string) (*SyncGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SyncGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SyncGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if id.StorageSyncServiceName, ok = input.Parsed["storageSyncServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", input) } - if id.SyncGroupName, ok = parsed.Parsed["syncGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", *parsed) + if id.SyncGroupName, ok = input.Parsed["syncGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", input) } - return &id, nil + return nil } // ValidateSyncGroupID checks that 'input' can be parsed as a Sync Group ID diff --git a/resource-manager/storagesync/2022-09-01/storagesyncservice/id_location.go b/resource-manager/storagesync/2022-09-01/storagesyncservice/id_location.go index 6a3f665cc3d..d3d95e3f93d 100644 --- a/resource-manager/storagesync/2022-09-01/storagesyncservice/id_location.go +++ b/resource-manager/storagesync/2022-09-01/storagesyncservice/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/storagesync/2022-09-01/storagesyncservicesresource/id_storagesyncservice.go b/resource-manager/storagesync/2022-09-01/storagesyncservicesresource/id_storagesyncservice.go index 60b30adc518..2641624bebd 100644 --- a/resource-manager/storagesync/2022-09-01/storagesyncservicesresource/id_storagesyncservice.go +++ b/resource-manager/storagesync/2022-09-01/storagesyncservicesresource/id_storagesyncservice.go @@ -36,19 +36,9 @@ func ParseStorageSyncServiceID(input string) (*StorageSyncServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageSyncServiceId{} - - 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.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseStorageSyncServiceIDInsensitively(input string) (*StorageSyncServiceId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageSyncServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *StorageSyncServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if id.StorageSyncServiceName, ok = input.Parsed["storageSyncServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", input) } - return &id, nil + return nil } // ValidateStorageSyncServiceID checks that 'input' can be parsed as a Storage Sync Service ID diff --git a/resource-manager/storagesync/2022-09-01/syncgroupresource/id_storagesyncservice.go b/resource-manager/storagesync/2022-09-01/syncgroupresource/id_storagesyncservice.go index 5e4494208ea..c9fd0ab9122 100644 --- a/resource-manager/storagesync/2022-09-01/syncgroupresource/id_storagesyncservice.go +++ b/resource-manager/storagesync/2022-09-01/syncgroupresource/id_storagesyncservice.go @@ -36,19 +36,9 @@ func ParseStorageSyncServiceID(input string) (*StorageSyncServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageSyncServiceId{} - - 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.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseStorageSyncServiceIDInsensitively(input string) (*StorageSyncServiceId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageSyncServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *StorageSyncServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if id.StorageSyncServiceName, ok = input.Parsed["storageSyncServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", input) } - return &id, nil + return nil } // ValidateStorageSyncServiceID checks that 'input' can be parsed as a Storage Sync Service ID diff --git a/resource-manager/storagesync/2022-09-01/syncgroupresource/id_syncgroup.go b/resource-manager/storagesync/2022-09-01/syncgroupresource/id_syncgroup.go index a792ed1dca3..6356505ac80 100644 --- a/resource-manager/storagesync/2022-09-01/syncgroupresource/id_syncgroup.go +++ b/resource-manager/storagesync/2022-09-01/syncgroupresource/id_syncgroup.go @@ -38,23 +38,9 @@ func ParseSyncGroupID(input string) (*SyncGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SyncGroupId{} - - 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.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) - } - - if id.SyncGroupName, ok = parsed.Parsed["syncGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSyncGroupIDInsensitively(input string) (*SyncGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SyncGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SyncGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if id.StorageSyncServiceName, ok = input.Parsed["storageSyncServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", input) } - if id.SyncGroupName, ok = parsed.Parsed["syncGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", *parsed) + if id.SyncGroupName, ok = input.Parsed["syncGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "syncGroupName", input) } - return &id, nil + return nil } // ValidateSyncGroupID checks that 'input' can be parsed as a Sync Group ID diff --git a/resource-manager/storagesync/2022-09-01/workflowresource/id_storagesyncservice.go b/resource-manager/storagesync/2022-09-01/workflowresource/id_storagesyncservice.go index 6fe675678b9..a09e1e5faaa 100644 --- a/resource-manager/storagesync/2022-09-01/workflowresource/id_storagesyncservice.go +++ b/resource-manager/storagesync/2022-09-01/workflowresource/id_storagesyncservice.go @@ -36,19 +36,9 @@ func ParseStorageSyncServiceID(input string) (*StorageSyncServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageSyncServiceId{} - - 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.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseStorageSyncServiceIDInsensitively(input string) (*StorageSyncServiceId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StorageSyncServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *StorageSyncServiceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if id.StorageSyncServiceName, ok = input.Parsed["storageSyncServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", input) } - return &id, nil + return nil } // ValidateStorageSyncServiceID checks that 'input' can be parsed as a Storage Sync Service ID diff --git a/resource-manager/storagesync/2022-09-01/workflowresource/id_workflow.go b/resource-manager/storagesync/2022-09-01/workflowresource/id_workflow.go index e55f941418d..ac4597bf3d6 100644 --- a/resource-manager/storagesync/2022-09-01/workflowresource/id_workflow.go +++ b/resource-manager/storagesync/2022-09-01/workflowresource/id_workflow.go @@ -38,23 +38,9 @@ func ParseWorkflowID(input string) (*WorkflowId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkflowId{} - - 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.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) - } - - if id.WorkflowId, ok = parsed.Parsed["workflowId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWorkflowIDInsensitively(input string) (*WorkflowId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkflowId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WorkflowId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StorageSyncServiceName, ok = parsed.Parsed["storageSyncServiceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", *parsed) + if id.StorageSyncServiceName, ok = input.Parsed["storageSyncServiceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "storageSyncServiceName", input) } - if id.WorkflowId, ok = parsed.Parsed["workflowId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowId", *parsed) + if id.WorkflowId, ok = input.Parsed["workflowId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowId", input) } - return &id, nil + return nil } // ValidateWorkflowID checks that 'input' can be parsed as a Workflow ID diff --git a/resource-manager/streamanalytics/2020-03-01/clusters/id_cluster.go b/resource-manager/streamanalytics/2020-03-01/clusters/id_cluster.go index 76f72c2de41..fb8191e6337 100644 --- a/resource-manager/streamanalytics/2020-03-01/clusters/id_cluster.go +++ b/resource-manager/streamanalytics/2020-03-01/clusters/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/streamanalytics/2020-03-01/functions/id_function.go b/resource-manager/streamanalytics/2020-03-01/functions/id_function.go index b5f463d5d4f..65352eb6c63 100644 --- a/resource-manager/streamanalytics/2020-03-01/functions/id_function.go +++ b/resource-manager/streamanalytics/2020-03-01/functions/id_function.go @@ -38,23 +38,9 @@ func ParseFunctionID(input string) (*FunctionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FunctionId{} - - 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.StreamingJobName, ok = parsed.Parsed["streamingJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamingJobName", *parsed) - } - - if id.FunctionName, ok = parsed.Parsed["functionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "functionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFunctionIDInsensitively(input string) (*FunctionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FunctionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FunctionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StreamingJobName, ok = parsed.Parsed["streamingJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamingJobName", *parsed) + if id.StreamingJobName, ok = input.Parsed["streamingJobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "streamingJobName", input) } - if id.FunctionName, ok = parsed.Parsed["functionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "functionName", *parsed) + if id.FunctionName, ok = input.Parsed["functionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "functionName", input) } - return &id, nil + return nil } // ValidateFunctionID checks that 'input' can be parsed as a Function ID diff --git a/resource-manager/streamanalytics/2020-03-01/functions/id_streamingjob.go b/resource-manager/streamanalytics/2020-03-01/functions/id_streamingjob.go index 4fb3438e50b..381affad90e 100644 --- a/resource-manager/streamanalytics/2020-03-01/functions/id_streamingjob.go +++ b/resource-manager/streamanalytics/2020-03-01/functions/id_streamingjob.go @@ -36,19 +36,9 @@ func ParseStreamingJobID(input string) (*StreamingJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StreamingJobId{} - - 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.StreamingJobName, ok = parsed.Parsed["streamingJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamingJobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseStreamingJobIDInsensitively(input string) (*StreamingJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StreamingJobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *StreamingJobId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StreamingJobName, ok = parsed.Parsed["streamingJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamingJobName", *parsed) + if id.StreamingJobName, ok = input.Parsed["streamingJobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "streamingJobName", input) } - return &id, nil + return nil } // ValidateStreamingJobID checks that 'input' can be parsed as a Streaming Job ID diff --git a/resource-manager/streamanalytics/2020-03-01/inputs/id_input.go b/resource-manager/streamanalytics/2020-03-01/inputs/id_input.go index 34ebf1bb3b3..cad2488a950 100644 --- a/resource-manager/streamanalytics/2020-03-01/inputs/id_input.go +++ b/resource-manager/streamanalytics/2020-03-01/inputs/id_input.go @@ -38,23 +38,9 @@ func ParseInputID(input string) (*InputId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InputId{} - - 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.StreamingJobName, ok = parsed.Parsed["streamingJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamingJobName", *parsed) - } - - if id.InputName, ok = parsed.Parsed["inputName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "inputName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseInputIDInsensitively(input string) (*InputId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InputId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *InputId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StreamingJobName, ok = parsed.Parsed["streamingJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamingJobName", *parsed) + if id.StreamingJobName, ok = input.Parsed["streamingJobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "streamingJobName", input) } - if id.InputName, ok = parsed.Parsed["inputName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "inputName", *parsed) + if id.InputName, ok = input.Parsed["inputName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "inputName", input) } - return &id, nil + return nil } // ValidateInputID checks that 'input' can be parsed as a Input ID diff --git a/resource-manager/streamanalytics/2020-03-01/inputs/id_streamingjob.go b/resource-manager/streamanalytics/2020-03-01/inputs/id_streamingjob.go index 6daad60fcec..067722f33fd 100644 --- a/resource-manager/streamanalytics/2020-03-01/inputs/id_streamingjob.go +++ b/resource-manager/streamanalytics/2020-03-01/inputs/id_streamingjob.go @@ -36,19 +36,9 @@ func ParseStreamingJobID(input string) (*StreamingJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StreamingJobId{} - - 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.StreamingJobName, ok = parsed.Parsed["streamingJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamingJobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseStreamingJobIDInsensitively(input string) (*StreamingJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StreamingJobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *StreamingJobId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StreamingJobName, ok = parsed.Parsed["streamingJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamingJobName", *parsed) + if id.StreamingJobName, ok = input.Parsed["streamingJobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "streamingJobName", input) } - return &id, nil + return nil } // ValidateStreamingJobID checks that 'input' can be parsed as a Streaming Job ID diff --git a/resource-manager/streamanalytics/2020-03-01/outputs/id_output.go b/resource-manager/streamanalytics/2020-03-01/outputs/id_output.go index b46cae1394b..d3fac25aefd 100644 --- a/resource-manager/streamanalytics/2020-03-01/outputs/id_output.go +++ b/resource-manager/streamanalytics/2020-03-01/outputs/id_output.go @@ -38,23 +38,9 @@ func ParseOutputID(input string) (*OutputId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OutputId{} - - 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.StreamingJobName, ok = parsed.Parsed["streamingJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamingJobName", *parsed) - } - - if id.OutputName, ok = parsed.Parsed["outputName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "outputName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseOutputIDInsensitively(input string) (*OutputId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OutputId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OutputId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StreamingJobName, ok = parsed.Parsed["streamingJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamingJobName", *parsed) + if id.StreamingJobName, ok = input.Parsed["streamingJobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "streamingJobName", input) } - if id.OutputName, ok = parsed.Parsed["outputName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "outputName", *parsed) + if id.OutputName, ok = input.Parsed["outputName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "outputName", input) } - return &id, nil + return nil } // ValidateOutputID checks that 'input' can be parsed as a Output ID diff --git a/resource-manager/streamanalytics/2020-03-01/outputs/id_streamingjob.go b/resource-manager/streamanalytics/2020-03-01/outputs/id_streamingjob.go index c450f1d6cc6..3b4caf5b723 100644 --- a/resource-manager/streamanalytics/2020-03-01/outputs/id_streamingjob.go +++ b/resource-manager/streamanalytics/2020-03-01/outputs/id_streamingjob.go @@ -36,19 +36,9 @@ func ParseStreamingJobID(input string) (*StreamingJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StreamingJobId{} - - 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.StreamingJobName, ok = parsed.Parsed["streamingJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamingJobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseStreamingJobIDInsensitively(input string) (*StreamingJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StreamingJobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *StreamingJobId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StreamingJobName, ok = parsed.Parsed["streamingJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamingJobName", *parsed) + if id.StreamingJobName, ok = input.Parsed["streamingJobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "streamingJobName", input) } - return &id, nil + return nil } // ValidateStreamingJobID checks that 'input' can be parsed as a Streaming Job ID diff --git a/resource-manager/streamanalytics/2020-03-01/privateendpoints/id_cluster.go b/resource-manager/streamanalytics/2020-03-01/privateendpoints/id_cluster.go index caf6ad8c02d..faa7152e62a 100644 --- a/resource-manager/streamanalytics/2020-03-01/privateendpoints/id_cluster.go +++ b/resource-manager/streamanalytics/2020-03-01/privateendpoints/id_cluster.go @@ -36,19 +36,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ClusterId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/streamanalytics/2020-03-01/privateendpoints/id_privateendpoint.go b/resource-manager/streamanalytics/2020-03-01/privateendpoints/id_privateendpoint.go index b630c532d71..af75e972a38 100644 --- a/resource-manager/streamanalytics/2020-03-01/privateendpoints/id_privateendpoint.go +++ b/resource-manager/streamanalytics/2020-03-01/privateendpoints/id_privateendpoint.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointID(input string) (*PrivateEndpointId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointId{} - - 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.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.PrivateEndpointName, ok = parsed.Parsed["privateEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointIDInsensitively(input string) (*PrivateEndpointId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.PrivateEndpointName, ok = parsed.Parsed["privateEndpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointName", *parsed) + if id.PrivateEndpointName, ok = input.Parsed["privateEndpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointID checks that 'input' can be parsed as a Private Endpoint ID diff --git a/resource-manager/streamanalytics/2020-03-01/streamingjobs/id_streamingjob.go b/resource-manager/streamanalytics/2020-03-01/streamingjobs/id_streamingjob.go index 6a568e9cb43..6a66cc61d8f 100644 --- a/resource-manager/streamanalytics/2020-03-01/streamingjobs/id_streamingjob.go +++ b/resource-manager/streamanalytics/2020-03-01/streamingjobs/id_streamingjob.go @@ -36,19 +36,9 @@ func ParseStreamingJobID(input string) (*StreamingJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StreamingJobId{} - - 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.StreamingJobName, ok = parsed.Parsed["streamingJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamingJobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseStreamingJobIDInsensitively(input string) (*StreamingJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StreamingJobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *StreamingJobId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StreamingJobName, ok = parsed.Parsed["streamingJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamingJobName", *parsed) + if id.StreamingJobName, ok = input.Parsed["streamingJobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "streamingJobName", input) } - return &id, nil + return nil } // ValidateStreamingJobID checks that 'input' can be parsed as a Streaming Job ID diff --git a/resource-manager/streamanalytics/2020-03-01/subscriptions/id_location.go b/resource-manager/streamanalytics/2020-03-01/subscriptions/id_location.go index 26996bee4ae..2663b95cdda 100644 --- a/resource-manager/streamanalytics/2020-03-01/subscriptions/id_location.go +++ b/resource-manager/streamanalytics/2020-03-01/subscriptions/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/streamanalytics/2020-03-01/transformations/id_transformation.go b/resource-manager/streamanalytics/2020-03-01/transformations/id_transformation.go index 6cbfd2eb501..3f300524e99 100644 --- a/resource-manager/streamanalytics/2020-03-01/transformations/id_transformation.go +++ b/resource-manager/streamanalytics/2020-03-01/transformations/id_transformation.go @@ -38,23 +38,9 @@ func ParseTransformationID(input string) (*TransformationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TransformationId{} - - 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.StreamingJobName, ok = parsed.Parsed["streamingJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamingJobName", *parsed) - } - - if id.TransformationName, ok = parsed.Parsed["transformationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "transformationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTransformationIDInsensitively(input string) (*TransformationId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TransformationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TransformationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StreamingJobName, ok = parsed.Parsed["streamingJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamingJobName", *parsed) + if id.StreamingJobName, ok = input.Parsed["streamingJobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "streamingJobName", input) } - if id.TransformationName, ok = parsed.Parsed["transformationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "transformationName", *parsed) + if id.TransformationName, ok = input.Parsed["transformationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "transformationName", input) } - return &id, nil + return nil } // ValidateTransformationID checks that 'input' can be parsed as a Transformation ID diff --git a/resource-manager/streamanalytics/2021-10-01-preview/functions/id_function.go b/resource-manager/streamanalytics/2021-10-01-preview/functions/id_function.go index b5f463d5d4f..65352eb6c63 100644 --- a/resource-manager/streamanalytics/2021-10-01-preview/functions/id_function.go +++ b/resource-manager/streamanalytics/2021-10-01-preview/functions/id_function.go @@ -38,23 +38,9 @@ func ParseFunctionID(input string) (*FunctionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FunctionId{} - - 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.StreamingJobName, ok = parsed.Parsed["streamingJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamingJobName", *parsed) - } - - if id.FunctionName, ok = parsed.Parsed["functionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "functionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFunctionIDInsensitively(input string) (*FunctionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FunctionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FunctionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StreamingJobName, ok = parsed.Parsed["streamingJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamingJobName", *parsed) + if id.StreamingJobName, ok = input.Parsed["streamingJobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "streamingJobName", input) } - if id.FunctionName, ok = parsed.Parsed["functionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "functionName", *parsed) + if id.FunctionName, ok = input.Parsed["functionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "functionName", input) } - return &id, nil + return nil } // ValidateFunctionID checks that 'input' can be parsed as a Function ID diff --git a/resource-manager/streamanalytics/2021-10-01-preview/functions/id_streamingjob.go b/resource-manager/streamanalytics/2021-10-01-preview/functions/id_streamingjob.go index 4fb3438e50b..381affad90e 100644 --- a/resource-manager/streamanalytics/2021-10-01-preview/functions/id_streamingjob.go +++ b/resource-manager/streamanalytics/2021-10-01-preview/functions/id_streamingjob.go @@ -36,19 +36,9 @@ func ParseStreamingJobID(input string) (*StreamingJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StreamingJobId{} - - 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.StreamingJobName, ok = parsed.Parsed["streamingJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamingJobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseStreamingJobIDInsensitively(input string) (*StreamingJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StreamingJobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *StreamingJobId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StreamingJobName, ok = parsed.Parsed["streamingJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamingJobName", *parsed) + if id.StreamingJobName, ok = input.Parsed["streamingJobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "streamingJobName", input) } - return &id, nil + return nil } // ValidateStreamingJobID checks that 'input' can be parsed as a Streaming Job ID diff --git a/resource-manager/streamanalytics/2021-10-01-preview/inputs/id_input.go b/resource-manager/streamanalytics/2021-10-01-preview/inputs/id_input.go index 34ebf1bb3b3..cad2488a950 100644 --- a/resource-manager/streamanalytics/2021-10-01-preview/inputs/id_input.go +++ b/resource-manager/streamanalytics/2021-10-01-preview/inputs/id_input.go @@ -38,23 +38,9 @@ func ParseInputID(input string) (*InputId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InputId{} - - 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.StreamingJobName, ok = parsed.Parsed["streamingJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamingJobName", *parsed) - } - - if id.InputName, ok = parsed.Parsed["inputName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "inputName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseInputIDInsensitively(input string) (*InputId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InputId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *InputId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StreamingJobName, ok = parsed.Parsed["streamingJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamingJobName", *parsed) + if id.StreamingJobName, ok = input.Parsed["streamingJobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "streamingJobName", input) } - if id.InputName, ok = parsed.Parsed["inputName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "inputName", *parsed) + if id.InputName, ok = input.Parsed["inputName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "inputName", input) } - return &id, nil + return nil } // ValidateInputID checks that 'input' can be parsed as a Input ID diff --git a/resource-manager/streamanalytics/2021-10-01-preview/inputs/id_streamingjob.go b/resource-manager/streamanalytics/2021-10-01-preview/inputs/id_streamingjob.go index 6daad60fcec..067722f33fd 100644 --- a/resource-manager/streamanalytics/2021-10-01-preview/inputs/id_streamingjob.go +++ b/resource-manager/streamanalytics/2021-10-01-preview/inputs/id_streamingjob.go @@ -36,19 +36,9 @@ func ParseStreamingJobID(input string) (*StreamingJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StreamingJobId{} - - 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.StreamingJobName, ok = parsed.Parsed["streamingJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamingJobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseStreamingJobIDInsensitively(input string) (*StreamingJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StreamingJobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *StreamingJobId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StreamingJobName, ok = parsed.Parsed["streamingJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamingJobName", *parsed) + if id.StreamingJobName, ok = input.Parsed["streamingJobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "streamingJobName", input) } - return &id, nil + return nil } // ValidateStreamingJobID checks that 'input' can be parsed as a Streaming Job ID diff --git a/resource-manager/streamanalytics/2021-10-01-preview/outputs/id_output.go b/resource-manager/streamanalytics/2021-10-01-preview/outputs/id_output.go index b46cae1394b..d3fac25aefd 100644 --- a/resource-manager/streamanalytics/2021-10-01-preview/outputs/id_output.go +++ b/resource-manager/streamanalytics/2021-10-01-preview/outputs/id_output.go @@ -38,23 +38,9 @@ func ParseOutputID(input string) (*OutputId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OutputId{} - - 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.StreamingJobName, ok = parsed.Parsed["streamingJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamingJobName", *parsed) - } - - if id.OutputName, ok = parsed.Parsed["outputName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "outputName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseOutputIDInsensitively(input string) (*OutputId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := OutputId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OutputId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StreamingJobName, ok = parsed.Parsed["streamingJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamingJobName", *parsed) + if id.StreamingJobName, ok = input.Parsed["streamingJobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "streamingJobName", input) } - if id.OutputName, ok = parsed.Parsed["outputName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "outputName", *parsed) + if id.OutputName, ok = input.Parsed["outputName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "outputName", input) } - return &id, nil + return nil } // ValidateOutputID checks that 'input' can be parsed as a Output ID diff --git a/resource-manager/streamanalytics/2021-10-01-preview/outputs/id_streamingjob.go b/resource-manager/streamanalytics/2021-10-01-preview/outputs/id_streamingjob.go index c450f1d6cc6..3b4caf5b723 100644 --- a/resource-manager/streamanalytics/2021-10-01-preview/outputs/id_streamingjob.go +++ b/resource-manager/streamanalytics/2021-10-01-preview/outputs/id_streamingjob.go @@ -36,19 +36,9 @@ func ParseStreamingJobID(input string) (*StreamingJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StreamingJobId{} - - 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.StreamingJobName, ok = parsed.Parsed["streamingJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamingJobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseStreamingJobIDInsensitively(input string) (*StreamingJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StreamingJobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *StreamingJobId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StreamingJobName, ok = parsed.Parsed["streamingJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamingJobName", *parsed) + if id.StreamingJobName, ok = input.Parsed["streamingJobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "streamingJobName", input) } - return &id, nil + return nil } // ValidateStreamingJobID checks that 'input' can be parsed as a Streaming Job ID diff --git a/resource-manager/streamanalytics/2021-10-01-preview/streamingjobs/id_streamingjob.go b/resource-manager/streamanalytics/2021-10-01-preview/streamingjobs/id_streamingjob.go index 6a568e9cb43..6a66cc61d8f 100644 --- a/resource-manager/streamanalytics/2021-10-01-preview/streamingjobs/id_streamingjob.go +++ b/resource-manager/streamanalytics/2021-10-01-preview/streamingjobs/id_streamingjob.go @@ -36,19 +36,9 @@ func ParseStreamingJobID(input string) (*StreamingJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StreamingJobId{} - - 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.StreamingJobName, ok = parsed.Parsed["streamingJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamingJobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseStreamingJobIDInsensitively(input string) (*StreamingJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StreamingJobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *StreamingJobId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StreamingJobName, ok = parsed.Parsed["streamingJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamingJobName", *parsed) + if id.StreamingJobName, ok = input.Parsed["streamingJobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "streamingJobName", input) } - return &id, nil + return nil } // ValidateStreamingJobID checks that 'input' can be parsed as a Streaming Job ID diff --git a/resource-manager/streamanalytics/2021-10-01-preview/subscriptions/id_location.go b/resource-manager/streamanalytics/2021-10-01-preview/subscriptions/id_location.go index 26996bee4ae..2663b95cdda 100644 --- a/resource-manager/streamanalytics/2021-10-01-preview/subscriptions/id_location.go +++ b/resource-manager/streamanalytics/2021-10-01-preview/subscriptions/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/streamanalytics/2021-10-01-preview/transformations/id_transformation.go b/resource-manager/streamanalytics/2021-10-01-preview/transformations/id_transformation.go index 6cbfd2eb501..3f300524e99 100644 --- a/resource-manager/streamanalytics/2021-10-01-preview/transformations/id_transformation.go +++ b/resource-manager/streamanalytics/2021-10-01-preview/transformations/id_transformation.go @@ -38,23 +38,9 @@ func ParseTransformationID(input string) (*TransformationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TransformationId{} - - 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.StreamingJobName, ok = parsed.Parsed["streamingJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamingJobName", *parsed) - } - - if id.TransformationName, ok = parsed.Parsed["transformationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "transformationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTransformationIDInsensitively(input string) (*TransformationId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TransformationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TransformationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StreamingJobName, ok = parsed.Parsed["streamingJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "streamingJobName", *parsed) + if id.StreamingJobName, ok = input.Parsed["streamingJobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "streamingJobName", input) } - if id.TransformationName, ok = parsed.Parsed["transformationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "transformationName", *parsed) + if id.TransformationName, ok = input.Parsed["transformationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "transformationName", input) } - return &id, nil + return nil } // ValidateTransformationID checks that 'input' can be parsed as a Transformation ID diff --git a/resource-manager/subscription/2021-10-01/subscriptions/id_alias.go b/resource-manager/subscription/2021-10-01/subscriptions/id_alias.go index a129ecbc1ee..099ab3bd861 100644 --- a/resource-manager/subscription/2021-10-01/subscriptions/id_alias.go +++ b/resource-manager/subscription/2021-10-01/subscriptions/id_alias.go @@ -32,11 +32,9 @@ func ParseAliasID(input string) (*AliasId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AliasId{} - - if id.AliasName, ok = parsed.Parsed["aliasName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "aliasName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseAliasIDInsensitively(input string) (*AliasId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AliasId{} - - if id.AliasName, ok = parsed.Parsed["aliasName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "aliasName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *AliasId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.AliasName, ok = input.Parsed["aliasName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "aliasName", input) + } + + return nil +} + // ValidateAliasID checks that 'input' can be parsed as a Alias ID func ValidateAliasID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/subscription/2021-10-01/subscriptions/id_billingaccount.go b/resource-manager/subscription/2021-10-01/subscriptions/id_billingaccount.go index 63e64d93cdf..34a58dc9313 100644 --- a/resource-manager/subscription/2021-10-01/subscriptions/id_billingaccount.go +++ b/resource-manager/subscription/2021-10-01/subscriptions/id_billingaccount.go @@ -32,11 +32,9 @@ func ParseBillingAccountID(input string) (*BillingAccountId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseBillingAccountIDInsensitively(input string) (*BillingAccountId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BillingAccountId{} - - if id.BillingAccountId, ok = parsed.Parsed["billingAccountId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *BillingAccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.BillingAccountId, ok = input.Parsed["billingAccountId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "billingAccountId", input) + } + + return nil +} + // ValidateBillingAccountID checks that 'input' can be parsed as a Billing Account ID func ValidateBillingAccountID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/subscription/2021-10-01/subscriptions/id_providersubscription.go b/resource-manager/subscription/2021-10-01/subscriptions/id_providersubscription.go index 661b154bbda..760f2413f5f 100644 --- a/resource-manager/subscription/2021-10-01/subscriptions/id_providersubscription.go +++ b/resource-manager/subscription/2021-10-01/subscriptions/id_providersubscription.go @@ -32,11 +32,9 @@ func ParseProviderSubscriptionID(input string) (*ProviderSubscriptionId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderSubscriptionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseProviderSubscriptionIDInsensitively(input string) (*ProviderSubscripti return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderSubscriptionId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *ProviderSubscriptionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + return nil +} + // ValidateProviderSubscriptionID checks that 'input' can be parsed as a Provider Subscription ID func ValidateProviderSubscriptionID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/subscription/2021-10-01/subscriptions/id_subscriptionoperation.go b/resource-manager/subscription/2021-10-01/subscriptions/id_subscriptionoperation.go index 982d008cf4a..75ec39c7e43 100644 --- a/resource-manager/subscription/2021-10-01/subscriptions/id_subscriptionoperation.go +++ b/resource-manager/subscription/2021-10-01/subscriptions/id_subscriptionoperation.go @@ -32,11 +32,9 @@ func ParseSubscriptionOperationID(input string) (*SubscriptionOperationId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SubscriptionOperationId{} - - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseSubscriptionOperationIDInsensitively(input string) (*SubscriptionOpera return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SubscriptionOperationId{} - - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *SubscriptionOperationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.OperationId, ok = input.Parsed["operationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "operationId", input) + } + + return nil +} + // ValidateSubscriptionOperationID checks that 'input' can be parsed as a Subscription Operation ID func ValidateSubscriptionOperationID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/id_availabilityset.go b/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/id_availabilityset.go index ae57f4330c9..16cdd02f861 100644 --- a/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/id_availabilityset.go +++ b/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/id_availabilityset.go @@ -36,19 +36,9 @@ func ParseAvailabilitySetID(input string) (*AvailabilitySetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AvailabilitySetId{} - - 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.AvailabilitySetName, ok = parsed.Parsed["availabilitySetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "availabilitySetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAvailabilitySetIDInsensitively(input string) (*AvailabilitySetId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AvailabilitySetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AvailabilitySetId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AvailabilitySetName, ok = parsed.Parsed["availabilitySetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "availabilitySetName", *parsed) + if id.AvailabilitySetName, ok = input.Parsed["availabilitySetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "availabilitySetName", input) } - return &id, nil + return nil } // ValidateAvailabilitySetID checks that 'input' can be parsed as a Availability Set ID diff --git a/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/id_cloud.go b/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/id_cloud.go index 57d2b09f455..c3b5cd0d97e 100644 --- a/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/id_cloud.go +++ b/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/id_cloud.go @@ -36,19 +36,9 @@ func ParseCloudID(input string) (*CloudId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CloudId{} - - 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.CloudName, ok = parsed.Parsed["cloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseCloudIDInsensitively(input string) (*CloudId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CloudId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CloudId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CloudName, ok = parsed.Parsed["cloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudName", *parsed) + if id.CloudName, ok = input.Parsed["cloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cloudName", input) } - return &id, nil + return nil } // ValidateCloudID checks that 'input' can be parsed as a Cloud ID diff --git a/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/id_inventoryitem.go b/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/id_inventoryitem.go index 1814b6aabd0..b81296c55a1 100644 --- a/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/id_inventoryitem.go +++ b/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/id_inventoryitem.go @@ -38,23 +38,9 @@ func ParseInventoryItemID(input string) (*InventoryItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InventoryItemId{} - - 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.VmmServerName, ok = parsed.Parsed["vmmServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vmmServerName", *parsed) - } - - if id.InventoryItemName, ok = parsed.Parsed["inventoryItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "inventoryItemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseInventoryItemIDInsensitively(input string) (*InventoryItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InventoryItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *InventoryItemId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VmmServerName, ok = parsed.Parsed["vmmServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vmmServerName", *parsed) + if id.VmmServerName, ok = input.Parsed["vmmServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vmmServerName", input) } - if id.InventoryItemName, ok = parsed.Parsed["inventoryItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "inventoryItemName", *parsed) + if id.InventoryItemName, ok = input.Parsed["inventoryItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "inventoryItemName", input) } - return &id, nil + return nil } // ValidateInventoryItemID checks that 'input' can be parsed as a Inventory Item ID diff --git a/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/id_vmmserver.go b/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/id_vmmserver.go index 22a411b7422..46ecadb2cf7 100644 --- a/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/id_vmmserver.go +++ b/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/id_vmmserver.go @@ -36,19 +36,9 @@ func ParseVMmServerID(input string) (*VMmServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VMmServerId{} - - 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.VmmServerName, ok = parsed.Parsed["vmmServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vmmServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVMmServerIDInsensitively(input string) (*VMmServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VMmServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VMmServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VmmServerName, ok = parsed.Parsed["vmmServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vmmServerName", *parsed) + if id.VmmServerName, ok = input.Parsed["vmmServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vmmServerName", input) } - return &id, nil + return nil } // ValidateVMmServerID checks that 'input' can be parsed as a V Mm Server ID diff --git a/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/id_virtualmachinetemplate.go b/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/id_virtualmachinetemplate.go index 5b723986aad..0d04f23ff6e 100644 --- a/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/id_virtualmachinetemplate.go +++ b/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/id_virtualmachinetemplate.go @@ -36,19 +36,9 @@ func ParseVirtualMachineTemplateID(input string) (*VirtualMachineTemplateId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineTemplateId{} - - 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.VirtualMachineTemplateName, ok = parsed.Parsed["virtualMachineTemplateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineTemplateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineTemplateIDInsensitively(input string) (*VirtualMachineTe return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineTemplateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineTemplateId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineTemplateName, ok = parsed.Parsed["virtualMachineTemplateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineTemplateName", *parsed) + if id.VirtualMachineTemplateName, ok = input.Parsed["virtualMachineTemplateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineTemplateName", input) } - return &id, nil + return nil } // ValidateVirtualMachineTemplateID checks that 'input' can be parsed as a Virtual Machine Template ID diff --git a/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/id_virtualnetwork.go b/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/id_virtualnetwork.go index 2b3547af703..0fdd39e3909 100644 --- a/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/id_virtualnetwork.go +++ b/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/id_virtualnetwork.go @@ -36,19 +36,9 @@ func ParseVirtualNetworkID(input string) (*VirtualNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkId{} - - 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.VirtualNetworkName, ok = parsed.Parsed["virtualNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualNetworkIDInsensitively(input string) (*VirtualNetworkId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualNetworkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualNetworkName, ok = parsed.Parsed["virtualNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkName", *parsed) + if id.VirtualNetworkName, ok = input.Parsed["virtualNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkName", input) } - return &id, nil + return nil } // ValidateVirtualNetworkID checks that 'input' can be parsed as a Virtual Network ID diff --git a/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/id_vmmserver.go b/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/id_vmmserver.go index 962171b7d30..5bc06809f15 100644 --- a/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/id_vmmserver.go +++ b/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/id_vmmserver.go @@ -36,19 +36,9 @@ func ParseVMmServerID(input string) (*VMmServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VMmServerId{} - - 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.VmmServerName, ok = parsed.Parsed["vmmServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vmmServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVMmServerIDInsensitively(input string) (*VMmServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VMmServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VMmServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VmmServerName, ok = parsed.Parsed["vmmServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vmmServerName", *parsed) + if id.VmmServerName, ok = input.Parsed["vmmServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vmmServerName", input) } - return &id, nil + return nil } // ValidateVMmServerID checks that 'input' can be parsed as a V Mm Server ID diff --git a/resource-manager/timeseriesinsights/2020-05-15/accesspolicies/id_accesspolicy.go b/resource-manager/timeseriesinsights/2020-05-15/accesspolicies/id_accesspolicy.go index f145e9f97b8..5ce8ab6b093 100644 --- a/resource-manager/timeseriesinsights/2020-05-15/accesspolicies/id_accesspolicy.go +++ b/resource-manager/timeseriesinsights/2020-05-15/accesspolicies/id_accesspolicy.go @@ -38,23 +38,9 @@ func ParseAccessPolicyID(input string) (*AccessPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccessPolicyId{} - - 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.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) - } - - if id.AccessPolicyName, ok = parsed.Parsed["accessPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accessPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAccessPolicyIDInsensitively(input string) (*AccessPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccessPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AccessPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if id.EnvironmentName, ok = input.Parsed["environmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "environmentName", input) } - if id.AccessPolicyName, ok = parsed.Parsed["accessPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accessPolicyName", *parsed) + if id.AccessPolicyName, ok = input.Parsed["accessPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accessPolicyName", input) } - return &id, nil + return nil } // ValidateAccessPolicyID checks that 'input' can be parsed as a Access Policy ID diff --git a/resource-manager/timeseriesinsights/2020-05-15/accesspolicies/id_environment.go b/resource-manager/timeseriesinsights/2020-05-15/accesspolicies/id_environment.go index f2bf3b3d5d6..5e9383e8418 100644 --- a/resource-manager/timeseriesinsights/2020-05-15/accesspolicies/id_environment.go +++ b/resource-manager/timeseriesinsights/2020-05-15/accesspolicies/id_environment.go @@ -36,19 +36,9 @@ func ParseEnvironmentID(input string) (*EnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentId{} - - 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.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseEnvironmentIDInsensitively(input string) (*EnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *EnvironmentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if id.EnvironmentName, ok = input.Parsed["environmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "environmentName", input) } - return &id, nil + return nil } // ValidateEnvironmentID checks that 'input' can be parsed as a Environment ID diff --git a/resource-manager/timeseriesinsights/2020-05-15/environments/id_environment.go b/resource-manager/timeseriesinsights/2020-05-15/environments/id_environment.go index f368e8f2251..0d9093d6766 100644 --- a/resource-manager/timeseriesinsights/2020-05-15/environments/id_environment.go +++ b/resource-manager/timeseriesinsights/2020-05-15/environments/id_environment.go @@ -36,19 +36,9 @@ func ParseEnvironmentID(input string) (*EnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentId{} - - 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.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseEnvironmentIDInsensitively(input string) (*EnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *EnvironmentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if id.EnvironmentName, ok = input.Parsed["environmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "environmentName", input) } - return &id, nil + return nil } // ValidateEnvironmentID checks that 'input' can be parsed as a Environment ID diff --git a/resource-manager/timeseriesinsights/2020-05-15/eventsources/id_environment.go b/resource-manager/timeseriesinsights/2020-05-15/eventsources/id_environment.go index e31d977209d..c8eb93e4442 100644 --- a/resource-manager/timeseriesinsights/2020-05-15/eventsources/id_environment.go +++ b/resource-manager/timeseriesinsights/2020-05-15/eventsources/id_environment.go @@ -36,19 +36,9 @@ func ParseEnvironmentID(input string) (*EnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentId{} - - 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.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseEnvironmentIDInsensitively(input string) (*EnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *EnvironmentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if id.EnvironmentName, ok = input.Parsed["environmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "environmentName", input) } - return &id, nil + return nil } // ValidateEnvironmentID checks that 'input' can be parsed as a Environment ID diff --git a/resource-manager/timeseriesinsights/2020-05-15/eventsources/id_eventsource.go b/resource-manager/timeseriesinsights/2020-05-15/eventsources/id_eventsource.go index 8b8967d015c..0d8c0c9486c 100644 --- a/resource-manager/timeseriesinsights/2020-05-15/eventsources/id_eventsource.go +++ b/resource-manager/timeseriesinsights/2020-05-15/eventsources/id_eventsource.go @@ -38,23 +38,9 @@ func ParseEventSourceID(input string) (*EventSourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EventSourceId{} - - 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.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) - } - - if id.EventSourceName, ok = parsed.Parsed["eventSourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventSourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseEventSourceIDInsensitively(input string) (*EventSourceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EventSourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EventSourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if id.EnvironmentName, ok = input.Parsed["environmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "environmentName", input) } - if id.EventSourceName, ok = parsed.Parsed["eventSourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "eventSourceName", *parsed) + if id.EventSourceName, ok = input.Parsed["eventSourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "eventSourceName", input) } - return &id, nil + return nil } // ValidateEventSourceID checks that 'input' can be parsed as a Event Source ID diff --git a/resource-manager/timeseriesinsights/2020-05-15/referencedatasets/id_environment.go b/resource-manager/timeseriesinsights/2020-05-15/referencedatasets/id_environment.go index 839e230a2b0..8cb510b80cb 100644 --- a/resource-manager/timeseriesinsights/2020-05-15/referencedatasets/id_environment.go +++ b/resource-manager/timeseriesinsights/2020-05-15/referencedatasets/id_environment.go @@ -36,19 +36,9 @@ func ParseEnvironmentID(input string) (*EnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentId{} - - 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.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseEnvironmentIDInsensitively(input string) (*EnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *EnvironmentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if id.EnvironmentName, ok = input.Parsed["environmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "environmentName", input) } - return &id, nil + return nil } // ValidateEnvironmentID checks that 'input' can be parsed as a Environment ID diff --git a/resource-manager/timeseriesinsights/2020-05-15/referencedatasets/id_referencedataset.go b/resource-manager/timeseriesinsights/2020-05-15/referencedatasets/id_referencedataset.go index 690035b3327..3f193cdf561 100644 --- a/resource-manager/timeseriesinsights/2020-05-15/referencedatasets/id_referencedataset.go +++ b/resource-manager/timeseriesinsights/2020-05-15/referencedatasets/id_referencedataset.go @@ -38,23 +38,9 @@ func ParseReferenceDataSetID(input string) (*ReferenceDataSetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReferenceDataSetId{} - - 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.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) - } - - if id.ReferenceDataSetName, ok = parsed.Parsed["referenceDataSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "referenceDataSetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseReferenceDataSetIDInsensitively(input string) (*ReferenceDataSetId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ReferenceDataSetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ReferenceDataSetId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.EnvironmentName, ok = parsed.Parsed["environmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "environmentName", *parsed) + if id.EnvironmentName, ok = input.Parsed["environmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "environmentName", input) } - if id.ReferenceDataSetName, ok = parsed.Parsed["referenceDataSetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "referenceDataSetName", *parsed) + if id.ReferenceDataSetName, ok = input.Parsed["referenceDataSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "referenceDataSetName", input) } - return &id, nil + return nil } // ValidateReferenceDataSetID checks that 'input' can be parsed as a Reference Data Set ID diff --git a/resource-manager/trafficmanager/2018-08-01/endpoints/id_endpointtype.go b/resource-manager/trafficmanager/2018-08-01/endpoints/id_endpointtype.go index 7372f267399..8ea4524bee4 100644 --- a/resource-manager/trafficmanager/2018-08-01/endpoints/id_endpointtype.go +++ b/resource-manager/trafficmanager/2018-08-01/endpoints/id_endpointtype.go @@ -40,35 +40,9 @@ func ParseEndpointTypeID(input string) (*EndpointTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EndpointTypeId{} - - 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.TrafficManagerProfileName, ok = parsed.Parsed["trafficManagerProfileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "trafficManagerProfileName", *parsed) - } - - if v, ok := parsed.Parsed["endpointType"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "endpointType", *parsed) - } - - endpointType, err := parseEndpointType(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.EndpointType = *endpointType - } - - if id.EndpointName, ok = parsed.Parsed["endpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "endpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -83,38 +57,46 @@ func ParseEndpointTypeIDInsensitively(input string) (*EndpointTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EndpointTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *EndpointTypeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.TrafficManagerProfileName, ok = parsed.Parsed["trafficManagerProfileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "trafficManagerProfileName", *parsed) + if id.TrafficManagerProfileName, ok = input.Parsed["trafficManagerProfileName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "trafficManagerProfileName", input) } - if v, ok := parsed.Parsed["endpointType"]; true { + if v, ok := input.Parsed["endpointType"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "endpointType", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "endpointType", input) } endpointType, err := parseEndpointType(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.EndpointType = *endpointType } - if id.EndpointName, ok = parsed.Parsed["endpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "endpointName", *parsed) + if id.EndpointName, ok = input.Parsed["endpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "endpointName", input) } - return &id, nil + return nil } // ValidateEndpointTypeID checks that 'input' can be parsed as a Endpoint Type ID diff --git a/resource-manager/trafficmanager/2018-08-01/heatmaps/id_trafficmanagerprofile.go b/resource-manager/trafficmanager/2018-08-01/heatmaps/id_trafficmanagerprofile.go index be40dc9dd95..4423e893e56 100644 --- a/resource-manager/trafficmanager/2018-08-01/heatmaps/id_trafficmanagerprofile.go +++ b/resource-manager/trafficmanager/2018-08-01/heatmaps/id_trafficmanagerprofile.go @@ -36,19 +36,9 @@ func ParseTrafficManagerProfileID(input string) (*TrafficManagerProfileId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TrafficManagerProfileId{} - - 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.TrafficManagerProfileName, ok = parsed.Parsed["trafficManagerProfileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "trafficManagerProfileName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseTrafficManagerProfileIDInsensitively(input string) (*TrafficManagerPro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TrafficManagerProfileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *TrafficManagerProfileId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.TrafficManagerProfileName, ok = parsed.Parsed["trafficManagerProfileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "trafficManagerProfileName", *parsed) + if id.TrafficManagerProfileName, ok = input.Parsed["trafficManagerProfileName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "trafficManagerProfileName", input) } - return &id, nil + return nil } // ValidateTrafficManagerProfileID checks that 'input' can be parsed as a Traffic Manager Profile ID diff --git a/resource-manager/trafficmanager/2018-08-01/profiles/id_trafficmanagerprofile.go b/resource-manager/trafficmanager/2018-08-01/profiles/id_trafficmanagerprofile.go index 30f09acf194..d6786d0cc28 100644 --- a/resource-manager/trafficmanager/2018-08-01/profiles/id_trafficmanagerprofile.go +++ b/resource-manager/trafficmanager/2018-08-01/profiles/id_trafficmanagerprofile.go @@ -36,19 +36,9 @@ func ParseTrafficManagerProfileID(input string) (*TrafficManagerProfileId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TrafficManagerProfileId{} - - 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.TrafficManagerProfileName, ok = parsed.Parsed["trafficManagerProfileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "trafficManagerProfileName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseTrafficManagerProfileIDInsensitively(input string) (*TrafficManagerPro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TrafficManagerProfileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *TrafficManagerProfileId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.TrafficManagerProfileName, ok = parsed.Parsed["trafficManagerProfileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "trafficManagerProfileName", *parsed) + if id.TrafficManagerProfileName, ok = input.Parsed["trafficManagerProfileName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "trafficManagerProfileName", input) } - return &id, nil + return nil } // ValidateTrafficManagerProfileID checks that 'input' can be parsed as a Traffic Manager Profile ID diff --git a/resource-manager/trafficmanager/2022-04-01/endpoints/id_endpointtype.go b/resource-manager/trafficmanager/2022-04-01/endpoints/id_endpointtype.go index 7372f267399..8ea4524bee4 100644 --- a/resource-manager/trafficmanager/2022-04-01/endpoints/id_endpointtype.go +++ b/resource-manager/trafficmanager/2022-04-01/endpoints/id_endpointtype.go @@ -40,35 +40,9 @@ func ParseEndpointTypeID(input string) (*EndpointTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EndpointTypeId{} - - 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.TrafficManagerProfileName, ok = parsed.Parsed["trafficManagerProfileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "trafficManagerProfileName", *parsed) - } - - if v, ok := parsed.Parsed["endpointType"]; true { - if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "endpointType", *parsed) - } - - endpointType, err := parseEndpointType(v) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) - } - id.EndpointType = *endpointType - } - - if id.EndpointName, ok = parsed.Parsed["endpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "endpointName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -83,38 +57,46 @@ func ParseEndpointTypeIDInsensitively(input string) (*EndpointTypeId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EndpointTypeId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *EndpointTypeId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.TrafficManagerProfileName, ok = parsed.Parsed["trafficManagerProfileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "trafficManagerProfileName", *parsed) + if id.TrafficManagerProfileName, ok = input.Parsed["trafficManagerProfileName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "trafficManagerProfileName", input) } - if v, ok := parsed.Parsed["endpointType"]; true { + if v, ok := input.Parsed["endpointType"]; true { if !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "endpointType", *parsed) + return resourceids.NewSegmentNotSpecifiedError(id, "endpointType", input) } endpointType, err := parseEndpointType(v) if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", v, err) + return fmt.Errorf("parsing %q: %+v", v, err) } id.EndpointType = *endpointType } - if id.EndpointName, ok = parsed.Parsed["endpointName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "endpointName", *parsed) + if id.EndpointName, ok = input.Parsed["endpointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "endpointName", input) } - return &id, nil + return nil } // ValidateEndpointTypeID checks that 'input' can be parsed as a Endpoint Type ID diff --git a/resource-manager/trafficmanager/2022-04-01/heatmaps/id_trafficmanagerprofile.go b/resource-manager/trafficmanager/2022-04-01/heatmaps/id_trafficmanagerprofile.go index be40dc9dd95..4423e893e56 100644 --- a/resource-manager/trafficmanager/2022-04-01/heatmaps/id_trafficmanagerprofile.go +++ b/resource-manager/trafficmanager/2022-04-01/heatmaps/id_trafficmanagerprofile.go @@ -36,19 +36,9 @@ func ParseTrafficManagerProfileID(input string) (*TrafficManagerProfileId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TrafficManagerProfileId{} - - 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.TrafficManagerProfileName, ok = parsed.Parsed["trafficManagerProfileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "trafficManagerProfileName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseTrafficManagerProfileIDInsensitively(input string) (*TrafficManagerPro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TrafficManagerProfileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *TrafficManagerProfileId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.TrafficManagerProfileName, ok = parsed.Parsed["trafficManagerProfileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "trafficManagerProfileName", *parsed) + if id.TrafficManagerProfileName, ok = input.Parsed["trafficManagerProfileName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "trafficManagerProfileName", input) } - return &id, nil + return nil } // ValidateTrafficManagerProfileID checks that 'input' can be parsed as a Traffic Manager Profile ID diff --git a/resource-manager/trafficmanager/2022-04-01/profiles/id_trafficmanagerprofile.go b/resource-manager/trafficmanager/2022-04-01/profiles/id_trafficmanagerprofile.go index 30f09acf194..d6786d0cc28 100644 --- a/resource-manager/trafficmanager/2022-04-01/profiles/id_trafficmanagerprofile.go +++ b/resource-manager/trafficmanager/2022-04-01/profiles/id_trafficmanagerprofile.go @@ -36,19 +36,9 @@ func ParseTrafficManagerProfileID(input string) (*TrafficManagerProfileId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TrafficManagerProfileId{} - - 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.TrafficManagerProfileName, ok = parsed.Parsed["trafficManagerProfileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "trafficManagerProfileName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseTrafficManagerProfileIDInsensitively(input string) (*TrafficManagerPro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TrafficManagerProfileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *TrafficManagerProfileId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.TrafficManagerProfileName, ok = parsed.Parsed["trafficManagerProfileName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "trafficManagerProfileName", *parsed) + if id.TrafficManagerProfileName, ok = input.Parsed["trafficManagerProfileName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "trafficManagerProfileName", input) } - return &id, nil + return nil } // ValidateTrafficManagerProfileID checks that 'input' can be parsed as a Traffic Manager Profile ID diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/id_edgemodule.go b/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/id_edgemodule.go index 167de703ce0..1d78f0e359b 100644 --- a/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/id_edgemodule.go +++ b/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/id_edgemodule.go @@ -38,23 +38,9 @@ func ParseEdgeModuleID(input string) (*EdgeModuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EdgeModuleId{} - - 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.VideoAnalyzerName, ok = parsed.Parsed["videoAnalyzerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "videoAnalyzerName", *parsed) - } - - if id.EdgeModuleName, ok = parsed.Parsed["edgeModuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "edgeModuleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseEdgeModuleIDInsensitively(input string) (*EdgeModuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := EdgeModuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EdgeModuleId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VideoAnalyzerName, ok = parsed.Parsed["videoAnalyzerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "videoAnalyzerName", *parsed) + if id.VideoAnalyzerName, ok = input.Parsed["videoAnalyzerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "videoAnalyzerName", input) } - if id.EdgeModuleName, ok = parsed.Parsed["edgeModuleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "edgeModuleName", *parsed) + if id.EdgeModuleName, ok = input.Parsed["edgeModuleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "edgeModuleName", input) } - return &id, nil + return nil } // ValidateEdgeModuleID checks that 'input' can be parsed as a Edge Module ID diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/id_videoanalyzer.go b/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/id_videoanalyzer.go index 85dfb64ccba..a0cf6d14a28 100644 --- a/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/id_videoanalyzer.go +++ b/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/id_videoanalyzer.go @@ -36,19 +36,9 @@ func ParseVideoAnalyzerID(input string) (*VideoAnalyzerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VideoAnalyzerId{} - - 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.VideoAnalyzerName, ok = parsed.Parsed["videoAnalyzerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "videoAnalyzerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVideoAnalyzerIDInsensitively(input string) (*VideoAnalyzerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VideoAnalyzerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VideoAnalyzerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VideoAnalyzerName, ok = parsed.Parsed["videoAnalyzerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "videoAnalyzerName", *parsed) + if id.VideoAnalyzerName, ok = input.Parsed["videoAnalyzerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "videoAnalyzerName", input) } - return &id, nil + return nil } // ValidateVideoAnalyzerID checks that 'input' can be parsed as a Video Analyzer ID diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/id_location.go b/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/id_location.go index 7aa330d5811..7f3beca3d06 100644 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/id_location.go +++ b/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/id_videoanalyzer.go b/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/id_videoanalyzer.go index 86006fb7fe2..c01217f419e 100644 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/id_videoanalyzer.go +++ b/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/id_videoanalyzer.go @@ -36,19 +36,9 @@ func ParseVideoAnalyzerID(input string) (*VideoAnalyzerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VideoAnalyzerId{} - - 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.VideoAnalyzerName, ok = parsed.Parsed["videoAnalyzerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "videoAnalyzerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVideoAnalyzerIDInsensitively(input string) (*VideoAnalyzerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VideoAnalyzerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VideoAnalyzerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VideoAnalyzerName, ok = parsed.Parsed["videoAnalyzerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "videoAnalyzerName", *parsed) + if id.VideoAnalyzerName, ok = input.Parsed["videoAnalyzerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "videoAnalyzerName", input) } - return &id, nil + return nil } // ValidateVideoAnalyzerID checks that 'input' can be parsed as a Video Analyzer ID diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videos/id_accesspolicy.go b/resource-manager/videoanalyzer/2021-05-01-preview/videos/id_accesspolicy.go index 5866079a132..bfbaa312d03 100644 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videos/id_accesspolicy.go +++ b/resource-manager/videoanalyzer/2021-05-01-preview/videos/id_accesspolicy.go @@ -38,23 +38,9 @@ func ParseAccessPolicyID(input string) (*AccessPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccessPolicyId{} - - 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.VideoAnalyzerName, ok = parsed.Parsed["videoAnalyzerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "videoAnalyzerName", *parsed) - } - - if id.AccessPolicyName, ok = parsed.Parsed["accessPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accessPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAccessPolicyIDInsensitively(input string) (*AccessPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AccessPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AccessPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VideoAnalyzerName, ok = parsed.Parsed["videoAnalyzerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "videoAnalyzerName", *parsed) + if id.VideoAnalyzerName, ok = input.Parsed["videoAnalyzerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "videoAnalyzerName", input) } - if id.AccessPolicyName, ok = parsed.Parsed["accessPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "accessPolicyName", *parsed) + if id.AccessPolicyName, ok = input.Parsed["accessPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accessPolicyName", input) } - return &id, nil + return nil } // ValidateAccessPolicyID checks that 'input' can be parsed as a Access Policy ID diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videos/id_video.go b/resource-manager/videoanalyzer/2021-05-01-preview/videos/id_video.go index 407d0f66ddd..dea619db2fd 100644 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videos/id_video.go +++ b/resource-manager/videoanalyzer/2021-05-01-preview/videos/id_video.go @@ -38,23 +38,9 @@ func ParseVideoID(input string) (*VideoId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VideoId{} - - 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.VideoAnalyzerName, ok = parsed.Parsed["videoAnalyzerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "videoAnalyzerName", *parsed) - } - - if id.VideoName, ok = parsed.Parsed["videoName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "videoName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVideoIDInsensitively(input string) (*VideoId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VideoId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VideoId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VideoAnalyzerName, ok = parsed.Parsed["videoAnalyzerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "videoAnalyzerName", *parsed) + if id.VideoAnalyzerName, ok = input.Parsed["videoAnalyzerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "videoAnalyzerName", input) } - if id.VideoName, ok = parsed.Parsed["videoName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "videoName", *parsed) + if id.VideoName, ok = input.Parsed["videoName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "videoName", input) } - return &id, nil + return nil } // ValidateVideoID checks that 'input' can be parsed as a Video ID diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videos/id_videoanalyzer.go b/resource-manager/videoanalyzer/2021-05-01-preview/videos/id_videoanalyzer.go index f1d24ed0435..8711bb60a8f 100644 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videos/id_videoanalyzer.go +++ b/resource-manager/videoanalyzer/2021-05-01-preview/videos/id_videoanalyzer.go @@ -36,19 +36,9 @@ func ParseVideoAnalyzerID(input string) (*VideoAnalyzerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VideoAnalyzerId{} - - 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.VideoAnalyzerName, ok = parsed.Parsed["videoAnalyzerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "videoAnalyzerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVideoAnalyzerIDInsensitively(input string) (*VideoAnalyzerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VideoAnalyzerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VideoAnalyzerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VideoAnalyzerName, ok = parsed.Parsed["videoAnalyzerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "videoAnalyzerName", *parsed) + if id.VideoAnalyzerName, ok = input.Parsed["videoAnalyzerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "videoAnalyzerName", input) } - return &id, nil + return nil } // ValidateVideoAnalyzerID checks that 'input' can be parsed as a Video Analyzer ID diff --git a/resource-manager/vmware/2022-05-01/addons/id_addon.go b/resource-manager/vmware/2022-05-01/addons/id_addon.go index 3d60fe9c49c..e5bbc93c53e 100644 --- a/resource-manager/vmware/2022-05-01/addons/id_addon.go +++ b/resource-manager/vmware/2022-05-01/addons/id_addon.go @@ -38,23 +38,9 @@ func ParseAddonID(input string) (*AddonId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AddonId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.AddonName, ok = parsed.Parsed["addonName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "addonName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAddonIDInsensitively(input string) (*AddonId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AddonId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AddonId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.AddonName, ok = parsed.Parsed["addonName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "addonName", *parsed) + if id.AddonName, ok = input.Parsed["addonName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "addonName", input) } - return &id, nil + return nil } // ValidateAddonID checks that 'input' can be parsed as a Addon ID diff --git a/resource-manager/vmware/2022-05-01/addons/id_privatecloud.go b/resource-manager/vmware/2022-05-01/addons/id_privatecloud.go index 1bcca7750ed..683f8be2a16 100644 --- a/resource-manager/vmware/2022-05-01/addons/id_privatecloud.go +++ b/resource-manager/vmware/2022-05-01/addons/id_privatecloud.go @@ -36,19 +36,9 @@ func ParsePrivateCloudID(input string) (*PrivateCloudId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateCloudId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePrivateCloudIDInsensitively(input string) (*PrivateCloudId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateCloudId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PrivateCloudId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - return &id, nil + return nil } // ValidatePrivateCloudID checks that 'input' can be parsed as a Private Cloud ID diff --git a/resource-manager/vmware/2022-05-01/authorizations/id_authorization.go b/resource-manager/vmware/2022-05-01/authorizations/id_authorization.go index e58f467d253..7945ea43105 100644 --- a/resource-manager/vmware/2022-05-01/authorizations/id_authorization.go +++ b/resource-manager/vmware/2022-05-01/authorizations/id_authorization.go @@ -38,23 +38,9 @@ func ParseAuthorizationID(input string) (*AuthorizationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.AuthorizationName, ok = parsed.Parsed["authorizationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAuthorizationIDInsensitively(input string) (*AuthorizationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AuthorizationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.AuthorizationName, ok = parsed.Parsed["authorizationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationName", *parsed) + if id.AuthorizationName, ok = input.Parsed["authorizationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationName", input) } - return &id, nil + return nil } // ValidateAuthorizationID checks that 'input' can be parsed as a Authorization ID diff --git a/resource-manager/vmware/2022-05-01/authorizations/id_privatecloud.go b/resource-manager/vmware/2022-05-01/authorizations/id_privatecloud.go index c36932fb77f..9b36093f5a5 100644 --- a/resource-manager/vmware/2022-05-01/authorizations/id_privatecloud.go +++ b/resource-manager/vmware/2022-05-01/authorizations/id_privatecloud.go @@ -36,19 +36,9 @@ func ParsePrivateCloudID(input string) (*PrivateCloudId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateCloudId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePrivateCloudIDInsensitively(input string) (*PrivateCloudId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateCloudId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PrivateCloudId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - return &id, nil + return nil } // ValidatePrivateCloudID checks that 'input' can be parsed as a Private Cloud ID diff --git a/resource-manager/vmware/2022-05-01/cloudlinks/id_cloudlink.go b/resource-manager/vmware/2022-05-01/cloudlinks/id_cloudlink.go index 6a476e3decc..d601530db8c 100644 --- a/resource-manager/vmware/2022-05-01/cloudlinks/id_cloudlink.go +++ b/resource-manager/vmware/2022-05-01/cloudlinks/id_cloudlink.go @@ -38,23 +38,9 @@ func ParseCloudLinkID(input string) (*CloudLinkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CloudLinkId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.CloudLinkName, ok = parsed.Parsed["cloudLinkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudLinkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCloudLinkIDInsensitively(input string) (*CloudLinkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CloudLinkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CloudLinkId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.CloudLinkName, ok = parsed.Parsed["cloudLinkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudLinkName", *parsed) + if id.CloudLinkName, ok = input.Parsed["cloudLinkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cloudLinkName", input) } - return &id, nil + return nil } // ValidateCloudLinkID checks that 'input' can be parsed as a Cloud Link ID diff --git a/resource-manager/vmware/2022-05-01/cloudlinks/id_privatecloud.go b/resource-manager/vmware/2022-05-01/cloudlinks/id_privatecloud.go index 17fdf7c940f..b20dc6e0780 100644 --- a/resource-manager/vmware/2022-05-01/cloudlinks/id_privatecloud.go +++ b/resource-manager/vmware/2022-05-01/cloudlinks/id_privatecloud.go @@ -36,19 +36,9 @@ func ParsePrivateCloudID(input string) (*PrivateCloudId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateCloudId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePrivateCloudIDInsensitively(input string) (*PrivateCloudId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateCloudId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PrivateCloudId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - return &id, nil + return nil } // ValidatePrivateCloudID checks that 'input' can be parsed as a Private Cloud ID diff --git a/resource-manager/vmware/2022-05-01/cluster/id_cluster.go b/resource-manager/vmware/2022-05-01/cluster/id_cluster.go index ed12e535ab7..53930927544 100644 --- a/resource-manager/vmware/2022-05-01/cluster/id_cluster.go +++ b/resource-manager/vmware/2022-05-01/cluster/id_cluster.go @@ -38,23 +38,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ClusterId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/vmware/2022-05-01/clusters/id_cluster.go b/resource-manager/vmware/2022-05-01/clusters/id_cluster.go index f544d575acc..4b673ed8119 100644 --- a/resource-manager/vmware/2022-05-01/clusters/id_cluster.go +++ b/resource-manager/vmware/2022-05-01/clusters/id_cluster.go @@ -38,23 +38,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ClusterId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/vmware/2022-05-01/clusters/id_privatecloud.go b/resource-manager/vmware/2022-05-01/clusters/id_privatecloud.go index b430f33189b..11c6266a8b3 100644 --- a/resource-manager/vmware/2022-05-01/clusters/id_privatecloud.go +++ b/resource-manager/vmware/2022-05-01/clusters/id_privatecloud.go @@ -36,19 +36,9 @@ func ParsePrivateCloudID(input string) (*PrivateCloudId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateCloudId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePrivateCloudIDInsensitively(input string) (*PrivateCloudId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateCloudId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PrivateCloudId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - return &id, nil + return nil } // ValidatePrivateCloudID checks that 'input' can be parsed as a Private Cloud ID diff --git a/resource-manager/vmware/2022-05-01/datastores/id_cluster.go b/resource-manager/vmware/2022-05-01/datastores/id_cluster.go index bf119a81668..6a0d632dee6 100644 --- a/resource-manager/vmware/2022-05-01/datastores/id_cluster.go +++ b/resource-manager/vmware/2022-05-01/datastores/id_cluster.go @@ -38,23 +38,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ClusterId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/vmware/2022-05-01/datastores/id_datastore.go b/resource-manager/vmware/2022-05-01/datastores/id_datastore.go index c7295fb1785..b212d2e29dc 100644 --- a/resource-manager/vmware/2022-05-01/datastores/id_datastore.go +++ b/resource-manager/vmware/2022-05-01/datastores/id_datastore.go @@ -40,27 +40,9 @@ func ParseDataStoreID(input string) (*DataStoreId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataStoreId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.DataStoreName, ok = parsed.Parsed["dataStoreName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataStoreName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseDataStoreIDInsensitively(input string) (*DataStoreId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataStoreId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DataStoreId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.DataStoreName, ok = parsed.Parsed["dataStoreName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataStoreName", *parsed) + if id.DataStoreName, ok = input.Parsed["dataStoreName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataStoreName", input) } - return &id, nil + return nil } // ValidateDataStoreID checks that 'input' can be parsed as a Data Store ID diff --git a/resource-manager/vmware/2022-05-01/globalreachconnections/id_globalreachconnection.go b/resource-manager/vmware/2022-05-01/globalreachconnections/id_globalreachconnection.go index e34e1c35969..b12bc4b790f 100644 --- a/resource-manager/vmware/2022-05-01/globalreachconnections/id_globalreachconnection.go +++ b/resource-manager/vmware/2022-05-01/globalreachconnections/id_globalreachconnection.go @@ -38,23 +38,9 @@ func ParseGlobalReachConnectionID(input string) (*GlobalReachConnectionId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GlobalReachConnectionId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.GlobalReachConnectionName, ok = parsed.Parsed["globalReachConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalReachConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGlobalReachConnectionIDInsensitively(input string) (*GlobalReachConnec return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GlobalReachConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GlobalReachConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.GlobalReachConnectionName, ok = parsed.Parsed["globalReachConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalReachConnectionName", *parsed) + if id.GlobalReachConnectionName, ok = input.Parsed["globalReachConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "globalReachConnectionName", input) } - return &id, nil + return nil } // ValidateGlobalReachConnectionID checks that 'input' can be parsed as a Global Reach Connection ID diff --git a/resource-manager/vmware/2022-05-01/globalreachconnections/id_privatecloud.go b/resource-manager/vmware/2022-05-01/globalreachconnections/id_privatecloud.go index 8ebce7ced59..a4950a1141d 100644 --- a/resource-manager/vmware/2022-05-01/globalreachconnections/id_privatecloud.go +++ b/resource-manager/vmware/2022-05-01/globalreachconnections/id_privatecloud.go @@ -36,19 +36,9 @@ func ParsePrivateCloudID(input string) (*PrivateCloudId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateCloudId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePrivateCloudIDInsensitively(input string) (*PrivateCloudId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateCloudId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PrivateCloudId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - return &id, nil + return nil } // ValidatePrivateCloudID checks that 'input' can be parsed as a Private Cloud ID diff --git a/resource-manager/vmware/2022-05-01/hcxenterprisesites/id_hcxenterprisesite.go b/resource-manager/vmware/2022-05-01/hcxenterprisesites/id_hcxenterprisesite.go index e8dda80cd5e..8048fe223c5 100644 --- a/resource-manager/vmware/2022-05-01/hcxenterprisesites/id_hcxenterprisesite.go +++ b/resource-manager/vmware/2022-05-01/hcxenterprisesites/id_hcxenterprisesite.go @@ -38,23 +38,9 @@ func ParseHcxEnterpriseSiteID(input string) (*HcxEnterpriseSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HcxEnterpriseSiteId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.HcxEnterpriseSiteName, ok = parsed.Parsed["hcxEnterpriseSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hcxEnterpriseSiteName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseHcxEnterpriseSiteIDInsensitively(input string) (*HcxEnterpriseSiteId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HcxEnterpriseSiteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *HcxEnterpriseSiteId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.HcxEnterpriseSiteName, ok = parsed.Parsed["hcxEnterpriseSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hcxEnterpriseSiteName", *parsed) + if id.HcxEnterpriseSiteName, ok = input.Parsed["hcxEnterpriseSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hcxEnterpriseSiteName", input) } - return &id, nil + return nil } // ValidateHcxEnterpriseSiteID checks that 'input' can be parsed as a Hcx Enterprise Site ID diff --git a/resource-manager/vmware/2022-05-01/hcxenterprisesites/id_privatecloud.go b/resource-manager/vmware/2022-05-01/hcxenterprisesites/id_privatecloud.go index 73304df0e78..e7b4426323d 100644 --- a/resource-manager/vmware/2022-05-01/hcxenterprisesites/id_privatecloud.go +++ b/resource-manager/vmware/2022-05-01/hcxenterprisesites/id_privatecloud.go @@ -36,19 +36,9 @@ func ParsePrivateCloudID(input string) (*PrivateCloudId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateCloudId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePrivateCloudIDInsensitively(input string) (*PrivateCloudId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateCloudId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PrivateCloudId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - return &id, nil + return nil } // ValidatePrivateCloudID checks that 'input' can be parsed as a Private Cloud ID diff --git a/resource-manager/vmware/2022-05-01/locations/id_location.go b/resource-manager/vmware/2022-05-01/locations/id_location.go index b56c56be99a..ac66ea44ca0 100644 --- a/resource-manager/vmware/2022-05-01/locations/id_location.go +++ b/resource-manager/vmware/2022-05-01/locations/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/vmware/2022-05-01/placementpolicies/id_cluster.go b/resource-manager/vmware/2022-05-01/placementpolicies/id_cluster.go index 5a3a778f021..1771f449f72 100644 --- a/resource-manager/vmware/2022-05-01/placementpolicies/id_cluster.go +++ b/resource-manager/vmware/2022-05-01/placementpolicies/id_cluster.go @@ -38,23 +38,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ClusterId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/vmware/2022-05-01/placementpolicies/id_placementpolicy.go b/resource-manager/vmware/2022-05-01/placementpolicies/id_placementpolicy.go index 8fe3ce574d3..c63e2568e0a 100644 --- a/resource-manager/vmware/2022-05-01/placementpolicies/id_placementpolicy.go +++ b/resource-manager/vmware/2022-05-01/placementpolicies/id_placementpolicy.go @@ -40,27 +40,9 @@ func ParsePlacementPolicyID(input string) (*PlacementPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PlacementPolicyId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.PlacementPolicyName, ok = parsed.Parsed["placementPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "placementPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParsePlacementPolicyIDInsensitively(input string) (*PlacementPolicyId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PlacementPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *PlacementPolicyId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.PlacementPolicyName, ok = parsed.Parsed["placementPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "placementPolicyName", *parsed) + if id.PlacementPolicyName, ok = input.Parsed["placementPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "placementPolicyName", input) } - return &id, nil + return nil } // ValidatePlacementPolicyID checks that 'input' can be parsed as a Placement Policy ID diff --git a/resource-manager/vmware/2022-05-01/placementpolicies/id_virtualmachine.go b/resource-manager/vmware/2022-05-01/placementpolicies/id_virtualmachine.go index 4a862408d2b..9853fe27cae 100644 --- a/resource-manager/vmware/2022-05-01/placementpolicies/id_virtualmachine.go +++ b/resource-manager/vmware/2022-05-01/placementpolicies/id_virtualmachine.go @@ -40,27 +40,9 @@ func ParseVirtualMachineID(input string) (*VirtualMachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.VirtualMachineId, ok = parsed.Parsed["virtualMachineId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVirtualMachineIDInsensitively(input string) (*VirtualMachineId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VirtualMachineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.VirtualMachineId, ok = parsed.Parsed["virtualMachineId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineId", *parsed) + if id.VirtualMachineId, ok = input.Parsed["virtualMachineId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineId", input) } - return &id, nil + return nil } // ValidateVirtualMachineID checks that 'input' can be parsed as a Virtual Machine ID diff --git a/resource-manager/vmware/2022-05-01/privateclouds/id_privatecloud.go b/resource-manager/vmware/2022-05-01/privateclouds/id_privatecloud.go index b2ca8fa59a5..1a5fc69da4e 100644 --- a/resource-manager/vmware/2022-05-01/privateclouds/id_privatecloud.go +++ b/resource-manager/vmware/2022-05-01/privateclouds/id_privatecloud.go @@ -36,19 +36,9 @@ func ParsePrivateCloudID(input string) (*PrivateCloudId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateCloudId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePrivateCloudIDInsensitively(input string) (*PrivateCloudId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateCloudId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PrivateCloudId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - return &id, nil + return nil } // ValidatePrivateCloudID checks that 'input' can be parsed as a Private Cloud ID diff --git a/resource-manager/vmware/2022-05-01/scripts/id_privatecloud.go b/resource-manager/vmware/2022-05-01/scripts/id_privatecloud.go index 95f25782d4e..beecc607f56 100644 --- a/resource-manager/vmware/2022-05-01/scripts/id_privatecloud.go +++ b/resource-manager/vmware/2022-05-01/scripts/id_privatecloud.go @@ -36,19 +36,9 @@ func ParsePrivateCloudID(input string) (*PrivateCloudId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateCloudId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePrivateCloudIDInsensitively(input string) (*PrivateCloudId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateCloudId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PrivateCloudId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - return &id, nil + return nil } // ValidatePrivateCloudID checks that 'input' can be parsed as a Private Cloud ID diff --git a/resource-manager/vmware/2022-05-01/scripts/id_scriptcmdlet.go b/resource-manager/vmware/2022-05-01/scripts/id_scriptcmdlet.go index ac004587db6..76b2acbb5c6 100644 --- a/resource-manager/vmware/2022-05-01/scripts/id_scriptcmdlet.go +++ b/resource-manager/vmware/2022-05-01/scripts/id_scriptcmdlet.go @@ -40,27 +40,9 @@ func ParseScriptCmdletID(input string) (*ScriptCmdletId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScriptCmdletId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.ScriptPackageName, ok = parsed.Parsed["scriptPackageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scriptPackageName", *parsed) - } - - if id.ScriptCmdletName, ok = parsed.Parsed["scriptCmdletName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scriptCmdletName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseScriptCmdletIDInsensitively(input string) (*ScriptCmdletId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScriptCmdletId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ScriptCmdletId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.ScriptPackageName, ok = parsed.Parsed["scriptPackageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scriptPackageName", *parsed) + if id.ScriptPackageName, ok = input.Parsed["scriptPackageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scriptPackageName", input) } - if id.ScriptCmdletName, ok = parsed.Parsed["scriptCmdletName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scriptCmdletName", *parsed) + if id.ScriptCmdletName, ok = input.Parsed["scriptCmdletName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scriptCmdletName", input) } - return &id, nil + return nil } // ValidateScriptCmdletID checks that 'input' can be parsed as a Script Cmdlet ID diff --git a/resource-manager/vmware/2022-05-01/scripts/id_scriptexecution.go b/resource-manager/vmware/2022-05-01/scripts/id_scriptexecution.go index 6d9f26746c1..2ecff714c19 100644 --- a/resource-manager/vmware/2022-05-01/scripts/id_scriptexecution.go +++ b/resource-manager/vmware/2022-05-01/scripts/id_scriptexecution.go @@ -38,23 +38,9 @@ func ParseScriptExecutionID(input string) (*ScriptExecutionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScriptExecutionId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.ScriptExecutionName, ok = parsed.Parsed["scriptExecutionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scriptExecutionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseScriptExecutionIDInsensitively(input string) (*ScriptExecutionId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScriptExecutionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ScriptExecutionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.ScriptExecutionName, ok = parsed.Parsed["scriptExecutionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scriptExecutionName", *parsed) + if id.ScriptExecutionName, ok = input.Parsed["scriptExecutionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scriptExecutionName", input) } - return &id, nil + return nil } // ValidateScriptExecutionID checks that 'input' can be parsed as a Script Execution ID diff --git a/resource-manager/vmware/2022-05-01/scripts/id_scriptpackage.go b/resource-manager/vmware/2022-05-01/scripts/id_scriptpackage.go index 0685c51735c..d7a6d2eb7c2 100644 --- a/resource-manager/vmware/2022-05-01/scripts/id_scriptpackage.go +++ b/resource-manager/vmware/2022-05-01/scripts/id_scriptpackage.go @@ -38,23 +38,9 @@ func ParseScriptPackageID(input string) (*ScriptPackageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScriptPackageId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.ScriptPackageName, ok = parsed.Parsed["scriptPackageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scriptPackageName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseScriptPackageIDInsensitively(input string) (*ScriptPackageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScriptPackageId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ScriptPackageId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.ScriptPackageName, ok = parsed.Parsed["scriptPackageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scriptPackageName", *parsed) + if id.ScriptPackageName, ok = input.Parsed["scriptPackageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scriptPackageName", input) } - return &id, nil + return nil } // ValidateScriptPackageID checks that 'input' can be parsed as a Script Package ID diff --git a/resource-manager/vmware/2022-05-01/virtualmachines/id_cluster.go b/resource-manager/vmware/2022-05-01/virtualmachines/id_cluster.go index 3ad722e1d46..b6c6c6e83f9 100644 --- a/resource-manager/vmware/2022-05-01/virtualmachines/id_cluster.go +++ b/resource-manager/vmware/2022-05-01/virtualmachines/id_cluster.go @@ -38,23 +38,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ClusterId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/vmware/2022-05-01/virtualmachines/id_virtualmachine.go b/resource-manager/vmware/2022-05-01/virtualmachines/id_virtualmachine.go index 7c78439c749..200a101a145 100644 --- a/resource-manager/vmware/2022-05-01/virtualmachines/id_virtualmachine.go +++ b/resource-manager/vmware/2022-05-01/virtualmachines/id_virtualmachine.go @@ -40,27 +40,9 @@ func ParseVirtualMachineID(input string) (*VirtualMachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.VirtualMachineId, ok = parsed.Parsed["virtualMachineId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVirtualMachineIDInsensitively(input string) (*VirtualMachineId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VirtualMachineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.VirtualMachineId, ok = parsed.Parsed["virtualMachineId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineId", *parsed) + if id.VirtualMachineId, ok = input.Parsed["virtualMachineId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineId", input) } - return &id, nil + return nil } // ValidateVirtualMachineID checks that 'input' can be parsed as a Virtual Machine ID diff --git a/resource-manager/vmware/2022-05-01/workloadnetworks/id_defaultvirtualmachine.go b/resource-manager/vmware/2022-05-01/workloadnetworks/id_defaultvirtualmachine.go index c6f6391ff15..f1750e22636 100644 --- a/resource-manager/vmware/2022-05-01/workloadnetworks/id_defaultvirtualmachine.go +++ b/resource-manager/vmware/2022-05-01/workloadnetworks/id_defaultvirtualmachine.go @@ -38,23 +38,9 @@ func ParseDefaultVirtualMachineID(input string) (*DefaultVirtualMachineId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DefaultVirtualMachineId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.VirtualMachineId, ok = parsed.Parsed["virtualMachineId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDefaultVirtualMachineIDInsensitively(input string) (*DefaultVirtualMac return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DefaultVirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DefaultVirtualMachineId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.VirtualMachineId, ok = parsed.Parsed["virtualMachineId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineId", *parsed) + if id.VirtualMachineId, ok = input.Parsed["virtualMachineId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineId", input) } - return &id, nil + return nil } // ValidateDefaultVirtualMachineID checks that 'input' can be parsed as a Default Virtual Machine ID diff --git a/resource-manager/vmware/2022-05-01/workloadnetworks/id_dhcpconfiguration.go b/resource-manager/vmware/2022-05-01/workloadnetworks/id_dhcpconfiguration.go index 7907fc1cab6..e663f166b71 100644 --- a/resource-manager/vmware/2022-05-01/workloadnetworks/id_dhcpconfiguration.go +++ b/resource-manager/vmware/2022-05-01/workloadnetworks/id_dhcpconfiguration.go @@ -38,23 +38,9 @@ func ParseDhcpConfigurationID(input string) (*DhcpConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DhcpConfigurationId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.DhcpId, ok = parsed.Parsed["dhcpId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dhcpId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDhcpConfigurationIDInsensitively(input string) (*DhcpConfigurationId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DhcpConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DhcpConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.DhcpId, ok = parsed.Parsed["dhcpId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dhcpId", *parsed) + if id.DhcpId, ok = input.Parsed["dhcpId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dhcpId", input) } - return &id, nil + return nil } // ValidateDhcpConfigurationID checks that 'input' can be parsed as a Dhcp Configuration ID diff --git a/resource-manager/vmware/2022-05-01/workloadnetworks/id_dnsservice.go b/resource-manager/vmware/2022-05-01/workloadnetworks/id_dnsservice.go index e929920036b..335e5f870a6 100644 --- a/resource-manager/vmware/2022-05-01/workloadnetworks/id_dnsservice.go +++ b/resource-manager/vmware/2022-05-01/workloadnetworks/id_dnsservice.go @@ -38,23 +38,9 @@ func ParseDnsServiceID(input string) (*DnsServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DnsServiceId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.DnsServiceId, ok = parsed.Parsed["dnsServiceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dnsServiceId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDnsServiceIDInsensitively(input string) (*DnsServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DnsServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DnsServiceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.DnsServiceId, ok = parsed.Parsed["dnsServiceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dnsServiceId", *parsed) + if id.DnsServiceId, ok = input.Parsed["dnsServiceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dnsServiceId", input) } - return &id, nil + return nil } // ValidateDnsServiceID checks that 'input' can be parsed as a Dns Service ID diff --git a/resource-manager/vmware/2022-05-01/workloadnetworks/id_dnszone.go b/resource-manager/vmware/2022-05-01/workloadnetworks/id_dnszone.go index b720c1e9d01..363e26d60a6 100644 --- a/resource-manager/vmware/2022-05-01/workloadnetworks/id_dnszone.go +++ b/resource-manager/vmware/2022-05-01/workloadnetworks/id_dnszone.go @@ -38,23 +38,9 @@ func ParseDnsZoneID(input string) (*DnsZoneId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DnsZoneId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.DnsZoneId, ok = parsed.Parsed["dnsZoneId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dnsZoneId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDnsZoneIDInsensitively(input string) (*DnsZoneId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool 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 = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.DnsZoneId, ok = parsed.Parsed["dnsZoneId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dnsZoneId", *parsed) + if id.DnsZoneId, ok = input.Parsed["dnsZoneId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dnsZoneId", input) } - return &id, nil + return nil } // ValidateDnsZoneID checks that 'input' can be parsed as a Dns Zone ID diff --git a/resource-manager/vmware/2022-05-01/workloadnetworks/id_gateway.go b/resource-manager/vmware/2022-05-01/workloadnetworks/id_gateway.go index 47b53dc1a85..9f624d9710f 100644 --- a/resource-manager/vmware/2022-05-01/workloadnetworks/id_gateway.go +++ b/resource-manager/vmware/2022-05-01/workloadnetworks/id_gateway.go @@ -38,23 +38,9 @@ func ParseGatewayID(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGatewayIDInsensitively(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GatewayId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if id.GatewayId, ok = input.Parsed["gatewayId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", input) } - return &id, nil + return nil } // ValidateGatewayID checks that 'input' can be parsed as a Gateway ID diff --git a/resource-manager/vmware/2022-05-01/workloadnetworks/id_portmirroringprofile.go b/resource-manager/vmware/2022-05-01/workloadnetworks/id_portmirroringprofile.go index 9a4538d526e..6754548863f 100644 --- a/resource-manager/vmware/2022-05-01/workloadnetworks/id_portmirroringprofile.go +++ b/resource-manager/vmware/2022-05-01/workloadnetworks/id_portmirroringprofile.go @@ -38,23 +38,9 @@ func ParsePortMirroringProfileID(input string) (*PortMirroringProfileId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PortMirroringProfileId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.PortMirroringId, ok = parsed.Parsed["portMirroringId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "portMirroringId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePortMirroringProfileIDInsensitively(input string) (*PortMirroringProfi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PortMirroringProfileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PortMirroringProfileId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.PortMirroringId, ok = parsed.Parsed["portMirroringId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "portMirroringId", *parsed) + if id.PortMirroringId, ok = input.Parsed["portMirroringId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "portMirroringId", input) } - return &id, nil + return nil } // ValidatePortMirroringProfileID checks that 'input' can be parsed as a Port Mirroring Profile ID diff --git a/resource-manager/vmware/2022-05-01/workloadnetworks/id_privatecloud.go b/resource-manager/vmware/2022-05-01/workloadnetworks/id_privatecloud.go index de706d2f121..9c3586a6b61 100644 --- a/resource-manager/vmware/2022-05-01/workloadnetworks/id_privatecloud.go +++ b/resource-manager/vmware/2022-05-01/workloadnetworks/id_privatecloud.go @@ -36,19 +36,9 @@ func ParsePrivateCloudID(input string) (*PrivateCloudId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateCloudId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePrivateCloudIDInsensitively(input string) (*PrivateCloudId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateCloudId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PrivateCloudId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - return &id, nil + return nil } // ValidatePrivateCloudID checks that 'input' can be parsed as a Private Cloud ID diff --git a/resource-manager/vmware/2022-05-01/workloadnetworks/id_publicip.go b/resource-manager/vmware/2022-05-01/workloadnetworks/id_publicip.go index 4b2326c182e..272ea96412a 100644 --- a/resource-manager/vmware/2022-05-01/workloadnetworks/id_publicip.go +++ b/resource-manager/vmware/2022-05-01/workloadnetworks/id_publicip.go @@ -38,23 +38,9 @@ func ParsePublicIPID(input string) (*PublicIPId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PublicIPId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.PublicIPId, ok = parsed.Parsed["publicIPId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publicIPId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePublicIPIDInsensitively(input string) (*PublicIPId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PublicIPId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PublicIPId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.PublicIPId, ok = parsed.Parsed["publicIPId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publicIPId", *parsed) + if id.PublicIPId, ok = input.Parsed["publicIPId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publicIPId", input) } - return &id, nil + return nil } // ValidatePublicIPID checks that 'input' can be parsed as a Public I P ID diff --git a/resource-manager/vmware/2022-05-01/workloadnetworks/id_segment.go b/resource-manager/vmware/2022-05-01/workloadnetworks/id_segment.go index 158bdfda4e8..0f890f244f8 100644 --- a/resource-manager/vmware/2022-05-01/workloadnetworks/id_segment.go +++ b/resource-manager/vmware/2022-05-01/workloadnetworks/id_segment.go @@ -38,23 +38,9 @@ func ParseSegmentID(input string) (*SegmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SegmentId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.SegmentId, ok = parsed.Parsed["segmentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "segmentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSegmentIDInsensitively(input string) (*SegmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SegmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SegmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.SegmentId, ok = parsed.Parsed["segmentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "segmentId", *parsed) + if id.SegmentId, ok = input.Parsed["segmentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "segmentId", input) } - return &id, nil + return nil } // ValidateSegmentID checks that 'input' can be parsed as a Segment ID diff --git a/resource-manager/vmware/2022-05-01/workloadnetworks/id_vmgroup.go b/resource-manager/vmware/2022-05-01/workloadnetworks/id_vmgroup.go index 3e091bf0a9f..b3cce8064e2 100644 --- a/resource-manager/vmware/2022-05-01/workloadnetworks/id_vmgroup.go +++ b/resource-manager/vmware/2022-05-01/workloadnetworks/id_vmgroup.go @@ -38,23 +38,9 @@ func ParseVMGroupID(input string) (*VMGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VMGroupId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.VmGroupId, ok = parsed.Parsed["vmGroupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vmGroupId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVMGroupIDInsensitively(input string) (*VMGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VMGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VMGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.VmGroupId, ok = parsed.Parsed["vmGroupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vmGroupId", *parsed) + if id.VmGroupId, ok = input.Parsed["vmGroupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vmGroupId", input) } - return &id, nil + return nil } // ValidateVMGroupID checks that 'input' can be parsed as a V M Group ID diff --git a/resource-manager/vmware/2022-05-01/zone/id_cluster.go b/resource-manager/vmware/2022-05-01/zone/id_cluster.go index 610baf0f431..89018490a1b 100644 --- a/resource-manager/vmware/2022-05-01/zone/id_cluster.go +++ b/resource-manager/vmware/2022-05-01/zone/id_cluster.go @@ -38,23 +38,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ClusterId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/vmware/2023-03-01/addons/id_addon.go b/resource-manager/vmware/2023-03-01/addons/id_addon.go index 3d60fe9c49c..e5bbc93c53e 100644 --- a/resource-manager/vmware/2023-03-01/addons/id_addon.go +++ b/resource-manager/vmware/2023-03-01/addons/id_addon.go @@ -38,23 +38,9 @@ func ParseAddonID(input string) (*AddonId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AddonId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.AddonName, ok = parsed.Parsed["addonName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "addonName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAddonIDInsensitively(input string) (*AddonId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AddonId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AddonId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.AddonName, ok = parsed.Parsed["addonName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "addonName", *parsed) + if id.AddonName, ok = input.Parsed["addonName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "addonName", input) } - return &id, nil + return nil } // ValidateAddonID checks that 'input' can be parsed as a Addon ID diff --git a/resource-manager/vmware/2023-03-01/addons/id_privatecloud.go b/resource-manager/vmware/2023-03-01/addons/id_privatecloud.go index 1bcca7750ed..683f8be2a16 100644 --- a/resource-manager/vmware/2023-03-01/addons/id_privatecloud.go +++ b/resource-manager/vmware/2023-03-01/addons/id_privatecloud.go @@ -36,19 +36,9 @@ func ParsePrivateCloudID(input string) (*PrivateCloudId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateCloudId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePrivateCloudIDInsensitively(input string) (*PrivateCloudId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateCloudId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PrivateCloudId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - return &id, nil + return nil } // ValidatePrivateCloudID checks that 'input' can be parsed as a Private Cloud ID diff --git a/resource-manager/vmware/2023-03-01/authorizations/id_authorization.go b/resource-manager/vmware/2023-03-01/authorizations/id_authorization.go index e58f467d253..7945ea43105 100644 --- a/resource-manager/vmware/2023-03-01/authorizations/id_authorization.go +++ b/resource-manager/vmware/2023-03-01/authorizations/id_authorization.go @@ -38,23 +38,9 @@ func ParseAuthorizationID(input string) (*AuthorizationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.AuthorizationName, ok = parsed.Parsed["authorizationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAuthorizationIDInsensitively(input string) (*AuthorizationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthorizationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AuthorizationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.AuthorizationName, ok = parsed.Parsed["authorizationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authorizationName", *parsed) + if id.AuthorizationName, ok = input.Parsed["authorizationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authorizationName", input) } - return &id, nil + return nil } // ValidateAuthorizationID checks that 'input' can be parsed as a Authorization ID diff --git a/resource-manager/vmware/2023-03-01/authorizations/id_privatecloud.go b/resource-manager/vmware/2023-03-01/authorizations/id_privatecloud.go index c36932fb77f..9b36093f5a5 100644 --- a/resource-manager/vmware/2023-03-01/authorizations/id_privatecloud.go +++ b/resource-manager/vmware/2023-03-01/authorizations/id_privatecloud.go @@ -36,19 +36,9 @@ func ParsePrivateCloudID(input string) (*PrivateCloudId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateCloudId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePrivateCloudIDInsensitively(input string) (*PrivateCloudId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateCloudId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PrivateCloudId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - return &id, nil + return nil } // ValidatePrivateCloudID checks that 'input' can be parsed as a Private Cloud ID diff --git a/resource-manager/vmware/2023-03-01/cloudlinks/id_cloudlink.go b/resource-manager/vmware/2023-03-01/cloudlinks/id_cloudlink.go index 6a476e3decc..d601530db8c 100644 --- a/resource-manager/vmware/2023-03-01/cloudlinks/id_cloudlink.go +++ b/resource-manager/vmware/2023-03-01/cloudlinks/id_cloudlink.go @@ -38,23 +38,9 @@ func ParseCloudLinkID(input string) (*CloudLinkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CloudLinkId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.CloudLinkName, ok = parsed.Parsed["cloudLinkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudLinkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCloudLinkIDInsensitively(input string) (*CloudLinkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CloudLinkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CloudLinkId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.CloudLinkName, ok = parsed.Parsed["cloudLinkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudLinkName", *parsed) + if id.CloudLinkName, ok = input.Parsed["cloudLinkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cloudLinkName", input) } - return &id, nil + return nil } // ValidateCloudLinkID checks that 'input' can be parsed as a Cloud Link ID diff --git a/resource-manager/vmware/2023-03-01/cloudlinks/id_privatecloud.go b/resource-manager/vmware/2023-03-01/cloudlinks/id_privatecloud.go index 17fdf7c940f..b20dc6e0780 100644 --- a/resource-manager/vmware/2023-03-01/cloudlinks/id_privatecloud.go +++ b/resource-manager/vmware/2023-03-01/cloudlinks/id_privatecloud.go @@ -36,19 +36,9 @@ func ParsePrivateCloudID(input string) (*PrivateCloudId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateCloudId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePrivateCloudIDInsensitively(input string) (*PrivateCloudId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateCloudId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PrivateCloudId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - return &id, nil + return nil } // ValidatePrivateCloudID checks that 'input' can be parsed as a Private Cloud ID diff --git a/resource-manager/vmware/2023-03-01/cluster/id_cluster.go b/resource-manager/vmware/2023-03-01/cluster/id_cluster.go index ed12e535ab7..53930927544 100644 --- a/resource-manager/vmware/2023-03-01/cluster/id_cluster.go +++ b/resource-manager/vmware/2023-03-01/cluster/id_cluster.go @@ -38,23 +38,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ClusterId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/vmware/2023-03-01/clusters/id_cluster.go b/resource-manager/vmware/2023-03-01/clusters/id_cluster.go index f544d575acc..4b673ed8119 100644 --- a/resource-manager/vmware/2023-03-01/clusters/id_cluster.go +++ b/resource-manager/vmware/2023-03-01/clusters/id_cluster.go @@ -38,23 +38,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ClusterId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/vmware/2023-03-01/clusters/id_privatecloud.go b/resource-manager/vmware/2023-03-01/clusters/id_privatecloud.go index b430f33189b..11c6266a8b3 100644 --- a/resource-manager/vmware/2023-03-01/clusters/id_privatecloud.go +++ b/resource-manager/vmware/2023-03-01/clusters/id_privatecloud.go @@ -36,19 +36,9 @@ func ParsePrivateCloudID(input string) (*PrivateCloudId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateCloudId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePrivateCloudIDInsensitively(input string) (*PrivateCloudId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateCloudId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PrivateCloudId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - return &id, nil + return nil } // ValidatePrivateCloudID checks that 'input' can be parsed as a Private Cloud ID diff --git a/resource-manager/vmware/2023-03-01/datastores/id_cluster.go b/resource-manager/vmware/2023-03-01/datastores/id_cluster.go index bf119a81668..6a0d632dee6 100644 --- a/resource-manager/vmware/2023-03-01/datastores/id_cluster.go +++ b/resource-manager/vmware/2023-03-01/datastores/id_cluster.go @@ -38,23 +38,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ClusterId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/vmware/2023-03-01/datastores/id_datastore.go b/resource-manager/vmware/2023-03-01/datastores/id_datastore.go index c7295fb1785..b212d2e29dc 100644 --- a/resource-manager/vmware/2023-03-01/datastores/id_datastore.go +++ b/resource-manager/vmware/2023-03-01/datastores/id_datastore.go @@ -40,27 +40,9 @@ func ParseDataStoreID(input string) (*DataStoreId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataStoreId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.DataStoreName, ok = parsed.Parsed["dataStoreName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataStoreName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseDataStoreIDInsensitively(input string) (*DataStoreId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DataStoreId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DataStoreId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.DataStoreName, ok = parsed.Parsed["dataStoreName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dataStoreName", *parsed) + if id.DataStoreName, ok = input.Parsed["dataStoreName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dataStoreName", input) } - return &id, nil + return nil } // ValidateDataStoreID checks that 'input' can be parsed as a Data Store ID diff --git a/resource-manager/vmware/2023-03-01/globalreachconnections/id_globalreachconnection.go b/resource-manager/vmware/2023-03-01/globalreachconnections/id_globalreachconnection.go index e34e1c35969..b12bc4b790f 100644 --- a/resource-manager/vmware/2023-03-01/globalreachconnections/id_globalreachconnection.go +++ b/resource-manager/vmware/2023-03-01/globalreachconnections/id_globalreachconnection.go @@ -38,23 +38,9 @@ func ParseGlobalReachConnectionID(input string) (*GlobalReachConnectionId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GlobalReachConnectionId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.GlobalReachConnectionName, ok = parsed.Parsed["globalReachConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalReachConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGlobalReachConnectionIDInsensitively(input string) (*GlobalReachConnec return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GlobalReachConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GlobalReachConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.GlobalReachConnectionName, ok = parsed.Parsed["globalReachConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "globalReachConnectionName", *parsed) + if id.GlobalReachConnectionName, ok = input.Parsed["globalReachConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "globalReachConnectionName", input) } - return &id, nil + return nil } // ValidateGlobalReachConnectionID checks that 'input' can be parsed as a Global Reach Connection ID diff --git a/resource-manager/vmware/2023-03-01/globalreachconnections/id_privatecloud.go b/resource-manager/vmware/2023-03-01/globalreachconnections/id_privatecloud.go index 8ebce7ced59..a4950a1141d 100644 --- a/resource-manager/vmware/2023-03-01/globalreachconnections/id_privatecloud.go +++ b/resource-manager/vmware/2023-03-01/globalreachconnections/id_privatecloud.go @@ -36,19 +36,9 @@ func ParsePrivateCloudID(input string) (*PrivateCloudId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateCloudId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePrivateCloudIDInsensitively(input string) (*PrivateCloudId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateCloudId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PrivateCloudId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - return &id, nil + return nil } // ValidatePrivateCloudID checks that 'input' can be parsed as a Private Cloud ID diff --git a/resource-manager/vmware/2023-03-01/hcxenterprisesites/id_hcxenterprisesite.go b/resource-manager/vmware/2023-03-01/hcxenterprisesites/id_hcxenterprisesite.go index e8dda80cd5e..8048fe223c5 100644 --- a/resource-manager/vmware/2023-03-01/hcxenterprisesites/id_hcxenterprisesite.go +++ b/resource-manager/vmware/2023-03-01/hcxenterprisesites/id_hcxenterprisesite.go @@ -38,23 +38,9 @@ func ParseHcxEnterpriseSiteID(input string) (*HcxEnterpriseSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HcxEnterpriseSiteId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.HcxEnterpriseSiteName, ok = parsed.Parsed["hcxEnterpriseSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hcxEnterpriseSiteName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseHcxEnterpriseSiteIDInsensitively(input string) (*HcxEnterpriseSiteId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HcxEnterpriseSiteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *HcxEnterpriseSiteId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.HcxEnterpriseSiteName, ok = parsed.Parsed["hcxEnterpriseSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hcxEnterpriseSiteName", *parsed) + if id.HcxEnterpriseSiteName, ok = input.Parsed["hcxEnterpriseSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hcxEnterpriseSiteName", input) } - return &id, nil + return nil } // ValidateHcxEnterpriseSiteID checks that 'input' can be parsed as a Hcx Enterprise Site ID diff --git a/resource-manager/vmware/2023-03-01/hcxenterprisesites/id_privatecloud.go b/resource-manager/vmware/2023-03-01/hcxenterprisesites/id_privatecloud.go index 73304df0e78..e7b4426323d 100644 --- a/resource-manager/vmware/2023-03-01/hcxenterprisesites/id_privatecloud.go +++ b/resource-manager/vmware/2023-03-01/hcxenterprisesites/id_privatecloud.go @@ -36,19 +36,9 @@ func ParsePrivateCloudID(input string) (*PrivateCloudId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateCloudId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePrivateCloudIDInsensitively(input string) (*PrivateCloudId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateCloudId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PrivateCloudId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - return &id, nil + return nil } // ValidatePrivateCloudID checks that 'input' can be parsed as a Private Cloud ID diff --git a/resource-manager/vmware/2023-03-01/locations/id_location.go b/resource-manager/vmware/2023-03-01/locations/id_location.go index b56c56be99a..ac66ea44ca0 100644 --- a/resource-manager/vmware/2023-03-01/locations/id_location.go +++ b/resource-manager/vmware/2023-03-01/locations/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/vmware/2023-03-01/placementpolicies/id_cluster.go b/resource-manager/vmware/2023-03-01/placementpolicies/id_cluster.go index 5a3a778f021..1771f449f72 100644 --- a/resource-manager/vmware/2023-03-01/placementpolicies/id_cluster.go +++ b/resource-manager/vmware/2023-03-01/placementpolicies/id_cluster.go @@ -38,23 +38,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ClusterId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/vmware/2023-03-01/placementpolicies/id_placementpolicy.go b/resource-manager/vmware/2023-03-01/placementpolicies/id_placementpolicy.go index 8fe3ce574d3..c63e2568e0a 100644 --- a/resource-manager/vmware/2023-03-01/placementpolicies/id_placementpolicy.go +++ b/resource-manager/vmware/2023-03-01/placementpolicies/id_placementpolicy.go @@ -40,27 +40,9 @@ func ParsePlacementPolicyID(input string) (*PlacementPolicyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PlacementPolicyId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.PlacementPolicyName, ok = parsed.Parsed["placementPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "placementPolicyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParsePlacementPolicyIDInsensitively(input string) (*PlacementPolicyId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PlacementPolicyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *PlacementPolicyId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.PlacementPolicyName, ok = parsed.Parsed["placementPolicyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "placementPolicyName", *parsed) + if id.PlacementPolicyName, ok = input.Parsed["placementPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "placementPolicyName", input) } - return &id, nil + return nil } // ValidatePlacementPolicyID checks that 'input' can be parsed as a Placement Policy ID diff --git a/resource-manager/vmware/2023-03-01/placementpolicies/id_virtualmachine.go b/resource-manager/vmware/2023-03-01/placementpolicies/id_virtualmachine.go index 4a862408d2b..9853fe27cae 100644 --- a/resource-manager/vmware/2023-03-01/placementpolicies/id_virtualmachine.go +++ b/resource-manager/vmware/2023-03-01/placementpolicies/id_virtualmachine.go @@ -40,27 +40,9 @@ func ParseVirtualMachineID(input string) (*VirtualMachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.VirtualMachineId, ok = parsed.Parsed["virtualMachineId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVirtualMachineIDInsensitively(input string) (*VirtualMachineId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VirtualMachineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.VirtualMachineId, ok = parsed.Parsed["virtualMachineId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineId", *parsed) + if id.VirtualMachineId, ok = input.Parsed["virtualMachineId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineId", input) } - return &id, nil + return nil } // ValidateVirtualMachineID checks that 'input' can be parsed as a Virtual Machine ID diff --git a/resource-manager/vmware/2023-03-01/privateclouds/id_privatecloud.go b/resource-manager/vmware/2023-03-01/privateclouds/id_privatecloud.go index b2ca8fa59a5..1a5fc69da4e 100644 --- a/resource-manager/vmware/2023-03-01/privateclouds/id_privatecloud.go +++ b/resource-manager/vmware/2023-03-01/privateclouds/id_privatecloud.go @@ -36,19 +36,9 @@ func ParsePrivateCloudID(input string) (*PrivateCloudId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateCloudId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePrivateCloudIDInsensitively(input string) (*PrivateCloudId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateCloudId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PrivateCloudId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - return &id, nil + return nil } // ValidatePrivateCloudID checks that 'input' can be parsed as a Private Cloud ID diff --git a/resource-manager/vmware/2023-03-01/scripts/id_privatecloud.go b/resource-manager/vmware/2023-03-01/scripts/id_privatecloud.go index 95f25782d4e..beecc607f56 100644 --- a/resource-manager/vmware/2023-03-01/scripts/id_privatecloud.go +++ b/resource-manager/vmware/2023-03-01/scripts/id_privatecloud.go @@ -36,19 +36,9 @@ func ParsePrivateCloudID(input string) (*PrivateCloudId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateCloudId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePrivateCloudIDInsensitively(input string) (*PrivateCloudId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateCloudId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PrivateCloudId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - return &id, nil + return nil } // ValidatePrivateCloudID checks that 'input' can be parsed as a Private Cloud ID diff --git a/resource-manager/vmware/2023-03-01/scripts/id_scriptcmdlet.go b/resource-manager/vmware/2023-03-01/scripts/id_scriptcmdlet.go index ac004587db6..76b2acbb5c6 100644 --- a/resource-manager/vmware/2023-03-01/scripts/id_scriptcmdlet.go +++ b/resource-manager/vmware/2023-03-01/scripts/id_scriptcmdlet.go @@ -40,27 +40,9 @@ func ParseScriptCmdletID(input string) (*ScriptCmdletId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScriptCmdletId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.ScriptPackageName, ok = parsed.Parsed["scriptPackageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scriptPackageName", *parsed) - } - - if id.ScriptCmdletName, ok = parsed.Parsed["scriptCmdletName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scriptCmdletName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseScriptCmdletIDInsensitively(input string) (*ScriptCmdletId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScriptCmdletId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ScriptCmdletId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.ScriptPackageName, ok = parsed.Parsed["scriptPackageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scriptPackageName", *parsed) + if id.ScriptPackageName, ok = input.Parsed["scriptPackageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scriptPackageName", input) } - if id.ScriptCmdletName, ok = parsed.Parsed["scriptCmdletName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scriptCmdletName", *parsed) + if id.ScriptCmdletName, ok = input.Parsed["scriptCmdletName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scriptCmdletName", input) } - return &id, nil + return nil } // ValidateScriptCmdletID checks that 'input' can be parsed as a Script Cmdlet ID diff --git a/resource-manager/vmware/2023-03-01/scripts/id_scriptexecution.go b/resource-manager/vmware/2023-03-01/scripts/id_scriptexecution.go index 6d9f26746c1..2ecff714c19 100644 --- a/resource-manager/vmware/2023-03-01/scripts/id_scriptexecution.go +++ b/resource-manager/vmware/2023-03-01/scripts/id_scriptexecution.go @@ -38,23 +38,9 @@ func ParseScriptExecutionID(input string) (*ScriptExecutionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScriptExecutionId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.ScriptExecutionName, ok = parsed.Parsed["scriptExecutionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scriptExecutionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseScriptExecutionIDInsensitively(input string) (*ScriptExecutionId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScriptExecutionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ScriptExecutionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.ScriptExecutionName, ok = parsed.Parsed["scriptExecutionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scriptExecutionName", *parsed) + if id.ScriptExecutionName, ok = input.Parsed["scriptExecutionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scriptExecutionName", input) } - return &id, nil + return nil } // ValidateScriptExecutionID checks that 'input' can be parsed as a Script Execution ID diff --git a/resource-manager/vmware/2023-03-01/scripts/id_scriptpackage.go b/resource-manager/vmware/2023-03-01/scripts/id_scriptpackage.go index 0685c51735c..d7a6d2eb7c2 100644 --- a/resource-manager/vmware/2023-03-01/scripts/id_scriptpackage.go +++ b/resource-manager/vmware/2023-03-01/scripts/id_scriptpackage.go @@ -38,23 +38,9 @@ func ParseScriptPackageID(input string) (*ScriptPackageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScriptPackageId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.ScriptPackageName, ok = parsed.Parsed["scriptPackageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scriptPackageName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseScriptPackageIDInsensitively(input string) (*ScriptPackageId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScriptPackageId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ScriptPackageId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.ScriptPackageName, ok = parsed.Parsed["scriptPackageName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scriptPackageName", *parsed) + if id.ScriptPackageName, ok = input.Parsed["scriptPackageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scriptPackageName", input) } - return &id, nil + return nil } // ValidateScriptPackageID checks that 'input' can be parsed as a Script Package ID diff --git a/resource-manager/vmware/2023-03-01/virtualmachines/id_cluster.go b/resource-manager/vmware/2023-03-01/virtualmachines/id_cluster.go index 3ad722e1d46..b6c6c6e83f9 100644 --- a/resource-manager/vmware/2023-03-01/virtualmachines/id_cluster.go +++ b/resource-manager/vmware/2023-03-01/virtualmachines/id_cluster.go @@ -38,23 +38,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ClusterId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/vmware/2023-03-01/virtualmachines/id_virtualmachine.go b/resource-manager/vmware/2023-03-01/virtualmachines/id_virtualmachine.go index 7c78439c749..200a101a145 100644 --- a/resource-manager/vmware/2023-03-01/virtualmachines/id_virtualmachine.go +++ b/resource-manager/vmware/2023-03-01/virtualmachines/id_virtualmachine.go @@ -40,27 +40,9 @@ func ParseVirtualMachineID(input string) (*VirtualMachineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) - } - - if id.VirtualMachineId, ok = parsed.Parsed["virtualMachineId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVirtualMachineIDInsensitively(input string) (*VirtualMachineId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VirtualMachineId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - if id.VirtualMachineId, ok = parsed.Parsed["virtualMachineId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineId", *parsed) + if id.VirtualMachineId, ok = input.Parsed["virtualMachineId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineId", input) } - return &id, nil + return nil } // ValidateVirtualMachineID checks that 'input' can be parsed as a Virtual Machine ID diff --git a/resource-manager/vmware/2023-03-01/workloadnetworks/id_defaultvirtualmachine.go b/resource-manager/vmware/2023-03-01/workloadnetworks/id_defaultvirtualmachine.go index c6f6391ff15..f1750e22636 100644 --- a/resource-manager/vmware/2023-03-01/workloadnetworks/id_defaultvirtualmachine.go +++ b/resource-manager/vmware/2023-03-01/workloadnetworks/id_defaultvirtualmachine.go @@ -38,23 +38,9 @@ func ParseDefaultVirtualMachineID(input string) (*DefaultVirtualMachineId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DefaultVirtualMachineId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.VirtualMachineId, ok = parsed.Parsed["virtualMachineId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDefaultVirtualMachineIDInsensitively(input string) (*DefaultVirtualMac return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DefaultVirtualMachineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DefaultVirtualMachineId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.VirtualMachineId, ok = parsed.Parsed["virtualMachineId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineId", *parsed) + if id.VirtualMachineId, ok = input.Parsed["virtualMachineId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineId", input) } - return &id, nil + return nil } // ValidateDefaultVirtualMachineID checks that 'input' can be parsed as a Default Virtual Machine ID diff --git a/resource-manager/vmware/2023-03-01/workloadnetworks/id_dhcpconfiguration.go b/resource-manager/vmware/2023-03-01/workloadnetworks/id_dhcpconfiguration.go index 7907fc1cab6..e663f166b71 100644 --- a/resource-manager/vmware/2023-03-01/workloadnetworks/id_dhcpconfiguration.go +++ b/resource-manager/vmware/2023-03-01/workloadnetworks/id_dhcpconfiguration.go @@ -38,23 +38,9 @@ func ParseDhcpConfigurationID(input string) (*DhcpConfigurationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DhcpConfigurationId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.DhcpId, ok = parsed.Parsed["dhcpId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dhcpId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDhcpConfigurationIDInsensitively(input string) (*DhcpConfigurationId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DhcpConfigurationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DhcpConfigurationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.DhcpId, ok = parsed.Parsed["dhcpId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dhcpId", *parsed) + if id.DhcpId, ok = input.Parsed["dhcpId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dhcpId", input) } - return &id, nil + return nil } // ValidateDhcpConfigurationID checks that 'input' can be parsed as a Dhcp Configuration ID diff --git a/resource-manager/vmware/2023-03-01/workloadnetworks/id_dnsservice.go b/resource-manager/vmware/2023-03-01/workloadnetworks/id_dnsservice.go index e929920036b..335e5f870a6 100644 --- a/resource-manager/vmware/2023-03-01/workloadnetworks/id_dnsservice.go +++ b/resource-manager/vmware/2023-03-01/workloadnetworks/id_dnsservice.go @@ -38,23 +38,9 @@ func ParseDnsServiceID(input string) (*DnsServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DnsServiceId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.DnsServiceId, ok = parsed.Parsed["dnsServiceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dnsServiceId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDnsServiceIDInsensitively(input string) (*DnsServiceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DnsServiceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DnsServiceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.DnsServiceId, ok = parsed.Parsed["dnsServiceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dnsServiceId", *parsed) + if id.DnsServiceId, ok = input.Parsed["dnsServiceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dnsServiceId", input) } - return &id, nil + return nil } // ValidateDnsServiceID checks that 'input' can be parsed as a Dns Service ID diff --git a/resource-manager/vmware/2023-03-01/workloadnetworks/id_dnszone.go b/resource-manager/vmware/2023-03-01/workloadnetworks/id_dnszone.go index b720c1e9d01..363e26d60a6 100644 --- a/resource-manager/vmware/2023-03-01/workloadnetworks/id_dnszone.go +++ b/resource-manager/vmware/2023-03-01/workloadnetworks/id_dnszone.go @@ -38,23 +38,9 @@ func ParseDnsZoneID(input string) (*DnsZoneId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DnsZoneId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.DnsZoneId, ok = parsed.Parsed["dnsZoneId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dnsZoneId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDnsZoneIDInsensitively(input string) (*DnsZoneId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool 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 = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.DnsZoneId, ok = parsed.Parsed["dnsZoneId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "dnsZoneId", *parsed) + if id.DnsZoneId, ok = input.Parsed["dnsZoneId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "dnsZoneId", input) } - return &id, nil + return nil } // ValidateDnsZoneID checks that 'input' can be parsed as a Dns Zone ID diff --git a/resource-manager/vmware/2023-03-01/workloadnetworks/id_gateway.go b/resource-manager/vmware/2023-03-01/workloadnetworks/id_gateway.go index 47b53dc1a85..9f624d9710f 100644 --- a/resource-manager/vmware/2023-03-01/workloadnetworks/id_gateway.go +++ b/resource-manager/vmware/2023-03-01/workloadnetworks/id_gateway.go @@ -38,23 +38,9 @@ func ParseGatewayID(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseGatewayIDInsensitively(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *GatewayId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if id.GatewayId, ok = input.Parsed["gatewayId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", input) } - return &id, nil + return nil } // ValidateGatewayID checks that 'input' can be parsed as a Gateway ID diff --git a/resource-manager/vmware/2023-03-01/workloadnetworks/id_portmirroringprofile.go b/resource-manager/vmware/2023-03-01/workloadnetworks/id_portmirroringprofile.go index 9a4538d526e..6754548863f 100644 --- a/resource-manager/vmware/2023-03-01/workloadnetworks/id_portmirroringprofile.go +++ b/resource-manager/vmware/2023-03-01/workloadnetworks/id_portmirroringprofile.go @@ -38,23 +38,9 @@ func ParsePortMirroringProfileID(input string) (*PortMirroringProfileId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PortMirroringProfileId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.PortMirroringId, ok = parsed.Parsed["portMirroringId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "portMirroringId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePortMirroringProfileIDInsensitively(input string) (*PortMirroringProfi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PortMirroringProfileId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PortMirroringProfileId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.PortMirroringId, ok = parsed.Parsed["portMirroringId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "portMirroringId", *parsed) + if id.PortMirroringId, ok = input.Parsed["portMirroringId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "portMirroringId", input) } - return &id, nil + return nil } // ValidatePortMirroringProfileID checks that 'input' can be parsed as a Port Mirroring Profile ID diff --git a/resource-manager/vmware/2023-03-01/workloadnetworks/id_privatecloud.go b/resource-manager/vmware/2023-03-01/workloadnetworks/id_privatecloud.go index de706d2f121..9c3586a6b61 100644 --- a/resource-manager/vmware/2023-03-01/workloadnetworks/id_privatecloud.go +++ b/resource-manager/vmware/2023-03-01/workloadnetworks/id_privatecloud.go @@ -36,19 +36,9 @@ func ParsePrivateCloudID(input string) (*PrivateCloudId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateCloudId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParsePrivateCloudIDInsensitively(input string) (*PrivateCloudId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateCloudId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *PrivateCloudId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - return &id, nil + return nil } // ValidatePrivateCloudID checks that 'input' can be parsed as a Private Cloud ID diff --git a/resource-manager/vmware/2023-03-01/workloadnetworks/id_publicip.go b/resource-manager/vmware/2023-03-01/workloadnetworks/id_publicip.go index 4b2326c182e..272ea96412a 100644 --- a/resource-manager/vmware/2023-03-01/workloadnetworks/id_publicip.go +++ b/resource-manager/vmware/2023-03-01/workloadnetworks/id_publicip.go @@ -38,23 +38,9 @@ func ParsePublicIPID(input string) (*PublicIPId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PublicIPId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.PublicIPId, ok = parsed.Parsed["publicIPId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publicIPId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePublicIPIDInsensitively(input string) (*PublicIPId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PublicIPId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PublicIPId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.PublicIPId, ok = parsed.Parsed["publicIPId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publicIPId", *parsed) + if id.PublicIPId, ok = input.Parsed["publicIPId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publicIPId", input) } - return &id, nil + return nil } // ValidatePublicIPID checks that 'input' can be parsed as a Public I P ID diff --git a/resource-manager/vmware/2023-03-01/workloadnetworks/id_segment.go b/resource-manager/vmware/2023-03-01/workloadnetworks/id_segment.go index 158bdfda4e8..0f890f244f8 100644 --- a/resource-manager/vmware/2023-03-01/workloadnetworks/id_segment.go +++ b/resource-manager/vmware/2023-03-01/workloadnetworks/id_segment.go @@ -38,23 +38,9 @@ func ParseSegmentID(input string) (*SegmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SegmentId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.SegmentId, ok = parsed.Parsed["segmentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "segmentId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSegmentIDInsensitively(input string) (*SegmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SegmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SegmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.SegmentId, ok = parsed.Parsed["segmentId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "segmentId", *parsed) + if id.SegmentId, ok = input.Parsed["segmentId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "segmentId", input) } - return &id, nil + return nil } // ValidateSegmentID checks that 'input' can be parsed as a Segment ID diff --git a/resource-manager/vmware/2023-03-01/workloadnetworks/id_vmgroup.go b/resource-manager/vmware/2023-03-01/workloadnetworks/id_vmgroup.go index 3e091bf0a9f..b3cce8064e2 100644 --- a/resource-manager/vmware/2023-03-01/workloadnetworks/id_vmgroup.go +++ b/resource-manager/vmware/2023-03-01/workloadnetworks/id_vmgroup.go @@ -38,23 +38,9 @@ func ParseVMGroupID(input string) (*VMGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VMGroupId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.VmGroupId, ok = parsed.Parsed["vmGroupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vmGroupId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVMGroupIDInsensitively(input string) (*VMGroupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VMGroupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VMGroupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.VmGroupId, ok = parsed.Parsed["vmGroupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vmGroupId", *parsed) + if id.VmGroupId, ok = input.Parsed["vmGroupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vmGroupId", input) } - return &id, nil + return nil } // ValidateVMGroupID checks that 'input' can be parsed as a V M Group ID diff --git a/resource-manager/vmware/2023-03-01/zone/id_cluster.go b/resource-manager/vmware/2023-03-01/zone/id_cluster.go index 610baf0f431..89018490a1b 100644 --- a/resource-manager/vmware/2023-03-01/zone/id_cluster.go +++ b/resource-manager/vmware/2023-03-01/zone/id_cluster.go @@ -38,23 +38,9 @@ func ParseClusterID(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} - - 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.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) - } - - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseClusterIDInsensitively(input string) (*ClusterId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ClusterId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ClusterId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.PrivateCloudName, ok = parsed.Parsed["privateCloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", *parsed) + if id.PrivateCloudName, ok = input.Parsed["privateCloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateCloudName", input) } - if id.ClusterName, ok = parsed.Parsed["clusterName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "clusterName", *parsed) + if id.ClusterName, ok = input.Parsed["clusterName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "clusterName", input) } - return &id, nil + return nil } // ValidateClusterID checks that 'input' can be parsed as a Cluster ID diff --git a/resource-manager/voiceservices/2023-04-03/communicationsgateways/id_communicationsgateway.go b/resource-manager/voiceservices/2023-04-03/communicationsgateways/id_communicationsgateway.go index 38a7701c0cc..f98e2c39d24 100644 --- a/resource-manager/voiceservices/2023-04-03/communicationsgateways/id_communicationsgateway.go +++ b/resource-manager/voiceservices/2023-04-03/communicationsgateways/id_communicationsgateway.go @@ -36,19 +36,9 @@ func ParseCommunicationsGatewayID(input string) (*CommunicationsGatewayId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommunicationsGatewayId{} - - 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.CommunicationsGatewayName, ok = parsed.Parsed["communicationsGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "communicationsGatewayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseCommunicationsGatewayIDInsensitively(input string) (*CommunicationsGat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommunicationsGatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CommunicationsGatewayId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CommunicationsGatewayName, ok = parsed.Parsed["communicationsGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "communicationsGatewayName", *parsed) + if id.CommunicationsGatewayName, ok = input.Parsed["communicationsGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "communicationsGatewayName", input) } - return &id, nil + return nil } // ValidateCommunicationsGatewayID checks that 'input' can be parsed as a Communications Gateway ID diff --git a/resource-manager/voiceservices/2023-04-03/testlines/id_communicationsgateway.go b/resource-manager/voiceservices/2023-04-03/testlines/id_communicationsgateway.go index 8bd5ef1d8da..45f0df7f2a6 100644 --- a/resource-manager/voiceservices/2023-04-03/testlines/id_communicationsgateway.go +++ b/resource-manager/voiceservices/2023-04-03/testlines/id_communicationsgateway.go @@ -36,19 +36,9 @@ func ParseCommunicationsGatewayID(input string) (*CommunicationsGatewayId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommunicationsGatewayId{} - - 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.CommunicationsGatewayName, ok = parsed.Parsed["communicationsGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "communicationsGatewayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseCommunicationsGatewayIDInsensitively(input string) (*CommunicationsGat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommunicationsGatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CommunicationsGatewayId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CommunicationsGatewayName, ok = parsed.Parsed["communicationsGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "communicationsGatewayName", *parsed) + if id.CommunicationsGatewayName, ok = input.Parsed["communicationsGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "communicationsGatewayName", input) } - return &id, nil + return nil } // ValidateCommunicationsGatewayID checks that 'input' can be parsed as a Communications Gateway ID diff --git a/resource-manager/voiceservices/2023-04-03/testlines/id_testline.go b/resource-manager/voiceservices/2023-04-03/testlines/id_testline.go index 17bf51b3747..2298ed133bb 100644 --- a/resource-manager/voiceservices/2023-04-03/testlines/id_testline.go +++ b/resource-manager/voiceservices/2023-04-03/testlines/id_testline.go @@ -38,23 +38,9 @@ func ParseTestLineID(input string) (*TestLineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TestLineId{} - - 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.CommunicationsGatewayName, ok = parsed.Parsed["communicationsGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "communicationsGatewayName", *parsed) - } - - if id.TestLineName, ok = parsed.Parsed["testLineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "testLineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTestLineIDInsensitively(input string) (*TestLineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TestLineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TestLineId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CommunicationsGatewayName, ok = parsed.Parsed["communicationsGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "communicationsGatewayName", *parsed) + if id.CommunicationsGatewayName, ok = input.Parsed["communicationsGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "communicationsGatewayName", input) } - if id.TestLineName, ok = parsed.Parsed["testLineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "testLineName", *parsed) + if id.TestLineName, ok = input.Parsed["testLineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "testLineName", input) } - return &id, nil + return nil } // ValidateTestLineID checks that 'input' can be parsed as a Test Line ID diff --git a/resource-manager/voiceservices/2023-04-03/voiceservices/id_location.go b/resource-manager/voiceservices/2023-04-03/voiceservices/id_location.go index 7c9473dbaf2..7e846371743 100644 --- a/resource-manager/voiceservices/2023-04-03/voiceservices/id_location.go +++ b/resource-manager/voiceservices/2023-04-03/voiceservices/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/voiceservices/2023-09-01/communicationsgateways/id_communicationsgateway.go b/resource-manager/voiceservices/2023-09-01/communicationsgateways/id_communicationsgateway.go index 38a7701c0cc..f98e2c39d24 100644 --- a/resource-manager/voiceservices/2023-09-01/communicationsgateways/id_communicationsgateway.go +++ b/resource-manager/voiceservices/2023-09-01/communicationsgateways/id_communicationsgateway.go @@ -36,19 +36,9 @@ func ParseCommunicationsGatewayID(input string) (*CommunicationsGatewayId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommunicationsGatewayId{} - - 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.CommunicationsGatewayName, ok = parsed.Parsed["communicationsGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "communicationsGatewayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseCommunicationsGatewayIDInsensitively(input string) (*CommunicationsGat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommunicationsGatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CommunicationsGatewayId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CommunicationsGatewayName, ok = parsed.Parsed["communicationsGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "communicationsGatewayName", *parsed) + if id.CommunicationsGatewayName, ok = input.Parsed["communicationsGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "communicationsGatewayName", input) } - return &id, nil + return nil } // ValidateCommunicationsGatewayID checks that 'input' can be parsed as a Communications Gateway ID diff --git a/resource-manager/voiceservices/2023-09-01/testlines/id_communicationsgateway.go b/resource-manager/voiceservices/2023-09-01/testlines/id_communicationsgateway.go index 8bd5ef1d8da..45f0df7f2a6 100644 --- a/resource-manager/voiceservices/2023-09-01/testlines/id_communicationsgateway.go +++ b/resource-manager/voiceservices/2023-09-01/testlines/id_communicationsgateway.go @@ -36,19 +36,9 @@ func ParseCommunicationsGatewayID(input string) (*CommunicationsGatewayId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommunicationsGatewayId{} - - 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.CommunicationsGatewayName, ok = parsed.Parsed["communicationsGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "communicationsGatewayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseCommunicationsGatewayIDInsensitively(input string) (*CommunicationsGat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CommunicationsGatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CommunicationsGatewayId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CommunicationsGatewayName, ok = parsed.Parsed["communicationsGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "communicationsGatewayName", *parsed) + if id.CommunicationsGatewayName, ok = input.Parsed["communicationsGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "communicationsGatewayName", input) } - return &id, nil + return nil } // ValidateCommunicationsGatewayID checks that 'input' can be parsed as a Communications Gateway ID diff --git a/resource-manager/voiceservices/2023-09-01/testlines/id_testline.go b/resource-manager/voiceservices/2023-09-01/testlines/id_testline.go index 17bf51b3747..2298ed133bb 100644 --- a/resource-manager/voiceservices/2023-09-01/testlines/id_testline.go +++ b/resource-manager/voiceservices/2023-09-01/testlines/id_testline.go @@ -38,23 +38,9 @@ func ParseTestLineID(input string) (*TestLineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TestLineId{} - - 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.CommunicationsGatewayName, ok = parsed.Parsed["communicationsGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "communicationsGatewayName", *parsed) - } - - if id.TestLineName, ok = parsed.Parsed["testLineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "testLineName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTestLineIDInsensitively(input string) (*TestLineId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TestLineId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TestLineId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CommunicationsGatewayName, ok = parsed.Parsed["communicationsGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "communicationsGatewayName", *parsed) + if id.CommunicationsGatewayName, ok = input.Parsed["communicationsGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "communicationsGatewayName", input) } - if id.TestLineName, ok = parsed.Parsed["testLineName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "testLineName", *parsed) + if id.TestLineName, ok = input.Parsed["testLineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "testLineName", input) } - return &id, nil + return nil } // ValidateTestLineID checks that 'input' can be parsed as a Test Line ID diff --git a/resource-manager/voiceservices/2023-09-01/voiceservices/id_location.go b/resource-manager/voiceservices/2023-09-01/voiceservices/id_location.go index 7c9473dbaf2..7e846371743 100644 --- a/resource-manager/voiceservices/2023-09-01/voiceservices/id_location.go +++ b/resource-manager/voiceservices/2023-09-01/voiceservices/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/web/2016-06-01/connectiongateways/id_connectiongateway.go b/resource-manager/web/2016-06-01/connectiongateways/id_connectiongateway.go index b684bf96e1b..253bffc1678 100644 --- a/resource-manager/web/2016-06-01/connectiongateways/id_connectiongateway.go +++ b/resource-manager/web/2016-06-01/connectiongateways/id_connectiongateway.go @@ -36,19 +36,9 @@ func ParseConnectionGatewayID(input string) (*ConnectionGatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionGatewayId{} - - 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.ConnectionGatewayName, ok = parsed.Parsed["connectionGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionGatewayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseConnectionGatewayIDInsensitively(input string) (*ConnectionGatewayId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionGatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ConnectionGatewayId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ConnectionGatewayName, ok = parsed.Parsed["connectionGatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionGatewayName", *parsed) + if id.ConnectionGatewayName, ok = input.Parsed["connectionGatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectionGatewayName", input) } - return &id, nil + return nil } // ValidateConnectionGatewayID checks that 'input' can be parsed as a Connection Gateway ID diff --git a/resource-manager/web/2016-06-01/connectiongateways/id_connectiongatewayinstallation.go b/resource-manager/web/2016-06-01/connectiongateways/id_connectiongatewayinstallation.go index b7dfe0cc391..eab62b3a86b 100644 --- a/resource-manager/web/2016-06-01/connectiongateways/id_connectiongatewayinstallation.go +++ b/resource-manager/web/2016-06-01/connectiongateways/id_connectiongatewayinstallation.go @@ -36,19 +36,9 @@ func ParseConnectionGatewayInstallationID(input string) (*ConnectionGatewayInsta return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionGatewayInstallationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseConnectionGatewayInstallationIDInsensitively(input string) (*Connectio return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionGatewayInstallationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ConnectionGatewayInstallationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.GatewayId, ok = parsed.Parsed["gatewayId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", *parsed) + if id.GatewayId, ok = input.Parsed["gatewayId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayId", input) } - return &id, nil + return nil } // ValidateConnectionGatewayInstallationID checks that 'input' can be parsed as a Connection Gateway Installation ID diff --git a/resource-manager/web/2016-06-01/connectiongateways/id_location.go b/resource-manager/web/2016-06-01/connectiongateways/id_location.go index e377ba1e3ff..de5cb8b32aa 100644 --- a/resource-manager/web/2016-06-01/connectiongateways/id_location.go +++ b/resource-manager/web/2016-06-01/connectiongateways/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/web/2016-06-01/connections/id_connection.go b/resource-manager/web/2016-06-01/connections/id_connection.go index baaa3e966e4..19e7527bdb0 100644 --- a/resource-manager/web/2016-06-01/connections/id_connection.go +++ b/resource-manager/web/2016-06-01/connections/id_connection.go @@ -36,19 +36,9 @@ func ParseConnectionID(input string) (*ConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionId{} - - 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.ConnectionName, ok = parsed.Parsed["connectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseConnectionIDInsensitively(input string) (*ConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ConnectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ConnectionName, ok = parsed.Parsed["connectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionName", *parsed) + if id.ConnectionName, ok = input.Parsed["connectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectionName", input) } - return &id, nil + return nil } // ValidateConnectionID checks that 'input' can be parsed as a Connection ID diff --git a/resource-manager/web/2016-06-01/customapis/id_customapi.go b/resource-manager/web/2016-06-01/customapis/id_customapi.go index 135bfda4f5b..b110a856f2f 100644 --- a/resource-manager/web/2016-06-01/customapis/id_customapi.go +++ b/resource-manager/web/2016-06-01/customapis/id_customapi.go @@ -36,19 +36,9 @@ func ParseCustomApiID(input string) (*CustomApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CustomApiId{} - - 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.CustomApiName, ok = parsed.Parsed["customApiName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "customApiName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseCustomApiIDInsensitively(input string) (*CustomApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CustomApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CustomApiId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CustomApiName, ok = parsed.Parsed["customApiName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "customApiName", *parsed) + if id.CustomApiName, ok = input.Parsed["customApiName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "customApiName", input) } - return &id, nil + return nil } // ValidateCustomApiID checks that 'input' can be parsed as a Custom Api ID diff --git a/resource-manager/web/2016-06-01/customapis/id_location.go b/resource-manager/web/2016-06-01/customapis/id_location.go index 8eea8c52a01..99cdc64beee 100644 --- a/resource-manager/web/2016-06-01/customapis/id_location.go +++ b/resource-manager/web/2016-06-01/customapis/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/web/2016-06-01/managedapis/id_location.go b/resource-manager/web/2016-06-01/managedapis/id_location.go index 929a70b6bf4..87a6b1244ce 100644 --- a/resource-manager/web/2016-06-01/managedapis/id_location.go +++ b/resource-manager/web/2016-06-01/managedapis/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/web/2016-06-01/managedapis/id_managedapi.go b/resource-manager/web/2016-06-01/managedapis/id_managedapi.go index 5391fbfe8c6..ff0124a2279 100644 --- a/resource-manager/web/2016-06-01/managedapis/id_managedapi.go +++ b/resource-manager/web/2016-06-01/managedapis/id_managedapi.go @@ -36,19 +36,9 @@ func ParseManagedApiID(input string) (*ManagedApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedApiId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.ManagedApiName, ok = parsed.Parsed["managedApiName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedApiName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseManagedApiIDInsensitively(input string) (*ManagedApiId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagedApiId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ManagedApiId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.ManagedApiName, ok = parsed.Parsed["managedApiName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "managedApiName", *parsed) + if id.ManagedApiName, ok = input.Parsed["managedApiName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "managedApiName", input) } - return &id, nil + return nil } // ValidateManagedApiID checks that 'input' can be parsed as a Managed Api ID diff --git a/resource-manager/web/2022-09-01/appservicecertificateorders/id_certificate.go b/resource-manager/web/2022-09-01/appservicecertificateorders/id_certificate.go index 98f3f9f07a8..4dd5a3a53b4 100644 --- a/resource-manager/web/2022-09-01/appservicecertificateorders/id_certificate.go +++ b/resource-manager/web/2022-09-01/appservicecertificateorders/id_certificate.go @@ -38,23 +38,9 @@ func ParseCertificateID(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} - - 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.CertificateOrderName, ok = parsed.Parsed["certificateOrderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateOrderName", *parsed) - } - - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCertificateIDInsensitively(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CertificateOrderName, ok = parsed.Parsed["certificateOrderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateOrderName", *parsed) + if id.CertificateOrderName, ok = input.Parsed["certificateOrderName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateOrderName", input) } - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if id.CertificateName, ok = input.Parsed["certificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateName", input) } - return &id, nil + return nil } // ValidateCertificateID checks that 'input' can be parsed as a Certificate ID diff --git a/resource-manager/web/2022-09-01/appservicecertificateorders/id_certificateorder.go b/resource-manager/web/2022-09-01/appservicecertificateorders/id_certificateorder.go index 1ace34f72b6..b35ea8326dd 100644 --- a/resource-manager/web/2022-09-01/appservicecertificateorders/id_certificateorder.go +++ b/resource-manager/web/2022-09-01/appservicecertificateorders/id_certificateorder.go @@ -36,19 +36,9 @@ func ParseCertificateOrderID(input string) (*CertificateOrderId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateOrderId{} - - 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.CertificateOrderName, ok = parsed.Parsed["certificateOrderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateOrderName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseCertificateOrderIDInsensitively(input string) (*CertificateOrderId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateOrderId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CertificateOrderId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CertificateOrderName, ok = parsed.Parsed["certificateOrderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateOrderName", *parsed) + if id.CertificateOrderName, ok = input.Parsed["certificateOrderName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateOrderName", input) } - return &id, nil + return nil } // ValidateCertificateOrderID checks that 'input' can be parsed as a Certificate Order ID diff --git a/resource-manager/web/2022-09-01/appserviceenvironments/id_defaultinstance.go b/resource-manager/web/2022-09-01/appserviceenvironments/id_defaultinstance.go index 3b45c4669ee..3082830caa7 100644 --- a/resource-manager/web/2022-09-01/appserviceenvironments/id_defaultinstance.go +++ b/resource-manager/web/2022-09-01/appserviceenvironments/id_defaultinstance.go @@ -38,23 +38,9 @@ func ParseDefaultInstanceID(input string) (*DefaultInstanceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DefaultInstanceId{} - - 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.HostingEnvironmentName, ok = parsed.Parsed["hostingEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostingEnvironmentName", *parsed) - } - - if id.InstanceName, ok = parsed.Parsed["instanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDefaultInstanceIDInsensitively(input string) (*DefaultInstanceId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DefaultInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DefaultInstanceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostingEnvironmentName, ok = parsed.Parsed["hostingEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostingEnvironmentName", *parsed) + if id.HostingEnvironmentName, ok = input.Parsed["hostingEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostingEnvironmentName", input) } - if id.InstanceName, ok = parsed.Parsed["instanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceName", *parsed) + if id.InstanceName, ok = input.Parsed["instanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceName", input) } - return &id, nil + return nil } // ValidateDefaultInstanceID checks that 'input' can be parsed as a Default Instance ID diff --git a/resource-manager/web/2022-09-01/appserviceenvironments/id_hostingenvironmentdiagnostic.go b/resource-manager/web/2022-09-01/appserviceenvironments/id_hostingenvironmentdiagnostic.go index 526df4365ad..812ab39d5c8 100644 --- a/resource-manager/web/2022-09-01/appserviceenvironments/id_hostingenvironmentdiagnostic.go +++ b/resource-manager/web/2022-09-01/appserviceenvironments/id_hostingenvironmentdiagnostic.go @@ -38,23 +38,9 @@ func ParseHostingEnvironmentDiagnosticID(input string) (*HostingEnvironmentDiagn return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostingEnvironmentDiagnosticId{} - - 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.HostingEnvironmentName, ok = parsed.Parsed["hostingEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostingEnvironmentName", *parsed) - } - - if id.DiagnosticName, ok = parsed.Parsed["diagnosticName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseHostingEnvironmentDiagnosticIDInsensitively(input string) (*HostingEnv return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostingEnvironmentDiagnosticId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *HostingEnvironmentDiagnosticId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostingEnvironmentName, ok = parsed.Parsed["hostingEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostingEnvironmentName", *parsed) + if id.HostingEnvironmentName, ok = input.Parsed["hostingEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostingEnvironmentName", input) } - if id.DiagnosticName, ok = parsed.Parsed["diagnosticName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticName", *parsed) + if id.DiagnosticName, ok = input.Parsed["diagnosticName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "diagnosticName", input) } - return &id, nil + return nil } // ValidateHostingEnvironmentDiagnosticID checks that 'input' can be parsed as a Hosting Environment Diagnostic ID diff --git a/resource-manager/web/2022-09-01/appserviceenvironments/id_hostingenvironmentprivateendpointconnection.go b/resource-manager/web/2022-09-01/appserviceenvironments/id_hostingenvironmentprivateendpointconnection.go index a21c5d4bdac..b020f793590 100644 --- a/resource-manager/web/2022-09-01/appserviceenvironments/id_hostingenvironmentprivateendpointconnection.go +++ b/resource-manager/web/2022-09-01/appserviceenvironments/id_hostingenvironmentprivateendpointconnection.go @@ -38,23 +38,9 @@ func ParseHostingEnvironmentPrivateEndpointConnectionID(input string) (*HostingE return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostingEnvironmentPrivateEndpointConnectionId{} - - 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.HostingEnvironmentName, ok = parsed.Parsed["hostingEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostingEnvironmentName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseHostingEnvironmentPrivateEndpointConnectionIDInsensitively(input strin return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostingEnvironmentPrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *HostingEnvironmentPrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostingEnvironmentName, ok = parsed.Parsed["hostingEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostingEnvironmentName", *parsed) + if id.HostingEnvironmentName, ok = input.Parsed["hostingEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostingEnvironmentName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidateHostingEnvironmentPrivateEndpointConnectionID checks that 'input' can be parsed as a Hosting Environment Private Endpoint Connection ID diff --git a/resource-manager/web/2022-09-01/appserviceenvironments/id_workerpool.go b/resource-manager/web/2022-09-01/appserviceenvironments/id_workerpool.go index 5683fe5ddc5..00002ea09ab 100644 --- a/resource-manager/web/2022-09-01/appserviceenvironments/id_workerpool.go +++ b/resource-manager/web/2022-09-01/appserviceenvironments/id_workerpool.go @@ -38,23 +38,9 @@ func ParseWorkerPoolID(input string) (*WorkerPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkerPoolId{} - - 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.HostingEnvironmentName, ok = parsed.Parsed["hostingEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostingEnvironmentName", *parsed) - } - - if id.WorkerPoolName, ok = parsed.Parsed["workerPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workerPoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWorkerPoolIDInsensitively(input string) (*WorkerPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkerPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WorkerPoolId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostingEnvironmentName, ok = parsed.Parsed["hostingEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostingEnvironmentName", *parsed) + if id.HostingEnvironmentName, ok = input.Parsed["hostingEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostingEnvironmentName", input) } - if id.WorkerPoolName, ok = parsed.Parsed["workerPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workerPoolName", *parsed) + if id.WorkerPoolName, ok = input.Parsed["workerPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workerPoolName", input) } - return &id, nil + return nil } // ValidateWorkerPoolID checks that 'input' can be parsed as a Worker Pool ID diff --git a/resource-manager/web/2022-09-01/appserviceenvironments/id_workerpoolinstance.go b/resource-manager/web/2022-09-01/appserviceenvironments/id_workerpoolinstance.go index a1d6ec24d1f..d15caa57595 100644 --- a/resource-manager/web/2022-09-01/appserviceenvironments/id_workerpoolinstance.go +++ b/resource-manager/web/2022-09-01/appserviceenvironments/id_workerpoolinstance.go @@ -40,27 +40,9 @@ func ParseWorkerPoolInstanceID(input string) (*WorkerPoolInstanceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkerPoolInstanceId{} - - 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.HostingEnvironmentName, ok = parsed.Parsed["hostingEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostingEnvironmentName", *parsed) - } - - if id.WorkerPoolName, ok = parsed.Parsed["workerPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workerPoolName", *parsed) - } - - if id.InstanceName, ok = parsed.Parsed["instanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseWorkerPoolInstanceIDInsensitively(input string) (*WorkerPoolInstanceId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkerPoolInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *WorkerPoolInstanceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostingEnvironmentName, ok = parsed.Parsed["hostingEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostingEnvironmentName", *parsed) + if id.HostingEnvironmentName, ok = input.Parsed["hostingEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostingEnvironmentName", input) } - if id.WorkerPoolName, ok = parsed.Parsed["workerPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workerPoolName", *parsed) + if id.WorkerPoolName, ok = input.Parsed["workerPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workerPoolName", input) } - if id.InstanceName, ok = parsed.Parsed["instanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceName", *parsed) + if id.InstanceName, ok = input.Parsed["instanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceName", input) } - return &id, nil + return nil } // ValidateWorkerPoolInstanceID checks that 'input' can be parsed as a Worker Pool Instance ID diff --git a/resource-manager/web/2022-09-01/appserviceplans/id_hybridconnectionnamespacerelay.go b/resource-manager/web/2022-09-01/appserviceplans/id_hybridconnectionnamespacerelay.go index 8fe7fb2a001..03767290c2d 100644 --- a/resource-manager/web/2022-09-01/appserviceplans/id_hybridconnectionnamespacerelay.go +++ b/resource-manager/web/2022-09-01/appserviceplans/id_hybridconnectionnamespacerelay.go @@ -40,27 +40,9 @@ func ParseHybridConnectionNamespaceRelayID(input string) (*HybridConnectionNames return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HybridConnectionNamespaceRelayId{} - - 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.ServerFarmName, ok = parsed.Parsed["serverFarmName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverFarmName", *parsed) - } - - if id.HybridConnectionNamespaceName, ok = parsed.Parsed["hybridConnectionNamespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridConnectionNamespaceName", *parsed) - } - - if id.RelayName, ok = parsed.Parsed["relayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "relayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseHybridConnectionNamespaceRelayIDInsensitively(input string) (*HybridCo return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HybridConnectionNamespaceRelayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *HybridConnectionNamespaceRelayId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerFarmName, ok = parsed.Parsed["serverFarmName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverFarmName", *parsed) + if id.ServerFarmName, ok = input.Parsed["serverFarmName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverFarmName", input) } - if id.HybridConnectionNamespaceName, ok = parsed.Parsed["hybridConnectionNamespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridConnectionNamespaceName", *parsed) + if id.HybridConnectionNamespaceName, ok = input.Parsed["hybridConnectionNamespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hybridConnectionNamespaceName", input) } - if id.RelayName, ok = parsed.Parsed["relayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "relayName", *parsed) + if id.RelayName, ok = input.Parsed["relayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "relayName", input) } - return &id, nil + return nil } // ValidateHybridConnectionNamespaceRelayID checks that 'input' can be parsed as a Hybrid Connection Namespace Relay ID diff --git a/resource-manager/web/2022-09-01/appserviceplans/id_route.go b/resource-manager/web/2022-09-01/appserviceplans/id_route.go index 77e22b1dc59..824335dce67 100644 --- a/resource-manager/web/2022-09-01/appserviceplans/id_route.go +++ b/resource-manager/web/2022-09-01/appserviceplans/id_route.go @@ -40,27 +40,9 @@ func ParseRouteID(input string) (*RouteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteId{} - - 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.ServerFarmName, ok = parsed.Parsed["serverFarmName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverFarmName", *parsed) - } - - if id.VirtualNetworkConnectionName, ok = parsed.Parsed["virtualNetworkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkConnectionName", *parsed) - } - - if id.RouteName, ok = parsed.Parsed["routeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseRouteIDInsensitively(input string) (*RouteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RouteId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerFarmName, ok = parsed.Parsed["serverFarmName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverFarmName", *parsed) + if id.ServerFarmName, ok = input.Parsed["serverFarmName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverFarmName", input) } - if id.VirtualNetworkConnectionName, ok = parsed.Parsed["virtualNetworkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkConnectionName", *parsed) + if id.VirtualNetworkConnectionName, ok = input.Parsed["virtualNetworkConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkConnectionName", input) } - if id.RouteName, ok = parsed.Parsed["routeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeName", *parsed) + if id.RouteName, ok = input.Parsed["routeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routeName", input) } - return &id, nil + return nil } // ValidateRouteID checks that 'input' can be parsed as a Route ID diff --git a/resource-manager/web/2022-09-01/appserviceplans/id_serverfarmvirtualnetworkconnection.go b/resource-manager/web/2022-09-01/appserviceplans/id_serverfarmvirtualnetworkconnection.go index f129a67af8a..a03f82ca601 100644 --- a/resource-manager/web/2022-09-01/appserviceplans/id_serverfarmvirtualnetworkconnection.go +++ b/resource-manager/web/2022-09-01/appserviceplans/id_serverfarmvirtualnetworkconnection.go @@ -38,23 +38,9 @@ func ParseServerFarmVirtualNetworkConnectionID(input string) (*ServerFarmVirtual return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerFarmVirtualNetworkConnectionId{} - - 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.ServerFarmName, ok = parsed.Parsed["serverFarmName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverFarmName", *parsed) - } - - if id.VirtualNetworkConnectionName, ok = parsed.Parsed["virtualNetworkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseServerFarmVirtualNetworkConnectionIDInsensitively(input string) (*Serv return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerFarmVirtualNetworkConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ServerFarmVirtualNetworkConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerFarmName, ok = parsed.Parsed["serverFarmName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverFarmName", *parsed) + if id.ServerFarmName, ok = input.Parsed["serverFarmName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverFarmName", input) } - if id.VirtualNetworkConnectionName, ok = parsed.Parsed["virtualNetworkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkConnectionName", *parsed) + if id.VirtualNetworkConnectionName, ok = input.Parsed["virtualNetworkConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkConnectionName", input) } - return &id, nil + return nil } // ValidateServerFarmVirtualNetworkConnectionID checks that 'input' can be parsed as a Server Farm Virtual Network Connection ID diff --git a/resource-manager/web/2022-09-01/appserviceplans/id_virtualnetworkconnectiongateway.go b/resource-manager/web/2022-09-01/appserviceplans/id_virtualnetworkconnectiongateway.go index 39ea1ec30b6..39eac11b9b4 100644 --- a/resource-manager/web/2022-09-01/appserviceplans/id_virtualnetworkconnectiongateway.go +++ b/resource-manager/web/2022-09-01/appserviceplans/id_virtualnetworkconnectiongateway.go @@ -40,27 +40,9 @@ func ParseVirtualNetworkConnectionGatewayID(input string) (*VirtualNetworkConnec return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkConnectionGatewayId{} - - 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.ServerFarmName, ok = parsed.Parsed["serverFarmName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverFarmName", *parsed) - } - - if id.VirtualNetworkConnectionName, ok = parsed.Parsed["virtualNetworkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkConnectionName", *parsed) - } - - if id.GatewayName, ok = parsed.Parsed["gatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVirtualNetworkConnectionGatewayIDInsensitively(input string) (*Virtual return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkConnectionGatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VirtualNetworkConnectionGatewayId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerFarmName, ok = parsed.Parsed["serverFarmName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverFarmName", *parsed) + if id.ServerFarmName, ok = input.Parsed["serverFarmName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverFarmName", input) } - if id.VirtualNetworkConnectionName, ok = parsed.Parsed["virtualNetworkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkConnectionName", *parsed) + if id.VirtualNetworkConnectionName, ok = input.Parsed["virtualNetworkConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkConnectionName", input) } - if id.GatewayName, ok = parsed.Parsed["gatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayName", *parsed) + if id.GatewayName, ok = input.Parsed["gatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayName", input) } - return &id, nil + return nil } // ValidateVirtualNetworkConnectionGatewayID checks that 'input' can be parsed as a Virtual Network Connection Gateway ID diff --git a/resource-manager/web/2022-09-01/appserviceplans/id_worker.go b/resource-manager/web/2022-09-01/appserviceplans/id_worker.go index e754ce3235d..1eaaa44be01 100644 --- a/resource-manager/web/2022-09-01/appserviceplans/id_worker.go +++ b/resource-manager/web/2022-09-01/appserviceplans/id_worker.go @@ -38,23 +38,9 @@ func ParseWorkerID(input string) (*WorkerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkerId{} - - 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.ServerFarmName, ok = parsed.Parsed["serverFarmName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverFarmName", *parsed) - } - - if id.WorkerName, ok = parsed.Parsed["workerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWorkerIDInsensitively(input string) (*WorkerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WorkerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerFarmName, ok = parsed.Parsed["serverFarmName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverFarmName", *parsed) + if id.ServerFarmName, ok = input.Parsed["serverFarmName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverFarmName", input) } - if id.WorkerName, ok = parsed.Parsed["workerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workerName", *parsed) + if id.WorkerName, ok = input.Parsed["workerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workerName", input) } - return &id, nil + return nil } // ValidateWorkerID checks that 'input' can be parsed as a Worker ID diff --git a/resource-manager/web/2022-09-01/certificateordersdiagnostics/id_certificateorder.go b/resource-manager/web/2022-09-01/certificateordersdiagnostics/id_certificateorder.go index d6b70f9951a..606c7e46f1f 100644 --- a/resource-manager/web/2022-09-01/certificateordersdiagnostics/id_certificateorder.go +++ b/resource-manager/web/2022-09-01/certificateordersdiagnostics/id_certificateorder.go @@ -36,19 +36,9 @@ func ParseCertificateOrderID(input string) (*CertificateOrderId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateOrderId{} - - 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.CertificateOrderName, ok = parsed.Parsed["certificateOrderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateOrderName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseCertificateOrderIDInsensitively(input string) (*CertificateOrderId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateOrderId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CertificateOrderId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CertificateOrderName, ok = parsed.Parsed["certificateOrderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateOrderName", *parsed) + if id.CertificateOrderName, ok = input.Parsed["certificateOrderName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateOrderName", input) } - return &id, nil + return nil } // ValidateCertificateOrderID checks that 'input' can be parsed as a Certificate Order ID diff --git a/resource-manager/web/2022-09-01/certificateordersdiagnostics/id_detector.go b/resource-manager/web/2022-09-01/certificateordersdiagnostics/id_detector.go index db5515aaa13..15bb1eee9ab 100644 --- a/resource-manager/web/2022-09-01/certificateordersdiagnostics/id_detector.go +++ b/resource-manager/web/2022-09-01/certificateordersdiagnostics/id_detector.go @@ -38,23 +38,9 @@ func ParseDetectorID(input string) (*DetectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DetectorId{} - - 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.CertificateOrderName, ok = parsed.Parsed["certificateOrderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateOrderName", *parsed) - } - - if id.DetectorName, ok = parsed.Parsed["detectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "detectorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDetectorIDInsensitively(input string) (*DetectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DetectorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DetectorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CertificateOrderName, ok = parsed.Parsed["certificateOrderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateOrderName", *parsed) + if id.CertificateOrderName, ok = input.Parsed["certificateOrderName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateOrderName", input) } - if id.DetectorName, ok = parsed.Parsed["detectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "detectorName", *parsed) + if id.DetectorName, ok = input.Parsed["detectorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "detectorName", input) } - return &id, nil + return nil } // ValidateDetectorID checks that 'input' can be parsed as a Detector ID diff --git a/resource-manager/web/2022-09-01/certificates/id_certificate.go b/resource-manager/web/2022-09-01/certificates/id_certificate.go index fcd08e96f50..8a8daad7e79 100644 --- a/resource-manager/web/2022-09-01/certificates/id_certificate.go +++ b/resource-manager/web/2022-09-01/certificates/id_certificate.go @@ -36,19 +36,9 @@ func ParseCertificateID(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} - - 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.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseCertificateIDInsensitively(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CertificateId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if id.CertificateName, ok = input.Parsed["certificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateName", input) } - return &id, nil + return nil } // ValidateCertificateID checks that 'input' can be parsed as a Certificate ID diff --git a/resource-manager/web/2022-09-01/containerapps/id_containerapp.go b/resource-manager/web/2022-09-01/containerapps/id_containerapp.go index bc307b18ca1..fd2d3e78f07 100644 --- a/resource-manager/web/2022-09-01/containerapps/id_containerapp.go +++ b/resource-manager/web/2022-09-01/containerapps/id_containerapp.go @@ -34,15 +34,9 @@ func ParseContainerAppID(input string) (*ContainerAppId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerAppId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseContainerAppIDInsensitively(input string) (*ContainerAppId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerAppId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ContainerAppId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if id.ContainerAppName, ok = input.Parsed["containerAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", input) } - return &id, nil + return nil } // ValidateContainerAppID checks that 'input' can be parsed as a Container App ID diff --git a/resource-manager/web/2022-09-01/containerapps/id_providercontainerapp.go b/resource-manager/web/2022-09-01/containerapps/id_providercontainerapp.go index 2d66f2456a0..d4a2d44af4b 100644 --- a/resource-manager/web/2022-09-01/containerapps/id_providercontainerapp.go +++ b/resource-manager/web/2022-09-01/containerapps/id_providercontainerapp.go @@ -36,19 +36,9 @@ func ParseProviderContainerAppID(input string) (*ProviderContainerAppId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderContainerAppId{} - - 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.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderContainerAppIDInsensitively(input string) (*ProviderContainerA return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderContainerAppId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderContainerAppId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if id.ContainerAppName, ok = input.Parsed["containerAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", input) } - return &id, nil + return nil } // ValidateProviderContainerAppID checks that 'input' can be parsed as a Provider Container App ID diff --git a/resource-manager/web/2022-09-01/containerappsrevisions/id_providercontainerapp.go b/resource-manager/web/2022-09-01/containerappsrevisions/id_providercontainerapp.go index a9e9a6b08b9..709af7143d3 100644 --- a/resource-manager/web/2022-09-01/containerappsrevisions/id_providercontainerapp.go +++ b/resource-manager/web/2022-09-01/containerappsrevisions/id_providercontainerapp.go @@ -36,19 +36,9 @@ func ParseProviderContainerAppID(input string) (*ProviderContainerAppId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderContainerAppId{} - - 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.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderContainerAppIDInsensitively(input string) (*ProviderContainerA return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderContainerAppId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderContainerAppId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if id.ContainerAppName, ok = input.Parsed["containerAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", input) } - return &id, nil + return nil } // ValidateProviderContainerAppID checks that 'input' can be parsed as a Provider Container App ID diff --git a/resource-manager/web/2022-09-01/containerappsrevisions/id_revision.go b/resource-manager/web/2022-09-01/containerappsrevisions/id_revision.go index 80f96701e69..a9411678941 100644 --- a/resource-manager/web/2022-09-01/containerappsrevisions/id_revision.go +++ b/resource-manager/web/2022-09-01/containerappsrevisions/id_revision.go @@ -38,23 +38,9 @@ func ParseRevisionID(input string) (*RevisionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RevisionId{} - - 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.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) - } - - if id.RevisionName, ok = parsed.Parsed["revisionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "revisionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRevisionIDInsensitively(input string) (*RevisionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RevisionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RevisionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if id.ContainerAppName, ok = input.Parsed["containerAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", input) } - if id.RevisionName, ok = parsed.Parsed["revisionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "revisionName", *parsed) + if id.RevisionName, ok = input.Parsed["revisionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "revisionName", input) } - return &id, nil + return nil } // ValidateRevisionID checks that 'input' can be parsed as a Revision ID diff --git a/resource-manager/web/2022-09-01/deletedwebapps/id_locationdeletedsite.go b/resource-manager/web/2022-09-01/deletedwebapps/id_locationdeletedsite.go index 7ba6e8b719f..dfc34260101 100644 --- a/resource-manager/web/2022-09-01/deletedwebapps/id_locationdeletedsite.go +++ b/resource-manager/web/2022-09-01/deletedwebapps/id_locationdeletedsite.go @@ -36,19 +36,9 @@ func ParseLocationDeletedSiteID(input string) (*LocationDeletedSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationDeletedSiteId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.DeletedSiteId, ok = parsed.Parsed["deletedSiteId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedSiteId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLocationDeletedSiteIDInsensitively(input string) (*LocationDeletedSite return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationDeletedSiteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LocationDeletedSiteId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.DeletedSiteId, ok = parsed.Parsed["deletedSiteId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedSiteId", *parsed) + if id.DeletedSiteId, ok = input.Parsed["deletedSiteId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deletedSiteId", input) } - return &id, nil + return nil } // ValidateLocationDeletedSiteID checks that 'input' can be parsed as a Location Deleted Site ID diff --git a/resource-manager/web/2022-09-01/deletedwebapps/id_providerlocation.go b/resource-manager/web/2022-09-01/deletedwebapps/id_providerlocation.go index db9acabda2c..7996928c8f7 100644 --- a/resource-manager/web/2022-09-01/deletedwebapps/id_providerlocation.go +++ b/resource-manager/web/2022-09-01/deletedwebapps/id_providerlocation.go @@ -34,15 +34,9 @@ func ParseProviderLocationID(input string) (*ProviderLocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviderLocationIDInsensitively(input string) (*ProviderLocationId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ProviderLocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateProviderLocationID checks that 'input' can be parsed as a Provider Location ID diff --git a/resource-manager/web/2022-09-01/diagnostics/id_analysis.go b/resource-manager/web/2022-09-01/diagnostics/id_analysis.go index f1462cc79ce..5e2f9026116 100644 --- a/resource-manager/web/2022-09-01/diagnostics/id_analysis.go +++ b/resource-manager/web/2022-09-01/diagnostics/id_analysis.go @@ -40,27 +40,9 @@ func ParseAnalysisID(input string) (*AnalysisId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AnalysisId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.DiagnosticName, ok = parsed.Parsed["diagnosticName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticName", *parsed) - } - - if id.AnalysisName, ok = parsed.Parsed["analysisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "analysisName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseAnalysisIDInsensitively(input string) (*AnalysisId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AnalysisId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *AnalysisId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.DiagnosticName, ok = parsed.Parsed["diagnosticName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticName", *parsed) + if id.DiagnosticName, ok = input.Parsed["diagnosticName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "diagnosticName", input) } - if id.AnalysisName, ok = parsed.Parsed["analysisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "analysisName", *parsed) + if id.AnalysisName, ok = input.Parsed["analysisName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "analysisName", input) } - return &id, nil + return nil } // ValidateAnalysisID checks that 'input' can be parsed as a Analysis ID diff --git a/resource-manager/web/2022-09-01/diagnostics/id_detector.go b/resource-manager/web/2022-09-01/diagnostics/id_detector.go index 419b3a6923a..779e3e200d3 100644 --- a/resource-manager/web/2022-09-01/diagnostics/id_detector.go +++ b/resource-manager/web/2022-09-01/diagnostics/id_detector.go @@ -38,23 +38,9 @@ func ParseDetectorID(input string) (*DetectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DetectorId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.DetectorName, ok = parsed.Parsed["detectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "detectorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDetectorIDInsensitively(input string) (*DetectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DetectorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DetectorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.DetectorName, ok = parsed.Parsed["detectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "detectorName", *parsed) + if id.DetectorName, ok = input.Parsed["detectorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "detectorName", input) } - return &id, nil + return nil } // ValidateDetectorID checks that 'input' can be parsed as a Detector ID diff --git a/resource-manager/web/2022-09-01/diagnostics/id_diagnostic.go b/resource-manager/web/2022-09-01/diagnostics/id_diagnostic.go index 92af51cd34b..ad3969f6dfc 100644 --- a/resource-manager/web/2022-09-01/diagnostics/id_diagnostic.go +++ b/resource-manager/web/2022-09-01/diagnostics/id_diagnostic.go @@ -38,23 +38,9 @@ func ParseDiagnosticID(input string) (*DiagnosticId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiagnosticId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.DiagnosticName, ok = parsed.Parsed["diagnosticName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDiagnosticIDInsensitively(input string) (*DiagnosticId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiagnosticId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DiagnosticId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.DiagnosticName, ok = parsed.Parsed["diagnosticName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticName", *parsed) + if id.DiagnosticName, ok = input.Parsed["diagnosticName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "diagnosticName", input) } - return &id, nil + return nil } // ValidateDiagnosticID checks that 'input' can be parsed as a Diagnostic ID diff --git a/resource-manager/web/2022-09-01/diagnostics/id_diagnosticanalysis.go b/resource-manager/web/2022-09-01/diagnostics/id_diagnosticanalysis.go index 3c8df682ff6..f0762584073 100644 --- a/resource-manager/web/2022-09-01/diagnostics/id_diagnosticanalysis.go +++ b/resource-manager/web/2022-09-01/diagnostics/id_diagnosticanalysis.go @@ -42,31 +42,9 @@ func ParseDiagnosticAnalysisID(input string) (*DiagnosticAnalysisId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiagnosticAnalysisId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.DiagnosticName, ok = parsed.Parsed["diagnosticName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticName", *parsed) - } - - if id.AnalysisName, ok = parsed.Parsed["analysisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "analysisName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseDiagnosticAnalysisIDInsensitively(input string) (*DiagnosticAnalysisId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiagnosticAnalysisId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DiagnosticAnalysisId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.DiagnosticName, ok = parsed.Parsed["diagnosticName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticName", *parsed) + if id.DiagnosticName, ok = input.Parsed["diagnosticName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "diagnosticName", input) } - if id.AnalysisName, ok = parsed.Parsed["analysisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "analysisName", *parsed) + if id.AnalysisName, ok = input.Parsed["analysisName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "analysisName", input) } - return &id, nil + return nil } // ValidateDiagnosticAnalysisID checks that 'input' can be parsed as a Diagnostic Analysis ID diff --git a/resource-manager/web/2022-09-01/diagnostics/id_diagnosticdetector.go b/resource-manager/web/2022-09-01/diagnostics/id_diagnosticdetector.go index 0106f3b7637..5f0622467f6 100644 --- a/resource-manager/web/2022-09-01/diagnostics/id_diagnosticdetector.go +++ b/resource-manager/web/2022-09-01/diagnostics/id_diagnosticdetector.go @@ -40,27 +40,9 @@ func ParseDiagnosticDetectorID(input string) (*DiagnosticDetectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiagnosticDetectorId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.DiagnosticName, ok = parsed.Parsed["diagnosticName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticName", *parsed) - } - - if id.DetectorName, ok = parsed.Parsed["detectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "detectorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseDiagnosticDetectorIDInsensitively(input string) (*DiagnosticDetectorId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiagnosticDetectorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DiagnosticDetectorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.DiagnosticName, ok = parsed.Parsed["diagnosticName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticName", *parsed) + if id.DiagnosticName, ok = input.Parsed["diagnosticName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "diagnosticName", input) } - if id.DetectorName, ok = parsed.Parsed["detectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "detectorName", *parsed) + if id.DetectorName, ok = input.Parsed["detectorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "detectorName", input) } - return &id, nil + return nil } // ValidateDiagnosticDetectorID checks that 'input' can be parsed as a Diagnostic Detector ID diff --git a/resource-manager/web/2022-09-01/diagnostics/id_hostingenvironmentdetector.go b/resource-manager/web/2022-09-01/diagnostics/id_hostingenvironmentdetector.go index 56606ef3afc..0b2a7d3c346 100644 --- a/resource-manager/web/2022-09-01/diagnostics/id_hostingenvironmentdetector.go +++ b/resource-manager/web/2022-09-01/diagnostics/id_hostingenvironmentdetector.go @@ -38,23 +38,9 @@ func ParseHostingEnvironmentDetectorID(input string) (*HostingEnvironmentDetecto return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostingEnvironmentDetectorId{} - - 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.HostingEnvironmentName, ok = parsed.Parsed["hostingEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostingEnvironmentName", *parsed) - } - - if id.DetectorName, ok = parsed.Parsed["detectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "detectorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseHostingEnvironmentDetectorIDInsensitively(input string) (*HostingEnvir return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostingEnvironmentDetectorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *HostingEnvironmentDetectorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostingEnvironmentName, ok = parsed.Parsed["hostingEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostingEnvironmentName", *parsed) + if id.HostingEnvironmentName, ok = input.Parsed["hostingEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostingEnvironmentName", input) } - if id.DetectorName, ok = parsed.Parsed["detectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "detectorName", *parsed) + if id.DetectorName, ok = input.Parsed["detectorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "detectorName", input) } - return &id, nil + return nil } // ValidateHostingEnvironmentDetectorID checks that 'input' can be parsed as a Hosting Environment Detector ID diff --git a/resource-manager/web/2022-09-01/diagnostics/id_slot.go b/resource-manager/web/2022-09-01/diagnostics/id_slot.go index 9de3e83b9f2..621f005dca9 100644 --- a/resource-manager/web/2022-09-01/diagnostics/id_slot.go +++ b/resource-manager/web/2022-09-01/diagnostics/id_slot.go @@ -38,23 +38,9 @@ func ParseSlotID(input string) (*SlotId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSlotIDInsensitively(input string) (*SlotId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SlotId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - return &id, nil + return nil } // ValidateSlotID checks that 'input' can be parsed as a Slot ID diff --git a/resource-manager/web/2022-09-01/diagnostics/id_slotdetector.go b/resource-manager/web/2022-09-01/diagnostics/id_slotdetector.go index 62fb18223fb..a79bfadb518 100644 --- a/resource-manager/web/2022-09-01/diagnostics/id_slotdetector.go +++ b/resource-manager/web/2022-09-01/diagnostics/id_slotdetector.go @@ -40,27 +40,9 @@ func ParseSlotDetectorID(input string) (*SlotDetectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotDetectorId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.DetectorName, ok = parsed.Parsed["detectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "detectorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSlotDetectorIDInsensitively(input string) (*SlotDetectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotDetectorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SlotDetectorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.DetectorName, ok = parsed.Parsed["detectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "detectorName", *parsed) + if id.DetectorName, ok = input.Parsed["detectorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "detectorName", input) } - return &id, nil + return nil } // ValidateSlotDetectorID checks that 'input' can be parsed as a Slot Detector ID diff --git a/resource-manager/web/2022-09-01/diagnostics/id_slotdiagnostic.go b/resource-manager/web/2022-09-01/diagnostics/id_slotdiagnostic.go index 41e3b13371f..eedc947b71e 100644 --- a/resource-manager/web/2022-09-01/diagnostics/id_slotdiagnostic.go +++ b/resource-manager/web/2022-09-01/diagnostics/id_slotdiagnostic.go @@ -40,27 +40,9 @@ func ParseSlotDiagnosticID(input string) (*SlotDiagnosticId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotDiagnosticId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.DiagnosticName, ok = parsed.Parsed["diagnosticName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSlotDiagnosticIDInsensitively(input string) (*SlotDiagnosticId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotDiagnosticId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SlotDiagnosticId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.DiagnosticName, ok = parsed.Parsed["diagnosticName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticName", *parsed) + if id.DiagnosticName, ok = input.Parsed["diagnosticName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "diagnosticName", input) } - return &id, nil + return nil } // ValidateSlotDiagnosticID checks that 'input' can be parsed as a Slot Diagnostic ID diff --git a/resource-manager/web/2022-09-01/diagnostics/id_slotdiagnosticdetector.go b/resource-manager/web/2022-09-01/diagnostics/id_slotdiagnosticdetector.go index 4938c973dd4..3cb926410b4 100644 --- a/resource-manager/web/2022-09-01/diagnostics/id_slotdiagnosticdetector.go +++ b/resource-manager/web/2022-09-01/diagnostics/id_slotdiagnosticdetector.go @@ -42,31 +42,9 @@ func ParseSlotDiagnosticDetectorID(input string) (*SlotDiagnosticDetectorId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotDiagnosticDetectorId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.DiagnosticName, ok = parsed.Parsed["diagnosticName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticName", *parsed) - } - - if id.DetectorName, ok = parsed.Parsed["detectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "detectorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseSlotDiagnosticDetectorIDInsensitively(input string) (*SlotDiagnosticDe return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotDiagnosticDetectorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SlotDiagnosticDetectorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.DiagnosticName, ok = parsed.Parsed["diagnosticName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticName", *parsed) + if id.DiagnosticName, ok = input.Parsed["diagnosticName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "diagnosticName", input) } - if id.DetectorName, ok = parsed.Parsed["detectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "detectorName", *parsed) + if id.DetectorName, ok = input.Parsed["detectorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "detectorName", input) } - return &id, nil + return nil } // ValidateSlotDiagnosticDetectorID checks that 'input' can be parsed as a Slot Diagnostic Detector ID diff --git a/resource-manager/web/2022-09-01/domains/id_domain.go b/resource-manager/web/2022-09-01/domains/id_domain.go index 88808fd7aa6..9bce1ffec8a 100644 --- a/resource-manager/web/2022-09-01/domains/id_domain.go +++ b/resource-manager/web/2022-09-01/domains/id_domain.go @@ -36,19 +36,9 @@ func ParseDomainID(input string) (*DomainId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DomainId{} - - 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.DomainName, ok = parsed.Parsed["domainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDomainIDInsensitively(input string) (*DomainId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DomainId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DomainId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DomainName, ok = parsed.Parsed["domainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainName", *parsed) + if id.DomainName, ok = input.Parsed["domainName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "domainName", input) } - return &id, nil + return nil } // ValidateDomainID checks that 'input' can be parsed as a Domain ID diff --git a/resource-manager/web/2022-09-01/domains/id_domainownershipidentifier.go b/resource-manager/web/2022-09-01/domains/id_domainownershipidentifier.go index 588e91545b7..4e40c5269b8 100644 --- a/resource-manager/web/2022-09-01/domains/id_domainownershipidentifier.go +++ b/resource-manager/web/2022-09-01/domains/id_domainownershipidentifier.go @@ -38,23 +38,9 @@ func ParseDomainOwnershipIdentifierID(input string) (*DomainOwnershipIdentifierI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DomainOwnershipIdentifierId{} - - 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.DomainName, ok = parsed.Parsed["domainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainName", *parsed) - } - - if id.DomainOwnershipIdentifierName, ok = parsed.Parsed["domainOwnershipIdentifierName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainOwnershipIdentifierName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDomainOwnershipIdentifierIDInsensitively(input string) (*DomainOwnersh return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DomainOwnershipIdentifierId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DomainOwnershipIdentifierId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DomainName, ok = parsed.Parsed["domainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainName", *parsed) + if id.DomainName, ok = input.Parsed["domainName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "domainName", input) } - if id.DomainOwnershipIdentifierName, ok = parsed.Parsed["domainOwnershipIdentifierName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainOwnershipIdentifierName", *parsed) + if id.DomainOwnershipIdentifierName, ok = input.Parsed["domainOwnershipIdentifierName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "domainOwnershipIdentifierName", input) } - return &id, nil + return nil } // ValidateDomainOwnershipIdentifierID checks that 'input' can be parsed as a Domain Ownership Identifier ID diff --git a/resource-manager/web/2022-09-01/global/id_deletedsite.go b/resource-manager/web/2022-09-01/global/id_deletedsite.go index 713b403b1d0..c28023d3415 100644 --- a/resource-manager/web/2022-09-01/global/id_deletedsite.go +++ b/resource-manager/web/2022-09-01/global/id_deletedsite.go @@ -34,15 +34,9 @@ func ParseDeletedSiteID(input string) (*DeletedSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeletedSiteId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.DeletedSiteId, ok = parsed.Parsed["deletedSiteId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedSiteId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseDeletedSiteIDInsensitively(input string) (*DeletedSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeletedSiteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DeletedSiteId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.DeletedSiteId, ok = parsed.Parsed["deletedSiteId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedSiteId", *parsed) + if id.DeletedSiteId, ok = input.Parsed["deletedSiteId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deletedSiteId", input) } - return &id, nil + return nil } // ValidateDeletedSiteID checks that 'input' can be parsed as a Deleted Site ID diff --git a/resource-manager/web/2022-09-01/kubeenvironments/id_kubeenvironment.go b/resource-manager/web/2022-09-01/kubeenvironments/id_kubeenvironment.go index e1eb58d11de..be98f187085 100644 --- a/resource-manager/web/2022-09-01/kubeenvironments/id_kubeenvironment.go +++ b/resource-manager/web/2022-09-01/kubeenvironments/id_kubeenvironment.go @@ -36,19 +36,9 @@ func ParseKubeEnvironmentID(input string) (*KubeEnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := KubeEnvironmentId{} - - 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.KubeEnvironmentName, ok = parsed.Parsed["kubeEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "kubeEnvironmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseKubeEnvironmentIDInsensitively(input string) (*KubeEnvironmentId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := KubeEnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *KubeEnvironmentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.KubeEnvironmentName, ok = parsed.Parsed["kubeEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "kubeEnvironmentName", *parsed) + if id.KubeEnvironmentName, ok = input.Parsed["kubeEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "kubeEnvironmentName", input) } - return &id, nil + return nil } // ValidateKubeEnvironmentID checks that 'input' can be parsed as a Kube Environment ID diff --git a/resource-manager/web/2022-09-01/provider/id_location.go b/resource-manager/web/2022-09-01/provider/id_location.go index babb6d4f13e..d3531b3fed3 100644 --- a/resource-manager/web/2022-09-01/provider/id_location.go +++ b/resource-manager/web/2022-09-01/provider/id_location.go @@ -32,11 +32,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + return nil +} + // ValidateLocationID checks that 'input' can be parsed as a Location ID func ValidateLocationID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/web/2022-09-01/recommendations/id_hostingenvironmentrecommendation.go b/resource-manager/web/2022-09-01/recommendations/id_hostingenvironmentrecommendation.go index db9a3da939e..d4c89238991 100644 --- a/resource-manager/web/2022-09-01/recommendations/id_hostingenvironmentrecommendation.go +++ b/resource-manager/web/2022-09-01/recommendations/id_hostingenvironmentrecommendation.go @@ -38,23 +38,9 @@ func ParseHostingEnvironmentRecommendationID(input string) (*HostingEnvironmentR return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostingEnvironmentRecommendationId{} - - 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.HostingEnvironmentName, ok = parsed.Parsed["hostingEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostingEnvironmentName", *parsed) - } - - if id.RecommendationName, ok = parsed.Parsed["recommendationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recommendationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseHostingEnvironmentRecommendationIDInsensitively(input string) (*Hostin return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostingEnvironmentRecommendationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *HostingEnvironmentRecommendationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostingEnvironmentName, ok = parsed.Parsed["hostingEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostingEnvironmentName", *parsed) + if id.HostingEnvironmentName, ok = input.Parsed["hostingEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostingEnvironmentName", input) } - if id.RecommendationName, ok = parsed.Parsed["recommendationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recommendationName", *parsed) + if id.RecommendationName, ok = input.Parsed["recommendationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "recommendationName", input) } - return &id, nil + return nil } // ValidateHostingEnvironmentRecommendationID checks that 'input' can be parsed as a Hosting Environment Recommendation ID diff --git a/resource-manager/web/2022-09-01/recommendations/id_recommendation.go b/resource-manager/web/2022-09-01/recommendations/id_recommendation.go index 72461363fcc..c7e7e1ad92b 100644 --- a/resource-manager/web/2022-09-01/recommendations/id_recommendation.go +++ b/resource-manager/web/2022-09-01/recommendations/id_recommendation.go @@ -34,15 +34,9 @@ func ParseRecommendationID(input string) (*RecommendationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecommendationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.RecommendationName, ok = parsed.Parsed["recommendationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recommendationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseRecommendationIDInsensitively(input string) (*RecommendationId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecommendationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RecommendationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.RecommendationName, ok = parsed.Parsed["recommendationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recommendationName", *parsed) + if id.RecommendationName, ok = input.Parsed["recommendationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "recommendationName", input) } - return &id, nil + return nil } // ValidateRecommendationID checks that 'input' can be parsed as a Recommendation ID diff --git a/resource-manager/web/2022-09-01/recommendations/id_siterecommendation.go b/resource-manager/web/2022-09-01/recommendations/id_siterecommendation.go index 3405fa817c0..0e12b06558a 100644 --- a/resource-manager/web/2022-09-01/recommendations/id_siterecommendation.go +++ b/resource-manager/web/2022-09-01/recommendations/id_siterecommendation.go @@ -38,23 +38,9 @@ func ParseSiteRecommendationID(input string) (*SiteRecommendationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SiteRecommendationId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.RecommendationName, ok = parsed.Parsed["recommendationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recommendationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSiteRecommendationIDInsensitively(input string) (*SiteRecommendationId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SiteRecommendationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SiteRecommendationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.RecommendationName, ok = parsed.Parsed["recommendationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recommendationName", *parsed) + if id.RecommendationName, ok = input.Parsed["recommendationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "recommendationName", input) } - return &id, nil + return nil } // ValidateSiteRecommendationID checks that 'input' can be parsed as a Site Recommendation ID diff --git a/resource-manager/web/2022-09-01/resourcehealthmetadata/id_slot.go b/resource-manager/web/2022-09-01/resourcehealthmetadata/id_slot.go index 9d76aadaf12..0ca77fcb8ea 100644 --- a/resource-manager/web/2022-09-01/resourcehealthmetadata/id_slot.go +++ b/resource-manager/web/2022-09-01/resourcehealthmetadata/id_slot.go @@ -38,23 +38,9 @@ func ParseSlotID(input string) (*SlotId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSlotIDInsensitively(input string) (*SlotId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SlotId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - return &id, nil + return nil } // ValidateSlotID checks that 'input' can be parsed as a Slot ID diff --git a/resource-manager/web/2022-09-01/resourceproviders/id_sourcecontrol.go b/resource-manager/web/2022-09-01/resourceproviders/id_sourcecontrol.go index 91261032c7f..3de3c627bc9 100644 --- a/resource-manager/web/2022-09-01/resourceproviders/id_sourcecontrol.go +++ b/resource-manager/web/2022-09-01/resourceproviders/id_sourcecontrol.go @@ -32,11 +32,9 @@ func ParseSourceControlID(input string) (*SourceControlId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlId{} - - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseSourceControlIDInsensitively(input string) (*SourceControlId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlId{} - - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *SourceControlId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SourceControlName, ok = input.Parsed["sourceControlName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", input) + } + + return nil +} + // ValidateSourceControlID checks that 'input' can be parsed as a Source Control ID func ValidateSourceControlID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/web/2022-09-01/staticsites/id_authprovider.go b/resource-manager/web/2022-09-01/staticsites/id_authprovider.go index 2d345d7e6c7..2fcb3983be2 100644 --- a/resource-manager/web/2022-09-01/staticsites/id_authprovider.go +++ b/resource-manager/web/2022-09-01/staticsites/id_authprovider.go @@ -38,23 +38,9 @@ func ParseAuthProviderID(input string) (*AuthProviderId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthProviderId{} - - 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.StaticSiteName, ok = parsed.Parsed["staticSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", *parsed) - } - - if id.AuthProviderName, ok = parsed.Parsed["authProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authProviderName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAuthProviderIDInsensitively(input string) (*AuthProviderId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthProviderId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AuthProviderId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StaticSiteName, ok = parsed.Parsed["staticSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", *parsed) + if id.StaticSiteName, ok = input.Parsed["staticSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", input) } - if id.AuthProviderName, ok = parsed.Parsed["authProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authProviderName", *parsed) + if id.AuthProviderName, ok = input.Parsed["authProviderName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authProviderName", input) } - return &id, nil + return nil } // ValidateAuthProviderID checks that 'input' can be parsed as a Auth Provider ID diff --git a/resource-manager/web/2022-09-01/staticsites/id_build.go b/resource-manager/web/2022-09-01/staticsites/id_build.go index e8c9bff7f44..f59984a3da8 100644 --- a/resource-manager/web/2022-09-01/staticsites/id_build.go +++ b/resource-manager/web/2022-09-01/staticsites/id_build.go @@ -38,23 +38,9 @@ func ParseBuildID(input string) (*BuildId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BuildId{} - - 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.StaticSiteName, ok = parsed.Parsed["staticSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", *parsed) - } - - if id.BuildName, ok = parsed.Parsed["buildName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBuildIDInsensitively(input string) (*BuildId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BuildId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BuildId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StaticSiteName, ok = parsed.Parsed["staticSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", *parsed) + if id.StaticSiteName, ok = input.Parsed["staticSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", input) } - if id.BuildName, ok = parsed.Parsed["buildName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildName", *parsed) + if id.BuildName, ok = input.Parsed["buildName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "buildName", input) } - return &id, nil + return nil } // ValidateBuildID checks that 'input' can be parsed as a Build ID diff --git a/resource-manager/web/2022-09-01/staticsites/id_builddatabaseconnection.go b/resource-manager/web/2022-09-01/staticsites/id_builddatabaseconnection.go index 7f8e7ca9a10..1abf1750bb5 100644 --- a/resource-manager/web/2022-09-01/staticsites/id_builddatabaseconnection.go +++ b/resource-manager/web/2022-09-01/staticsites/id_builddatabaseconnection.go @@ -40,27 +40,9 @@ func ParseBuildDatabaseConnectionID(input string) (*BuildDatabaseConnectionId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BuildDatabaseConnectionId{} - - 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.StaticSiteName, ok = parsed.Parsed["staticSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", *parsed) - } - - if id.BuildName, ok = parsed.Parsed["buildName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildName", *parsed) - } - - if id.DatabaseConnectionName, ok = parsed.Parsed["databaseConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseBuildDatabaseConnectionIDInsensitively(input string) (*BuildDatabaseCo return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BuildDatabaseConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *BuildDatabaseConnectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StaticSiteName, ok = parsed.Parsed["staticSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", *parsed) + if id.StaticSiteName, ok = input.Parsed["staticSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", input) } - if id.BuildName, ok = parsed.Parsed["buildName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildName", *parsed) + if id.BuildName, ok = input.Parsed["buildName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "buildName", input) } - if id.DatabaseConnectionName, ok = parsed.Parsed["databaseConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseConnectionName", *parsed) + if id.DatabaseConnectionName, ok = input.Parsed["databaseConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseConnectionName", input) } - return &id, nil + return nil } // ValidateBuildDatabaseConnectionID checks that 'input' can be parsed as a Build Database Connection ID diff --git a/resource-manager/web/2022-09-01/staticsites/id_buildlinkedbackend.go b/resource-manager/web/2022-09-01/staticsites/id_buildlinkedbackend.go index 225de979367..fe9de867951 100644 --- a/resource-manager/web/2022-09-01/staticsites/id_buildlinkedbackend.go +++ b/resource-manager/web/2022-09-01/staticsites/id_buildlinkedbackend.go @@ -40,27 +40,9 @@ func ParseBuildLinkedBackendID(input string) (*BuildLinkedBackendId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BuildLinkedBackendId{} - - 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.StaticSiteName, ok = parsed.Parsed["staticSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", *parsed) - } - - if id.BuildName, ok = parsed.Parsed["buildName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildName", *parsed) - } - - if id.LinkedBackendName, ok = parsed.Parsed["linkedBackendName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "linkedBackendName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseBuildLinkedBackendIDInsensitively(input string) (*BuildLinkedBackendId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BuildLinkedBackendId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *BuildLinkedBackendId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StaticSiteName, ok = parsed.Parsed["staticSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", *parsed) + if id.StaticSiteName, ok = input.Parsed["staticSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", input) } - if id.BuildName, ok = parsed.Parsed["buildName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildName", *parsed) + if id.BuildName, ok = input.Parsed["buildName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "buildName", input) } - if id.LinkedBackendName, ok = parsed.Parsed["linkedBackendName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "linkedBackendName", *parsed) + if id.LinkedBackendName, ok = input.Parsed["linkedBackendName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "linkedBackendName", input) } - return &id, nil + return nil } // ValidateBuildLinkedBackendID checks that 'input' can be parsed as a Build Linked Backend ID diff --git a/resource-manager/web/2022-09-01/staticsites/id_builduserprovidedfunctionapp.go b/resource-manager/web/2022-09-01/staticsites/id_builduserprovidedfunctionapp.go index 28ccbca77c7..32403b5b0a5 100644 --- a/resource-manager/web/2022-09-01/staticsites/id_builduserprovidedfunctionapp.go +++ b/resource-manager/web/2022-09-01/staticsites/id_builduserprovidedfunctionapp.go @@ -40,27 +40,9 @@ func ParseBuildUserProvidedFunctionAppID(input string) (*BuildUserProvidedFuncti return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BuildUserProvidedFunctionAppId{} - - 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.StaticSiteName, ok = parsed.Parsed["staticSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", *parsed) - } - - if id.BuildName, ok = parsed.Parsed["buildName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildName", *parsed) - } - - if id.UserProvidedFunctionAppName, ok = parsed.Parsed["userProvidedFunctionAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userProvidedFunctionAppName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseBuildUserProvidedFunctionAppIDInsensitively(input string) (*BuildUserP return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BuildUserProvidedFunctionAppId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *BuildUserProvidedFunctionAppId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StaticSiteName, ok = parsed.Parsed["staticSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", *parsed) + if id.StaticSiteName, ok = input.Parsed["staticSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", input) } - if id.BuildName, ok = parsed.Parsed["buildName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildName", *parsed) + if id.BuildName, ok = input.Parsed["buildName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "buildName", input) } - if id.UserProvidedFunctionAppName, ok = parsed.Parsed["userProvidedFunctionAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userProvidedFunctionAppName", *parsed) + if id.UserProvidedFunctionAppName, ok = input.Parsed["userProvidedFunctionAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userProvidedFunctionAppName", input) } - return &id, nil + return nil } // ValidateBuildUserProvidedFunctionAppID checks that 'input' can be parsed as a Build User Provided Function App ID diff --git a/resource-manager/web/2022-09-01/staticsites/id_customdomain.go b/resource-manager/web/2022-09-01/staticsites/id_customdomain.go index 6c3831ab55c..dbea7275339 100644 --- a/resource-manager/web/2022-09-01/staticsites/id_customdomain.go +++ b/resource-manager/web/2022-09-01/staticsites/id_customdomain.go @@ -38,23 +38,9 @@ func ParseCustomDomainID(input string) (*CustomDomainId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CustomDomainId{} - - 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.StaticSiteName, ok = parsed.Parsed["staticSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", *parsed) - } - - if id.CustomDomainName, ok = parsed.Parsed["customDomainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "customDomainName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCustomDomainIDInsensitively(input string) (*CustomDomainId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CustomDomainId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CustomDomainId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StaticSiteName, ok = parsed.Parsed["staticSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", *parsed) + if id.StaticSiteName, ok = input.Parsed["staticSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", input) } - if id.CustomDomainName, ok = parsed.Parsed["customDomainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "customDomainName", *parsed) + if id.CustomDomainName, ok = input.Parsed["customDomainName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "customDomainName", input) } - return &id, nil + return nil } // ValidateCustomDomainID checks that 'input' can be parsed as a Custom Domain ID diff --git a/resource-manager/web/2022-09-01/staticsites/id_databaseconnection.go b/resource-manager/web/2022-09-01/staticsites/id_databaseconnection.go index ff0cbb9a161..e8fcbcd940e 100644 --- a/resource-manager/web/2022-09-01/staticsites/id_databaseconnection.go +++ b/resource-manager/web/2022-09-01/staticsites/id_databaseconnection.go @@ -38,23 +38,9 @@ func ParseDatabaseConnectionID(input string) (*DatabaseConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseConnectionId{} - - 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.StaticSiteName, ok = parsed.Parsed["staticSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", *parsed) - } - - if id.DatabaseConnectionName, ok = parsed.Parsed["databaseConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDatabaseConnectionIDInsensitively(input string) (*DatabaseConnectionId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DatabaseConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StaticSiteName, ok = parsed.Parsed["staticSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", *parsed) + if id.StaticSiteName, ok = input.Parsed["staticSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", input) } - if id.DatabaseConnectionName, ok = parsed.Parsed["databaseConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseConnectionName", *parsed) + if id.DatabaseConnectionName, ok = input.Parsed["databaseConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseConnectionName", input) } - return &id, nil + return nil } // ValidateDatabaseConnectionID checks that 'input' can be parsed as a Database Connection ID diff --git a/resource-manager/web/2022-09-01/staticsites/id_linkedbackend.go b/resource-manager/web/2022-09-01/staticsites/id_linkedbackend.go index e0ddbaca788..179c6311cbe 100644 --- a/resource-manager/web/2022-09-01/staticsites/id_linkedbackend.go +++ b/resource-manager/web/2022-09-01/staticsites/id_linkedbackend.go @@ -38,23 +38,9 @@ func ParseLinkedBackendID(input string) (*LinkedBackendId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LinkedBackendId{} - - 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.StaticSiteName, ok = parsed.Parsed["staticSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", *parsed) - } - - if id.LinkedBackendName, ok = parsed.Parsed["linkedBackendName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "linkedBackendName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLinkedBackendIDInsensitively(input string) (*LinkedBackendId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LinkedBackendId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LinkedBackendId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StaticSiteName, ok = parsed.Parsed["staticSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", *parsed) + if id.StaticSiteName, ok = input.Parsed["staticSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", input) } - if id.LinkedBackendName, ok = parsed.Parsed["linkedBackendName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "linkedBackendName", *parsed) + if id.LinkedBackendName, ok = input.Parsed["linkedBackendName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "linkedBackendName", input) } - return &id, nil + return nil } // ValidateLinkedBackendID checks that 'input' can be parsed as a Linked Backend ID diff --git a/resource-manager/web/2022-09-01/staticsites/id_providerlocation.go b/resource-manager/web/2022-09-01/staticsites/id_providerlocation.go index 03856e00e52..aa6e5476eb5 100644 --- a/resource-manager/web/2022-09-01/staticsites/id_providerlocation.go +++ b/resource-manager/web/2022-09-01/staticsites/id_providerlocation.go @@ -34,15 +34,9 @@ func ParseProviderLocationID(input string) (*ProviderLocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviderLocationIDInsensitively(input string) (*ProviderLocationId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ProviderLocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateProviderLocationID checks that 'input' can be parsed as a Provider Location ID diff --git a/resource-manager/web/2022-09-01/staticsites/id_staticsite.go b/resource-manager/web/2022-09-01/staticsites/id_staticsite.go index 6c3fe5a0568..bcad7d1192e 100644 --- a/resource-manager/web/2022-09-01/staticsites/id_staticsite.go +++ b/resource-manager/web/2022-09-01/staticsites/id_staticsite.go @@ -36,19 +36,9 @@ func ParseStaticSiteID(input string) (*StaticSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StaticSiteId{} - - 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.StaticSiteName, ok = parsed.Parsed["staticSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseStaticSiteIDInsensitively(input string) (*StaticSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StaticSiteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *StaticSiteId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StaticSiteName, ok = parsed.Parsed["staticSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", *parsed) + if id.StaticSiteName, ok = input.Parsed["staticSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", input) } - return &id, nil + return nil } // ValidateStaticSiteID checks that 'input' can be parsed as a Static Site ID diff --git a/resource-manager/web/2022-09-01/staticsites/id_staticsiteprivateendpointconnection.go b/resource-manager/web/2022-09-01/staticsites/id_staticsiteprivateendpointconnection.go index 7bf39fdc2b8..8e4f8f8de88 100644 --- a/resource-manager/web/2022-09-01/staticsites/id_staticsiteprivateendpointconnection.go +++ b/resource-manager/web/2022-09-01/staticsites/id_staticsiteprivateendpointconnection.go @@ -38,23 +38,9 @@ func ParseStaticSitePrivateEndpointConnectionID(input string) (*StaticSitePrivat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StaticSitePrivateEndpointConnectionId{} - - 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.StaticSiteName, ok = parsed.Parsed["staticSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseStaticSitePrivateEndpointConnectionIDInsensitively(input string) (*Sta return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StaticSitePrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *StaticSitePrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StaticSiteName, ok = parsed.Parsed["staticSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", *parsed) + if id.StaticSiteName, ok = input.Parsed["staticSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidateStaticSitePrivateEndpointConnectionID checks that 'input' can be parsed as a Static Site Private Endpoint Connection ID diff --git a/resource-manager/web/2022-09-01/staticsites/id_user.go b/resource-manager/web/2022-09-01/staticsites/id_user.go index 76334a31978..73377a28325 100644 --- a/resource-manager/web/2022-09-01/staticsites/id_user.go +++ b/resource-manager/web/2022-09-01/staticsites/id_user.go @@ -40,27 +40,9 @@ func ParseUserID(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} - - 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.StaticSiteName, ok = parsed.Parsed["staticSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", *parsed) - } - - if id.AuthProviderName, ok = parsed.Parsed["authProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authProviderName", *parsed) - } - - if id.UserName, ok = parsed.Parsed["userName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseUserIDInsensitively(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *UserId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StaticSiteName, ok = parsed.Parsed["staticSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", *parsed) + if id.StaticSiteName, ok = input.Parsed["staticSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", input) } - if id.AuthProviderName, ok = parsed.Parsed["authProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authProviderName", *parsed) + if id.AuthProviderName, ok = input.Parsed["authProviderName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authProviderName", input) } - if id.UserName, ok = parsed.Parsed["userName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userName", *parsed) + if id.UserName, ok = input.Parsed["userName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userName", input) } - return &id, nil + return nil } // ValidateUserID checks that 'input' can be parsed as a User ID diff --git a/resource-manager/web/2022-09-01/staticsites/id_userprovidedfunctionapp.go b/resource-manager/web/2022-09-01/staticsites/id_userprovidedfunctionapp.go index 718865debfc..49630eed1ee 100644 --- a/resource-manager/web/2022-09-01/staticsites/id_userprovidedfunctionapp.go +++ b/resource-manager/web/2022-09-01/staticsites/id_userprovidedfunctionapp.go @@ -38,23 +38,9 @@ func ParseUserProvidedFunctionAppID(input string) (*UserProvidedFunctionAppId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserProvidedFunctionAppId{} - - 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.StaticSiteName, ok = parsed.Parsed["staticSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", *parsed) - } - - if id.UserProvidedFunctionAppName, ok = parsed.Parsed["userProvidedFunctionAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userProvidedFunctionAppName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseUserProvidedFunctionAppIDInsensitively(input string) (*UserProvidedFun return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserProvidedFunctionAppId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UserProvidedFunctionAppId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StaticSiteName, ok = parsed.Parsed["staticSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", *parsed) + if id.StaticSiteName, ok = input.Parsed["staticSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", input) } - if id.UserProvidedFunctionAppName, ok = parsed.Parsed["userProvidedFunctionAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userProvidedFunctionAppName", *parsed) + if id.UserProvidedFunctionAppName, ok = input.Parsed["userProvidedFunctionAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userProvidedFunctionAppName", input) } - return &id, nil + return nil } // ValidateUserProvidedFunctionAppID checks that 'input' can be parsed as a User Provided Function App ID diff --git a/resource-manager/web/2022-09-01/topleveldomains/id_topleveldomain.go b/resource-manager/web/2022-09-01/topleveldomains/id_topleveldomain.go index 2ae951f5d2e..3faef0ad6fe 100644 --- a/resource-manager/web/2022-09-01/topleveldomains/id_topleveldomain.go +++ b/resource-manager/web/2022-09-01/topleveldomains/id_topleveldomain.go @@ -34,15 +34,9 @@ func ParseTopLevelDomainID(input string) (*TopLevelDomainId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TopLevelDomainId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.TopLevelDomainName, ok = parsed.Parsed["topLevelDomainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topLevelDomainName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseTopLevelDomainIDInsensitively(input string) (*TopLevelDomainId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TopLevelDomainId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TopLevelDomainId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.TopLevelDomainName, ok = parsed.Parsed["topLevelDomainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topLevelDomainName", *parsed) + if id.TopLevelDomainName, ok = input.Parsed["topLevelDomainName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "topLevelDomainName", input) } - return &id, nil + return nil } // ValidateTopLevelDomainID checks that 'input' can be parsed as a Top Level Domain ID diff --git a/resource-manager/web/2022-09-01/webapps/id_appsetting.go b/resource-manager/web/2022-09-01/webapps/id_appsetting.go index 90a37b2bd62..8bbf3e816c3 100644 --- a/resource-manager/web/2022-09-01/webapps/id_appsetting.go +++ b/resource-manager/web/2022-09-01/webapps/id_appsetting.go @@ -38,23 +38,9 @@ func ParseAppSettingID(input string) (*AppSettingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AppSettingId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.AppSettingKey, ok = parsed.Parsed["appSettingKey"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "appSettingKey", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAppSettingIDInsensitively(input string) (*AppSettingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AppSettingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AppSettingId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.AppSettingKey, ok = parsed.Parsed["appSettingKey"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "appSettingKey", *parsed) + if id.AppSettingKey, ok = input.Parsed["appSettingKey"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "appSettingKey", input) } - return &id, nil + return nil } // ValidateAppSettingID checks that 'input' can be parsed as a App Setting ID diff --git a/resource-manager/web/2022-09-01/webapps/id_backup.go b/resource-manager/web/2022-09-01/webapps/id_backup.go index 16b83a88548..5eb75e41c8a 100644 --- a/resource-manager/web/2022-09-01/webapps/id_backup.go +++ b/resource-manager/web/2022-09-01/webapps/id_backup.go @@ -38,23 +38,9 @@ func ParseBackupID(input string) (*BackupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.BackupId, ok = parsed.Parsed["backupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupIDInsensitively(input string) (*BackupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.BackupId, ok = parsed.Parsed["backupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupId", *parsed) + if id.BackupId, ok = input.Parsed["backupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupId", input) } - return &id, nil + return nil } // ValidateBackupID checks that 'input' can be parsed as a Backup ID diff --git a/resource-manager/web/2022-09-01/webapps/id_configreferenceappsetting.go b/resource-manager/web/2022-09-01/webapps/id_configreferenceappsetting.go index 17ecdec0011..2464de4561f 100644 --- a/resource-manager/web/2022-09-01/webapps/id_configreferenceappsetting.go +++ b/resource-manager/web/2022-09-01/webapps/id_configreferenceappsetting.go @@ -40,27 +40,9 @@ func ParseConfigReferenceAppSettingID(input string) (*ConfigReferenceAppSettingI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigReferenceAppSettingId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.AppSettingKey, ok = parsed.Parsed["appSettingKey"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "appSettingKey", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseConfigReferenceAppSettingIDInsensitively(input string) (*ConfigReferen return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigReferenceAppSettingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ConfigReferenceAppSettingId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.AppSettingKey, ok = parsed.Parsed["appSettingKey"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "appSettingKey", *parsed) + if id.AppSettingKey, ok = input.Parsed["appSettingKey"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "appSettingKey", input) } - return &id, nil + return nil } // ValidateConfigReferenceAppSettingID checks that 'input' can be parsed as a Config Reference App Setting ID diff --git a/resource-manager/web/2022-09-01/webapps/id_configreferenceconnectionstring.go b/resource-manager/web/2022-09-01/webapps/id_configreferenceconnectionstring.go index cb3cec4348a..1b238cdc1a5 100644 --- a/resource-manager/web/2022-09-01/webapps/id_configreferenceconnectionstring.go +++ b/resource-manager/web/2022-09-01/webapps/id_configreferenceconnectionstring.go @@ -40,27 +40,9 @@ func ParseConfigReferenceConnectionStringID(input string) (*ConfigReferenceConne return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigReferenceConnectionStringId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.ConnectionStringKey, ok = parsed.Parsed["connectionStringKey"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionStringKey", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseConfigReferenceConnectionStringIDInsensitively(input string) (*ConfigR return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigReferenceConnectionStringId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ConfigReferenceConnectionStringId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.ConnectionStringKey, ok = parsed.Parsed["connectionStringKey"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionStringKey", *parsed) + if id.ConnectionStringKey, ok = input.Parsed["connectionStringKey"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectionStringKey", input) } - return &id, nil + return nil } // ValidateConfigReferenceConnectionStringID checks that 'input' can be parsed as a Config Reference Connection String ID diff --git a/resource-manager/web/2022-09-01/webapps/id_connectionstring.go b/resource-manager/web/2022-09-01/webapps/id_connectionstring.go index 4f03d7e906a..0026da1c832 100644 --- a/resource-manager/web/2022-09-01/webapps/id_connectionstring.go +++ b/resource-manager/web/2022-09-01/webapps/id_connectionstring.go @@ -38,23 +38,9 @@ func ParseConnectionStringID(input string) (*ConnectionStringId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionStringId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.ConnectionStringKey, ok = parsed.Parsed["connectionStringKey"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionStringKey", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConnectionStringIDInsensitively(input string) (*ConnectionStringId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionStringId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConnectionStringId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.ConnectionStringKey, ok = parsed.Parsed["connectionStringKey"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionStringKey", *parsed) + if id.ConnectionStringKey, ok = input.Parsed["connectionStringKey"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectionStringKey", input) } - return &id, nil + return nil } // ValidateConnectionStringID checks that 'input' can be parsed as a Connection String ID diff --git a/resource-manager/web/2022-09-01/webapps/id_continuouswebjob.go b/resource-manager/web/2022-09-01/webapps/id_continuouswebjob.go index 82914ec65a2..db74d01b1ae 100644 --- a/resource-manager/web/2022-09-01/webapps/id_continuouswebjob.go +++ b/resource-manager/web/2022-09-01/webapps/id_continuouswebjob.go @@ -38,23 +38,9 @@ func ParseContinuousWebJobID(input string) (*ContinuousWebJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContinuousWebJobId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.ContinuousWebJobName, ok = parsed.Parsed["continuousWebJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "continuousWebJobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseContinuousWebJobIDInsensitively(input string) (*ContinuousWebJobId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContinuousWebJobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ContinuousWebJobId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.ContinuousWebJobName, ok = parsed.Parsed["continuousWebJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "continuousWebJobName", *parsed) + if id.ContinuousWebJobName, ok = input.Parsed["continuousWebJobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "continuousWebJobName", input) } - return &id, nil + return nil } // ValidateContinuousWebJobID checks that 'input' can be parsed as a Continuous Web Job ID diff --git a/resource-manager/web/2022-09-01/webapps/id_default.go b/resource-manager/web/2022-09-01/webapps/id_default.go index a45b0d91911..2504429e1f3 100644 --- a/resource-manager/web/2022-09-01/webapps/id_default.go +++ b/resource-manager/web/2022-09-01/webapps/id_default.go @@ -40,27 +40,9 @@ func ParseDefaultID(input string) (*DefaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DefaultId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.DefaultName, ok = parsed.Parsed["defaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "defaultName", *parsed) - } - - if id.KeyName, ok = parsed.Parsed["keyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseDefaultIDInsensitively(input string) (*DefaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DefaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DefaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.DefaultName, ok = parsed.Parsed["defaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "defaultName", *parsed) + if id.DefaultName, ok = input.Parsed["defaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "defaultName", input) } - if id.KeyName, ok = parsed.Parsed["keyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyName", *parsed) + if id.KeyName, ok = input.Parsed["keyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "keyName", input) } - return &id, nil + return nil } // ValidateDefaultID checks that 'input' can be parsed as a Default ID diff --git a/resource-manager/web/2022-09-01/webapps/id_deployment.go b/resource-manager/web/2022-09-01/webapps/id_deployment.go index d4512a8a345..b04a811e64d 100644 --- a/resource-manager/web/2022-09-01/webapps/id_deployment.go +++ b/resource-manager/web/2022-09-01/webapps/id_deployment.go @@ -38,23 +38,9 @@ func ParseDeploymentID(input string) (*DeploymentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeploymentId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDeploymentIDInsensitively(input string) (*DeploymentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeploymentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DeploymentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if id.DeploymentName, ok = input.Parsed["deploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", input) } - return &id, nil + return nil } // ValidateDeploymentID checks that 'input' can be parsed as a Deployment ID diff --git a/resource-manager/web/2022-09-01/webapps/id_domainownershipidentifier.go b/resource-manager/web/2022-09-01/webapps/id_domainownershipidentifier.go index 15e7aece781..4cb36ffe991 100644 --- a/resource-manager/web/2022-09-01/webapps/id_domainownershipidentifier.go +++ b/resource-manager/web/2022-09-01/webapps/id_domainownershipidentifier.go @@ -38,23 +38,9 @@ func ParseDomainOwnershipIdentifierID(input string) (*DomainOwnershipIdentifierI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DomainOwnershipIdentifierId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.DomainOwnershipIdentifierName, ok = parsed.Parsed["domainOwnershipIdentifierName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainOwnershipIdentifierName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDomainOwnershipIdentifierIDInsensitively(input string) (*DomainOwnersh return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DomainOwnershipIdentifierId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DomainOwnershipIdentifierId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.DomainOwnershipIdentifierName, ok = parsed.Parsed["domainOwnershipIdentifierName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainOwnershipIdentifierName", *parsed) + if id.DomainOwnershipIdentifierName, ok = input.Parsed["domainOwnershipIdentifierName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "domainOwnershipIdentifierName", input) } - return &id, nil + return nil } // ValidateDomainOwnershipIdentifierID checks that 'input' can be parsed as a Domain Ownership Identifier ID diff --git a/resource-manager/web/2022-09-01/webapps/id_function.go b/resource-manager/web/2022-09-01/webapps/id_function.go index c4cc0117dfa..50ec22415e9 100644 --- a/resource-manager/web/2022-09-01/webapps/id_function.go +++ b/resource-manager/web/2022-09-01/webapps/id_function.go @@ -38,23 +38,9 @@ func ParseFunctionID(input string) (*FunctionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FunctionId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.FunctionName, ok = parsed.Parsed["functionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "functionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFunctionIDInsensitively(input string) (*FunctionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FunctionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FunctionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.FunctionName, ok = parsed.Parsed["functionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "functionName", *parsed) + if id.FunctionName, ok = input.Parsed["functionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "functionName", input) } - return &id, nil + return nil } // ValidateFunctionID checks that 'input' can be parsed as a Function ID diff --git a/resource-manager/web/2022-09-01/webapps/id_functionkey.go b/resource-manager/web/2022-09-01/webapps/id_functionkey.go index 5b7393d379b..8bde4cda147 100644 --- a/resource-manager/web/2022-09-01/webapps/id_functionkey.go +++ b/resource-manager/web/2022-09-01/webapps/id_functionkey.go @@ -42,31 +42,9 @@ func ParseFunctionKeyID(input string) (*FunctionKeyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FunctionKeyId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.FunctionName, ok = parsed.Parsed["functionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "functionName", *parsed) - } - - if id.KeyName, ok = parsed.Parsed["keyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseFunctionKeyIDInsensitively(input string) (*FunctionKeyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FunctionKeyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FunctionKeyId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.FunctionName, ok = parsed.Parsed["functionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "functionName", *parsed) + if id.FunctionName, ok = input.Parsed["functionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "functionName", input) } - if id.KeyName, ok = parsed.Parsed["keyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyName", *parsed) + if id.KeyName, ok = input.Parsed["keyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "keyName", input) } - return &id, nil + return nil } // ValidateFunctionKeyID checks that 'input' can be parsed as a Function Key ID diff --git a/resource-manager/web/2022-09-01/webapps/id_gateway.go b/resource-manager/web/2022-09-01/webapps/id_gateway.go index 0f44bbd3940..89657833244 100644 --- a/resource-manager/web/2022-09-01/webapps/id_gateway.go +++ b/resource-manager/web/2022-09-01/webapps/id_gateway.go @@ -40,27 +40,9 @@ func ParseGatewayID(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.VirtualNetworkConnectionName, ok = parsed.Parsed["virtualNetworkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkConnectionName", *parsed) - } - - if id.GatewayName, ok = parsed.Parsed["gatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseGatewayIDInsensitively(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *GatewayId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.VirtualNetworkConnectionName, ok = parsed.Parsed["virtualNetworkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkConnectionName", *parsed) + if id.VirtualNetworkConnectionName, ok = input.Parsed["virtualNetworkConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkConnectionName", input) } - if id.GatewayName, ok = parsed.Parsed["gatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayName", *parsed) + if id.GatewayName, ok = input.Parsed["gatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayName", input) } - return &id, nil + return nil } // ValidateGatewayID checks that 'input' can be parsed as a Gateway ID diff --git a/resource-manager/web/2022-09-01/webapps/id_history.go b/resource-manager/web/2022-09-01/webapps/id_history.go index f4909efba3b..1c0ca4de4d6 100644 --- a/resource-manager/web/2022-09-01/webapps/id_history.go +++ b/resource-manager/web/2022-09-01/webapps/id_history.go @@ -40,27 +40,9 @@ func ParseHistoryID(input string) (*HistoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HistoryId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.TriggeredWebJobName, ok = parsed.Parsed["triggeredWebJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggeredWebJobName", *parsed) - } - - if id.HistoryName, ok = parsed.Parsed["historyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "historyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseHistoryIDInsensitively(input string) (*HistoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HistoryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *HistoryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.TriggeredWebJobName, ok = parsed.Parsed["triggeredWebJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggeredWebJobName", *parsed) + if id.TriggeredWebJobName, ok = input.Parsed["triggeredWebJobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "triggeredWebJobName", input) } - if id.HistoryName, ok = parsed.Parsed["historyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "historyName", *parsed) + if id.HistoryName, ok = input.Parsed["historyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "historyName", input) } - return &id, nil + return nil } // ValidateHistoryID checks that 'input' can be parsed as a History ID diff --git a/resource-manager/web/2022-09-01/webapps/id_hostdefault.go b/resource-manager/web/2022-09-01/webapps/id_hostdefault.go index 9d971ecb036..8786787ad05 100644 --- a/resource-manager/web/2022-09-01/webapps/id_hostdefault.go +++ b/resource-manager/web/2022-09-01/webapps/id_hostdefault.go @@ -42,31 +42,9 @@ func ParseHostDefaultID(input string) (*HostDefaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostDefaultId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.DefaultName, ok = parsed.Parsed["defaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "defaultName", *parsed) - } - - if id.KeyName, ok = parsed.Parsed["keyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseHostDefaultIDInsensitively(input string) (*HostDefaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostDefaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *HostDefaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.DefaultName, ok = parsed.Parsed["defaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "defaultName", *parsed) + if id.DefaultName, ok = input.Parsed["defaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "defaultName", input) } - if id.KeyName, ok = parsed.Parsed["keyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyName", *parsed) + if id.KeyName, ok = input.Parsed["keyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "keyName", input) } - return &id, nil + return nil } // ValidateHostDefaultID checks that 'input' can be parsed as a Host Default ID diff --git a/resource-manager/web/2022-09-01/webapps/id_hostnamebinding.go b/resource-manager/web/2022-09-01/webapps/id_hostnamebinding.go index 2c7d264c7f7..445cdd8c1f4 100644 --- a/resource-manager/web/2022-09-01/webapps/id_hostnamebinding.go +++ b/resource-manager/web/2022-09-01/webapps/id_hostnamebinding.go @@ -38,23 +38,9 @@ func ParseHostNameBindingID(input string) (*HostNameBindingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostNameBindingId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.HostNameBindingName, ok = parsed.Parsed["hostNameBindingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostNameBindingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseHostNameBindingIDInsensitively(input string) (*HostNameBindingId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostNameBindingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *HostNameBindingId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.HostNameBindingName, ok = parsed.Parsed["hostNameBindingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostNameBindingName", *parsed) + if id.HostNameBindingName, ok = input.Parsed["hostNameBindingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostNameBindingName", input) } - return &id, nil + return nil } // ValidateHostNameBindingID checks that 'input' can be parsed as a Host Name Binding ID diff --git a/resource-manager/web/2022-09-01/webapps/id_hybridconnection.go b/resource-manager/web/2022-09-01/webapps/id_hybridconnection.go index 37b10cd84ef..05a52ef303c 100644 --- a/resource-manager/web/2022-09-01/webapps/id_hybridconnection.go +++ b/resource-manager/web/2022-09-01/webapps/id_hybridconnection.go @@ -38,23 +38,9 @@ func ParseHybridConnectionID(input string) (*HybridConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HybridConnectionId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.HybridConnectionName, ok = parsed.Parsed["hybridConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseHybridConnectionIDInsensitively(input string) (*HybridConnectionId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HybridConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *HybridConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.HybridConnectionName, ok = parsed.Parsed["hybridConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridConnectionName", *parsed) + if id.HybridConnectionName, ok = input.Parsed["hybridConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hybridConnectionName", input) } - return &id, nil + return nil } // ValidateHybridConnectionID checks that 'input' can be parsed as a Hybrid Connection ID diff --git a/resource-manager/web/2022-09-01/webapps/id_instance.go b/resource-manager/web/2022-09-01/webapps/id_instance.go index 47c279d2780..b71b552f4a3 100644 --- a/resource-manager/web/2022-09-01/webapps/id_instance.go +++ b/resource-manager/web/2022-09-01/webapps/id_instance.go @@ -38,23 +38,9 @@ func ParseInstanceID(input string) (*InstanceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InstanceId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseInstanceIDInsensitively(input string) (*InstanceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *InstanceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if id.InstanceId, ok = input.Parsed["instanceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceId", input) } - return &id, nil + return nil } // ValidateInstanceID checks that 'input' can be parsed as a Instance ID diff --git a/resource-manager/web/2022-09-01/webapps/id_instanceprocess.go b/resource-manager/web/2022-09-01/webapps/id_instanceprocess.go index be393773799..d63ca842bbe 100644 --- a/resource-manager/web/2022-09-01/webapps/id_instanceprocess.go +++ b/resource-manager/web/2022-09-01/webapps/id_instanceprocess.go @@ -40,27 +40,9 @@ func ParseInstanceProcessID(input string) (*InstanceProcessId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InstanceProcessId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) - } - - if id.ProcessId, ok = parsed.Parsed["processId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "processId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseInstanceProcessIDInsensitively(input string) (*InstanceProcessId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InstanceProcessId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *InstanceProcessId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if id.InstanceId, ok = input.Parsed["instanceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceId", input) } - if id.ProcessId, ok = parsed.Parsed["processId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "processId", *parsed) + if id.ProcessId, ok = input.Parsed["processId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "processId", input) } - return &id, nil + return nil } // ValidateInstanceProcessID checks that 'input' can be parsed as a Instance Process ID diff --git a/resource-manager/web/2022-09-01/webapps/id_instanceprocessmodule.go b/resource-manager/web/2022-09-01/webapps/id_instanceprocessmodule.go index b9bd89816da..f05e0fc2d20 100644 --- a/resource-manager/web/2022-09-01/webapps/id_instanceprocessmodule.go +++ b/resource-manager/web/2022-09-01/webapps/id_instanceprocessmodule.go @@ -42,31 +42,9 @@ func ParseInstanceProcessModuleID(input string) (*InstanceProcessModuleId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InstanceProcessModuleId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) - } - - if id.ProcessId, ok = parsed.Parsed["processId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "processId", *parsed) - } - - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseInstanceProcessModuleIDInsensitively(input string) (*InstanceProcessMo return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InstanceProcessModuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *InstanceProcessModuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if id.InstanceId, ok = input.Parsed["instanceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceId", input) } - if id.ProcessId, ok = parsed.Parsed["processId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "processId", *parsed) + if id.ProcessId, ok = input.Parsed["processId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "processId", input) } - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if id.ModuleName, ok = input.Parsed["moduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "moduleName", input) } - return &id, nil + return nil } // ValidateInstanceProcessModuleID checks that 'input' can be parsed as a Instance Process Module ID diff --git a/resource-manager/web/2022-09-01/webapps/id_key.go b/resource-manager/web/2022-09-01/webapps/id_key.go index c0a9c0a06f9..c24d2c75274 100644 --- a/resource-manager/web/2022-09-01/webapps/id_key.go +++ b/resource-manager/web/2022-09-01/webapps/id_key.go @@ -40,27 +40,9 @@ func ParseKeyID(input string) (*KeyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := KeyId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.FunctionName, ok = parsed.Parsed["functionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "functionName", *parsed) - } - - if id.KeyName, ok = parsed.Parsed["keyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseKeyIDInsensitively(input string) (*KeyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := KeyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *KeyId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.FunctionName, ok = parsed.Parsed["functionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "functionName", *parsed) + if id.FunctionName, ok = input.Parsed["functionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "functionName", input) } - if id.KeyName, ok = parsed.Parsed["keyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyName", *parsed) + if id.KeyName, ok = input.Parsed["keyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "keyName", input) } - return &id, nil + return nil } // ValidateKeyID checks that 'input' can be parsed as a Key ID diff --git a/resource-manager/web/2022-09-01/webapps/id_module.go b/resource-manager/web/2022-09-01/webapps/id_module.go index 8efcceee146..4992de29755 100644 --- a/resource-manager/web/2022-09-01/webapps/id_module.go +++ b/resource-manager/web/2022-09-01/webapps/id_module.go @@ -40,27 +40,9 @@ func ParseModuleID(input string) (*ModuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModuleId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.ProcessId, ok = parsed.Parsed["processId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "processId", *parsed) - } - - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseModuleIDInsensitively(input string) (*ModuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ModuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.ProcessId, ok = parsed.Parsed["processId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "processId", *parsed) + if id.ProcessId, ok = input.Parsed["processId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "processId", input) } - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if id.ModuleName, ok = input.Parsed["moduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "moduleName", input) } - return &id, nil + return nil } // ValidateModuleID checks that 'input' can be parsed as a Module ID diff --git a/resource-manager/web/2022-09-01/webapps/id_networkfeature.go b/resource-manager/web/2022-09-01/webapps/id_networkfeature.go index e75d15419bc..39aca6abdad 100644 --- a/resource-manager/web/2022-09-01/webapps/id_networkfeature.go +++ b/resource-manager/web/2022-09-01/webapps/id_networkfeature.go @@ -38,23 +38,9 @@ func ParseNetworkFeatureID(input string) (*NetworkFeatureId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkFeatureId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.NetworkFeatureName, ok = parsed.Parsed["networkFeatureName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkFeatureName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseNetworkFeatureIDInsensitively(input string) (*NetworkFeatureId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkFeatureId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *NetworkFeatureId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.NetworkFeatureName, ok = parsed.Parsed["networkFeatureName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkFeatureName", *parsed) + if id.NetworkFeatureName, ok = input.Parsed["networkFeatureName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkFeatureName", input) } - return &id, nil + return nil } // ValidateNetworkFeatureID checks that 'input' can be parsed as a Network Feature ID diff --git a/resource-manager/web/2022-09-01/webapps/id_networktrace.go b/resource-manager/web/2022-09-01/webapps/id_networktrace.go index b81b95a9de2..2649b121ba4 100644 --- a/resource-manager/web/2022-09-01/webapps/id_networktrace.go +++ b/resource-manager/web/2022-09-01/webapps/id_networktrace.go @@ -38,23 +38,9 @@ func ParseNetworkTraceID(input string) (*NetworkTraceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkTraceId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseNetworkTraceIDInsensitively(input string) (*NetworkTraceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkTraceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *NetworkTraceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if id.OperationId, ok = input.Parsed["operationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "operationId", input) } - return &id, nil + return nil } // ValidateNetworkTraceID checks that 'input' can be parsed as a Network Trace ID diff --git a/resource-manager/web/2022-09-01/webapps/id_premieraddon.go b/resource-manager/web/2022-09-01/webapps/id_premieraddon.go index c3b272f1e88..2d423b516ec 100644 --- a/resource-manager/web/2022-09-01/webapps/id_premieraddon.go +++ b/resource-manager/web/2022-09-01/webapps/id_premieraddon.go @@ -38,23 +38,9 @@ func ParsePremierAddonID(input string) (*PremierAddonId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PremierAddonId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.PremierAddonName, ok = parsed.Parsed["premierAddonName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "premierAddonName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePremierAddonIDInsensitively(input string) (*PremierAddonId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PremierAddonId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PremierAddonId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.PremierAddonName, ok = parsed.Parsed["premierAddonName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "premierAddonName", *parsed) + if id.PremierAddonName, ok = input.Parsed["premierAddonName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "premierAddonName", input) } - return &id, nil + return nil } // ValidatePremierAddonID checks that 'input' can be parsed as a Premier Addon ID diff --git a/resource-manager/web/2022-09-01/webapps/id_privateendpointconnection.go b/resource-manager/web/2022-09-01/webapps/id_privateendpointconnection.go index 310dae565b0..3295084d8a6 100644 --- a/resource-manager/web/2022-09-01/webapps/id_privateendpointconnection.go +++ b/resource-manager/web/2022-09-01/webapps/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/web/2022-09-01/webapps/id_process.go b/resource-manager/web/2022-09-01/webapps/id_process.go index b5217930469..8bad3c8ed48 100644 --- a/resource-manager/web/2022-09-01/webapps/id_process.go +++ b/resource-manager/web/2022-09-01/webapps/id_process.go @@ -38,23 +38,9 @@ func ParseProcessID(input string) (*ProcessId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProcessId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.ProcessId, ok = parsed.Parsed["processId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "processId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProcessIDInsensitively(input string) (*ProcessId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProcessId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProcessId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.ProcessId, ok = parsed.Parsed["processId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "processId", *parsed) + if id.ProcessId, ok = input.Parsed["processId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "processId", input) } - return &id, nil + return nil } // ValidateProcessID checks that 'input' can be parsed as a Process ID diff --git a/resource-manager/web/2022-09-01/webapps/id_processmodule.go b/resource-manager/web/2022-09-01/webapps/id_processmodule.go index 8b363ea518e..b4c90cb7011 100644 --- a/resource-manager/web/2022-09-01/webapps/id_processmodule.go +++ b/resource-manager/web/2022-09-01/webapps/id_processmodule.go @@ -42,31 +42,9 @@ func ParseProcessModuleID(input string) (*ProcessModuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProcessModuleId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.ProcessId, ok = parsed.Parsed["processId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "processId", *parsed) - } - - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseProcessModuleIDInsensitively(input string) (*ProcessModuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProcessModuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProcessModuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.ProcessId, ok = parsed.Parsed["processId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "processId", *parsed) + if id.ProcessId, ok = input.Parsed["processId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "processId", input) } - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if id.ModuleName, ok = input.Parsed["moduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "moduleName", input) } - return &id, nil + return nil } // ValidateProcessModuleID checks that 'input' can be parsed as a Process Module ID diff --git a/resource-manager/web/2022-09-01/webapps/id_publiccertificate.go b/resource-manager/web/2022-09-01/webapps/id_publiccertificate.go index 1a084e11fe5..5af96c29d89 100644 --- a/resource-manager/web/2022-09-01/webapps/id_publiccertificate.go +++ b/resource-manager/web/2022-09-01/webapps/id_publiccertificate.go @@ -38,23 +38,9 @@ func ParsePublicCertificateID(input string) (*PublicCertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PublicCertificateId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.PublicCertificateName, ok = parsed.Parsed["publicCertificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publicCertificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePublicCertificateIDInsensitively(input string) (*PublicCertificateId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PublicCertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PublicCertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.PublicCertificateName, ok = parsed.Parsed["publicCertificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publicCertificateName", *parsed) + if id.PublicCertificateName, ok = input.Parsed["publicCertificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publicCertificateName", input) } - return &id, nil + return nil } // ValidatePublicCertificateID checks that 'input' can be parsed as a Public Certificate ID diff --git a/resource-manager/web/2022-09-01/webapps/id_relay.go b/resource-manager/web/2022-09-01/webapps/id_relay.go index a5e88bad4d9..b7ef581f158 100644 --- a/resource-manager/web/2022-09-01/webapps/id_relay.go +++ b/resource-manager/web/2022-09-01/webapps/id_relay.go @@ -40,27 +40,9 @@ func ParseRelayID(input string) (*RelayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RelayId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.HybridConnectionNamespaceName, ok = parsed.Parsed["hybridConnectionNamespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridConnectionNamespaceName", *parsed) - } - - if id.RelayName, ok = parsed.Parsed["relayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "relayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseRelayIDInsensitively(input string) (*RelayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RelayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RelayId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.HybridConnectionNamespaceName, ok = parsed.Parsed["hybridConnectionNamespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridConnectionNamespaceName", *parsed) + if id.HybridConnectionNamespaceName, ok = input.Parsed["hybridConnectionNamespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hybridConnectionNamespaceName", input) } - if id.RelayName, ok = parsed.Parsed["relayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "relayName", *parsed) + if id.RelayName, ok = input.Parsed["relayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "relayName", input) } - return &id, nil + return nil } // ValidateRelayID checks that 'input' can be parsed as a Relay ID diff --git a/resource-manager/web/2022-09-01/webapps/id_siteextension.go b/resource-manager/web/2022-09-01/webapps/id_siteextension.go index 07356e96dd7..24bc8cfac4e 100644 --- a/resource-manager/web/2022-09-01/webapps/id_siteextension.go +++ b/resource-manager/web/2022-09-01/webapps/id_siteextension.go @@ -38,23 +38,9 @@ func ParseSiteExtensionID(input string) (*SiteExtensionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SiteExtensionId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SiteExtensionId, ok = parsed.Parsed["siteExtensionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteExtensionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSiteExtensionIDInsensitively(input string) (*SiteExtensionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SiteExtensionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SiteExtensionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SiteExtensionId, ok = parsed.Parsed["siteExtensionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteExtensionId", *parsed) + if id.SiteExtensionId, ok = input.Parsed["siteExtensionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteExtensionId", input) } - return &id, nil + return nil } // ValidateSiteExtensionID checks that 'input' can be parsed as a Site Extension ID diff --git a/resource-manager/web/2022-09-01/webapps/id_sitenetworktrace.go b/resource-manager/web/2022-09-01/webapps/id_sitenetworktrace.go index 72d8a65f302..5e6ddf37b2f 100644 --- a/resource-manager/web/2022-09-01/webapps/id_sitenetworktrace.go +++ b/resource-manager/web/2022-09-01/webapps/id_sitenetworktrace.go @@ -38,23 +38,9 @@ func ParseSiteNetworkTraceID(input string) (*SiteNetworkTraceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SiteNetworkTraceId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSiteNetworkTraceIDInsensitively(input string) (*SiteNetworkTraceId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SiteNetworkTraceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SiteNetworkTraceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if id.OperationId, ok = input.Parsed["operationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "operationId", input) } - return &id, nil + return nil } // ValidateSiteNetworkTraceID checks that 'input' can be parsed as a Site Network Trace ID diff --git a/resource-manager/web/2022-09-01/webapps/id_siteslotnetworktrace.go b/resource-manager/web/2022-09-01/webapps/id_siteslotnetworktrace.go index ca1f4a58702..5c23156040b 100644 --- a/resource-manager/web/2022-09-01/webapps/id_siteslotnetworktrace.go +++ b/resource-manager/web/2022-09-01/webapps/id_siteslotnetworktrace.go @@ -40,27 +40,9 @@ func ParseSiteSlotNetworkTraceID(input string) (*SiteSlotNetworkTraceId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SiteSlotNetworkTraceId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSiteSlotNetworkTraceIDInsensitively(input string) (*SiteSlotNetworkTra return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SiteSlotNetworkTraceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SiteSlotNetworkTraceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if id.OperationId, ok = input.Parsed["operationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "operationId", input) } - return &id, nil + return nil } // ValidateSiteSlotNetworkTraceID checks that 'input' can be parsed as a Site Slot Network Trace ID diff --git a/resource-manager/web/2022-09-01/webapps/id_slot.go b/resource-manager/web/2022-09-01/webapps/id_slot.go index ac867ad4a87..e15a92882f1 100644 --- a/resource-manager/web/2022-09-01/webapps/id_slot.go +++ b/resource-manager/web/2022-09-01/webapps/id_slot.go @@ -38,23 +38,9 @@ func ParseSlotID(input string) (*SlotId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSlotIDInsensitively(input string) (*SlotId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SlotId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - return &id, nil + return nil } // ValidateSlotID checks that 'input' can be parsed as a Slot ID diff --git a/resource-manager/web/2022-09-01/webapps/id_slotbackup.go b/resource-manager/web/2022-09-01/webapps/id_slotbackup.go index d1d78f34add..196d2ef7799 100644 --- a/resource-manager/web/2022-09-01/webapps/id_slotbackup.go +++ b/resource-manager/web/2022-09-01/webapps/id_slotbackup.go @@ -40,27 +40,9 @@ func ParseSlotBackupID(input string) (*SlotBackupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotBackupId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.BackupId, ok = parsed.Parsed["backupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSlotBackupIDInsensitively(input string) (*SlotBackupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotBackupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SlotBackupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.BackupId, ok = parsed.Parsed["backupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupId", *parsed) + if id.BackupId, ok = input.Parsed["backupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupId", input) } - return &id, nil + return nil } // ValidateSlotBackupID checks that 'input' can be parsed as a Slot Backup ID diff --git a/resource-manager/web/2022-09-01/webapps/id_slotcontinuouswebjob.go b/resource-manager/web/2022-09-01/webapps/id_slotcontinuouswebjob.go index 8f684a225b9..fdacebe446a 100644 --- a/resource-manager/web/2022-09-01/webapps/id_slotcontinuouswebjob.go +++ b/resource-manager/web/2022-09-01/webapps/id_slotcontinuouswebjob.go @@ -40,27 +40,9 @@ func ParseSlotContinuousWebJobID(input string) (*SlotContinuousWebJobId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotContinuousWebJobId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.ContinuousWebJobName, ok = parsed.Parsed["continuousWebJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "continuousWebJobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSlotContinuousWebJobIDInsensitively(input string) (*SlotContinuousWebJ return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotContinuousWebJobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SlotContinuousWebJobId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.ContinuousWebJobName, ok = parsed.Parsed["continuousWebJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "continuousWebJobName", *parsed) + if id.ContinuousWebJobName, ok = input.Parsed["continuousWebJobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "continuousWebJobName", input) } - return &id, nil + return nil } // ValidateSlotContinuousWebJobID checks that 'input' can be parsed as a Slot Continuous Web Job ID diff --git a/resource-manager/web/2022-09-01/webapps/id_slotdeployment.go b/resource-manager/web/2022-09-01/webapps/id_slotdeployment.go index 6549fb21156..1c06c19237b 100644 --- a/resource-manager/web/2022-09-01/webapps/id_slotdeployment.go +++ b/resource-manager/web/2022-09-01/webapps/id_slotdeployment.go @@ -40,27 +40,9 @@ func ParseSlotDeploymentID(input string) (*SlotDeploymentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotDeploymentId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSlotDeploymentIDInsensitively(input string) (*SlotDeploymentId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotDeploymentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SlotDeploymentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if id.DeploymentName, ok = input.Parsed["deploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", input) } - return &id, nil + return nil } // ValidateSlotDeploymentID checks that 'input' can be parsed as a Slot Deployment ID diff --git a/resource-manager/web/2022-09-01/webapps/id_slotdomainownershipidentifier.go b/resource-manager/web/2022-09-01/webapps/id_slotdomainownershipidentifier.go index fbfa235a874..a204baad734 100644 --- a/resource-manager/web/2022-09-01/webapps/id_slotdomainownershipidentifier.go +++ b/resource-manager/web/2022-09-01/webapps/id_slotdomainownershipidentifier.go @@ -40,27 +40,9 @@ func ParseSlotDomainOwnershipIdentifierID(input string) (*SlotDomainOwnershipIde return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotDomainOwnershipIdentifierId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.DomainOwnershipIdentifierName, ok = parsed.Parsed["domainOwnershipIdentifierName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainOwnershipIdentifierName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSlotDomainOwnershipIdentifierIDInsensitively(input string) (*SlotDomai return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotDomainOwnershipIdentifierId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SlotDomainOwnershipIdentifierId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.DomainOwnershipIdentifierName, ok = parsed.Parsed["domainOwnershipIdentifierName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainOwnershipIdentifierName", *parsed) + if id.DomainOwnershipIdentifierName, ok = input.Parsed["domainOwnershipIdentifierName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "domainOwnershipIdentifierName", input) } - return &id, nil + return nil } // ValidateSlotDomainOwnershipIdentifierID checks that 'input' can be parsed as a Slot Domain Ownership Identifier ID diff --git a/resource-manager/web/2022-09-01/webapps/id_slotfunction.go b/resource-manager/web/2022-09-01/webapps/id_slotfunction.go index 468949e855c..47101ae28cb 100644 --- a/resource-manager/web/2022-09-01/webapps/id_slotfunction.go +++ b/resource-manager/web/2022-09-01/webapps/id_slotfunction.go @@ -40,27 +40,9 @@ func ParseSlotFunctionID(input string) (*SlotFunctionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotFunctionId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.FunctionName, ok = parsed.Parsed["functionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "functionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSlotFunctionIDInsensitively(input string) (*SlotFunctionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotFunctionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SlotFunctionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.FunctionName, ok = parsed.Parsed["functionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "functionName", *parsed) + if id.FunctionName, ok = input.Parsed["functionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "functionName", input) } - return &id, nil + return nil } // ValidateSlotFunctionID checks that 'input' can be parsed as a Slot Function ID diff --git a/resource-manager/web/2022-09-01/webapps/id_slothostnamebinding.go b/resource-manager/web/2022-09-01/webapps/id_slothostnamebinding.go index 68dabae59c2..9b914c92db9 100644 --- a/resource-manager/web/2022-09-01/webapps/id_slothostnamebinding.go +++ b/resource-manager/web/2022-09-01/webapps/id_slothostnamebinding.go @@ -40,27 +40,9 @@ func ParseSlotHostNameBindingID(input string) (*SlotHostNameBindingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotHostNameBindingId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.HostNameBindingName, ok = parsed.Parsed["hostNameBindingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostNameBindingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSlotHostNameBindingIDInsensitively(input string) (*SlotHostNameBinding return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotHostNameBindingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SlotHostNameBindingId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.HostNameBindingName, ok = parsed.Parsed["hostNameBindingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostNameBindingName", *parsed) + if id.HostNameBindingName, ok = input.Parsed["hostNameBindingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostNameBindingName", input) } - return &id, nil + return nil } // ValidateSlotHostNameBindingID checks that 'input' can be parsed as a Slot Host Name Binding ID diff --git a/resource-manager/web/2022-09-01/webapps/id_slothybridconnection.go b/resource-manager/web/2022-09-01/webapps/id_slothybridconnection.go index 9c2b5677715..6d48ba38f6c 100644 --- a/resource-manager/web/2022-09-01/webapps/id_slothybridconnection.go +++ b/resource-manager/web/2022-09-01/webapps/id_slothybridconnection.go @@ -40,27 +40,9 @@ func ParseSlotHybridConnectionID(input string) (*SlotHybridConnectionId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotHybridConnectionId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.HybridConnectionName, ok = parsed.Parsed["hybridConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSlotHybridConnectionIDInsensitively(input string) (*SlotHybridConnecti return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotHybridConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SlotHybridConnectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.HybridConnectionName, ok = parsed.Parsed["hybridConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridConnectionName", *parsed) + if id.HybridConnectionName, ok = input.Parsed["hybridConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hybridConnectionName", input) } - return &id, nil + return nil } // ValidateSlotHybridConnectionID checks that 'input' can be parsed as a Slot Hybrid Connection ID diff --git a/resource-manager/web/2022-09-01/webapps/id_slothybridconnectionnamespacerelay.go b/resource-manager/web/2022-09-01/webapps/id_slothybridconnectionnamespacerelay.go index 0e228fde8ed..3822d459f6a 100644 --- a/resource-manager/web/2022-09-01/webapps/id_slothybridconnectionnamespacerelay.go +++ b/resource-manager/web/2022-09-01/webapps/id_slothybridconnectionnamespacerelay.go @@ -42,31 +42,9 @@ func ParseSlotHybridConnectionNamespaceRelayID(input string) (*SlotHybridConnect return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotHybridConnectionNamespaceRelayId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.HybridConnectionNamespaceName, ok = parsed.Parsed["hybridConnectionNamespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridConnectionNamespaceName", *parsed) - } - - if id.RelayName, ok = parsed.Parsed["relayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "relayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseSlotHybridConnectionNamespaceRelayIDInsensitively(input string) (*Slot return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotHybridConnectionNamespaceRelayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SlotHybridConnectionNamespaceRelayId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.HybridConnectionNamespaceName, ok = parsed.Parsed["hybridConnectionNamespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridConnectionNamespaceName", *parsed) + if id.HybridConnectionNamespaceName, ok = input.Parsed["hybridConnectionNamespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hybridConnectionNamespaceName", input) } - if id.RelayName, ok = parsed.Parsed["relayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "relayName", *parsed) + if id.RelayName, ok = input.Parsed["relayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "relayName", input) } - return &id, nil + return nil } // ValidateSlotHybridConnectionNamespaceRelayID checks that 'input' can be parsed as a Slot Hybrid Connection Namespace Relay ID diff --git a/resource-manager/web/2022-09-01/webapps/id_slotinstance.go b/resource-manager/web/2022-09-01/webapps/id_slotinstance.go index 63f1357757e..009666c7f05 100644 --- a/resource-manager/web/2022-09-01/webapps/id_slotinstance.go +++ b/resource-manager/web/2022-09-01/webapps/id_slotinstance.go @@ -40,27 +40,9 @@ func ParseSlotInstanceID(input string) (*SlotInstanceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotInstanceId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSlotInstanceIDInsensitively(input string) (*SlotInstanceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SlotInstanceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if id.InstanceId, ok = input.Parsed["instanceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceId", input) } - return &id, nil + return nil } // ValidateSlotInstanceID checks that 'input' can be parsed as a Slot Instance ID diff --git a/resource-manager/web/2022-09-01/webapps/id_slotinstanceprocess.go b/resource-manager/web/2022-09-01/webapps/id_slotinstanceprocess.go index 4b8c98a4970..796e2dc30aa 100644 --- a/resource-manager/web/2022-09-01/webapps/id_slotinstanceprocess.go +++ b/resource-manager/web/2022-09-01/webapps/id_slotinstanceprocess.go @@ -42,31 +42,9 @@ func ParseSlotInstanceProcessID(input string) (*SlotInstanceProcessId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotInstanceProcessId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) - } - - if id.ProcessId, ok = parsed.Parsed["processId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "processId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseSlotInstanceProcessIDInsensitively(input string) (*SlotInstanceProcess return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotInstanceProcessId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SlotInstanceProcessId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if id.InstanceId, ok = input.Parsed["instanceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceId", input) } - if id.ProcessId, ok = parsed.Parsed["processId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "processId", *parsed) + if id.ProcessId, ok = input.Parsed["processId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "processId", input) } - return &id, nil + return nil } // ValidateSlotInstanceProcessID checks that 'input' can be parsed as a Slot Instance Process ID diff --git a/resource-manager/web/2022-09-01/webapps/id_slotinstanceprocessmodule.go b/resource-manager/web/2022-09-01/webapps/id_slotinstanceprocessmodule.go index 1593d7a81dc..423930cd9de 100644 --- a/resource-manager/web/2022-09-01/webapps/id_slotinstanceprocessmodule.go +++ b/resource-manager/web/2022-09-01/webapps/id_slotinstanceprocessmodule.go @@ -44,35 +44,9 @@ func ParseSlotInstanceProcessModuleID(input string) (*SlotInstanceProcessModuleI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotInstanceProcessModuleId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) - } - - if id.ProcessId, ok = parsed.Parsed["processId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "processId", *parsed) - } - - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseSlotInstanceProcessModuleIDInsensitively(input string) (*SlotInstanceP return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotInstanceProcessModuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SlotInstanceProcessModuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if id.InstanceId, ok = input.Parsed["instanceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceId", input) } - if id.ProcessId, ok = parsed.Parsed["processId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "processId", *parsed) + if id.ProcessId, ok = input.Parsed["processId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "processId", input) } - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if id.ModuleName, ok = input.Parsed["moduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "moduleName", input) } - return &id, nil + return nil } // ValidateSlotInstanceProcessModuleID checks that 'input' can be parsed as a Slot Instance Process Module ID diff --git a/resource-manager/web/2022-09-01/webapps/id_slotnetworkfeature.go b/resource-manager/web/2022-09-01/webapps/id_slotnetworkfeature.go index e2efece4733..37161d178ca 100644 --- a/resource-manager/web/2022-09-01/webapps/id_slotnetworkfeature.go +++ b/resource-manager/web/2022-09-01/webapps/id_slotnetworkfeature.go @@ -40,27 +40,9 @@ func ParseSlotNetworkFeatureID(input string) (*SlotNetworkFeatureId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotNetworkFeatureId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.NetworkFeatureName, ok = parsed.Parsed["networkFeatureName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkFeatureName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSlotNetworkFeatureIDInsensitively(input string) (*SlotNetworkFeatureId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotNetworkFeatureId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SlotNetworkFeatureId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.NetworkFeatureName, ok = parsed.Parsed["networkFeatureName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkFeatureName", *parsed) + if id.NetworkFeatureName, ok = input.Parsed["networkFeatureName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkFeatureName", input) } - return &id, nil + return nil } // ValidateSlotNetworkFeatureID checks that 'input' can be parsed as a Slot Network Feature ID diff --git a/resource-manager/web/2022-09-01/webapps/id_slotnetworktrace.go b/resource-manager/web/2022-09-01/webapps/id_slotnetworktrace.go index f202a7b84d0..66c083ff8e8 100644 --- a/resource-manager/web/2022-09-01/webapps/id_slotnetworktrace.go +++ b/resource-manager/web/2022-09-01/webapps/id_slotnetworktrace.go @@ -40,27 +40,9 @@ func ParseSlotNetworkTraceID(input string) (*SlotNetworkTraceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotNetworkTraceId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSlotNetworkTraceIDInsensitively(input string) (*SlotNetworkTraceId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotNetworkTraceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SlotNetworkTraceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if id.OperationId, ok = input.Parsed["operationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "operationId", input) } - return &id, nil + return nil } // ValidateSlotNetworkTraceID checks that 'input' can be parsed as a Slot Network Trace ID diff --git a/resource-manager/web/2022-09-01/webapps/id_slotpremieraddon.go b/resource-manager/web/2022-09-01/webapps/id_slotpremieraddon.go index 7e4b160fa5e..e83e02065eb 100644 --- a/resource-manager/web/2022-09-01/webapps/id_slotpremieraddon.go +++ b/resource-manager/web/2022-09-01/webapps/id_slotpremieraddon.go @@ -40,27 +40,9 @@ func ParseSlotPremierAddonID(input string) (*SlotPremierAddonId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotPremierAddonId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.PremierAddonName, ok = parsed.Parsed["premierAddonName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "premierAddonName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSlotPremierAddonIDInsensitively(input string) (*SlotPremierAddonId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotPremierAddonId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SlotPremierAddonId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.PremierAddonName, ok = parsed.Parsed["premierAddonName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "premierAddonName", *parsed) + if id.PremierAddonName, ok = input.Parsed["premierAddonName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "premierAddonName", input) } - return &id, nil + return nil } // ValidateSlotPremierAddonID checks that 'input' can be parsed as a Slot Premier Addon ID diff --git a/resource-manager/web/2022-09-01/webapps/id_slotprivateendpointconnection.go b/resource-manager/web/2022-09-01/webapps/id_slotprivateendpointconnection.go index 460aa65f354..3c2041e9790 100644 --- a/resource-manager/web/2022-09-01/webapps/id_slotprivateendpointconnection.go +++ b/resource-manager/web/2022-09-01/webapps/id_slotprivateendpointconnection.go @@ -40,27 +40,9 @@ func ParseSlotPrivateEndpointConnectionID(input string) (*SlotPrivateEndpointCon return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotPrivateEndpointConnectionId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSlotPrivateEndpointConnectionIDInsensitively(input string) (*SlotPriva return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotPrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SlotPrivateEndpointConnectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidateSlotPrivateEndpointConnectionID checks that 'input' can be parsed as a Slot Private Endpoint Connection ID diff --git a/resource-manager/web/2022-09-01/webapps/id_slotprocess.go b/resource-manager/web/2022-09-01/webapps/id_slotprocess.go index c10a4e1045a..1bacecea3c5 100644 --- a/resource-manager/web/2022-09-01/webapps/id_slotprocess.go +++ b/resource-manager/web/2022-09-01/webapps/id_slotprocess.go @@ -40,27 +40,9 @@ func ParseSlotProcessID(input string) (*SlotProcessId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotProcessId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.ProcessId, ok = parsed.Parsed["processId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "processId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSlotProcessIDInsensitively(input string) (*SlotProcessId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotProcessId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SlotProcessId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.ProcessId, ok = parsed.Parsed["processId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "processId", *parsed) + if id.ProcessId, ok = input.Parsed["processId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "processId", input) } - return &id, nil + return nil } // ValidateSlotProcessID checks that 'input' can be parsed as a Slot Process ID diff --git a/resource-manager/web/2022-09-01/webapps/id_slotpubliccertificate.go b/resource-manager/web/2022-09-01/webapps/id_slotpubliccertificate.go index cc2ef07f4e5..5dc24ba58ca 100644 --- a/resource-manager/web/2022-09-01/webapps/id_slotpubliccertificate.go +++ b/resource-manager/web/2022-09-01/webapps/id_slotpubliccertificate.go @@ -40,27 +40,9 @@ func ParseSlotPublicCertificateID(input string) (*SlotPublicCertificateId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotPublicCertificateId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.PublicCertificateName, ok = parsed.Parsed["publicCertificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publicCertificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSlotPublicCertificateIDInsensitively(input string) (*SlotPublicCertifi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotPublicCertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SlotPublicCertificateId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.PublicCertificateName, ok = parsed.Parsed["publicCertificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publicCertificateName", *parsed) + if id.PublicCertificateName, ok = input.Parsed["publicCertificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publicCertificateName", input) } - return &id, nil + return nil } // ValidateSlotPublicCertificateID checks that 'input' can be parsed as a Slot Public Certificate ID diff --git a/resource-manager/web/2022-09-01/webapps/id_slotsiteextension.go b/resource-manager/web/2022-09-01/webapps/id_slotsiteextension.go index c2b469b4ead..794884bacc8 100644 --- a/resource-manager/web/2022-09-01/webapps/id_slotsiteextension.go +++ b/resource-manager/web/2022-09-01/webapps/id_slotsiteextension.go @@ -40,27 +40,9 @@ func ParseSlotSiteExtensionID(input string) (*SlotSiteExtensionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotSiteExtensionId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.SiteExtensionId, ok = parsed.Parsed["siteExtensionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteExtensionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSlotSiteExtensionIDInsensitively(input string) (*SlotSiteExtensionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotSiteExtensionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SlotSiteExtensionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.SiteExtensionId, ok = parsed.Parsed["siteExtensionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteExtensionId", *parsed) + if id.SiteExtensionId, ok = input.Parsed["siteExtensionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteExtensionId", input) } - return &id, nil + return nil } // ValidateSlotSiteExtensionID checks that 'input' can be parsed as a Slot Site Extension ID diff --git a/resource-manager/web/2022-09-01/webapps/id_slottriggeredwebjob.go b/resource-manager/web/2022-09-01/webapps/id_slottriggeredwebjob.go index 62e8969daf5..6f7295755e6 100644 --- a/resource-manager/web/2022-09-01/webapps/id_slottriggeredwebjob.go +++ b/resource-manager/web/2022-09-01/webapps/id_slottriggeredwebjob.go @@ -40,27 +40,9 @@ func ParseSlotTriggeredWebJobID(input string) (*SlotTriggeredWebJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotTriggeredWebJobId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.TriggeredWebJobName, ok = parsed.Parsed["triggeredWebJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggeredWebJobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSlotTriggeredWebJobIDInsensitively(input string) (*SlotTriggeredWebJob return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotTriggeredWebJobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SlotTriggeredWebJobId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.TriggeredWebJobName, ok = parsed.Parsed["triggeredWebJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggeredWebJobName", *parsed) + if id.TriggeredWebJobName, ok = input.Parsed["triggeredWebJobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "triggeredWebJobName", input) } - return &id, nil + return nil } // ValidateSlotTriggeredWebJobID checks that 'input' can be parsed as a Slot Triggered Web Job ID diff --git a/resource-manager/web/2022-09-01/webapps/id_slotvirtualnetworkconnection.go b/resource-manager/web/2022-09-01/webapps/id_slotvirtualnetworkconnection.go index 5561c7588a2..76bafab7b89 100644 --- a/resource-manager/web/2022-09-01/webapps/id_slotvirtualnetworkconnection.go +++ b/resource-manager/web/2022-09-01/webapps/id_slotvirtualnetworkconnection.go @@ -40,27 +40,9 @@ func ParseSlotVirtualNetworkConnectionID(input string) (*SlotVirtualNetworkConne return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotVirtualNetworkConnectionId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.VirtualNetworkConnectionName, ok = parsed.Parsed["virtualNetworkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSlotVirtualNetworkConnectionIDInsensitively(input string) (*SlotVirtua return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotVirtualNetworkConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SlotVirtualNetworkConnectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.VirtualNetworkConnectionName, ok = parsed.Parsed["virtualNetworkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkConnectionName", *parsed) + if id.VirtualNetworkConnectionName, ok = input.Parsed["virtualNetworkConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkConnectionName", input) } - return &id, nil + return nil } // ValidateSlotVirtualNetworkConnectionID checks that 'input' can be parsed as a Slot Virtual Network Connection ID diff --git a/resource-manager/web/2022-09-01/webapps/id_slotvirtualnetworkconnectiongateway.go b/resource-manager/web/2022-09-01/webapps/id_slotvirtualnetworkconnectiongateway.go index 1d5d9860bff..6ce53651da1 100644 --- a/resource-manager/web/2022-09-01/webapps/id_slotvirtualnetworkconnectiongateway.go +++ b/resource-manager/web/2022-09-01/webapps/id_slotvirtualnetworkconnectiongateway.go @@ -42,31 +42,9 @@ func ParseSlotVirtualNetworkConnectionGatewayID(input string) (*SlotVirtualNetwo return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotVirtualNetworkConnectionGatewayId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.VirtualNetworkConnectionName, ok = parsed.Parsed["virtualNetworkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkConnectionName", *parsed) - } - - if id.GatewayName, ok = parsed.Parsed["gatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseSlotVirtualNetworkConnectionGatewayIDInsensitively(input string) (*Slo return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotVirtualNetworkConnectionGatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SlotVirtualNetworkConnectionGatewayId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.VirtualNetworkConnectionName, ok = parsed.Parsed["virtualNetworkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkConnectionName", *parsed) + if id.VirtualNetworkConnectionName, ok = input.Parsed["virtualNetworkConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkConnectionName", input) } - if id.GatewayName, ok = parsed.Parsed["gatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayName", *parsed) + if id.GatewayName, ok = input.Parsed["gatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayName", input) } - return &id, nil + return nil } // ValidateSlotVirtualNetworkConnectionGatewayID checks that 'input' can be parsed as a Slot Virtual Network Connection Gateway ID diff --git a/resource-manager/web/2022-09-01/webapps/id_slotwebjob.go b/resource-manager/web/2022-09-01/webapps/id_slotwebjob.go index 8aee6707b44..eb825ed3474 100644 --- a/resource-manager/web/2022-09-01/webapps/id_slotwebjob.go +++ b/resource-manager/web/2022-09-01/webapps/id_slotwebjob.go @@ -40,27 +40,9 @@ func ParseSlotWebJobID(input string) (*SlotWebJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotWebJobId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.WebJobName, ok = parsed.Parsed["webJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "webJobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSlotWebJobIDInsensitively(input string) (*SlotWebJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotWebJobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SlotWebJobId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.WebJobName, ok = parsed.Parsed["webJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "webJobName", *parsed) + if id.WebJobName, ok = input.Parsed["webJobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "webJobName", input) } - return &id, nil + return nil } // ValidateSlotWebJobID checks that 'input' can be parsed as a Slot Web Job ID diff --git a/resource-manager/web/2022-09-01/webapps/id_slotworkflow.go b/resource-manager/web/2022-09-01/webapps/id_slotworkflow.go index 839b9a9cc0c..c143535e7c4 100644 --- a/resource-manager/web/2022-09-01/webapps/id_slotworkflow.go +++ b/resource-manager/web/2022-09-01/webapps/id_slotworkflow.go @@ -40,27 +40,9 @@ func ParseSlotWorkflowID(input string) (*SlotWorkflowId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotWorkflowId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSlotWorkflowIDInsensitively(input string) (*SlotWorkflowId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotWorkflowId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SlotWorkflowId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - return &id, nil + return nil } // ValidateSlotWorkflowID checks that 'input' can be parsed as a Slot Workflow ID diff --git a/resource-manager/web/2022-09-01/webapps/id_snapshot.go b/resource-manager/web/2022-09-01/webapps/id_snapshot.go index 5b856f08c84..c7b5a80078c 100644 --- a/resource-manager/web/2022-09-01/webapps/id_snapshot.go +++ b/resource-manager/web/2022-09-01/webapps/id_snapshot.go @@ -38,23 +38,9 @@ func ParseSnapshotID(input string) (*SnapshotId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SnapshotId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SnapshotId, ok = parsed.Parsed["snapshotId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSnapshotIDInsensitively(input string) (*SnapshotId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SnapshotId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SnapshotId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SnapshotId, ok = parsed.Parsed["snapshotId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotId", *parsed) + if id.SnapshotId, ok = input.Parsed["snapshotId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "snapshotId", input) } - return &id, nil + return nil } // ValidateSnapshotID checks that 'input' can be parsed as a Snapshot ID diff --git a/resource-manager/web/2022-09-01/webapps/id_triggeredwebjob.go b/resource-manager/web/2022-09-01/webapps/id_triggeredwebjob.go index 855b9d76261..8e62aa483da 100644 --- a/resource-manager/web/2022-09-01/webapps/id_triggeredwebjob.go +++ b/resource-manager/web/2022-09-01/webapps/id_triggeredwebjob.go @@ -38,23 +38,9 @@ func ParseTriggeredWebJobID(input string) (*TriggeredWebJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TriggeredWebJobId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.TriggeredWebJobName, ok = parsed.Parsed["triggeredWebJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggeredWebJobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTriggeredWebJobIDInsensitively(input string) (*TriggeredWebJobId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TriggeredWebJobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TriggeredWebJobId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.TriggeredWebJobName, ok = parsed.Parsed["triggeredWebJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggeredWebJobName", *parsed) + if id.TriggeredWebJobName, ok = input.Parsed["triggeredWebJobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "triggeredWebJobName", input) } - return &id, nil + return nil } // ValidateTriggeredWebJobID checks that 'input' can be parsed as a Triggered Web Job ID diff --git a/resource-manager/web/2022-09-01/webapps/id_triggeredwebjobhistory.go b/resource-manager/web/2022-09-01/webapps/id_triggeredwebjobhistory.go index d2dfcd67327..cb4ec930b86 100644 --- a/resource-manager/web/2022-09-01/webapps/id_triggeredwebjobhistory.go +++ b/resource-manager/web/2022-09-01/webapps/id_triggeredwebjobhistory.go @@ -42,31 +42,9 @@ func ParseTriggeredWebJobHistoryID(input string) (*TriggeredWebJobHistoryId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TriggeredWebJobHistoryId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.TriggeredWebJobName, ok = parsed.Parsed["triggeredWebJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggeredWebJobName", *parsed) - } - - if id.HistoryName, ok = parsed.Parsed["historyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "historyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseTriggeredWebJobHistoryIDInsensitively(input string) (*TriggeredWebJobH return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TriggeredWebJobHistoryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *TriggeredWebJobHistoryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.TriggeredWebJobName, ok = parsed.Parsed["triggeredWebJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggeredWebJobName", *parsed) + if id.TriggeredWebJobName, ok = input.Parsed["triggeredWebJobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "triggeredWebJobName", input) } - if id.HistoryName, ok = parsed.Parsed["historyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "historyName", *parsed) + if id.HistoryName, ok = input.Parsed["historyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "historyName", input) } - return &id, nil + return nil } // ValidateTriggeredWebJobHistoryID checks that 'input' can be parsed as a Triggered Web Job History ID diff --git a/resource-manager/web/2022-09-01/webapps/id_virtualnetworkconnection.go b/resource-manager/web/2022-09-01/webapps/id_virtualnetworkconnection.go index f0535c087fd..b6deb7ee4c8 100644 --- a/resource-manager/web/2022-09-01/webapps/id_virtualnetworkconnection.go +++ b/resource-manager/web/2022-09-01/webapps/id_virtualnetworkconnection.go @@ -38,23 +38,9 @@ func ParseVirtualNetworkConnectionID(input string) (*VirtualNetworkConnectionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkConnectionId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.VirtualNetworkConnectionName, ok = parsed.Parsed["virtualNetworkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualNetworkConnectionIDInsensitively(input string) (*VirtualNetwork return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualNetworkConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.VirtualNetworkConnectionName, ok = parsed.Parsed["virtualNetworkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkConnectionName", *parsed) + if id.VirtualNetworkConnectionName, ok = input.Parsed["virtualNetworkConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkConnectionName", input) } - return &id, nil + return nil } // ValidateVirtualNetworkConnectionID checks that 'input' can be parsed as a Virtual Network Connection ID diff --git a/resource-manager/web/2022-09-01/webapps/id_webjob.go b/resource-manager/web/2022-09-01/webapps/id_webjob.go index c6693dd4a71..700fb470cdd 100644 --- a/resource-manager/web/2022-09-01/webapps/id_webjob.go +++ b/resource-manager/web/2022-09-01/webapps/id_webjob.go @@ -38,23 +38,9 @@ func ParseWebJobID(input string) (*WebJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WebJobId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.WebJobName, ok = parsed.Parsed["webJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "webJobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWebJobIDInsensitively(input string) (*WebJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WebJobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WebJobId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.WebJobName, ok = parsed.Parsed["webJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "webJobName", *parsed) + if id.WebJobName, ok = input.Parsed["webJobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "webJobName", input) } - return &id, nil + return nil } // ValidateWebJobID checks that 'input' can be parsed as a Web Job ID diff --git a/resource-manager/web/2022-09-01/webapps/id_websnapshot.go b/resource-manager/web/2022-09-01/webapps/id_websnapshot.go index 1777427c5a1..0f21c69e809 100644 --- a/resource-manager/web/2022-09-01/webapps/id_websnapshot.go +++ b/resource-manager/web/2022-09-01/webapps/id_websnapshot.go @@ -40,27 +40,9 @@ func ParseWebSnapshotID(input string) (*WebSnapshotId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WebSnapshotId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.SnapshotId, ok = parsed.Parsed["snapshotId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseWebSnapshotIDInsensitively(input string) (*WebSnapshotId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WebSnapshotId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *WebSnapshotId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.SnapshotId, ok = parsed.Parsed["snapshotId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotId", *parsed) + if id.SnapshotId, ok = input.Parsed["snapshotId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "snapshotId", input) } - return &id, nil + return nil } // ValidateWebSnapshotID checks that 'input' can be parsed as a Web Snapshot ID diff --git a/resource-manager/web/2022-09-01/webapps/id_workflow.go b/resource-manager/web/2022-09-01/webapps/id_workflow.go index 30bbcd8315a..ed14199a96c 100644 --- a/resource-manager/web/2022-09-01/webapps/id_workflow.go +++ b/resource-manager/web/2022-09-01/webapps/id_workflow.go @@ -38,23 +38,9 @@ func ParseWorkflowID(input string) (*WorkflowId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkflowId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWorkflowIDInsensitively(input string) (*WorkflowId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkflowId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WorkflowId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - return &id, nil + return nil } // ValidateWorkflowID checks that 'input' can be parsed as a Workflow ID diff --git a/resource-manager/web/2022-09-01/workflowrunactions/id_action.go b/resource-manager/web/2022-09-01/workflowrunactions/id_action.go index b166f79b84f..49184a3bf77 100644 --- a/resource-manager/web/2022-09-01/workflowrunactions/id_action.go +++ b/resource-manager/web/2022-09-01/workflowrunactions/id_action.go @@ -42,31 +42,9 @@ func ParseActionID(input string) (*ActionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ActionId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) - } - - if id.RunName, ok = parsed.Parsed["runName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runName", *parsed) - } - - if id.ActionName, ok = parsed.Parsed["actionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseActionIDInsensitively(input string) (*ActionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ActionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ActionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - if id.RunName, ok = parsed.Parsed["runName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runName", *parsed) + if id.RunName, ok = input.Parsed["runName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runName", input) } - if id.ActionName, ok = parsed.Parsed["actionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionName", *parsed) + if id.ActionName, ok = input.Parsed["actionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "actionName", input) } - return &id, nil + return nil } // ValidateActionID checks that 'input' can be parsed as a Action ID diff --git a/resource-manager/web/2022-09-01/workflowrunactions/id_repetition.go b/resource-manager/web/2022-09-01/workflowrunactions/id_repetition.go index 122545c8c34..f40af57dc1f 100644 --- a/resource-manager/web/2022-09-01/workflowrunactions/id_repetition.go +++ b/resource-manager/web/2022-09-01/workflowrunactions/id_repetition.go @@ -44,35 +44,9 @@ func ParseRepetitionID(input string) (*RepetitionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RepetitionId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) - } - - if id.RunName, ok = parsed.Parsed["runName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runName", *parsed) - } - - if id.ActionName, ok = parsed.Parsed["actionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionName", *parsed) - } - - if id.RepetitionName, ok = parsed.Parsed["repetitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "repetitionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseRepetitionIDInsensitively(input string) (*RepetitionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RepetitionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RepetitionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - if id.RunName, ok = parsed.Parsed["runName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runName", *parsed) + if id.RunName, ok = input.Parsed["runName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runName", input) } - if id.ActionName, ok = parsed.Parsed["actionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionName", *parsed) + if id.ActionName, ok = input.Parsed["actionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "actionName", input) } - if id.RepetitionName, ok = parsed.Parsed["repetitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "repetitionName", *parsed) + if id.RepetitionName, ok = input.Parsed["repetitionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "repetitionName", input) } - return &id, nil + return nil } // ValidateRepetitionID checks that 'input' can be parsed as a Repetition ID diff --git a/resource-manager/web/2022-09-01/workflowrunactions/id_requesthistory.go b/resource-manager/web/2022-09-01/workflowrunactions/id_requesthistory.go index ad568f0337a..bea80f04346 100644 --- a/resource-manager/web/2022-09-01/workflowrunactions/id_requesthistory.go +++ b/resource-manager/web/2022-09-01/workflowrunactions/id_requesthistory.go @@ -46,39 +46,9 @@ func ParseRequestHistoryID(input string) (*RequestHistoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RequestHistoryId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) - } - - if id.RunName, ok = parsed.Parsed["runName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runName", *parsed) - } - - if id.ActionName, ok = parsed.Parsed["actionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionName", *parsed) - } - - if id.RepetitionName, ok = parsed.Parsed["repetitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "repetitionName", *parsed) - } - - if id.RequestHistoryName, ok = parsed.Parsed["requestHistoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "requestHistoryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -93,42 +63,50 @@ func ParseRequestHistoryIDInsensitively(input string) (*RequestHistoryId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RequestHistoryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RequestHistoryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - if id.RunName, ok = parsed.Parsed["runName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runName", *parsed) + if id.RunName, ok = input.Parsed["runName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runName", input) } - if id.ActionName, ok = parsed.Parsed["actionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionName", *parsed) + if id.ActionName, ok = input.Parsed["actionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "actionName", input) } - if id.RepetitionName, ok = parsed.Parsed["repetitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "repetitionName", *parsed) + if id.RepetitionName, ok = input.Parsed["repetitionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "repetitionName", input) } - if id.RequestHistoryName, ok = parsed.Parsed["requestHistoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "requestHistoryName", *parsed) + if id.RequestHistoryName, ok = input.Parsed["requestHistoryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "requestHistoryName", input) } - return &id, nil + return nil } // ValidateRequestHistoryID checks that 'input' can be parsed as a Request History ID diff --git a/resource-manager/web/2022-09-01/workflowrunactions/id_run.go b/resource-manager/web/2022-09-01/workflowrunactions/id_run.go index 1d5fbc16bb0..4a34fbe1a33 100644 --- a/resource-manager/web/2022-09-01/workflowrunactions/id_run.go +++ b/resource-manager/web/2022-09-01/workflowrunactions/id_run.go @@ -40,27 +40,9 @@ func ParseRunID(input string) (*RunId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) - } - - if id.RunName, ok = parsed.Parsed["runName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseRunIDInsensitively(input string) (*RunId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RunId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - if id.RunName, ok = parsed.Parsed["runName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runName", *parsed) + if id.RunName, ok = input.Parsed["runName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runName", input) } - return &id, nil + return nil } // ValidateRunID checks that 'input' can be parsed as a Run ID diff --git a/resource-manager/web/2022-09-01/workflowrunactions/id_scoperepetition.go b/resource-manager/web/2022-09-01/workflowrunactions/id_scoperepetition.go index 6a010b1f5ab..4950cbb4bd6 100644 --- a/resource-manager/web/2022-09-01/workflowrunactions/id_scoperepetition.go +++ b/resource-manager/web/2022-09-01/workflowrunactions/id_scoperepetition.go @@ -44,35 +44,9 @@ func ParseScopeRepetitionID(input string) (*ScopeRepetitionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopeRepetitionId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) - } - - if id.RunName, ok = parsed.Parsed["runName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runName", *parsed) - } - - if id.ActionName, ok = parsed.Parsed["actionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionName", *parsed) - } - - if id.ScopeRepetitionName, ok = parsed.Parsed["scopeRepetitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scopeRepetitionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseScopeRepetitionIDInsensitively(input string) (*ScopeRepetitionId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopeRepetitionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ScopeRepetitionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - if id.RunName, ok = parsed.Parsed["runName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runName", *parsed) + if id.RunName, ok = input.Parsed["runName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runName", input) } - if id.ActionName, ok = parsed.Parsed["actionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionName", *parsed) + if id.ActionName, ok = input.Parsed["actionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "actionName", input) } - if id.ScopeRepetitionName, ok = parsed.Parsed["scopeRepetitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scopeRepetitionName", *parsed) + if id.ScopeRepetitionName, ok = input.Parsed["scopeRepetitionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scopeRepetitionName", input) } - return &id, nil + return nil } // ValidateScopeRepetitionID checks that 'input' can be parsed as a Scope Repetition ID diff --git a/resource-manager/web/2022-09-01/workflowruns/id_managementworkflow.go b/resource-manager/web/2022-09-01/workflowruns/id_managementworkflow.go index 18e85e0a13b..bc6063d1e6a 100644 --- a/resource-manager/web/2022-09-01/workflowruns/id_managementworkflow.go +++ b/resource-manager/web/2022-09-01/workflowruns/id_managementworkflow.go @@ -38,23 +38,9 @@ func ParseManagementWorkflowID(input string) (*ManagementWorkflowId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagementWorkflowId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseManagementWorkflowIDInsensitively(input string) (*ManagementWorkflowId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagementWorkflowId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ManagementWorkflowId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - return &id, nil + return nil } // ValidateManagementWorkflowID checks that 'input' can be parsed as a Management Workflow ID diff --git a/resource-manager/web/2022-09-01/workflowruns/id_run.go b/resource-manager/web/2022-09-01/workflowruns/id_run.go index c55c99caf28..8c4fa0bb534 100644 --- a/resource-manager/web/2022-09-01/workflowruns/id_run.go +++ b/resource-manager/web/2022-09-01/workflowruns/id_run.go @@ -40,27 +40,9 @@ func ParseRunID(input string) (*RunId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) - } - - if id.RunName, ok = parsed.Parsed["runName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseRunIDInsensitively(input string) (*RunId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RunId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - if id.RunName, ok = parsed.Parsed["runName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runName", *parsed) + if id.RunName, ok = input.Parsed["runName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runName", input) } - return &id, nil + return nil } // ValidateRunID checks that 'input' can be parsed as a Run ID diff --git a/resource-manager/web/2022-09-01/workflows/id_managementworkflow.go b/resource-manager/web/2022-09-01/workflows/id_managementworkflow.go index 1e057367da6..697779df5f2 100644 --- a/resource-manager/web/2022-09-01/workflows/id_managementworkflow.go +++ b/resource-manager/web/2022-09-01/workflows/id_managementworkflow.go @@ -38,23 +38,9 @@ func ParseManagementWorkflowID(input string) (*ManagementWorkflowId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagementWorkflowId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseManagementWorkflowIDInsensitively(input string) (*ManagementWorkflowId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagementWorkflowId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ManagementWorkflowId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - return &id, nil + return nil } // ValidateManagementWorkflowID checks that 'input' can be parsed as a Management Workflow ID diff --git a/resource-manager/web/2022-09-01/workflowtriggerhistories/id_trigger.go b/resource-manager/web/2022-09-01/workflowtriggerhistories/id_trigger.go index 06133491beb..58e8530aa2f 100644 --- a/resource-manager/web/2022-09-01/workflowtriggerhistories/id_trigger.go +++ b/resource-manager/web/2022-09-01/workflowtriggerhistories/id_trigger.go @@ -40,27 +40,9 @@ func ParseTriggerID(input string) (*TriggerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TriggerId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) - } - - if id.TriggerName, ok = parsed.Parsed["triggerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseTriggerIDInsensitively(input string) (*TriggerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TriggerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TriggerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - if id.TriggerName, ok = parsed.Parsed["triggerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggerName", *parsed) + if id.TriggerName, ok = input.Parsed["triggerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "triggerName", input) } - return &id, nil + return nil } // ValidateTriggerID checks that 'input' can be parsed as a Trigger ID diff --git a/resource-manager/web/2022-09-01/workflowtriggerhistories/id_triggerhistory.go b/resource-manager/web/2022-09-01/workflowtriggerhistories/id_triggerhistory.go index 2dcda2eba2f..6d315a220b9 100644 --- a/resource-manager/web/2022-09-01/workflowtriggerhistories/id_triggerhistory.go +++ b/resource-manager/web/2022-09-01/workflowtriggerhistories/id_triggerhistory.go @@ -42,31 +42,9 @@ func ParseTriggerHistoryID(input string) (*TriggerHistoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TriggerHistoryId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) - } - - if id.TriggerName, ok = parsed.Parsed["triggerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggerName", *parsed) - } - - if id.HistoryName, ok = parsed.Parsed["historyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "historyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseTriggerHistoryIDInsensitively(input string) (*TriggerHistoryId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TriggerHistoryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *TriggerHistoryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - if id.TriggerName, ok = parsed.Parsed["triggerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggerName", *parsed) + if id.TriggerName, ok = input.Parsed["triggerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "triggerName", input) } - if id.HistoryName, ok = parsed.Parsed["historyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "historyName", *parsed) + if id.HistoryName, ok = input.Parsed["historyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "historyName", input) } - return &id, nil + return nil } // ValidateTriggerHistoryID checks that 'input' can be parsed as a Trigger History ID diff --git a/resource-manager/web/2022-09-01/workflowtriggers/id_managementworkflow.go b/resource-manager/web/2022-09-01/workflowtriggers/id_managementworkflow.go index 101400fc48a..5b408ef4aec 100644 --- a/resource-manager/web/2022-09-01/workflowtriggers/id_managementworkflow.go +++ b/resource-manager/web/2022-09-01/workflowtriggers/id_managementworkflow.go @@ -38,23 +38,9 @@ func ParseManagementWorkflowID(input string) (*ManagementWorkflowId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagementWorkflowId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseManagementWorkflowIDInsensitively(input string) (*ManagementWorkflowId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagementWorkflowId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ManagementWorkflowId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - return &id, nil + return nil } // ValidateManagementWorkflowID checks that 'input' can be parsed as a Management Workflow ID diff --git a/resource-manager/web/2022-09-01/workflowtriggers/id_trigger.go b/resource-manager/web/2022-09-01/workflowtriggers/id_trigger.go index 9639dc15519..ff3dd294352 100644 --- a/resource-manager/web/2022-09-01/workflowtriggers/id_trigger.go +++ b/resource-manager/web/2022-09-01/workflowtriggers/id_trigger.go @@ -40,27 +40,9 @@ func ParseTriggerID(input string) (*TriggerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TriggerId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) - } - - if id.TriggerName, ok = parsed.Parsed["triggerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseTriggerIDInsensitively(input string) (*TriggerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TriggerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TriggerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - if id.TriggerName, ok = parsed.Parsed["triggerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggerName", *parsed) + if id.TriggerName, ok = input.Parsed["triggerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "triggerName", input) } - return &id, nil + return nil } // ValidateTriggerID checks that 'input' can be parsed as a Trigger ID diff --git a/resource-manager/web/2022-09-01/workflowversions/id_managementworkflow.go b/resource-manager/web/2022-09-01/workflowversions/id_managementworkflow.go index e5e55f3eed0..e47a5b20b93 100644 --- a/resource-manager/web/2022-09-01/workflowversions/id_managementworkflow.go +++ b/resource-manager/web/2022-09-01/workflowversions/id_managementworkflow.go @@ -38,23 +38,9 @@ func ParseManagementWorkflowID(input string) (*ManagementWorkflowId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagementWorkflowId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseManagementWorkflowIDInsensitively(input string) (*ManagementWorkflowId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagementWorkflowId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ManagementWorkflowId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - return &id, nil + return nil } // ValidateManagementWorkflowID checks that 'input' can be parsed as a Management Workflow ID diff --git a/resource-manager/web/2022-09-01/workflowversions/id_version.go b/resource-manager/web/2022-09-01/workflowversions/id_version.go index 10113b68e4d..c5f3f6bc6a3 100644 --- a/resource-manager/web/2022-09-01/workflowversions/id_version.go +++ b/resource-manager/web/2022-09-01/workflowversions/id_version.go @@ -40,27 +40,9 @@ func ParseVersionID(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) - } - - if id.VersionId, ok = parsed.Parsed["versionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVersionIDInsensitively(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - if id.VersionId, ok = parsed.Parsed["versionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionId", *parsed) + if id.VersionId, ok = input.Parsed["versionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionId", input) } - return &id, nil + return nil } // ValidateVersionID checks that 'input' can be parsed as a Version ID diff --git a/resource-manager/web/2023-01-01/appservicecertificateorders/id_certificate.go b/resource-manager/web/2023-01-01/appservicecertificateorders/id_certificate.go index 98f3f9f07a8..4dd5a3a53b4 100644 --- a/resource-manager/web/2023-01-01/appservicecertificateorders/id_certificate.go +++ b/resource-manager/web/2023-01-01/appservicecertificateorders/id_certificate.go @@ -38,23 +38,9 @@ func ParseCertificateID(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} - - 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.CertificateOrderName, ok = parsed.Parsed["certificateOrderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateOrderName", *parsed) - } - - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCertificateIDInsensitively(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CertificateOrderName, ok = parsed.Parsed["certificateOrderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateOrderName", *parsed) + if id.CertificateOrderName, ok = input.Parsed["certificateOrderName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateOrderName", input) } - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if id.CertificateName, ok = input.Parsed["certificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateName", input) } - return &id, nil + return nil } // ValidateCertificateID checks that 'input' can be parsed as a Certificate ID diff --git a/resource-manager/web/2023-01-01/appservicecertificateorders/id_certificateorder.go b/resource-manager/web/2023-01-01/appservicecertificateorders/id_certificateorder.go index 1ace34f72b6..b35ea8326dd 100644 --- a/resource-manager/web/2023-01-01/appservicecertificateorders/id_certificateorder.go +++ b/resource-manager/web/2023-01-01/appservicecertificateorders/id_certificateorder.go @@ -36,19 +36,9 @@ func ParseCertificateOrderID(input string) (*CertificateOrderId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateOrderId{} - - 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.CertificateOrderName, ok = parsed.Parsed["certificateOrderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateOrderName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseCertificateOrderIDInsensitively(input string) (*CertificateOrderId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateOrderId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CertificateOrderId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CertificateOrderName, ok = parsed.Parsed["certificateOrderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateOrderName", *parsed) + if id.CertificateOrderName, ok = input.Parsed["certificateOrderName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateOrderName", input) } - return &id, nil + return nil } // ValidateCertificateOrderID checks that 'input' can be parsed as a Certificate Order ID diff --git a/resource-manager/web/2023-01-01/appserviceenvironments/id_defaultinstance.go b/resource-manager/web/2023-01-01/appserviceenvironments/id_defaultinstance.go index 3b45c4669ee..3082830caa7 100644 --- a/resource-manager/web/2023-01-01/appserviceenvironments/id_defaultinstance.go +++ b/resource-manager/web/2023-01-01/appserviceenvironments/id_defaultinstance.go @@ -38,23 +38,9 @@ func ParseDefaultInstanceID(input string) (*DefaultInstanceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DefaultInstanceId{} - - 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.HostingEnvironmentName, ok = parsed.Parsed["hostingEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostingEnvironmentName", *parsed) - } - - if id.InstanceName, ok = parsed.Parsed["instanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDefaultInstanceIDInsensitively(input string) (*DefaultInstanceId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DefaultInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DefaultInstanceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostingEnvironmentName, ok = parsed.Parsed["hostingEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostingEnvironmentName", *parsed) + if id.HostingEnvironmentName, ok = input.Parsed["hostingEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostingEnvironmentName", input) } - if id.InstanceName, ok = parsed.Parsed["instanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceName", *parsed) + if id.InstanceName, ok = input.Parsed["instanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceName", input) } - return &id, nil + return nil } // ValidateDefaultInstanceID checks that 'input' can be parsed as a Default Instance ID diff --git a/resource-manager/web/2023-01-01/appserviceenvironments/id_hostingenvironmentdiagnostic.go b/resource-manager/web/2023-01-01/appserviceenvironments/id_hostingenvironmentdiagnostic.go index 526df4365ad..812ab39d5c8 100644 --- a/resource-manager/web/2023-01-01/appserviceenvironments/id_hostingenvironmentdiagnostic.go +++ b/resource-manager/web/2023-01-01/appserviceenvironments/id_hostingenvironmentdiagnostic.go @@ -38,23 +38,9 @@ func ParseHostingEnvironmentDiagnosticID(input string) (*HostingEnvironmentDiagn return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostingEnvironmentDiagnosticId{} - - 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.HostingEnvironmentName, ok = parsed.Parsed["hostingEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostingEnvironmentName", *parsed) - } - - if id.DiagnosticName, ok = parsed.Parsed["diagnosticName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseHostingEnvironmentDiagnosticIDInsensitively(input string) (*HostingEnv return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostingEnvironmentDiagnosticId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *HostingEnvironmentDiagnosticId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostingEnvironmentName, ok = parsed.Parsed["hostingEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostingEnvironmentName", *parsed) + if id.HostingEnvironmentName, ok = input.Parsed["hostingEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostingEnvironmentName", input) } - if id.DiagnosticName, ok = parsed.Parsed["diagnosticName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticName", *parsed) + if id.DiagnosticName, ok = input.Parsed["diagnosticName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "diagnosticName", input) } - return &id, nil + return nil } // ValidateHostingEnvironmentDiagnosticID checks that 'input' can be parsed as a Hosting Environment Diagnostic ID diff --git a/resource-manager/web/2023-01-01/appserviceenvironments/id_hostingenvironmentprivateendpointconnection.go b/resource-manager/web/2023-01-01/appserviceenvironments/id_hostingenvironmentprivateendpointconnection.go index a21c5d4bdac..b020f793590 100644 --- a/resource-manager/web/2023-01-01/appserviceenvironments/id_hostingenvironmentprivateendpointconnection.go +++ b/resource-manager/web/2023-01-01/appserviceenvironments/id_hostingenvironmentprivateendpointconnection.go @@ -38,23 +38,9 @@ func ParseHostingEnvironmentPrivateEndpointConnectionID(input string) (*HostingE return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostingEnvironmentPrivateEndpointConnectionId{} - - 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.HostingEnvironmentName, ok = parsed.Parsed["hostingEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostingEnvironmentName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseHostingEnvironmentPrivateEndpointConnectionIDInsensitively(input strin return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostingEnvironmentPrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *HostingEnvironmentPrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostingEnvironmentName, ok = parsed.Parsed["hostingEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostingEnvironmentName", *parsed) + if id.HostingEnvironmentName, ok = input.Parsed["hostingEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostingEnvironmentName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidateHostingEnvironmentPrivateEndpointConnectionID checks that 'input' can be parsed as a Hosting Environment Private Endpoint Connection ID diff --git a/resource-manager/web/2023-01-01/appserviceenvironments/id_workerpool.go b/resource-manager/web/2023-01-01/appserviceenvironments/id_workerpool.go index 5683fe5ddc5..00002ea09ab 100644 --- a/resource-manager/web/2023-01-01/appserviceenvironments/id_workerpool.go +++ b/resource-manager/web/2023-01-01/appserviceenvironments/id_workerpool.go @@ -38,23 +38,9 @@ func ParseWorkerPoolID(input string) (*WorkerPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkerPoolId{} - - 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.HostingEnvironmentName, ok = parsed.Parsed["hostingEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostingEnvironmentName", *parsed) - } - - if id.WorkerPoolName, ok = parsed.Parsed["workerPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workerPoolName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWorkerPoolIDInsensitively(input string) (*WorkerPoolId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkerPoolId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WorkerPoolId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostingEnvironmentName, ok = parsed.Parsed["hostingEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostingEnvironmentName", *parsed) + if id.HostingEnvironmentName, ok = input.Parsed["hostingEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostingEnvironmentName", input) } - if id.WorkerPoolName, ok = parsed.Parsed["workerPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workerPoolName", *parsed) + if id.WorkerPoolName, ok = input.Parsed["workerPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workerPoolName", input) } - return &id, nil + return nil } // ValidateWorkerPoolID checks that 'input' can be parsed as a Worker Pool ID diff --git a/resource-manager/web/2023-01-01/appserviceenvironments/id_workerpoolinstance.go b/resource-manager/web/2023-01-01/appserviceenvironments/id_workerpoolinstance.go index a1d6ec24d1f..d15caa57595 100644 --- a/resource-manager/web/2023-01-01/appserviceenvironments/id_workerpoolinstance.go +++ b/resource-manager/web/2023-01-01/appserviceenvironments/id_workerpoolinstance.go @@ -40,27 +40,9 @@ func ParseWorkerPoolInstanceID(input string) (*WorkerPoolInstanceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkerPoolInstanceId{} - - 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.HostingEnvironmentName, ok = parsed.Parsed["hostingEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostingEnvironmentName", *parsed) - } - - if id.WorkerPoolName, ok = parsed.Parsed["workerPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workerPoolName", *parsed) - } - - if id.InstanceName, ok = parsed.Parsed["instanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseWorkerPoolInstanceIDInsensitively(input string) (*WorkerPoolInstanceId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkerPoolInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *WorkerPoolInstanceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostingEnvironmentName, ok = parsed.Parsed["hostingEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostingEnvironmentName", *parsed) + if id.HostingEnvironmentName, ok = input.Parsed["hostingEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostingEnvironmentName", input) } - if id.WorkerPoolName, ok = parsed.Parsed["workerPoolName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workerPoolName", *parsed) + if id.WorkerPoolName, ok = input.Parsed["workerPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workerPoolName", input) } - if id.InstanceName, ok = parsed.Parsed["instanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceName", *parsed) + if id.InstanceName, ok = input.Parsed["instanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceName", input) } - return &id, nil + return nil } // ValidateWorkerPoolInstanceID checks that 'input' can be parsed as a Worker Pool Instance ID diff --git a/resource-manager/web/2023-01-01/appserviceplans/id_hybridconnectionnamespacerelay.go b/resource-manager/web/2023-01-01/appserviceplans/id_hybridconnectionnamespacerelay.go index 8fe7fb2a001..03767290c2d 100644 --- a/resource-manager/web/2023-01-01/appserviceplans/id_hybridconnectionnamespacerelay.go +++ b/resource-manager/web/2023-01-01/appserviceplans/id_hybridconnectionnamespacerelay.go @@ -40,27 +40,9 @@ func ParseHybridConnectionNamespaceRelayID(input string) (*HybridConnectionNames return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HybridConnectionNamespaceRelayId{} - - 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.ServerFarmName, ok = parsed.Parsed["serverFarmName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverFarmName", *parsed) - } - - if id.HybridConnectionNamespaceName, ok = parsed.Parsed["hybridConnectionNamespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridConnectionNamespaceName", *parsed) - } - - if id.RelayName, ok = parsed.Parsed["relayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "relayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseHybridConnectionNamespaceRelayIDInsensitively(input string) (*HybridCo return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HybridConnectionNamespaceRelayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *HybridConnectionNamespaceRelayId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerFarmName, ok = parsed.Parsed["serverFarmName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverFarmName", *parsed) + if id.ServerFarmName, ok = input.Parsed["serverFarmName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverFarmName", input) } - if id.HybridConnectionNamespaceName, ok = parsed.Parsed["hybridConnectionNamespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridConnectionNamespaceName", *parsed) + if id.HybridConnectionNamespaceName, ok = input.Parsed["hybridConnectionNamespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hybridConnectionNamespaceName", input) } - if id.RelayName, ok = parsed.Parsed["relayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "relayName", *parsed) + if id.RelayName, ok = input.Parsed["relayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "relayName", input) } - return &id, nil + return nil } // ValidateHybridConnectionNamespaceRelayID checks that 'input' can be parsed as a Hybrid Connection Namespace Relay ID diff --git a/resource-manager/web/2023-01-01/appserviceplans/id_route.go b/resource-manager/web/2023-01-01/appserviceplans/id_route.go index 77e22b1dc59..824335dce67 100644 --- a/resource-manager/web/2023-01-01/appserviceplans/id_route.go +++ b/resource-manager/web/2023-01-01/appserviceplans/id_route.go @@ -40,27 +40,9 @@ func ParseRouteID(input string) (*RouteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteId{} - - 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.ServerFarmName, ok = parsed.Parsed["serverFarmName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverFarmName", *parsed) - } - - if id.VirtualNetworkConnectionName, ok = parsed.Parsed["virtualNetworkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkConnectionName", *parsed) - } - - if id.RouteName, ok = parsed.Parsed["routeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseRouteIDInsensitively(input string) (*RouteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RouteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RouteId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerFarmName, ok = parsed.Parsed["serverFarmName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverFarmName", *parsed) + if id.ServerFarmName, ok = input.Parsed["serverFarmName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverFarmName", input) } - if id.VirtualNetworkConnectionName, ok = parsed.Parsed["virtualNetworkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkConnectionName", *parsed) + if id.VirtualNetworkConnectionName, ok = input.Parsed["virtualNetworkConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkConnectionName", input) } - if id.RouteName, ok = parsed.Parsed["routeName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "routeName", *parsed) + if id.RouteName, ok = input.Parsed["routeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "routeName", input) } - return &id, nil + return nil } // ValidateRouteID checks that 'input' can be parsed as a Route ID diff --git a/resource-manager/web/2023-01-01/appserviceplans/id_serverfarmvirtualnetworkconnection.go b/resource-manager/web/2023-01-01/appserviceplans/id_serverfarmvirtualnetworkconnection.go index f129a67af8a..a03f82ca601 100644 --- a/resource-manager/web/2023-01-01/appserviceplans/id_serverfarmvirtualnetworkconnection.go +++ b/resource-manager/web/2023-01-01/appserviceplans/id_serverfarmvirtualnetworkconnection.go @@ -38,23 +38,9 @@ func ParseServerFarmVirtualNetworkConnectionID(input string) (*ServerFarmVirtual return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerFarmVirtualNetworkConnectionId{} - - 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.ServerFarmName, ok = parsed.Parsed["serverFarmName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverFarmName", *parsed) - } - - if id.VirtualNetworkConnectionName, ok = parsed.Parsed["virtualNetworkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseServerFarmVirtualNetworkConnectionIDInsensitively(input string) (*Serv return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ServerFarmVirtualNetworkConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ServerFarmVirtualNetworkConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerFarmName, ok = parsed.Parsed["serverFarmName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverFarmName", *parsed) + if id.ServerFarmName, ok = input.Parsed["serverFarmName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverFarmName", input) } - if id.VirtualNetworkConnectionName, ok = parsed.Parsed["virtualNetworkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkConnectionName", *parsed) + if id.VirtualNetworkConnectionName, ok = input.Parsed["virtualNetworkConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkConnectionName", input) } - return &id, nil + return nil } // ValidateServerFarmVirtualNetworkConnectionID checks that 'input' can be parsed as a Server Farm Virtual Network Connection ID diff --git a/resource-manager/web/2023-01-01/appserviceplans/id_virtualnetworkconnectiongateway.go b/resource-manager/web/2023-01-01/appserviceplans/id_virtualnetworkconnectiongateway.go index 39ea1ec30b6..39eac11b9b4 100644 --- a/resource-manager/web/2023-01-01/appserviceplans/id_virtualnetworkconnectiongateway.go +++ b/resource-manager/web/2023-01-01/appserviceplans/id_virtualnetworkconnectiongateway.go @@ -40,27 +40,9 @@ func ParseVirtualNetworkConnectionGatewayID(input string) (*VirtualNetworkConnec return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkConnectionGatewayId{} - - 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.ServerFarmName, ok = parsed.Parsed["serverFarmName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverFarmName", *parsed) - } - - if id.VirtualNetworkConnectionName, ok = parsed.Parsed["virtualNetworkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkConnectionName", *parsed) - } - - if id.GatewayName, ok = parsed.Parsed["gatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVirtualNetworkConnectionGatewayIDInsensitively(input string) (*Virtual return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkConnectionGatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VirtualNetworkConnectionGatewayId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerFarmName, ok = parsed.Parsed["serverFarmName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverFarmName", *parsed) + if id.ServerFarmName, ok = input.Parsed["serverFarmName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverFarmName", input) } - if id.VirtualNetworkConnectionName, ok = parsed.Parsed["virtualNetworkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkConnectionName", *parsed) + if id.VirtualNetworkConnectionName, ok = input.Parsed["virtualNetworkConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkConnectionName", input) } - if id.GatewayName, ok = parsed.Parsed["gatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayName", *parsed) + if id.GatewayName, ok = input.Parsed["gatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayName", input) } - return &id, nil + return nil } // ValidateVirtualNetworkConnectionGatewayID checks that 'input' can be parsed as a Virtual Network Connection Gateway ID diff --git a/resource-manager/web/2023-01-01/appserviceplans/id_worker.go b/resource-manager/web/2023-01-01/appserviceplans/id_worker.go index e754ce3235d..1eaaa44be01 100644 --- a/resource-manager/web/2023-01-01/appserviceplans/id_worker.go +++ b/resource-manager/web/2023-01-01/appserviceplans/id_worker.go @@ -38,23 +38,9 @@ func ParseWorkerID(input string) (*WorkerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkerId{} - - 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.ServerFarmName, ok = parsed.Parsed["serverFarmName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverFarmName", *parsed) - } - - if id.WorkerName, ok = parsed.Parsed["workerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWorkerIDInsensitively(input string) (*WorkerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WorkerId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ServerFarmName, ok = parsed.Parsed["serverFarmName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "serverFarmName", *parsed) + if id.ServerFarmName, ok = input.Parsed["serverFarmName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "serverFarmName", input) } - if id.WorkerName, ok = parsed.Parsed["workerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workerName", *parsed) + if id.WorkerName, ok = input.Parsed["workerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workerName", input) } - return &id, nil + return nil } // ValidateWorkerID checks that 'input' can be parsed as a Worker ID diff --git a/resource-manager/web/2023-01-01/certificateordersdiagnostics/id_certificateorder.go b/resource-manager/web/2023-01-01/certificateordersdiagnostics/id_certificateorder.go index d6b70f9951a..606c7e46f1f 100644 --- a/resource-manager/web/2023-01-01/certificateordersdiagnostics/id_certificateorder.go +++ b/resource-manager/web/2023-01-01/certificateordersdiagnostics/id_certificateorder.go @@ -36,19 +36,9 @@ func ParseCertificateOrderID(input string) (*CertificateOrderId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateOrderId{} - - 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.CertificateOrderName, ok = parsed.Parsed["certificateOrderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateOrderName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseCertificateOrderIDInsensitively(input string) (*CertificateOrderId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateOrderId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CertificateOrderId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CertificateOrderName, ok = parsed.Parsed["certificateOrderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateOrderName", *parsed) + if id.CertificateOrderName, ok = input.Parsed["certificateOrderName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateOrderName", input) } - return &id, nil + return nil } // ValidateCertificateOrderID checks that 'input' can be parsed as a Certificate Order ID diff --git a/resource-manager/web/2023-01-01/certificateordersdiagnostics/id_detector.go b/resource-manager/web/2023-01-01/certificateordersdiagnostics/id_detector.go index db5515aaa13..15bb1eee9ab 100644 --- a/resource-manager/web/2023-01-01/certificateordersdiagnostics/id_detector.go +++ b/resource-manager/web/2023-01-01/certificateordersdiagnostics/id_detector.go @@ -38,23 +38,9 @@ func ParseDetectorID(input string) (*DetectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DetectorId{} - - 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.CertificateOrderName, ok = parsed.Parsed["certificateOrderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateOrderName", *parsed) - } - - if id.DetectorName, ok = parsed.Parsed["detectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "detectorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDetectorIDInsensitively(input string) (*DetectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DetectorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DetectorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CertificateOrderName, ok = parsed.Parsed["certificateOrderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateOrderName", *parsed) + if id.CertificateOrderName, ok = input.Parsed["certificateOrderName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateOrderName", input) } - if id.DetectorName, ok = parsed.Parsed["detectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "detectorName", *parsed) + if id.DetectorName, ok = input.Parsed["detectorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "detectorName", input) } - return &id, nil + return nil } // ValidateDetectorID checks that 'input' can be parsed as a Detector ID diff --git a/resource-manager/web/2023-01-01/certificates/id_certificate.go b/resource-manager/web/2023-01-01/certificates/id_certificate.go index fcd08e96f50..8a8daad7e79 100644 --- a/resource-manager/web/2023-01-01/certificates/id_certificate.go +++ b/resource-manager/web/2023-01-01/certificates/id_certificate.go @@ -36,19 +36,9 @@ func ParseCertificateID(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} - - 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.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseCertificateIDInsensitively(input string) (*CertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CertificateId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CertificateName, ok = parsed.Parsed["certificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "certificateName", *parsed) + if id.CertificateName, ok = input.Parsed["certificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateName", input) } - return &id, nil + return nil } // ValidateCertificateID checks that 'input' can be parsed as a Certificate ID diff --git a/resource-manager/web/2023-01-01/containerapps/id_containerapp.go b/resource-manager/web/2023-01-01/containerapps/id_containerapp.go index bc307b18ca1..fd2d3e78f07 100644 --- a/resource-manager/web/2023-01-01/containerapps/id_containerapp.go +++ b/resource-manager/web/2023-01-01/containerapps/id_containerapp.go @@ -34,15 +34,9 @@ func ParseContainerAppID(input string) (*ContainerAppId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerAppId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseContainerAppIDInsensitively(input string) (*ContainerAppId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContainerAppId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ContainerAppId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if id.ContainerAppName, ok = input.Parsed["containerAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", input) } - return &id, nil + return nil } // ValidateContainerAppID checks that 'input' can be parsed as a Container App ID diff --git a/resource-manager/web/2023-01-01/containerapps/id_providercontainerapp.go b/resource-manager/web/2023-01-01/containerapps/id_providercontainerapp.go index 2d66f2456a0..d4a2d44af4b 100644 --- a/resource-manager/web/2023-01-01/containerapps/id_providercontainerapp.go +++ b/resource-manager/web/2023-01-01/containerapps/id_providercontainerapp.go @@ -36,19 +36,9 @@ func ParseProviderContainerAppID(input string) (*ProviderContainerAppId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderContainerAppId{} - - 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.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderContainerAppIDInsensitively(input string) (*ProviderContainerA return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderContainerAppId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderContainerAppId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if id.ContainerAppName, ok = input.Parsed["containerAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", input) } - return &id, nil + return nil } // ValidateProviderContainerAppID checks that 'input' can be parsed as a Provider Container App ID diff --git a/resource-manager/web/2023-01-01/containerappsrevisions/id_providercontainerapp.go b/resource-manager/web/2023-01-01/containerappsrevisions/id_providercontainerapp.go index a9e9a6b08b9..709af7143d3 100644 --- a/resource-manager/web/2023-01-01/containerappsrevisions/id_providercontainerapp.go +++ b/resource-manager/web/2023-01-01/containerappsrevisions/id_providercontainerapp.go @@ -36,19 +36,9 @@ func ParseProviderContainerAppID(input string) (*ProviderContainerAppId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderContainerAppId{} - - 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.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseProviderContainerAppIDInsensitively(input string) (*ProviderContainerA return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderContainerAppId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProviderContainerAppId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if id.ContainerAppName, ok = input.Parsed["containerAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", input) } - return &id, nil + return nil } // ValidateProviderContainerAppID checks that 'input' can be parsed as a Provider Container App ID diff --git a/resource-manager/web/2023-01-01/containerappsrevisions/id_revision.go b/resource-manager/web/2023-01-01/containerappsrevisions/id_revision.go index 80f96701e69..a9411678941 100644 --- a/resource-manager/web/2023-01-01/containerappsrevisions/id_revision.go +++ b/resource-manager/web/2023-01-01/containerappsrevisions/id_revision.go @@ -38,23 +38,9 @@ func ParseRevisionID(input string) (*RevisionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RevisionId{} - - 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.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) - } - - if id.RevisionName, ok = parsed.Parsed["revisionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "revisionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseRevisionIDInsensitively(input string) (*RevisionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RevisionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RevisionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.ContainerAppName, ok = parsed.Parsed["containerAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", *parsed) + if id.ContainerAppName, ok = input.Parsed["containerAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "containerAppName", input) } - if id.RevisionName, ok = parsed.Parsed["revisionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "revisionName", *parsed) + if id.RevisionName, ok = input.Parsed["revisionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "revisionName", input) } - return &id, nil + return nil } // ValidateRevisionID checks that 'input' can be parsed as a Revision ID diff --git a/resource-manager/web/2023-01-01/deletedwebapps/id_locationdeletedsite.go b/resource-manager/web/2023-01-01/deletedwebapps/id_locationdeletedsite.go index 7ba6e8b719f..dfc34260101 100644 --- a/resource-manager/web/2023-01-01/deletedwebapps/id_locationdeletedsite.go +++ b/resource-manager/web/2023-01-01/deletedwebapps/id_locationdeletedsite.go @@ -36,19 +36,9 @@ func ParseLocationDeletedSiteID(input string) (*LocationDeletedSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationDeletedSiteId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) - } - - if id.DeletedSiteId, ok = parsed.Parsed["deletedSiteId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedSiteId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseLocationDeletedSiteIDInsensitively(input string) (*LocationDeletedSite return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationDeletedSiteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *LocationDeletedSiteId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - if id.DeletedSiteId, ok = parsed.Parsed["deletedSiteId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedSiteId", *parsed) + if id.DeletedSiteId, ok = input.Parsed["deletedSiteId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deletedSiteId", input) } - return &id, nil + return nil } // ValidateLocationDeletedSiteID checks that 'input' can be parsed as a Location Deleted Site ID diff --git a/resource-manager/web/2023-01-01/deletedwebapps/id_providerlocation.go b/resource-manager/web/2023-01-01/deletedwebapps/id_providerlocation.go index db9acabda2c..7996928c8f7 100644 --- a/resource-manager/web/2023-01-01/deletedwebapps/id_providerlocation.go +++ b/resource-manager/web/2023-01-01/deletedwebapps/id_providerlocation.go @@ -34,15 +34,9 @@ func ParseProviderLocationID(input string) (*ProviderLocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviderLocationIDInsensitively(input string) (*ProviderLocationId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ProviderLocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateProviderLocationID checks that 'input' can be parsed as a Provider Location ID diff --git a/resource-manager/web/2023-01-01/diagnostics/id_analysis.go b/resource-manager/web/2023-01-01/diagnostics/id_analysis.go index f1462cc79ce..5e2f9026116 100644 --- a/resource-manager/web/2023-01-01/diagnostics/id_analysis.go +++ b/resource-manager/web/2023-01-01/diagnostics/id_analysis.go @@ -40,27 +40,9 @@ func ParseAnalysisID(input string) (*AnalysisId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AnalysisId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.DiagnosticName, ok = parsed.Parsed["diagnosticName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticName", *parsed) - } - - if id.AnalysisName, ok = parsed.Parsed["analysisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "analysisName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseAnalysisIDInsensitively(input string) (*AnalysisId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AnalysisId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *AnalysisId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.DiagnosticName, ok = parsed.Parsed["diagnosticName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticName", *parsed) + if id.DiagnosticName, ok = input.Parsed["diagnosticName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "diagnosticName", input) } - if id.AnalysisName, ok = parsed.Parsed["analysisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "analysisName", *parsed) + if id.AnalysisName, ok = input.Parsed["analysisName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "analysisName", input) } - return &id, nil + return nil } // ValidateAnalysisID checks that 'input' can be parsed as a Analysis ID diff --git a/resource-manager/web/2023-01-01/diagnostics/id_detector.go b/resource-manager/web/2023-01-01/diagnostics/id_detector.go index 419b3a6923a..779e3e200d3 100644 --- a/resource-manager/web/2023-01-01/diagnostics/id_detector.go +++ b/resource-manager/web/2023-01-01/diagnostics/id_detector.go @@ -38,23 +38,9 @@ func ParseDetectorID(input string) (*DetectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DetectorId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.DetectorName, ok = parsed.Parsed["detectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "detectorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDetectorIDInsensitively(input string) (*DetectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DetectorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DetectorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.DetectorName, ok = parsed.Parsed["detectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "detectorName", *parsed) + if id.DetectorName, ok = input.Parsed["detectorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "detectorName", input) } - return &id, nil + return nil } // ValidateDetectorID checks that 'input' can be parsed as a Detector ID diff --git a/resource-manager/web/2023-01-01/diagnostics/id_diagnostic.go b/resource-manager/web/2023-01-01/diagnostics/id_diagnostic.go index 92af51cd34b..ad3969f6dfc 100644 --- a/resource-manager/web/2023-01-01/diagnostics/id_diagnostic.go +++ b/resource-manager/web/2023-01-01/diagnostics/id_diagnostic.go @@ -38,23 +38,9 @@ func ParseDiagnosticID(input string) (*DiagnosticId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiagnosticId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.DiagnosticName, ok = parsed.Parsed["diagnosticName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDiagnosticIDInsensitively(input string) (*DiagnosticId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiagnosticId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DiagnosticId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.DiagnosticName, ok = parsed.Parsed["diagnosticName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticName", *parsed) + if id.DiagnosticName, ok = input.Parsed["diagnosticName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "diagnosticName", input) } - return &id, nil + return nil } // ValidateDiagnosticID checks that 'input' can be parsed as a Diagnostic ID diff --git a/resource-manager/web/2023-01-01/diagnostics/id_diagnosticanalysis.go b/resource-manager/web/2023-01-01/diagnostics/id_diagnosticanalysis.go index 3c8df682ff6..f0762584073 100644 --- a/resource-manager/web/2023-01-01/diagnostics/id_diagnosticanalysis.go +++ b/resource-manager/web/2023-01-01/diagnostics/id_diagnosticanalysis.go @@ -42,31 +42,9 @@ func ParseDiagnosticAnalysisID(input string) (*DiagnosticAnalysisId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiagnosticAnalysisId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.DiagnosticName, ok = parsed.Parsed["diagnosticName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticName", *parsed) - } - - if id.AnalysisName, ok = parsed.Parsed["analysisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "analysisName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseDiagnosticAnalysisIDInsensitively(input string) (*DiagnosticAnalysisId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiagnosticAnalysisId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DiagnosticAnalysisId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.DiagnosticName, ok = parsed.Parsed["diagnosticName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticName", *parsed) + if id.DiagnosticName, ok = input.Parsed["diagnosticName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "diagnosticName", input) } - if id.AnalysisName, ok = parsed.Parsed["analysisName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "analysisName", *parsed) + if id.AnalysisName, ok = input.Parsed["analysisName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "analysisName", input) } - return &id, nil + return nil } // ValidateDiagnosticAnalysisID checks that 'input' can be parsed as a Diagnostic Analysis ID diff --git a/resource-manager/web/2023-01-01/diagnostics/id_diagnosticdetector.go b/resource-manager/web/2023-01-01/diagnostics/id_diagnosticdetector.go index 0106f3b7637..5f0622467f6 100644 --- a/resource-manager/web/2023-01-01/diagnostics/id_diagnosticdetector.go +++ b/resource-manager/web/2023-01-01/diagnostics/id_diagnosticdetector.go @@ -40,27 +40,9 @@ func ParseDiagnosticDetectorID(input string) (*DiagnosticDetectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiagnosticDetectorId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.DiagnosticName, ok = parsed.Parsed["diagnosticName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticName", *parsed) - } - - if id.DetectorName, ok = parsed.Parsed["detectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "detectorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseDiagnosticDetectorIDInsensitively(input string) (*DiagnosticDetectorId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DiagnosticDetectorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DiagnosticDetectorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.DiagnosticName, ok = parsed.Parsed["diagnosticName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticName", *parsed) + if id.DiagnosticName, ok = input.Parsed["diagnosticName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "diagnosticName", input) } - if id.DetectorName, ok = parsed.Parsed["detectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "detectorName", *parsed) + if id.DetectorName, ok = input.Parsed["detectorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "detectorName", input) } - return &id, nil + return nil } // ValidateDiagnosticDetectorID checks that 'input' can be parsed as a Diagnostic Detector ID diff --git a/resource-manager/web/2023-01-01/diagnostics/id_hostingenvironmentdetector.go b/resource-manager/web/2023-01-01/diagnostics/id_hostingenvironmentdetector.go index 56606ef3afc..0b2a7d3c346 100644 --- a/resource-manager/web/2023-01-01/diagnostics/id_hostingenvironmentdetector.go +++ b/resource-manager/web/2023-01-01/diagnostics/id_hostingenvironmentdetector.go @@ -38,23 +38,9 @@ func ParseHostingEnvironmentDetectorID(input string) (*HostingEnvironmentDetecto return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostingEnvironmentDetectorId{} - - 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.HostingEnvironmentName, ok = parsed.Parsed["hostingEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostingEnvironmentName", *parsed) - } - - if id.DetectorName, ok = parsed.Parsed["detectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "detectorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseHostingEnvironmentDetectorIDInsensitively(input string) (*HostingEnvir return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostingEnvironmentDetectorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *HostingEnvironmentDetectorId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostingEnvironmentName, ok = parsed.Parsed["hostingEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostingEnvironmentName", *parsed) + if id.HostingEnvironmentName, ok = input.Parsed["hostingEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostingEnvironmentName", input) } - if id.DetectorName, ok = parsed.Parsed["detectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "detectorName", *parsed) + if id.DetectorName, ok = input.Parsed["detectorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "detectorName", input) } - return &id, nil + return nil } // ValidateHostingEnvironmentDetectorID checks that 'input' can be parsed as a Hosting Environment Detector ID diff --git a/resource-manager/web/2023-01-01/diagnostics/id_slot.go b/resource-manager/web/2023-01-01/diagnostics/id_slot.go index 9de3e83b9f2..621f005dca9 100644 --- a/resource-manager/web/2023-01-01/diagnostics/id_slot.go +++ b/resource-manager/web/2023-01-01/diagnostics/id_slot.go @@ -38,23 +38,9 @@ func ParseSlotID(input string) (*SlotId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSlotIDInsensitively(input string) (*SlotId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SlotId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - return &id, nil + return nil } // ValidateSlotID checks that 'input' can be parsed as a Slot ID diff --git a/resource-manager/web/2023-01-01/diagnostics/id_slotdetector.go b/resource-manager/web/2023-01-01/diagnostics/id_slotdetector.go index 62fb18223fb..a79bfadb518 100644 --- a/resource-manager/web/2023-01-01/diagnostics/id_slotdetector.go +++ b/resource-manager/web/2023-01-01/diagnostics/id_slotdetector.go @@ -40,27 +40,9 @@ func ParseSlotDetectorID(input string) (*SlotDetectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotDetectorId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.DetectorName, ok = parsed.Parsed["detectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "detectorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSlotDetectorIDInsensitively(input string) (*SlotDetectorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotDetectorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SlotDetectorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.DetectorName, ok = parsed.Parsed["detectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "detectorName", *parsed) + if id.DetectorName, ok = input.Parsed["detectorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "detectorName", input) } - return &id, nil + return nil } // ValidateSlotDetectorID checks that 'input' can be parsed as a Slot Detector ID diff --git a/resource-manager/web/2023-01-01/diagnostics/id_slotdiagnostic.go b/resource-manager/web/2023-01-01/diagnostics/id_slotdiagnostic.go index 41e3b13371f..eedc947b71e 100644 --- a/resource-manager/web/2023-01-01/diagnostics/id_slotdiagnostic.go +++ b/resource-manager/web/2023-01-01/diagnostics/id_slotdiagnostic.go @@ -40,27 +40,9 @@ func ParseSlotDiagnosticID(input string) (*SlotDiagnosticId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotDiagnosticId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.DiagnosticName, ok = parsed.Parsed["diagnosticName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSlotDiagnosticIDInsensitively(input string) (*SlotDiagnosticId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotDiagnosticId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SlotDiagnosticId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.DiagnosticName, ok = parsed.Parsed["diagnosticName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticName", *parsed) + if id.DiagnosticName, ok = input.Parsed["diagnosticName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "diagnosticName", input) } - return &id, nil + return nil } // ValidateSlotDiagnosticID checks that 'input' can be parsed as a Slot Diagnostic ID diff --git a/resource-manager/web/2023-01-01/diagnostics/id_slotdiagnosticdetector.go b/resource-manager/web/2023-01-01/diagnostics/id_slotdiagnosticdetector.go index 4938c973dd4..3cb926410b4 100644 --- a/resource-manager/web/2023-01-01/diagnostics/id_slotdiagnosticdetector.go +++ b/resource-manager/web/2023-01-01/diagnostics/id_slotdiagnosticdetector.go @@ -42,31 +42,9 @@ func ParseSlotDiagnosticDetectorID(input string) (*SlotDiagnosticDetectorId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotDiagnosticDetectorId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.DiagnosticName, ok = parsed.Parsed["diagnosticName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticName", *parsed) - } - - if id.DetectorName, ok = parsed.Parsed["detectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "detectorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseSlotDiagnosticDetectorIDInsensitively(input string) (*SlotDiagnosticDe return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotDiagnosticDetectorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SlotDiagnosticDetectorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.DiagnosticName, ok = parsed.Parsed["diagnosticName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "diagnosticName", *parsed) + if id.DiagnosticName, ok = input.Parsed["diagnosticName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "diagnosticName", input) } - if id.DetectorName, ok = parsed.Parsed["detectorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "detectorName", *parsed) + if id.DetectorName, ok = input.Parsed["detectorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "detectorName", input) } - return &id, nil + return nil } // ValidateSlotDiagnosticDetectorID checks that 'input' can be parsed as a Slot Diagnostic Detector ID diff --git a/resource-manager/web/2023-01-01/domains/id_domain.go b/resource-manager/web/2023-01-01/domains/id_domain.go index 88808fd7aa6..9bce1ffec8a 100644 --- a/resource-manager/web/2023-01-01/domains/id_domain.go +++ b/resource-manager/web/2023-01-01/domains/id_domain.go @@ -36,19 +36,9 @@ func ParseDomainID(input string) (*DomainId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DomainId{} - - 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.DomainName, ok = parsed.Parsed["domainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseDomainIDInsensitively(input string) (*DomainId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DomainId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *DomainId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DomainName, ok = parsed.Parsed["domainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainName", *parsed) + if id.DomainName, ok = input.Parsed["domainName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "domainName", input) } - return &id, nil + return nil } // ValidateDomainID checks that 'input' can be parsed as a Domain ID diff --git a/resource-manager/web/2023-01-01/domains/id_domainownershipidentifier.go b/resource-manager/web/2023-01-01/domains/id_domainownershipidentifier.go index 588e91545b7..4e40c5269b8 100644 --- a/resource-manager/web/2023-01-01/domains/id_domainownershipidentifier.go +++ b/resource-manager/web/2023-01-01/domains/id_domainownershipidentifier.go @@ -38,23 +38,9 @@ func ParseDomainOwnershipIdentifierID(input string) (*DomainOwnershipIdentifierI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DomainOwnershipIdentifierId{} - - 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.DomainName, ok = parsed.Parsed["domainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainName", *parsed) - } - - if id.DomainOwnershipIdentifierName, ok = parsed.Parsed["domainOwnershipIdentifierName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainOwnershipIdentifierName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDomainOwnershipIdentifierIDInsensitively(input string) (*DomainOwnersh return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DomainOwnershipIdentifierId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DomainOwnershipIdentifierId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.DomainName, ok = parsed.Parsed["domainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainName", *parsed) + if id.DomainName, ok = input.Parsed["domainName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "domainName", input) } - if id.DomainOwnershipIdentifierName, ok = parsed.Parsed["domainOwnershipIdentifierName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainOwnershipIdentifierName", *parsed) + if id.DomainOwnershipIdentifierName, ok = input.Parsed["domainOwnershipIdentifierName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "domainOwnershipIdentifierName", input) } - return &id, nil + return nil } // ValidateDomainOwnershipIdentifierID checks that 'input' can be parsed as a Domain Ownership Identifier ID diff --git a/resource-manager/web/2023-01-01/global/id_deletedsite.go b/resource-manager/web/2023-01-01/global/id_deletedsite.go index 713b403b1d0..c28023d3415 100644 --- a/resource-manager/web/2023-01-01/global/id_deletedsite.go +++ b/resource-manager/web/2023-01-01/global/id_deletedsite.go @@ -34,15 +34,9 @@ func ParseDeletedSiteID(input string) (*DeletedSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeletedSiteId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.DeletedSiteId, ok = parsed.Parsed["deletedSiteId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedSiteId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseDeletedSiteIDInsensitively(input string) (*DeletedSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeletedSiteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DeletedSiteId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.DeletedSiteId, ok = parsed.Parsed["deletedSiteId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deletedSiteId", *parsed) + if id.DeletedSiteId, ok = input.Parsed["deletedSiteId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deletedSiteId", input) } - return &id, nil + return nil } // ValidateDeletedSiteID checks that 'input' can be parsed as a Deleted Site ID diff --git a/resource-manager/web/2023-01-01/kubeenvironments/id_kubeenvironment.go b/resource-manager/web/2023-01-01/kubeenvironments/id_kubeenvironment.go index e1eb58d11de..be98f187085 100644 --- a/resource-manager/web/2023-01-01/kubeenvironments/id_kubeenvironment.go +++ b/resource-manager/web/2023-01-01/kubeenvironments/id_kubeenvironment.go @@ -36,19 +36,9 @@ func ParseKubeEnvironmentID(input string) (*KubeEnvironmentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := KubeEnvironmentId{} - - 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.KubeEnvironmentName, ok = parsed.Parsed["kubeEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "kubeEnvironmentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseKubeEnvironmentIDInsensitively(input string) (*KubeEnvironmentId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := KubeEnvironmentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *KubeEnvironmentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.KubeEnvironmentName, ok = parsed.Parsed["kubeEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "kubeEnvironmentName", *parsed) + if id.KubeEnvironmentName, ok = input.Parsed["kubeEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "kubeEnvironmentName", input) } - return &id, nil + return nil } // ValidateKubeEnvironmentID checks that 'input' can be parsed as a Kube Environment ID diff --git a/resource-manager/web/2023-01-01/provider/id_location.go b/resource-manager/web/2023-01-01/provider/id_location.go index babb6d4f13e..d3531b3fed3 100644 --- a/resource-manager/web/2023-01-01/provider/id_location.go +++ b/resource-manager/web/2023-01-01/provider/id_location.go @@ -32,11 +32,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + return nil +} + // ValidateLocationID checks that 'input' can be parsed as a Location ID func ValidateLocationID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/web/2023-01-01/recommendations/id_hostingenvironmentrecommendation.go b/resource-manager/web/2023-01-01/recommendations/id_hostingenvironmentrecommendation.go index db9a3da939e..d4c89238991 100644 --- a/resource-manager/web/2023-01-01/recommendations/id_hostingenvironmentrecommendation.go +++ b/resource-manager/web/2023-01-01/recommendations/id_hostingenvironmentrecommendation.go @@ -38,23 +38,9 @@ func ParseHostingEnvironmentRecommendationID(input string) (*HostingEnvironmentR return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostingEnvironmentRecommendationId{} - - 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.HostingEnvironmentName, ok = parsed.Parsed["hostingEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostingEnvironmentName", *parsed) - } - - if id.RecommendationName, ok = parsed.Parsed["recommendationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recommendationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseHostingEnvironmentRecommendationIDInsensitively(input string) (*Hostin return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostingEnvironmentRecommendationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *HostingEnvironmentRecommendationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.HostingEnvironmentName, ok = parsed.Parsed["hostingEnvironmentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostingEnvironmentName", *parsed) + if id.HostingEnvironmentName, ok = input.Parsed["hostingEnvironmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostingEnvironmentName", input) } - if id.RecommendationName, ok = parsed.Parsed["recommendationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recommendationName", *parsed) + if id.RecommendationName, ok = input.Parsed["recommendationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "recommendationName", input) } - return &id, nil + return nil } // ValidateHostingEnvironmentRecommendationID checks that 'input' can be parsed as a Hosting Environment Recommendation ID diff --git a/resource-manager/web/2023-01-01/recommendations/id_recommendation.go b/resource-manager/web/2023-01-01/recommendations/id_recommendation.go index 72461363fcc..c7e7e1ad92b 100644 --- a/resource-manager/web/2023-01-01/recommendations/id_recommendation.go +++ b/resource-manager/web/2023-01-01/recommendations/id_recommendation.go @@ -34,15 +34,9 @@ func ParseRecommendationID(input string) (*RecommendationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecommendationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.RecommendationName, ok = parsed.Parsed["recommendationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recommendationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseRecommendationIDInsensitively(input string) (*RecommendationId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RecommendationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RecommendationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.RecommendationName, ok = parsed.Parsed["recommendationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recommendationName", *parsed) + if id.RecommendationName, ok = input.Parsed["recommendationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "recommendationName", input) } - return &id, nil + return nil } // ValidateRecommendationID checks that 'input' can be parsed as a Recommendation ID diff --git a/resource-manager/web/2023-01-01/recommendations/id_siterecommendation.go b/resource-manager/web/2023-01-01/recommendations/id_siterecommendation.go index 3405fa817c0..0e12b06558a 100644 --- a/resource-manager/web/2023-01-01/recommendations/id_siterecommendation.go +++ b/resource-manager/web/2023-01-01/recommendations/id_siterecommendation.go @@ -38,23 +38,9 @@ func ParseSiteRecommendationID(input string) (*SiteRecommendationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SiteRecommendationId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.RecommendationName, ok = parsed.Parsed["recommendationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recommendationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSiteRecommendationIDInsensitively(input string) (*SiteRecommendationId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SiteRecommendationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SiteRecommendationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.RecommendationName, ok = parsed.Parsed["recommendationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "recommendationName", *parsed) + if id.RecommendationName, ok = input.Parsed["recommendationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "recommendationName", input) } - return &id, nil + return nil } // ValidateSiteRecommendationID checks that 'input' can be parsed as a Site Recommendation ID diff --git a/resource-manager/web/2023-01-01/resourcehealthmetadata/id_slot.go b/resource-manager/web/2023-01-01/resourcehealthmetadata/id_slot.go index 9d76aadaf12..0ca77fcb8ea 100644 --- a/resource-manager/web/2023-01-01/resourcehealthmetadata/id_slot.go +++ b/resource-manager/web/2023-01-01/resourcehealthmetadata/id_slot.go @@ -38,23 +38,9 @@ func ParseSlotID(input string) (*SlotId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSlotIDInsensitively(input string) (*SlotId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SlotId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - return &id, nil + return nil } // ValidateSlotID checks that 'input' can be parsed as a Slot ID diff --git a/resource-manager/web/2023-01-01/resourceproviders/id_providerlocation.go b/resource-manager/web/2023-01-01/resourceproviders/id_providerlocation.go index b885e20ca98..f1a135084fe 100644 --- a/resource-manager/web/2023-01-01/resourceproviders/id_providerlocation.go +++ b/resource-manager/web/2023-01-01/resourceproviders/id_providerlocation.go @@ -34,15 +34,9 @@ func ParseProviderLocationID(input string) (*ProviderLocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviderLocationIDInsensitively(input string) (*ProviderLocationId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ProviderLocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateProviderLocationID checks that 'input' can be parsed as a Provider Location ID diff --git a/resource-manager/web/2023-01-01/resourceproviders/id_sourcecontrol.go b/resource-manager/web/2023-01-01/resourceproviders/id_sourcecontrol.go index 91261032c7f..3de3c627bc9 100644 --- a/resource-manager/web/2023-01-01/resourceproviders/id_sourcecontrol.go +++ b/resource-manager/web/2023-01-01/resourceproviders/id_sourcecontrol.go @@ -32,11 +32,9 @@ func ParseSourceControlID(input string) (*SourceControlId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlId{} - - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -51,16 +49,24 @@ func ParseSourceControlIDInsensitively(input string) (*SourceControlId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SourceControlId{} - - if id.SourceControlName, ok = parsed.Parsed["sourceControlName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil } +func (id *SourceControlId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SourceControlName, ok = input.Parsed["sourceControlName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sourceControlName", input) + } + + return nil +} + // ValidateSourceControlID checks that 'input' can be parsed as a Source Control ID func ValidateSourceControlID(input interface{}, key string) (warnings []string, errors []error) { v, ok := input.(string) diff --git a/resource-manager/web/2023-01-01/staticsites/id_authprovider.go b/resource-manager/web/2023-01-01/staticsites/id_authprovider.go index 2d345d7e6c7..2fcb3983be2 100644 --- a/resource-manager/web/2023-01-01/staticsites/id_authprovider.go +++ b/resource-manager/web/2023-01-01/staticsites/id_authprovider.go @@ -38,23 +38,9 @@ func ParseAuthProviderID(input string) (*AuthProviderId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthProviderId{} - - 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.StaticSiteName, ok = parsed.Parsed["staticSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", *parsed) - } - - if id.AuthProviderName, ok = parsed.Parsed["authProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authProviderName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAuthProviderIDInsensitively(input string) (*AuthProviderId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AuthProviderId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AuthProviderId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StaticSiteName, ok = parsed.Parsed["staticSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", *parsed) + if id.StaticSiteName, ok = input.Parsed["staticSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", input) } - if id.AuthProviderName, ok = parsed.Parsed["authProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authProviderName", *parsed) + if id.AuthProviderName, ok = input.Parsed["authProviderName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authProviderName", input) } - return &id, nil + return nil } // ValidateAuthProviderID checks that 'input' can be parsed as a Auth Provider ID diff --git a/resource-manager/web/2023-01-01/staticsites/id_build.go b/resource-manager/web/2023-01-01/staticsites/id_build.go index e8c9bff7f44..f59984a3da8 100644 --- a/resource-manager/web/2023-01-01/staticsites/id_build.go +++ b/resource-manager/web/2023-01-01/staticsites/id_build.go @@ -38,23 +38,9 @@ func ParseBuildID(input string) (*BuildId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BuildId{} - - 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.StaticSiteName, ok = parsed.Parsed["staticSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", *parsed) - } - - if id.BuildName, ok = parsed.Parsed["buildName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBuildIDInsensitively(input string) (*BuildId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BuildId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BuildId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StaticSiteName, ok = parsed.Parsed["staticSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", *parsed) + if id.StaticSiteName, ok = input.Parsed["staticSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", input) } - if id.BuildName, ok = parsed.Parsed["buildName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildName", *parsed) + if id.BuildName, ok = input.Parsed["buildName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "buildName", input) } - return &id, nil + return nil } // ValidateBuildID checks that 'input' can be parsed as a Build ID diff --git a/resource-manager/web/2023-01-01/staticsites/id_builddatabaseconnection.go b/resource-manager/web/2023-01-01/staticsites/id_builddatabaseconnection.go index 7f8e7ca9a10..1abf1750bb5 100644 --- a/resource-manager/web/2023-01-01/staticsites/id_builddatabaseconnection.go +++ b/resource-manager/web/2023-01-01/staticsites/id_builddatabaseconnection.go @@ -40,27 +40,9 @@ func ParseBuildDatabaseConnectionID(input string) (*BuildDatabaseConnectionId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BuildDatabaseConnectionId{} - - 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.StaticSiteName, ok = parsed.Parsed["staticSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", *parsed) - } - - if id.BuildName, ok = parsed.Parsed["buildName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildName", *parsed) - } - - if id.DatabaseConnectionName, ok = parsed.Parsed["databaseConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseBuildDatabaseConnectionIDInsensitively(input string) (*BuildDatabaseCo return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BuildDatabaseConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *BuildDatabaseConnectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StaticSiteName, ok = parsed.Parsed["staticSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", *parsed) + if id.StaticSiteName, ok = input.Parsed["staticSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", input) } - if id.BuildName, ok = parsed.Parsed["buildName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildName", *parsed) + if id.BuildName, ok = input.Parsed["buildName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "buildName", input) } - if id.DatabaseConnectionName, ok = parsed.Parsed["databaseConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseConnectionName", *parsed) + if id.DatabaseConnectionName, ok = input.Parsed["databaseConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseConnectionName", input) } - return &id, nil + return nil } // ValidateBuildDatabaseConnectionID checks that 'input' can be parsed as a Build Database Connection ID diff --git a/resource-manager/web/2023-01-01/staticsites/id_buildlinkedbackend.go b/resource-manager/web/2023-01-01/staticsites/id_buildlinkedbackend.go index 225de979367..fe9de867951 100644 --- a/resource-manager/web/2023-01-01/staticsites/id_buildlinkedbackend.go +++ b/resource-manager/web/2023-01-01/staticsites/id_buildlinkedbackend.go @@ -40,27 +40,9 @@ func ParseBuildLinkedBackendID(input string) (*BuildLinkedBackendId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BuildLinkedBackendId{} - - 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.StaticSiteName, ok = parsed.Parsed["staticSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", *parsed) - } - - if id.BuildName, ok = parsed.Parsed["buildName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildName", *parsed) - } - - if id.LinkedBackendName, ok = parsed.Parsed["linkedBackendName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "linkedBackendName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseBuildLinkedBackendIDInsensitively(input string) (*BuildLinkedBackendId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BuildLinkedBackendId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *BuildLinkedBackendId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StaticSiteName, ok = parsed.Parsed["staticSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", *parsed) + if id.StaticSiteName, ok = input.Parsed["staticSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", input) } - if id.BuildName, ok = parsed.Parsed["buildName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildName", *parsed) + if id.BuildName, ok = input.Parsed["buildName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "buildName", input) } - if id.LinkedBackendName, ok = parsed.Parsed["linkedBackendName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "linkedBackendName", *parsed) + if id.LinkedBackendName, ok = input.Parsed["linkedBackendName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "linkedBackendName", input) } - return &id, nil + return nil } // ValidateBuildLinkedBackendID checks that 'input' can be parsed as a Build Linked Backend ID diff --git a/resource-manager/web/2023-01-01/staticsites/id_builduserprovidedfunctionapp.go b/resource-manager/web/2023-01-01/staticsites/id_builduserprovidedfunctionapp.go index 28ccbca77c7..32403b5b0a5 100644 --- a/resource-manager/web/2023-01-01/staticsites/id_builduserprovidedfunctionapp.go +++ b/resource-manager/web/2023-01-01/staticsites/id_builduserprovidedfunctionapp.go @@ -40,27 +40,9 @@ func ParseBuildUserProvidedFunctionAppID(input string) (*BuildUserProvidedFuncti return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BuildUserProvidedFunctionAppId{} - - 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.StaticSiteName, ok = parsed.Parsed["staticSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", *parsed) - } - - if id.BuildName, ok = parsed.Parsed["buildName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildName", *parsed) - } - - if id.UserProvidedFunctionAppName, ok = parsed.Parsed["userProvidedFunctionAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userProvidedFunctionAppName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseBuildUserProvidedFunctionAppIDInsensitively(input string) (*BuildUserP return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BuildUserProvidedFunctionAppId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *BuildUserProvidedFunctionAppId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StaticSiteName, ok = parsed.Parsed["staticSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", *parsed) + if id.StaticSiteName, ok = input.Parsed["staticSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", input) } - if id.BuildName, ok = parsed.Parsed["buildName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "buildName", *parsed) + if id.BuildName, ok = input.Parsed["buildName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "buildName", input) } - if id.UserProvidedFunctionAppName, ok = parsed.Parsed["userProvidedFunctionAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userProvidedFunctionAppName", *parsed) + if id.UserProvidedFunctionAppName, ok = input.Parsed["userProvidedFunctionAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userProvidedFunctionAppName", input) } - return &id, nil + return nil } // ValidateBuildUserProvidedFunctionAppID checks that 'input' can be parsed as a Build User Provided Function App ID diff --git a/resource-manager/web/2023-01-01/staticsites/id_customdomain.go b/resource-manager/web/2023-01-01/staticsites/id_customdomain.go index 6c3831ab55c..dbea7275339 100644 --- a/resource-manager/web/2023-01-01/staticsites/id_customdomain.go +++ b/resource-manager/web/2023-01-01/staticsites/id_customdomain.go @@ -38,23 +38,9 @@ func ParseCustomDomainID(input string) (*CustomDomainId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CustomDomainId{} - - 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.StaticSiteName, ok = parsed.Parsed["staticSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", *parsed) - } - - if id.CustomDomainName, ok = parsed.Parsed["customDomainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "customDomainName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCustomDomainIDInsensitively(input string) (*CustomDomainId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CustomDomainId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CustomDomainId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StaticSiteName, ok = parsed.Parsed["staticSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", *parsed) + if id.StaticSiteName, ok = input.Parsed["staticSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", input) } - if id.CustomDomainName, ok = parsed.Parsed["customDomainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "customDomainName", *parsed) + if id.CustomDomainName, ok = input.Parsed["customDomainName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "customDomainName", input) } - return &id, nil + return nil } // ValidateCustomDomainID checks that 'input' can be parsed as a Custom Domain ID diff --git a/resource-manager/web/2023-01-01/staticsites/id_databaseconnection.go b/resource-manager/web/2023-01-01/staticsites/id_databaseconnection.go index ff0cbb9a161..e8fcbcd940e 100644 --- a/resource-manager/web/2023-01-01/staticsites/id_databaseconnection.go +++ b/resource-manager/web/2023-01-01/staticsites/id_databaseconnection.go @@ -38,23 +38,9 @@ func ParseDatabaseConnectionID(input string) (*DatabaseConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseConnectionId{} - - 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.StaticSiteName, ok = parsed.Parsed["staticSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", *parsed) - } - - if id.DatabaseConnectionName, ok = parsed.Parsed["databaseConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDatabaseConnectionIDInsensitively(input string) (*DatabaseConnectionId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DatabaseConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StaticSiteName, ok = parsed.Parsed["staticSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", *parsed) + if id.StaticSiteName, ok = input.Parsed["staticSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", input) } - if id.DatabaseConnectionName, ok = parsed.Parsed["databaseConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseConnectionName", *parsed) + if id.DatabaseConnectionName, ok = input.Parsed["databaseConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseConnectionName", input) } - return &id, nil + return nil } // ValidateDatabaseConnectionID checks that 'input' can be parsed as a Database Connection ID diff --git a/resource-manager/web/2023-01-01/staticsites/id_linkedbackend.go b/resource-manager/web/2023-01-01/staticsites/id_linkedbackend.go index e0ddbaca788..179c6311cbe 100644 --- a/resource-manager/web/2023-01-01/staticsites/id_linkedbackend.go +++ b/resource-manager/web/2023-01-01/staticsites/id_linkedbackend.go @@ -38,23 +38,9 @@ func ParseLinkedBackendID(input string) (*LinkedBackendId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LinkedBackendId{} - - 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.StaticSiteName, ok = parsed.Parsed["staticSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", *parsed) - } - - if id.LinkedBackendName, ok = parsed.Parsed["linkedBackendName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "linkedBackendName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseLinkedBackendIDInsensitively(input string) (*LinkedBackendId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LinkedBackendId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *LinkedBackendId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StaticSiteName, ok = parsed.Parsed["staticSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", *parsed) + if id.StaticSiteName, ok = input.Parsed["staticSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", input) } - if id.LinkedBackendName, ok = parsed.Parsed["linkedBackendName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "linkedBackendName", *parsed) + if id.LinkedBackendName, ok = input.Parsed["linkedBackendName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "linkedBackendName", input) } - return &id, nil + return nil } // ValidateLinkedBackendID checks that 'input' can be parsed as a Linked Backend ID diff --git a/resource-manager/web/2023-01-01/staticsites/id_providerlocation.go b/resource-manager/web/2023-01-01/staticsites/id_providerlocation.go index 03856e00e52..aa6e5476eb5 100644 --- a/resource-manager/web/2023-01-01/staticsites/id_providerlocation.go +++ b/resource-manager/web/2023-01-01/staticsites/id_providerlocation.go @@ -34,15 +34,9 @@ func ParseProviderLocationID(input string) (*ProviderLocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseProviderLocationIDInsensitively(input string) (*ProviderLocationId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderLocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ProviderLocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateProviderLocationID checks that 'input' can be parsed as a Provider Location ID diff --git a/resource-manager/web/2023-01-01/staticsites/id_staticsite.go b/resource-manager/web/2023-01-01/staticsites/id_staticsite.go index 6c3fe5a0568..bcad7d1192e 100644 --- a/resource-manager/web/2023-01-01/staticsites/id_staticsite.go +++ b/resource-manager/web/2023-01-01/staticsites/id_staticsite.go @@ -36,19 +36,9 @@ func ParseStaticSiteID(input string) (*StaticSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StaticSiteId{} - - 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.StaticSiteName, ok = parsed.Parsed["staticSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseStaticSiteIDInsensitively(input string) (*StaticSiteId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StaticSiteId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *StaticSiteId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StaticSiteName, ok = parsed.Parsed["staticSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", *parsed) + if id.StaticSiteName, ok = input.Parsed["staticSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", input) } - return &id, nil + return nil } // ValidateStaticSiteID checks that 'input' can be parsed as a Static Site ID diff --git a/resource-manager/web/2023-01-01/staticsites/id_staticsiteprivateendpointconnection.go b/resource-manager/web/2023-01-01/staticsites/id_staticsiteprivateendpointconnection.go index 7bf39fdc2b8..8e4f8f8de88 100644 --- a/resource-manager/web/2023-01-01/staticsites/id_staticsiteprivateendpointconnection.go +++ b/resource-manager/web/2023-01-01/staticsites/id_staticsiteprivateendpointconnection.go @@ -38,23 +38,9 @@ func ParseStaticSitePrivateEndpointConnectionID(input string) (*StaticSitePrivat return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StaticSitePrivateEndpointConnectionId{} - - 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.StaticSiteName, ok = parsed.Parsed["staticSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseStaticSitePrivateEndpointConnectionIDInsensitively(input string) (*Sta return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := StaticSitePrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *StaticSitePrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StaticSiteName, ok = parsed.Parsed["staticSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", *parsed) + if id.StaticSiteName, ok = input.Parsed["staticSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidateStaticSitePrivateEndpointConnectionID checks that 'input' can be parsed as a Static Site Private Endpoint Connection ID diff --git a/resource-manager/web/2023-01-01/staticsites/id_user.go b/resource-manager/web/2023-01-01/staticsites/id_user.go index 76334a31978..73377a28325 100644 --- a/resource-manager/web/2023-01-01/staticsites/id_user.go +++ b/resource-manager/web/2023-01-01/staticsites/id_user.go @@ -40,27 +40,9 @@ func ParseUserID(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} - - 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.StaticSiteName, ok = parsed.Parsed["staticSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", *parsed) - } - - if id.AuthProviderName, ok = parsed.Parsed["authProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authProviderName", *parsed) - } - - if id.UserName, ok = parsed.Parsed["userName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseUserIDInsensitively(input string) (*UserId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *UserId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StaticSiteName, ok = parsed.Parsed["staticSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", *parsed) + if id.StaticSiteName, ok = input.Parsed["staticSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", input) } - if id.AuthProviderName, ok = parsed.Parsed["authProviderName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "authProviderName", *parsed) + if id.AuthProviderName, ok = input.Parsed["authProviderName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "authProviderName", input) } - if id.UserName, ok = parsed.Parsed["userName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userName", *parsed) + if id.UserName, ok = input.Parsed["userName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userName", input) } - return &id, nil + return nil } // ValidateUserID checks that 'input' can be parsed as a User ID diff --git a/resource-manager/web/2023-01-01/staticsites/id_userprovidedfunctionapp.go b/resource-manager/web/2023-01-01/staticsites/id_userprovidedfunctionapp.go index 718865debfc..49630eed1ee 100644 --- a/resource-manager/web/2023-01-01/staticsites/id_userprovidedfunctionapp.go +++ b/resource-manager/web/2023-01-01/staticsites/id_userprovidedfunctionapp.go @@ -38,23 +38,9 @@ func ParseUserProvidedFunctionAppID(input string) (*UserProvidedFunctionAppId, e return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserProvidedFunctionAppId{} - - 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.StaticSiteName, ok = parsed.Parsed["staticSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", *parsed) - } - - if id.UserProvidedFunctionAppName, ok = parsed.Parsed["userProvidedFunctionAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userProvidedFunctionAppName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseUserProvidedFunctionAppIDInsensitively(input string) (*UserProvidedFun return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := UserProvidedFunctionAppId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *UserProvidedFunctionAppId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.StaticSiteName, ok = parsed.Parsed["staticSiteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", *parsed) + if id.StaticSiteName, ok = input.Parsed["staticSiteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "staticSiteName", input) } - if id.UserProvidedFunctionAppName, ok = parsed.Parsed["userProvidedFunctionAppName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "userProvidedFunctionAppName", *parsed) + if id.UserProvidedFunctionAppName, ok = input.Parsed["userProvidedFunctionAppName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "userProvidedFunctionAppName", input) } - return &id, nil + return nil } // ValidateUserProvidedFunctionAppID checks that 'input' can be parsed as a User Provided Function App ID diff --git a/resource-manager/web/2023-01-01/topleveldomains/id_topleveldomain.go b/resource-manager/web/2023-01-01/topleveldomains/id_topleveldomain.go index 2ae951f5d2e..3faef0ad6fe 100644 --- a/resource-manager/web/2023-01-01/topleveldomains/id_topleveldomain.go +++ b/resource-manager/web/2023-01-01/topleveldomains/id_topleveldomain.go @@ -34,15 +34,9 @@ func ParseTopLevelDomainID(input string) (*TopLevelDomainId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TopLevelDomainId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.TopLevelDomainName, ok = parsed.Parsed["topLevelDomainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topLevelDomainName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseTopLevelDomainIDInsensitively(input string) (*TopLevelDomainId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TopLevelDomainId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TopLevelDomainId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.TopLevelDomainName, ok = parsed.Parsed["topLevelDomainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "topLevelDomainName", *parsed) + if id.TopLevelDomainName, ok = input.Parsed["topLevelDomainName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "topLevelDomainName", input) } - return &id, nil + return nil } // ValidateTopLevelDomainID checks that 'input' can be parsed as a Top Level Domain ID diff --git a/resource-manager/web/2023-01-01/webapps/id_appsetting.go b/resource-manager/web/2023-01-01/webapps/id_appsetting.go index 90a37b2bd62..8bbf3e816c3 100644 --- a/resource-manager/web/2023-01-01/webapps/id_appsetting.go +++ b/resource-manager/web/2023-01-01/webapps/id_appsetting.go @@ -38,23 +38,9 @@ func ParseAppSettingID(input string) (*AppSettingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AppSettingId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.AppSettingKey, ok = parsed.Parsed["appSettingKey"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "appSettingKey", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseAppSettingIDInsensitively(input string) (*AppSettingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AppSettingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AppSettingId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.AppSettingKey, ok = parsed.Parsed["appSettingKey"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "appSettingKey", *parsed) + if id.AppSettingKey, ok = input.Parsed["appSettingKey"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "appSettingKey", input) } - return &id, nil + return nil } // ValidateAppSettingID checks that 'input' can be parsed as a App Setting ID diff --git a/resource-manager/web/2023-01-01/webapps/id_backup.go b/resource-manager/web/2023-01-01/webapps/id_backup.go index 16b83a88548..5eb75e41c8a 100644 --- a/resource-manager/web/2023-01-01/webapps/id_backup.go +++ b/resource-manager/web/2023-01-01/webapps/id_backup.go @@ -38,23 +38,9 @@ func ParseBackupID(input string) (*BackupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.BackupId, ok = parsed.Parsed["backupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseBackupIDInsensitively(input string) (*BackupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := BackupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.BackupId, ok = parsed.Parsed["backupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupId", *parsed) + if id.BackupId, ok = input.Parsed["backupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupId", input) } - return &id, nil + return nil } // ValidateBackupID checks that 'input' can be parsed as a Backup ID diff --git a/resource-manager/web/2023-01-01/webapps/id_configreferenceappsetting.go b/resource-manager/web/2023-01-01/webapps/id_configreferenceappsetting.go index 17ecdec0011..2464de4561f 100644 --- a/resource-manager/web/2023-01-01/webapps/id_configreferenceappsetting.go +++ b/resource-manager/web/2023-01-01/webapps/id_configreferenceappsetting.go @@ -40,27 +40,9 @@ func ParseConfigReferenceAppSettingID(input string) (*ConfigReferenceAppSettingI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigReferenceAppSettingId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.AppSettingKey, ok = parsed.Parsed["appSettingKey"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "appSettingKey", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseConfigReferenceAppSettingIDInsensitively(input string) (*ConfigReferen return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigReferenceAppSettingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ConfigReferenceAppSettingId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.AppSettingKey, ok = parsed.Parsed["appSettingKey"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "appSettingKey", *parsed) + if id.AppSettingKey, ok = input.Parsed["appSettingKey"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "appSettingKey", input) } - return &id, nil + return nil } // ValidateConfigReferenceAppSettingID checks that 'input' can be parsed as a Config Reference App Setting ID diff --git a/resource-manager/web/2023-01-01/webapps/id_configreferenceconnectionstring.go b/resource-manager/web/2023-01-01/webapps/id_configreferenceconnectionstring.go index cb3cec4348a..1b238cdc1a5 100644 --- a/resource-manager/web/2023-01-01/webapps/id_configreferenceconnectionstring.go +++ b/resource-manager/web/2023-01-01/webapps/id_configreferenceconnectionstring.go @@ -40,27 +40,9 @@ func ParseConfigReferenceConnectionStringID(input string) (*ConfigReferenceConne return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigReferenceConnectionStringId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.ConnectionStringKey, ok = parsed.Parsed["connectionStringKey"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionStringKey", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseConfigReferenceConnectionStringIDInsensitively(input string) (*ConfigR return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConfigReferenceConnectionStringId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ConfigReferenceConnectionStringId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.ConnectionStringKey, ok = parsed.Parsed["connectionStringKey"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionStringKey", *parsed) + if id.ConnectionStringKey, ok = input.Parsed["connectionStringKey"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectionStringKey", input) } - return &id, nil + return nil } // ValidateConfigReferenceConnectionStringID checks that 'input' can be parsed as a Config Reference Connection String ID diff --git a/resource-manager/web/2023-01-01/webapps/id_connectionstring.go b/resource-manager/web/2023-01-01/webapps/id_connectionstring.go index 4f03d7e906a..0026da1c832 100644 --- a/resource-manager/web/2023-01-01/webapps/id_connectionstring.go +++ b/resource-manager/web/2023-01-01/webapps/id_connectionstring.go @@ -38,23 +38,9 @@ func ParseConnectionStringID(input string) (*ConnectionStringId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionStringId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.ConnectionStringKey, ok = parsed.Parsed["connectionStringKey"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionStringKey", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseConnectionStringIDInsensitively(input string) (*ConnectionStringId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ConnectionStringId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ConnectionStringId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.ConnectionStringKey, ok = parsed.Parsed["connectionStringKey"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "connectionStringKey", *parsed) + if id.ConnectionStringKey, ok = input.Parsed["connectionStringKey"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "connectionStringKey", input) } - return &id, nil + return nil } // ValidateConnectionStringID checks that 'input' can be parsed as a Connection String ID diff --git a/resource-manager/web/2023-01-01/webapps/id_continuouswebjob.go b/resource-manager/web/2023-01-01/webapps/id_continuouswebjob.go index 82914ec65a2..db74d01b1ae 100644 --- a/resource-manager/web/2023-01-01/webapps/id_continuouswebjob.go +++ b/resource-manager/web/2023-01-01/webapps/id_continuouswebjob.go @@ -38,23 +38,9 @@ func ParseContinuousWebJobID(input string) (*ContinuousWebJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContinuousWebJobId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.ContinuousWebJobName, ok = parsed.Parsed["continuousWebJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "continuousWebJobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseContinuousWebJobIDInsensitively(input string) (*ContinuousWebJobId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ContinuousWebJobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ContinuousWebJobId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.ContinuousWebJobName, ok = parsed.Parsed["continuousWebJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "continuousWebJobName", *parsed) + if id.ContinuousWebJobName, ok = input.Parsed["continuousWebJobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "continuousWebJobName", input) } - return &id, nil + return nil } // ValidateContinuousWebJobID checks that 'input' can be parsed as a Continuous Web Job ID diff --git a/resource-manager/web/2023-01-01/webapps/id_default.go b/resource-manager/web/2023-01-01/webapps/id_default.go index a45b0d91911..2504429e1f3 100644 --- a/resource-manager/web/2023-01-01/webapps/id_default.go +++ b/resource-manager/web/2023-01-01/webapps/id_default.go @@ -40,27 +40,9 @@ func ParseDefaultID(input string) (*DefaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DefaultId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.DefaultName, ok = parsed.Parsed["defaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "defaultName", *parsed) - } - - if id.KeyName, ok = parsed.Parsed["keyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseDefaultIDInsensitively(input string) (*DefaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DefaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *DefaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.DefaultName, ok = parsed.Parsed["defaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "defaultName", *parsed) + if id.DefaultName, ok = input.Parsed["defaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "defaultName", input) } - if id.KeyName, ok = parsed.Parsed["keyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyName", *parsed) + if id.KeyName, ok = input.Parsed["keyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "keyName", input) } - return &id, nil + return nil } // ValidateDefaultID checks that 'input' can be parsed as a Default ID diff --git a/resource-manager/web/2023-01-01/webapps/id_deployment.go b/resource-manager/web/2023-01-01/webapps/id_deployment.go index d4512a8a345..b04a811e64d 100644 --- a/resource-manager/web/2023-01-01/webapps/id_deployment.go +++ b/resource-manager/web/2023-01-01/webapps/id_deployment.go @@ -38,23 +38,9 @@ func ParseDeploymentID(input string) (*DeploymentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeploymentId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDeploymentIDInsensitively(input string) (*DeploymentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DeploymentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DeploymentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if id.DeploymentName, ok = input.Parsed["deploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", input) } - return &id, nil + return nil } // ValidateDeploymentID checks that 'input' can be parsed as a Deployment ID diff --git a/resource-manager/web/2023-01-01/webapps/id_domainownershipidentifier.go b/resource-manager/web/2023-01-01/webapps/id_domainownershipidentifier.go index 15e7aece781..4cb36ffe991 100644 --- a/resource-manager/web/2023-01-01/webapps/id_domainownershipidentifier.go +++ b/resource-manager/web/2023-01-01/webapps/id_domainownershipidentifier.go @@ -38,23 +38,9 @@ func ParseDomainOwnershipIdentifierID(input string) (*DomainOwnershipIdentifierI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DomainOwnershipIdentifierId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.DomainOwnershipIdentifierName, ok = parsed.Parsed["domainOwnershipIdentifierName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainOwnershipIdentifierName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDomainOwnershipIdentifierIDInsensitively(input string) (*DomainOwnersh return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DomainOwnershipIdentifierId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DomainOwnershipIdentifierId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.DomainOwnershipIdentifierName, ok = parsed.Parsed["domainOwnershipIdentifierName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainOwnershipIdentifierName", *parsed) + if id.DomainOwnershipIdentifierName, ok = input.Parsed["domainOwnershipIdentifierName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "domainOwnershipIdentifierName", input) } - return &id, nil + return nil } // ValidateDomainOwnershipIdentifierID checks that 'input' can be parsed as a Domain Ownership Identifier ID diff --git a/resource-manager/web/2023-01-01/webapps/id_function.go b/resource-manager/web/2023-01-01/webapps/id_function.go index c4cc0117dfa..50ec22415e9 100644 --- a/resource-manager/web/2023-01-01/webapps/id_function.go +++ b/resource-manager/web/2023-01-01/webapps/id_function.go @@ -38,23 +38,9 @@ func ParseFunctionID(input string) (*FunctionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FunctionId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.FunctionName, ok = parsed.Parsed["functionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "functionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseFunctionIDInsensitively(input string) (*FunctionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FunctionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *FunctionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.FunctionName, ok = parsed.Parsed["functionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "functionName", *parsed) + if id.FunctionName, ok = input.Parsed["functionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "functionName", input) } - return &id, nil + return nil } // ValidateFunctionID checks that 'input' can be parsed as a Function ID diff --git a/resource-manager/web/2023-01-01/webapps/id_functionkey.go b/resource-manager/web/2023-01-01/webapps/id_functionkey.go index 5b7393d379b..8bde4cda147 100644 --- a/resource-manager/web/2023-01-01/webapps/id_functionkey.go +++ b/resource-manager/web/2023-01-01/webapps/id_functionkey.go @@ -42,31 +42,9 @@ func ParseFunctionKeyID(input string) (*FunctionKeyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FunctionKeyId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.FunctionName, ok = parsed.Parsed["functionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "functionName", *parsed) - } - - if id.KeyName, ok = parsed.Parsed["keyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseFunctionKeyIDInsensitively(input string) (*FunctionKeyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := FunctionKeyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *FunctionKeyId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.FunctionName, ok = parsed.Parsed["functionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "functionName", *parsed) + if id.FunctionName, ok = input.Parsed["functionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "functionName", input) } - if id.KeyName, ok = parsed.Parsed["keyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyName", *parsed) + if id.KeyName, ok = input.Parsed["keyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "keyName", input) } - return &id, nil + return nil } // ValidateFunctionKeyID checks that 'input' can be parsed as a Function Key ID diff --git a/resource-manager/web/2023-01-01/webapps/id_gateway.go b/resource-manager/web/2023-01-01/webapps/id_gateway.go index 0f44bbd3940..89657833244 100644 --- a/resource-manager/web/2023-01-01/webapps/id_gateway.go +++ b/resource-manager/web/2023-01-01/webapps/id_gateway.go @@ -40,27 +40,9 @@ func ParseGatewayID(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.VirtualNetworkConnectionName, ok = parsed.Parsed["virtualNetworkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkConnectionName", *parsed) - } - - if id.GatewayName, ok = parsed.Parsed["gatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseGatewayIDInsensitively(input string) (*GatewayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := GatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *GatewayId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.VirtualNetworkConnectionName, ok = parsed.Parsed["virtualNetworkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkConnectionName", *parsed) + if id.VirtualNetworkConnectionName, ok = input.Parsed["virtualNetworkConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkConnectionName", input) } - if id.GatewayName, ok = parsed.Parsed["gatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayName", *parsed) + if id.GatewayName, ok = input.Parsed["gatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayName", input) } - return &id, nil + return nil } // ValidateGatewayID checks that 'input' can be parsed as a Gateway ID diff --git a/resource-manager/web/2023-01-01/webapps/id_history.go b/resource-manager/web/2023-01-01/webapps/id_history.go index f4909efba3b..1c0ca4de4d6 100644 --- a/resource-manager/web/2023-01-01/webapps/id_history.go +++ b/resource-manager/web/2023-01-01/webapps/id_history.go @@ -40,27 +40,9 @@ func ParseHistoryID(input string) (*HistoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HistoryId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.TriggeredWebJobName, ok = parsed.Parsed["triggeredWebJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggeredWebJobName", *parsed) - } - - if id.HistoryName, ok = parsed.Parsed["historyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "historyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseHistoryIDInsensitively(input string) (*HistoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HistoryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *HistoryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.TriggeredWebJobName, ok = parsed.Parsed["triggeredWebJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggeredWebJobName", *parsed) + if id.TriggeredWebJobName, ok = input.Parsed["triggeredWebJobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "triggeredWebJobName", input) } - if id.HistoryName, ok = parsed.Parsed["historyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "historyName", *parsed) + if id.HistoryName, ok = input.Parsed["historyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "historyName", input) } - return &id, nil + return nil } // ValidateHistoryID checks that 'input' can be parsed as a History ID diff --git a/resource-manager/web/2023-01-01/webapps/id_hostdefault.go b/resource-manager/web/2023-01-01/webapps/id_hostdefault.go index 9d971ecb036..8786787ad05 100644 --- a/resource-manager/web/2023-01-01/webapps/id_hostdefault.go +++ b/resource-manager/web/2023-01-01/webapps/id_hostdefault.go @@ -42,31 +42,9 @@ func ParseHostDefaultID(input string) (*HostDefaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostDefaultId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.DefaultName, ok = parsed.Parsed["defaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "defaultName", *parsed) - } - - if id.KeyName, ok = parsed.Parsed["keyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseHostDefaultIDInsensitively(input string) (*HostDefaultId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostDefaultId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *HostDefaultId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.DefaultName, ok = parsed.Parsed["defaultName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "defaultName", *parsed) + if id.DefaultName, ok = input.Parsed["defaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "defaultName", input) } - if id.KeyName, ok = parsed.Parsed["keyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyName", *parsed) + if id.KeyName, ok = input.Parsed["keyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "keyName", input) } - return &id, nil + return nil } // ValidateHostDefaultID checks that 'input' can be parsed as a Host Default ID diff --git a/resource-manager/web/2023-01-01/webapps/id_hostnamebinding.go b/resource-manager/web/2023-01-01/webapps/id_hostnamebinding.go index 2c7d264c7f7..445cdd8c1f4 100644 --- a/resource-manager/web/2023-01-01/webapps/id_hostnamebinding.go +++ b/resource-manager/web/2023-01-01/webapps/id_hostnamebinding.go @@ -38,23 +38,9 @@ func ParseHostNameBindingID(input string) (*HostNameBindingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostNameBindingId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.HostNameBindingName, ok = parsed.Parsed["hostNameBindingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostNameBindingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseHostNameBindingIDInsensitively(input string) (*HostNameBindingId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HostNameBindingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *HostNameBindingId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.HostNameBindingName, ok = parsed.Parsed["hostNameBindingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostNameBindingName", *parsed) + if id.HostNameBindingName, ok = input.Parsed["hostNameBindingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostNameBindingName", input) } - return &id, nil + return nil } // ValidateHostNameBindingID checks that 'input' can be parsed as a Host Name Binding ID diff --git a/resource-manager/web/2023-01-01/webapps/id_hybridconnection.go b/resource-manager/web/2023-01-01/webapps/id_hybridconnection.go index 37b10cd84ef..05a52ef303c 100644 --- a/resource-manager/web/2023-01-01/webapps/id_hybridconnection.go +++ b/resource-manager/web/2023-01-01/webapps/id_hybridconnection.go @@ -38,23 +38,9 @@ func ParseHybridConnectionID(input string) (*HybridConnectionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HybridConnectionId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.HybridConnectionName, ok = parsed.Parsed["hybridConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseHybridConnectionIDInsensitively(input string) (*HybridConnectionId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HybridConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *HybridConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.HybridConnectionName, ok = parsed.Parsed["hybridConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridConnectionName", *parsed) + if id.HybridConnectionName, ok = input.Parsed["hybridConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hybridConnectionName", input) } - return &id, nil + return nil } // ValidateHybridConnectionID checks that 'input' can be parsed as a Hybrid Connection ID diff --git a/resource-manager/web/2023-01-01/webapps/id_instance.go b/resource-manager/web/2023-01-01/webapps/id_instance.go index 47c279d2780..b71b552f4a3 100644 --- a/resource-manager/web/2023-01-01/webapps/id_instance.go +++ b/resource-manager/web/2023-01-01/webapps/id_instance.go @@ -38,23 +38,9 @@ func ParseInstanceID(input string) (*InstanceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InstanceId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseInstanceIDInsensitively(input string) (*InstanceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *InstanceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if id.InstanceId, ok = input.Parsed["instanceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceId", input) } - return &id, nil + return nil } // ValidateInstanceID checks that 'input' can be parsed as a Instance ID diff --git a/resource-manager/web/2023-01-01/webapps/id_instanceprocess.go b/resource-manager/web/2023-01-01/webapps/id_instanceprocess.go index be393773799..d63ca842bbe 100644 --- a/resource-manager/web/2023-01-01/webapps/id_instanceprocess.go +++ b/resource-manager/web/2023-01-01/webapps/id_instanceprocess.go @@ -40,27 +40,9 @@ func ParseInstanceProcessID(input string) (*InstanceProcessId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InstanceProcessId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) - } - - if id.ProcessId, ok = parsed.Parsed["processId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "processId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseInstanceProcessIDInsensitively(input string) (*InstanceProcessId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InstanceProcessId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *InstanceProcessId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if id.InstanceId, ok = input.Parsed["instanceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceId", input) } - if id.ProcessId, ok = parsed.Parsed["processId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "processId", *parsed) + if id.ProcessId, ok = input.Parsed["processId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "processId", input) } - return &id, nil + return nil } // ValidateInstanceProcessID checks that 'input' can be parsed as a Instance Process ID diff --git a/resource-manager/web/2023-01-01/webapps/id_instanceprocessmodule.go b/resource-manager/web/2023-01-01/webapps/id_instanceprocessmodule.go index b9bd89816da..f05e0fc2d20 100644 --- a/resource-manager/web/2023-01-01/webapps/id_instanceprocessmodule.go +++ b/resource-manager/web/2023-01-01/webapps/id_instanceprocessmodule.go @@ -42,31 +42,9 @@ func ParseInstanceProcessModuleID(input string) (*InstanceProcessModuleId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InstanceProcessModuleId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) - } - - if id.ProcessId, ok = parsed.Parsed["processId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "processId", *parsed) - } - - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseInstanceProcessModuleIDInsensitively(input string) (*InstanceProcessMo return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InstanceProcessModuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *InstanceProcessModuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if id.InstanceId, ok = input.Parsed["instanceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceId", input) } - if id.ProcessId, ok = parsed.Parsed["processId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "processId", *parsed) + if id.ProcessId, ok = input.Parsed["processId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "processId", input) } - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if id.ModuleName, ok = input.Parsed["moduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "moduleName", input) } - return &id, nil + return nil } // ValidateInstanceProcessModuleID checks that 'input' can be parsed as a Instance Process Module ID diff --git a/resource-manager/web/2023-01-01/webapps/id_key.go b/resource-manager/web/2023-01-01/webapps/id_key.go index c0a9c0a06f9..c24d2c75274 100644 --- a/resource-manager/web/2023-01-01/webapps/id_key.go +++ b/resource-manager/web/2023-01-01/webapps/id_key.go @@ -40,27 +40,9 @@ func ParseKeyID(input string) (*KeyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := KeyId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.FunctionName, ok = parsed.Parsed["functionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "functionName", *parsed) - } - - if id.KeyName, ok = parsed.Parsed["keyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseKeyIDInsensitively(input string) (*KeyId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := KeyId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *KeyId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.FunctionName, ok = parsed.Parsed["functionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "functionName", *parsed) + if id.FunctionName, ok = input.Parsed["functionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "functionName", input) } - if id.KeyName, ok = parsed.Parsed["keyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "keyName", *parsed) + if id.KeyName, ok = input.Parsed["keyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "keyName", input) } - return &id, nil + return nil } // ValidateKeyID checks that 'input' can be parsed as a Key ID diff --git a/resource-manager/web/2023-01-01/webapps/id_module.go b/resource-manager/web/2023-01-01/webapps/id_module.go index 8efcceee146..4992de29755 100644 --- a/resource-manager/web/2023-01-01/webapps/id_module.go +++ b/resource-manager/web/2023-01-01/webapps/id_module.go @@ -40,27 +40,9 @@ func ParseModuleID(input string) (*ModuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModuleId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.ProcessId, ok = parsed.Parsed["processId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "processId", *parsed) - } - - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseModuleIDInsensitively(input string) (*ModuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ModuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ModuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.ProcessId, ok = parsed.Parsed["processId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "processId", *parsed) + if id.ProcessId, ok = input.Parsed["processId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "processId", input) } - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if id.ModuleName, ok = input.Parsed["moduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "moduleName", input) } - return &id, nil + return nil } // ValidateModuleID checks that 'input' can be parsed as a Module ID diff --git a/resource-manager/web/2023-01-01/webapps/id_networkfeature.go b/resource-manager/web/2023-01-01/webapps/id_networkfeature.go index e75d15419bc..39aca6abdad 100644 --- a/resource-manager/web/2023-01-01/webapps/id_networkfeature.go +++ b/resource-manager/web/2023-01-01/webapps/id_networkfeature.go @@ -38,23 +38,9 @@ func ParseNetworkFeatureID(input string) (*NetworkFeatureId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkFeatureId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.NetworkFeatureName, ok = parsed.Parsed["networkFeatureName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkFeatureName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseNetworkFeatureIDInsensitively(input string) (*NetworkFeatureId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkFeatureId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *NetworkFeatureId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.NetworkFeatureName, ok = parsed.Parsed["networkFeatureName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkFeatureName", *parsed) + if id.NetworkFeatureName, ok = input.Parsed["networkFeatureName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkFeatureName", input) } - return &id, nil + return nil } // ValidateNetworkFeatureID checks that 'input' can be parsed as a Network Feature ID diff --git a/resource-manager/web/2023-01-01/webapps/id_networktrace.go b/resource-manager/web/2023-01-01/webapps/id_networktrace.go index b81b95a9de2..2649b121ba4 100644 --- a/resource-manager/web/2023-01-01/webapps/id_networktrace.go +++ b/resource-manager/web/2023-01-01/webapps/id_networktrace.go @@ -38,23 +38,9 @@ func ParseNetworkTraceID(input string) (*NetworkTraceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkTraceId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseNetworkTraceIDInsensitively(input string) (*NetworkTraceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := NetworkTraceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *NetworkTraceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if id.OperationId, ok = input.Parsed["operationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "operationId", input) } - return &id, nil + return nil } // ValidateNetworkTraceID checks that 'input' can be parsed as a Network Trace ID diff --git a/resource-manager/web/2023-01-01/webapps/id_premieraddon.go b/resource-manager/web/2023-01-01/webapps/id_premieraddon.go index c3b272f1e88..2d423b516ec 100644 --- a/resource-manager/web/2023-01-01/webapps/id_premieraddon.go +++ b/resource-manager/web/2023-01-01/webapps/id_premieraddon.go @@ -38,23 +38,9 @@ func ParsePremierAddonID(input string) (*PremierAddonId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PremierAddonId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.PremierAddonName, ok = parsed.Parsed["premierAddonName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "premierAddonName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePremierAddonIDInsensitively(input string) (*PremierAddonId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PremierAddonId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PremierAddonId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.PremierAddonName, ok = parsed.Parsed["premierAddonName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "premierAddonName", *parsed) + if id.PremierAddonName, ok = input.Parsed["premierAddonName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "premierAddonName", input) } - return &id, nil + return nil } // ValidatePremierAddonID checks that 'input' can be parsed as a Premier Addon ID diff --git a/resource-manager/web/2023-01-01/webapps/id_privateendpointconnection.go b/resource-manager/web/2023-01-01/webapps/id_privateendpointconnection.go index 310dae565b0..3295084d8a6 100644 --- a/resource-manager/web/2023-01-01/webapps/id_privateendpointconnection.go +++ b/resource-manager/web/2023-01-01/webapps/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/web/2023-01-01/webapps/id_process.go b/resource-manager/web/2023-01-01/webapps/id_process.go index b5217930469..8bad3c8ed48 100644 --- a/resource-manager/web/2023-01-01/webapps/id_process.go +++ b/resource-manager/web/2023-01-01/webapps/id_process.go @@ -38,23 +38,9 @@ func ParseProcessID(input string) (*ProcessId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProcessId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.ProcessId, ok = parsed.Parsed["processId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "processId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProcessIDInsensitively(input string) (*ProcessId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProcessId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProcessId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.ProcessId, ok = parsed.Parsed["processId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "processId", *parsed) + if id.ProcessId, ok = input.Parsed["processId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "processId", input) } - return &id, nil + return nil } // ValidateProcessID checks that 'input' can be parsed as a Process ID diff --git a/resource-manager/web/2023-01-01/webapps/id_processmodule.go b/resource-manager/web/2023-01-01/webapps/id_processmodule.go index 8b363ea518e..b4c90cb7011 100644 --- a/resource-manager/web/2023-01-01/webapps/id_processmodule.go +++ b/resource-manager/web/2023-01-01/webapps/id_processmodule.go @@ -42,31 +42,9 @@ func ParseProcessModuleID(input string) (*ProcessModuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProcessModuleId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.ProcessId, ok = parsed.Parsed["processId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "processId", *parsed) - } - - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseProcessModuleIDInsensitively(input string) (*ProcessModuleId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProcessModuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ProcessModuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.ProcessId, ok = parsed.Parsed["processId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "processId", *parsed) + if id.ProcessId, ok = input.Parsed["processId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "processId", input) } - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if id.ModuleName, ok = input.Parsed["moduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "moduleName", input) } - return &id, nil + return nil } // ValidateProcessModuleID checks that 'input' can be parsed as a Process Module ID diff --git a/resource-manager/web/2023-01-01/webapps/id_publiccertificate.go b/resource-manager/web/2023-01-01/webapps/id_publiccertificate.go index 1a084e11fe5..5af96c29d89 100644 --- a/resource-manager/web/2023-01-01/webapps/id_publiccertificate.go +++ b/resource-manager/web/2023-01-01/webapps/id_publiccertificate.go @@ -38,23 +38,9 @@ func ParsePublicCertificateID(input string) (*PublicCertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PublicCertificateId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.PublicCertificateName, ok = parsed.Parsed["publicCertificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publicCertificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePublicCertificateIDInsensitively(input string) (*PublicCertificateId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PublicCertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PublicCertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.PublicCertificateName, ok = parsed.Parsed["publicCertificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publicCertificateName", *parsed) + if id.PublicCertificateName, ok = input.Parsed["publicCertificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publicCertificateName", input) } - return &id, nil + return nil } // ValidatePublicCertificateID checks that 'input' can be parsed as a Public Certificate ID diff --git a/resource-manager/web/2023-01-01/webapps/id_relay.go b/resource-manager/web/2023-01-01/webapps/id_relay.go index a5e88bad4d9..b7ef581f158 100644 --- a/resource-manager/web/2023-01-01/webapps/id_relay.go +++ b/resource-manager/web/2023-01-01/webapps/id_relay.go @@ -40,27 +40,9 @@ func ParseRelayID(input string) (*RelayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RelayId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.HybridConnectionNamespaceName, ok = parsed.Parsed["hybridConnectionNamespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridConnectionNamespaceName", *parsed) - } - - if id.RelayName, ok = parsed.Parsed["relayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "relayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseRelayIDInsensitively(input string) (*RelayId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RelayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RelayId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.HybridConnectionNamespaceName, ok = parsed.Parsed["hybridConnectionNamespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridConnectionNamespaceName", *parsed) + if id.HybridConnectionNamespaceName, ok = input.Parsed["hybridConnectionNamespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hybridConnectionNamespaceName", input) } - if id.RelayName, ok = parsed.Parsed["relayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "relayName", *parsed) + if id.RelayName, ok = input.Parsed["relayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "relayName", input) } - return &id, nil + return nil } // ValidateRelayID checks that 'input' can be parsed as a Relay ID diff --git a/resource-manager/web/2023-01-01/webapps/id_siteextension.go b/resource-manager/web/2023-01-01/webapps/id_siteextension.go index 07356e96dd7..24bc8cfac4e 100644 --- a/resource-manager/web/2023-01-01/webapps/id_siteextension.go +++ b/resource-manager/web/2023-01-01/webapps/id_siteextension.go @@ -38,23 +38,9 @@ func ParseSiteExtensionID(input string) (*SiteExtensionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SiteExtensionId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SiteExtensionId, ok = parsed.Parsed["siteExtensionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteExtensionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSiteExtensionIDInsensitively(input string) (*SiteExtensionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SiteExtensionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SiteExtensionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SiteExtensionId, ok = parsed.Parsed["siteExtensionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteExtensionId", *parsed) + if id.SiteExtensionId, ok = input.Parsed["siteExtensionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteExtensionId", input) } - return &id, nil + return nil } // ValidateSiteExtensionID checks that 'input' can be parsed as a Site Extension ID diff --git a/resource-manager/web/2023-01-01/webapps/id_sitenetworktrace.go b/resource-manager/web/2023-01-01/webapps/id_sitenetworktrace.go index 72d8a65f302..5e6ddf37b2f 100644 --- a/resource-manager/web/2023-01-01/webapps/id_sitenetworktrace.go +++ b/resource-manager/web/2023-01-01/webapps/id_sitenetworktrace.go @@ -38,23 +38,9 @@ func ParseSiteNetworkTraceID(input string) (*SiteNetworkTraceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SiteNetworkTraceId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSiteNetworkTraceIDInsensitively(input string) (*SiteNetworkTraceId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SiteNetworkTraceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SiteNetworkTraceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if id.OperationId, ok = input.Parsed["operationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "operationId", input) } - return &id, nil + return nil } // ValidateSiteNetworkTraceID checks that 'input' can be parsed as a Site Network Trace ID diff --git a/resource-manager/web/2023-01-01/webapps/id_siteslotnetworktrace.go b/resource-manager/web/2023-01-01/webapps/id_siteslotnetworktrace.go index ca1f4a58702..5c23156040b 100644 --- a/resource-manager/web/2023-01-01/webapps/id_siteslotnetworktrace.go +++ b/resource-manager/web/2023-01-01/webapps/id_siteslotnetworktrace.go @@ -40,27 +40,9 @@ func ParseSiteSlotNetworkTraceID(input string) (*SiteSlotNetworkTraceId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SiteSlotNetworkTraceId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSiteSlotNetworkTraceIDInsensitively(input string) (*SiteSlotNetworkTra return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SiteSlotNetworkTraceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SiteSlotNetworkTraceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if id.OperationId, ok = input.Parsed["operationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "operationId", input) } - return &id, nil + return nil } // ValidateSiteSlotNetworkTraceID checks that 'input' can be parsed as a Site Slot Network Trace ID diff --git a/resource-manager/web/2023-01-01/webapps/id_slot.go b/resource-manager/web/2023-01-01/webapps/id_slot.go index ac867ad4a87..e15a92882f1 100644 --- a/resource-manager/web/2023-01-01/webapps/id_slot.go +++ b/resource-manager/web/2023-01-01/webapps/id_slot.go @@ -38,23 +38,9 @@ func ParseSlotID(input string) (*SlotId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSlotIDInsensitively(input string) (*SlotId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SlotId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - return &id, nil + return nil } // ValidateSlotID checks that 'input' can be parsed as a Slot ID diff --git a/resource-manager/web/2023-01-01/webapps/id_slotbackup.go b/resource-manager/web/2023-01-01/webapps/id_slotbackup.go index d1d78f34add..196d2ef7799 100644 --- a/resource-manager/web/2023-01-01/webapps/id_slotbackup.go +++ b/resource-manager/web/2023-01-01/webapps/id_slotbackup.go @@ -40,27 +40,9 @@ func ParseSlotBackupID(input string) (*SlotBackupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotBackupId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.BackupId, ok = parsed.Parsed["backupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSlotBackupIDInsensitively(input string) (*SlotBackupId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotBackupId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SlotBackupId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.BackupId, ok = parsed.Parsed["backupId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "backupId", *parsed) + if id.BackupId, ok = input.Parsed["backupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupId", input) } - return &id, nil + return nil } // ValidateSlotBackupID checks that 'input' can be parsed as a Slot Backup ID diff --git a/resource-manager/web/2023-01-01/webapps/id_slotcontinuouswebjob.go b/resource-manager/web/2023-01-01/webapps/id_slotcontinuouswebjob.go index 8f684a225b9..fdacebe446a 100644 --- a/resource-manager/web/2023-01-01/webapps/id_slotcontinuouswebjob.go +++ b/resource-manager/web/2023-01-01/webapps/id_slotcontinuouswebjob.go @@ -40,27 +40,9 @@ func ParseSlotContinuousWebJobID(input string) (*SlotContinuousWebJobId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotContinuousWebJobId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.ContinuousWebJobName, ok = parsed.Parsed["continuousWebJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "continuousWebJobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSlotContinuousWebJobIDInsensitively(input string) (*SlotContinuousWebJ return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotContinuousWebJobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SlotContinuousWebJobId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.ContinuousWebJobName, ok = parsed.Parsed["continuousWebJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "continuousWebJobName", *parsed) + if id.ContinuousWebJobName, ok = input.Parsed["continuousWebJobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "continuousWebJobName", input) } - return &id, nil + return nil } // ValidateSlotContinuousWebJobID checks that 'input' can be parsed as a Slot Continuous Web Job ID diff --git a/resource-manager/web/2023-01-01/webapps/id_slotdeployment.go b/resource-manager/web/2023-01-01/webapps/id_slotdeployment.go index 6549fb21156..1c06c19237b 100644 --- a/resource-manager/web/2023-01-01/webapps/id_slotdeployment.go +++ b/resource-manager/web/2023-01-01/webapps/id_slotdeployment.go @@ -40,27 +40,9 @@ func ParseSlotDeploymentID(input string) (*SlotDeploymentId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotDeploymentId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSlotDeploymentIDInsensitively(input string) (*SlotDeploymentId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotDeploymentId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SlotDeploymentId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.DeploymentName, ok = parsed.Parsed["deploymentName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", *parsed) + if id.DeploymentName, ok = input.Parsed["deploymentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deploymentName", input) } - return &id, nil + return nil } // ValidateSlotDeploymentID checks that 'input' can be parsed as a Slot Deployment ID diff --git a/resource-manager/web/2023-01-01/webapps/id_slotdomainownershipidentifier.go b/resource-manager/web/2023-01-01/webapps/id_slotdomainownershipidentifier.go index fbfa235a874..a204baad734 100644 --- a/resource-manager/web/2023-01-01/webapps/id_slotdomainownershipidentifier.go +++ b/resource-manager/web/2023-01-01/webapps/id_slotdomainownershipidentifier.go @@ -40,27 +40,9 @@ func ParseSlotDomainOwnershipIdentifierID(input string) (*SlotDomainOwnershipIde return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotDomainOwnershipIdentifierId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.DomainOwnershipIdentifierName, ok = parsed.Parsed["domainOwnershipIdentifierName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainOwnershipIdentifierName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSlotDomainOwnershipIdentifierIDInsensitively(input string) (*SlotDomai return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotDomainOwnershipIdentifierId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SlotDomainOwnershipIdentifierId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.DomainOwnershipIdentifierName, ok = parsed.Parsed["domainOwnershipIdentifierName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "domainOwnershipIdentifierName", *parsed) + if id.DomainOwnershipIdentifierName, ok = input.Parsed["domainOwnershipIdentifierName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "domainOwnershipIdentifierName", input) } - return &id, nil + return nil } // ValidateSlotDomainOwnershipIdentifierID checks that 'input' can be parsed as a Slot Domain Ownership Identifier ID diff --git a/resource-manager/web/2023-01-01/webapps/id_slotfunction.go b/resource-manager/web/2023-01-01/webapps/id_slotfunction.go index 468949e855c..47101ae28cb 100644 --- a/resource-manager/web/2023-01-01/webapps/id_slotfunction.go +++ b/resource-manager/web/2023-01-01/webapps/id_slotfunction.go @@ -40,27 +40,9 @@ func ParseSlotFunctionID(input string) (*SlotFunctionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotFunctionId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.FunctionName, ok = parsed.Parsed["functionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "functionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSlotFunctionIDInsensitively(input string) (*SlotFunctionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotFunctionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SlotFunctionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.FunctionName, ok = parsed.Parsed["functionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "functionName", *parsed) + if id.FunctionName, ok = input.Parsed["functionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "functionName", input) } - return &id, nil + return nil } // ValidateSlotFunctionID checks that 'input' can be parsed as a Slot Function ID diff --git a/resource-manager/web/2023-01-01/webapps/id_slothostnamebinding.go b/resource-manager/web/2023-01-01/webapps/id_slothostnamebinding.go index 68dabae59c2..9b914c92db9 100644 --- a/resource-manager/web/2023-01-01/webapps/id_slothostnamebinding.go +++ b/resource-manager/web/2023-01-01/webapps/id_slothostnamebinding.go @@ -40,27 +40,9 @@ func ParseSlotHostNameBindingID(input string) (*SlotHostNameBindingId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotHostNameBindingId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.HostNameBindingName, ok = parsed.Parsed["hostNameBindingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostNameBindingName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSlotHostNameBindingIDInsensitively(input string) (*SlotHostNameBinding return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotHostNameBindingId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SlotHostNameBindingId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.HostNameBindingName, ok = parsed.Parsed["hostNameBindingName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hostNameBindingName", *parsed) + if id.HostNameBindingName, ok = input.Parsed["hostNameBindingName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hostNameBindingName", input) } - return &id, nil + return nil } // ValidateSlotHostNameBindingID checks that 'input' can be parsed as a Slot Host Name Binding ID diff --git a/resource-manager/web/2023-01-01/webapps/id_slothybridconnection.go b/resource-manager/web/2023-01-01/webapps/id_slothybridconnection.go index 9c2b5677715..6d48ba38f6c 100644 --- a/resource-manager/web/2023-01-01/webapps/id_slothybridconnection.go +++ b/resource-manager/web/2023-01-01/webapps/id_slothybridconnection.go @@ -40,27 +40,9 @@ func ParseSlotHybridConnectionID(input string) (*SlotHybridConnectionId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotHybridConnectionId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.HybridConnectionName, ok = parsed.Parsed["hybridConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSlotHybridConnectionIDInsensitively(input string) (*SlotHybridConnecti return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotHybridConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SlotHybridConnectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.HybridConnectionName, ok = parsed.Parsed["hybridConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridConnectionName", *parsed) + if id.HybridConnectionName, ok = input.Parsed["hybridConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hybridConnectionName", input) } - return &id, nil + return nil } // ValidateSlotHybridConnectionID checks that 'input' can be parsed as a Slot Hybrid Connection ID diff --git a/resource-manager/web/2023-01-01/webapps/id_slothybridconnectionnamespacerelay.go b/resource-manager/web/2023-01-01/webapps/id_slothybridconnectionnamespacerelay.go index 0e228fde8ed..3822d459f6a 100644 --- a/resource-manager/web/2023-01-01/webapps/id_slothybridconnectionnamespacerelay.go +++ b/resource-manager/web/2023-01-01/webapps/id_slothybridconnectionnamespacerelay.go @@ -42,31 +42,9 @@ func ParseSlotHybridConnectionNamespaceRelayID(input string) (*SlotHybridConnect return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotHybridConnectionNamespaceRelayId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.HybridConnectionNamespaceName, ok = parsed.Parsed["hybridConnectionNamespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridConnectionNamespaceName", *parsed) - } - - if id.RelayName, ok = parsed.Parsed["relayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "relayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseSlotHybridConnectionNamespaceRelayIDInsensitively(input string) (*Slot return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotHybridConnectionNamespaceRelayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SlotHybridConnectionNamespaceRelayId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.HybridConnectionNamespaceName, ok = parsed.Parsed["hybridConnectionNamespaceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hybridConnectionNamespaceName", *parsed) + if id.HybridConnectionNamespaceName, ok = input.Parsed["hybridConnectionNamespaceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hybridConnectionNamespaceName", input) } - if id.RelayName, ok = parsed.Parsed["relayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "relayName", *parsed) + if id.RelayName, ok = input.Parsed["relayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "relayName", input) } - return &id, nil + return nil } // ValidateSlotHybridConnectionNamespaceRelayID checks that 'input' can be parsed as a Slot Hybrid Connection Namespace Relay ID diff --git a/resource-manager/web/2023-01-01/webapps/id_slotinstance.go b/resource-manager/web/2023-01-01/webapps/id_slotinstance.go index 63f1357757e..009666c7f05 100644 --- a/resource-manager/web/2023-01-01/webapps/id_slotinstance.go +++ b/resource-manager/web/2023-01-01/webapps/id_slotinstance.go @@ -40,27 +40,9 @@ func ParseSlotInstanceID(input string) (*SlotInstanceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotInstanceId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSlotInstanceIDInsensitively(input string) (*SlotInstanceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SlotInstanceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if id.InstanceId, ok = input.Parsed["instanceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceId", input) } - return &id, nil + return nil } // ValidateSlotInstanceID checks that 'input' can be parsed as a Slot Instance ID diff --git a/resource-manager/web/2023-01-01/webapps/id_slotinstanceprocess.go b/resource-manager/web/2023-01-01/webapps/id_slotinstanceprocess.go index 4b8c98a4970..796e2dc30aa 100644 --- a/resource-manager/web/2023-01-01/webapps/id_slotinstanceprocess.go +++ b/resource-manager/web/2023-01-01/webapps/id_slotinstanceprocess.go @@ -42,31 +42,9 @@ func ParseSlotInstanceProcessID(input string) (*SlotInstanceProcessId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotInstanceProcessId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) - } - - if id.ProcessId, ok = parsed.Parsed["processId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "processId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseSlotInstanceProcessIDInsensitively(input string) (*SlotInstanceProcess return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotInstanceProcessId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SlotInstanceProcessId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if id.InstanceId, ok = input.Parsed["instanceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceId", input) } - if id.ProcessId, ok = parsed.Parsed["processId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "processId", *parsed) + if id.ProcessId, ok = input.Parsed["processId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "processId", input) } - return &id, nil + return nil } // ValidateSlotInstanceProcessID checks that 'input' can be parsed as a Slot Instance Process ID diff --git a/resource-manager/web/2023-01-01/webapps/id_slotinstanceprocessmodule.go b/resource-manager/web/2023-01-01/webapps/id_slotinstanceprocessmodule.go index 1593d7a81dc..423930cd9de 100644 --- a/resource-manager/web/2023-01-01/webapps/id_slotinstanceprocessmodule.go +++ b/resource-manager/web/2023-01-01/webapps/id_slotinstanceprocessmodule.go @@ -44,35 +44,9 @@ func ParseSlotInstanceProcessModuleID(input string) (*SlotInstanceProcessModuleI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotInstanceProcessModuleId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) - } - - if id.ProcessId, ok = parsed.Parsed["processId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "processId", *parsed) - } - - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseSlotInstanceProcessModuleIDInsensitively(input string) (*SlotInstanceP return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotInstanceProcessModuleId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SlotInstanceProcessModuleId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.InstanceId, ok = parsed.Parsed["instanceId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "instanceId", *parsed) + if id.InstanceId, ok = input.Parsed["instanceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceId", input) } - if id.ProcessId, ok = parsed.Parsed["processId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "processId", *parsed) + if id.ProcessId, ok = input.Parsed["processId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "processId", input) } - if id.ModuleName, ok = parsed.Parsed["moduleName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "moduleName", *parsed) + if id.ModuleName, ok = input.Parsed["moduleName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "moduleName", input) } - return &id, nil + return nil } // ValidateSlotInstanceProcessModuleID checks that 'input' can be parsed as a Slot Instance Process Module ID diff --git a/resource-manager/web/2023-01-01/webapps/id_slotnetworkfeature.go b/resource-manager/web/2023-01-01/webapps/id_slotnetworkfeature.go index e2efece4733..37161d178ca 100644 --- a/resource-manager/web/2023-01-01/webapps/id_slotnetworkfeature.go +++ b/resource-manager/web/2023-01-01/webapps/id_slotnetworkfeature.go @@ -40,27 +40,9 @@ func ParseSlotNetworkFeatureID(input string) (*SlotNetworkFeatureId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotNetworkFeatureId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.NetworkFeatureName, ok = parsed.Parsed["networkFeatureName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkFeatureName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSlotNetworkFeatureIDInsensitively(input string) (*SlotNetworkFeatureId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotNetworkFeatureId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SlotNetworkFeatureId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.NetworkFeatureName, ok = parsed.Parsed["networkFeatureName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "networkFeatureName", *parsed) + if id.NetworkFeatureName, ok = input.Parsed["networkFeatureName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "networkFeatureName", input) } - return &id, nil + return nil } // ValidateSlotNetworkFeatureID checks that 'input' can be parsed as a Slot Network Feature ID diff --git a/resource-manager/web/2023-01-01/webapps/id_slotnetworktrace.go b/resource-manager/web/2023-01-01/webapps/id_slotnetworktrace.go index f202a7b84d0..66c083ff8e8 100644 --- a/resource-manager/web/2023-01-01/webapps/id_slotnetworktrace.go +++ b/resource-manager/web/2023-01-01/webapps/id_slotnetworktrace.go @@ -40,27 +40,9 @@ func ParseSlotNetworkTraceID(input string) (*SlotNetworkTraceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotNetworkTraceId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSlotNetworkTraceIDInsensitively(input string) (*SlotNetworkTraceId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotNetworkTraceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SlotNetworkTraceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.OperationId, ok = parsed.Parsed["operationId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "operationId", *parsed) + if id.OperationId, ok = input.Parsed["operationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "operationId", input) } - return &id, nil + return nil } // ValidateSlotNetworkTraceID checks that 'input' can be parsed as a Slot Network Trace ID diff --git a/resource-manager/web/2023-01-01/webapps/id_slotpremieraddon.go b/resource-manager/web/2023-01-01/webapps/id_slotpremieraddon.go index 7e4b160fa5e..e83e02065eb 100644 --- a/resource-manager/web/2023-01-01/webapps/id_slotpremieraddon.go +++ b/resource-manager/web/2023-01-01/webapps/id_slotpremieraddon.go @@ -40,27 +40,9 @@ func ParseSlotPremierAddonID(input string) (*SlotPremierAddonId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotPremierAddonId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.PremierAddonName, ok = parsed.Parsed["premierAddonName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "premierAddonName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSlotPremierAddonIDInsensitively(input string) (*SlotPremierAddonId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotPremierAddonId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SlotPremierAddonId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.PremierAddonName, ok = parsed.Parsed["premierAddonName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "premierAddonName", *parsed) + if id.PremierAddonName, ok = input.Parsed["premierAddonName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "premierAddonName", input) } - return &id, nil + return nil } // ValidateSlotPremierAddonID checks that 'input' can be parsed as a Slot Premier Addon ID diff --git a/resource-manager/web/2023-01-01/webapps/id_slotprivateendpointconnection.go b/resource-manager/web/2023-01-01/webapps/id_slotprivateendpointconnection.go index 460aa65f354..3c2041e9790 100644 --- a/resource-manager/web/2023-01-01/webapps/id_slotprivateendpointconnection.go +++ b/resource-manager/web/2023-01-01/webapps/id_slotprivateendpointconnection.go @@ -40,27 +40,9 @@ func ParseSlotPrivateEndpointConnectionID(input string) (*SlotPrivateEndpointCon return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotPrivateEndpointConnectionId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSlotPrivateEndpointConnectionIDInsensitively(input string) (*SlotPriva return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotPrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SlotPrivateEndpointConnectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidateSlotPrivateEndpointConnectionID checks that 'input' can be parsed as a Slot Private Endpoint Connection ID diff --git a/resource-manager/web/2023-01-01/webapps/id_slotprocess.go b/resource-manager/web/2023-01-01/webapps/id_slotprocess.go index c10a4e1045a..1bacecea3c5 100644 --- a/resource-manager/web/2023-01-01/webapps/id_slotprocess.go +++ b/resource-manager/web/2023-01-01/webapps/id_slotprocess.go @@ -40,27 +40,9 @@ func ParseSlotProcessID(input string) (*SlotProcessId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotProcessId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.ProcessId, ok = parsed.Parsed["processId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "processId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSlotProcessIDInsensitively(input string) (*SlotProcessId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotProcessId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SlotProcessId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.ProcessId, ok = parsed.Parsed["processId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "processId", *parsed) + if id.ProcessId, ok = input.Parsed["processId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "processId", input) } - return &id, nil + return nil } // ValidateSlotProcessID checks that 'input' can be parsed as a Slot Process ID diff --git a/resource-manager/web/2023-01-01/webapps/id_slotpubliccertificate.go b/resource-manager/web/2023-01-01/webapps/id_slotpubliccertificate.go index cc2ef07f4e5..5dc24ba58ca 100644 --- a/resource-manager/web/2023-01-01/webapps/id_slotpubliccertificate.go +++ b/resource-manager/web/2023-01-01/webapps/id_slotpubliccertificate.go @@ -40,27 +40,9 @@ func ParseSlotPublicCertificateID(input string) (*SlotPublicCertificateId, error return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotPublicCertificateId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.PublicCertificateName, ok = parsed.Parsed["publicCertificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publicCertificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSlotPublicCertificateIDInsensitively(input string) (*SlotPublicCertifi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotPublicCertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SlotPublicCertificateId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.PublicCertificateName, ok = parsed.Parsed["publicCertificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "publicCertificateName", *parsed) + if id.PublicCertificateName, ok = input.Parsed["publicCertificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publicCertificateName", input) } - return &id, nil + return nil } // ValidateSlotPublicCertificateID checks that 'input' can be parsed as a Slot Public Certificate ID diff --git a/resource-manager/web/2023-01-01/webapps/id_slotsiteextension.go b/resource-manager/web/2023-01-01/webapps/id_slotsiteextension.go index c2b469b4ead..794884bacc8 100644 --- a/resource-manager/web/2023-01-01/webapps/id_slotsiteextension.go +++ b/resource-manager/web/2023-01-01/webapps/id_slotsiteextension.go @@ -40,27 +40,9 @@ func ParseSlotSiteExtensionID(input string) (*SlotSiteExtensionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotSiteExtensionId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.SiteExtensionId, ok = parsed.Parsed["siteExtensionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteExtensionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSlotSiteExtensionIDInsensitively(input string) (*SlotSiteExtensionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotSiteExtensionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SlotSiteExtensionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.SiteExtensionId, ok = parsed.Parsed["siteExtensionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteExtensionId", *parsed) + if id.SiteExtensionId, ok = input.Parsed["siteExtensionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteExtensionId", input) } - return &id, nil + return nil } // ValidateSlotSiteExtensionID checks that 'input' can be parsed as a Slot Site Extension ID diff --git a/resource-manager/web/2023-01-01/webapps/id_slottriggeredwebjob.go b/resource-manager/web/2023-01-01/webapps/id_slottriggeredwebjob.go index 62e8969daf5..6f7295755e6 100644 --- a/resource-manager/web/2023-01-01/webapps/id_slottriggeredwebjob.go +++ b/resource-manager/web/2023-01-01/webapps/id_slottriggeredwebjob.go @@ -40,27 +40,9 @@ func ParseSlotTriggeredWebJobID(input string) (*SlotTriggeredWebJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotTriggeredWebJobId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.TriggeredWebJobName, ok = parsed.Parsed["triggeredWebJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggeredWebJobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSlotTriggeredWebJobIDInsensitively(input string) (*SlotTriggeredWebJob return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotTriggeredWebJobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SlotTriggeredWebJobId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.TriggeredWebJobName, ok = parsed.Parsed["triggeredWebJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggeredWebJobName", *parsed) + if id.TriggeredWebJobName, ok = input.Parsed["triggeredWebJobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "triggeredWebJobName", input) } - return &id, nil + return nil } // ValidateSlotTriggeredWebJobID checks that 'input' can be parsed as a Slot Triggered Web Job ID diff --git a/resource-manager/web/2023-01-01/webapps/id_slotvirtualnetworkconnection.go b/resource-manager/web/2023-01-01/webapps/id_slotvirtualnetworkconnection.go index 5561c7588a2..76bafab7b89 100644 --- a/resource-manager/web/2023-01-01/webapps/id_slotvirtualnetworkconnection.go +++ b/resource-manager/web/2023-01-01/webapps/id_slotvirtualnetworkconnection.go @@ -40,27 +40,9 @@ func ParseSlotVirtualNetworkConnectionID(input string) (*SlotVirtualNetworkConne return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotVirtualNetworkConnectionId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.VirtualNetworkConnectionName, ok = parsed.Parsed["virtualNetworkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSlotVirtualNetworkConnectionIDInsensitively(input string) (*SlotVirtua return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotVirtualNetworkConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SlotVirtualNetworkConnectionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.VirtualNetworkConnectionName, ok = parsed.Parsed["virtualNetworkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkConnectionName", *parsed) + if id.VirtualNetworkConnectionName, ok = input.Parsed["virtualNetworkConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkConnectionName", input) } - return &id, nil + return nil } // ValidateSlotVirtualNetworkConnectionID checks that 'input' can be parsed as a Slot Virtual Network Connection ID diff --git a/resource-manager/web/2023-01-01/webapps/id_slotvirtualnetworkconnectiongateway.go b/resource-manager/web/2023-01-01/webapps/id_slotvirtualnetworkconnectiongateway.go index 1d5d9860bff..6ce53651da1 100644 --- a/resource-manager/web/2023-01-01/webapps/id_slotvirtualnetworkconnectiongateway.go +++ b/resource-manager/web/2023-01-01/webapps/id_slotvirtualnetworkconnectiongateway.go @@ -42,31 +42,9 @@ func ParseSlotVirtualNetworkConnectionGatewayID(input string) (*SlotVirtualNetwo return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotVirtualNetworkConnectionGatewayId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.VirtualNetworkConnectionName, ok = parsed.Parsed["virtualNetworkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkConnectionName", *parsed) - } - - if id.GatewayName, ok = parsed.Parsed["gatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseSlotVirtualNetworkConnectionGatewayIDInsensitively(input string) (*Slo return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotVirtualNetworkConnectionGatewayId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SlotVirtualNetworkConnectionGatewayId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.VirtualNetworkConnectionName, ok = parsed.Parsed["virtualNetworkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkConnectionName", *parsed) + if id.VirtualNetworkConnectionName, ok = input.Parsed["virtualNetworkConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkConnectionName", input) } - if id.GatewayName, ok = parsed.Parsed["gatewayName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "gatewayName", *parsed) + if id.GatewayName, ok = input.Parsed["gatewayName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "gatewayName", input) } - return &id, nil + return nil } // ValidateSlotVirtualNetworkConnectionGatewayID checks that 'input' can be parsed as a Slot Virtual Network Connection Gateway ID diff --git a/resource-manager/web/2023-01-01/webapps/id_slotwebjob.go b/resource-manager/web/2023-01-01/webapps/id_slotwebjob.go index 8aee6707b44..eb825ed3474 100644 --- a/resource-manager/web/2023-01-01/webapps/id_slotwebjob.go +++ b/resource-manager/web/2023-01-01/webapps/id_slotwebjob.go @@ -40,27 +40,9 @@ func ParseSlotWebJobID(input string) (*SlotWebJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotWebJobId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.WebJobName, ok = parsed.Parsed["webJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "webJobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSlotWebJobIDInsensitively(input string) (*SlotWebJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotWebJobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SlotWebJobId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.WebJobName, ok = parsed.Parsed["webJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "webJobName", *parsed) + if id.WebJobName, ok = input.Parsed["webJobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "webJobName", input) } - return &id, nil + return nil } // ValidateSlotWebJobID checks that 'input' can be parsed as a Slot Web Job ID diff --git a/resource-manager/web/2023-01-01/webapps/id_slotworkflow.go b/resource-manager/web/2023-01-01/webapps/id_slotworkflow.go index 839b9a9cc0c..c143535e7c4 100644 --- a/resource-manager/web/2023-01-01/webapps/id_slotworkflow.go +++ b/resource-manager/web/2023-01-01/webapps/id_slotworkflow.go @@ -40,27 +40,9 @@ func ParseSlotWorkflowID(input string) (*SlotWorkflowId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotWorkflowId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseSlotWorkflowIDInsensitively(input string) (*SlotWorkflowId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SlotWorkflowId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *SlotWorkflowId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - return &id, nil + return nil } // ValidateSlotWorkflowID checks that 'input' can be parsed as a Slot Workflow ID diff --git a/resource-manager/web/2023-01-01/webapps/id_snapshot.go b/resource-manager/web/2023-01-01/webapps/id_snapshot.go index 5b856f08c84..c7b5a80078c 100644 --- a/resource-manager/web/2023-01-01/webapps/id_snapshot.go +++ b/resource-manager/web/2023-01-01/webapps/id_snapshot.go @@ -38,23 +38,9 @@ func ParseSnapshotID(input string) (*SnapshotId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SnapshotId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SnapshotId, ok = parsed.Parsed["snapshotId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSnapshotIDInsensitively(input string) (*SnapshotId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SnapshotId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SnapshotId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SnapshotId, ok = parsed.Parsed["snapshotId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotId", *parsed) + if id.SnapshotId, ok = input.Parsed["snapshotId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "snapshotId", input) } - return &id, nil + return nil } // ValidateSnapshotID checks that 'input' can be parsed as a Snapshot ID diff --git a/resource-manager/web/2023-01-01/webapps/id_triggeredwebjob.go b/resource-manager/web/2023-01-01/webapps/id_triggeredwebjob.go index 855b9d76261..8e62aa483da 100644 --- a/resource-manager/web/2023-01-01/webapps/id_triggeredwebjob.go +++ b/resource-manager/web/2023-01-01/webapps/id_triggeredwebjob.go @@ -38,23 +38,9 @@ func ParseTriggeredWebJobID(input string) (*TriggeredWebJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TriggeredWebJobId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.TriggeredWebJobName, ok = parsed.Parsed["triggeredWebJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggeredWebJobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseTriggeredWebJobIDInsensitively(input string) (*TriggeredWebJobId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TriggeredWebJobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TriggeredWebJobId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.TriggeredWebJobName, ok = parsed.Parsed["triggeredWebJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggeredWebJobName", *parsed) + if id.TriggeredWebJobName, ok = input.Parsed["triggeredWebJobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "triggeredWebJobName", input) } - return &id, nil + return nil } // ValidateTriggeredWebJobID checks that 'input' can be parsed as a Triggered Web Job ID diff --git a/resource-manager/web/2023-01-01/webapps/id_triggeredwebjobhistory.go b/resource-manager/web/2023-01-01/webapps/id_triggeredwebjobhistory.go index d2dfcd67327..cb4ec930b86 100644 --- a/resource-manager/web/2023-01-01/webapps/id_triggeredwebjobhistory.go +++ b/resource-manager/web/2023-01-01/webapps/id_triggeredwebjobhistory.go @@ -42,31 +42,9 @@ func ParseTriggeredWebJobHistoryID(input string) (*TriggeredWebJobHistoryId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TriggeredWebJobHistoryId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.TriggeredWebJobName, ok = parsed.Parsed["triggeredWebJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggeredWebJobName", *parsed) - } - - if id.HistoryName, ok = parsed.Parsed["historyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "historyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseTriggeredWebJobHistoryIDInsensitively(input string) (*TriggeredWebJobH return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TriggeredWebJobHistoryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *TriggeredWebJobHistoryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.TriggeredWebJobName, ok = parsed.Parsed["triggeredWebJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggeredWebJobName", *parsed) + if id.TriggeredWebJobName, ok = input.Parsed["triggeredWebJobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "triggeredWebJobName", input) } - if id.HistoryName, ok = parsed.Parsed["historyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "historyName", *parsed) + if id.HistoryName, ok = input.Parsed["historyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "historyName", input) } - return &id, nil + return nil } // ValidateTriggeredWebJobHistoryID checks that 'input' can be parsed as a Triggered Web Job History ID diff --git a/resource-manager/web/2023-01-01/webapps/id_virtualnetworkconnection.go b/resource-manager/web/2023-01-01/webapps/id_virtualnetworkconnection.go index f0535c087fd..b6deb7ee4c8 100644 --- a/resource-manager/web/2023-01-01/webapps/id_virtualnetworkconnection.go +++ b/resource-manager/web/2023-01-01/webapps/id_virtualnetworkconnection.go @@ -38,23 +38,9 @@ func ParseVirtualNetworkConnectionID(input string) (*VirtualNetworkConnectionId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkConnectionId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.VirtualNetworkConnectionName, ok = parsed.Parsed["virtualNetworkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseVirtualNetworkConnectionIDInsensitively(input string) (*VirtualNetwork return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualNetworkConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.VirtualNetworkConnectionName, ok = parsed.Parsed["virtualNetworkConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkConnectionName", *parsed) + if id.VirtualNetworkConnectionName, ok = input.Parsed["virtualNetworkConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkConnectionName", input) } - return &id, nil + return nil } // ValidateVirtualNetworkConnectionID checks that 'input' can be parsed as a Virtual Network Connection ID diff --git a/resource-manager/web/2023-01-01/webapps/id_webjob.go b/resource-manager/web/2023-01-01/webapps/id_webjob.go index c6693dd4a71..700fb470cdd 100644 --- a/resource-manager/web/2023-01-01/webapps/id_webjob.go +++ b/resource-manager/web/2023-01-01/webapps/id_webjob.go @@ -38,23 +38,9 @@ func ParseWebJobID(input string) (*WebJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WebJobId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.WebJobName, ok = parsed.Parsed["webJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "webJobName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWebJobIDInsensitively(input string) (*WebJobId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WebJobId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WebJobId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.WebJobName, ok = parsed.Parsed["webJobName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "webJobName", *parsed) + if id.WebJobName, ok = input.Parsed["webJobName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "webJobName", input) } - return &id, nil + return nil } // ValidateWebJobID checks that 'input' can be parsed as a Web Job ID diff --git a/resource-manager/web/2023-01-01/webapps/id_websnapshot.go b/resource-manager/web/2023-01-01/webapps/id_websnapshot.go index 1777427c5a1..0f21c69e809 100644 --- a/resource-manager/web/2023-01-01/webapps/id_websnapshot.go +++ b/resource-manager/web/2023-01-01/webapps/id_websnapshot.go @@ -40,27 +40,9 @@ func ParseWebSnapshotID(input string) (*WebSnapshotId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WebSnapshotId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) - } - - if id.SnapshotId, ok = parsed.Parsed["snapshotId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseWebSnapshotIDInsensitively(input string) (*WebSnapshotId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WebSnapshotId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *WebSnapshotId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.SlotName, ok = parsed.Parsed["slotName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "slotName", *parsed) + if id.SlotName, ok = input.Parsed["slotName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "slotName", input) } - if id.SnapshotId, ok = parsed.Parsed["snapshotId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "snapshotId", *parsed) + if id.SnapshotId, ok = input.Parsed["snapshotId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "snapshotId", input) } - return &id, nil + return nil } // ValidateWebSnapshotID checks that 'input' can be parsed as a Web Snapshot ID diff --git a/resource-manager/web/2023-01-01/webapps/id_workflow.go b/resource-manager/web/2023-01-01/webapps/id_workflow.go index 30bbcd8315a..ed14199a96c 100644 --- a/resource-manager/web/2023-01-01/webapps/id_workflow.go +++ b/resource-manager/web/2023-01-01/webapps/id_workflow.go @@ -38,23 +38,9 @@ func ParseWorkflowID(input string) (*WorkflowId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkflowId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseWorkflowIDInsensitively(input string) (*WorkflowId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WorkflowId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *WorkflowId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - return &id, nil + return nil } // ValidateWorkflowID checks that 'input' can be parsed as a Workflow ID diff --git a/resource-manager/web/2023-01-01/workflowrunactions/id_action.go b/resource-manager/web/2023-01-01/workflowrunactions/id_action.go index b166f79b84f..49184a3bf77 100644 --- a/resource-manager/web/2023-01-01/workflowrunactions/id_action.go +++ b/resource-manager/web/2023-01-01/workflowrunactions/id_action.go @@ -42,31 +42,9 @@ func ParseActionID(input string) (*ActionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ActionId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) - } - - if id.RunName, ok = parsed.Parsed["runName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runName", *parsed) - } - - if id.ActionName, ok = parsed.Parsed["actionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseActionIDInsensitively(input string) (*ActionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ActionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *ActionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - if id.RunName, ok = parsed.Parsed["runName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runName", *parsed) + if id.RunName, ok = input.Parsed["runName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runName", input) } - if id.ActionName, ok = parsed.Parsed["actionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionName", *parsed) + if id.ActionName, ok = input.Parsed["actionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "actionName", input) } - return &id, nil + return nil } // ValidateActionID checks that 'input' can be parsed as a Action ID diff --git a/resource-manager/web/2023-01-01/workflowrunactions/id_repetition.go b/resource-manager/web/2023-01-01/workflowrunactions/id_repetition.go index 122545c8c34..f40af57dc1f 100644 --- a/resource-manager/web/2023-01-01/workflowrunactions/id_repetition.go +++ b/resource-manager/web/2023-01-01/workflowrunactions/id_repetition.go @@ -44,35 +44,9 @@ func ParseRepetitionID(input string) (*RepetitionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RepetitionId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) - } - - if id.RunName, ok = parsed.Parsed["runName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runName", *parsed) - } - - if id.ActionName, ok = parsed.Parsed["actionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionName", *parsed) - } - - if id.RepetitionName, ok = parsed.Parsed["repetitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "repetitionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseRepetitionIDInsensitively(input string) (*RepetitionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RepetitionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RepetitionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - if id.RunName, ok = parsed.Parsed["runName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runName", *parsed) + if id.RunName, ok = input.Parsed["runName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runName", input) } - if id.ActionName, ok = parsed.Parsed["actionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionName", *parsed) + if id.ActionName, ok = input.Parsed["actionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "actionName", input) } - if id.RepetitionName, ok = parsed.Parsed["repetitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "repetitionName", *parsed) + if id.RepetitionName, ok = input.Parsed["repetitionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "repetitionName", input) } - return &id, nil + return nil } // ValidateRepetitionID checks that 'input' can be parsed as a Repetition ID diff --git a/resource-manager/web/2023-01-01/workflowrunactions/id_requesthistory.go b/resource-manager/web/2023-01-01/workflowrunactions/id_requesthistory.go index ad568f0337a..bea80f04346 100644 --- a/resource-manager/web/2023-01-01/workflowrunactions/id_requesthistory.go +++ b/resource-manager/web/2023-01-01/workflowrunactions/id_requesthistory.go @@ -46,39 +46,9 @@ func ParseRequestHistoryID(input string) (*RequestHistoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RequestHistoryId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) - } - - if id.RunName, ok = parsed.Parsed["runName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runName", *parsed) - } - - if id.ActionName, ok = parsed.Parsed["actionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionName", *parsed) - } - - if id.RepetitionName, ok = parsed.Parsed["repetitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "repetitionName", *parsed) - } - - if id.RequestHistoryName, ok = parsed.Parsed["requestHistoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "requestHistoryName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -93,42 +63,50 @@ func ParseRequestHistoryIDInsensitively(input string) (*RequestHistoryId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RequestHistoryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RequestHistoryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - if id.RunName, ok = parsed.Parsed["runName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runName", *parsed) + if id.RunName, ok = input.Parsed["runName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runName", input) } - if id.ActionName, ok = parsed.Parsed["actionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionName", *parsed) + if id.ActionName, ok = input.Parsed["actionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "actionName", input) } - if id.RepetitionName, ok = parsed.Parsed["repetitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "repetitionName", *parsed) + if id.RepetitionName, ok = input.Parsed["repetitionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "repetitionName", input) } - if id.RequestHistoryName, ok = parsed.Parsed["requestHistoryName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "requestHistoryName", *parsed) + if id.RequestHistoryName, ok = input.Parsed["requestHistoryName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "requestHistoryName", input) } - return &id, nil + return nil } // ValidateRequestHistoryID checks that 'input' can be parsed as a Request History ID diff --git a/resource-manager/web/2023-01-01/workflowrunactions/id_run.go b/resource-manager/web/2023-01-01/workflowrunactions/id_run.go index 1d5fbc16bb0..4a34fbe1a33 100644 --- a/resource-manager/web/2023-01-01/workflowrunactions/id_run.go +++ b/resource-manager/web/2023-01-01/workflowrunactions/id_run.go @@ -40,27 +40,9 @@ func ParseRunID(input string) (*RunId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) - } - - if id.RunName, ok = parsed.Parsed["runName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseRunIDInsensitively(input string) (*RunId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RunId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - if id.RunName, ok = parsed.Parsed["runName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runName", *parsed) + if id.RunName, ok = input.Parsed["runName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runName", input) } - return &id, nil + return nil } // ValidateRunID checks that 'input' can be parsed as a Run ID diff --git a/resource-manager/web/2023-01-01/workflowrunactions/id_scoperepetition.go b/resource-manager/web/2023-01-01/workflowrunactions/id_scoperepetition.go index 6a010b1f5ab..4950cbb4bd6 100644 --- a/resource-manager/web/2023-01-01/workflowrunactions/id_scoperepetition.go +++ b/resource-manager/web/2023-01-01/workflowrunactions/id_scoperepetition.go @@ -44,35 +44,9 @@ func ParseScopeRepetitionID(input string) (*ScopeRepetitionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopeRepetitionId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) - } - - if id.RunName, ok = parsed.Parsed["runName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runName", *parsed) - } - - if id.ActionName, ok = parsed.Parsed["actionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionName", *parsed) - } - - if id.ScopeRepetitionName, ok = parsed.Parsed["scopeRepetitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scopeRepetitionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -87,38 +61,46 @@ func ParseScopeRepetitionIDInsensitively(input string) (*ScopeRepetitionId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ScopeRepetitionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *ScopeRepetitionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - if id.RunName, ok = parsed.Parsed["runName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runName", *parsed) + if id.RunName, ok = input.Parsed["runName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runName", input) } - if id.ActionName, ok = parsed.Parsed["actionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "actionName", *parsed) + if id.ActionName, ok = input.Parsed["actionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "actionName", input) } - if id.ScopeRepetitionName, ok = parsed.Parsed["scopeRepetitionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "scopeRepetitionName", *parsed) + if id.ScopeRepetitionName, ok = input.Parsed["scopeRepetitionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "scopeRepetitionName", input) } - return &id, nil + return nil } // ValidateScopeRepetitionID checks that 'input' can be parsed as a Scope Repetition ID diff --git a/resource-manager/web/2023-01-01/workflowruns/id_managementworkflow.go b/resource-manager/web/2023-01-01/workflowruns/id_managementworkflow.go index 18e85e0a13b..bc6063d1e6a 100644 --- a/resource-manager/web/2023-01-01/workflowruns/id_managementworkflow.go +++ b/resource-manager/web/2023-01-01/workflowruns/id_managementworkflow.go @@ -38,23 +38,9 @@ func ParseManagementWorkflowID(input string) (*ManagementWorkflowId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagementWorkflowId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseManagementWorkflowIDInsensitively(input string) (*ManagementWorkflowId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagementWorkflowId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ManagementWorkflowId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - return &id, nil + return nil } // ValidateManagementWorkflowID checks that 'input' can be parsed as a Management Workflow ID diff --git a/resource-manager/web/2023-01-01/workflowruns/id_run.go b/resource-manager/web/2023-01-01/workflowruns/id_run.go index c55c99caf28..8c4fa0bb534 100644 --- a/resource-manager/web/2023-01-01/workflowruns/id_run.go +++ b/resource-manager/web/2023-01-01/workflowruns/id_run.go @@ -40,27 +40,9 @@ func ParseRunID(input string) (*RunId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) - } - - if id.RunName, ok = parsed.Parsed["runName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseRunIDInsensitively(input string) (*RunId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := RunId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *RunId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - if id.RunName, ok = parsed.Parsed["runName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "runName", *parsed) + if id.RunName, ok = input.Parsed["runName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runName", input) } - return &id, nil + return nil } // ValidateRunID checks that 'input' can be parsed as a Run ID diff --git a/resource-manager/web/2023-01-01/workflows/id_managementworkflow.go b/resource-manager/web/2023-01-01/workflows/id_managementworkflow.go index 1e057367da6..697779df5f2 100644 --- a/resource-manager/web/2023-01-01/workflows/id_managementworkflow.go +++ b/resource-manager/web/2023-01-01/workflows/id_managementworkflow.go @@ -38,23 +38,9 @@ func ParseManagementWorkflowID(input string) (*ManagementWorkflowId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagementWorkflowId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseManagementWorkflowIDInsensitively(input string) (*ManagementWorkflowId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagementWorkflowId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ManagementWorkflowId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - return &id, nil + return nil } // ValidateManagementWorkflowID checks that 'input' can be parsed as a Management Workflow ID diff --git a/resource-manager/web/2023-01-01/workflowtriggerhistories/id_trigger.go b/resource-manager/web/2023-01-01/workflowtriggerhistories/id_trigger.go index 06133491beb..58e8530aa2f 100644 --- a/resource-manager/web/2023-01-01/workflowtriggerhistories/id_trigger.go +++ b/resource-manager/web/2023-01-01/workflowtriggerhistories/id_trigger.go @@ -40,27 +40,9 @@ func ParseTriggerID(input string) (*TriggerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TriggerId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) - } - - if id.TriggerName, ok = parsed.Parsed["triggerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseTriggerIDInsensitively(input string) (*TriggerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TriggerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TriggerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - if id.TriggerName, ok = parsed.Parsed["triggerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggerName", *parsed) + if id.TriggerName, ok = input.Parsed["triggerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "triggerName", input) } - return &id, nil + return nil } // ValidateTriggerID checks that 'input' can be parsed as a Trigger ID diff --git a/resource-manager/web/2023-01-01/workflowtriggerhistories/id_triggerhistory.go b/resource-manager/web/2023-01-01/workflowtriggerhistories/id_triggerhistory.go index 2dcda2eba2f..6d315a220b9 100644 --- a/resource-manager/web/2023-01-01/workflowtriggerhistories/id_triggerhistory.go +++ b/resource-manager/web/2023-01-01/workflowtriggerhistories/id_triggerhistory.go @@ -42,31 +42,9 @@ func ParseTriggerHistoryID(input string) (*TriggerHistoryId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TriggerHistoryId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) - } - - if id.TriggerName, ok = parsed.Parsed["triggerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggerName", *parsed) - } - - if id.HistoryName, ok = parsed.Parsed["historyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "historyName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -81,34 +59,42 @@ func ParseTriggerHistoryIDInsensitively(input string) (*TriggerHistoryId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TriggerHistoryId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *TriggerHistoryId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - if id.TriggerName, ok = parsed.Parsed["triggerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggerName", *parsed) + if id.TriggerName, ok = input.Parsed["triggerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "triggerName", input) } - if id.HistoryName, ok = parsed.Parsed["historyName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "historyName", *parsed) + if id.HistoryName, ok = input.Parsed["historyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "historyName", input) } - return &id, nil + return nil } // ValidateTriggerHistoryID checks that 'input' can be parsed as a Trigger History ID diff --git a/resource-manager/web/2023-01-01/workflowtriggers/id_managementworkflow.go b/resource-manager/web/2023-01-01/workflowtriggers/id_managementworkflow.go index 101400fc48a..5b408ef4aec 100644 --- a/resource-manager/web/2023-01-01/workflowtriggers/id_managementworkflow.go +++ b/resource-manager/web/2023-01-01/workflowtriggers/id_managementworkflow.go @@ -38,23 +38,9 @@ func ParseManagementWorkflowID(input string) (*ManagementWorkflowId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagementWorkflowId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseManagementWorkflowIDInsensitively(input string) (*ManagementWorkflowId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagementWorkflowId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ManagementWorkflowId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - return &id, nil + return nil } // ValidateManagementWorkflowID checks that 'input' can be parsed as a Management Workflow ID diff --git a/resource-manager/web/2023-01-01/workflowtriggers/id_trigger.go b/resource-manager/web/2023-01-01/workflowtriggers/id_trigger.go index 9639dc15519..ff3dd294352 100644 --- a/resource-manager/web/2023-01-01/workflowtriggers/id_trigger.go +++ b/resource-manager/web/2023-01-01/workflowtriggers/id_trigger.go @@ -40,27 +40,9 @@ func ParseTriggerID(input string) (*TriggerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TriggerId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) - } - - if id.TriggerName, ok = parsed.Parsed["triggerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseTriggerIDInsensitively(input string) (*TriggerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := TriggerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *TriggerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - if id.TriggerName, ok = parsed.Parsed["triggerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "triggerName", *parsed) + if id.TriggerName, ok = input.Parsed["triggerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "triggerName", input) } - return &id, nil + return nil } // ValidateTriggerID checks that 'input' can be parsed as a Trigger ID diff --git a/resource-manager/web/2023-01-01/workflowversions/id_managementworkflow.go b/resource-manager/web/2023-01-01/workflowversions/id_managementworkflow.go index e5e55f3eed0..e47a5b20b93 100644 --- a/resource-manager/web/2023-01-01/workflowversions/id_managementworkflow.go +++ b/resource-manager/web/2023-01-01/workflowversions/id_managementworkflow.go @@ -38,23 +38,9 @@ func ParseManagementWorkflowID(input string) (*ManagementWorkflowId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagementWorkflowId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseManagementWorkflowIDInsensitively(input string) (*ManagementWorkflowId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ManagementWorkflowId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ManagementWorkflowId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - return &id, nil + return nil } // ValidateManagementWorkflowID checks that 'input' can be parsed as a Management Workflow ID diff --git a/resource-manager/web/2023-01-01/workflowversions/id_version.go b/resource-manager/web/2023-01-01/workflowversions/id_version.go index 10113b68e4d..c5f3f6bc6a3 100644 --- a/resource-manager/web/2023-01-01/workflowversions/id_version.go +++ b/resource-manager/web/2023-01-01/workflowversions/id_version.go @@ -40,27 +40,9 @@ func ParseVersionID(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} - - 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.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) - } - - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) - } - - if id.VersionId, ok = parsed.Parsed["versionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionId", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -75,30 +57,38 @@ func ParseVersionIDInsensitively(input string) (*VersionId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VersionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *VersionId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SiteName, ok = parsed.Parsed["siteName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "siteName", *parsed) + if id.SiteName, ok = input.Parsed["siteName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "siteName", input) } - if id.WorkflowName, ok = parsed.Parsed["workflowName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "workflowName", *parsed) + if id.WorkflowName, ok = input.Parsed["workflowName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "workflowName", input) } - if id.VersionId, ok = parsed.Parsed["versionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "versionId", *parsed) + if id.VersionId, ok = input.Parsed["versionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionId", input) } - return &id, nil + return nil } // ValidateVersionID checks that 'input' can be parsed as a Version ID diff --git a/resource-manager/webpubsub/2023-02-01/webpubsub/id_customcertificate.go b/resource-manager/webpubsub/2023-02-01/webpubsub/id_customcertificate.go index ce60ff4072c..c2a5644f26d 100644 --- a/resource-manager/webpubsub/2023-02-01/webpubsub/id_customcertificate.go +++ b/resource-manager/webpubsub/2023-02-01/webpubsub/id_customcertificate.go @@ -38,23 +38,9 @@ func ParseCustomCertificateID(input string) (*CustomCertificateId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CustomCertificateId{} - - 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.WebPubSubName, ok = parsed.Parsed["webPubSubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "webPubSubName", *parsed) - } - - if id.CustomCertificateName, ok = parsed.Parsed["customCertificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "customCertificateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCustomCertificateIDInsensitively(input string) (*CustomCertificateId, return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CustomCertificateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CustomCertificateId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WebPubSubName, ok = parsed.Parsed["webPubSubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "webPubSubName", *parsed) + if id.WebPubSubName, ok = input.Parsed["webPubSubName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "webPubSubName", input) } - if id.CustomCertificateName, ok = parsed.Parsed["customCertificateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "customCertificateName", *parsed) + if id.CustomCertificateName, ok = input.Parsed["customCertificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "customCertificateName", input) } - return &id, nil + return nil } // ValidateCustomCertificateID checks that 'input' can be parsed as a Custom Certificate ID diff --git a/resource-manager/webpubsub/2023-02-01/webpubsub/id_customdomain.go b/resource-manager/webpubsub/2023-02-01/webpubsub/id_customdomain.go index c0a1c1f006d..5e9bb62a228 100644 --- a/resource-manager/webpubsub/2023-02-01/webpubsub/id_customdomain.go +++ b/resource-manager/webpubsub/2023-02-01/webpubsub/id_customdomain.go @@ -38,23 +38,9 @@ func ParseCustomDomainID(input string) (*CustomDomainId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CustomDomainId{} - - 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.WebPubSubName, ok = parsed.Parsed["webPubSubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "webPubSubName", *parsed) - } - - if id.CustomDomainName, ok = parsed.Parsed["customDomainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "customDomainName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCustomDomainIDInsensitively(input string) (*CustomDomainId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CustomDomainId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CustomDomainId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WebPubSubName, ok = parsed.Parsed["webPubSubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "webPubSubName", *parsed) + if id.WebPubSubName, ok = input.Parsed["webPubSubName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "webPubSubName", input) } - if id.CustomDomainName, ok = parsed.Parsed["customDomainName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "customDomainName", *parsed) + if id.CustomDomainName, ok = input.Parsed["customDomainName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "customDomainName", input) } - return &id, nil + return nil } // ValidateCustomDomainID checks that 'input' can be parsed as a Custom Domain ID diff --git a/resource-manager/webpubsub/2023-02-01/webpubsub/id_hub.go b/resource-manager/webpubsub/2023-02-01/webpubsub/id_hub.go index 4609929da3c..1403c815ce4 100644 --- a/resource-manager/webpubsub/2023-02-01/webpubsub/id_hub.go +++ b/resource-manager/webpubsub/2023-02-01/webpubsub/id_hub.go @@ -38,23 +38,9 @@ func ParseHubID(input string) (*HubId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HubId{} - - 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.WebPubSubName, ok = parsed.Parsed["webPubSubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "webPubSubName", *parsed) - } - - if id.HubName, ok = parsed.Parsed["hubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hubName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseHubIDInsensitively(input string) (*HubId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := HubId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *HubId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WebPubSubName, ok = parsed.Parsed["webPubSubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "webPubSubName", *parsed) + if id.WebPubSubName, ok = input.Parsed["webPubSubName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "webPubSubName", input) } - if id.HubName, ok = parsed.Parsed["hubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "hubName", *parsed) + if id.HubName, ok = input.Parsed["hubName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "hubName", input) } - return &id, nil + return nil } // ValidateHubID checks that 'input' can be parsed as a Hub ID diff --git a/resource-manager/webpubsub/2023-02-01/webpubsub/id_location.go b/resource-manager/webpubsub/2023-02-01/webpubsub/id_location.go index 1ad476be0aa..ab388f16be1 100644 --- a/resource-manager/webpubsub/2023-02-01/webpubsub/id_location.go +++ b/resource-manager/webpubsub/2023-02-01/webpubsub/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/webpubsub/2023-02-01/webpubsub/id_privateendpointconnection.go b/resource-manager/webpubsub/2023-02-01/webpubsub/id_privateendpointconnection.go index 47d7ac4f5be..442137c977b 100644 --- a/resource-manager/webpubsub/2023-02-01/webpubsub/id_privateendpointconnection.go +++ b/resource-manager/webpubsub/2023-02-01/webpubsub/id_privateendpointconnection.go @@ -38,23 +38,9 @@ func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} - - 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.WebPubSubName, ok = parsed.Parsed["webPubSubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "webPubSubName", *parsed) - } - - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpoi return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := PrivateEndpointConnectionId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WebPubSubName, ok = parsed.Parsed["webPubSubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "webPubSubName", *parsed) + if id.WebPubSubName, ok = input.Parsed["webPubSubName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "webPubSubName", input) } - if id.PrivateEndpointConnectionName, ok = parsed.Parsed["privateEndpointConnectionName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", *parsed) + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) } - return &id, nil + return nil } // ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID diff --git a/resource-manager/webpubsub/2023-02-01/webpubsub/id_sharedprivatelinkresource.go b/resource-manager/webpubsub/2023-02-01/webpubsub/id_sharedprivatelinkresource.go index 5d844134fee..d74460f6844 100644 --- a/resource-manager/webpubsub/2023-02-01/webpubsub/id_sharedprivatelinkresource.go +++ b/resource-manager/webpubsub/2023-02-01/webpubsub/id_sharedprivatelinkresource.go @@ -38,23 +38,9 @@ func ParseSharedPrivateLinkResourceID(input string) (*SharedPrivateLinkResourceI return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SharedPrivateLinkResourceId{} - - 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.WebPubSubName, ok = parsed.Parsed["webPubSubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "webPubSubName", *parsed) - } - - if id.SharedPrivateLinkResourceName, ok = parsed.Parsed["sharedPrivateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sharedPrivateLinkResourceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseSharedPrivateLinkResourceIDInsensitively(input string) (*SharedPrivate return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SharedPrivateLinkResourceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SharedPrivateLinkResourceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WebPubSubName, ok = parsed.Parsed["webPubSubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "webPubSubName", *parsed) + if id.WebPubSubName, ok = input.Parsed["webPubSubName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "webPubSubName", input) } - if id.SharedPrivateLinkResourceName, ok = parsed.Parsed["sharedPrivateLinkResourceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sharedPrivateLinkResourceName", *parsed) + if id.SharedPrivateLinkResourceName, ok = input.Parsed["sharedPrivateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sharedPrivateLinkResourceName", input) } - return &id, nil + return nil } // ValidateSharedPrivateLinkResourceID checks that 'input' can be parsed as a Shared Private Link Resource ID diff --git a/resource-manager/webpubsub/2023-02-01/webpubsub/id_webpubsub.go b/resource-manager/webpubsub/2023-02-01/webpubsub/id_webpubsub.go index df95162f6af..4c617e5da72 100644 --- a/resource-manager/webpubsub/2023-02-01/webpubsub/id_webpubsub.go +++ b/resource-manager/webpubsub/2023-02-01/webpubsub/id_webpubsub.go @@ -36,19 +36,9 @@ func ParseWebPubSubID(input string) (*WebPubSubId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WebPubSubId{} - - 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.WebPubSubName, ok = parsed.Parsed["webPubSubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "webPubSubName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseWebPubSubIDInsensitively(input string) (*WebPubSubId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := WebPubSubId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *WebPubSubId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.WebPubSubName, ok = parsed.Parsed["webPubSubName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "webPubSubName", *parsed) + if id.WebPubSubName, ok = input.Parsed["webPubSubName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "webPubSubName", input) } - return &id, nil + return nil } // ValidateWebPubSubID checks that 'input' can be parsed as a Web Pub Sub ID diff --git a/resource-manager/workloads/2023-04-01/monitors/id_monitor.go b/resource-manager/workloads/2023-04-01/monitors/id_monitor.go index c18097b1f68..d9ded30d5d7 100644 --- a/resource-manager/workloads/2023-04-01/monitors/id_monitor.go +++ b/resource-manager/workloads/2023-04-01/monitors/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/workloads/2023-04-01/providerinstances/id_monitor.go b/resource-manager/workloads/2023-04-01/providerinstances/id_monitor.go index 0ea9b6a8cf8..10c3ca3d1e8 100644 --- a/resource-manager/workloads/2023-04-01/providerinstances/id_monitor.go +++ b/resource-manager/workloads/2023-04-01/providerinstances/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/workloads/2023-04-01/providerinstances/id_providerinstance.go b/resource-manager/workloads/2023-04-01/providerinstances/id_providerinstance.go index 4a27824f743..7a39b14c89d 100644 --- a/resource-manager/workloads/2023-04-01/providerinstances/id_providerinstance.go +++ b/resource-manager/workloads/2023-04-01/providerinstances/id_providerinstance.go @@ -38,23 +38,9 @@ func ParseProviderInstanceID(input string) (*ProviderInstanceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderInstanceId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) - } - - if id.ProviderInstanceName, ok = parsed.Parsed["providerInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "providerInstanceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseProviderInstanceIDInsensitively(input string) (*ProviderInstanceId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ProviderInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProviderInstanceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - if id.ProviderInstanceName, ok = parsed.Parsed["providerInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "providerInstanceName", *parsed) + if id.ProviderInstanceName, ok = input.Parsed["providerInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "providerInstanceName", input) } - return &id, nil + return nil } // ValidateProviderInstanceID checks that 'input' can be parsed as a Provider Instance ID diff --git a/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/id_applicationinstance.go b/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/id_applicationinstance.go index 97e355c0969..32b5c81a6f8 100644 --- a/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/id_applicationinstance.go +++ b/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/id_applicationinstance.go @@ -38,23 +38,9 @@ func ParseApplicationInstanceID(input string) (*ApplicationInstanceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationInstanceId{} - - 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.SapVirtualInstanceName, ok = parsed.Parsed["sapVirtualInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sapVirtualInstanceName", *parsed) - } - - if id.ApplicationInstanceName, ok = parsed.Parsed["applicationInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationInstanceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseApplicationInstanceIDInsensitively(input string) (*ApplicationInstance return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := ApplicationInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ApplicationInstanceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SapVirtualInstanceName, ok = parsed.Parsed["sapVirtualInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sapVirtualInstanceName", *parsed) + if id.SapVirtualInstanceName, ok = input.Parsed["sapVirtualInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sapVirtualInstanceName", input) } - if id.ApplicationInstanceName, ok = parsed.Parsed["applicationInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "applicationInstanceName", *parsed) + if id.ApplicationInstanceName, ok = input.Parsed["applicationInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "applicationInstanceName", input) } - return &id, nil + return nil } // ValidateApplicationInstanceID checks that 'input' can be parsed as a Application Instance ID diff --git a/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/id_sapvirtualinstance.go b/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/id_sapvirtualinstance.go index 54c57d8c03d..a3da8c07472 100644 --- a/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/id_sapvirtualinstance.go +++ b/resource-manager/workloads/2023-04-01/sapapplicationserverinstances/id_sapvirtualinstance.go @@ -36,19 +36,9 @@ func ParseSapVirtualInstanceID(input string) (*SapVirtualInstanceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SapVirtualInstanceId{} - - 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.SapVirtualInstanceName, ok = parsed.Parsed["sapVirtualInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sapVirtualInstanceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSapVirtualInstanceIDInsensitively(input string) (*SapVirtualInstanceId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SapVirtualInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SapVirtualInstanceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SapVirtualInstanceName, ok = parsed.Parsed["sapVirtualInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sapVirtualInstanceName", *parsed) + if id.SapVirtualInstanceName, ok = input.Parsed["sapVirtualInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sapVirtualInstanceName", input) } - return &id, nil + return nil } // ValidateSapVirtualInstanceID checks that 'input' can be parsed as a Sap Virtual Instance ID diff --git a/resource-manager/workloads/2023-04-01/sapavailabilityzonedetails/id_location.go b/resource-manager/workloads/2023-04-01/sapavailabilityzonedetails/id_location.go index dab8c53bcab..1ac88fba322 100644 --- a/resource-manager/workloads/2023-04-01/sapavailabilityzonedetails/id_location.go +++ b/resource-manager/workloads/2023-04-01/sapavailabilityzonedetails/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/workloads/2023-04-01/sapcentralinstances/id_centralinstance.go b/resource-manager/workloads/2023-04-01/sapcentralinstances/id_centralinstance.go index 00be24db282..31c92e65e5d 100644 --- a/resource-manager/workloads/2023-04-01/sapcentralinstances/id_centralinstance.go +++ b/resource-manager/workloads/2023-04-01/sapcentralinstances/id_centralinstance.go @@ -38,23 +38,9 @@ func ParseCentralInstanceID(input string) (*CentralInstanceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CentralInstanceId{} - - 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.SapVirtualInstanceName, ok = parsed.Parsed["sapVirtualInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sapVirtualInstanceName", *parsed) - } - - if id.CentralInstanceName, ok = parsed.Parsed["centralInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "centralInstanceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseCentralInstanceIDInsensitively(input string) (*CentralInstanceId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CentralInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CentralInstanceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SapVirtualInstanceName, ok = parsed.Parsed["sapVirtualInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sapVirtualInstanceName", *parsed) + if id.SapVirtualInstanceName, ok = input.Parsed["sapVirtualInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sapVirtualInstanceName", input) } - if id.CentralInstanceName, ok = parsed.Parsed["centralInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "centralInstanceName", *parsed) + if id.CentralInstanceName, ok = input.Parsed["centralInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "centralInstanceName", input) } - return &id, nil + return nil } // ValidateCentralInstanceID checks that 'input' can be parsed as a Central Instance ID diff --git a/resource-manager/workloads/2023-04-01/sapcentralinstances/id_sapvirtualinstance.go b/resource-manager/workloads/2023-04-01/sapcentralinstances/id_sapvirtualinstance.go index 39832c934bf..883a1f1c0cb 100644 --- a/resource-manager/workloads/2023-04-01/sapcentralinstances/id_sapvirtualinstance.go +++ b/resource-manager/workloads/2023-04-01/sapcentralinstances/id_sapvirtualinstance.go @@ -36,19 +36,9 @@ func ParseSapVirtualInstanceID(input string) (*SapVirtualInstanceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SapVirtualInstanceId{} - - 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.SapVirtualInstanceName, ok = parsed.Parsed["sapVirtualInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sapVirtualInstanceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSapVirtualInstanceIDInsensitively(input string) (*SapVirtualInstanceId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SapVirtualInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SapVirtualInstanceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SapVirtualInstanceName, ok = parsed.Parsed["sapVirtualInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sapVirtualInstanceName", *parsed) + if id.SapVirtualInstanceName, ok = input.Parsed["sapVirtualInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sapVirtualInstanceName", input) } - return &id, nil + return nil } // ValidateSapVirtualInstanceID checks that 'input' can be parsed as a Sap Virtual Instance ID diff --git a/resource-manager/workloads/2023-04-01/sapdatabaseinstances/id_databaseinstance.go b/resource-manager/workloads/2023-04-01/sapdatabaseinstances/id_databaseinstance.go index 8cba2fd1ab1..3501bed913b 100644 --- a/resource-manager/workloads/2023-04-01/sapdatabaseinstances/id_databaseinstance.go +++ b/resource-manager/workloads/2023-04-01/sapdatabaseinstances/id_databaseinstance.go @@ -38,23 +38,9 @@ func ParseDatabaseInstanceID(input string) (*DatabaseInstanceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseInstanceId{} - - 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.SapVirtualInstanceName, ok = parsed.Parsed["sapVirtualInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sapVirtualInstanceName", *parsed) - } - - if id.DatabaseInstanceName, ok = parsed.Parsed["databaseInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseInstanceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseDatabaseInstanceIDInsensitively(input string) (*DatabaseInstanceId, er return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := DatabaseInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DatabaseInstanceId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SapVirtualInstanceName, ok = parsed.Parsed["sapVirtualInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sapVirtualInstanceName", *parsed) + if id.SapVirtualInstanceName, ok = input.Parsed["sapVirtualInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sapVirtualInstanceName", input) } - if id.DatabaseInstanceName, ok = parsed.Parsed["databaseInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "databaseInstanceName", *parsed) + if id.DatabaseInstanceName, ok = input.Parsed["databaseInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseInstanceName", input) } - return &id, nil + return nil } // ValidateDatabaseInstanceID checks that 'input' can be parsed as a Database Instance ID diff --git a/resource-manager/workloads/2023-04-01/sapdatabaseinstances/id_sapvirtualinstance.go b/resource-manager/workloads/2023-04-01/sapdatabaseinstances/id_sapvirtualinstance.go index 5a87702af3a..2d37fb8e8ad 100644 --- a/resource-manager/workloads/2023-04-01/sapdatabaseinstances/id_sapvirtualinstance.go +++ b/resource-manager/workloads/2023-04-01/sapdatabaseinstances/id_sapvirtualinstance.go @@ -36,19 +36,9 @@ func ParseSapVirtualInstanceID(input string) (*SapVirtualInstanceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SapVirtualInstanceId{} - - 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.SapVirtualInstanceName, ok = parsed.Parsed["sapVirtualInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sapVirtualInstanceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSapVirtualInstanceIDInsensitively(input string) (*SapVirtualInstanceId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SapVirtualInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SapVirtualInstanceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SapVirtualInstanceName, ok = parsed.Parsed["sapVirtualInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sapVirtualInstanceName", *parsed) + if id.SapVirtualInstanceName, ok = input.Parsed["sapVirtualInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sapVirtualInstanceName", input) } - return &id, nil + return nil } // ValidateSapVirtualInstanceID checks that 'input' can be parsed as a Sap Virtual Instance ID diff --git a/resource-manager/workloads/2023-04-01/sapdiskconfigurations/id_location.go b/resource-manager/workloads/2023-04-01/sapdiskconfigurations/id_location.go index 4d70343e691..8c24504e326 100644 --- a/resource-manager/workloads/2023-04-01/sapdiskconfigurations/id_location.go +++ b/resource-manager/workloads/2023-04-01/sapdiskconfigurations/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/workloads/2023-04-01/saplandscapemonitor/id_monitor.go b/resource-manager/workloads/2023-04-01/saplandscapemonitor/id_monitor.go index 303a946efb0..aa8b9997ae9 100644 --- a/resource-manager/workloads/2023-04-01/saplandscapemonitor/id_monitor.go +++ b/resource-manager/workloads/2023-04-01/saplandscapemonitor/id_monitor.go @@ -36,19 +36,9 @@ func ParseMonitorID(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} - - 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.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseMonitorIDInsensitively(input string) (*MonitorId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := MonitorId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *MonitorId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.MonitorName, ok = parsed.Parsed["monitorName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "monitorName", *parsed) + if id.MonitorName, ok = input.Parsed["monitorName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "monitorName", input) } - return &id, nil + return nil } // ValidateMonitorID checks that 'input' can be parsed as a Monitor ID diff --git a/resource-manager/workloads/2023-04-01/saprecommendations/id_location.go b/resource-manager/workloads/2023-04-01/saprecommendations/id_location.go index f36a125dcb0..76463fa1e0c 100644 --- a/resource-manager/workloads/2023-04-01/saprecommendations/id_location.go +++ b/resource-manager/workloads/2023-04-01/saprecommendations/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/workloads/2023-04-01/sapsupportedsku/id_location.go b/resource-manager/workloads/2023-04-01/sapsupportedsku/id_location.go index 37fcacc164e..27a3f191002 100644 --- a/resource-manager/workloads/2023-04-01/sapsupportedsku/id_location.go +++ b/resource-manager/workloads/2023-04-01/sapsupportedsku/id_location.go @@ -34,15 +34,9 @@ func ParseLocationID(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -57,18 +51,26 @@ func ParseLocationIDInsensitively(input string) (*LocationId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := LocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + return &id, nil +} + +func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.LocationName, ok = parsed.Parsed["locationName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "locationName", *parsed) + if id.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) } - return &id, nil + return nil } // ValidateLocationID checks that 'input' can be parsed as a Location ID diff --git a/resource-manager/workloads/2023-04-01/sapvirtualinstances/id_sapvirtualinstance.go b/resource-manager/workloads/2023-04-01/sapvirtualinstances/id_sapvirtualinstance.go index a2020c1bde6..7bb7ed7a165 100644 --- a/resource-manager/workloads/2023-04-01/sapvirtualinstances/id_sapvirtualinstance.go +++ b/resource-manager/workloads/2023-04-01/sapvirtualinstances/id_sapvirtualinstance.go @@ -36,19 +36,9 @@ func ParseSapVirtualInstanceID(input string) (*SapVirtualInstanceId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SapVirtualInstanceId{} - - 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.SapVirtualInstanceName, ok = parsed.Parsed["sapVirtualInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sapVirtualInstanceName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseSapVirtualInstanceIDInsensitively(input string) (*SapVirtualInstanceId return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := SapVirtualInstanceId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *SapVirtualInstanceId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.SapVirtualInstanceName, ok = parsed.Parsed["sapVirtualInstanceName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "sapVirtualInstanceName", *parsed) + if id.SapVirtualInstanceName, ok = input.Parsed["sapVirtualInstanceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sapVirtualInstanceName", input) } - return &id, nil + return nil } // ValidateSapVirtualInstanceID checks that 'input' can be parsed as a Sap Virtual Instance ID